PageSourceSearch

https://glama.ai/client/_route-CNOtjlve.js

js glama.ai collected 2026-09-24 19:45:07 UTC 159,714 bytes, 18 lines download raw bytes

1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$t as t,Dt as n,Et as r,J as i,Pn as a,Pt as o,Sn as s,St as c,Wt as l,en as u,ft as d,gt as f,ht as p,it as m,kt as h,m as g,nn as _,pt as v,rt as y,un as b,xt as x}from"./react-rwOUWP5T.js";import{At as S,Dt as C,Er as w,Et as T,Lr as E,Or as D,Ot as O,Pr as k,Tr as A,Vr as j,Zt as M,bn as ee,ct as te,dt as ne,gn as N,gt as re,ir as ie,jr as P,jt as F,kr as I,kt as ae,lt as oe,mn as se,nr as ce,pt as le,q as ue,st as de,tt as fe,ut as pe,vn as me,wr as he,yn as ge}from"./core-Drge1c6l.js";import{a as _e,b as ve,c as L,d as ye,f as be,g as xe,h as Se,l as Ce,m as we,n as Te,o as Ee,p as De,r as Oe,s as ke,u as Ae,v as R}from"./_zod-compiler-runtime-CUZDFN44.js";import{S as z,g as je,o as Me,r as Ne}from"./form-BJx_GM55.js";import{t as Pe}from"./useLocalStorage-Bo49UbR1.js";import{i as Fe,o as Ie}from"./command-bar-BFZB_4aP.js";import{t as Le}from"./ProgressIndicator-Bdxx0LuH.js";import{r as B}from"./zu-B_l-1yEA.js";import{t as V}from"./Banner-CsDBjyL_.js";import{t as Re}from"./fireAndForget-Br5NEyTU.js";import{t as ze}from"./captureMessage-CxPJE05B.js";import{t as Be}from"./ChatSessionMenu-VIzZva-5.js";import{C as Ve,E as He,N as Ue,S as We,T as Ge,W as Ke,_ as qe,a as Je,c as Ye,d as Xe,f as Ze,g as Qe,h as $e,i as et,l as H,m as tt,o as nt,p as rt,s as it,u as at,v as ot,w as st,x as ct,y as lt}from"./editor-Bi3vKjkG.js";import{t as U}from"./object-equals.esm-xrPzOJ-4.js";import{t as ut}from"./plainTextExtensions-DAR-B4Ay.js";import{r as dt,t as ft}from"./Markdown-B0PnEvIz.js";import{t as W}from"./SyntaxHighlighter-DGYm7-Bt.js";import{c as pt,o as mt}from"./markdown-SwFlTXP5.js";import{a as ht,i as gt,n as _t,o as vt,r as G,t as yt}from"./CopyButton-gyjtd7f_.js";import{t as bt}from"./useToggle-B5BlhMDG.js";import{t as xt}from"./MessageDate-fwVJor_0.js";import{a as St,c as Ct,n as wt,o as Tt,s as Et,t as Dt}from"./lib-DGhj7KUU.js";import{a as Ot,i as kt,n as At,o as jt,r as Mt,t as K}from"./HostedLlmModelMenu-B-0UuMr8.js";import{t as Nt}from"./NoValue-DFR8j7p2.js";import{t as Pt}from"./usePrevious-nMxuop_l.js";import{t as Ft}from"./FileUpload.client-CeB_PYYd.js";import{t as It}from"./getAbsolutePath-dXY8czdH.js";import{t as Lt}from"./resolveTasks-aCpOs4Fv.js";import{t as Rt}from"./TipContent-DeL5-oPT.js";import{t as zt}from"./es-B2TmjUB1.js";var q=a(),J=i(),Y=e(s(),1),Bt=class extends Y.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){k.error(`client error boundary caught an error`,{error:e}),P({error:e,extra:{componentStack:t.componentStack},level:`error`,message:`client error boundary caught an error`}),I({description:e.message,title:`Something went wrong`,type:`error`})}render(){return this.state.error?this.props.fallback??null:this.props.children}},Vt=()=>{let e=_(),t=(0,Y.useRef)(e),n={},r=t.current;for(let t in e)r&&U(e[t],r[t])?n[t]=r[t]:(k.debug(`new loader value :key`,{key:t}),n[t]=e[t]);return t.current=n,n},Ht=()=>{let e=(0,Y.useRef)(1);return(0,Y.useEffect)(()=>{e.current+=1}),e.current},Ut=e=>{let t=(0,J.c)(5),{attributes:n}=e,[r]=se(`GLAMA_DEBUG`);if(!r)return null;let i;t[0]===n?i=t[1]:(i=Object.entries(n).map(Wt),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsxs)(`div`,{children:[`renders: `,(0,q.jsx)(Ht,{"data-sentry-element":`RenderCounter`,"data-sentry-source-file":`DebugDetail.tsx`})]}),t[2]=a):a=t[2];let o;return t[3]===i?o=t[4]:(o=(0,q.jsxs)(`div`,{className:`gMuvmc ezXLwI jsnJKs gFWrJr jrPWok jBowhj ATFzd ATFzw`,"data-sentry-component":`DebugDetail`,"data-sentry-source-file":`DebugDetail.tsx`,children:[i,a]}),t[3]=i,t[4]=o),o};function Wt(e){let[t,n]=e;return(0,q.jsxs)(`div`,{children:[t,`: `,String(n)]},t)}var Gt=({editor:e,mention:t})=>{e.commands.insertContent({text:` `,type:`text`}),e.commands.insertContent({attrs:{id:t.type+`:`+t.uid,label:t.name},type:`mention`}),e.commands.insertContent({text:` `,type:`text`}),e.commands.focus()},X=e=>{if(e.length===0)return[];let t=e.reduce((e,t)=>t.receivedAt>e.receivedAt?t:e),n=new Map(e.map(e=>[e.uid,e])),r=[],i=t;for(;i;){r.unshift(i);let e=i.parent?.uid;i=e?n.get(e):void 0}return r},Kt=({status:e})=>e===`queued`||e===`started`,qt=`bUhQuA hzfxld bMnvBR bUvkqG bYPztT jsCDPW cXhuSU bZRhvx fPSBzf hnMRLK jrPWok jRYfTR jsnMfm eAZrqn gEYBVn AxjtB hMIOua jTHIjJ ezkBTa`,Jt=e=>{let t=(0,J.c)(15),{editor:n}=e,r=_(),i;t[0]!==r.agents||t[1]!==n?(i=e=>{let t=r.agents.find(t=>t.uid===e.value);t&&Gt({editor:n,mention:{name:t.name,type:`agent`,uid:t.uid}})},t[0]=r.agents,t[1]=n,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a={placement:`top`},t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,q.jsx)(le,{asChild:!0,"data-sentry-element":`Me
1nu.Trigger`,"data-sentry-source-file":`AgentSelector.tsx`,children:(0,q.jsxs)(`button`,{className:`cHRCPr hDmuzH gVwcIi ldgVKi czsPJt jMiZUS bYPztT jsnJKs fSaIQG fPSBzf hnMRLK jrIcfy fNCCdc bYPznK dVuHSo gsJBgH`,type:`button`,children:[(0,q.jsx)(z,{name:`bot`,size:18,"data-sentry-element":`MaskIcon`,"data-sentry-source-file":`AgentSelector.tsx`}),(0,q.jsx)(`span`,{children:`Agents`})]})}),t[4]=o):o=t[4];let s;t[5]===r.agents?s=t[6]:(s=r.agents.length>0?(0,q.jsx)(oe,{children:r.agents.map(Yt)}):(0,q.jsx)(`p`,{className:`czikZZ jrPWok jRYfTR jTHIjJ`,children:`No installed agents.`}),t[5]=r.agents,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsx)(`hr`,{}),t[7]=c):c=t[7];let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,q.jsx)(te,{asChild:!0,value:`agent-settings`,"data-sentry-element":`Menu.Item`,"data-sentry-source-file":`AgentSelector.tsx`,children:(0,q.jsx)(w,{className:qt,to:D(`/settings/agents`),"data-sentry-element":`Link`,"data-sentry-source-file":`AgentSelector.tsx`,children:`Agent settings`})}),t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsxs)(oe,{"data-sentry-element":`Menu.ItemGroup`,"data-sentry-source-file":`AgentSelector.tsx`,children:[l,(0,q.jsx)(te,{asChild:!0,value:`how-to-use-agents`,"data-sentry-element":`Menu.Item`,"data-sentry-source-file":`AgentSelector.tsx`,children:(0,q.jsx)(w,{className:qt,target:`_blank`,to:`https://glama.ai/blog/2025-07-08-how-to-use-agents`,"data-sentry-element":`Link`,"data-sentry-source-file":`AgentSelector.tsx`,children:`How to use agents?`})})]}),t[9]=u):u=t[9];let d;t[10]===s?d=t[11]:(d=(0,q.jsx)(g,{"data-sentry-element":`Portal`,"data-sentry-source-file":`AgentSelector.tsx`,children:(0,q.jsx)(pe,{"data-sentry-element":`Menu.Positioner`,"data-sentry-source-file":`AgentSelector.tsx`,children:(0,q.jsxs)(de,{className:`koremC jDOzgL jsnJKs irhbZF ATHag`,"data-sentry-element":`Menu.Content`,"data-sentry-source-file":`AgentSelector.tsx`,children:[s,c,u]})})}),t[10]=s,t[11]=d);let f;return t[12]!==i||t[13]!==d?(f=(0,q.jsxs)(ne,{lazyMount:!0,onSelect:i,positioning:a,"data-sentry-element":`Menu.Root`,"data-sentry-component":`AgentSelector`,"data-sentry-source-file":`AgentSelector.tsx`,children:[o,d]}),t[12]=i,t[13]=d,t[14]=f):f=t[14],f};function Yt(e){return(0,q.jsx)(te,{asChild:!0,value:e.uid,children:(0,q.jsxs)(`button`,{className:qt,type:`button`,children:[(0,q.jsx)(`span`,{className:`ThbyN`,children:`agent`}),(0,q.jsx)(`span`,{children:e.name})]})},e.uid)}var Xt=`cHRCPr hDmuzH gVwcIi ldgVKi czsPJt jMiZUS bYPztT jsCDPW cXhuSU bZRhvx fPSBzf hnMRLK jrPWok jRYfTR jsnMfm eAZrqn gEYBVn AxjtB hMIOua jTHIjJ ezkBTa`,Zt=e=>{let t=(0,J.c)(18),{editor:n}=e,r=_(),i;t[0]!==r.mcpConnectionProfiles||t[1]!==n?(i=e=>{let t=r.mcpConnectionProfiles.find(t=>t.uid===e.value);t&&Gt({editor:n,mention:{name:t.name,type:`mcp`,uid:t.uid}})},t[0]=r.mcpConnectionProfiles,t[1]=n,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a={placement:`top`},t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,q.jsx)(le,{asChild:!0,"data-sentry-element":`Menu.Trigger`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:(0,q.jsxs)(`button`,{className:`cHRCPr hDmuzH gVwcIi ldgVKi czsPJt jMiZUS bYPztT jsnJKs fSaIQG fPSBzf hnMRLK jrIcfy fNCCdc bYPznK dVuHSo gsJBgH`,type:`button`,children:[(0,q.jsx)(z,{name:`simpleicons-modelcontextprotocol`,size:18,"data-sentry-element":`MaskIcon`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`}),(0,q.jsx)(`span`,{children:`MCP`})]})}),t[4]=o):o=t[4];let s;t[5]===r.mcpConnectionProfiles?s=t[6]:(s=r.mcpConnectionProfiles.length>0?(0,q.jsx)(oe,{children:r.mcpConnectionProfiles.map(Z)}):(0,q.jsx)(`p`,{className:`czikZZ jrPWok jRYfTR jTHIjJ`,children:`No MCP connection profiles.`}),t[5]=r.mcpConnectionProfiles,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsx)(`hr`,{}),t[7]=c):c=t[7];let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=D(`/mcp/servers`),t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(te,{asChild:!0,value:`browse-mcp-servers`,"data-sentry-element":`Me
1nu.Item`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:(0,q.jsxs)(w,{className:Xt,target:`_blank`,to:l,"data-sentry-element":`Link`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:[(0,q.jsx)(`span`,{className:`hlUslA`,children:`Browse MCP servers`}),(0,q.jsx)(z,{color:`#7d8284`,name:`external-link`,size:14,"data-sentry-element":`MaskIcon`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`})]})}),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,q.jsx)(te,{asChild:!0,value:`mcp-hosting`,"data-sentry-element":`Menu.Item`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:(0,q.jsx)(w,{className:Xt,to:D(`/settings/mcp/deployments`),"data-sentry-element":`Link`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:`MCP Deployments`})}),t[10]=d):d=t[10];let f;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,q.jsx)(te,{asChild:!0,value:`mcp-connectors`,"data-sentry-element":`Menu.Item`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:(0,q.jsx)(w,{className:Xt,to:D(`/settings/mcp/connectors`),"data-sentry-element":`Link`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:`MCP Connectors`})}),t[11]=f):f=t[11];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,q.jsxs)(oe,{"data-sentry-element":`Menu.ItemGroup`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:[u,d,f,(0,q.jsx)(te,{asChild:!0,value:`how-to-use-mcp`,"data-sentry-element":`Menu.Item`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:(0,q.jsx)(w,{className:Xt,target:`_blank`,to:`https://glama.ai/blog/2025-07-08-how-to-install-and-use-mcp-servers`,"data-sentry-element":`Link`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:`How to use MCP?`})})]}),t[12]=p):p=t[12];let m;t[13]===s?m=t[14]:(m=(0,q.jsx)(g,{"data-sentry-element":`Portal`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:(0,q.jsx)(pe,{"data-sentry-element":`Menu.Positioner`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:(0,q.jsxs)(de,{className:`koremC jDOzgL jsnJKs irhbZF ATHag`,"data-sentry-element":`Menu.Content`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:[s,c,p]})})}),t[13]=s,t[14]=m);let h;return t[15]!==i||t[16]!==m?(h=(0,q.jsxs)(ne,{lazyMount:!0,onSelect:i,positioning:a,"data-sentry-element":`Menu.Root`,"data-sentry-component":`McpConnectionProfileSelector`,"data-sentry-source-file":`McpConnectionProfileSelector.tsx`,children:[o,m]}),t[15]=i,t[16]=m,t[17]=h):h=t[17],h};function Z(e){return(0,q.jsx)(te,{asChild:!0,value:e.uid,children:(0,q.jsxs)(`button`,{className:Xt,type:`button`,children:[(0,q.jsxs)(`div`,{className:`fPSBzf hnMRLK hlUslA jsnMfm`,children:[(0,q.jsx)(`span`,{className:`ThbyN`,children:`mcp`}),(0,q.jsx)(`span`,{children:e.name})]}),(0,q.jsx)(`div`,{className:`bYPztT fPSBzf bYPznK jsnkmj`,children:(0,q.jsx)(M,{color:e.health===`healthy`?`#12b981`:e.health===`unhealthy`?`#ff0000`:`#d29922`})})]})},e.uid)}var Qt=`hrtDQD bYPztT cLJfRK jsnJKs vjReU bZRhvx fPSBzf zlTvE jrPWok jRXFuD jsnMfm dTmrYJ kFYoVQ`,$t=e=>{let t=(0,J.c)(16),{intent:n,onReset:r}=e;if(n===`search-web`){let e;t[0]===r?e=t[1]:(e=()=>{r()},t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,q.jsx)(z,{name:`globe`,size:18}),t[2]=n):n=t[2];let i;t[3]===e?i=t[4]:(i=(0,q.jsxs)(`div`,{className:Qt,onClick:e,children:[n,`Search`]}),t[3]=e,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(`p`,{className:`czikZZ jrPWok`,children:`Performs a web search.`}),t[5]=a):a=t[5];let o;return t[6]===i?o=t[7]:(o=(0,q.jsxs)(`div`,{className:`felzIp fPSBzf hnMRLK jrIcfy`,children:[i,a]}),t[6]=i,t[7]=o),o}if(n===`research`){let e;t[8]===r?e=t[9]:(e=()=>{r()},t[8]=r,t[9]=e);let n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,q.jsx)(z,{name:`microscope`,size:18}),t[10]=n):n=t[10];let i;t[11]===e?i=t[12]:(i=(0,q.jsxs)(`div`,{className:Qt,onClick:e,children:[n,`Research`]}),t[11]=e,t[12]=i);let a;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(`p`,{className:`czikZZ jrPWok`,children:`Performs a deep web search.`}),t[13]=a):a=t[13];let o;return t[14]===i?o=t[15]:(o=(0,q.jsxs)(`div`,{className:`felzIp fPSBzf hnMRLK jrIcfy`,children:[i,a]}),t[14]=i,t[15]=o),o}if(n===`chat`)return null;throw new E(`Unexpected intent`,{extra:{intent:n}})},en=`cHRCPr hDmuzH gVwcIi ldgVKi czsPJt jMiZUS bYPztT jsnJKs fSaIQG fPSBzf hnMRLK jrIcfy fNCCdc bYPznK dVuHSo gsJBgH`,tn=e=>{let t=(0,J.c)(41),{beforeAttachControl:n,editor:r,intent:i,onEnterSubmit:a,onOpenFileDialog:o,onStop:s,progressing:c,setIntent:l,submitting:u,syncedIndication:d,uploading:f}=e,p,m;t[0]===r?(p=t[1],m=t[2]):(p=e=>{let t=()=>{e()};return r.on(`update`,t),()=>{r.off(`update`,t)}},m=()=>r.getText(),t[0]=r,t[1]=p,t[2]=m);let h=(0,Y.useSyncExternalStore)(p,m,nn),g=u||f,_;t[3]!==r||t[4]!==a?(_=e=>{e.preventDefault(),a({editor:r})},t[3]=r,t[4]=a,t[5]=_):_=t[5];let v;t[6]===d?v=t[7]:(v=d?(0,q.jsx)(`div`,{className:`llOPUI jsCDPW brESqQ jsOvvq fugysR cERSkX jXSfKH dkLiAR dKLBxC kFYoVQ fzozCb`,children:`synced`}):null,t[6]=d,t[7]=v);let y;t[8]===r?y=t[9]:(y=(0,q.jsx)(He,{editor:r,"data-sentry-element":`EditorContent`,"data-sentry-source-file":`MessageForm.tsx`}),t[8]=r,t[9]=y);let b;t[10]!==v||t[11]!==y?(b=(0,q.jsxs)(`div`,{className:`jTWvec`,children:[v,y]}),t[10]=v,t[11]=y,t[12]=b):b=t[12];let x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,q.jsx)(z,{name:`paperclip`,size:18,"data-sentry-element":`MaskIcon`,"data-sentry-source-file":`MessageForm.tsx`}),t[13]=x):x=t[13];let S;t[14]!==g||t[15]!==o?(S=(0,q.jsx)(`button`,{className:en,disabled:g,onClick:o,type:`button`,children:x}),t[14]=g,t[15]=o,t[16]=S):S=t[16];let C,w;t[17]===r?(C=t[18],w=t[19]):(w=(0,q.jsx)(Zt,{editor:r,"data-sentry-element":`McpConnectionProfileSelector`,"data-sentry-source-file":`MessageForm.tsx`}),C=(0,q.jsx)(Jt,{editor:r,"data-sentry-element":`AgentSelector`,"data-sentry-source-file":`MessageForm.tsx`}),t[17]=r,t[18]=C,t[19]=w);let T;t[20]!==n||t[21]!==C||t[22]!==S||t[23]!==w?(T=(0,q.jsxs)(`div`,{className:`bYPztT fPSBzf hnMRLK jrIcfy`,children:[n,S,w,C]}),t[20]=n,t[21]=C,t[22]=S,t[23]=w,t[24]=T):T=t[24];let E;t[25]!==g||t[26]!==s||t[27]!==c||t[28]!==h?(E=(0,q.jsx)(`div`,{className:`bYPztT fPSBzf hnMRLK jrIcfy`,children:c&&s?(0,q.jsx)(`button`,{className:en,onClick:s,title:`Stop generating (Esc)`,type:`button`,children:(0,q.jsx)(z,{name:`square`,size:18})}):(0,q.jsx)(`button`,{className:en,disabled:h.trim().length===0||g||c,type:`submit`,children:(0,q.jsx)(z,{name:`arrow-up`,size:18})})}),t[25]=g,t[26]=s,t[27]=c,t[28]=h,t[29]=E):E=t[29];let D;t[30]!==T||t[31]!==E?(D=(0,q.jsxs)(`div`,{className:`fPSBzf hnMRLK jrIcfy dDWCpe`,children:[T,E]}),t[30]=T,t[31]=E,t[32]=D):D=t[32];let O;t[33]!==i||t[34]!==l?(O=i?(0,q.jsx)($t,{intent:i,onReset:()=>l(`chat`)}):null,t[33]=i,t[34]=l,t[35]=O):O=t[35];let k;return t[36]!==D||t[37]!==O||t[38]!==_||t[39]!==b?(k=(0,q.jsxs)(`form`,{className:`bwOuOz imQOig jUrcmX iCCQiI ghioyV dEHSnZ dDDGnV imVWwP lhQfvL iSXlKz fPSBzf bnYmbW jrIcfy krgSwD`,"data-testid":`message-form`,onSubmit:_,"data-sentry-component":`MessageForm`,"data-sentry-source-file":`MessageForm.tsx`,children:[b,D,O]}),t[36]=D,t[37]=O,t[38]=_,t[39]=b,t[40]=k):k=t[40],k};function nn(){return``}var rn=e=>{let t=(0,J.c)(2),{state:n}=e;if(n===`idle`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(`span`,{className:`CeBbJ cERSkX jTWvec kFYoVQ`,children:(0,q.jsx)(`span`,{className:`cPcLnU knVeeC gFWrJr`,children:`█`})}),t[0]=e):e=t[0],e}let r;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsxs)(`span`,{className:`jOyLAO CeBbJ cERSkX jTWvec kFYoVQ`,"data-sentry-component":`TypingIndicator`,"data-sentry-source-file":`TypingIndicator.tsx`,children:[(0,q.jsx)(`span`,{className:`cjMzOL kyGdCf kiKDyH gp
1QeaC jXSfKH qbeer dZDlsz jsxjDG`}),(0,q.jsx)(`span`,{className:`dvZdhQ kyGdCf kiKDyH jXSfKH qbeer dZDlsz jsxjDG`})]}),t[1]=r):r=t[1],r},an=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),on=function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)},sn=function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-->0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a},cn=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},ln=function(e){an(t,e);function t(){return e.call(this,`EventSource not available.
2Consider loading an EventSource polyfill and making it available globally as EventSource, or passing one in as eventSourceClass to the ReconnectingEventSource constructor.`)||this}return t}(Error),un=function(){function e(e,t){var n=this;if(this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,this._configuration=t==null?void 0:Object.assign({},t),this.withCredentials=!1,this._eventSource=null,this._lastEventId=null,this._timer=null,this._listeners={},this.url=e.toString(),this.readyState=this.CONNECTING,this.max_retry_time=3e3,this.eventSourceClass=globalThis.EventSource,this._configuration!=null&&(this._configuration.lastEventId&&(this._lastEventId=this._configuration.lastEventId,delete this._configuration.lastEventId),this._configuration.max_retry_time&&(this.max_retry_time=this._configuration.max_retry_time,delete this._configuration.max_retry_time),this._configuration.eventSourceClass&&(this.eventSourceClass=this._configuration.eventSourceClass,delete this._configuration.eventSourceClass)),this.eventSourceClass==null||typeof this.eventSourceClass!=`function`)throw new ln;this._onevent_wrapped=function(e){n._onevent(e)},this._start()}return e.prototype.dispatchEvent=function(e){throw Error(`Method not implemented.`)},e.prototype._start=function(){var e,t,n=this,r=this.url;this._lastEventId&&(r.indexOf(`?`)===-1?r+=`?`:r+=`&`,r+=`lastEventId=`+encodeURIComponent(this._lastEventId)),this._eventSource=new this.eventSourceClass(r,this._configuration),this._eventSource.onopen=function(e){n._onopen(e)},this._eventSource.onerror=function(e){n._onerror(e)},this._eventSource.onmessage=function(e){n.onmessage(e)};try{for(var i=on(Object.keys(this._listeners)),a=i.next();!a.done;a=i.next()){var o=a.value;this._eventSource.addEventListener(o,this._onevent_wrapped)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},e.prototype._onopen=function(e){this.readyState===0&&(this.readyState=1,this.onopen(e))},e.prototype._onerror=function(e){var t=this;if(this.readyState===1&&(this.readyState=0,this.onerror(e)),this._eventSource&&this._eventSource.readyState===2){this._eventSource.close(),this._eventSource=null;var n=Math.round(this.max_retry_time*Math.random());this._timer=setTimeout(function(){return t._start()},n)}},e.prototype._onevent=function(e){var t,n;e instanceof MessageEvent&&(this._lastEventId=e.lastEventId);var r=this._listeners[e.type];if(r!=null)try{for(var i=on(cn([],sn(r),!1)),a=i.next();!a.done;a=i.next())a.value.call(this,e)}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.type===`message`&&this.onmessage(e)},e.prototype.onopen=function(e){},e.prototype.onerror=function(e){},e.prototype.onmessage=function(e){},e.prototype.close=function(){this._timer&&=(clearTimeout(this._timer),null),this._eventSource&&=(this._eventSource.close(),null),this.readyState=2},e.prototype.addEventListener=function(e,t,n){e in this._listeners||(this._listeners[e]=[],this._eventSource!=null&&this._eventSource.addEventListener(e,this._onevent_wrapped));var r=this._listeners[e];Array.isArray(r)&&!r.includes(t)&&r.push(t)},e.prototype.removeEventListener=function(e,t,n){var r=this._listeners[e];if(r!=null){for(;;){var i=r.indexOf(t);if(i===-1)break;r.splice(i,1)}r.length<=0&&(delete this._listeners[e],this._eventSource!=null&&this._eventSource.removeEventListener(e,this._onevent_wrapped))}},e.CONNECTING=0,e.OPEN=1,e.CLOSED=2,e}(),Q=new class{closeTimeouts=new Map;connectionStatus=new Map;listeners=new Map;sourceListeners=new Map;sources=new Map;statusListeners=new Map;connect(e){if(this.sources.has(e))return;let t=new un(e);this.setConnectionStatus(e,`connecting`);let n=()=>{this.setConnectionStatus(e,`open`)},r=t=>{let n=t;for(let[t,r]of this.listeners)if(r===e){if(n.data===`[DONE]`){this.handleStreamEnd(e);return}t(n.data)}},i=t=>{let n=this.connectionStatus.get(e);if(!n){ze({extra:{error:t,url:e},level:`warning`,message:`EventSource error: no connection status`});return}n!==`closed`&&(t.target.readyState===EventSource.CLOSED?this.handleStreamEnd(e):(ze({extra:{error:t,url:e},level:`warning`,message:`EventSource error`}),this.setConnectionStatus(e,`error`)))};t.addEventListener(`open`,n),t.addEventListener(`message`,r),t.addEventListener(`error`,i),this.sourceListeners.set(e,{error:i,message:r,open:n}),this.sources.set(e,t)}disconnect(e){let t=this.sources.get(e);if(t){let n=this.sourceListeners.get(e);n&&(t.removeEventListener(`open`,n.open),t.removeEventListener(`message`,n.message),t.removeEventListener(`error`,
2n.error),this.sourceListeners.delete(e)),t.close(),this.sources.delete(e)}this.connectionStatus.delete(e),this.cancelCloseTimeout(e)}subscribe(e,t,n){let r=this.listeners.get(e);r&&r!==n&&this.unsubscribe(e,t),this.listeners.set(e,n),this.statusListeners.set(t,n),this.connect(n),this.cancelCloseTimeout(n);let i=this.connectionStatus.get(n);i&&t(i)}unsubscribe(e,t){let n=this.listeners.get(e);if(n&&(this.listeners.delete(e),this.statusListeners.delete(t),!(Array.from(this.listeners.values()).includes(n)||Array.from(this.statusListeners.values()).includes(n)))){let e=setTimeout(()=>{this.disconnect(n)},1e3);this.closeTimeouts.set(n,e)}}cancelCloseTimeout(e){let t=this.closeTimeouts.get(e);t&&(clearTimeout(t),this.closeTimeouts.delete(e))}handleStreamEnd(e){this.setConnectionStatus(e,`closed`),setTimeout(()=>{this.connectionStatus.get(e)===`closed`&&this.disconnect(e)},100)}setConnectionStatus(e,t){this.connectionStatus.set(e,t);for(let[n,r]of this.statusListeners)r===e&&n(t)}},dn=e=>{let t=(0,J.c)(7),[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(`connecting`),[o,s]=(0,Y.useState)(),c=(0,Y.useRef)(!0);!e&&i!==`closed`&&(r(null),a(`closed`),s(void 0));let l,u;t[0]===e?(l=t[1],u=t[2]):(l=()=>{if(c.current=!0,!e)return;let t=null,n=null,i=e=>{c.current&&(n=e,t===null&&(t=requestAnimationFrame(()=>{t=null,c.current&&n!==null&&(r(n),n=null)})))},o=e=>{c.current&&(a(e),e===`error`&&s(Error(`EventSource connection error`)))};return Q.subscribe(i,o,e),()=>{c.current=!1,t!==null&&cancelAnimationFrame(t),Q.unsubscribe(i,o)}},u=[e],t[0]=e,t[1]=l,t[2]=u),(0,Y.useEffect)(l,u);let d;return t[3]!==n||t[4]!==o||t[5]!==i?(d={data:n,error:o,status:i},t[3]=n,t[4]=o,t[5]=i,t[6]=d):d=t[6],d},fn=2,pn=(e,t)=>{let[n,r]=(0,Y.useState)(e),[i,a]=(0,Y.useState)(!1),o=(0,Y.useRef)(e),s=(0,Y.useRef)(e.length),c=(0,Y.useRef)(null),l=(0,Y.useRef)(fn),u=(0,Y.useRef)(t),d=(0,Y.useRef)(e.length),f=(0,Y.useRef)(0),p=(0,Y.useRef)(0);if(o.current=e,t&&e.length>d.current){let t=performance.now(),n=e.length-d.current;if(d.current=e.length,f.current===0)f.current=t,p.current=n;else{p.current+=n;let e=t-f.current;if(e>500){let n=p.current/e,r=Math.round(n*24);l.current=Math.max(fn,r),f.current=t,p.current=0}}}let m=!t&&u.current;return u.current=t,!t&&!i&&(m&&s.current<d.current?a(!0):n!==e&&(s.current=e.length,d.current=e.length,r(e))),(0,Y.useEffect)(()=>{if(!t&&!i)return;t&&(f.current=0,p.current=0,l.current=fn,a(!1));let e=()=>{let t=o.current,n=s.current;if(t.length-n>0){let i=Math.min(n+l.current,t.length);s.current=i,r(t.slice(0,i)),c.current=requestAnimationFrame(e)}else i?(a(!1),c.current=null):c.current=requestAnimationFrame(e)};return c.current=requestAnimationFrame(e),()=>{c.current!==null&&(cancelAnimationFrame(c.current),c.current=null)}},[t,i]),n},mn=e=>{if(e.length!==0)return e[e.length-1]},hn=e=>{let t=(0,J.c)(18),{chatMessage:n,editing:r,focused:i}=e,a=l(),o;t[0]!==n.uid||t[1]!==a?(o=()=>{a.submit(new FormData,{action:D(`/api/message/:uid/delete`,{params:{uid:n.uid}}),method:`post`})},t[0]=n.uid,t[1]=a,t[2]=o):o=t[2];let s=o,c;t[3]===s?c=t[4]:(c=()=>{s()},t[3]=s,t[4]=c);let u=!r&&i,d;t[5]!==c||t[6]!==u?(d={callback:c,enabled:u,key:`d`},t[5]=c,t[6]=u,t[7]=d):d=t[7],ht(d);let f=a.state===`idle`?`hzfxld DhpGJ bUvkqG bYPztT jsnJKs bZRhvx fPSBzf zlTvE jsnMfm bYPznK ATHag`:`hzfxld DhpGJ bUvkqG bYPztT jsnJKs fyplMZ fPSBzf zlTvE jsnMfm bYPznK ATHag jGqhgM`,p=a.state!==`idle`,m;t[8]===s?m=t[9]:(m=()=>{s()},t[8]=s,t[9]=m);let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,q.jsx)(z,{name:`trash-2`,size:14,"data-sentry-element":`MaskIcon`,"data-sentry-source-file":`DeleteButton.tsx`}),t[10]=h):h=t[10];let g;t[11]===i?g=t[12]:(g=i?(0,q.jsx)(`kbd`,{className:_t,children:`d`}):null,t[11]=i,t[12]=g);let _;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==g?(_=(0,q.jsx)(ue,{content:`Delete`,"data-sentry-element":`SimpleTooltip`,"data-sentry-component":`DeleteButton`,"data-sentry-source-file":`DeleteButton.tsx`,children:(0,q.jsxs)(`button`,{className:f,disabled:p,onClick:m,type:`button`,children:[h,g]})}),t[13]=f,t[14]=p,t[15]=m,t[16]=g,t[17]=_):_=t[17],_},gn=e=>{let t=(0,J.c)(20),{chatMessage:n,editing:r,focused:i}=e,a=l(),o;t[0]!==n.uid||t[1]!==a?(o=()=>{a.submit(new FormData,{action:D(`/api/message/:uid/fork`,{params:{uid:n.uid}}),method:`post`})},t[0]=n.uid,t[1]=a,t[2]=o):o=t[2];let s=o,c;t[3]===s?c=t[4]:(c=()=>{s()},t[3]=s,t[4]=c);let u=!r&&i,d;t[5]!==c||t[6]!==u?(d={callback:c,enabled:u,key:`f`},t[5]=c,t[6]=u,t[7]=d):d=t[7],ht(d);let f;t[8]===n.uid?f=t[9]:(f=D(`/api/message/:uid/fork`,{params:{uid:n.uid}}),t[8]=n.uid,t[9]=f);let p=a.state===`idle`?`hzfxld DhpGJ bUvkqG bYPztT jsnJKs bZRhvx fPSBzf zlTvE jsnMfm bYPznK ATHag`:`hzfxld DhpGJ bUvkqG bYPztT jsnJKs fyplMZ fPSBzf zlTvE jsnMfm bYPznK ATHag jGqhgM`,m=a.state!==`idle`,h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,q.jsx)(z,{name:`split`,size:14,"data-sentry-element":`MaskIcon`,"data-sentry-source-file":`ForkButton.tsx`}),t[10]=h):h=t[10];let g;t[11]===i?g=t[12]:(g=i?(0,q.jsx)(`kbd`,{className:_t,children:`f`}):null,t[11]=i,t[12]=g);let _;t[13]!==p||t[14]!==m||t[15]!==g?(_=(0,q.jsxs)(`button`,{className:p,disabled:m,type:`submit`,children:[h,g]}),t[13]=p,t[14]=m,t[15]=g,t[16]=_):_=t[16];let v;return t[17]!==_||t[18]!==f?(v=(0,q.jsx)(ue,{content:`Fork`,"data-sentry-element":`SimpleTooltip`,"data-sentry-component":`ForkButton`,"data-sentry-source-file":`ForkButton.tsx`,children:(0,q.jsx)(`form`,{action:f,method:`post`,target:`_blank`,children:_})}),t[17]=_,t[18]=f,t[19]=v):v=t[19],v},$=e=>{let t=(0,J.c)(5),{completionRequest:n}=e,r;t[0]===n.referenceId?r=t[1]:(r=D(`/settings/logs/:referenceId`,{params:{referenceId:n.referenceId}}),t[0]=n.referenceId,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(z,{name:`info`,size:14,"data-sentry-element":`MaskIcon`,"data-sentry-source-file":`InspectButton.tsx`}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,q.jsx)(ue,{content:`Inspect`,"data-sentry-element":`SimpleTooltip`,"data-sentry-component":`InspectButton`,"data-sentry-source-file":`InspectButton.tsx`,children:(0,q.jsx)(w,{className:`hzfxld DhpGJ bUvkqG bYPztT jsnJKs bZRhvx fPSBzf zlTvE jsnMfm bYPznK ATHag`,to:r,type:`button`,"data-sentry-element":`Link`,"data-sentry-source-file":`InspectButton.tsx`,children:i})}),t[3]=r,t[4]=a),a},_n=e=>{let t=(0,J.c)(18),{chatMessage:n,editing:r,focused:i}=e,a=l(),[o,s]=(0,Y.useState)(!1),c;t[0]!==n.uid||t[1]!==a?(c=()=>{s(!0),a.submit(new FormData,{action:D(`/api/message/:uid/retry`,{params:{uid:n.uid}}),method:`post`})},t[0]=n.uid,t[1]=a,t[2]=c):c=t[2];let u=c,d;t[3]===u?d=t[4]:(d=()=>{u()},t[3]=u,t[4]=d);let f=!r&&i,p;t[5]!==d||t[6]!==f?(p={callback:d,enabled:f,key:`r`},t[5]=d,t[6]=f,t[7]=p):p=t[7],ht(p);let m=o?`hzfxld DhpGJ bUvkqG bYPztT jsnJKs fyplMZ fPSBzf zlTvE jsnMfm bYPznK ATHag jGqhgM`:`hzfxld DhpGJ bUvkqG bYPztT jsnJKs bZRhvx fPSBzf zlTvE jsnMfm bYPznK ATHag`,h;t[8]===u?h=t[9]:(h=()=>{u()},t[8]=u,t[9]=h);let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,q.jsx)(z,{name:`refresh-ccw`,size:14,"data-sentry-element":`MaskIcon`,"data-sentry-source-file":`RetryButton.tsx`}),t[10]=g):g=t[10];let _;t[11]===i?_=t[12]:(_=i?(0,q.jsx)(`kbd`,{className:_t,children:`r`}):null,t[11]=i,t[12]=_);let v;return t[13]!==o||t[14]!==m||t[15]!==h||t[16]!==_?(v=(0,q.jsx)(ue,{content:`Retry`,"data-sentry-element":`SimpleTooltip`,"data-sentry-component":`RetryButton`,"data-sentry-source-file":`RetryButton.tsx`,children:(0,q.jsxs)(`button`,{className:m,disabled:o,onClick:h,type:`button`,children:[g,_]})}
2),t[13]=o,t[14]=m,t[15]=h,t[16]=_,t[17]=v):v=t[17],v},vn=e=>{let t=(0,J.c)(57),{chatMessage:n,editing:r,focused:i,format:a,toggleEditing:o,toggleFormat:s}=e,c;t[0]===n.assistantResponses?c=t[1]:(c=mn(n.assistantResponses),t[0]=n.assistantResponses,t[1]=c);let l=c,u;t[2]===i?u=t[3]:(u=i?(0,q.jsx)(`kbd`,{className:_t,children:`e`}):null,t[2]=i,t[3]=u);let d;t[4]!==r||t[5]!==u||t[6]!==o?(d=(0,q.jsxs)(`button`,{className:G,"data-disabled":r,onClick:o,type:`button`,children:[`Edit`,u]}),t[4]=r,t[5]=u,t[6]=o,t[7]=d):d=t[7];let f=a===`markdown`?`Markdown`:a===`plain-text`?`Plain Text`:`Pretty`,p;t[8]!==f||t[9]!==s?(p=(0,q.jsx)(`button`,{className:G,onClick:s,type:`button`,children:f}),t[8]=f,t[9]=s,t[10]=p):p=t[10];let m;t[11]===n.agentChatSession?m=t[12]:(m=n.agentChatSession?(0,q.jsxs)(w,{className:`hzfxld DhpGJ bUvkqG bYPztT jsnJKs bZRhvx fPSBzf zlTvE jsnMfm bYPznK ATHag`,to:D(`/chat/:uid`,{params:{uid:n.agentChatSession.uid}}),children:[(0,q.jsx)(z,{name:`bot`,size:14}),(0,q.jsx)(`span`,{children:n.agentChatSession.agent.name})]}):null,t[11]=n.agentChatSession,t[12]=m);let h;t[13]!==n.content.content||t[14]!==r||t[15]!==i?(h=(0,q.jsx)(yt,{content:n.content.content,editing:r,focused:i,"data-sentry-element":`CopyButton`,"data-sentry-source-file":`AssistantMessageFooter.tsx`}),t[13]=n.content.content,t[14]=r,t[15]=i,t[16]=h):h=t[16];let g;t[17]!==n||t[18]!==r||t[19]!==i?(g=n.parent?.role===`user`?(0,q.jsx)(_n,{chatMessage:{...n,parent:n.parent},editing:r,focused:i}):null,t[17]=n,t[18]=r,t[19]=i,t[20]=g):g=t[20];let _,v;t[21]!==n||t[22]!==r||t[23]!==i?(v=(0,q.jsx)(gn,{chatMessage:n,editing:r,focused:i,"data-sentry-element":`ForkButton`,"data-sentry-source-file":`AssistantMessageFooter.tsx`}),_=(0,q.jsx)(hn,{chatMessage:n,editing:r,focused:i,"data-sentry-element":`DeleteButton`,"data-sentry-source-file":`AssistantMessageFooter.tsx`}),t[21]=n,t[22]=r,t[23]=i,t[24]=_,t[25]=v):(_=t[24],v=t[25]);let y;t[26]===l?y=t[27]:(y=l?.completionRequest?(0,q.jsx)($,{completionRequest:l.completionRequest}):null,t[26]=l,t[27]=y);let b;t[28]!==_||t[29]!==y||t[30]!==h||t[31]!==g||t[32]!==v?(b=(0,q.jsxs)(`div`,{className:`bYPztT fPSBzf hnMRLK jsnMfm`,children:[h,g,v,_,y]}),t[28]=_,t[29]=y,t[30]=h,t[31]=g,t[32]=v,t[33]=b):b=t[33];let x;t[34]!==b||t[35]!==d||t[36]!==p||t[37]!==m?(x=(0,q.jsxs)(`div`,{className:`bYPztT czikZZ fPSBzf bAasmd jrPWok jrIcfy dYDBYd`,"data-part":`actions`,children:[d,p,m,b]}),t[34]=b,t[35]=d,t[36]=p,t[37]=m,t[38]=x):x=t[38];let E;t[39]===l?E=t[40]:(E=l?(0,q.jsx)(`span`,{className:`cbkwRf`,title:l.hostedLlmModel.name,children:l.hostedLlmModel.llmModel.alias??l.hostedLlmModel.llmModel.name}):null,t[39]=l,t[40]=E);let k;t[41]===n.receivedAt?k=t[42]:(k=(0,q.jsx)(xt,{date:n.receivedAt,"data-sentry-element":`MessageDate`,"data-sentry-source-file":`AssistantMessageFooter.tsx`}),t[41]=n.receivedAt,t[42]=k);let A;t[43]!==n.role||t[44]!==l?.status?(A=n.role===`assistant`&&l?.status===`aborted`?(0,q.jsx)(`span`,{className:`jJhssH`,children:(0,q.jsxs)(S,{lazyMount:!0,openDelay:100,children:[(0,q.jsx)(F,{children:`Aborted`}),(0,q.jsxs)(ae,{children:[(0,q.jsx)(T,{children:(0,q.jsx)(C,{})}),(0,q.jsx)(O,{children:`The assistant response was interrupted because the client has navigated away from the chat.`})]})]})}):null,t[43]=n.role,t[44]=l?.status,t[45]=A):A=t[45];let j;t[46]!==n.role||t[47]!==l?.status?(j=n.role===`assistant`&&l?.status===`interrupted`?(0,q.jsx)(`span`,{className:`jJhssH`,children:(0,q.jsxs)(S,{lazyMount:!0,openDelay:100,children:[(0,q.jsx)(F,{children:`Interrupted`}),(0,q.jsxs)(ae,{children:[(0,q.jsx)(T,{children:(0,q.jsx)(C,{})}),(0,q.jsx)(O,{children:`The assistant response was interrupted because the client has asked to stop the response.`})]})]})}):null,t[46]=n.role,t[47]=l?.status,t[48]=j):j=t[48];let M;t[49]!==E||t[50]!==k||t[51]!==A||t[52]!==j?(M=(0,q.jsxs)(`div`,{className:`bYPztT czikZZ fPSBzf hnMRLK jrPWok jrIcfy dYDBYd`,children:[E,k,A,j]}),t[49]=E,t[50]=k,t[51]=A,t[52]=j,t[53]=M):M=t[53];let ee;return t[54]!==x||t[55]!==M?(ee=(0,q.jsx)(`div`,{className:`message-footer`,"data-sentry-component":`AssistantMessageFooter`,"data-sentry-source-file":`AssistantMessageFooter.tsx`,children:(0,q.jsxs)(`div`,{className:`fPSBzf hnMRLK jrIcfy dDWCpe`,"data-
2part":`main`,children:[x,M]})}),t[54]=x,t[55]=M,t[56]=ee):ee=t[56],ee},yn=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},bn=10,xn=13,Sn=32,Cn=6;function wn(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{maxBufferSize:t,onComment:n,onError:r,onEvent:i,onId:a,onRetry:o}=e,s=[],c=0,l=!0,u,d=``,f=0,p,m=!1,h=!1,g=!1;function _(e){if(m)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,e.charCodeAt(0)===65279?e=e.slice(1):e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),(h||g)&&(e=v(e),!e))return;if(!s.length){let t=S(e);t!==``&&y(t),x();return}if(e.indexOf(`
3`)===-1&&e.indexOf(`\r`)===-1){if(c<Cn&&!b(s.join(``)+e.slice(0,Cn-c))){s.length=0,c=0,h=!0;return}s.push(e),c+=e.length,x();return}s.push(e);let t=s.join(``);s.length=0,c=0,y(S(t)),x()}function v(e){if(e.length===0)return e;if(g)return g=!1,e.charCodeAt(0)===bn?e.slice(1):e;let t=e.indexOf(`\r`),n=e.indexOf(`
4`),r=t===-1?n:n===-1||t<n?t:n;return r===-1?``:r===e.length-1&&e.charCodeAt(r)===xn?(h=!1,g=!0,``):(h=!1,e.slice(r+(e.charCodeAt(r)===xn&&e.charCodeAt(r+1)===bn?2:1)))}function y(e){if(e){if(e.charCodeAt(e.length-1)===xn){C(e,0,e.length-1),g=!0;return}if(b(e)){s.push(e),c=e.length;return}h=!0}}function b(e){let t=e.charCodeAt(0);return t===58&&!!n||t===100&&Dn(e,`data`)||t===101&&Dn(e,`event`)||t===105&&Dn(e,`id`)||t===114&&Dn(e,`retry`)}function x(){t!==void 0&&(c+d.length<=t||(m=!0,s.length=0,c=0,u=void 0,d=``,f=0,p=void 0,h=!1,g=!1,r?.(new yn(`Buffered data exceeded max buffer size of ${t} characters`,{type:`max-buffer-size-exceeded`}))))}function S(e){let t=0;if(e.indexOf(`\r`)===-1){let n=e.indexOf(`
5`,t);for(;n!==-1;){if(t===n){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0,t=n+1,n=e.indexOf(`
6`,t);continue}let r=e.charCodeAt(t);if(Tn(e,t,r)){let r=e.charCodeAt(t+5)===Sn?t+6:t+5,o=e.slice(r,n);if(f===0&&e.charCodeAt(n+1)===bn){u!==void 0&&a?.(u),i?.({id:u,event:p,data:o}),u=void 0,d=``,p=void 0,t=n+2,n=e.indexOf(`
7`,t);continue}d=f===0?o:`${d}\n${o}`,f++}else En(e,t,r)?p=e.slice(e.charCodeAt(t+6)===Sn?t+7:t+6,n)||void 0:C(e,t,n);t=n+1,n=e.indexOf(`
8`,t)}return e.slice(t)}for(;t<e.length;){let n=e.indexOf(`\r`,t),r=e.indexOf(`
9`,t),i=-1;if(n!==-1&&r!==-1?i=n<r?n:r:n===-1?r!==-1&&(i=r):i=n===e.length-1?-1:n,i===-1)break;C(e,t,i),t=i+1,e.charCodeAt(t-1)===xn&&e.charCodeAt(t)===bn&&t++}return e.slice(t)}function C(e,t,r){if(t===r){T();return}let i=e.charCodeAt(t);if(Tn(e,t,i)){let n=e.charCodeAt(t+5)===Sn?t+6:t+5,i=e.slice(n,r);d=f===0?i:`${d}\n${i}`,f++;return}if(En(e,t,i)){p=e.slice(e.charCodeAt(t+6)===Sn?t+7:t+6,r)||void 0;return}if(i===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let n=e.slice(e.charCodeAt(t+3)===Sn?t+4:t+3,r);n.includes(`\0`)||(u=n);return}if(i===58){if(n){let i=e.slice(t,r);n(i.slice(e.charCodeAt(t+1)===Sn?2:1))}return}let a=e.slice(t,r),o=a.indexOf(`:`);if(o===-1){w(a,``,a);return}let s=a.slice(0,o),c=a.charCodeAt(o+1)===Sn?2:1;w(s,a.slice(o+c),a)}function w(e,t,n){switch(e){case`event`:p=t||void 0;break;case`data`:d=f===0?t:`${d}\n${t}`,f++;break;case`id`:t.includes(`\0`)||(u=t);break;case`retry`:/^\d+$/.test(t)?o?.(parseInt(t,10)):r?.(new yn(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:n}));break;default:r?.(new yn(`Unknown field "${e.length>20?`${e.slice(0,20)}…`:e}"`,{type:`unknown-field`,field:e,value:t,line:n}))}}function T(){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0}function E(e={}){if(e.consume&&s.length>0){let e=s.join(``);C(e,0,e.length)}l=!0,u=void 0,d=``,f=0,p=void 0,s.length=0,c=0,m=!1,h=!1,g=!1}return{feed:_,reset:E}}function Tn(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function En(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}function Dn(e,t){let n=1;for(;n<e.length&&n<t.length;){if(e.charCodeAt(n)!==t.charCodeAt(n))return!1;n++}return e.length<=t.length||e.charCodeAt(t.length)===58}var On=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n,onId:r,maxBufferSize:i}={}){let a;super({start(o){a=wn({onEvent:e=>{o.enqueue(e)},onError(t){typeof e==`function`&&e(t),(e===`terminate`||t.type===`max-buffer-size-exceeded`)&&o.error(t)},onRetry:t,onComment:n,onId:r,maxBufferSize:i})},transform(e){a.feed(e)}})}},kn=f({progress:p(),progressToken:r([c(),p()]),total:p().optional()}),An=({html:e,mcpConnectionProfileUid:t,toolArgs:n,toolResult:r})=>{let i=(0,Y.useRef)(null),[a,o]=(0,Y.useState)(0),[s,c]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{let a=i.current;if(!a||!e||!r)return;let s=null,l=!1;return(async()=>
9{if(await new Promise(e=>{let t=n=>{n.source===a.contentWindow&&n.data?.method===`ui/notifications/sandbox-proxy-ready`&&(window.removeEventListener(`message`,t),e())};window.addEventListener(`message`,t)}),l)return;let i=a.contentWindow;if(!i)return;let c=new Ct(i,i);s=new Et(null,{name:`glama-chat`,version:`1.0.0`},{logging:{},serverTools:{}}),s.onsizechange=({height:e})=>{typeof e==`number`&&o(e)},s.onopenlink=async({url:e})=>(window.open(e,`_blank`),{}),s.oncalltool=async(e,n)=>{if(!t)return{content:[{text:`No connection profile available.`,type:`text`}],isError:!0};let r=await fetch(D(`/api/mcp/app-tool-call`),{body:me({_meta:e._meta,args:e.arguments,mcpConnectionProfileUid:t,toolName:e.name}),headers:{"Content-Type":`application/json`},method:`POST`});if(!r.ok||!r.body)return{content:[{text:`Tool call failed: ${r.statusText}`,type:`text`}],isError:!0};let i=r.body.pipeThrough(new TextDecoderStream).pipeThrough(new On).getReader(),a=null,o=null;try{for(;;){let{done:e,value:t}=await i.read();if(e)break;if(t.event===`progress`){let e={method:`notifications/progress`,params:ge(kn,ee(t.data))};await n.sendNotification(e)}else t.event===`result`?a=ee(t.data):t.event===`error`&&(o=`Tool call failed`)}}finally{await i.cancel()}return a||{content:[{text:o??`Tool call ended without a result.`,type:`text`}],isError:!0}};let u=s;u.oninitialized=()=>{u.sendToolInput({arguments:n}),u.sendToolResult({content:Array.isArray(r)?r:[]})},await s.connect(c),!l&&await s.sendSandboxResourceReady({html:e})})().catch(e=>{l||(k.error(`ChatAppRenderer setup failed`,{error:e}),c(e instanceof Error?e.message:`Failed to load app`))}),()=>{l=!0,s&&s.close()}},[e,t,n,r]),s||!e||!r?null:(0,q.jsx)(`iframe`,{className:`jDOzgL jrHZPA gnlqYH hYZFkb`,ref:i,sandbox:`allow-same-origin allow-scripts allow-forms`,scrolling:`no`,src:D(`/api/mcp-app-sandbox`),style:{height:`${a}px`},title:`MCP App`,"data-sentry-component":`ChatAppRenderer`,"data-sentry-source-file":`ChatAppRenderer.tsx`})},jn=new Set([`balance_beyond_negative_limit`,`negative_balance_not_allowed`,`no_payment_method`,`request_would_exceed_negative_limit`]),Mn=e=>typeof e==`string`&&jn.has(e),Nn=`fPSBzf bnYmbW jrPWok jsnMfm`,Pn=`jRXFuD`,Fn=e=>{let t=(0,J.c)(14),{clientCompletionRequestId:n,code:r,message:i,sentryErrorExternalId:a}=e;if(Mn(r)){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(`p`,{className:Pn,children:`Insufficient credits`}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,q.jsx)(V,{role:`alert`,size:`compact`,variant:`warning`,children:(0,q.jsxs)(`div`,{className:Nn,children:[e,(0,q.jsxs)(`p`,{children:[`Your workspace does not have enough credits to complete this request. Visit`,` `,(0,q.jsx)(w,{className:`bYPztT jutHam hlqAVQ pKjuE bXBpoe bVhrBr cPAnzU gVIUVX kaKbZQ gABwnp IllHO bejlTa bhFGkb BdEWC jEevvj jClhju koJNIU iWtjzs cUPqFr iVlkKm dGndpe jsLxaN bZRhvx fEVEmD JAEma gXlbfc ecmYYS entBuJ`,to:D(`/settings/workspace/billing`),children:`Billing`}),` `,`to add credits or set up a payment method.`]})]})}),t[1]=n):n=t[1],n}let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,q.jsx)(`p`,{className:Pn,children:`Could not complete request`}),t[2]=o):o=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsxs)(`p`,{children:[`Please`,` `,(0,q.jsx)(w,{className:`bYPztT jutHam hlqAVQ pKjuE bXBpoe bVhrBr cPAnzU gVIUVX kaKbZQ gABwnp IllHO bejlTa bhFGkb BdEWC jEevvj jClhju koJNIU iWtjzs cUPqFr iVlkKm dGndpe jsLxaN bZRhvx fEVEmD JAEma gXlbfc ecmYYS entBuJ`,to:D(`/support`),"data-sentry-element":`Link`,"data-sentry-source-file":`ErrorMessage.tsx`,children:`contact support`}),` `,`for assistance.`]}),t[3]=s):s=t[3];let c;t[4]===a?c=t[5]:(c=a?(0,q.jsxs)(`p`,{children:[`Error ID: `,(0,q.jsx)(`code`,{children:a})]}):null,t[4]=a,t[5]=c);let l;t[6]===i?l=t[7]:(l=i&&(0,q.jsxs)(`p`,{children:[`Message: `,(0,q.jsx)(`code`,{children:i})]}),t[6]=i,t[7]=l);let u;t[8]===n?u=t[9]:(u=n&&(0,q.jsxs)(`p`,{children:[`Request ID:`,` `,(0,q.jsx)(w,{className:`bYPztT jutHam hlqAVQ pKjuE bXBpoe bVhrBr cPAnzU gVIUVX kaKbZQ gABwnp IllHO bejlTa bhFGkb BdEW
9C jEevvj jClhju koJNIU iWtjzs cUPqFr iVlkKm dGndpe jsLxaN bZRhvx fEVEmD JAEma gXlbfc ecmYYS entBuJ`,to:D(`/settings/logs/:referenceId`,{params:{referenceId:n}}),children:n})]}),t[8]=n,t[9]=u);let d;return t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,q.jsx)(V,{role:`alert`,size:`compact`,variant:`error`,"data-sentry-element":`Banner`,"data-sentry-component":`ErrorMessage`,"data-sentry-source-file":`ErrorMessage.tsx`,children:(0,q.jsxs)(`div`,{className:Nn,children:[o,s,c,l,u]})}),t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13],d},In=e=>j(e)&&`type`in e&&e.type===`doc`,Ln=e=>{let t=(0,J.c)(40),{chatMessage:n,fetchMentionsSuggestions:r,onCancel:i,onSubmit:a}=e,o;t[0]===n.content.content?o=t[1]:(o=()=>In(n.content.content)?n.content.content:dt(n.content.content),t[0]=n.content.content,t[1]=o);let[s,c]=(0,Y.useState)(o),u;t[2]===i?u=t[3]:(u={callback:()=>{i()},enabled:!0,key:`Escape`},t[2]=i,t[3]=u),ht(u);let d=l(),f=(0,Y.useRef)(null),p;t[4]!==n.uid||t[5]!==d||t[6]!==a?(p=e=>{e.setEditable(!1);let t=new FormData;t.append(`message`,me(e.getJSON())),d.submit(t,{action:D(`/api/message/:uid/edit`,{params:{uid:n.uid}}),method:`post`}).then(()=>{a()}).finally(()=>{e.setEditable(!0)})},t[4]=n.uid,t[5]=d,t[6]=a,t[7]=p):p=t[7];let m=p,h;t[8]===m?h=t[9]:(h=e=>{let{editor:t}=e;console.log(`onEnterSubmit`,t.getJSON()),m(t)},t[8]=m,t[9]=h);let g=h,_;t[10]!==r||t[11]!==g?(_={fetchMentionsSuggestions:r,onEnterSubmit:g},t[10]=r,t[11]=g,t[12]=_):_=t[12];let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{let{editor:t}=e;c(t.getJSON())},t[13]=v):v=t[13];let y;t[14]!==s||t[15]!==_?(y={content:s,extensions:_,onBlur:Rn,onFocus:zn,onUpdate:v},t[14]=s,t[15]=_,t[16]=y):y=t[16];let b=At(y),x,S;t[17]===b?(x=t[18],S=t[19]):(x=()=>{b?.setEditable(!0);let e=setTimeout(()=>{try{b?.commands.focus()}catch(e){P({error:e,level:`error`,message:`could not focus editor`})}},300);return()=>{clearTimeout(e)}},S=[b],t[17]=b,t[18]=x,t[19]=S),(0,Y.useEffect)(x,S);let C;t[20]!==b||t[21]!==m?(C=e=>{e.preventDefault(),b&&m(b)},t[20]=b,t[21]=m,t[22]=C):C=t[22];let w;t[23]===b?w=t[24]:(w=(0,q.jsx)(`div`,{className:`bwOuOz imQOig jUrcmX iCCQiI ghioyV dEHSnZ dDDGnV imVWwP lhQfvL iSXlKz fPSBzf bnYmbW jrIcfy`,children:(0,q.jsx)(He,{editor:b,"data-sentry-element":`EditorContent`,"data-sentry-source-file":`MessageEditor.tsx`})}),t[23]=b,t[24]=w);let T=d.state!==`idle`,E;t[25]!==b||t[26]!==i?(E=()=>{b&&b.commands.clearContent(),i()},t[25]=b,t[26]=i,t[27]=E):E=t[27];let O;t[28]!==T||t[29]!==E?(O=(0,q.jsx)(je,{disabled:T,onClick:E,type:`button`,variant:`outline`,"data-sentry-element":`SimpleButton`,"data-sentry-source-file":`MessageEditor.tsx`,children:`Cancel`}),t[28]=T,t[29]=E,t[30]=O):O=t[30];let k=d.state!==`idle`,A;t[31]===k?A=t[32]:(A=(0,q.jsx)(je,{loading:k,loadingText:`Submitting`,type:`submit`,"data-sentry-element":`SimpleButton`,"data-sentry-source-file":`MessageEditor.tsx`,children:`Submit`}),t[31]=k,t[32]=A);let j;t[33]!==O||t[34]!==A?(j=(0,q.jsxs)(`div`,{className:`fPSBzf jrIcfy felzJA`,children:[O,A]}),t[33]=O,t[34]=A,t[35]=j):j=t[35];let M;return t[36]!==C||t[37]!==w||t[38]!==j?(M=(0,q.jsxs)(`form`,{className:`iyUaLe fPSBzf bnYmbW jrIcfy ddfHct`,method:`post`,onSubmit:C,ref:f,"data-sentry-component":`MessageEditor`,"data-sentry-source-file":`MessageEditor.tsx`,children:[w,j]}),t[36]=C,t[37]=w,t[38]=j,t[39]=M):M=t[39],M};function Rn(){}function zn(){}var Bn=e=>{let t=(0,J.c)(7),{actions:n,onActionClick:r}=e;if(n.length===0)return null;let i;if(t[0]!==n||t[1]!==r){let e;t[3]===r?e=t[4]:(e=(e,t)=>(0,q.jsx)(`button`,{className:`eFrXto gZjRfX joaggh dhQYkN gwPFec hzfxld bMnvBR bUvkqG bYPztT foDtdn bynxtG jsnJKs iyWGqD bZRhvx fEVEmD jrPWok ATFzw gsJBgH kFYoVQ`,onClick:()=>r(e),type:`button`,children:(0,q.jsx)(ft,{children:e})},t),t[3]=r,t[4]=e),i=n.map(e),t[0]=n,t[1]=r,t[2]=i}else i=t[2];let a;return t[5]===i?a=t[6]:(a=(0,q.jsx)(`div`,{className:`fPSBzf bnYmbW jrWRtM fNBpMl`,"data-sentry-component":`SuggestedActions`,"data-sentry-source-file":`SuggestedActions.tsx`,children:i}),t[5]=i,t[6]=a),a},Vn=e=>{let t=(0,J.c)(29),{content:n,reasoningTokens:r,streaming:i}=e,[a,o]=(0,Y.useState)(!1),s;t[0]===n?s=t[1]:(s=n.trim(),t[0]=n,t[1]=s);let c=s.length>0,l;t[2]!==r||t[3]!==i?(l=i?`Thinking...`:r?`Reasoned for ${re(r,{notation:`standard`})} tokens`:`Reasoned`,t[2]=r,t[3]=i,t[4]=l):l=t[4];let u=l,d;t[5]===c?d=t[6]:(d=c?()=>o(Hn):void 0,t[5]=c,t[6]=d);let f=c?`pointer`:`default`,p;t[7]===f?p=t[8]:(p={cursor:f},t[7]=f,t[8]=p);let m;t[9]===i?m=t[10]:(m=i?(0,q.jsx)(Le,{styleName:`dots5`}):(0,q.jsx)(z,{color:`#00d992`,name:`brain`,size:16}),t[9]=i,t[10]=m);let h;t[11]===u?h=t[12]:(h=(0,q.jsx)(`span`,{children:u}),t[11]=u,t[12]=h);let g;t[13]!==a||t[14]!==c?(g=c&&(0,q.jsx)(`span`,{className:`coigcm`,children:a?(0,q.jsx)(z,{name:`chevron-down`,size:14}):(0,q.jsx)(z,{name:`chevron-right`,size:14})}),t[13]=a,t[14]=c,t[15]=g):g=t[15];let _;t[16]!==d||t[17]!==p||t[18]!==m||t[19]!==h||t[20]!==g?(_=(0,q.jsxs)(`button`,{className:`bMnvBR bYPztT iYHFpI fPSBzf jrPWok jrWRtM jTHJoi hYZFkb`,onClick:d,style:p,type:`button`,children:[m,h,g]}),t[16]=d,t[17]=p,t[18]=m,t[19]=h,t[20]=g,t[21]=_):_=t[21];let v;
9t[22]!==n||t[23]!==a||t[24]!==c?(v=a&&c&&(0,q.jsx)(`div`,{className:`jIaImt czikZZ jsVUaf jGqtWe bMdgrd BENyO IGbeU gNOQHw bkzFSZ`,children:n}),t[22]=n,t[23]=a,t[24]=c,t[25]=v):v=t[25];let y;return t[26]!==v||t[27]!==_?(y=(0,q.jsxs)(`div`,{className:`eoimnw jsnJKs`,"data-sentry-component":`ThinkingBlock`,"data-sentry-source-file":`ThinkingBlock.tsx`,children:[_,v]}),t[26]=v,t[27]=_,t[28]=y):y=t[28],y};function Hn(e){return!e}var Un=`project_memory_search`,Wn=`project_memory_confirmation`,Gn=`project_memory_saved`,Kn=e=>{let t=(0,J.c)(14),{buttonsProps:n,children:r,className:i,hasToolbar:a,registry:o,uiSchema:s}=e,c;t[0]===s?c=t[1]:(c=Tt(s),t[0]=s,t[1]=c);let l=c,u;t[2]!==o||t[3]!==l?(u=St(`ArrayFieldItemButtonsTemplate`,o,l),t[2]=o,t[3]=l,t[4]=u):u=t[4];let d=u,f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={flex:1,fontWeight:`bold`,paddingLeft:6,paddingRight:6},t[5]=f):f=t[5];let p=f,m;t[6]!==d||t[7]!==n||t[8]!==a?(m=a&&(0,q.jsx)(`div`,{className:`fPSBzf bnYmbW jsxeSy`,children:(0,q.jsx)(d,{...n,style:p})}),t[6]=d,t[7]=n,t[8]=a,t[9]=m):m=t[9];let h;return t[10]!==r||t[11]!==i||t[12]!==m?(h=(0,q.jsxs)(`div`,{className:i,"data-sentry-component":`ArrayFieldItemTemplate`,"data-sentry-source-file":`ElicitationForm.tsx`,children:[r,m]}),t[10]=r,t[11]=i,t[12]=m,t[13]=h):h=t[13],h},qn=`bkrhwk dZHizr iKcMWP cpoytx jBJNyK hVemIC eHBLhq fxoSXn jFfdlT jlUwnx birBdL fSfMeo bHNdXW cHbRqt bMSUtJ hYwiPH fiJcbV cqdbFs JAinS gZYHrW hoalgC lKGU kBSZmF fLXUID gBbcZq dJmbgV cjuHhe hjTlka fvzze bGfrhx iSfibP lmMLUx dXqlpi ceILpI hsfLas UNUlr fsDwFF cbgvrG ksAUkJ gPcvwj jGXhQt MYoNv dVzNWE bsCGQC gipSXg dLQkRy jdbWRs gBLXWr gtzRIs dCsNls eEXDUH jWnweh bADFrC cHFkwu! hQyALw! lfOSbj OuTWM bzwRYc imgRTe fGNJjA bFDyMs gGSPzP htEDwp gcTzYj iedjfM cCVtXR bwsjGO VUjDQ hziKJ ikwgJZ hwxCeE hkmqPt guLTGX gtMLKz! kGQkEf exNjKL bjpNDJ kDjIWL crPVfC jrMELH lctfUG dChrgp dhGQLi cIVvlv gALCwo bGaVZu egqrSP jxqURO bcwaWd efCETx hsHgBv frcdcv PZpLP bWBlIF fMCnpp ldmLsk dpXFVa iNDfcF! hxIyfF fBFPjZ iznCeS fwjbmc jkYVOw dEvAfO iXmwLm hLhWCD gVRcbq sYSYA gVEtGA fAXvvQ NCVTY gXGnSS jtYnQy gGHbyq kFDcrw bVdGfY cvtARJ dzgJVf dJyuZU! dDXmJI letTmk ddURKb cbylTR jIRZfN jacHUj GtziD iZnBwO eRWaHL gYYSDB BoQHJ juSiiJ`,Jn=e=>{let t=(0,J.c)(66),{elicitationRequest:n,onSubmitted:r}=e,i=l(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={},t[0]=a):a=t[0];let[o,s]=(0,Y.useState)(a),c=i.state!==`idle`;if(i.state===`idle`&&i.data&&r&&r(),n.status===`responded`){let e;t[1]===n.message?e=t[2]:(e=(0,q.jsx)(`p`,{className:`DOqBF xYowz jGqtWe`,children:n.message}),t[1]=n.message,t[2]=e);let r;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsx)(`span`,{className:`DOqBF xYowz`,children:`Response:`}),t[3]=r):r=t[3];let i=n.responseAction===`accept`?`#122d28`:`#2d1f22`,a=n.responseAction===`accept`?`#00d992`:`#fe4a4b`,o;t[4]!==i||t[5]!==a?(o={background:i,color:a},t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]!==n.responseAction||t[8]!==o?(s=(0,q.jsxs)(`div`,{className:`bYPztT fPSBzf jrIcfy`,children:[r,(0,q.jsx)(`span`,{className:`jsnJKs xYowz jRXTuE dTmqxZ jiOJAw`,style:o,children:n.responseAction})]}),t[7]=n.responseAction,t[8]=o,t[9]=s):s=t[9];let c;t[10]===n.responseContent?c=t[11]:(c=n.responseContent&&Object.keys(n.responseContent).length>0&&(0,q.jsx)(`pre`,{className:`koremC jDOzgL jsnJKs dBIADy xYowz jGqtWe coifMe fNDdIP`,children:me(n.responseContent,{pretty:!0})}),t[10]=n.responseContent,t[11]=c);let l;return t[12]!==e||t[13]!==s||t[14]!==c?(l=(0,q.jsxs)(`div`,{className:`eXSGnJ jDOzgL jrHZPA fPSBzf bnYmbW dVuiVB fNCcFz`,children:[e,s,c]}),t[12]=e,t[13]=s,t[14]=c,t[15]=l):l=t[15],l}let u;t[16]!==n.uid||t[17]!==i||t[18]!==o?(u=e=>{let t=new FormData;t.append(`action`,e),e===`accept`&&t.append(`content`,me(o)),i.submit(t,{action:D(`/api/elicitations/:uid/respond`,{params:{uid:n.uid}}),method:`POST`})},t[16]=n.uid,t[17]=i,t[18]=o,t[19]=u):u=t[19];let d=u,f;t[20]===n.message?f=t[21]:(f=(0,q.jsx)(`p`,{className:`dBIADy xYowz jGqtWe`,children:n.message}),t[20]=n.message,t[21]=f);let p;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{s(e.formData??{})},t[22]=p):p=t[22];let m;t[23]===d?m=t[24]:(m=()=>d(`accept`),t[23]=d,t[24]=m);let h=n.requestedSchema,g,_;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(g={ArrayFieldItemTemplate:Kn},_={"ui:submitButtonOptions":{norender:!0}},t[25]=g,t[26]=_):(g=t[25],_=t[26]);let v;t[27]!==o||t[28]!==m||t[29]!==h?(v=(0,q.jsx)(`div`,{className:qn,children:(0,q.jsx)(wt,{formData:o,onChange:p,onSubmit:m,schema:h,templates:g,uiSchema:_,validator:Dt,"data-sentry-element":`Form`,"data-sentry-source-file":`ElicitationForm.tsx`})}),t[27]=o,t[28]=m,t[29]=h,t[30]=v):v=t[30];let y;t[31]!==i.formData||t[32]!==c?(y=c&&i.formData?.get(`action`)===`accept`,t[31]=i.formData,t[32]=c,t[33]=y):y=t[33];let b;t[34]===d?b=t[35]:(b=()=>d(`accept`),t[34]=d,t[35]=b);let x;t[36]!==c||t[37]!==y||t[38]!==b?(x=(0,q.jsx)(je,{disabled:c,loading:y,loadingText:`Submitting...`,onClick:b,"data-sentry-element":`SimpleButton`,"data-sentry-source-file":`ElicitationForm.tsx`,children:`Accept`}),t[36]=c,t[37]=y,t[38]=b,t[39]=x):x=t[39];let S;t[40]!==i.formData||t[41]!==c?(S=c&&i.formData?.get(`action`)===`decline`,t[40]=i.formData,t[41]=c,t[42]=S):S=t[42];let C;t[43]===d?C=t[44]:(C=()=>d(`decline`),t[43]=d,t[44]=C);let w;t[45]!==c||t[46]!==S||t[47]!==C?(w=(0,q.jsx)(je,{disabled:c,loading:S,loadingText:`Declining...`,onClick:C,variant:`outline`,"data-sentry-element":`SimpleButton`,"data-sentry-source-file":`ElicitationForm.tsx`,children:`Decline`}),t[45]=c,t[46]=S,t[47]=C,t[48]=w):w=t[48];let T;t[49]!==i.formData||t[50]!==c?(T=c&&i.formData?.get(`action`)===`cancel`,t[49]=i.formData,t[50]=c,t[51]=T):T=t[51];let E;t[52]===d?E=t[53]:(E=()=>d(`cancel`),t[52]=d,t[53]=E);let O;t[54]!==c||t[55]!==T||t[56]!==E?(O=(0,q.jsx)(je,{disabled:c,loading:T,loadingText:`Cancelling...`,onClick:E,variant:`ghost`,"data-sentry-element":`SimpleButton`,"data-sentry-source-file":`ElicitationForm.tsx`,children:`Cancel`}),t[54]=c,t[55]=T,t[56]=E,t[57]=O):O=t[57];let k;t[58]!==x||t[59]!==w||t[60]!==O?(k=(0,q.jsxs)(`div`,{className:`fPSBzf jrIcfy`,children:[x,w,O]}),t[58]=x,t[59]=w,t[60]=O,t[61]=k):k=t[61];let A;
9return t[62]!==k||t[63]!==f||t[64]!==v?(A=(0,q.jsxs)(`div`,{className:`eXSGnJ jDOzgL jrHZPA fPSBzf bnYmbW dAaUHp fNCcFz`,"data-sentry-component":`ElicitationForm`,"data-sentry-source-file":`ElicitationForm.tsx`,children:[f,v,k]}),t[62]=k,t[63]=f,t[64]=v,t[65]=A):A=t[65],A},Yn=e=>{let t=(0,J.c)(51),{onSubmitted:n,samplingRequest:r}=e,i=l(),a=i.state!==`idle`;if(i.state===`idle`&&i.data&&n&&n(),r.status===`responded`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(`span`,{className:`DOqBF xYowz`,children:`LLM Sampling Completed`}),t[0]=e):e=t[0];let n;t[1]===r.responseModel?n=t[2]:(n=r.responseModel&&(0,q.jsx)(`span`,{className:`qGslh jsnJKs knVeeC AMuyK dTmqxZ`,children:r.responseModel}),t[1]=r.responseModel,t[2]=n);let i;t[3]===n?i=t[4]:(i=(0,q.jsxs)(`div`,{className:`bYPztT fPSBzf jrIcfy`,children:[e,n]}),t[3]=n,t[4]=i);let a;t[5]===r.responseContent?a=t[6]:(a=r.responseContent?(0,q.jsx)(W,{code:me(r.responseContent,{pretty:!0}),lang:`json`}):null,t[5]=r.responseContent,t[6]=a);let o;return t[7]!==i||t[8]!==a?(o=(0,q.jsxs)(`div`,{className:`eXSGnJ jDOzgL jrHZPA fPSBzf bnYmbW dVuiVB fNCcFz`,"data-testid":`sampling-request-form`,children:[i,a]}),t[7]=i,t[8]=a,t[9]=o):o=t[9],o}let o;t[10]!==i||t[11]!==r.uid?(o=()=>{i.submit(null,{action:D(`/api/sampling-requests/:uid/approve`,{params:{uid:r.uid}}),method:`POST`})},t[10]=i,t[11]=r.uid,t[12]=o):o=t[12];let s=o,c;t[13]!==i||t[14]!==r.uid?(c=()=>{i.submit(null,{action:D(`/api/sampling-requests/:uid/reject`,{params:{uid:r.uid}}),method:`POST`})},t[13]=i,t[14]=r.uid,t[15]=c):c=t[15];let u=c,d;t[16]===r.maxTokens?d=t[17]:(d=(0,q.jsxs)(`p`,{className:`fNBpvX`,children:[`The MCP server is requesting an LLM completion with`,` `,(0,q.jsx)(`strong`,{children:r.maxTokens}),` max tokens.`]}),t[16]=r.maxTokens,t[17]=d);let f;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,q.jsx)(`p`,{className:`DOqBF AMuyK`,children:`Approving will use your configured model to generate a response.`}),t[18]=f):f=t[18];let p;t[19]===d?p=t[20]:(p=(0,q.jsxs)(`div`,{className:`dBIADy xYowz jGqtWe`,children:[d,f]}),t[19]=d,t[20]=p);let m;t[21]===r.messages.length?m=t[22]:(m=(0,q.jsxs)(`div`,{className:`iYHFpI jsOvvq fzpbtJ`,children:[`Messages (`,r.messages.length,`)`]}),t[21]=r.messages.length,t[22]=m);let h;t[23]===r.messages?h=t[24]:(h=me(r.messages,{pretty:!0}),t[23]=r.messages,t[24]=h);let g;t[25]===h?g=t[26]:(g=(0,q.jsx)(W,{code:h,lang:`json`,"data-sentry-element":`SyntaxHighlighter`,"data-sentry-source-file":`SamplingRequestForm.tsx`}),t[25]=h,t[26]=g);let _;t[27]!==m||t[28]!==g?(_=(0,q.jsxs)(`div`,{className:`fPSBzf bnYmbW jrIcfy`,children:[m,g]}),t[27]=m,t[28]=g,t[29]=_):_=t[29];let v;t[30]!==i.formAction||t[31]!==a?(v=a&&i.formAction?.includes(`approve`),t[30]=i.formAction,t[31]=a,t[32]=v):v=t[32];let y;t[33]!==s||t[34]!==a||t[35]!==v?(y=(0,q.jsx)(je,{disabled:a,loading:v,loadingText:`Processing...`,onClick:s,"data-sentry-element":`SimpleButton`,"data-sentry-source-file":`SamplingRequestForm.tsx`,children:`Approve & Generate`}),t[33]=s,t[34]=a,t[35]=v,t[36]=y):y=t[36];let b;t[37]!==i.formAction||t[38]!==a?(b=a&&i.formAction?.includes(`reject`),t[37]=i.formAction,t[38]=a,t[39]=b):b=t[39];let x;t[40]!==u||t[41]!==a||t[42]!==b?(x=(0,q.jsx)(je,{disabled:a,loading:b,loadingText:`Rejecting...`,onClick:u,variant:`outline`,"data-sentry-element":`SimpleButton`,"data-sentry-source-file":`SamplingRequestForm.tsx`,children:`Reject`}),t[40]=u,t[41]=a,t[42]=b,t[43]=x):x=t[43];let S;t[44]!==y||t[45]!==x?(S=(0,q.jsxs)(`div`,{className:`fPSBzf jrIcfy`,children:[y,x]}),t[44]=y,t[45]=x,t[46]=S):S=t[46];let C;return t[47]!==S||t[48]!==p||t[49]!==_?(C=(0,q.jsxs)(`div`,{className:`eXSGnJ jDOzgL jrHZPA fPSBzf bnYmbW dAaUHp fNCcFz`,"data-testid":`sampling-request-form`,"data-sentry-component":`SamplingRequestForm`,"data-sentry-source-file":`SamplingRequestForm.tsx`,children:[p,_,S]}),t[47]=S,t[48]=p,t[49]=_,t[50]=C):C=t[50],C},Xn=e=>{let t=(0,J.c)(17),{progress:n,total:r}=e,i;t[0]!==n||t[1]!==r?(i=Math.round(n/r*100),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=Math.min(100,i),o=`${n} of ${r}`,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s={position:`relative`},t[3]=s):s=t[3];let c=`${a}%`,l;t[4]===c?l=t[5]:(l=(0,q.jsx)(`div`,{className:`llOPUI jsnJKs hYZFjI cMaNJz`,style:{width:c}}),t[4]=c,t[5]=l);let u;t[6]!==n||t[7]!==o||t[8]!==l||t[9]!==r?(u=(0,q.jsx)(`div`,{"aria-valuemax":r,"aria-valuemin":0,"aria-valuenow":n,"aria-valuetext":o,className:`jNPhXM jsnJKs ATGke gnlqYH jsxjDG`,role:`progressbar`,style:s,tabIndex:0,children:l}),t[6]=n,t[7]=o,t[8]=l,t[9]=r,t[10]=u):u=t[10];let d;t[11]!==n||t[12]!==r?(d=(0,q.jsxs)(`span`,{"aria-hidden":`true`,className:`iYHFpI jsOvvq`,children:[n,`/`,r]}),t[11]=n,t[12]=r,t[13]=d):d=t[13];let f;return t[14]!==u||t[15]!==d?(f=(0,q.jsxs)(`div`,{className:`bYPztT fPSBzf jrIcfy`,"data-sentry-component":`ProgressBar`,"data-sentry-source-file":`ToolCalls.tsx`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f},Zn=({toolName:e})=>{switch(e){case Wn:return`confirmation`;case Gn:return`saved`;case Un:return`search`;default:return null}},Qn=({toolName:e})=>Zn({toolName:e})!==null,$n=({mcpConnectionProfileTool:e,toolName:t})=>Qn({toolName:t})?`project_memory`:e?.name??t,er=e=>{let t=(0,J.c)(32),{mcpConnectionProfileTool:n,previewArgs:r,progress:i,progressTotal:a,status:o,toolName:s}=e,c=o===`started`&&i!==null&&a!==null&&a>0,l;t[0]!==n||t[1]!==s?(l=$n({mcpConnectionProfileTool:n,toolName:s}),t[0]=n,t[1]=s,t[2]=l):l=t[2];let u=l,d=o===`error`?`#fe4a4b`:`#00d992`,f;t[3]===s?f=t[4]:(f=Qn({toolName:s}),t[3]=s,t[4]=f);let p=f,m;t[5]===s?m=t[6]:(m=Zn({toolName:s}),t[5]=s,t[6]=m);let h=m,g;t[7]!==d||t[8]!==p||t[9]!==o?(g=o===`queued`||o===`started`?(0,q.
9jsx)(`div`,{className:`fNCnzd`,children:(0,q.jsx)(Le,{styleName:`dots5`})}):p?(0,q.jsx)(z,{color:d,name:`brain`,size:16}):(0,q.jsx)(z,{color:d,name:`hammer`,size:16}),t[7]=d,t[8]=p,t[9]=o,t[10]=g):g=t[10];let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsx)(`span`,{className:`fCWkdx jsCcOF`}),t[11]=_):_=t[11];let v;t[12]===n?v=t[13]:(v=n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:n.mcpConnectionProfile.name}),(0,q.jsx)(z,{name:`chevron-right`,size:16})]}):null,t[12]=n,t[13]=v);let y;t[14]===u?y=t[15]:(y=(0,q.jsx)(`span`,{children:u}),t[14]=u,t[15]=y);let b;t[16]===h?b=t[17]:(b=h?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(z,{name:`chevron-right`,size:16}),(0,q.jsx)(`span`,{children:h})]}):null,t[16]=h,t[17]=b);let x;t[18]===p?x=t[19]:(x=p?null:(0,q.jsx)(z,{name:`chevron-right`,size:16}),t[18]=p,t[19]=x);let S;t[20]!==r||t[21]!==i||t[22]!==a||t[23]!==c?(S=c?(0,q.jsx)(Xn,{progress:i,total:a}):r?(0,q.jsx)(`div`,{className:`eywZlr fPSBzf hnMRLK jsnMfm`,children:Object.entries(r).map(fr)}):null,t[20]=r,t[21]=i,t[22]=a,t[23]=c,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==g||t[27]!==v||t[28]!==y||t[29]!==b||t[30]!==x?(C=(0,q.jsxs)(`div`,{className:`bYPztT fPSBzf hnMRLK jsCBtQ`,"data-sentry-component":`ToolInfo`,"data-sentry-source-file":`ToolCalls.tsx`,children:[g,_,v,y,b,x,S]}),t[25]=S,t[26]=g,t[27]=v,t[28]=y,t[29]=b,t[30]=x,t[31]=C):C=t[31],C},tr=e=>{let t=(0,J.c)(9),{data:n,label:r}=e,i;t[0]===r?i=t[1]:(i=(0,q.jsx)(`div`,{className:`iYHFpI jsOvvq fzpbtJ`,children:r}),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=me(n,{pretty:!0}),t[2]=n,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,q.jsx)(W,{code:a,lang:`json`,"data-sentry-element":`SyntaxHighlighter`,"data-sentry-source-file":`ToolCalls.tsx`}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,q.jsxs)(`div`,{className:`fPSBzf bnYmbW jsnMfm`,"data-sentry-component":`DebugSection`,"data-sentry-source-file":`ToolCalls.tsx`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s},nr=e=>{let t=Array.isArray(e)?e:j(e)&&Array.isArray(e.content)?e.content:null;return t?t.filter(e=>(e.type===`audio`||e.type===`image`)&&e.data&&e.mimeType):[]},rr=e=>{let t=(0,J.c)(11),{result:n}=e,r,i,a,o,s;if(t[0]!==n){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e=nr(n);if(e.length===0){s=null;break bb0}r=`fPSBzf bnYmbW jrIcfy`,i=`ResultMediaContent`,a=`ToolCalls.tsx`,o=e.map(pr)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s}else r=t[1],i=t[2],a=t[3],o=t[4],s=t[5];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[6]!==r||t[7]!==i||t[8]!==a||t[9]!==o?(c=(0,q.jsx)(`div`,{className:r,"data-sentry-component":i,"data-sentry-source-file":a,children:o}),t[6]=r,t[7]=i,t[8]=a,t[9]=o,t[10]=c):c=t[10],c},ir=e=>e.replaceAll(/\s+/gu,` `).replaceAll(`
10`,` `).trim().slice(0,20),ar=e=>{if(!j(e)||!j(e.arguments))return null;let t={};for(let[n,r]of Object.entries(e.arguments))(typeof r==`string`||typeof r==`number`||typeof r==`boolean`||r===null)&&(n.length>20||(t[n]=typeof r==`string`?ir(r):r));return Object.keys(t).length>0?t:null},or=`bYPztT fSaZOV fPSBzf jsOvvq jRXTuE jrWRtM jsOvFc`,sr=e=>{let t=(0,J.c)(14),{expanded:n,onClick:r,previewArgs:i,status:a,toolCall:o}=e,s;t[0]!==n||t[1]!==a?(s=he([n,a],[[-1,-1,[`completed`,-1,`error`,-2,`queued`,-3,`started`,-3,`unknown`,-1]],[-4,-4,[`completed`,-4,`error`,-5,`queued`,-6,`started`,-6,`unknown`,-4]],[-7,-7,[`completed`,-7,`error`,-8,`queued`,-9,`started`,-9,`unknown`,-7]],[0,0,[`false`,1,`true`,2]]],[`bYPztT iYHFpI bZRhvx fPSBzf hnMRLK jrPWok jsnMfm jTHJoi`,`bYPztT iYHFpI bZRhvx fPSBzf hnMRLK jrPWok jsnMfm jTHJoi ciapuD ijFeKH`,`bYPztT iYHFpI bZRhvx fPSBzf hnMRLK jrPWok jsnMfm jTHJoi jGAxYB`,`bYPztT iYHFpI bZRhvx fPSBzf hnMRLK jrPWok jsnMfm jTHJoi bMnvBR eoimnw jsnJKs`,`bYPztT iYHFpI bZRhvx fPSBzf hnMRLK jrPWok jsnMfm jTHJoi bMnvBR eoimnw jsnJKs ciapuD ijFeKH`,`bYPztT iYHFpI bZRhvx fPSBzf hnMRLK jrPWok jsnMfm jTHJoi bMnvBR eoimnw jsnJKs jGAxYB`,`bYPztT iYHFpI bZRhvx fPSBzf hnMRLK jrPWok jsnMfm jTHJoi bTmeQJ jIglCv jAzgQP`,`bYPztT iYHFpI bZRhvx fPSBzf hnMRLK jrPWok jsnMfm jTHJoi ciapuD jIglCv jAzgQP ijFeKH`,`bYPztT iYHFpI bZRhvx fPSBzf hnMRLK jrPWok jsnMfm jTHJoi bTmeQJ jIglCv jAzgQP jGAxYB`],3),t[0]=n,t[1]=a,t[2]=s):s=t[2];let c;t[3]!==i||t[4]!==a||t[5]!==o.mcpConnectionProfileTool||t[6]!==o.progress||t[7]!==o.progressTotal||t[8]!==o.toolName?(c=(0,q.jsx)(er,{mcpConnectionProfileTool:o.mcpConnectionProfileTool,previewArgs:i,progress:o.progress,progressTotal:o.progressTotal,status:a,toolName:o.toolName,"data-sentry-element":`ToolInfo`,"data-sentry-source-file":`ToolCalls.tsx`}),t[3]=i,t[4]=a,t[5]=o.mcpConnectionProfileTool,t[6]=o.progress,t[7]=o.progressTotal,t[8]=o.toolName,t[9]=c):c=t[9];let l;return t[10]!==r||t[11]!==s||t[12]!==c?(l=(0,q.jsx)(`button`,{className:s,onClick:r,type:`button`,"data-sentry-component":`ToolCallHeaderButton`,"data-sentry-source-file":`ToolCalls.tsx`,children:c}),t[10]=r,t[11]=s,t[12]=c,t[13]=l):l=t[13],l},cr=e=>{let t=(0,J.c)(10),{children:n,onExpand:r,previewArgs:i,status:a,toolCall:o}=e,s;t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o?(s=(0,q.jsx)(sr,{expanded:!0,onClick:r,previewArgs:i,status:a,toolCall:o,"data-sentry-element":`ToolCallHeaderButton`,"data-sentry-source-file":`ToolCalls.tsx`}),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n?c=t[6]:(c=(0,q.jsx)(`div`,{className:`wgfej jowIXG fNDdIP`,children:n}),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==c?(l=(0,q.jsxs)(`div`,{className:`eoimnw jsnJKs fPSBzf bnYmbW`,"data-sentry-component":`CollapsedToolCallPanel`,"data-sentry-source-file":`ToolCalls.tsx`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}
10,lr=e=>{let t=(0,J.c)(49),{toolCall:n}=e,{args:r,elicitationRequest:i,error:a,mcpConnectionProfileTool:o,result:s,samplingRequest:c,taskRequest:u}=n,d;t[0]!==n.calledAt||t[1]!==n.endedAt?(d=n.calledAt&&n.endedAt?new Date(n.endedAt).getTime()-new Date(n.calledAt).getTime():null,t[0]=n.calledAt,t[1]=n.endedAt,t[2]=d):d=t[2];let f=d,p=l(),m=j(s)&&j(s.memory)&&typeof s.memory.uid==`string`?s.memory.uid:null,h;t[3]===i?h=t[4]:(h=i?.status===`pending`&&(0,q.jsxs)(`div`,{className:`wgfej jDOzgL jrHZPA fNBpvX`,children:[(0,q.jsxs)(`div`,{className:`bYPztT jorfMA fSaZOV fPSBzf jsOvvq jRXTuE jrWRtM IGbeU`,children:[(0,q.jsx)(`span`,{children:`⏳`}),(0,q.jsx)(`span`,{children:`Input Required`})]}),(0,q.jsx)(`div`,{className:`fNDdIP`,children:(0,q.jsx)(Jn,{elicitationRequest:i})})]}),t[3]=i,t[4]=h);let g;t[5]===i?g=t[6]:(g=i?.status===`responded`&&(0,q.jsxs)(`div`,{className:`wgfej jDOzgL jrHZPA fNBpvX`,children:[(0,q.jsxs)(`div`,{className:`bYPztT jorfMA iYHFpI fPSBzf jsOvvq jRXTuE jrWRtM IGbeU`,children:[(0,q.jsx)(`span`,{children:`✓`}),(0,q.jsx)(`span`,{children:`Elicitation Responded`})]}),(0,q.jsx)(`div`,{className:`fNDdIP`,children:(0,q.jsx)(Jn,{elicitationRequest:i})})]}),t[5]=i,t[6]=g);let _;t[7]===c?_=t[8]:(_=c?.status===`pending`&&(0,q.jsxs)(`div`,{className:`wgfej jDOzgL jrHZPA fNBpvX`,children:[(0,q.jsxs)(`div`,{className:`bYPztT jorfMA fSaZOV fPSBzf jsOvvq jRXTuE jrWRtM IGbeU`,children:[(0,q.jsx)(`span`,{children:`🤖`}),(0,q.jsx)(`span`,{children:`LLM Sampling Required`})]}),(0,q.jsx)(`div`,{className:`fNDdIP`,children:(0,q.jsx)(Yn,{samplingRequest:c})})]}),t[7]=c,t[8]=_);let v;t[9]===c?v=t[10]:(v=c?.status===`responded`&&(0,q.jsxs)(`div`,{className:`wgfej jDOzgL jrHZPA fNBpvX`,children:[(0,q.jsxs)(`div`,{className:`bYPztT jorfMA iYHFpI fPSBzf jsOvvq jRXTuE jrWRtM IGbeU`,children:[(0,q.jsx)(`span`,{children:`✓`}),(0,q.jsx)(`span`,{children:`LLM Sampling Completed`})]}),(0,q.jsx)(`div`,{className:`fNDdIP`,children:(0,q.jsx)(Yn,{samplingRequest:c})})]}),t[9]=c,t[10]=v);let y;t[11]===u?y=t[12]:(y=u?.status===`working`&&(0,q.jsxs)(`div`,{className:`wgfej jDOzgL jrHZPA fNBpvX`,"data-testid":`task-status-working`,children:[(0,q.jsxs)(`div`,{className:`bYPztT jorfMA blpxoP fPSBzf jsOvvq jRXTuE jrWRtM IGbeU`,children:[(0,q.jsx)(Le,{styleName:`dots5`}),(0,q.jsx)(`span`,{children:`Task Running`})]}),(0,q.jsxs)(`div`,{className:`iYHFpI jsOvvq fNDdIP`,children:[u.statusMessage&&(0,q.jsx)(`div`,{className:`fNBpvX`,children:u.statusMessage}),(0,q.jsxs)(`div`,{children:[`Task ID: `,u.taskId]})]})]}),t[11]=u,t[12]=y);let b;t[13]===u?b=t[14]:(b=u?.status===`failed`&&(0,q.jsxs)(`div`,{className:`galgcR eYhqVp jrHZPA fNBpvX`,"data-testid":`task-status-failed`,children:[(0,q.jsxs)(`div`,{className:`bYPztT gsfWue leZivw fPSBzf jsOvvq jRXTuE jrWRtM IGbeU`,children:[(0,q.jsx)(`span`,{children:`✗`}),(0,q.jsx)(`span`,{children:`Task Failed`})]}),u.statusMessage&&(0,q.jsx)(`div`,{className:`leZivw jsOvvq fNDdIP`,children:u.statusMessage})]}),t[13]=u,t[14]=b);let x;t[15]===u?.status?x=t[16]:(x=u?.status===`cancelled`&&(0,q.jsx)(`div`,{className:`wgfej bTCkx jrHZPA fNBpvX`,"data-testid":`task-status-cancelled`,children:(0,q.jsxs)(`div`,{className:`bYPztT iYHFpI fPSBzf jsOvvq jRXTuE jrWRtM IGbeU`,children:[(0,q.jsx)(`span`,{children:`⊘`}),(0,q.jsx)(`span`,{children:`Task Cancelled`})]})}),t[15]=u?.status,t[16]=x);let S;t[17]===r?S=t[18]:(S=r?(0,q.jsx)(tr,{data:r,label:`Args`}):null,t[17]=r,t[18]=S);let C;t[19]!==m||t[20]!==p||t[21]!==s?(C=s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(rr,{result:s}),(0,q.jsx)(tr,{data:s,label:`Result`}),m?(0,q.jsx)(`div`,{className:`fPSBzf felzJA`,children:(0,q.jsx)(p.Form,{action:D(`/api/project-memories/:uid/delete`,{params:{uid:m}}),method:`post`,children:(0,q.jsx)(je,{loading:p.state!==`idle`,loadingText:`Removing`,type:`submit`,children:`Remove memory`})})}):null]}):null,t[19]=m,t[20]=p,t[21]=s,t[22]=C):C=t[22];let T;t[23]===a?T=t[24]:(T=a?(0,q.jsx)(tr,{data:a,label:`Error`}):null,t[23]=a,t[24]=T);let E;t[25]===o?E=t[26]:(E=o&&(0,q.jsxs)(`div`,{children:[`profile:`,` `,(0,q.jsx)(w,{className:`bYPztT jutHam hlqAVQ pKjuE bXBpoe bVhrBr cPAnzU gVIUVX kaKbZQ gABwnp IllHO bejlTa bhFGkb BdEW
10C jEevvj jClhju koJNIU iWtjzs cUPqFr iVlkKm dGndpe jsLxaN bZRhvx fEVEmD JAEma gXlbfc ecmYYS entBuJ`,to:D(`/settings/mcp/connectors/:uid`,{params:{uid:o.mcpConnectionProfile.uid}}),children:o.mcpConnectionProfile.name})]}),t[25]=o,t[26]=E);let O;t[27]===f?O=t[28]:(O=f?`${re(f,{notation:`standard`})} ms`:(0,q.jsx)(Nt,{}),t[27]=f,t[28]=O);let k;t[29]===O?k=t[30]:(k=(0,q.jsxs)(`div`,{children:[`duration:`,` `,O]}),t[29]=O,t[30]=k);let A=n.resultIndicatesError?`error`:n.status,M;t[31]===A?M=t[32]:(M=(0,q.jsxs)(`div`,{children:[`status: `,A]}),t[31]=A,t[32]=M);let ee;t[33]!==E||t[34]!==k||t[35]!==M?(ee=(0,q.jsxs)(`div`,{className:`iYHFpI fPSBzf hnMRLK jsOvvq jrIcfy fzpbtJ`,children:[E,k,M]}),t[33]=E,t[34]=k,t[35]=M,t[36]=ee):ee=t[36];let te;return t[37]!==C||t[38]!==T||t[39]!==ee||t[40]!==h||t[41]!==g||t[42]!==_||t[43]!==v||t[44]!==y||t[45]!==b||t[46]!==x||t[47]!==S?(te=(0,q.jsxs)(`div`,{className:`fPSBzf bnYmbW jrIcfy ATFzw`,"data-sentry-component":`ExpandedToolCallDetails`,"data-sentry-source-file":`ToolCalls.tsx`,children:[h,g,_,v,y,b,x,S,C,T,ee]}),t[37]=C,t[38]=T,t[39]=ee,t[40]=h,t[41]=g,t[42]=_,t[43]=v,t[44]=y,t[45]=b,t[46]=x,t[47]=S,t[48]=te):te=t[48],te},ur=e=>{let t=(0,J.c)(46),{toolCall:n}=e,[r,i]=(0,Y.useState)(!1),{args:a,elicitationRequest:o,result:s,samplingRequest:c,status:l}=n,u;t[0]===a?u=t[1]:(u=ar(a),t[0]=a,t[1]=u);let d=u,f=n.resultIndicatesError?`error`:l;if(r){let e;t[2]===f?e=t[3]:(e=he([f],[[-1,-1,[`completed`,-1,`error`,-2,`queued`,-1,`started`,-1,`unknown`,-1]]],[`eoimnw jsnJKs fPSBzf bnYmbW`,`eoimnw jsnJKs fPSBzf bnYmbW ciapuD ijFeKH`],0),t[2]=f,t[3]=e);let r;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>i(!1),t[4]=r):r=t[4];let a;t[5]!==f||t[6]!==d||t[7]!==n?(a=(0,q.jsx)(sr,{expanded:!0,onClick:r,previewArgs:d,status:f,toolCall:n}),t[5]=f,t[6]=d,t[7]=n,t[8]=a):a=t[8];let o;t[9]===n?o=t[10]:(o=(0,q.jsx)(lr,{toolCall:n}),t[9]=n,t[10]=o);let s;return t[11]!==e||t[12]!==a||t[13]!==o?(s=(0,q.jsxs)(`div`,{className:e,children:[a,o]}),t[11]=e,t[12]=a,t[13]=o,t[14]=s):s=t[14],s}if(o?.status===`pending`){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>i(!0),t[15]=e):e=t[15];let r;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsxs)(`div`,{className:or,children:[(0,q.jsx)(`span`,{children:`⏳`}),(0,q.jsx)(`span`,{children:`Input Required`})]}),t[16]=r):r=t[16];let a;t[17]===o?a=t[18]:(a=(0,q.jsx)(Jn,{elicitationRequest:o}),t[17]=o,t[18]=a);let s;return t[19]!==f||t[20]!==d||t[21]!==a||t[22]!==n?(s=(0,q.jsxs)(cr,{onExpand:e,previewArgs:d,status:f,toolCall:n,children:[r,a]}),t[19]=f,t[20]=d,t[21]=a,t[22]=n,t[23]=s):s=t[23],s}if(c?.status===`pending`){let e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>i(!0),t[24]=e):e=t[24];let r;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsxs)(`div`,{className:or,children:[(0,q.jsx)(`span`,{children:`🤖`}),(0,q.jsx)(`span`,{children:`LLM Sampling Required`})]}),t[25]=r):r=t[25];let a;t[26]===c?a=t[27]:(a=(0,q.jsx)(Yn,{samplingRequest:c}),t[26]=c,t[27]=a);let o;return t[28]!==f||t[29]!==d||t[30]!==a||t[31]!==n?(o=(0,q.jsxs)(cr,{onExpand:e,previewArgs:d,status:f,toolCall:n,children:[r,a]}),t[28]=f,t[29]=d,t[30]=a,t[31]=n,t[32]=o):o=t[32],o}if(nr(s).length>0){let e;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>i(!0),t[33]=e):e=t[33];let r;t[34]===s?r=t[35]:(r=(0,q.jsx)(rr,{result:s}),t[34]=s,t[35]=r);let a;return t[36]!==f||t[37]!==d||t[38]!==r||t[39]!==n?(a=(0,q.jsx)(cr,{onExpand:e,previewArgs:d,status:f,toolCall:n,children:r}),t[36]=f,t[37]=d,t[38]=r,t[39]=n,t[40]=a):a=t[40],a}let p;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>i(!0),t[41]=p):p=t[41];let m;return t[42]!==f||t[43]!==d||t[44]!==n?(m=(0,q.jsx)(sr,{expanded:!1,onClick:p,previewArgs:d,status:f,toolCall:n,"data-sentry-element":`ToolCallHeaderButton`,"data-sentry-component":`ToolCallItem`,"data-sentry-source-file":`ToolCalls.tsx`}),t[42]=f,t[43]=d,t[44]=n,t[45]=m):m=t[45],m},dr=e=>{let t=(0,J.c)(4),{toolCalls:n}=e,r;t[0]===n?r=t[1]:(r=n.map(mr),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,q.jsx)(`ul`,{className:`fPSBzf bnYmbW jrIcfy`,"data-sentry-component":`ToolCalls`,"data-sentry-source-file":`ToolCalls.tsx`,children:r}),t[2]=r,t[3]=i),i};function fr(e){let[t,n]=e;return(0,q.jsxs)(`div`,{className:`fCWkdx`,children:[t,`: `,n]},t)}function pr(e){return(0,q.jsxs)(`div`,{children:[e.type===`audio`&&(0,q.jsx)(`audio`,{className:`dmmjlu jsxiNQ`,controls:!0,src:`data:${e.mimeType};base64,${e.data}`}),e.type===`image`&&(0,q.jsx)(`img`,{alt:`Tool result`,className:`eAZrqn dmmjlu`,src:`data:${e.mimeType};base64,${e.data}`})]},`${e.type}:${e.mimeType}:${e.data?.slice(0,32)??``}`)}function mr(e){return(0,q.jsx)(`li`,{children:(0,q.jsx)(ur,{toolCall:e})},e.toolCallExternalId)}var hr=B.verboseEnum([`aborted`,`ended`,`interrupted`,`started`,`queued`]),gr=B.verboseEnum([`assistant`,`user`,`system`,`developer`]),_r=RegExp(`^[a-z0-9]+$`,`iu`),vr=f({args:n().nullable(),calledAt:o().nullable(),elicitationRequest:f({message:c(),requestedSchema:v({type:d(`object`)}),responseAction:B.verboseEnum([`accept`,`decline`,`cancel`]).nullable(),responseContent:x(c(),n()).nullable(),status:B.verboseEnum([`pending`,`responded`]),uid:B.uid()}).nullable(),endedAt:o().nullable(),error:x(c(),n()).nullable(),mcpConnectionProfileTool:f({mcpConnectionProfile:f({name:c(),uid:B.uid()}),name:c(),uid:B.uid()}).nullable(),progress:p().nullable(),progressTotal:p().nullable(),result:n().nullable(),resultIndicatesError:m(),samplingRequest:f({maxTokens:p(),messages:y(n()),responseContent:n().nullable(),responseModel:c().nullable(),responseRole:B.verboseEnum([`assistant`,`user`]).nullable(),responseStopReason:c().nullable(),status:B.verboseEnum([`pending`,`responded`]),uid:B.uid()}).nullable(),status:B.verboseEnum([`queued`,`started`,`completed`,`error`,`unknown`]),taskRequest:f({lastUpdatedAt:o(),pollInterval:p().nullable(),status:B.verboseEnum([`working`,`input_required`,`completed`,`failed`,`cancelled`]),statusMessage:c().nullable(),taskId:c(),ttl:p().nullable(),uid:B.uid()}).nullable(),toolCallExternalId:c(),toolName:c(),uiResourceHtml:c().nullable()}),yr=f({clientCompletionRequestId:h().nullable(),completionRequest:f({referenceId:h()}).nullable(),content:c(),error:f({code:c().nullable(),message:c().nullable(),sentryErrorExternalId:c().nullable()}).nullable(),finishReason:c().nullable(),hostedLlmModel:f({alias:B.modelAlias().nullable(),llmModel:f({alias:B.modelAlias().nullable(),name:B.modelName()}),llmProvider:f({displayName:c(),name:B.llmProviderName()}),name:B.modelName()}),reasoningContent:c(),reasoningTokens:p().nullable(),status:hr,toolCalls:y(vr),uid:B.uid()}),br=(()=>{var e=f({agentChatSession:f({agent:f({name:c(),uid:B.uid()}),uid:B.uid()}).nullable(),assistantResponses:y(yr),content:f({content:c(),type:d(`markdown`)}),deletedAt:o().nullable(),parent:f({receivedAt:o(),role:gr,uid:B.uid()}).nullable(),receivedAt:o(),role:d(`assistant`),suggestedActions:y(c()).nullable(),uid:B.uid()}),t=[e.shape.agentChatSession._zod.def.innerType.shape.agent.shape.uid._zod.def.out._zod.def.transform,e.shape.agentChatSession._zod.def.innerType.shape.uid._zod.def.out._zod.def.transform,e.shape.assistantResponses._zod.def.element.shape.hostedLlmModel.shape.alias._zod.def.innerType._zod.def.checks[2]._zod.def.fn,e.shape.assistantResponses._zod.def.element.shape.hostedLlmModel.shape.llmModel.shape.alias._zod.def.innerType._zod.def.checks[2]._zod.def.fn,e.shape.assistantResponses._zod.def.element.shape.hostedLlmModel.shape.llmModel.shape.name._zod.def.checks[2]._zod.def.fn,e.shape.assistantResponses._zod.def.element.shape.hostedLlmModel.shape.llmProvider.shape.name._zod.def.checks[2]._zod.def.fn,e.shape.assistantResponses._zod.def.element.shape.hostedLlmModel.shape.name._zod.def.checks[2]._zod.def.fn,e.shape.assistantResponses._zod.def.element.shape.status,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.elicitationRequest._zod.def.innerType.shape.responseAction._zod.def.innerType,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.elicitationRequest._zod.def.innerType.shape.status,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.elicitationRequest._zod.def.innerType.shape.uid._zod.def.out._zod.def.transform,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.mcpConnectionProfileTool._zod.def.innerType.shape.mcpConnectionProfile.shape.uid._zod.def.out._zod.def.transform,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.mcpConnectionProfileTool._zod.def.innerType.shape.uid._zod.def.out._zod.def.transform,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.samplingRequest._zod.def.innerType.shape.responseRole._zod.def.innerType,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.samplingRequest._zod.def.innerType.shape.status,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.samplingRequest._zod.def.innerType.shape.uid._zod.def.out._zod.def.transform,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.status,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.taskRequest._zod.def.innerType.shape.status,e.shape.assistantResponses._zod.def.element.shape.toolCalls._zod.def.element.shape.taskRequest._zod.def.innerType.shape.uid._zod.def.out._zod.def.transform,e.shape.assistantResponses._zod.def.element.shape.uid._zod.def.out._zod.def.transform,e.shape.parent._zod.def.innerType.shape.role,e.shape.parent._zod.def.innerType.shape.uid._zod.def.out._zod.def.transform,e.shape.uid._zod.def.out._zod.def.transform],n=(e=>e.trim()),r=t[0],i=t[1],a=(e=>e.toLowerCase()===e),s=(e=>e.length>0),l=t[2],u=t[3],p=t[4],m=t[5],h=t[6],g=t[7].safeParse.bind(t[7]),_=t[8].safeParse.bind(t[8]),v=Ee,b=t[9].safeParse.bind(t[9]),x=t[10
10],S=t[11],C=t[12],w=t[13].safeParse.bind(t[13]),T=t[14].safeParse.bind(t[14]),E=t[15],D=t[16].safeParse.bind(t[16]),O=t[17].safeParse.bind(t[17]),k=t[18],A=t[19],j=t[20].safeParse.bind(t[20]),M=t[21],ee=t[22];function te(e){var t=[],o=e;if(typeof o!=`object`||!o||Array.isArray(o))t.push(L(`object`,o,[]));else{var c=o.agentChatSession;if(c!==null){if(typeof c!=`object`||!c||Array.isArray(c))t.push(L(`object`,c,[`agentChatSession`]));else{var d=c.agent;if(typeof d!=`object`||!d||Array.isArray(d))t.push(L(`object`,d,[`agentChatSession`,`agent`]));else{var f=d.name;typeof f!=`string`&&t.push(L(`string`,f,[`agentChatSession`,`agent`,`name`]));var y=d.uid,te=t.length;typeof y==`string`?(y=n(y),y.length<10&&t.push(ve(10,`string`,!0,y,[`agentChatSession`,`agent`,`uid`])),y.length>10&&t.push(R(10,`string`,!0,y,[`agentChatSession`,`agent`,`uid`])),_r.test(y)||t.push(ke(`string`,`regex`,y,[`agentChatSession`,`agent`,`uid`],{pattern:_r.toString()}))):(t.push(L(`string`,y,[`agentChatSession`,`agent`,`uid`])),y!=null&&y.length!==void 0&&(y.length<10&&t.push(ve(10,Ae(y),!0,y,[`agentChatSession`,`agent`,`uid`])),y.length>10&&t.push(R(10,Ae(y),!0,y,[`agentChatSession`,`agent`,`uid`])))),t.length===te&&(y=r(y));var ne={name:f};(y!==void 0||`uid`in d)&&(ne.uid=y),d=ne}var N=c.uid,re=t.length;typeof N==`string`?(N=n(N),N.length<10&&t.push(ve(10,`string`,!0,N,[`agentChatSession`,`uid`])),N.length>10&&t.push(R(10,`string`,!0,N,[`agentChatSession`,`uid`])),_r.test(N)||t.push(ke(`string`,`regex`,N,[`agentChatSession`,`uid`],{pattern:_r.toString()}))):(t.push(L(`string`,N,[`agentChatSession`,`uid`])),N!=null&&N.length!==void 0&&(N.length<10&&t.push(ve(10,Ae(N),!0,N,[`agentChatSession`,`uid`])),N.length>10&&t.push(R(10,Ae(N),!0,N,[`agentChatSession`,`uid`])))),t.length===re&&(N=i(N));var ie={agent:d};(N!==void 0||`uid`in c)&&(ie.uid=N),c=ie}}var P=o.assistantResponses;if(!Array.isArray(P))t.push(L(`array`,P,[`assistantResponses`]));else{P=P.slice();for(var F=0;F<P.length;F++)if(typeof P[F]!=`object`||P[F]===null||Array.isArray(P[F]))t.push(L(`object`,P[F],[`assistantResponses`,F]));else{var I=P[F].clientCompletionRequestId;I!==null&&(typeof I==`string`?Se.test(I)||t.push(ke(`string`,`uuid`,I,[`assistantResponses`,F,`clientCompletionRequestId`],{pattern:xe})):t.push(L(`string`,I,[`assistantResponses`,F,`clientCompletionRequestId`])));var ae=P[F].completionRequest;if(ae!==null){if(typeof ae!=`object`||!ae||Array.isArray(ae))t.push(L(`object`,ae,[`assistantResponses`,F,`completionRequest`]));else{var oe=ae.referenceId;typeof oe==`string`?Se.test(oe)||t.push(ke(`string`,`uuid`,oe,[`assistantResponses`,F,`completionRequest`,`referenceId`],{pattern:xe})):t.push(L(`string`,oe,[`assistantResponses`,F,`completionRequest`,`referenceId`])),ae={referenceId:oe}}}var se=P[F].content;typeof se!=`string`&&t.push(L(`string`,se,[`assistantResponses`,F,`content`]));var ce=P[F].error;if(ce!==null){if(typeof ce!=`object`||!ce||Array.isArray(ce))t.push(L(`object`,ce,[`assistantResponses`,F,`error`]));else{var le=ce.code;le!==null&&typeof le!=`string`&&t.push(L(`string`,le,[`assistantResponses`,F,`error`,`code`]));var ue=ce.message;ue!==null&&typeof ue!=`string`&&t.push(L(`string`,ue,[`assistantResponses`,F,`error`,`message`]));var de=ce.sentryErrorExternalId;de!==null&&typeof de!=`string`&&t.push(L(`string`,de,[`assistantResponses`,F,`error`,`sentryErrorExternalId`])),ce={code:le,message:ue,sentryErrorExternalId:de}}}var fe=P[F].finishReason;fe!==null&&typeof fe!=`string`&&t.push(L(`string`,fe,[`assistantResponses`,F,`finishReason`]));var pe=P[F].hostedLlmModel;if(typeof pe!=`object`||!pe||Array.isArray(pe))t.push(L(`object`,pe,[`assistantResponses`,F,`hostedLlmModel`]));else{var me=pe.alias;me!==null&&(typeof me==`string`?(a(me)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`alias`],input:me,message:`Model alias must be lowercase`}),s(me)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`alias`],input:me,message:`Model alias is required`}),l(me)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`alias`],input:me,message:`Model alias must start and end with a lowercase letter and contain only lowercase letters, numbers, dots, and hyphens`})):t.push(L(`string`,me,[`assistantResponses`,F,`hostedLlmModel`,`alias`])));var he=pe.llmModel;if(typeof he!=`object`||!he||Array.isArray(he))t.push(L(`object`,he,[`assistantResponses`,F,`hostedLlmModel`,`llmModel`]));else{var ge=he.alias;ge!==null&&(typeof ge==`string`?(a(ge)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`llmModel`,`alias`],input:ge,message:`Model alias must be lowercase`}),s(ge)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`llmModel`,`alias`],input:ge,message:`Model alias is required`}),u(ge)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`llmModel`,`alias`],input:ge,message:`Model alias must start and end with a lowercase letter and contain only lowercase letters, numbers, dots, and hyphens`})):t.push(L(`string`,ge,[`assistantResponses`,F,`hostedLlmModel`,`llmModel`,`alias`])));var ye=he.name;typeof ye==`string`?(a(ye)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`llmModel`,`name`],input:ye,message:`Model name must be lowercase`}),s(ye)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`llmModel`,`name`],input:ye,message:`Model name is required`}),p(ye)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`llmModel`,`name`],input:ye,message:`Model name must start and end with a lowercase letter and contain only lowercase letters, numbers, dots, and hyphens`})):t.push(L(`string`,ye,[`assistantResponses`,F,`hostedLlmModel`,`llmModel`,`name`])),he={alias:ge,name:ye}}var Ee=pe.llmProvider;if(typeof Ee!=`object`||!Ee||Array.isArray(Ee))t.push(L(`object`,Ee,[`assistantResponses`,F,`hostedLlmModel`,`llmProvider`]));else{var Oe=Ee.displayName;typeof Oe!=`string`&&t.push(L(`string`,Oe,[`assistantResponses`,F,`hostedLlmModel`,`llmProvider`,`displayName`]));var z=Ee.name;typeof z==`string`?(a(z)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`llmProvider`,`name`],input:z,message:`LLM provider name must be lowercase`}),s(z)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`llmProvider`,`name`],input:z,message:`LLM provider name is required`}),m(z)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`llmProvider`,`name`],input:z,message:`LLM provider name must start and end with a lowercase letter and contain only lowercase letters, numbers, dots, and hyphens`})):t.push(L(`string`,z,[`assistantResponses`,F,`hostedLlmModel`,`llmProvider`,`name`])),Ee={displayName:Oe,name:z}}var je=pe.name;typeof je==`string`?(a(je)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`name`],input:je,message:`Model name must be lowercase`}),s(je)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`name`],input:je,message:`Model name is required`}),h(je)||t.push({code:`custom`,path:[`assistantResponses`,F,`hostedLlmModel`,`name`],input:je,message:`Model name must start and end with a lowercase letter and contain only lowercase letters, numbers, dots, and hyphens`})):t.push(L(`string`,je,[`assistantResponses`,F,`hostedLlmModel`,`name`])),pe={alias:me,llmModel:he,llmProvider:Ee,name:je}}var Me=P[F].reasoningContent;typeof Me!=`string`&&t.push(L(`string`,Me,[`assistantResponses`,F,`reasoningContent`]));var Ne=P[F].reasoningTokens;Ne!==null&&(typeof Ne==`number`?Number.isNaN(Ne)?t.push({expected:`number`,code:`invalid_type`,received:`NaN`,input:Ne,path:[`assistantResponses`,F,`reasoningTokens`]}):Number.isFinite(Ne)||t.push({expected:`number`,code:`invalid_type`,received:`Infinity`,input:Ne,path:[`assistantResponses`,F,`reasoningTokens`]}):t.push(L(`number`,Ne,[`assistantResponses`,F,`reasoningTokens`])));var Pe=P[F].status,Fe=g(Pe);if(Fe.success)Pe=Fe.data;else for(var Ie=Fe.error.issues,Le=0;Le<Ie.length;Le++)t.push({...Ie[Le],path:[`assistantResponses`,F,`status`].concat(Ie[Le].path)});var B=P[F].toolCalls;if(!Array.isArray(B))t.push(L(`array`,B,[`assistantResponses`,F,`toolCalls`]));else{B=B.slice();for(var V=0;V<B.length;V++)if(typeof B[V]!=`object`||B[V]===null||Array.isArray(B[V]))t.push(L(`object`,B[V],[`assistantResponses`,F,`toolCalls`,V]));else{var Re=B[V].args,ze=B[V].calledAt;ze!==null&&(typeof ze==`string`?De.test(ze)||t.push(ke(`string`,`datetime`,ze,[`assistantResponses`,F,`toolCalls`,V,`calledAt`],{pattern:we})):t.push(L(`string`,ze,[`assistantResponses`,F,`toolCalls`,V,`calledAt`])));var Be=B[V].elicitationRequest;if(Be!==null){if(typeof Be!=`object`||!Be||Array.isArray(Be))t.push(L(`object`,Be,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`]));else{var Ve=Be.message;typeof Ve!=`string`&&t.push(L(`string`,Ve,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`message`]));var He=Be.requestedSchema;if(typeof He!=`object`||!He||Array.isArray(He))t.push(L(`object`,He,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`requestedSchema`]));else{var Ue=He;Ue.type!==`object`&&t.push(Ce([`object`],Ue.type,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`requestedSchema`,`type`]))}var We=Be.responseAction;if(We!==null){var Ge=_(We);if(Ge.success)We=Ge.data;else for(var Ke=Ge.error.issues,qe=0;qe<Ke.length;qe++)t.push({...Ke[qe],path:[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`responseAction`].concat(Ke[qe].path)})}var Je=Be.responseContent;if(Je!==null){if(!be(Je))t.push(L(`record`,Je,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`responseContent`]));else for(var Ye in Je)if(v.call(Je,Ye)&&Ye!==`__proto__`){var Xe=[];typeof Ye!=`string`&&Xe.push(L(`string`,Ye,[])),Xe.length>0&&t.push({code:`invalid_key`,origin:`record`,issues:_e(Xe),input:Ye,path:[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`responseContent`,Ye]})}}var Ze=Be.status,Qe=b(Ze);if(Qe.success)Ze=Qe.data;else for(var $e=Qe.error.issues,et=0;et<$e.length;et++)t.push({...$e[et],path:[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`status`].concat($e[et].path)});var H=Be.uid,tt=t.length;typeof H==`string`?(H=n(H),H.length<10&&t.push(ve(10,`string`,!0,H,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`uid`])),H.length>10&&t.push(R(10,`string`,!0,H,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`uid`])),_r.test(H)||t.pu
10sh(ke(`string`,`regex`,H,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`uid`],{pattern:_r.toString()}))):(t.push(L(`string`,H,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`uid`])),H!=null&&H.length!==void 0&&(H.length<10&&t.push(ve(10,Ae(H),!0,H,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`uid`])),H.length>10&&t.push(R(10,Ae(H),!0,H,[`assistantResponses`,F,`toolCalls`,V,`elicitationRequest`,`uid`])))),t.length===tt&&(H=x(H));var nt={message:Ve,requestedSchema:He};(We!==void 0||`responseAction`in Be)&&(nt.responseAction=We),nt.responseContent=Je,(Ze!==void 0||`status`in Be)&&(nt.status=Ze),(H!==void 0||`uid`in Be)&&(nt.uid=H),Be=nt}}var rt=B[V].endedAt;rt!==null&&(typeof rt==`string`?De.test(rt)||t.push(ke(`string`,`datetime`,rt,[`assistantResponses`,F,`toolCalls`,V,`endedAt`],{pattern:we})):t.push(L(`string`,rt,[`assistantResponses`,F,`toolCalls`,V,`endedAt`])));var it=B[V].error;if(it!==null){if(!be(it))t.push(L(`record`,it,[`assistantResponses`,F,`toolCalls`,V,`error`]));else for(var at in it)if(v.call(it,at)&&at!==`__proto__`){var ot=[];typeof at!=`string`&&ot.push(L(`string`,at,[])),ot.length>0&&t.push({code:`invalid_key`,origin:`record`,issues:_e(ot),input:at,path:[`assistantResponses`,F,`toolCalls`,V,`error`,at]})}}var st=B[V].mcpConnectionProfileTool;if(st!==null){if(typeof st!=`object`||!st||Array.isArray(st))t.push(L(`object`,st,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`]));else{var ct=st.mcpConnectionProfile;if(typeof ct!=`object`||!ct||Array.isArray(ct))t.push(L(`object`,ct,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`mcpConnectionProfile`]));else{var lt=ct.name;typeof lt!=`string`&&t.push(L(`string`,lt,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`mcpConnectionProfile`,`name`]));var U=ct.uid,ut=t.length;typeof U==`string`?(U=n(U),U.length<10&&t.push(ve(10,`string`,!0,U,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`mcpConnectionProfile`,`uid`])),U.length>10&&t.push(R(10,`string`,!0,U,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`mcpConnectionProfile`,`uid`])),_r.test(U)||t.push(ke(`string`,`regex`,U,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`mcpConnectionProfile`,`uid`],{pattern:_r.toString()}))):(t.push(L(`string`,U,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`mcpConnectionProfile`,`uid`])),U!=null&&U.length!==void 0&&(U.length<10&&t.push(ve(10,Ae(U),!0,U,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`mcpConnectionProfile`,`uid`])),U.length>10&&t.push(R(10,Ae(U),!0,U,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`mcpConnectionProfile`,`uid`])))),t.length===ut&&(U=S(U));var dt={name:lt};(U!==void 0||`uid`in ct)&&(dt.uid=U),ct=dt}var ft=st.name;typeof ft!=`string`&&t.push(L(`string`,ft,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`name`]));var W=st.uid,pt=t.length;typeof W==`string`?(W=n(W),W.length<10&&t.push(ve(10,`string`,!0,W,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`uid`])),W.length>10&&t.push(R(10,`string`,!0,W,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`uid`])),_r.test(W)||t.push(ke(`string`,`regex`,W,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`uid`],{pattern:_r.toString()}))):(t.push(L(`string`,W,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`uid`])),W!=null&&W.length!==void 0&&(W.length<10&&t.push(ve(10,Ae(W),!0,W,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`uid`])),W.length>10&&t.push(R(10,Ae(W),!0,W,[`assistantResponses`,F,`toolCalls`,V,`mcpConnectionProfileTool`,`uid`])))),t.length===pt&&(W=C(W));var mt={mcpConnectionProfile:ct,name:ft};(W!==void 0||`uid`in st)&&(mt.uid=W),st=mt}}var ht=B[V].progress;ht!==null&&(typeof ht==`number`?Number.isNaN(ht)?t.push({expected:`number`,code:`invalid_type`,received:`NaN`,input:ht,path:[`assistantResponses`,F,`toolCalls`,V,`progress`]}):Number.isFinite(ht)||t.push({expected:`number`,code:`invalid_type`,received:`Infinity`,input:ht,path:[`assistantResponses`,F,`toolCalls`,V,`progress`]}
10):t.push(L(`number`,ht,[`assistantResponses`,F,`toolCalls`,V,`progress`])));var gt=B[V].progressTotal;gt!==null&&(typeof gt==`number`?Number.isNaN(gt)?t.push({expected:`number`,code:`invalid_type`,received:`NaN`,input:gt,path:[`assistantResponses`,F,`toolCalls`,V,`progressTotal`]}):Number.isFinite(gt)||t.push({expected:`number`,code:`invalid_type`,received:`Infinity`,input:gt,path:[`assistantResponses`,F,`toolCalls`,V,`progressTotal`]}):t.push(L(`number`,gt,[`assistantResponses`,F,`toolCalls`,V,`progressTotal`])));var _t=B[V].result,vt=B[V].resultIndicatesError;typeof vt!=`boolean`&&t.push(L(`boolean`,vt,[`assistantResponses`,F,`toolCalls`,V,`resultIndicatesError`]));var G=B[V].samplingRequest;if(G!==null){if(typeof G!=`object`||!G||Array.isArray(G))t.push(L(`object`,G,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`]));else{var yt=G.maxTokens;typeof yt==`number`?Number.isNaN(yt)?t.push({expected:`number`,code:`invalid_type`,received:`NaN`,input:yt,path:[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`maxTokens`]}):Number.isFinite(yt)||t.push({expected:`number`,code:`invalid_type`,received:`Infinity`,input:yt,path:[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`maxTokens`]}):t.push(L(`number`,yt,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`maxTokens`]));var bt=G.messages;if(!Array.isArray(bt))t.push(L(`array`,bt,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`messages`]));else for(var xt=0;xt<bt.length;xt++);var St=G.responseContent,Ct=G.responseModel;Ct!==null&&typeof Ct!=`string`&&t.push(L(`string`,Ct,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`responseModel`]));var wt=G.responseRole;if(wt!==null){var Tt=w(wt);if(Tt.success)wt=Tt.data;else for(var Et=Tt.error.issues,Dt=0;Dt<Et.length;Dt++)t.push({...Et[Dt],path:[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`responseRole`].concat(Et[Dt].path)})}var Ot=G.responseStopReason;Ot!==null&&typeof Ot!=`string`&&t.push(L(`string`,Ot,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`responseStopReason`]));var kt=G.status,At=T(kt);if(At.success)kt=At.data;else for(var jt=At.error.issues,Mt=0;Mt<jt.length;Mt++)t.push({...jt[Mt],path:[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`status`].concat(jt[Mt].path)});var K=G.uid,Nt=t.length;typeof K==`string`?(K=n(K),K.length<10&&t.push(ve(10,`string`,!0,K,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`uid`])),K.length>10&&t.push(R(10,`string`,!0,K,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`uid`])),_r.test(K)||t.push(ke(`string`,`regex`,K,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`uid`],{pattern:_r.toString()}))):(t.push(L(`string`,K,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`uid`])),K!=null&&K.length!==void 0&&(K.length<10&&t.push(ve(10,Ae(K),!0,K,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`uid`])),K.length>10&&t.push(R(10,Ae(K),!0,K,[`assistantResponses`,F,`toolCalls`,V,`samplingRequest`,`uid`])))),t.length===Nt&&(K=E(K));var Pt={maxTokens:yt,messages:bt};(St!==void 0||`responseContent`in G)&&(Pt.responseContent=St),Pt.responseModel=Ct,(wt!==void 0||`responseRole`in G)&&(Pt.responseRole=wt),Pt.responseStopReason=Ot,(kt!==void 0||`status`in G)&&(Pt.status=kt),(K!==void 0||`uid`in G)&&(Pt.uid=K),G=Pt}}var Ft=B[V].status,It=D(Ft);if(It.success)Ft=It.data;else for(var Lt=It.error.issues,Rt=0;Rt<Lt.length;Rt++)t.push({...Lt[Rt],path:[`assistantResponses`,F,`toolCalls`,V,`status`].concat(Lt[Rt].path)});var zt=B[V].taskRequest;if(zt!==null){if(typeof zt!=`object`||!zt||Array.isArray(zt))t.push(L(`object`,zt,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`]));else{var q=zt.lastUpdatedAt;typeof q==`string`?De.test(q)||t.push(ke(`string`,`datetime`,q,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`lastUpdatedAt`],{pattern:we})):t.push(L(`string`,q,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`lastUpdatedAt`]));var J=zt.pollInterval;J!==null&&(typeof J==`number`?Number.isNaN(J)?t.push({expected:`number`,code:`invalid_type`,received:`NaN`,input:J,path:[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`pollInterval`]}
10):Number.isFinite(J)||t.push({expected:`number`,code:`invalid_type`,received:`Infinity`,input:J,path:[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`pollInterval`]}):t.push(L(`number`,J,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`pollInterval`])));var Y=zt.status,Bt=O(Y);if(Bt.success)Y=Bt.data;else for(var Vt=Bt.error.issues,Ht=0;Ht<Vt.length;Ht++)t.push({...Vt[Ht],path:[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`status`].concat(Vt[Ht].path)});var Ut=zt.statusMessage;Ut!==null&&typeof Ut!=`string`&&t.push(L(`string`,Ut,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`statusMessage`]));var Wt=zt.taskId;typeof Wt!=`string`&&t.push(L(`string`,Wt,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`taskId`]));var Gt=zt.ttl;Gt!==null&&(typeof Gt==`number`?Number.isNaN(Gt)?t.push({expected:`number`,code:`invalid_type`,received:`NaN`,input:Gt,path:[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`ttl`]}):Number.isFinite(Gt)||t.push({expected:`number`,code:`invalid_type`,received:`Infinity`,input:Gt,path:[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`ttl`]}):t.push(L(`number`,Gt,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`ttl`])));var X=zt.uid,Kt=t.length;typeof X==`string`?(X=n(X),X.length<10&&t.push(ve(10,`string`,!0,X,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`uid`])),X.length>10&&t.push(R(10,`string`,!0,X,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`uid`])),_r.test(X)||t.push(ke(`string`,`regex`,X,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`uid`],{pattern:_r.toString()}))):(t.push(L(`string`,X,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`uid`])),X!=null&&X.length!==void 0&&(X.length<10&&t.push(ve(10,Ae(X),!0,X,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`uid`])),X.length>10&&t.push(R(10,Ae(X),!0,X,[`assistantResponses`,F,`toolCalls`,V,`taskRequest`,`uid`])))),t.length===Kt&&(X=k(X));var qt={lastUpdatedAt:q,pollInterval:J};(Y!==void 0||`status`in zt)&&(qt.status=Y),qt.statusMessage=Ut,qt.taskId=Wt,qt.ttl=Gt,(X!==void 0||`uid`in zt)&&(qt.uid=X),zt=qt}}var Jt=B[V].toolCallExternalId;typeof Jt!=`string`&&t.push(L(`string`,Jt,[`assistantResponses`,F,`toolCalls`,V,`toolCallExternalId`]));var Yt=B[V].toolName;typeof Yt!=`string`&&t.push(L(`string`,Yt,[`assistantResponses`,F,`toolCalls`,V,`toolName`]));var Xt=B[V].uiResourceHtml;Xt!==null&&typeof Xt!=`string`&&t.push(L(`string`,Xt,[`assistantResponses`,F,`toolCalls`,V,`uiResourceHtml`]));var Zt={};(Re!==void 0||`args`in B[V])&&(Zt.args=Re),Zt.calledAt=ze,Zt.elicitationRequest=Be,Zt.endedAt=rt,Zt.error=it,Zt.mcpConnectionProfileTool=st,Zt.progress=ht,Zt.progressTotal=gt,(_t!==void 0||`result`in B[V])&&(Zt.result=_t),Zt.resultIndicatesError=vt,Zt.samplingRequest=G,(Ft!==void 0||`status`in B[V])&&(Zt.status=Ft),Zt.taskRequest=zt,Zt.toolCallExternalId=Jt,Zt.toolName=Yt,Zt.uiResourceHtml=Xt,B[V]=Zt}}var Z=P[F].uid,Qt=t.length;typeof Z==`string`?(Z=n(Z),Z.length<10&&t.push(ve(10,`string`,!0,Z,[`assistantResponses`,F,`uid`])),Z.length>10&&t.push(R(10,`string`,!0,Z,[`assistantResponses`,F,`uid`])),_r.test(Z)||t.push(ke(`string`,`regex`,Z,[`assistantResponses`,F,`uid`],{pattern:_r.toString()}))):(t.push(L(`string`,Z,[`assistantResponses`,F,`uid`])),Z!=null&&Z.length!==void 0&&(Z.length<10&&t.push(ve(10,Ae(Z),!0,Z,[`assistantResponses`,F,`uid`])),Z.length>10&&t.push(R(10,Ae(Z),!0,Z,[`assistantResponses`,F,`uid`])))),t.length===Qt&&(Z=A(Z));var $t={clientCompletionRequestId:I,completionRequest:ae,content:se,error:ce,finishReason:fe,hostedLlmModel:pe,reasoningContent:Me,reasoningTokens:Ne};(Pe!==void 0||`status`in P[F])&&($t.status=Pe),$t.toolCalls=B,(Z!==void 0||`uid`in P[F])&&($t.uid=Z),P[F]=$t}}var en=o.content;if(typeof en!=`object`||!en||Array.isArray(en))t.push(L(`object`,en,[`content`]));else{var tn=en.content;typeof tn!=`string`&&t.push(L(`string`,tn,[`content`,`content`]));var nn=en.type;nn!==`markdown`&&t.push(Ce([`markdown`],nn,[`content`,`type`])),en={content:tn,type:nn}}var rn=o.deletedAt;rn!==null&&(typeof rn==`string`?De.test(rn)||t.push(ke(`string`,`datetime`,rn,[`deletedAt`],{pattern:we})):t.push(L(`string`,rn,[`deletedAt`])));var an=o.parent;if(an!==null){if(typeof an!=`object`||!an||Array.isArray(an))t.push(L(`object`,an,[`parent`]));else{var on=an.receivedAt;typeof on==`string`?De.test(on)||t.push(ke(`string`,`datetime`,on,[`parent`,`receivedAt`],{pattern:we})):t.push(L(`string`,on,[`parent`,`receivedAt`]));var sn=an.role,cn=j(sn);if(cn.success)sn=cn.data;else for(var ln=cn.error.issues,un=0;un<ln.length;un++)t.push({...ln[un],path:[`parent`,`role`].concat(ln[un].path)});var Q=an.uid,dn=t.length;typeof Q==`string`?(Q=n(Q),Q.length<10&&t.push(ve(10,`string`,!0,Q,[`parent`,`uid`])),Q.length>10&&t.push(R(10,`string`,!0,Q,[`parent`,`uid`])),_r.test(Q)||t.pu
10sh(ke(`string`,`regex`,Q,[`parent`,`uid`],{pattern:_r.toString()}))):(t.push(L(`string`,Q,[`parent`,`uid`])),Q!=null&&Q.length!==void 0&&(Q.length<10&&t.push(ve(10,Ae(Q),!0,Q,[`parent`,`uid`])),Q.length>10&&t.push(R(10,Ae(Q),!0,Q,[`parent`,`uid`])))),t.length===dn&&(Q=M(Q));var fn={receivedAt:on};(sn!==void 0||`role`in an)&&(fn.role=sn),(Q!==void 0||`uid`in an)&&(fn.uid=Q),an=fn}}var pn=o.receivedAt;typeof pn==`string`?De.test(pn)||t.push(ke(`string`,`datetime`,pn,[`receivedAt`],{pattern:we})):t.push(L(`string`,pn,[`receivedAt`]));var mn=o.role;mn!==`assistant`&&t.push(Ce([`assistant`],mn,[`role`]));var hn=o.suggestedActions;if(hn!==null){if(!Array.isArray(hn))t.push(L(`array`,hn,[`suggestedActions`]));else for(var gn=0;gn<hn.length;gn++)typeof hn[gn]!=`string`&&t.push(L(`string`,hn[gn],[`suggestedActions`,gn]))}var $=o.uid,_n=t.length;typeof $==`string`?($=n($),$.length<10&&t.push(ve(10,`string`,!0,$,[`uid`])),$.length>10&&t.push(R(10,`string`,!0,$,[`uid`])),_r.test($)||t.push(ke(`string`,`regex`,$,[`uid`],{pattern:_r.toString()}))):(t.push(L(`string`,$,[`uid`])),$!=null&&$.length!==void 0&&($.length<10&&t.push(ve(10,Ae($),!0,$,[`uid`])),$.length>10&&t.push(R(10,Ae($),!0,$,[`uid`])))),t.length===_n&&($=ee($));var vn={agentChatSession:c,assistantResponses:P,content:en,deletedAt:rn,parent:an,receivedAt:pn,role:mn,suggestedActions:hn};($!==void 0||`uid`in o)&&(vn.uid=$),o=vn}return t.length===0?{success:!0,data:o}:Te(t,o)}return ye(te,e,null,null)})(),xr=({content:e,projectUid:t})=>e.type===`projectMemoryReference`?{...e,attrs:{...typeof e.attrs==`object`&&e.attrs?e.attrs:{},projectUid:t}}:!e.content||!Array.isArray(e.content)?e:{...e,content:e.content.map(e=>xr({content:e,projectUid:t}))},Sr=()=>{let e=(0,J.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[`pretty`,`markdown`,`plain-text`],e[0]=t):t=e[0];let[n,r]=bt(t),i;return e[1]!==n||e[2]!==r?(i=[n,r],e[1]=n,e[2]=r,e[3]=i):i=e[3],i},Cr=(e,t)=>{let n=(0,J.c)(24),[r,i]=(0,Y.useState)(e),a;n[0]===e.assistantResponses?a=n[1]:(a=e.assistantResponses.some(Or),n[0]=e.assistantResponses,n[1]=a);let o=a,s;n[2]!==e.uid||n[3]!==o?(s=o?D(`/api/completions/:chatSessionMessageUid`,{params:{chatSessionMessageUid:e.uid}}):null,n[2]=e.uid,n[3]=o,n[4]=s):s=n[4];let c=dn(s),l;if(n[5]!==c.data||n[6]!==c.status||n[7]!==o){bb0:{if(!o||!c.data){l=null;break bb0}try{l=ge(br,ee(c.data))}catch(e){P({error:e,extra:{event:{data:c.data,status:c.status}},level:`error`,message:`could not parse event`}),l=null}}n[5]=c.data,n[6]=c.status,n[7]=o,n[8]=l}else l=n[8];let u=l,d,f;n[9]===u?(d=n[10],f=n[11]):(d=()=>{u&&i(u)},f=[u],n[9]=u,n[10]=d,n[11]=f),(0,Y.useEffect)(d,f);let p;n[12]===r.assistantResponses?p=n[13]:(p=r.assistantResponses.some(kr),n[12]=r.assistantResponses,n[13]=p);let m=p,h;n[14]===r.assistantResponses?h=n[15]:(h=mn(r.assistantResponses)?.status,n[14]=r.assistantResponses,n[15]=h);let g=h,_,v;n[16]!==g||n[17]!==t?(_=()=>{g&&t(g)},v=[g,t],n[16]=g,n[17]=t,n[18]=_,n[19]=v):(_=n[18],v=n[19]),(0,Y.useEffect)(_,v);let y=o&&!u&&m,b;return n[20]!==r||n[21]!==m||n[22]!==y?(b={chatMessage:r,isInitialLoading:y,streaming:m},n[20]=r,n[21]=m,n[22]=y,n[23]=b):b=n[23],b},wr=(e,t)=>{let n=(0,J.c)(6),r;n[0]!==e||n[1]!==t?(r=()=>{t&&fetch(D(`/api/message/:uid/interrupt`,{params:{uid:e}}),{method:`POST`}).catch(Ar)},n[0]=e,n[1]=t,n[2]=r):r=n[2];let i=r,a;n[3]!==i||n[4]!==t?(a={callback:i,enabled:t,key:`Escape`},n[3]=i,n[4]=t,n[5]=a):a=n[5],ht(a)},Tr=(e,t)=>{let n=(0,J.c)(9),[r,i]=(0,Y.useState)(!1),a=r&&!t,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{i(jr)},n[0]=o):o=n[0];let s=o,c;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{i(!1)},n[1]=c):c=n[1];let l=c,u;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{i(!1)},n[2]=u):u=n[2];let d=u,f;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>i(!0),n[3]=f):f=n[3];let p=e&&!a,m;n[4]===p?m=n[5]:(m={callback:f,enabled:p,key:`e`},n[4]=p,n[5]=m),ht(m);let h;return n[6]!==a||n[7]!==r?(h={editing:a,editingIntent:r,handleCancel:l,handleSubmit:d,toggleEditing:s},n[6]=a,n[7]=r,n[8]=h):h=n[8],h},Er=e=>{let t=(0,J.c)(10),{content:n,format:r,projectUid:i,streaming:a}=e,o=pn(n,a??!1),s;bb0:{if(!i){s=void 0;break bb0}let e;t[0]===i?e=t[1]:(e=e=>xr({content:e,projectUid:i}),t[0]=i,t[1]=e),s=e}let c=s;if(r===`pretty`){let e;return t[2]!==o||t[3]!==c?(e=(0,q.jsx)(gt,{children:(0,q.jsx)(ft,{chunked:!0,transformTiptapNodes:c,children:o})}),t[2]=o,t[3]=c,t[4]=e):e=t[4],e}let l;t[5]!==o||t[6]!==r?(l=r===`plain-text`?vt(o):o,t[5]=o,t[6]=r,t[7]=l):l=t[7];let u=l,d;return t[8]===u?d=t[9]:(d=(0,q.jsx)(`div`,{className:`jsgMqa jLqugF gNOQHw`,"data-sentry-component":`Message`,"data-sentry-source-file":`AssistantChatMessageBubble.tsx`,children:u}),t[8]=u,t[9]=d),d},Dr=e=>{let t=(0,J.c)(35),{chatMessage:n,fetchMentionsSuggestions:r,focused:i,onAssistantResponseStatusChange:a,onSuggestedActionClick:o,projectUid:s}=e,{chatMessage:c,isInitialLoading:l,streaming:u}=Cr(n,a);wr(c.uid,u);let[d,f]=Sr(),{editing:p,handleCancel:m,handleSubmit:h,toggleEditing:g}=Tr(i,u);if(l){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(`div`,{"data-streaming":`true`,"data-testid":`assistant-response`,children:(0,q.jsx)(rn,{state:`idle`})}),t[0]=e):e=t[0],e}let _;t[1]===c.content.content?_=t[2]:(_=c.content.content.trim(),t[1]=c.content.content,t[2]=_);let v=_.length>0,y=u&&!v,b=c.assistantResponses.length-1,x=i?!0:void 0,S=u?!0:void 0,C;t[3]!==c||t[4]!==p||t[5]!==r||t[6]!==d||t[7]!==m||t[8]!==h||t[9]!==v||t[10]!==b||t[11]!==s||t[12]!==u?(C=p?(0,q.jsx)(Ln,{chatMessage:c,fetchMentionsSuggestions:r,onCancel:m,onSubmit:h}):c.assistantResponses.length===0&&v?(0,q.jsx)(Er,{content:c.content.content,format:d,projectUid:s,streaming:u}):c.assistantResponses.map((e,t)=>{let n=t===b,r=e.status===`queued`||e.status===`started`,i=e.content.trim().length>0;return(0,q.jsxs)(Y.Fragment,{children:[(e.reasoningContent.trim().length>0||r&&e.reasoningTokens!==null)&&(0,q.jsx)(Vn,{content:e.reasoningContent,reasoningTokens:e.reasoningTokens,streaming:r}
10),i&&(0,q.jsx)(Er,{content:e.content,format:d,projectUid:s,streaming:r}),e.error&&(0,q.jsx)(Fn,{clientCompletionRequestId:e.clientCompletionRequestId,code:e.error.code,message:e.error.message,sentryErrorExternalId:e.error.sentryErrorExternalId}),e.toolCalls.length>0&&(0,q.jsx)(dr,{toolCalls:e.toolCalls}),e.toolCalls.map(Mr),n&&r&&(!i||e.toolCalls.length>0)&&(0,q.jsx)(rn,{state:`idle`})]},e.uid)}),t[3]=c,t[4]=p,t[5]=r,t[6]=d,t[7]=m,t[8]=h,t[9]=v,t[10]=b,t[11]=s,t[12]=u,t[13]=C):C=t[13];let w;t[14]!==c.assistantResponses.length||t[15]!==y?(w=y&&c.assistantResponses.length===0&&(0,q.jsx)(rn,{state:`idle`}),t[14]=c.assistantResponses.length,t[15]=y,t[16]=w):w=t[16];let T;t[17]!==c||t[18]!==p||t[19]!==i||t[20]!==d||t[21]!==g||t[22]!==f?(T=(0,q.jsx)(vn,{chatMessage:c,editing:p,focused:i,format:d,toggleEditing:g,toggleFormat:f,"data-sentry-element":`AssistantMessageFooter`,"data-sentry-source-file":`AssistantChatMessageBubble.tsx`}),t[17]=c,t[18]=p,t[19]=i,t[20]=d,t[21]=g,t[22]=f,t[23]=T):T=t[23];let E;t[24]!==c.suggestedActions||t[25]!==o||t[26]!==u?(E=!u&&c.suggestedActions&&c.suggestedActions.length>0&&o&&(0,q.jsx)(Bn,{actions:c.suggestedActions,onActionClick:o}),t[24]=c.suggestedActions,t[25]=o,t[26]=u,t[27]=E):E=t[27];let D;return t[28]!==x||t[29]!==S||t[30]!==C||t[31]!==w||t[32]!==T||t[33]!==E?(D=(0,q.jsxs)(`div`,{className:`fjLFrW fITofF! ihYese fPSBzf bnYmbW jrIcfy`,"data-current":x,"data-streaming":S,"data-testid":`assistant-response`,"data-sentry-component":`AssistantChatMessageBubble`,"data-sentry-source-file":`AssistantChatMessageBubble.tsx`,children:[C,w,T,E]}),t[28]=x,t[29]=S,t[30]=C,t[31]=w,t[32]=T,t[33]=E,t[34]=D):D=t[34],D};function Or(e){return e.status===`queued`||e.status===`started`}function kr(e){return e.status===`queued`||e.status===`started`}function Ar(e){P({error:e,level:`error`,message:`could not interrupt completion`})}function jr(e){return!e}function Mr(e){return e.uiResourceHtml?(0,q.jsx)(An,{html:e.uiResourceHtml,mcpConnectionProfileUid:e.mcpConnectionProfileTool?.mcpConnectionProfile.uid??null,toolArgs:e.args,toolResult:e.result},e.toolCallExternalId):null}var Nr=e=>{let t=(0,J.c)(15),{chatSessionMessage:n,children:r,focused:i,onMessageFocussed:a}=e,o=i?!0:void 0,s,c;t[0]!==n||t[1]!==i||t[2]!==a?(s=()=>{i||(k.debug(`focus message :chatSessionMessageUid (click)`,{chatSessionMessageUid:n.uid}),a(n))},c=()=>{i||(k.debug(`focus message :chatSessionMessageUid`,{chatSessionMessageUid:n.uid}),a(n))},t[0]=n,t[1]=i,t[2]=a,t[3]=s,t[4]=c):(s=t[3],c=t[4]);let l;t[5]!==n.uid||t[6]!==i?(l=(0,q.jsx)(Ut,{attributes:{chatSessionMessageUid:n.uid,focused:i},"data-sentry-element":`DebugDetail`,"data-sentry-source-file":`MessageFocussedIndicator.tsx`}),t[5]=n.uid,t[6]=i,t[7]=l):l=t[7];let u;return t[8]!==n.uid||t[9]!==r||t[10]!==o||t[11]!==s||t[12]!==c||t[13]!==l?(u=(0,q.jsxs)(`div`,{className:`iAOCYK hLQceJ aEwIy eXMQhb gfiiji bEojx bbiGDJ idUWTB dDosZq hGkggQ hgfbDa fwULYN jTWvec`,"data-focus":o,"data-message-uid":n.uid,onClick:s,onFocus:c,tabIndex:0,"data-sentry-component":`MessageFocussedIndicator`,"data-sentry-source-file":`MessageFocussedIndicator.tsx`,children:[l,r]}),t[8]=n.uid,t[9]=r,t[10]=o,t[11]=s,t[12]=c,t[13]=l,t[14]=u):u=t[14],u},Pr=e=>{let t=(0,J.c)(25),{chatMessage:n,editing:r,focused:i,role:a,toggleEditing:o}=e,s;t[0]===i?s=t[1]:(s=i?(0,q.jsx)(`kbd`,{className:_t,children:`e`}):null,t[0]=i,t[1]=s);let c;t[2]!==r||t[3]!==s||t[4]!==o?(c=(0,q.jsxs)(`button`,{className:G,"data-disabled":r,onClick:o,type:`button`,children:[`Edit`,s]}),t[2]=r,t[3]=s,t[4]=o,t[5]=c):c=t[5];let l,u;t[6]!==n||t[7]!==r||t[8]!==i?(l=(0,q.jsx)(gn,{chatMessage:n,editing:r,focused:i,"data-sentry-element":`ForkButton`,"data-sentry-source-file":`MessageFooter.tsx`}),u=(0,q.jsx)(hn,{chatMessage:n,editing:r,focused:i,"data-sentry-element":`DeleteButton`,"data-sentry-source-file":`MessageFooter.tsx`}),t[6]=n,t[7]=r,t[8]=i,t[9]=l,t[10]=u):(l=t[9],u=t[10]);let d;t[11]!==c||t[12]!==l||t[13]!==u?(d=(0,q.jsxs)(`div`,{className:`bYPztT czikZZ fPSBzf bAasmd jrPWok jrIcfy dYDBYd`,children:[c,l,u]}),t[11]=c,t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===a?f=t[16]:(f=(0,q.jsx)(`span`,{"aria-label":`Message role`,title:`Message role`,children:a}),t[15]=a,t[16]=f);let p;t[17]===n.receivedAt?p=t[18]:(p=(0,q.jsx)(xt,{date:n.receivedAt,"data-sentry-element":`MessageDate`,"data-sentry-source-file":`MessageFooter.tsx`}),t[17]=n.receivedAt,t[18]=p);let m;t[19]!==f||t[20]!==p?(m=(0,q.jsxs)(`div`,{className:`bYPztT czikZZ fPSBzf bAasmd jrPWok jrIcfy dYDBYd`,children:[f,p]}),t[19]=f,t[20]=p,t[21]=m):m=t[21];let h;return t[22]!==d||t[23]!==m?(h=(0,q.jsxs)(`div`,{className:`message-footer fPSBzf hnMRLK jrIcfy dDWCpe`,"data-sentry-component":`MessageFooter`,"data-sentry-source-file":`MessageFooter.tsx`,children:[d,m]}),t[22]=d,t[23]=m,t[24]=h):h=t[24],h},Fr={close:``,mixable:!0,open:``},Ir=class{nodes;marks;options;constructor(e,t,n={}){this.nodes=e,this.marks=t,this.options=n}serialize(e,t={}){let n={...this.options,...t},r=new Lr(this.nodes,this.marks,n);return r.renderContent(e),r.out}},Lr=class{nodes;marks;options;inAutolink=void 0;out=``;atBlockStart=!1;closed=null;delim=``;inTightList=!1;constructor(e,t,n){this.nodes=e,this.marks=t,this.options=n,this.options.tightLists===void 0&&(this.options.tightLists=!1),this.options.hardBreakNodeName===void 0&&(this.options.hardBreakNodeName=`hard_break`)}closeBlock(e){this.closed=e}ensureNewLine(){this.atBlank()||(this.out+=`
11`)}esc(e,t=!1){let n=e.replaceAll(/[*[\\\]_`~]/gu,(t,n)=>t===`_`&&n>0&&n+1<e.length&&/\w/u.test(e[n-1])&&/\w/u.test(e[n+1])?t:`\\`+t);return t&&(n=n.replace(/^(?:\+ |[*>-])/u,`\\$&`).replace(/^(\s*)(#{1,6})(\s|$)/u,`$1\\$2$3`).replace(/^(\s*\d+)\.\s/u,`$1\\. `)),this.options.escapeExtraCharacters&&(n=n.replace(this.options.escapeExtraCharacters,`\\$&`)),n}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
12`),e>1){let t=this.delim,n=/\s+$/u.exec(t);n&&(t=t.slice(0,t.length-n[0].length));for(let n=1;n<e;n++)this.out+=t+`
13`}this.closed=null}}getEnclosingWhitespace(e){return{leading:(/^(\s+)/u.exec(e)??[void 0])[0],trailing:(/(\s+)$/u.exec(e)??[void 0])[0]}}
13markString(e,t,n,r){let i=this.getMark(e.type.name),a=t?i.open:i.close;return typeof a==`string`?a:a(this,e,n,r)}render(e,t,n){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,t,n);else if(this.options.strict!==!1)throw Error("Token type `"+e.type.name+"` not supported by Markdown renderer");else e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}renderContent(e){for(let t=0;t<e.childCount;t++){let n=e.child(t);this.render(n,e,t)}}renderInline(e,t=!0){this.atBlockStart=t;let n=[],r=``,i=(t,i,a)=>{let o=t,s=o?o.marks:[];o&&o.type.name===this.options.hardBreakNodeName&&(s=s.filter(t=>{if(a+1===e.childCount)return!1;let n=e.child(a+1);return t.isInSet(n.marks)&&(!n.isText||n.text&&/\S/u.test(n.text))}));let c=r;if(r=``,o&&o.isText&&s.some(e=>{let t=this.getMark(e.type.name);return t&&t.expelEnclosingWhitespace&&!e.isInSet(n)})){let e=/^(\s*)(\S[\s\S]*)?$/u.exec(o.text||``);if(!e)return;let[,t,r]=e;t&&(c+=t,o=r?o.withText(r):null,o||(s=n))}if(o&&o.isText&&s.some(t=>{let n=this.getMark(t.type.name);return n&&n.expelEnclosingWhitespace&&(a===e.childCount-1||!t.isInSet(e.child(a+1).marks))})){let e=o.text||``,t=/\s+$/u.exec(e)?.[0]||``;if(t){r=t;let i=e.slice(0,e.length-t.length);o=i?o.withText(i):null,o||(s=n)}}
13let l=s.length?s[s.length-1]:null,u=l&&this.getMark(l.type.name).escape===!1,d=s.length-+!!u;outer:for(let e=0;e<d;e++){let t=s[e];if(!this.getMark(t.type.name).mixable)break;for(let[r,i]of n.entries()){if(!this.getMark(i.type.name).mixable)break;if(t.eq(i)){e>r?s=s.slice(0,r).concat(t).concat(s.slice(r,e)).concat(s.slice(e+1,d)):r>e&&(s=s.slice(0,e).concat(s.slice(e+1,r)).concat(t).concat(s.slice(r,d)));continue outer}}}let f=0;for(;f<Math.min(n.length,d)&&s[f].eq(n[f]);)++f;for(;f<n.length;){let t=n.pop();t&&this.text(this.markString(t,!1,e,a),!1)}if(c&&this.text(c),o){for(;n.length<d;){let t=s[n.length];n.push(t),this.text(this.markString(t,!0,e,a),!1),this.atBlockStart=!1}u&&o.isText?this.text((l?this.markString(l,!0,e,a):``)+o.text+(l?this.markString(l,!1,e,a+1):``),!1):this.render(o,e,a),this.atBlockStart=!1}o?.isText&&o.nodeSize>0&&(this.atBlockStart=!1)};for(let t=0;t<e.childCount;t++)i(e.child(t),0,t);i(null,0,e.childCount),this.atBlockStart=!1}renderList(e,t,n){this.closed?.type===e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let r=e.attrs.tight===void 0?this.options.tightLists:e.attrs.tight,i=this.inTightList;this.inTightList=r;
13for(let i=0;i<e.childCount;i++){let a=e.child(i);i&&r&&this.flushClose(1),this.wrapBlock(t,n(i),e,()=>this.render(a,e,i))}this.inTightList=i}repeat(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}text(e,t=!0){let n=e.split(`
14`);for(let e=0;e<n.length;e++)this.write(),!t&&n[e].startsWith(`[`)&&/(?:^|[^\\])!$/u.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+`\\!`),this.out+=t?this.esc(n[e],this.atBlockStart):n[e],e!==n.length-1&&(this.out+=`
15`)}wrapBlock(e,t,n,r){let i=this.delim;this.write(t??e),this.delim+=e,r(),this.delim=i,this.closeBlock(n)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}getMark(e){let t=this.marks[e];if(!t){if(this.options.strict!==!1)throw Error(`Mark type \`${e}\` not supported by Markdown renderer`);t=Fr}return t}atBlank(){return/(?:^|\n)$/u.test(this.out)}},Rr=e=>[...new Set(e)],zr={td:{colspan:1,colwidth:null,rowspan:1},th:{colspan:1,colwidth:null,rowspan:1}},Br={dd:[`isTerm`],dt:[`isTerm`]},Vr=new WeakMap,Hr=(e,t,n)=>{if(e.attrs.title||!/^\w+:/u.test(e.attrs.href))return!1;let r=t.child(n);return!r.isText||r.text!==e.attrs.href||r.marks[r.marks.length-1]!==e?!1:n===t.childCount-1||!e.isInSet(t.child(n+1).marks)},Ur=e=>{if(e.childCount===1){let t=e.child(0);return t.isText&&t.marks.length===0}return!1},Wr=e=>{if(e.childCount===1){let t=e.child(0);if(t.type.name===`paragraph`)return Ur(t)}return!1},Gr=e=>{let t=[],n=[];return e.descendants(e=>e.type.name===`tableCell`||e.type.name===`tableHeader`?(t.push(e),!1):(e.type.name===`tableRow`&&n.push(e),!0)),{cells:t,rows:n}},Kr=e=>{let t=[];for(let n=0;n<e.childCount;n+=1)t.push(e.child(n));return t},qr=e=>{let{cells:t,rows:n}=Gr(e),r=Math.max(...t.map(e=>e.childCount)),i=Math.max(...t.map(e=>e.attrs.colspan)),a=Math.max(...t.map(e=>e.attrs.rowspan)),o=n.map(e=>Rr(Kr(e).map(e=>e.type.name))),s=o[0],c=Rr(o.slice(1).map(([e])=>e)),l=s.length===1&&s[0]===`tableHeader`&&c.length===1&&c[0]===`tableCell`,u=s.length===1&&s[0]===`tableCell`&&(c.length===0||c.length===1&&c[0]===`tableCell`);if((l||u)&&r===1&&i===1&&a===1){let e=Rr(t.map(e=>e.child(0).type.name));if(e.length===1&&e[0]===`paragraph`)return!1}return!0},Jr=(e=``)=>e.replaceAll(`&`,`&amp;`).replaceAll(`<`,`&lt;`).replaceAll(`>`,`&gt;`).replaceAll(`'`,`&#39;`).replaceAll(`"`,`&#34;`),Yr=(e,t)=>{let n=`<${e}`;return n+=Object.entries(t||{}).map(([t,n])=>(Br[e]||[]).includes(t)||zr[e]?.[t]===n?``:` ${![`class`,`id`].includes(t)&&!t.startsWith(`data-`)?`data-${t}`:t}="${Jr(n?.toString())}"`).join(``),`${n}>`},Xr=e=>`</${e}>`,Zr=e=>Vr.get(e),Qr=e=>Vr.has(e),$r=(e,t)=>{Vr.set(e,t);let{cells:n,rows:r}=Gr(e);for(let e of r)Vr.set(e,t);for(let e of n)Vr.set(e,t),e.childCount&&e.child(0).type.name===`paragraph`&&Vr.set(e.child(0),t)},ei=e=>{Vr.delete(e);let{cells:t,rows:n}=Gr(e);for(let e of n)Vr.delete(e);for(let e of t)Vr.delete(e),e.childCount&&Vr.delete(e.child(0))},ti=(e,t,n={})=>{e.ensureNewLine(),e.write(Yr(t,n))},ni=(e,t,n=!0)=>{e.write(Xr(t)),n&&e.ensureNewLine()},ri=(e,t,n)=>{e.flushClose(1),e.write(`| `);for(let r=0;r<t.childCount;r++){let i=t.child(r);r&&e.write(` | `);let a=Math.max(3,n[r]);e.write(i.attrs.align===`center`?`:`:`-`),e.write(e.repeat(`-`,a-2)),e.write(i.attrs.align===`center`||i.attrs.align===`right`?`:`:`-`)}e.write(` |`),e.closeBlock(t)},ii=(e,t,n=!1)=>{let r=[];e.flushClose(1),e.write(`| `);for(let n=0;n<t.childCount;n++){let i=t.child(n);n&&e.write(` | `);let{length:a}=e.out;e.render(i,t,n),r.push(e.out.length-a)}e.write(` |`),e.closeBlock(t),n&&ri(e,t,r)},ai=(e,t)=>{ti(e,`tr`);for(let n=0;n<t.childCount;n++){let r=t.child(n),i=r.type.name===`tableHeader`?`th`:`td`;ti(e,i,r.attrs),Wr(r)||(e.closeBlock(t),e.flushClose()),e.render(r,t,n),e.flushClose(1),ni(e,i)}ni(e,`tr`)},oi=(e,t)=>{!Zr(t)||Wr(t)?e.renderInline(t.child(0)):e.renderContent(t)},si=(e,t,n,r)=>{if(Zr(t))ai(e,t);else{let n=r===0;ii(e,t,t.child(0).type.name===`tableHeader`||n)}},ci=(e,t)=>{$r(t,qr(t)),Zr(t)&&ti(e,`table`),e.renderContent(t),Zr(t)&&(ni(e,`table`),e.closeBlock(t),e.flushClose()),ei(t)},li=(e,t)=>{let n=/`+/gu,r,i=0;if(e.isText&&typeof e.text==`string`)for(;r=n.exec(e.text);)i=Math.max(i,r[0].length);let a=i>0&&t>0?" `":"`";for(let e=0;e<i;e++)a+="`";return i>0&&t<0&&(a+=` `),a},ui=new Ir({[kt.name](e,t){let n=t.attrs.type||`NOTE`;e.wrapBlock(`> `,null,t,()=>{e.text(`[!${n}]`,!1),t.childCount>0&&(e.ensureNewLine(),e.renderContent(t))})},[Ve.name](e,t){e.wrapBlock(`> `,null,t,()=>e.renderContent(t))},[Ze.name](e,t){e.renderList(t,`  `,()=>`${t.attrs.bullet??`*`} `)},[Ge.name](e,t){let n=t.textContent.match(/`{3,}/gu),r=n?`${n.toSorted().slice(-1)[0]}\``:"```";e.write(`${r+(t.attrs.language??``)}\n`),e.text(t.textContent,!1),e.write(`
16`),e.write(r),e.closeBlock(t)},[lt.name]:(e,t,n,r)=>{let i=Qr(n)?`<br>`:`\\
17`;for(let a=r+1;a<n.childCount;a+=1)if(n.child(a).type!==t.type){e.write(i);return}},[ot.name](e,t){e.write(`${e.repeat(`#`,t.attrs.level)} `),e.renderInline(t,!1),e.closeBlock(t)},[qe.name](e,t){e.write(t.attrs.markup??`---`),e.closeBlock(t)},[st.name](e,t){e.write(`![${e.esc(t.attrs.alt??``)}](${t.attrs.src.replaceAll(/[()]/gu,`\\$&`)}${t.attrs.title?` "${t.attrs.title.replaceAll(`"`,`\\"`)}"`:``})`)},[rt.name](e,t){e.renderContent(t)}
17,[Xe.name]:(e,t)=>{let{id:n,label:r}=t.attrs,[i,a]=n.split(`:`);e.write(`:${i}[${r}]{uid="${a}"}`)},[tt.name]:(e,t)=>{let{parens:n}=t.attrs,r=t.attrs.start??1,i=String(r+t.childCount-1).length,a=e.repeat(` `,i+2),o=n?`)`:`.`;e.renderList(t,a,t=>{let n=String(r+t);return`${e.repeat(` `,i-n.length)+n}${o} `})},[at.name](e,t){e.renderInline(t),e.closeBlock(t)},[Ot.name]:(e,t)=>{e.write(`[memory:${t.attrs.uid}]`)},[Je.name]:ci,[nt.name]:oi,[it.name]:oi,[Ye.name]:si,[et.name](e,t){typeof t.text==`string`&&e.text(t.text,!e.inAutolink)}},{[We.name]:{close:`**`,expelEnclosingWhitespace:!0,mixable:!0,open:`**`},[ct.name]:{close(e,t,n,r){return li(n.child(r-1),1)},escape:!1,open(e,t,n,r){return li(n.child(r),-1)}},[Qe.name]:{close:`*`,expelEnclosingWhitespace:!0,mixable:!0,open:`*`},[$e.name]:{close(e,t){let{inAutolink:n}=e;return e.inAutolink=void 0,n?`>`:`](${t.attrs.href.replaceAll(/["()]/gu,`\\$&`)}${t.attrs.title?` "${t.attrs.title.replaceAll(`"`,`\\"`)}"`:``})`},mixable:!0,open(e,t,n,r){return e.inAutolink=Hr(t,n,r),e.inAutolink?`<`:`[`}},[H.name]:{close:`~~`,expelEnclosingWhitespace:!0,mixable:!0,open:`~~`}}),di=Ue(Mt()),fi=e=>{let t=Ke.fromJSON(di,e);return ui.serialize(t,{tightLists:!0})},pi=`fPSBzf bnYmbW jrIcfy`,mi=`fPSBzf bAasmd jrIcfy`,hi=e=>{let t=Array.isArray(e.content)?e.content:[];return{images:t.flatMap((e,t)=>e.type!==`image`||typeof e.attrs?.src!=`string`?[]:[{alt:typeof e.attrs.alt==`string`?e.attrs.alt:``,key:`${e.attrs.src}-${t}`,src:e.attrs.src,title:typeof e.attrs.title==`string`?e.attrs.title:void 0}]),markdown:fi({...e,content:t.filter(e=>e.type!==`image`)}).trim()}},gi=e=>{let t=(0,J.c)(9),{content:n}=e,r;t[0]===n?r=t[1]:(r=hi(n),t[0]=n,t[1]=r);let{images:i,markdown:a}=r;if(i.length===0&&a.length===0)return null;let o;t[2]===i?o=t[3]:(o=i.length>0?(0,q.jsx)(`div`,{className:mi,children:i.map(_i)}):null,t[2]=i,t[3]=o);let s;t[4]===a?s=t[5]:(s=a.length>0?(0,q.jsx)(gt,{children:(0,q.jsx)(ft,{children:a})}):null,t[4]=a,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,q.jsxs)(`div`,{className:pi,"data-sentry-component":`TiptapMessageContent`,"data-sentry-source-file":`TiptapMessageContent.tsx`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c};function _i(e){return(0,q.jsx)(jt,{alt:e.alt,src:e.src,title:e.title},e.key)}var vi=e=>{let t=(0,J.c)(20),{chatMessage:n,fetchMentionsSuggestions:r,focused:i}=e,[a,o]=(0,Y.useState)(!1),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o(!0)},t[0]=s):s=t[0];let c=i&&!a,l;t[1]===c?l=t[2]:(l={callback:s,enabled:c,key:`e`},t[1]=c,t[2]=l),ht(l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{o(!1)},t[3]=u):u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{o(!1)},t[4]=f):f=t[4];let p=f,m=i?!0:void 0,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=(0,q.jsx)(`div`,{className:`bTmeQJ jsnJKs iyUaLe lnXALx fNCcFz`,children:a?(0,q.jsx)(Ln,{chatMessage:n,fetchMentionsSuggestions:r,onCancel:d,onSubmit:p}):(0,q.jsx)(gi,{content:n.content.content})}),t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g;t[9]===a?g=t[10]:(g=()=>{o(!a)},t[9]=a,t[10]=g);let _;t[11]!==n||t[12]!==a||t[13]!==i||t[14]!==g?(_=(0,q.jsx)(Pr,{chatMessage:n,editing:a,focused:i,role:n.role,toggleEditing:g,"data-sentry-element":`MessageFooter`,"data-sentry-source-file":`SystemChatMessageBubble.tsx`}),t[11]=n,t[12]=a,t[13]=i,t[14]=g,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==_?(v=(0,q.jsxs)(`div`,{className:`fjLFrW fITofF! ihYese fPSBzf bnYmbW jrIcfy`,"data-current":m,"data-sentry-component":`SystemChatMessageBubble`,"data-sentry-source-file":`SystemChatMessageBubble.tsx`,children:[h,_]}),t[16]=m,t[17]=h,t[18]=_,t[19]=v):v=t[19],v},yi=e=>{let t=(0,J.c)(34),{isMessageListFocused:n,onFocusMessage:r,onFocusMessageForm:i,visibleMessages:a}=e,[o,s]=(0,Y.useState)(null),c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l=(0,Y.useEffectEvent)(c),u;t[2]!==o||t[3]!==l?(u=()=>{l(o)},t[2]=o,t[3]=l,t[4]=u):u=t[4];let d;t[5]===o?d=t[6]:(d=[o],t[5]=o,t[6]=d),(0,Y.useEffect)(u,d);let f=Pt(n),p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{s(null)},t[7]=p):p=t[7];let m=!!o,h;t[8]===m?h=t[9]:(h={callback:p,enabled:m,key:`Escape`},t[8]=m,t[9]=h),ht(h);let g=a[a.length-1];o&&(a.some(e=>e.uid===o.uid)||s(g??null)),!f&&n&&!o&&s(g??null),f&&!n&&o&&s(null);let _;t[10]===o?_=t[11]:(_=()=>{o&&document.querySelector(`[data-message-uid="${o.uid}"]`)?.focus()},t[10]=o,t[11]=_);let v=(0,Y.useEffectEvent)(_),y;t[12]===v?y=t[13]:(y=()=>{v()},t[12]=v,t[13]=y);let b=o?.uid,x;t[14]===b?x=t[15]:(x=[b],t[14]=b,t[15]=x),(0,Y.useEffect)(y,x);let S;t[16]!==o||t[17]!==a?(S=()=>
17{if(document.activeElement?.matches(`[role="textbox"]`)||!o)return;let e=a.findIndex(e=>e.uid===o.uid);if(e===-1)throw new E(`Unexpected focused message`,{extra:{focusedMessage:o}});let t=a[e-1];t&&s(t)},t[16]=o,t[17]=a,t[18]=S):S=t[18];let C=!!o,w;t[19]!==S||t[20]!==C?(w={callback:S,enabled:C,key:`ArrowUp`},t[19]=S,t[20]=C,t[21]=w):w=t[21],ht(w);let T;t[22]!==o||t[23]!==i||t[24]!==a?(T=()=>{if(document.activeElement?.matches(`[role="textbox"]`)||!o)return;let e=a.findIndex(e=>e.uid===o.uid);if(e===-1)throw new E(`Unexpected focused message`,{extra:{focusedMessage:o}});let t=a[e+1];t?s(t):i()},t[22]=o,t[23]=i,t[24]=a,t[25]=T):T=t[25];let D=!!o,O;t[26]!==T||t[27]!==D?(O={callback:T,enabled:D,key:`ArrowDown`},t[26]=T,t[27]=D,t[28]=O):O=t[28],ht(O);let k;t[29]===o?.uid?k=t[30]:(k=e=>o?.uid===e.uid,t[29]=o?.uid,t[30]=k);let A=k,j;return t[31]!==o||t[32]!==A?(j={focusedMessage:o,isFocused:A,setFocusedMessage:s},t[31]=o,t[32]=A,t[33]=j):j=t[33],j},bi=e=>{let t=(0,J.c)(20),{chatMessage:n,fetchMentionsSuggestions:r,focused:i}=e,[a,o]=(0,Y.useState)(!1),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o(!0)},t[0]=s):s=t[0];let c=i&&!a,l;t[1]===c?l=t[2]:(l={callback:s,enabled:c,key:`e`},t[1]=c,t[2]=l),ht(l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{o(!1)},t[3]=u):u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{o(!1)},t[4]=f):f=t[4];let p=f,m=i?!0:void 0,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=(0,q.jsx)(`div`,{className:`bTmeQJ jsnJKs iyUaLe lnXALx fNCcFz`,children:a?(0,q.jsx)(Ln,{chatMessage:n,fetchMentionsSuggestions:r,onCancel:d,onSubmit:p}):(0,q.jsx)(gi,{content:n.content.content})}),t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g;t[9]===a?g=t[10]:(g=()=>{o(!a)},t[9]=a,t[10]=g);let _;t[11]!==n||t[12]!==a||t[13]!==i||t[14]!==g?(_=(0,q.jsx)(Pr,{chatMessage:n,editing:a,focused:i,role:`user`,toggleEditing:g,"data-sentry-element":`MessageFooter`,"data-sentry-source-file":`UserChatMessageBubble.tsx`}),t[11]=n,t[12]=a,t[13]=i,t[14]=g,t[15]=_):_=t[15];let v;return t[16]!==m||t[17]!==h||t[18]!==_?(v=(0,q.jsxs)(`div`,{className:`fjLFrW fITofF! ihYese fPSBzf bnYmbW jrIcfy`,"data-current":m,"data-sentry-component":`UserChatMessageBubble`,"data-sentry-source-file":`UserChatMessageBubble.tsx`,children:[h,_]}),t[16]=m,t[17]=h,t[18]=_,t[19]=v):v=t[19],v},xi=e=>{let t=(0,J.c)(6),{receivedAt:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsx)(`div`,{className:`cwzgxS hlUslA ATIgZ`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=(0,q.jsx)(ce,{className:`iYHFpI jrPWok jRXTuE kfwppx ATFzw`,date:n,format:`MMM D, YYYY`,"data-sentry-element":`SimpleDate`,"data-sentry-source-file":`Messages.tsx`}),t[1]=n,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(`div`,{className:`cwzgxS hlUslA ATIgZ`}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,q.jsxs)(`li`,{className:`bYPztT fPSBzf hnMRLK jrIcfy`,"data-sentry-component":`TimeSeparator`,"data-sentry-source-file":`Messages.tsx`,children:[r,i,a]}),t[4]=i,t[5]=o),o},Si=(e,t)=>ie(e).isSame(ie(t),`day`),Ci=(0,Y.memo)(e=>{let t=(0,J.c)(32),{agent:n,chatSessionMessages:r,fetchMentionsSuggestions:i,focused:a,onAssistantResponseStatusChange:o,onFocusMessage:s,onFocusMessageForm:c,onSuggestedActionClick:l,projectUid:u,showPendingIndicator:d}=e,f;t[0]===r?f=t[1]:(f=X(r),t[0]=r,t[1]=f);let p=f,m;t[2]===p?m=t[3]:(m=p.filter(Ti),t[2]=p,t[3]=m);let h=m,g;t[4]!==a||t[5]!==s||t[6]!==c||t[7]!==h?(g={isMessageListFocused:a,onFocusMessage:s,onFocusMessageForm:c,visibleMessages:h},t[4]=a,t[5]=s,t[6]=c,t[7]=h,t[8]=g):g=t[8];let{isFocused:_,setFocusedMessage:v}=yi(g),y;t[9]===n?y=t[10]:(y=n?(0,q.jsx)(`li`,{className:`bYPztT fPSBzf hnMRLK jrIcfy bYPznK`,children:(0,q.jsxs)(`div`,{className:`iYHFpI fPSBzf zlTvE jrPWok jRXTuE jrIcfy kfwppx ATFzw`,children:[(0,q.jsx)(z,{name:`bot`,size:18}),(0,q.jsx)(w,{className:`bYPztT jutHam hlqAVQ pKjuE bXBpoe bVhrBr cPAnzU gVIUVX kaKbZQ gABwnp IllHO bejlTa bhFGkb BdEWC jEevvj jClhju koJNIU iWtjzs cUPqFr iVlkKm dGndpe jsLxaN bZRhvx fEVEmD JAEma gXlbfc ecmYYS entBuJ`,to:D(`/settings/agents/:uid`,{params:{uid:n.uid}}),children:n.name})]})}):null,t[9]=n,t[10]=y);let b;if(t[11]!==i||t[12]!==_||t[13]!==p||t[14]!==o||t[15]!==l||t[16]!==u||t[17]!==v){let e;t[19]!==i||t[20]!==_||t[21]!==o||t[22]!==l||t[23]!==u||t[24]!==v?(e=(e,t,n)=>{let r=n.slice(0,t).toReversed().find(Ei);if(e.deletedAt)return null;let a=_(e);if(e.role===`system`||e.role===`developer`)return(0,q.jsx)(`li`,{children:(0,q.jsx)(`div`,{className:`hYZyji`,children:(0,q.jsx)(Nr,{chatSessionMessage:e,focused:a,onMessageFocussed:v,children:(0,q.jsx)(vi,{chatMessage:e,fetch
17MentionsSuggestions:i,focused:a})})})},e.uid);if(e.role===`user`)return(0,q.jsxs)(Y.Fragment,{children:[r&&Si(e.receivedAt,r.receivedAt)?null:(0,q.jsx)(xi,{receivedAt:e.receivedAt}),(0,q.jsx)(`li`,{children:(0,q.jsx)(`div`,{className:`hYZyji`,children:(0,q.jsx)(Nr,{chatSessionMessage:e,focused:a,onMessageFocussed:v,children:(0,q.jsx)(bi,{chatMessage:e,fetchMentionsSuggestions:i,focused:a})})})})]},e.uid);if(e.role===`assistant`)return(0,q.jsx)(`li`,{children:(0,q.jsx)(Nr,{chatSessionMessage:e,focused:a,onMessageFocussed:v,children:(0,q.jsx)(Dr,{chatMessage:e,fetchMentionsSuggestions:i,focused:a,onAssistantResponseStatusChange:o,onSuggestedActionClick:l,projectUid:u})})},e.uid);throw new E(`Unexpected message role`,{extra:{chatSessionMessage:e}})},t[19]=i,t[20]=_,t[21]=o,t[22]=l,t[23]=u,t[24]=v,t[25]=e):e=t[25],b=p.map(e),t[11]=i,t[12]=_,t[13]=p,t[14]=o,t[15]=l,t[16]=u,t[17]=v,t[18]=b}else b=t[18];let x;t[26]===d?x=t[27]:(x=d&&(0,q.jsx)(`li`,{children:(0,q.jsx)(rn,{state:`idle`})}),t[26]=d,t[27]=x);let S;return t[28]!==y||t[29]!==b||t[30]!==x?(S=(0,q.jsxs)(`ul`,{className:`fSBwJU fPSBzf bnYmbW dpjphg hYZFkb`,children:[y,b,x]}),t[28]=y,t[29]=b,t[30]=x,t[31]=S):S=t[31],S}),wi=e=>{let t=(0,J.c)(22),{agent:n,chatSessionMessages:r,fetchMentionsSuggestions:i,focused:a,onAssistantResponseStatusChange:o,onFocusMessage:s,onFocusMessageForm:c,onSuggestedActionClick:l,projectUid:u,showPendingIndicator:d}=e,f=(0,Y.useRef)(null),[,p]=(0,Y.useState)(null),m=r.length,h;t[0]===o?h=t[1]:(h=e=>{p(e),o(e)},t[0]=o,t[1]=h);let g=h,_,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsx)(`div`,{className:`ebZKuD fNCCdc kiKDyH cERSkX jXSfKH hWgptE qbeer fzozfU`,role:`presentation`}),v=(0,q.jsx)(`div`,{className:`bKpmhy kyGdCf fNCCdc kiKDyH cERSkX jXSfKH hWgptE fzozfU`,role:`presentation`}),t[2]=_,t[3]=v):(_=t[2],v=t[3]);let y;t[4]!==a||t[5]!==m?(y=(0,q.jsx)(Ut,{attributes:{focused:a,messageCount:m},"data-sentry-element":`DebugDetail`,"data-sentry-source-file":`Messages.tsx`}),t[4]=a,t[5]=m,t[6]=y):y=t[6];let b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,q.jsx)(`div`,{className:`jmzEDN fNCACc`}),t[7]=b):b=t[7];let x;t[8]!==n||t[9]!==r||t[10]!==i||t[11]!==a||t[12]!==g||t[13]!==s||t[14]!==c||t[15]!==l||t[16]!==u||t[17]!==d?(x=(0,q.jsx)(Ci,{agent:n,chatSessionMessages:r,fetchMentionsSuggestions:i,focused:a,onAssistantResponseStatusChange:g,onFocusMessage:s,onFocusMessageForm:c,onSuggestedActionClick:l,projectUid:u,showPendingIndicator:d,"data-sentry-element":`MessageList`,"data-sentry-source-file":`Messages.tsx`}),t[8]=n,t[9]=r,t[10]=i,t[11]=a,t[12]=g,t[13]=s,t[14]=c,t[15]=l,t[16]=u,t[17]=d,t[18]=x):x=t[18];let S;return t[19]!==y||t[20]!==x?(S=(0,q.jsxs)(`div`,{className:`fPSBzf bnYmbW hYZFjI jTWvec`,"data-sentry-component":`Messages`,"data-sentry-source-file":`Messages.tsx`,children:[_,v,(0,q.jsxs)(`div`,{className:`fPSBzf diTiND hlUslA ATIgZ lnXALx fiGCQY fNCcFz jTWvec fzozCb`,ref:f,children:[y,b,x]})]}),t[19]=y,t[20]=x,t[21]=S):S=t[21],S};function Ti(e){return e.deletedAt===null}function Ei(e){return e.role===`user`}var Di=e=>{let t=(0,J.c)(6),[n,r]=(0,Y.useState)(null),i=Pt(e);!i&&e&&n===null&&r(Oi),i&&!e&&n!==null&&r(null);let a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{r(`messages`)},t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{r(`message-form`)},t[1]=s):s=t[1];let c=s,l=n===`message-form`,u=n===`messages`,d;return t[2]!==n||t[3]!==l||t[4]!==u?(d={focusedComponent:n,focusMessageForm:c,focusMessages:o,isMessageFormFocused:l,isMessagesFocused:u},t[2]=n,t[3]=l,t[4]=u,t[5]=d):d=t[5],d};function Oi(e){return e===`messages`?`messages`:`message-form`}var ki=(e,t,n)=>{let r=(0,J.c)(15),[i,a]=(0,Y.useReducer)(Ai,!1),o=Pt(e),s=Pt(n),c;r[0]===t?.submission.error?c=r[1]:(c=()=>{t?.submission.error&&a({type:`end`})},r[0]=t?.submission.error,r[1]=c);let l;r[2]===t?l=r[3]:(l=[t],r[2]=t,r[3]=l),(0,Y.useEffect)(c,l);let u,d;r[4]!==e||r[5]!==o?(u=()=>{o!==void 0&&o!==`submitting`&&e===`submitting`&&a({type:`start`})},d=[e,o],r[4]=e,r[5]=o,r[6]=u,r[7]=d):(u=r[6],d=r[7]),(0,Y.useEffect)(u,d);let f,p;r[8]!==n||r[9]!==s?(f=()=>{s!==n&&(n===`ended`||n===`interrupted`||n===`aborted`)&&a({type:`end`})},p=[n,s],r[8]=n,r[9]=s,r[10]=f,r[11]=p):(f=r[10],p=r[11]),(0,Y.useEffect)(f,p);let m;return r[12]!==n||r[13]!==i?(m=i||Kt({status:n}),r[12]=n,r[13]=i,r[14]=m):m=r[14],m};function Ai(e,t){switch(t.type){case`end`:return!1;case`start`:return!0;default:return e}}var ji=e=>e.getText().trim().length===0,Mi=({assistantResponseStatus:e,chatSession:t,fetchMentionsSuggestions:n,focused:r,onBlur:i,onFocus:a,onFocusLastMessage:o,onSubmit:s,uploading:c})=>{let u=l({key:`chat-session-message-form-${t.uid}`}),d=u.state!==`idle`,[f,p]=(0,Y.useState)(!1),m=ki(u.state,u.data,e),[h,g]=(0,Y.useState)(`chat`),_=(0,Y.useRef)(void 0),v=(0,Y.useRef)(m);v.current=m;let y=(0,Y.useRef)(s);y.current=s;let b=`chat-session-${t.uid}-draft`,[x]=(0,Y.useState)(()=>
17{if(typeof window>`u`)return;let e=sessionStorage.getItem(b);if(e)try{return ee(e)}catch{return}}),S=(0,Y.useCallback)(({editor:e})=>{v.current||(!y.current||y.current())&&(ji(e)||_.current?.())},[]),C=At({content:x,extensions:{fetchMentionsSuggestions:n,onEnterSubmit:S},handleKeyDown:(e,t)=>{if(e.state.selection.anchor===1&&t.key===`ArrowUp`)return C?.commands.blur(),o(),!0},onBlur:()=>{p(!1),i()},onCreate:({editor:e})=>{x&&e.commands.focus(`end`)},onFocus:()=>{p(!0),a()},onUpdate:({editor:e})=>{let t=e.getJSON();e.getText().trim().length>0?sessionStorage.setItem(b,me(t)):sessionStorage.removeItem(b)}}),w=Pt(r),T=`chat-session-${t.uid}-submitted-text`;return(0,Y.useEffect)(()=>{if(u.state===`idle`&&u.data){let e=Ne(u.data.submission.error);if(e.length>0){let t=sessionStorage.getItem(T);if(t)try{let e=ee(t);if(!In(e)){ze({extra:{submittedText:t},level:`warning`,message:`submitted text is not valid TipTap content`});return}C?.commands.setContent(e)}catch(e){P({error:e,extra:{submittedText:t},level:`error`,message:`could not restore submitted text`})}for(let t of e)I({description:t,title:`Error`,type:`error`})}else sessionStorage.removeItem(T),sessionStorage.removeItem(b)}},[u.state,u.data,C,T,b]),(0,Y.useEffect)(()=>{if(w||!r)return;let e=setTimeout(()=>{try{C?.commands.focus()}catch(e){P({error:e,level:`error`,message:`could not focus editor`})}},300);return()=>{clearTimeout(e)}},[C,r,w]),_.current=(0,Y.useCallback)(()=>{if(!C||ji(C))return;let e=me(C.getJSON());sessionStorage.setItem(T,e),g(`chat`);let n=new FormData;n.append(`message`,e),n.append(`intent`,h),u.submit(n,{action:D(`/api/chat/:uid/send-message`,{params:{uid:t.uid}}),method:`post`}),setTimeout(()=>{C.commands.clearContent(),C.commands.focus()},100)},[u,t.uid,C,h,T]),(0,Y.useEffect)(()=>{C&&C.setEditable(!c)},[C,c]),(0,Y.useEffect)(()=>{if(!t.focused)return;let e=setTimeout(()=>{if(document.activeElement&&document.activeElement.tagName!==`BODY`)return;let e=window.getSelection();if(!(e&&e.toString().trim().length>0)&&C)try{C?.commands.focus()}catch(e){P({error:e,level:`error`,message:`could not focus editor`})}},300);return()=>{clearTimeout(e)}},[C,t.focused]),{editor:C,inputFocused:f,intent:h,onEnterSubmit:S,progressing:m,setIntent:g,submitting:d,syncedIndication:!1}},Ni=()=>{let e=(0,J.c)(2),t=b(`routes/_authenticated/_app/_layout`);t?.productTips;let n;return e[0]===t?.productTips?n=e[1]:(n=t?.productTips??[],e[0]=t?.productTips,e[1]=n),n},Pi=e=>{let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t},Fi=()=>{let e=Ni(),t=(0,Y.useRef)(null);t.current===null&&e.length>0&&(t.current=Pi([...e])[0]);let n=t.current;return n?(0,q.jsxs)(`div`,{className:`dMEiui fboolS cVqtDV dkDldq fyXDCv linLGR ehNEGe epDmbV ihJfrU hIAqoe hFLSLt itUQBz kznDMU gnBxyl cwTkLo jDOzgL jsnJKs fcuAfK fPSBzf bnYmbW jrPWok jrIcfy Bbian fNCcFz`,"data-sentry-component":`ProTip`,"data-sentry-source-file":`ProTip.tsx`,children:[(0,q.jsx)(`div`,{className:`bYPztT fPSBzf jsnMfm dDWCpe`,children:(0,q.jsxs)(`div`,{className:`bYPztT joMfwK fPSBzf jRXFuD jsnMfm`,children:[(0,q.jsx)(z,{color:`#d29922`,name:`lightbulb`,size:18,style:{display:`inline-block`,flexShrink:0},"data-sentry-element":`MaskIcon`,"data-sentry-source-file":`ProTip.tsx`}),(0,q.jsx)(w,{className:`bYPztT jutHam hlqAVQ pKjuE bXBpoe bVhrBr cPAnzU gVIUVX kaKbZQ gABwnp IllHO bejlTa bhFGkb BdEWC jEevvj jClhju koJNIU iWtjzs cUPqFr iVlkKm dGndpe jsLxaN bZRhvx fEVEmD JAEma gXlbfc ecmYYS entBuJ`,to:D(`/settings/tips`),"data-sentry-element":`Link`,"data-sentry-source-file":`ProTip.tsx`,children:`Pro tip!`})]})}),(0,q.jsx)(Rt,{"data-sentry-element":`TipContent`,"data-sentry-source-file":`ProTip.tsx`,children:n.contentMarkdown})]}):null},Ii=()=>{let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(`div`,{className:`bYPztT fPSBzf bnYmbW hlUslA dpjphg ATIgZ bYPznK lnXALx fNCcFz`,"data-sentry-component":`ChatEmptyState`,"data-sentry-source-file":`ChatEmptyState.tsx`,children:(0,q.jsx)(Fi,{"data-sentry-element":`ProTip`,"data-sentry-source-file":`ChatEmptyState.tsx`})}),e[0]=t):t=e[0],t},Li=e=>{let t=(0,J.c)(7),{chatSession:n}=e,r=_(),i=l(),a;t[0]!==n.uid||t[1]!==i?(a=e=>{let t=new FormData;t.append(`hostedLlmModelId`,e.id.toString()),i.submit(t,{action:D(`/api/chat/:uid/change-model`,{params:{uid:n.uid}}),method:`post`})},t[0]=n.uid,t[1]=i,t[2]=a):a=t[2];let o;return t[3]!==n.hostedLlmModel.id||t[4]!==r.availableHostedLlmModels||t[5]!==a?(o=(0,q.jsx)(`div`,{className:`esUjvx bXVgR kFYoVQ hYZFkb`,"data-sentry-component":`LlmModelMenuW
17ithAction`,"data-sentry-source-file":`LlmModelMenuWithAction.tsx`,children:(0,q.jsx)(K,{currentHostedLlmModelId:n.hostedLlmModel.id,hostedLlmModels:r.availableHostedLlmModels,onHostedLlmModelChange:a,variant:`chatSession`,"data-sentry-element":`HostedLlmModelMenu`,"data-sentry-source-file":`LlmModelMenuWithAction.tsx`})}),t[3]=n.hostedLlmModel.id,t[4]=r.availableHostedLlmModels,t[5]=a,t[6]=o):o=t[6],o},Ri=[{label:`Default`,value:`default`},{label:`Low`,value:`low`},{label:`Medium`,value:`medium`},{label:`High`,value:`high`}],zi=`bMnvBR bUvkqG bYPztT jsCDPW cXhuSU bZRhvx fPSBzf hnMRLK jrPWok jRYfTR jrIcfy eAZrqn dDWCpe AxjtB eqLRXZ jTHIjJ ezkBTa`,Bi=e=>{let t=(0,J.c)(17),{chatSession:n}=e,r=l();if(!n.hostedLlmModel.capabilities.includes(`reasoning`))return null;let i=n.reasoningEffort,a;t[0]!==n.uid||t[1]!==r?(a=e=>{let t=new FormData;t.append(`reasoningEffort`,e.value),r.submit(t,{action:D(`/api/chat/:uid/change-reasoning-effort`,{params:{uid:n.uid}}),method:`post`})},t[0]=n.uid,t[1]=r,t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o={placement:`top`},t[3]=o):o=t[3];let s=i===null?``:`knVeeC`,c;t[4]===s?c=t[5]:(c=A(`hDmuzH gVwcIi ldgVKi czsPJt jMiZUS bYPztT jsnJKs fSaIQG fPSBzf hnMRLK jrIcfy fNCCdc bYPznK dVuHSo gsJBgH`,s),t[4]=s,t[5]=c);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(z,{name:`brain`,size:18,"data-sentry-element":`MaskIcon`,"data-sentry-source-file":`ReasoningEffortSelector.tsx`}),t[6]=u):u=t[6];let d;t[7]===c?d=t[8]:(d=(0,q.jsx)(le,{asChild:!0,"data-sentry-element":`Menu.Trigger`,"data-sentry-source-file":`ReasoningEffortSelector.tsx`,children:(0,q.jsx)(`button`,{className:c,title:`Reasoning effort`,type:`button`,children:u})}),t[7]=c,t[8]=d);let f;t[9]===i?f=t[10]:(f=Ri.map(e=>{let t=e.value==="default"?i===null:i===e.value;return(0,q.jsx)(te,{asChild:!0,value:e.value,children:(0,q.jsxs)(`button`,{className:zi,type:`button`,children:[(0,q.jsx)(`span`,{children:e.label}),t&&(0,q.jsx)(z,{className:`knVeeC`,name:`check`,size:14})]})},e.value)}),t[9]=i,t[10]=f);let p;t[11]===f?p=t[12]:(p=(0,q.jsx)(g,{"data-sentry-element":`Portal`,"data-sentry-source-file":`ReasoningEffortSelector.tsx`,children:(0,q.jsx)(pe,{"data-sentry-element":`Menu.Positioner`,"data-sentry-source-file":`ReasoningEffortSelector.tsx`,children:(0,q.jsx)(de,{className:`koremC jDOzgL jsnJKs irhbZF ATHag`,"data-sentry-element":`Menu.Content`,"data-sentry-source-file":`ReasoningEffortSelector.tsx`,children:(0,q.jsx)(oe,{"data-sentry-element":`Menu.ItemGroup`,"data-sentry-source-file":`ReasoningEffortSelector.tsx`,children:f})})})}),t[11]=f,t[12]=p);let m;return t[13]!==a||t[14]!==d||t[15]!==p?(m=(0,q.jsxs)(ne,{lazyMount:!0,onSelect:a,positioning:o,"data-sentry-element":`Menu.Root`,"data-sentry-component":`ReasoningEffortSelector`,"data-sentry-source-file":`ReasoningEffortSelector.tsx`,children:[d,p]}),t[13]=a,t[14]=d,t[15]=p,t[16]=m):m=t[16],m},Vi=`gzwJCM jsnJKs dcaIRd gFWrJr jrPWok jRXTuE jrPWGt jsCcOc fugysR`,Hi=()=>{let e=(0,J.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(`p`,{className:`hGHvhs jBowhj`,children:`Upload files`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,q.jsx)(`kbd`,{className:Vi,children:Ie(`$mod`)}),e[1]=n):n=e[1];let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsx)(`div`,{className:`bYPztT bFdtvY vqcKy rbAlZ jsnJKs fPSBzf bnYmbW hWgZTB bYPznK jXSfKH pAMKI`,"data-sentry-component":`UploadInstructionsOverlay`,"data-sentry-source-file":`UploadInstructionsOverlay.tsx`,children:(0,q.jsxs)(`div`,{className:`eXSGnJ eWIgxS jsnJKs fPSBzf bnYmbW jsgMqa jrIcfy Bbian fNCcFz bYPzoC`,children:[t,(0,q.jsxs)(`p`,{className:`jrPWok`,children:[`You can also copy-paste (`,n,`+`,(0,q.jsx)(`kbd`,{className:Vi,children:`V`}),`) files to add them to your message`]})]})}),e[2]=r):r=e[2],r},Ui=(()=>{function e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.message==`string`}var t={};function n(e){var n,r;return typeof e!=`object`||!e||Array.isArray(e)||(n=e.message,typeof n!=`string`)?t:(r={message:n},r)}function r(e){var t=[],n=e;if(typeof n!=`object`||!n||Array.isArray(n))t.push(L(`object`,n,[]));else{var r=n.message;typeof r!=`string`&&t.push(L(`string`,r,[`message`])),n={message:r}}return t}function i(e){var i=n(e);return i===t?Oe(r,e):{success:!0,data:i}}return ye(i,f({message:c()}),null,e)})(),Wi=f({uid:B.uid()}),Gi=async({storedObjectPointerReferenceId:e})=>{let t=new FormData;t.append(`storedObjectPointerReferenceId`,e);let n=await fetch(D(`/api/embed`),{body:t,method:`POST`});if(!n.ok){let e=`Could not embed document`;try{let t=Ui.safeParse(await n.json());t.success&&(e=t.data.message)}catch{}throw Error(e)}return ge(Wi,await n.json())},Ki=({chatSessionMessages:e})=>{let t=X(e).filter(e=>e.deletedAt===null);for(let e of t.toReversed()){if(e.role!==`assistant`)continue;let t=e.assistantResponses.at(-1);if(t&&Kt({status:t.status}))return t.status}return null}
17,qi=({chatSession:e,mentionSuggestionOptions:t,onFocus:n,onHyperFocus:r,onInputBlur:i,onInputFocus:a,projects:o})=>{let s=e.messages,[c,l]=(0,Y.useState)(()=>Ki({chatSessionMessages:s})),{focusedComponent:u,focusMessageForm:d,focusMessages:f,isMessageFormFocused:p,isMessagesFocused:m}=Di(e.focused??!1),[h,g]=(0,Y.useState)(!1),_=(0,Y.useRef)(t);(0,Y.useEffect)(()=>{_.current=t},[t]);let v=(0,Y.useCallback)(async({query:e})=>Me({fields:[`name`,`type`],items:_.current,searchTerm:e}).slice(0,9).map(e=>e.item),[]),{editor:y,intent:b,onEnterSubmit:x,progressing:S,setIntent:C,submitting:w,syncedIndication:T}=Mi({assistantResponseStatus:c,chatSession:e,fetchMentionsSuggestions:v,focused:p,onBlur:()=>{i()},onFocus:()=>{d(),n(),a()},onFocusLastMessage:()=>{f()},onSubmit:()=>!h,uploading:h}),E=(0,Y.useMemo)(()=>{let e=X(s).filter(e=>e.deletedAt===null);for(let t of e.toReversed()){if(t.role!==`assistant`)continue;let e=t.assistantResponses.at(-1);if(e&&Kt({status:e.status}))return t.uid}return null},[s]),O=(0,Y.useCallback)(()=>{E&&fetch(D(`/api/message/:uid/interrupt`,{params:{uid:E}}),{method:`POST`}).catch(e=>{P({error:e,level:`error`,message:`could not interrupt completion`})})},[E]),k=(0,Y.useCallback)(e=>{if(!y)return;let t=dt(e);y.commands.setContent(t),y.commands.focus(`end`),d()},[y,d]),{getInputProps:A,getRootProps:j,inputRef:M,isDragActive:ee,open:te}=zt({accept:{"application/pdf":[`.pdf`],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[`.docx`],"image/*":[`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`],"text/*":[...ut]},maxFiles:10,noClick:!0,noKeyboard:!0,onDropAccepted:e=>{Re({name:`upload-files`,routine:async()=>{if(e.length>10){I({description:`You can only upload up to 10 files at a time`,title:`Too many files`,type:`error`});return}g(!0);let t=[];try{t=await Lt({tasks:e.map(e=>async()=>{let{storedObjectPointerReferenceId:t}=await Ft({file:e});if(e.type.startsWith(`image/`))return I({description:`Image uploaded`,title:e.name,type:`success`}),{name:e.name,storedObjectPointerReferenceId:t,type:`image`};I({description:`Embedding document`,title:e.name,type:`info`});let{uid:n}=await Gi({storedObjectPointerReferenceId:t});return I({description:`Document embedded`,title:e.name,type:`success`}),{name:e.name,type:`embeddedDocument`,uid:n}})})}catch(e){console.error(e),P({error:e,level:`error`,message:`could not upload file`}),I({description:e instanceof Error&&e.message.trim().length>0?e.message:`Unknown error`,title:`Could not upload files`,type:`error`})}finally{g(!1)}if(!y){I({description:`No editor found`,title:`No editor found`,type:`error`});return}for(let e of t)if(e.type===`image`){let t=It(`/objects/:referenceId`,{params:{referenceId:e.storedObjectPointerReferenceId}});y.commands.createParagraphNear(),y.commands.setImage({src:t})}else e.type===`embeddedDocument`&&(y.commands.createParagraphNear(),Gt({editor:y,mention:{name:e.name,type:`document`,uid:e.uid}}),y.commands.insertContent({text:` `,type:`text`}));y.commands.focus(`end`)}})},onDropRejected:e=>{for(let t of e)for(let e of t.errors)I({description:e.message,title:t.file.name,type:`error`})}});if((0,Y.useEffect)(()=>{if(!e.focused)return;let t=e=>{e.clipboardData?.files&&(M.current.files=e.clipboardData.files,M.current?.dispatchEvent(new Event(`change`,{bubbles:!0})))};return window.addEventListener(`paste`,t),()=>{window.removeEventListener(`paste`,t)}},[M,e.focused]),!y)return null;let ne=e.project?`${e.project.name} / ${e.title}`:e.title;return(0,q.jsxs)(`div`,{className:`eXSGnJ jDOzgL jrHZPA fPSBzf hnMRLK hlUslA dpjphg bHFeoT jTWvec`,"data-chat-session-uid":e.uid,"data-testid":`chat-session`,onClick:e=>{(e.ctrlKey||e.metaKey)&&r()},onMouseDown:()=>{n()},...j(),"data-sentry-component":`ChatSession`,"data-sentry-source-file":`ChatSession.tsx`,children:[(0,q.jsx)(`input`,{...A()}),ee?(0,q.jsx)(Hi,{}):null,(0,q.jsxs)(`div`,{className:`fPSBzf bnYmbW hlUslA bYPznK hYZFkb`,children:[(0,q.jsxs)(`div`,{className:`bYPztT fPSBzf zlTvE jsgMqa jrIcfy gEYBVn kfwppx jTWvec pANgP`,style:e.focused?{borderBottom:`1px solid #00d992`}:{borderBottom:`1px solid #1b2326`},children:[(0,q.jsx)(`div`,{className:`ebOJWz fCdqms jRXTuE hVpAQY gnlqYH fNDdIP hWhrno cbkwRf`,title:ne,children:ne}),(0,q.jsx)(`div`,{className:`bYPztT fPSBzf hnMRLK jmzEDN jrIcfy bYPznK fNCnCK`,onClick:e=>{e.stopPropagation()},children:(0,q.jsx)(Be,{chatSession:e,projects:o,trigger:(0,q.jsx)(`button`,{"aria-label":`Open chat session menu`,className:`fFhxAT! kpzmdx! dZia
17DW fHrgwN glcMvp jvDkeb imZDZl SJuGJ hLPLOG bYPztT jsnJKs fSaIQG bZRhvx fPSBzf bYPznK gHyzDp ATHKW`,title:`Open chat session menu`,type:`button`,children:(0,q.jsx)(z,{name:`ellipsis`,size:22})}),variant:`chat`,"data-sentry-element":`ChatSessionMenu`,"data-sentry-source-file":`ChatSession.tsx`})})]}),s.length||e.agent?(0,q.jsx)(wi,{agent:e.agent,chatSessionMessages:s,fetchMentionsSuggestions:v,focused:m,onAssistantResponseStatusChange:l,onFocusMessage:f,onFocusMessageForm:d,onSuggestedActionClick:k,projectUid:e.project?.uid??null,showPendingIndicator:S&&!E}):(0,q.jsx)(Ii,{}),(0,q.jsx)(Ut,{attributes:{chatSessionFocused:e.focused,focusedComponent:u,isMessageFormFocused:p,isMessagesFocused:m},"data-sentry-element":`DebugDetail`,"data-sentry-source-file":`ChatSession.tsx`}),e.hostedLlmModel.attributes.includes(`AVAILABLE`)?(0,q.jsx)(tn,{beforeAttachControl:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Li,{chatSession:e}),(0,q.jsx)(Bi,{chatSession:e})]}),editor:y,intent:b,onEnterSubmit:x,onOpenFileDialog:te,onStop:E?O:null,progressing:S,setIntent:C,submitting:w,syncedIndication:T??!1,uploading:h}):(0,q.jsxs)(`div`,{className:`fPSBzf bnYmbW jrIcfy ATFzd`,children:[(0,q.jsxs)(V,{role:`status`,variant:`warning`,children:[(0,q.jsx)(`p`,{children:`The selected model is not available.`}),(0,q.jsx)(`p`,{children:`Please change to an available model.`})]}),(0,q.jsx)(`div`,{className:`fPSBzf felzJA`,children:(0,q.jsx)(Li,{chatSession:e})})]})]})]})},Ji=e=>{let t=[];return mt().use(()=>e=>{pt(e,`code`,e=>{t.push({content:e.value,language:e.lang})})}).processSync(e),t},Yi=fe(),Xi=e=>{let t=(0,J.c)(16),{focusedChatSession:n,maximized:r,setMaximized:i}=e,a=_(),{setCommands:o}=Fe(),s=l(),c;t[0]!==a.availableHostedLlmModels||t[1]!==s||t[2]!==n.hostedLlmModel||t[3]!==n.messages||t[4]!==n.uid||t[5]!==r||t[6]!==o||t[7]!==i?(c=()=>{let e=`chat-session:${n.uid}`;return o(t=>{let o=[...t].filter(t=>!t.tags.includes(e));o.push({combo:[`Shift`,`$mod`,`Enter`],id:`toggle-maximize`,label:`Chat → Toggle Maximize`,onSelect:()=>{i(!r)},synonyms:[{id:`toggle-maximize-fullscreen`,label:`Chat → Toggle Fullscreen`},{id:`toggle-maximize-full-width`,label:`Chat → Toggle Full Width`}],tags:[`chat`,e,`current-chat`],weight:1}),o.push({combo:[`$mod`,`Shift`,`y`],id:`retry-last-response`,label:`Chat → Retry last response`,onSelect:()=>{let e=new FormData,t=n.messages.slice().toReversed().find(ea);t&&s.submit(e,{action:D(`/api/message/:uid/retry`,{params:{uid:t.uid}}),method:`post`})},synonyms:[{id:`regenerate-response`,label:`Chat → Regenerate response`},{id:`resend-message`,label:`Chat → Resend message`},{id:`ask-again`,label:`Chat → Ask again`}],tags:[`chat`,e,`current-chat`],weight:1}),o.push({combo:[`$mod`,`Shift`,`c`],id:`copy-last-response`,label:`Chat → Copy last response`,onSelect:()=>{let e=n.messages.filter(ta),t=e[e.length-1];if(!t){I({title:`No response available to copy`,type:`error`});return}navigator.clipboard.writeText(t.content.content).then(na).catch(ra)},preserveUserActivation:!0,tags:[`chat`,e,`current-chat`],weight:1}),o.push({combo:[`$mod`,`Shift`,`;`],id:`copy-last-code-block`,label:`Chat → Copy last code block`,onSelect:()=>{let e=n.messages.filter(ia),t=e[e.length-1];if(!t){I({title:`No response available to copy`,type:`error`});return}let r=Ji(t.content.content),i=r[r.length-1];if(!i){I({title:`No code block available to copy`,type:`error`});return}navigator.clipboard.writeText(i.content).then(aa).catch(oa)},preserveUserActivation:!0,tags:[`chat`,e,`current-chat`],weight:1}),o.push({combo:[`$mod`,`Shift`,`d`],id:`duplicate-chat`,label:`Chat → Duplicate`,onSelect:()=>{let e=new FormData;s.submit(e,{action:D(`/api/chat/:uid/duplicate`,{params:{uid:n.uid}}),method:`post`})},synonyms:[{id:`clone-chat`,label:`Chat → Clone`}],tags:[`chat`,e,`current-chat`],weight:1}),o.push({combo:[`$mod`,`Shift`,`Backspace`],id:`delete-chat`,label:`Chat → Delete`,onSelect:()=>{let e=new FormData;s.submit(e,{action:D(`/api/chat/:uid/delete`,{params:{uid:n.uid}}),method:`post`})},tags:[`chat`,e,`current-chat`],weight:1});for(let t of a.availableHostedLlmModels)t.name!==n.hostedLlmModel.name&&(o.push({id:`change-model-to-${t.llmProvider.name}-${t.name}`,label:`Chat → Change model to ${t.llmProvider.name}/${t.llmModel.name}`,onSelect:()=>{let e=new FormData;e.append(`hostedLlmModelId`,t.id.toString()),s.submit(e,{action:D(`/api/chat/:uid/change-model`,{params:{uid:n.uid}}),method:`post`})},tags:[`chat`,e,`current-chat`,`change-model`],weight:2}),t.llmModel.alias&&o.push({id:`change-model-to-${t.llmProvider.name}-${t.llmModel.alias}`,label:`Chat → Change model to ${t.llmProvider.name}/${t.llmModel.alias}`,onSelect:()=>{let e=new FormData;e.append(`hostedLlmModelId`,t.id.toString()),s.submit(e,{action:D(`/api/chat/:uid/change-model`,{params:{uid:n.uid}}),method:`post`})},tags:[`chat`,e,`current-chat`,`change-model`],weight:1}));return o}
17),()=>{o(t=>t.filter(t=>!t.tags.includes(e)))}},t[0]=a.availableHostedLlmModels,t[1]=s,t[2]=n.hostedLlmModel,t[3]=n.messages,t[4]=n.uid,t[5]=r,t[6]=o,t[7]=i,t[8]=c):c=t[8];let u;t[9]!==a.availableHostedLlmModels||t[10]!==s||t[11]!==n||t[12]!==r||t[13]!==o||t[14]!==i?(u=[a.availableHostedLlmModels,s,n,r,o,i],t[9]=a.availableHostedLlmModels,t[10]=s,t[11]=n,t[12]=r,t[13]=o,t[14]=i,t[15]=u):u=t[15],(0,Y.useEffect)(c,u)},Zi=()=>{let e=(0,J.c)(22),t=Vt(),n=N(),[r,i]=Pe(`GLAMA_CHAT_MAXIMIZED`),a=t.chatSession;if(!a)throw new E(`Expected focused chat session`);let o;if(e[0]!==a||e[1]!==r||e[2]!==i?(o={focusedChatSession:a,maximized:r,setMaximized:i},e[0]=a,e[1]=r,e[2]=i,e[3]=o):o=e[3],Xi(o),!n)return null;let s=r?`100%`:`860px`,c;e[4]===s?c=e[5]:(c={maxWidth:s},e[4]=s,e[5]=c);let l;e[6]===a?l=e[7]:(l={...a,focused:!0},e[6]=a,e[7]=l);let u;e[8]!==r||e[9]!==i?(u=()=>{i(!r)},e[8]=r,e[9]=i,e[10]=u):u=e[10];let d;e[11]!==t.mentionSuggestionOptions||e[12]!==t.projects||e[13]!==l||e[14]!==u?(d=(0,q.jsx)(qi,{chatSession:l,mentionSuggestionOptions:t.mentionSuggestionOptions,onFocus:sa,onHyperFocus:u,onInputBlur:ca,onInputFocus:la,projects:t.projects,"data-sentry-element":`ChatSession`,"data-sentry-source-file":`_route.tsx`}),e[11]=t.mentionSuggestionOptions,e[12]=t.projects,e[13]=l,e[14]=u,e[15]=d):d=e[15];let f;e[16]!==c||e[17]!==d?(f=(0,q.jsx)(`div`,{className:`fPSBzf hlUslA coifUy hVpAQY hYZFkb`,style:c,children:d}),e[16]=c,e[17]=d,e[18]=f):f=e[18];let p;return e[19]!==a.uid||e[20]!==f?(p=(0,q.jsx)(`div`,{className:`fPSBzf hlUslA ATFzw jTWvec hYZFkb`,"data-sentry-component":`Route`,"data-sentry-source-file":`_route.tsx`,children:(0,q.jsx)(Bt,{"data-sentry-element":`ClientErrorBoundary`,"data-sentry-source-file":`_route.tsx`,children:f},a.uid)}),e[19]=a.uid,e[20]=f,e[21]=p):p=e[21],p},Qi=u(()=>{let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(`div`,{className:`bYPztT fPSBzf hlUslA bYPznK`,"data-sentry-component":`ErrorBoundary`,"data-sentry-source-file":`_route.tsx`,children:(0,q.jsx)(`p`,{className:`czikZZ jrPWok`,children:`An error occurred. Please try refreshing the page.`})}),e[0]=t):t=e[0],t}),$i=t(Zi);function ea(e){return e.role===`user`}function ta(e){return e.role===`assistant`}function na(){I({title:`Last response copied to clipboard`,type:`success`})}function ra(e){P({error:e,level:`error`,message:`could not copy last response to clipboard`}),I({title:`Could not copy last response`,type:`error`})}function ia(e){return e.role===`assistant`}function aa(){I({title:`Last code block copied to clipboard`,type:`success`})}function oa(e){P({error:e,level:`error`,message:`could not copy last code block to clipboard`}),I({title:`Could not copy last code block`,type:`error`})}function sa(){}function ca(){}function la(){}export{Qi as ErrorBoundary,$i as default,Yi as meta};
18//# sourceMappingURL=_route-CNOtjlve.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.