This repository has been archived on 2026-04-03. You can view files and clone it, but cannot push or open issues or pull requests.
nyx/dist/assets/AgentsView-DlISXhse.js
Nico e2667f8e12 Initial nyx project — fork of hermes-frontend
Forked from hermes-frontend, stripped openclaw/bun specifics:
- Auth tokens: openclaw_session -> nyx_session
- Vite proxy: localhost:3003 -> localhost:8000 (assay)
- Prod WS: wss://assay.loop42.de/ws
- Workspace paths: removed openclaw-specific paths
- Added missing deps: @heroicons/vue, overlayscrollbars-vue
- Branding: title -> nyx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 20:23:27 +02:00

6 lines
54 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{c as r,a as i,o as l,u as ue,t as fe,r as H,w as pe,b as re,d as it,e as P,n as oe,g as De,f as Ee,h as ae,i as K,j as U,k as Ye,F as G,l as W,m as Gt,p as y,q as Ae,s as ce,v as me,x as V,y as J,z as ee,_ as ve,A as X,B as Ft,C as Wt,D as qt,E as Yt,G as je,H as xe,I as ze,J as jt,P as zt,K as Ke,L as Kt,M as Jt,N as he,O as Xt,Q as Qt,R as es}from"./index-BcBhCcW4.js";import{g as rt}from"./marked.esm-D9eDbhZJ.js";import{r as Je,a as ts,b as Xe}from"./LockClosedIcon-BaCuRZ_8.js";function ss(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{"fill-rule":"evenodd",d:"M10 17a.75.75 0 0 1-.75-.75V5.612L5.29 9.77a.75.75 0 0 1-1.08-1.04l5.25-5.5a.75.75 0 0 1 1.08 0l5.25 5.5a.75.75 0 1 1-1.08 1.04l-3.96-4.158V16.25A.75.75 0 0 1 10 17Z","clip-rule":"evenodd"})])}function ns(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{d:"M10.75 16.82A7.462 7.462 0 0 1 15 15.5c.71 0 1.396.098 2.046.282A.75.75 0 0 0 18 15.06v-11a.75.75 0 0 0-.546-.721A9.006 9.006 0 0 0 15 3a8.963 8.963 0 0 0-4.25 1.065V16.82ZM9.25 4.065A8.963 8.963 0 0 0 5 3c-.85 0-1.673.118-2.454.339A.75.75 0 0 0 2 4.06v11a.75.75 0 0 0 .954.721A7.506 7.506 0 0 1 5 15.5c1.579 0 3.042.487 4.25 1.32V4.065Z"})])}function os(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{"fill-rule":"evenodd",d:"M10 2c-2.236 0-4.43.18-6.57.524C1.993 2.755 1 4.014 1 5.426v5.148c0 1.413.993 2.67 2.43 2.902 1.168.188 2.352.327 3.55.414.28.02.521.18.642.413l1.713 3.293a.75.75 0 0 0 1.33 0l1.713-3.293a.783.783 0 0 1 .642-.413 41.102 41.102 0 0 0 3.55-.414c1.437-.231 2.43-1.49 2.43-2.902V5.426c0-1.413-.993-2.67-2.43-2.902A41.289 41.289 0 0 0 10 2ZM6.75 6a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Zm0 2.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5h-3.5Z","clip-rule":"evenodd"})])}function as(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{"fill-rule":"evenodd",d:"M3.43 2.524A41.29 41.29 0 0 1 10 2c2.236 0 4.43.18 6.57.524 1.437.231 2.43 1.49 2.43 2.902v5.148c0 1.413-.993 2.67-2.43 2.902a41.202 41.202 0 0 1-5.183.501.78.78 0 0 0-.528.224l-3.579 3.58A.75.75 0 0 1 6 17.25v-3.443a41.033 41.033 0 0 1-2.57-.33C1.993 13.244 1 11.986 1 10.573V5.426c0-1.413.993-2.67 2.43-2.902Z","clip-rule":"evenodd"})])}function ct(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{"fill-rule":"evenodd",d:"M7.84 1.804A1 1 0 0 1 8.82 1h2.36a1 1 0 0 1 .98.804l.331 1.652a6.993 6.993 0 0 1 1.929 1.115l1.598-.54a1 1 0 0 1 1.186.447l1.18 2.044a1 1 0 0 1-.205 1.251l-1.267 1.113a7.047 7.047 0 0 1 0 2.228l1.267 1.113a1 1 0 0 1 .206 1.25l-1.18 2.045a1 1 0 0 1-1.187.447l-1.598-.54a6.993 6.993 0 0 1-1.929 1.115l-.33 1.652a1 1 0 0 1-.98.804H8.82a1 1 0 0 1-.98-.804l-.331-1.652a6.993 6.993 0 0 1-1.929-1.115l-1.598.54a1 1 0 0 1-1.186-.447l-1.18-2.044a1 1 0 0 1 .205-1.251l1.267-1.114a7.05 7.05 0 0 1 0-2.227L1.821 7.773a1 1 0 0 1-.206-1.25l1.18-2.045a1 1 0 0 1 1.187-.447l1.598.54A6.992 6.992 0 0 1 7.51 3.456l.33-1.652ZM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z","clip-rule":"evenodd"})])}function ls(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{"fill-rule":"evenodd",d:"M2 4.25A2.25 2.25 0 0 1 4.25 2h11.5A2.25 2.25 0 0 1 18 4.25v8.5A2.25 2.25 0 0 1 15.75 15h-3.105a3.501 3.501 0 0 0 1.1 1.677A.75.75 0 0 1 13.26 18H6.74a.75.75 0 0 1-.484-1.323A3.501 3.501 0 0 0 7.355 15H4.25A2.25 2.25 0 0 1 2 12.75v-8.5Zm1.5 0a.75.75 0 0 1 .75-.75h11.5a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-.75.75H4.25a.75.75 0 0 1-.75-.75v-7.5Z","clip-rule":"evenodd"})])}function Qe(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{d:"M14 6H6v8h8V6Z"}),i("path",{"fill-rule":"evenodd",d:"M9.25 3V1.75a.75.75 0 0 1 1.5 0V3h1.5V1.75a.75.75 0 0 1 1.5 0V3h.5A2.75 2.75 0 0 1 17 5.75v.5h1.25a.75.75 0 0 1 0 1.5H17v1.5h1.25a.75.75 0 0 1 0 1.5H17v1.5h1.25a.75.75 0 0 1 0 1.5H17v.5A2.75 2.75 0 0 1 14.25 17h-.5v1.25a.75.75 0 0 1-1.5 0V17h-1.5v1.25a.75.75 0 0 1-1.5 0V17h-1.5v1.25a.75.75 0 0 1-1.5 0V17h-.5A2.75 2.75 0 0 1 3 14.25v-.5H1.75a.75.75 0 0 1 0-1.5H3v-1.5H1.75a.75.75 0 0 1 0-1.5H3v-1.5H1.75a.75.75 0 0 1 0-1.5H3v-.5A2.75 2.75 0 0 1 5.75 3h.5V1.75a.75.75 0 0 1 1.5 0V3h1.5ZM4.5 5.75c0-.69.56-1.25 1.25-1.25h8.5c.69 0 1.25.56 1.25 1.25v8.5c0 .69-.56 1.25-1.25 1.25h-8.5c-.69 0-1.25-.56-1.25-1.25v-8.5Z","clip-rule":"evenodd"})])}function is(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{"fill-rule":"evenodd",d:"M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5ZM10 8a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0v-1.5h-1.5a.75.75 0 0 1 0-1.5h1.5v-1.5A.75.75 0 0 1 10 8Z","clip-rule":"evenodd"})])}function rs(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{"fill-rule":"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z","clip-rule":"evenodd"})])}function et(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{d:"M16.555 5.412a8.028 8.028 0 0 0-3.503-2.81 14.899 14.899 0 0 1 1.663 4.472 8.547 8.547 0 0 0 1.84-1.662ZM13.326 7.825a13.43 13.43 0 0 0-2.413-5.773 8.087 8.087 0 0 0-1.826 0 13.43 13.43 0 0 0-2.413 5.773A8.473 8.473 0 0 0 10 8.5c1.18 0 2.304-.24 3.326-.675ZM6.514 9.376A9.98 9.98 0 0 0 10 10c1.226 0 2.4-.22 3.486-.624a13.54 13.54 0 0 1-.351 3.759A13.54 13.54 0 0 1 10 13.5c-1.079 0-2.128-.127-3.134-.366a13.538 13.538 0 0 1-.352-3.758ZM5.285 7.074a14.9 14.9 0 0 1 1.663-4.471 8.028 8.028 0 0 0-3.503 2.81c.529.638 1.149 1.199 1.84 1.66ZM17.334 6.798a7.973 7.973 0 0 1 .614 4.115 13.47 13.47 0 0 1-3.178 1.72 15.093 15.093 0 0 0 .174-3.939 10.043 10.043 0 0 0 2.39-1.896ZM2.666 6.798a10.042 10.042 0 0 0 2.39 1.896 15.196 15.196 0 0 0 .174 3.94 13.472 13.472 0 0 1-3.178-1.72 7.973 7.973 0 0 1 .615-4.115ZM10 15c.898 0 1.778-.079 2.633-.23a13.473 13.473 0 0 1-1.72 3.178 8.099 8.099 0 0 1-1.826 0 13.47 13.47 0 0 1-1.72-3.178c.855.151 1.735.23 2.633.23ZM14.357 14.357a14.912 14.912 0 0 1-1.305 3.04 8.027 8.027 0 0 0 4.345-4.345c-.953.542-1.971.981-3.04 1.305ZM6.948 17.397a8.027 8.027 0 0 1-4.345-4.345c.953.542 1.971.981 3.04 1.305a14.912 14.912 0 0 0 1.305 3.04Z"})])}function cs(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z","clip-rule":"evenodd"})])}function us(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{d:"M7 4a3 3 0 0 1 6 0v6a3 3 0 1 1-6 0V4Z"}),i("path",{d:"M5.5 9.643a.75.75 0 0 0-1.5 0V10c0 3.06 2.29 5.585 5.25 5.954V17.5h-1.5a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-1.5v-1.546A6.001 6.001 0 0 0 16 10v-.357a.75.75 0 0 0-1.5 0V10a4.5 4.5 0 0 1-9 0v-.357Z"})])}function ds(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{"fill-rule":"evenodd",d:"M15.621 4.379a3 3 0 0 0-4.242 0l-7 7a3 3 0 0 0 4.241 4.243h.001l.497-.5a.75.75 0 0 1 1.064 1.057l-.498.501-.002.002a4.5 4.5 0 0 1-6.364-6.364l7-7a4.5 4.5 0 0 1 6.368 6.36l-3.455 3.553A2.625 2.625 0 1 1 9.52 9.52l3.45-3.451a.75.75 0 1 1 1.061 1.06l-3.45 3.451a1.125 1.125 0 0 0 1.587 1.595l3.454-3.553a3 3 0 0 0 0-4.242Z","clip-rule":"evenodd"})])}function gs(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{d:"m2.695 14.762-1.262 3.155a.5.5 0 0 0 .65.65l3.155-1.262a4 4 0 0 0 1.343-.886L17.5 5.501a2.121 2.121 0 0 0-3-3L3.58 13.419a4 4 0 0 0-.885 1.343Z"})])}function fs(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{d:"M10.5 3.75a.75.75 0 0 0-1.264-.546L5.203 7H2.667a.75.75 0 0 0-.7.48A6.985 6.985 0 0 0 1.5 10c0 .887.165 1.737.468 2.52.111.29.39.48.7.48h2.535l4.033 3.796a.75.75 0 0 0 1.264-.546V3.75ZM16.45 5.05a.75.75 0 0 0-1.06 1.061 5.5 5.5 0 0 1 0 7.778.75.75 0 0 0 1.06 1.06 7 7 0 0 0 0-9.899Z"}),i("path",{d:"M14.329 7.172a.75.75 0 0 0-1.061 1.06 2.5 2.5 0 0 1 0 3.536.75.75 0 0 0 1.06 1.06 4 4 0 0 0 0-5.656Z"})])}function hs(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{d:"M5.25 3A2.25 2.25 0 0 0 3 5.25v9.5A2.25 2.25 0 0 0 5.25 17h9.5A2.25 2.25 0 0 0 17 14.75v-9.5A2.25 2.25 0 0 0 14.75 3h-9.5Z"})])}function ps(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{d:"M10 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM6 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM1.49 15.326a.78.78 0 0 1-.358-.442 3 3 0 0 1 4.308-3.516 6.484 6.484 0 0 0-1.905 3.959c-.023.222-.014.442.025.654a4.97 4.97 0 0 1-2.07-.655ZM16.44 15.98a4.97 4.97 0 0 0 2.07-.654.78.78 0 0 0 .357-.442 3 3 0 0 0-4.308-3.517 6.484 6.484 0 0 1 1.907 3.96 2.32 2.32 0 0 1-.026.654ZM18 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM5.304 16.19a.844.844 0 0 1-.277-.71 5 5 0 0 1 9.947 0 .843.843 0 0 1-.277.71A6.975 6.975 0 0 1 10 18a6.974 6.974 0 0 1-4.696-1.81Z"})])}function ms(t,a){return l(),r("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[i("path",{"fill-rule":"evenodd",d:"M19 5.5a4.5 4.5 0 0 1-4.791 4.49c-.873-.055-1.808.128-2.368.8l-6.024 7.23a2.724 2.724 0 1 1-3.837-3.837L9.21 8.16c.672-.56.855-1.495.8-2.368a4.5 4.5 0 0 1 5.873-4.575c.324.105.39.51.15.752L13.34 4.66a.455.455 0 0 0-.11.494 3.01 3.01 0 0 0 1.617 1.617c.17.07.363.02.493-.111l2.692-2.692c.241-.241.647-.174.752.15.14.435.216.9.216 1.382ZM4 17a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z","clip-rule":"evenodd"})])}const vs=50,tt=100;function ys(t,a,n){const o=ue(),f=H(!1),s=H(null);let S=null,g=[],_=null;const w=H(null),h=H([]),$=H(0),x=new Map,O=new Map,d=new Map;function m(c){if(!c)return null;const k=d.get(c);if(!k)return null;const M=k.deref();return M||(d.delete(c),null)}const I=H(null);function E(c){return{id:c.id||crypto.randomUUID(),type:c.type||"received",state:c.state||"running",label:c.label||"",children:[],replay:c.replay??!1,startedAt:c.startedAt||Date.now(),...c}}function C(c,k){for(const M of c){if(M.correlationId===k)return M;if(M.children){const A=C(M.children,k);if(A)return A}}return null}function e(c,k){if(k&&k!=="history"){const M=O.get(k);if(M){M.children.push(c),fe(h),$.value++;return}}h.value.unshift(c),h.value.length>tt&&h.value.splice(tt),fe(h),$.value++}function T(c){const k=!!c.replay,M=c.ts||Date.now(),A=c.correlationId,N=c.parentId;switch(c.event){case"turn_start":{if(A&&(x.has(A)||O.has(A)))break;const R=E({type:"turn",state:"running",label:"🔄 Turn",correlationId:A,startedAt:M,replay:k});A&&(x.set(A,R),O.set(A,R)),!k&&A&&(I.value=A),e(R);break}case"turn_end":{const R=A?x.get(A):null;R&&(R.state="done",R.endedAt=M,R.durationMs=c.durationMs,A&&(x.delete(A),O.delete(A)),fe(h),$.value++),!k&&A&&I.value===A&&(I.value=null);break}case"think_start":{const R=E({type:"think",state:"running",label:"Thinking",correlationId:A,startedAt:M,replay:k});A&&x.set(A,R),e(R,N);break}case"think_end":{const R=A?x.get(A):null;R?(R.state="done",R.endedAt=M,R.durationMs=c.durationMs,A&&x.delete(A),fe(h),$.value++):e(E({type:"think",state:"done",label:"Thinking",correlationId:A,startedAt:M,endedAt:M,durationMs:c.durationMs,replay:k}),N);break}case"tool_start":{const R=c.tool||"unknown",b=c.args||{},L=q(R,b),F=E({type:"tool",state:"running",label:L,tool:R,args:b,correlationId:A,startedAt:M,replay:k});A&&x.set(A,F),c.toolCallId&&d.set(c.toolCallId,new WeakRef(F)),e(F,N),w.value=L;break}case"tool_end":{const R=c.tool||"unknown",b=c.result||{};let L=m(c.toolCallId)??(A?x.get(A):null);if(!L&&N){const F=C(h.value,N);if(F?.children){const le=F.children.find(ne=>ne.type==="tool"&&ne.state==="running"&&(ne.tool===R||ne.tool==="unknown"));le&&(L=le,le.correlationId&&x.delete(le.correlationId))}}if(L)L.state=b.ok===!1?"error":"done",L.result=b,L.endedAt=M,L.durationMs=c.durationMs,L.label=q(R,L.args||{},b),A&&x.delete(A),c.toolCallId&&d.delete(c.toolCallId),fe(h),$.value++;else{const F=q(R,c.args||{},b);e(E({type:"tool",state:"done",label:F,tool:R,result:b,correlationId:A,startedAt:M,endedAt:M,durationMs:c.durationMs,replay:k}),N)}break}case"received":{const R=E({type:"received",state:"done",subtype:c.subtype,label:c.label||c.subtype||"received",startedAt:M,endedAt:M,replay:k});e(R);break}}}function q(c,k,M){if(["read","write","edit","append"].includes(c)){const N=k.viewerPath||k.path||"",R=N.split("/").pop()||N,b=M?.area||k.area,L=b?`:L${b.startLine}${b.endLine}`:"";return`${R}${L}`}if(c==="exec"){const N=k.command||"";return`${N.slice(0,60)}${N.length>60?"…":""}`}return c==="web_fetch"?(k.url||"").slice(0,60):c==="web_search"?(k.query||"").slice(0,60):c}function Y(c){if(!c)return[];const k=h.value.find(M=>M.correlationId===c)??[...O.values()].find(M=>M.correlationId===c);return k?k.children.filter(M=>M.type==="tool"):[]}function j(){const c=[`HUD tree — ${h.value.length} root node(s)
`];for(const k of h.value){const M=k.durationMs!=null?` [${k.durationMs}ms]`:"",A=k.replay?" (replay)":"";c.push(` ${k.state==="running"?"⏳":k.state==="error"?"❌":"✅"} [${k.type}] ${k.label}${M}${A}`),c.push(` id=${k.id.slice(0,8)} corrId=${(k.correlationId||"—").slice(0,8)} children=${k.children.length}`);for(const N of k.children){const R=N.durationMs!=null?` [${N.durationMs}ms]`:"";c.push(` ${N.state==="running"?"⏳":N.state==="error"?"❌":"✅"} [${N.type}] ${N.label}${R}`),N.args&&c.push(` args: ${JSON.stringify(N.args).slice(0,80)}`),N.result&&c.push(` result: ${JSON.stringify(N.result).slice(0,80)}`)}}return c.join(`
`)}function z(c){w.value=c}function te(c){c.value&&(c.value=!1,o.clearMessages(),a.value=vs,f.value=!1,S=performance.now(),g=[],_=null)}function se(){S=null;const c=g,k=_;g=[],_=null;const M=o.messages.findIndex(N=>N.role==="system"&&N.content.includes("Loading session history..."));M!==-1?o.messages.splice(M,1,...c):o.messages.unshift(...c);const A=c.filter(N=>N.role!=="system").length;o.sessionContextHint=A>0?`${A} msgs in context`:"fresh context",k&&(s.value=k)}function de(c){if(!c?.length)return;S===null&&(S=performance.now()),o.messages.some(b=>b.content?.includes("Loading session history..."))||o.pushSystem("⏳ Loading session history...",n());const k=[],M=n(),A=o.localSessionId;let N=null;for(const b of c){if(b.type==="hud"){T({...b,replay:!0});continue}if(b.event==="tool_start"||b.event==="tool_end"||b.event==="think_start"||b.event==="think_end"||b.event==="turn_start"||b.event==="turn_end"||b.event==="received"){T({...b,replay:!0});continue}if(b.entry_type==="session_context")k.push({role:"session_context",content:b.content||"",agentId:M,sessionId:A});else if(b.entry_type==="user_message")k.push({role:"user",content:b.content||"",agentId:M,sessionId:A});else if(b.entry_type==="assistant_text"){const L=(b.content||"").replace(/^\[\[reply_to[^\]]*\]\]\s*/i,"").trim();if(!L)continue;const F={role:"assistant",content:L,streaming:!1,agentId:M,sessionId:A,timestamp:b.ts||null};b.truncated&&(F.truncated=!0),N&&(F.usage=N,N=null),k.push(F)}else if(b.entry_type==="usage"){N={input_tokens:b.input_tokens||0,output_tokens:b.output_tokens||0,total_tokens:b.total_tokens||0,cost:Number(b.cost||0)};const L=k[k.length-1];L?.role==="assistant"&&(L.usage=N,N=null)}}g=k;const R=c.filter(b=>b.entry_type==="usage").reduce((b,L)=>({input_tokens:b.input_tokens+(L.input_tokens||0),output_tokens:b.output_tokens+(L.output_tokens||0),total_tokens:b.total_tokens+(L.total_tokens||0),cost:b.cost+Number(L.cost||0)}),{input_tokens:0,output_tokens:0,total_tokens:0,cost:0});_=R.total_tokens>0?R:null}function Ie(c,k,M){if(c.type==="hud"){T(c);return}const A=!f.value,N=n(),R=o.localSessionId;switch(c.entry_type){case"user_message":{const b=c.content||"";if(b.startsWith("A new session was started")||!A&&b.includes("[voice transcript]:")||c.msgId&&o.messages.some(F=>F.msgId===c.msgId))break;!A&&!k.has(b.trim())?o.messages.push({role:"user",content:b,agentId:N,sessionId:R,msgId:c.msgId}):k.delete(b.trim());break}}}function Me(){x.clear(),O.clear(),d.clear(),I.value=null,h.value=[],$.value++}function ye(){return[...d.entries()].map(([c,k])=>{const M=k.deref();return{toolCallId:c,label:M?.label??null,state:M?.state??null,stale:!M}})}return{sessionHistoryComplete:f,lastUsage:s,lastSystemMsgRef:w,hudTree:h,hudVersion:$,activeTurnCorrId:I,getToolsForTurn:Y,pushHudEvent:T,hudSnapshot:j,toolCallMapSnapshot:ye,resetHudMaps:Me,flushPendingClear:te,revealMessages:se,handleSessionHistory:de,handleSessionEntry:Ie,pushSystem:z}}function ws(t,a,n,o,f){const s=ue(),{connected:S,send:g,onMessage:_,replayBuffer:w}=pe,{updateFromServer:h,selectedAgent:$}=it,x=()=>s.smState==="HANDOVER_PENDING"||s.smState==="HANDOVER_DONE",d=ys(()=>s.smState==="AGENT_RUNNING",t,()=>$.value);d.lastUsage=a,re(d.activeTurnCorrId,E=>{s.activeTurnCorrId=E});function m(E){d.pushSystem(E)}function I(){const E={auth_ok(e){h(e)},ready(e){h(e),e.sessionId&&(s.sessionKey=e.sessionId)},thinking(e){x()||s.appendThinking(e.content)},delta(e){x()||(d.flushPendingClear(n),s.collapseThinking(),s.appendAssistantDelta(e.content,e.agentId))},message(e){x()||(d.flushPendingClear(n),e.streaming===!1?s.createCompleteAssistantMessage(e.content,e.agentId,e.usage):e.final&&s.finalizeAssistantMessage(null,e.usage))},truncated_warning(e){s.collapseThinking(),s.hasActiveStreamingMessage()&&s.finalizeAssistantMessage(null,void 0,!0),s.truncatedWarning=!0},done(e){if(!x()){if(s.collapseThinking(),e.suppress)s.suppressAssistantMessage();else{const T=e.content||null;if(s.hasActiveStreamingMessage()){const q=s.streamingMessageLength(),Y=T&&q<T.length?T:null;s.finalizeAssistantMessage(Y,e.usage)}else T&&s.createCompleteAssistantMessage(T,void 0,e.usage)}d.lastSystemMsgRef.value=null}},session_history(e){s.hasActiveStreamingMessage()&&s.finalizeAssistantMessage(null),s.collapseThinking(),d.flushPendingClear(n),d.handleSessionHistory(e.entries)},hud(e){d.pushHudEvent(e),e.event==="turn_start"&&!e.replay&&(s.activeTurnCorrId=e.correlationId??null,s.startNewAssistantMessage($.value))},event(e){e.event==="agent"&&e.payload?.stream==="tool"&&console.log("[HUD agent/tool]",JSON.stringify(e.payload).slice(0,400))},tool(e){e.action==="call"?m(`${e.tool} ${e.args||""}`):e.action==="result"&&m(`${e.result||""}`)},session_entry(e){d.handleSessionEntry(e,o,m)},message_update(e){if(!e.msgId||!e.patch)return;const T={...e.patch};if(T.voiceAudioUrl){const Y=localStorage.getItem("nyx_session")||localStorage.getItem("titan_token")||"";T.voiceAudioUrl=`${T.voiceAudioUrl}?token=${encodeURIComponent(Y)}`}T.transcript&&o.add(`[voice transcript]: ${T.transcript}`.trim()),s.patchMessage(e.msgId,T)||console.warn("[message_update] no message found for msgId:",e.msgId)},handover_done(e){s.messages.push({role:"assistant",content:e.content||"📋 Handover written.",agentId:$.value,sessionId:s.localSessionId}),s.messages.push({role:"system",content:"Start a new session with this handover context?",confirmNew:!0,confirmed:!1,agentId:$.value,sessionId:s.localSessionId})},handover_context(e){},channel_state(e){if(!e.state)return;e.clear_history&&(console.log("[clear] channel switch",{state:e.state,msgCount:s.messages.length}),d.resetHudMaps(),s.messages.length=0,n.value=!1);const T=s.channelState;if(s.applyChannelState(e.state),(e.state==="READY"||e.state==="FRESH")&&(d.lastSystemMsgRef.value=null,s.queuedThought!==null&&T==="AGENT_RUNNING")){const q=s.queuedThought;s.queuedThought=null,g({type:"message",content:q})}},connection_state(e){e.state&&(s.applyConnectionState(e.state),e.state==="LOADING_HISTORY"&&(d.resetHudMaps(),s.messages.length=0,n.value=!1),e.state==="SYNCED"&&(d.flushPendingClear(n),d.revealMessages()))},session_state(e){if(e.state&&(e.reconnected,(e.reconnected||e.clear_history)&&(console.log("[clear] immediate flush",{reconnected:e.reconnected,clear_history:e.clear_history,state:e.state,msgCount:s.messages.length}),s.stashMessages(),d.resetHudMaps(),s.messages.length=0,n.value=!1),s.applySessionState(e.state),(e.state==="READY"||e.state==="FRESH"||e.state==="IDLE")&&(d.lastSystemMsgRef.value=null,s.queuedThought!==null))){const T=s.queuedThought;s.queuedThought=null,g({type:"message",content:T})}},session_total_tokens(e){s.sessionTotalTokens=e},finance_update(e){s.finance=e},usage(e){x()||(s.sessionTotalTokens={input_tokens:e.input_tokens||s.sessionTotalTokens?.input_tokens||0,cache_read_tokens:e.cache_read_tokens||s.sessionTotalTokens?.cache_read_tokens||0,output_tokens:e.output_tokens||s.sessionTotalTokens?.output_tokens||0})},session_status(e){e.status==="no_session"?(n.value=!0,d.flushPendingClear(n),s.messages.push({role:"system",type:"no_session",content:"-- NO SESSION --",agentId:$.value,sessionId:s.localSessionId}),s.sessionContextHint=""):e.status==="watching"&&(d.flushPendingClear(n),d.sessionHistoryComplete.value=!0,d.revealMessages())},sent(e){},switch_ok(e){d.sessionHistoryComplete.value=!1,e.sessionKey&&(s.sessionKey=e.sessionKey)},new_ok(e){d.sessionHistoryComplete.value=!1},error(e){e.code==="SESSION_TERMINATED"?(s.pushSystem("⚠️ Message not delivered — session was resetting. Please try again.",$.value),f?.()):(e.code==="DISCARDED_NOT_IDLE"||e.code==="DISCARDED_NOT_READY")&&(s.pushSystem("⚠️ Message not delivered — agent was busy. Please try again.",$.value),f?.())},stopped(e){s.pushSystem("✅ Agent stopped",$.value)},killed(e){s.pushSystem("☠️ Agent killed",$.value)}},C=_(e=>{const T=E[e.type];T&&T(e)});return w(e=>{const T=E[e.type];T&&T(e)}),C}return{mount:I,lastSystemMsg:d.lastSystemMsgRef,hudTree:d.hudTree,hudVersion:d.hudVersion,getToolsForTurn:d.getToolsForTurn,hudSnapshot:d.hudSnapshot,toolCallMapSnapshot:d.toolCallMapSnapshot,sessionHistoryComplete:d.sessionHistoryComplete,pushSystem:m,hasActiveStreamingMessage:s.hasActiveStreamingMessage}}function _s(){return crypto.randomUUID()}const ut=new rt.Renderer;ut.link=({href:t,title:a,text:n})=>{const o=a?` title="${a}"`:"";return`<a href="${t}"${o} target="_blank" rel="noopener noreferrer">${n}</a>`};function ks(t){const a={30:"#555",31:"#e06c75",32:"#98c379",33:"#e5c07b",34:"#61afef",35:"#c678dd",36:"#56b6c2",37:"#abb2bf"};let n=!1,o=!1,f=!1;const s=t.replace(/\x1b\[([0-9;]*)m/g,(g,_)=>{const w=_.split(";").map(Number);let h="";for(const $ of w)$===0?(n&&(h+="</span>",n=!1),o&&(h+="</strong>",o=!1),f&&(h+="</span>",f=!1)):$===1?o||(h+="<strong>",o=!0):$===2?f||(h+='<span style="opacity:0.45">',f=!0):a[$]&&(n&&(h+="</span>"),h+=`<span style="color:${a[$]}">`,n=!0);return h});let S="";return n&&(S+="</span>"),o&&(S+="</strong>"),f&&(S+="</span>"),s+S}const Ss=/(workspace\/[^\s"'<>)]+\.(?:pdf|png|jpg|jpeg|gif|csv|json|txt|md|html|zip|mp3|wav|ogg|webm|m4a))/g,bs="",As=new Set(["mp3","wav","ogg","webm","m4a"]);function Is(t){return t.replace(Ss,a=>{const n=a.split("/").pop()||a,o=a.startsWith("/")?a:bs+a,f=n.split(".").pop()?.toLowerCase()||"";return As.has(f)?`<audio controls class="inline-audio" data-filepath="${o}" onplay="window.__hermesAudioSrc(this)"></audio>`:`<button class="file-download-link" data-filepath="${o}" data-filename="${n}" onclick="window.__hermesDownload(this)" title="Download ${n}">📎 ${n}</button>`})}typeof window<"u"&&!window.__hermesAudioSrc&&(window.__hermesAudioSrc=t=>{if(t.src)return;const a=t.dataset.filepath;if(!a)return;const n=localStorage.getItem("nyx_session")||localStorage.getItem("titan_token")||"",o=De();t.src=`${o}/api/files${a}?token=${encodeURIComponent(n)}`});typeof window<"u"&&!window.__hermesDownload&&(window.__hermesDownload=async t=>{const a=t.dataset.filepath,n=t.dataset.filename||"download";if(a){t.textContent="⏳ "+n;try{const o=localStorage.getItem("nyx_session")||localStorage.getItem("titan_token")||"",f=De(),s=await fetch(`${f}/api/files${a}?token=${encodeURIComponent(o)}`);if(!s.ok)throw new Error(`${s.status}`);const S=await s.blob(),g=URL.createObjectURL(S),_=document.createElement("a");_.href=g,_.download=n,_.click(),URL.revokeObjectURL(g),t.textContent="✅ "+n}catch(o){t.textContent="❌ "+n,console.error("[download]",o)}}});function dt(t){const a=t||"";if(/\x1b\[/.test(a)){const o=a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`<pre style="font-family:var(--font-mono);line-height:1.5;white-space:pre-wrap">${ks(o)}</pre>`}let n=rt.parse(a,{renderer:ut,async:!1,gfm:!0,breaks:!0});return n=Is(n),n}const Re="chat_draft",gt="chat_input_history",Ms=50;function $s(){try{return sessionStorage.getItem(Re)||""}catch{return""}}function st(t){try{t?sessionStorage.setItem(Re,t):sessionStorage.removeItem(Re)}catch{}}function ft(){try{return JSON.parse(sessionStorage.getItem(gt)||"[]")}catch{return[]}}function Ts(t){try{const a=ft().filter(n=>n!==t);a.unshift(t),sessionStorage.setItem(gt,JSON.stringify(a.slice(0,Ms)))}catch{}}function Cs(t){const a=ue(),n=H(!1),o=H($s()),f=H(null);let s=-1;function S(){const m=f.value;if(!m)return null;const I=m.$el||m;return I.querySelector?.("[data-overlayscrollbars-viewport]")||I}function g(){oe(()=>{oe(()=>{requestAnimationFrame(()=>{const m=S();m&&(m.scrollTop=m.scrollHeight)})})})}function _(){const m=S();m&&m.scrollHeight-m.scrollTop-m.clientHeight<80&&g()}let w=null;function h(){w&&clearTimeout(w),w=setTimeout(()=>st(o.value),1e3)}function $(m){const I=ft();I.length&&(m==="up"?s=Math.min(s+1,I.length-1):s=Math.max(s-1,-1),o.value=s===-1?"":I[s])}let x="";function O(){o.value=x}async function d(m){const I=o.value.trim().length>0,E=m&&m.length>0;if(!I&&!E||n.value)return;const C=o.value.trim();I&&(x=C,Ts(C)),s=-1,o.value="",st(""),n.value=!0;const e=_s(),T=E?m.map(j=>{const z=j.mimeType.split(";")[0];let te;if(j.mimeType.startsWith("audio/")){const se=Uint8Array.from(atob(j.content),de=>de.charCodeAt(0));te=URL.createObjectURL(new Blob([se],{type:z}))}else te=`data:${z};base64,${j.content}`;return{mimeType:j.mimeType,fileName:j.fileName,dataUrl:te}}):void 0,q=E&&m.some(j=>j.mimeType.startsWith("audio/"));a.pushMessage({role:"user",content:C,agentId:null,msgId:e,attachments:T,pending:q});const Y={type:"message",content:C,msgId:e};E&&(Y.attachments=m),t(Y),n.value=!1}return{sending:n,input:o,messagesEl:f,parseMd:dt,scrollToBottom:g,scrollIfAtBottom:_,send:d,onInputChange:h,navigateHistory:$,restoreLastSent:O,startNewAssistantMessage:a.startNewAssistantMessage,appendAssistantMessage:a.appendAssistantDelta,finalizeAssistantMessage:a.finalizeAssistantMessage,resetAssistantMessageState:a.resetLocalSession,hasActiveStreamingMessage:a.hasActiveStreamingMessage,streamingMessageVisibleContent:P(()=>a.streamingMessageVisibleContent)}}function Ns(t,a,n,o,f){const S=P(()=>{const d=t.value,m=Math.max(0,d.length-a.value);return d.slice(m).map((I,E)=>({...I,_sourceIndex:m+E}))}),g=P(()=>t.value.length>a.value);function _(){a.value+=50}function w(d){if(!d)return"Unknown";const m=o.value.find(I=>I.id===d);return m?m.name:d}function h(d,m){if(d===0)return!0;const I=m[d],E=m[d-1];return!I.agentId||!E.agentId?I.sessionId!==E.sessionId:I.agentId!==E.agentId||I.sessionId!==E.sessionId}function $(d){const m=f?.value;return m?`${d} · ${m}`:d}function x(d,m){const I=m[d],E=I.agentId||n.value,C=w(E);if(d===0)return{text:$(C),kind:"agent"};const e=m[d-1];return I.agentId!==e.agentId?{text:$(C),kind:"agent"}:I.sessionId!==e.sessionId?{text:"New Session",kind:"new-session"}:{text:$(C),kind:"agent"}}const O=P(()=>{const d=S.value,m=[];let I=null;for(let E=0;E<d.length;E++){const C=d[E];if(h(E,d)){I&&(m.push(I),I=null);const{text:e,kind:T}=x(E,d);m.push({role:"system",type:"headline",content:e,headlineKind:T,agentId:C.agentId,sessionId:C.sessionId,position:"header"})}if(C.role==="system"&&C.type!=="no_session")I?I.messages.push(C):I={role:"system_group",messages:[C],agentId:C.agentId,sessionId:C.sessionId};else{I&&(m.push(I),I=null),m.push(C);const e=C.agentId||n.value;if(e&&E===d.length-1){const T=w(e);m.push({role:"system",type:"headline",content:$(T),headlineKind:"agent",agentId:e,sessionId:C.sessionId,position:"footer"})}}}return I&&m.push(I),m});return{visibleMsgs:S,groupedVisibleMsgs:O,hasMore:g,loadMore:_,getFormattedAgentName:w}}function xs(t){const a=H(null),n=H(!1);function o(){const s=a.value;s&&(s.style.height="auto",s.style.height=s.scrollHeight+"px",s.style.overflowY=s.scrollHeight>160?"auto":"hidden")}function f(){n.value=!0,setTimeout(()=>{n.value=!1},400)}return re(t,s=>{s||oe(()=>o())}),{inputEl:a,isShaking:n,autoGrow:o,triggerShake:f}}function Es(t,a,n){const o=ue(),f=P(()=>{const w=n.value.find(h=>h.id===a.value);return w?w.name:a.value}),s=P(()=>{const w=n.value.find(h=>h.id===t.value);return(w?w.name:t.value).toUpperCase()}),S=P(()=>o.smState==="AGENT_RUNNING"),g=P(()=>o.channelState==="READY"||o.channelState==="FRESH"),_=P(()=>{switch(o.smState){case"CONNECTING":return"⚙️ Connecting…";case"AGENT_RUNNING":return"⚙️ Working…";case"HANDOVER_PENDING":return"📝 Writing handover…";case"HANDOVER_DONE":return"✅ Handover ready";case"SWITCHING":return"🔀 Switching…";default:return null}});return{defaultAgentName:f,agentDisplayName:s,isAgentRunning:S,agentStatusDone:g,agentStatus:_}}const nt=["image/jpeg","image/png","image/gif","image/webp","application/pdf","audio/webm","audio/mp4","audio/ogg","audio/mpeg","audio/wav","audio/x-m4a"],Rs=10*1024*1024;function Ds(t){return new Promise((a,n)=>{const o=new FileReader;o.onload=()=>{const f=o.result,s=f.indexOf(",");a(s>=0?f.slice(s+1):f)},o.onerror=()=>n(o.error),o.readAsDataURL(t)})}function Hs(){const t=H([]);async function a(S){for(const g of Array.from(S)){const _=g.type.split(";")[0];if(!nt.includes(_)&&!nt.includes(g.type)){console.warn(`[attachments] skipped ${g.name}: unsupported type ${g.type}`);continue}if(g.size>Rs){console.warn(`[attachments] skipped ${g.name}: exceeds 5MB (${(g.size/1024/1024).toFixed(1)}MB)`);continue}const w=await Ds(g),h=URL.createObjectURL(g);t.value.push({file:g,preview:h,base64:w,mimeType:g.type,fileName:g.name})}}function n(S){const g=t.value[S];g&&URL.revokeObjectURL(g.preview),t.value.splice(S,1)}function o(){for(const S of t.value)URL.revokeObjectURL(S.preview);t.value=[]}function f(){return t.value.map(S=>({type:S.mimeType.startsWith("image/")?"image":S.mimeType.startsWith("audio/")?"audio":"document",mimeType:S.mimeType,content:S.base64,fileName:S.fileName}))}function s(){return t.value.length>0}return{attachments:t,addFiles:a,removeAttachment:n,clearAttachments:o,toPayload:f,hasAttachments:s}}function Ls(){const t=H(!1),a=H(0),n=H(0),o=H(!1);let f=null,s=null,S=null,g=null,_=null,w=[],h=null,$=0;function x(){h&&(clearInterval(h),h=null),S&&(S.close().catch(()=>{}),S=null,g=null,_=null),s&&(s.getTracks().forEach(C=>C.stop()),s=null),f=null,w=[],a.value=0,n.value=0,t.value=!1}function O(){if(!g||!_)return;g.getByteTimeDomainData(_);let C=0;for(let e=0;e<_.length;e++){const T=(_[e]-128)/128;C+=T*T}n.value=Math.min(1,Math.sqrt(C/_.length)*3)}async function d(){if(t.value)return;try{s=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){console.warn("[audio] mic access denied:",e),o.value=!0,setTimeout(()=>{o.value=!1},5e3);return}try{S=new AudioContext;const e=S.createMediaStreamSource(s);g=S.createAnalyser(),g.fftSize=256,e.connect(g),_=new Uint8Array(g.fftSize)}catch(e){console.warn("[audio] analyser setup failed:",e)}w=[];const C=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"";f=new MediaRecorder(s,C?{mimeType:C}:void 0),f.ondataavailable=e=>{e.data.size>0&&w.push(e.data)},f.start(250),t.value=!0,$=Date.now(),h=setInterval(()=>{a.value=Math.floor((Date.now()-$)/1e3),O()},80)}function m(){return new Promise(C=>{if(!f||f.state==="inactive"){x(),C(null);return}f.onstop=()=>{const e=f?.mimeType||"audio/webm",T=e.includes("mp4")?"mp4":e.includes("ogg")?"ogg":"webm",q=new Blob(w,{type:e}),Y=new File([q],`recording-${Date.now()}.${T}`,{type:e});x(),C(Y)},f.stop()})}function I(){f&&f.state!=="inactive"&&(f.onstop=()=>{},f.stop()),x()}function E(C){const e=Math.floor(C/60),T=C%60;return`${e}:${T.toString().padStart(2,"0")}`}return Ee(x),{isRecording:t,duration:a,audioLevel:n,micDenied:o,startRecording:d,stopRecording:m,cancelRecording:I,formatDuration:E}}const Us={key:1,class:"bubble-footer"},ht=ae({__name:"MessageFrame",props:{role:{},copyContent:{}},setup(t){const a=t;function n(){a.copyContent!==void 0&&navigator.clipboard.writeText(a.copyContent).catch(()=>{const o=document.createElement("textarea");o.value=a.copyContent,document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)})}return(o,f)=>(l(),r("div",{class:K(["message",t.role])},[t.role!=="system"?(l(),r("button",{key:0,class:"copy-btn",onClick:n,title:"Copy"},"⎘")):U("",!0),Ye(o.$slots,"default"),o.$slots.footer?(l(),r("div",Us,[Ye(o.$slots,"footer")])):U("",!0)],2))}}),Bs=["src"],Vs=["src"],Ps={key:2,class:"voice-pending"},Os={key:3},Zs={key:4,class:"user-attachments"},Gs=["title"],Fs={class:"pdf-name"},Ws=["onClick"],qs=["src","alt"],Ys=["src"],js=ae({__name:"UserMessage",props:{msg:{}},setup(t){const a=t,n=Ae.currentUser,o=H("");function f(g){o.value=g}const s=P(()=>(a.msg.attachments||[]).find(g=>g.mimeType?.startsWith("audio/"))),S=P(()=>(a.msg.attachments||[]).filter(g=>!g.mimeType?.startsWith("audio/")));return(g,_)=>(l(),r(G,null,[W(ht,{role:"user",copyContent:t.msg.content},Gt({default:ce(()=>[t.msg.voiceAudioUrl?(l(),r("audio",{key:0,controls:"",src:t.msg.voiceAudioUrl,class:"user-att-audio"},null,8,Bs)):s.value?(l(),r("audio",{key:1,controls:"",src:s.value.dataUrl,class:"user-att-audio"},null,8,Vs)):U("",!0),t.msg.pending?(l(),r("div",Ps,"transcribing...")):U("",!0),t.msg.content?(l(),r("div",Os,V(t.msg.content),1)):U("",!0),S.value.length?(l(),r("div",Zs,[(l(!0),r(G,null,J(S.value,(w,h)=>(l(),r(G,{key:h},[w.mimeType==="application/pdf"?(l(),r("div",{key:0,class:"user-att-pdf",title:w.fileName||"PDF"},[_[2]||(_[2]=i("span",{class:"pdf-icon"},"📄",-1)),i("span",Fs,V(w.fileName||"document.pdf"),1)],8,Gs)):(l(),r("div",{key:1,class:"user-att-thumb",onClick:$=>f(w.dataUrl)},[i("img",{src:w.dataUrl,alt:w.fileName||"image",loading:"lazy"},null,8,qs)],8,Ws))],64))),128))])):U("",!0)]),_:2},[y(n)?{name:"footer",fn:ce(()=>[me(V(y(n)),1)]),key:"0"}:void 0]),1032,["copyContent"]),o.value?(l(),r("div",{key:0,class:"lightbox-overlay",onClick:_[1]||(_[1]=w=>o.value="")},[i("img",{src:o.value,class:"lightbox-img",onClick:_[0]||(_[0]=ee(()=>{},["stop"]))},null,8,Ys)])):U("",!0)],64))}}),ot=ve(js,[["__scopeId","data-v-90f9dace"]]),zs=ae({__name:"ToolIcon",props:{tool:{}},setup(t){const a=t,n={read:ns,write:gs,edit:ms,append:is,exec:Je,web_search:et,web_fetch:et,memory_search:Qe,memory_get:Qe,browser:ls},o=P(()=>{if(!a.tool)return Je;const f=a.tool.toLowerCase();return n[f]?n[f]:f.includes("message")?as:f.includes("session")?ts:ct});return(f,s)=>(l(),X(Ft(o.value),{class:"tool-icon w-3.5 h-3.5 inline shrink-0"}))}});function pt(t){const a=typeof t=="string"?new Date(t):t,o=Date.now()-a.getTime();if(o<0)return"just now";const f=Math.floor(o/1e3);if(f<60)return"just now";const s=Math.floor(f/60);if(s<60)return`${s}m ago`;const S=Math.floor(s/60);if(S<24)return`${S}h ago`;const g=Math.floor(S/24);return g<30?`${g}d ago`:a.toLocaleDateString()}const Ks=["innerHTML"],Js={class:"footer-name"},Xs={key:0,class:"tts-spinner"},Qs={key:1,class:"footer-status"},en={key:2,class:"footer-status"},tn={key:3,class:"footer-tools"},sn=["title"],nn={key:4,class:"truncated-notice"},on=ae({__name:"AssistantMessage",props:{msg:{},agentDisplayName:{},isAgentRunning:{type:Boolean},allAgents:{},getToolsForTurn:{type:Function},hudVersion:{}},setup(t){const a=ue(),n=Wt(),o=t,f=P(()=>{const _=o.msg.agentId;if(_){const w=o.allAgents?.find(h=>h.id===_);return(w?w.name:_).toUpperCase()}return o.agentDisplayName}),s=P(()=>o.msg.timestamp?pt(o.msg.timestamp):"Done"),S=P(()=>o.msg.streaming?a.streamingMessageVisibleContent+'<span class="typing-dots">...</span>':o.msg.content),g=P(()=>(o.hudVersion,o.getToolsForTurn(o.msg.turnCorrId)));return(_,w)=>(l(),X(ht,{role:"assistant",copyContent:t.msg.content},{footer:ce(()=>[i("span",Js,V(f.value),1),!t.msg.streaming&&t.msg.content?(l(),r("button",{key:0,class:K(["tts-btn",{active:y(n).isPlayingMsg(t.msg)}]),onClick:w[0]||(w[0]=ee(h=>y(n).play(t.msg,t.msg._sourceIndex??0),["stop"])),title:"Listen"},[y(n).isPlayingMsg(t.msg)&&y(n).state.value==="loading"?(l(),r("span",Xs)):(l(),X(y(fs),{key:1,class:"w-3.5 h-3.5"}))],2)):U("",!0),t.msg.streaming&&g.value.length===0?(l(),r("span",Qs," ...")):!t.msg.streaming&&g.value.length===0?(l(),r("span",en," | "+V(s.value),1)):U("",!0),g.value.length>0?(l(),r("span",tn,[(l(!0),r(G,null,J(g.value,h=>(l(),r("span",{key:h.id,class:K(["footer-tool-icon",h.state]),title:`${h.label} [${h.state}]`},[W(zs,{tool:h.tool||""},null,8,["tool"])],10,sn))),128))])):U("",!0),t.msg.truncated?(l(),r("span",nn,[W(y(rs),{class:"w-4 h-4 inline"}),w[1]||(w[1]=me(" Output limit reached — response was cut off",-1))])):U("",!0)]),default:ce(()=>[i("div",{innerHTML:y(dt)(S.value)},null,8,Ks)]),_:1},8,["copyContent"]))}}),at=ve(on,[["__scopeId","data-v-a59db10d"]]),an={class:"message-hud"},ln={key:0,class:"headline-container headline-header"},rn={class:"headline-text"},cn={key:1,class:"headline-footer-wrapper"},un={class:"headline-container headline-footer"},dn={class:"headline-text"},gn={key:2,class:"headline-new-session"},fn={class:"new-session-text"},hn={key:3,class:"system-group"},pn={class:"system-group-summary"},mn={key:0,class:"sql-table-wrap"},vn={class:"sql-table"},yn=["title"],wn={key:4,class:"system-group"},_n={class:"system-group-header"},kn={class:"system-group-summary"},Sn=ae({__name:"SystemMessage",props:{msg:{}},setup(t){const a=t,n=H(!1),o=H(null);qt(()=>{oe(()=>{o.value&&(o.value.scrollTop=o.value.scrollHeight)})});function f(g){if(!g)return!1;const w=(g.startsWith("→ ")?g.slice(2):g).split(`
`).filter(h=>h.trim());return w.length<2?!1:w.filter(h=>h.includes(" ")).length>=2}function s(g){const w=(g.startsWith("→ ")?g.slice(2):g).split(`
`).filter(d=>d.trim()),[h,...$]=w,x=h.split(" "),O=$.filter(d=>!d.startsWith("… [")).map(d=>d.split(" "));return{headers:x,rows:O}}function S(){const g=a.msg.messages;if(!g?.length)return"Event";const _=[];for(const $ of g){const O=($.content||"").match(/^[^\w]*(\w+)/u);if(O){const d=O[1];["true","false","null","done","ok"].includes(d.toLowerCase())||_.includes(d)||_.push(d)}}const w=g.length,h=_.length?_.join(" · "):"Event";return w===1?h:`${h} · ${w}`}return(g,_)=>(l(),r("div",an,[t.msg.type==="headline"&&t.msg.headlineKind!=="new-session"&&t.msg.position!=="footer"?(l(),r("div",ln,[_[1]||(_[1]=i("div",{class:"headline-line"},null,-1)),i("div",rn,V(t.msg.content),1),_[2]||(_[2]=i("div",{class:"headline-line"},null,-1))])):t.msg.type==="headline"&&t.msg.headlineKind!=="new-session"&&t.msg.position==="footer"?(l(),r("div",cn,[i("div",un,[_[3]||(_[3]=i("div",{class:"headline-line"},null,-1)),i("div",dn,V(t.msg.content),1),_[4]||(_[4]=i("div",{class:"headline-line"},null,-1))])])):t.msg.type==="headline"&&t.msg.headlineKind==="new-session"?(l(),r("div",gn,[i("span",fn,V(t.msg.content),1)])):t.msg.role==="system_group"||t.msg.messages?(l(),r("div",hn,[i("div",{class:"system-group-header",onClick:_[0]||(_[0]=w=>n.value=!n.value)},[W(y(ct),{class:"system-group-icon-svg"}),i("span",pn,V(S()),1),W(y(Yt),{class:K(["chevron",{open:!n.value}])},null,8,["class"])]),n.value?U("",!0):(l(),r("div",{key:0,class:"system-group-content",ref_key:"groupContentEl",ref:o},[(l(!0),r(G,null,J(t.msg.messages,(w,h)=>(l(),r("div",{key:h,class:"system-item"},[f(w.content)?(l(),r("div",mn,[i("table",vn,[i("thead",null,[i("tr",null,[(l(!0),r(G,null,J(s(w.content).headers,($,x)=>(l(),r("th",{key:x},V($),1))),128))])]),i("tbody",null,[(l(!0),r(G,null,J(s(w.content).rows,($,x)=>(l(),r("tr",{key:x},[(l(!0),r(G,null,J($,(O,d)=>(l(),r("td",{key:d},V(O),1))),128))]))),128))])])])):(l(),r("div",{key:1,class:"system-content raw-text",title:w.content},V(w.content),9,yn))]))),128))],512))])):(l(),r("div",wn,[i("div",_n,[W(y(cs),{class:"system-group-icon-svg"}),i("span",kn,V(t.msg.content),1)])]))]))}}),lt=ve(Sn,[["__scopeId","data-v-6cdcd5f1"]]),bn={class:"hud-controls"},An={class:"btn-group primary"},In=["disabled"],Mn=["disabled"],$n={class:"btn-group secondary"},Tn=["disabled"],Cn=["disabled"],Nn=["disabled"],xn=ae({__name:"HudControls",props:{smState:String,connected:Boolean,isAgentRunning:Boolean,handoverPending:Boolean,isPublic:Boolean},emits:["new","handover","confirm-new","stay"],setup(t){return(a,n)=>(l(),r("div",bn,[i("div",An,[i("button",{class:"control-btn",onClick:n[0]||(n[0]=o=>a.$emit("new")),disabled:!t.connected||t.isAgentRunning||t.handoverPending||t.smState==="NO_SESSION"||t.smState==="RESETTING"},"NEW",8,In),t.isPublic?U("",!0):(l(),r("button",{key:0,class:"control-btn",onClick:n[1]||(n[1]=o=>a.$emit("handover")),disabled:!t.connected||t.isAgentRunning||t.handoverPending||t.smState==="NO_SESSION"||t.smState==="RESETTING"},"HANDOVER",8,Mn))]),i("div",$n,[i("button",{class:"control-btn confirm-btn",onClick:n[2]||(n[2]=o=>a.$emit("confirm-new")),disabled:!t.handoverPending},"YES, NEW",8,Tn),i("button",{class:"control-btn stay-btn",onClick:n[3]||(n[3]=o=>a.$emit("stay")),disabled:!t.handoverPending},"STAY",8,Cn),i("button",{class:"control-btn ns-btn",onClick:n[4]||(n[4]=o=>a.$emit("new")),disabled:t.smState!=="NO_SESSION"},"NEW SESSION",8,Nn)])]))}}),En=ve(xn,[["__scopeId","data-v-89c5a82c"]]),Rn={key:0,class:"agents-view flex flex-col h-full overflow-hidden bg-bg"},Dn={class:"agent-picker"},Hn={class:"agent-picker-content"},Ln={class:"agent-picker-segment-label"},Un=["onClick","title"],Bn={class:"agent-picker-name"},Vn={class:"agent-picker-modes"},Pn=["onClick"],On=["onClick"],Zn={class:"page flex flex-col flex-1 min-h-0"},Gn={class:"chat-frame flex-1 flex flex-col overflow-visible relative"},Fn={class:"content flex-1 min-h-0"},Wn=["disabled"],qn={class:"prev-session-header"},Yn={class:"prev-session-wrapper"},jn={key:0,class:"no-session-center"},zn={key:3,class:"session-context-badge"},Kn={class:"session-context-text"},Jn={key:5,class:"message thinking"},Xn=["open"],Qn={class:"thinking-content"},eo={key:7,class:"sm-status-bar"},to={class:"sm-status-label"},so={key:1,class:"sm-status-bar"},no={class:"sm-status-label"},oo={key:0,class:"mic-denied-hint"},ao={key:1,class:"recording-strip"},lo={class:"rec-level-bar"},io={class:"rec-time"},ro={key:2,class:"attachment-strip"},co={class:"audio-name"},uo=["src","alt"],go=["onClick"],fo=["title"],ho=["disabled","title"],po=["disabled"],mo={key:1,style:{"font-size":"11px"}},vo={key:1,class:"not-logged-in"},yo=50,wo=ae({name:"AgentsView",__name:"AgentsView",setup(t){const a=Qt(),n=ue(),o=P(()=>!a.query.agent);re(()=>a.query.agent,p=>{!p&&a.name},{immediate:!0});const f=H([]),s=H(!1),S=H(!1),g=H(0),_=P(()=>f.value.flatMap(p=>p.messages));async function w(p=!1){if(!(!m.value||S.value)){S.value=!0;try{const u=localStorage.getItem("nyx_session")||localStorage.getItem("titan_token")||"",B=p?g.value:0,v=De(),D=await fetch(`${v}/api/session-history?agent=${m.value}&mode=${I.value}&skip=${B}&count=1`,{headers:{Authorization:`Bearer ${u}`}});if(!D.ok)return;const Z=await D.json(),Q=(Z.sessions||[]).map(ie=>({messages:(ie.entries||[]).map(ge=>({role:ge.role,content:ge.content,timestamp:ge.timestamp,agentId:m.value,streaming:!1})),timestamp:ie.resetTimestamp,timeLabel:ie.resetTimestamp?pt(ie.resetTimestamp):""}));p?f.value=[...Q,...f.value]:f.value=Q,g.value=B+Q.length,s.value=Z.hasMore??!1}catch{}finally{S.value=!1}}}const{connected:h,status:$,send:x,switchAgent:O}=pe,{isLoggedIn:d}=Ae,{selectedAgent:m,selectedMode:I,filteredAgents:E,defaultAgent:C,allAgents:e}=it,T=["personal","common","private","public"],q=P(()=>T.map(p=>({key:p,agents:E.value.filter(u=>(u.segment??"utility")===p).sort((u,B)=>u.name.localeCompare(B.name))})).filter(p=>p.agents.length>0));function Y(p,u){m.value=p,I.value=u,sessionStorage.setItem("agent",p),sessionStorage.setItem("agent_mode",u),es.push({name:"agents",query:{agent:p,mode:u}}),pe.connected.value?pe.switchAgent(p,u):pe.connect(m,Ae.isLoggedIn,Ae.loginError,I)}const{sending:j,input:z,messagesEl:te,scrollToBottom:se,send:de,onInputChange:Ie,restoreLastSent:Me}=Cs(x),ye=H(null),c=he(n,"smState"),k=he(n,"channelState"),M=he(n,"connectionState"),A=he(n,"smLabel"),N=P(()=>M.value!=="SYNCED"),R=P(()=>{const p=F.value,u=p[p.length-1];return u?.position==="footer"?u:null}),b=P(()=>{const p=F.value;for(let u=p.length-1;u>=0;u--)if(p[u].type!=="headline")return u;return-1}),L=H(yo),{groupedVisibleMsgs:F,hasMore:le,loadMore:ne,getFormattedAgentName:He}=Ns(P(()=>n.messages),L,m,e,he(n,"sessionKey")),$e=new Set,Le=H(null),mt=H(!1),{mount:vt,hudVersion:yt,getToolsForTurn:wt,hudSnapshot:_t,toolCallMapSnapshot:kt}=ws(L,Le,mt,$e,Me);typeof window<"u"&&(window.__hudSnapshot=_t,window.__toolCallMap=kt);const Ue=P(()=>a.name==="agents");let Te=!1;const Be=H(0);function Ce(){const p=te.value;return p?(p.$el||p).querySelector("[data-overlayscrollbars-viewport]"):null}function we(){const p=Ce();if(!p)return 0;const u=ye.value||p.querySelector(".msg-controls");if(!u)return 0;const B=p.querySelectorAll(".message.user"),v=B[B.length-1];if(!v)return 0;const D=p.getBoundingClientRect(),Z=p.scrollTop,Q=v.getBoundingClientRect().top-D.top+Z,ie=u.getBoundingClientRect().bottom-D.top+Z,ge=p.clientHeight,Zt=Q-40+ge,qe=Math.max(0,Zt-ie);return Be.value=qe,qe}let Ne=null;je(()=>{Ne=setInterval(we,200),Ee(()=>{Ne&&clearInterval(Ne)})});function St(p=!0){oe(()=>oe(()=>{we(),oe(()=>{const u=Ce();if(!u)return;u.offsetHeight;const B=u.querySelectorAll(".message.user"),v=B[B.length-1];if(!v)return;const D=u.getBoundingClientRect(),Z=v.getBoundingClientRect(),Q=u.scrollTop+(Z.top-D.top)-40;u.scrollTo({top:Math.max(0,Q),behavior:p?"smooth":"instant"})})}))}re(M,p=>{Ue.value&&p==="SYNCED"&&(_.value.length||w(),se())}),re(k,(p,u)=>{Ue.value&&(u==="AGENT_RUNNING"&&(p==="READY"||p==="FRESH")&&(Te=!1),p==="AGENT_RUNNING"&&u!=="AGENT_RUNNING"&&(Te||se()))});function Ve(){const p=z.value.trim(),u=Ge();if(!p&&!u){_e();return}n.truncatedWarning=!1;const B=k.value;if(M.value!=="SYNCED")n.pushSystem("Not connected yet -- please wait.",m.value),_e();else if(B==="READY"||B==="FRESH"){p&&$e.add(p),Te=!0;const D=u?Ct():void 0;de(D),Ze(),St()}else B==="AGENT_RUNNING"?(n.queuedThought=p,z.value="",Ze(),n.pushSystem("Queued -- will send when agent finishes.",m.value)):_e()}function bt(){n.newSession(),se()}function At(){n.confirmNew(),se()}const{inputEl:Pe,isShaking:It,autoGrow:Mt,triggerShake:_e}=xs(z),{isAgentRunning:$t}=Es(m,C,e),{attachments:Oe,addFiles:ke,removeAttachment:Tt,clearAttachments:Ze,toPayload:Ct,hasAttachments:Ge}=Hs(),Fe=H(null),Se=H(!1),{isRecording:be,duration:Nt,audioLevel:xt,micDenied:Et,startRecording:Rt,stopRecording:Dt,cancelRecording:We,formatDuration:Ht}=Ls();async function Lt(){if(be.value){const p=await Dt();p&&ke([p])}else await Rt()}function Ut(p){const u=p.target;u.files?.length&&ke(u.files),u.value=""}function Bt(p){const u=p.clipboardData?.files;if(u?.length){const B=Array.from(u).filter(v=>v.type.startsWith("image/")||v.type.startsWith("audio/"));B.length&&(p.preventDefault(),ke(B))}}function Vt(p){p.dataTransfer?.types.includes("Files")&&(Se.value=!0)}function Pt(){Se.value=!1}function Ot(p){Se.value=!1,p.dataTransfer?.files.length&&ke(p.dataTransfer.files)}return re([m,I],([p,u],[B,v])=>{(p!==B||u!==v)&&(sessionStorage.setItem("agent",p),Le.value=null,$e.clear(),f.value=[],s.value=!1,g.value=0,n.resetLocalSession())}),je(()=>{n.setWsSend(x);const p=vt();M.value==="SYNCED"&&w();const u=Ce();let B=null;u&&(B=new ResizeObserver(()=>we()),B.observe(u)),we(),Ee(()=>{p(),B?.disconnect()})}),(p,u)=>{const B=Xt("RouterLink");return y(d)?(l(),r("div",Rn,[xe(i("div",Dn,[i("div",Hn,[u[11]||(u[11]=i("p",{class:"agent-picker-title"},"Select an agent",-1)),(l(!0),r(G,null,J(q.value,v=>(l(),r("div",{key:v.key,class:"agent-picker-segment"},[i("div",Ln,V(v.key),1),(l(!0),r(G,null,J(v.agents,D=>(l(),r("div",{key:D.id,class:"agent-picker-row"},[i("button",{class:"agent-picker-btn",onClick:Z=>Y(D.id,"private"),title:D.name+" (private)"},[i("span",{class:K(["sidebar-room-dot",`dot-${D.role}`])},null,2),i("span",Bn,V(D.name),1)],8,Un),i("div",Vn,[D.modes?.includes("private")?(l(),r("button",{key:0,class:"agent-picker-mode",onClick:Z=>Y(D.id,"private"),title:"Private"},[W(y(Xe),{class:"w-3.5 h-3.5"})],8,Pn)):U("",!0),D.modes?.includes("public")?(l(),r("button",{key:1,class:"agent-picker-mode",onClick:Z=>Y(D.id,"public"),title:"Public"},[W(y(ps),{class:"w-3.5 h-3.5"})],8,On)):U("",!0)])]))),128))]))),128))])],512),[[ze,o.value]]),xe(i("div",Zn,[i("div",Gn,[i("div",Fn,[W(y(zt),{class:K(["messages h-full pb-4 flex flex-col gap-3 relative",{"is-switching":N.value}]),options:y(jt),ref_key:"messagesEl",ref:te,element:"div"},{default:ce(()=>[f.value.length?(l(),r(G,{key:0},[s.value?(l(),r("button",{key:0,class:"prev-load-more",onClick:u[0]||(u[0]=v=>w(!0)),disabled:S.value},V(S.value?"Loading...":"Load older session"),9,Wn)):U("",!0),(l(!0),r(G,null,J(f.value,(v,D)=>(l(),r(G,{key:"ps-"+D},[i("div",qn," Session "+V(f.value.length-D)+V(v.timeLabel?" — "+v.timeLabel:""),1),i("div",Yn,[(l(!0),r(G,null,J(v.messages,(Z,Q)=>(l(),r(G,{key:"prev-"+D+"-"+Q},[Z.role==="user"?(l(),X(ot,{key:0,msg:Z},null,8,["msg"])):Z.role==="assistant"?(l(),X(at,{key:1,msg:Z,agentDisplayName:y(He)(Z.agentId||y(m)),isAgentRunning:!1,allAgents:y(e),getToolsForTurn:()=>[],hudVersion:0},null,8,["msg","agentDisplayName","allAgents"])):U("",!0)],64))),128))])],64))),128)),u[12]||(u[12]=i("div",{class:"session-divider"},[i("span",{class:"session-divider-text"},"Current session")],-1))],64)):U("",!0),(l(!0),r(G,null,J(y(F),(v,D)=>(l(),r(G,{key:D},[v.type==="no_session"?(l(),r("div",jn,"— NO SESSION —")):U("",!0),v.type!=="no_session"&&(v.role==="system"||v.role==="system_group"||v.type==="headline")&&v.position!=="footer"?(l(),X(lt,{key:1,msg:v},null,8,["msg"])):U("",!0),y(le)&&v.type==="headline"&&v.position!=="footer"&&D===0?(l(),r("button",{key:2,class:"load-more-btn",onClick:u[1]||(u[1]=(...Z)=>y(ne)&&y(ne)(...Z))},"↑ Load previous messages")):v.role==="session_context"?(l(),r("div",zn,[i("span",Kn,V(v.content),1)])):v.role==="user"?(l(),X(ot,{key:4,msg:v},null,8,["msg"])):v.role==="thinking"?(l(),r("div",Jn,[i("details",{open:!v.collapsed},[i("summary",null,[W(y(os),{class:"w-4 h-4 inline"}),u[13]||(u[13]=me(" thinking…",-1))]),i("pre",Qn,V(typeof v.content=="object"?v.content.value:v.content),1)],8,Xn)])):v.role==="assistant"?(l(),X(at,{key:6,msg:v,agentDisplayName:y(He)(v.agentId),isAgentRunning:y($t),allAgents:y(e),getToolsForTurn:y(wt),hudVersion:y(yt)},null,8,["msg","agentDisplayName","isAgentRunning","allAgents","getToolsForTurn","hudVersion"])):U("",!0),D===b.value?(l(),r("div",eo,[i("div",{class:K(["sm-dot",c.value])},null,2),i("span",to,V(A.value),1)])):U("",!0)],64))),128)),b.value===-1?(l(),r("div",so,[i("div",{class:K(["sm-dot",c.value])},null,2),i("span",no,V(A.value),1)])):U("",!0),R.value?(l(),X(lt,{key:2,msg:R.value},null,8,["msg"])):U("",!0),i("div",{class:"msg-controls",ref_key:"controlsEl",ref:ye},[W(En,{smState:c.value,connected:y(h),isAgentRunning:y(n).isRunning,handoverPending:y(n).handoverPending,isPublic:y(I)==="public",onNew:bt,onHandover:u[2]||(u[2]=v=>y(n).handover()),onConfirmNew:At,onStay:u[3]||(u[3]=v=>y(n).stay())},null,8,["smState","connected","isAgentRunning","handoverPending","isPublic"])],512),i("div",{class:"scroll-spacer",style:Ke({height:Be.value+"px",flexShrink:0})},null,4)]),_:1},8,["class","options"])]),i("div",{class:"input-area",onDragover:ee(Vt,["prevent"]),onDragleave:ee(Pt,["prevent"]),onDrop:ee(Ot,["prevent"])},[y(Et)?(l(),r("div",oo,"Mic access denied — enable in browser settings")):U("",!0),y(be)?(l(),r("div",ao,[u[14]||(u[14]=i("span",{class:"rec-dot"},null,-1)),i("div",lo,[i("div",{class:"rec-level-fill",style:Ke({width:y(xt)*100+"%"})},null,4)]),i("span",io,V(y(Ht)(y(Nt))),1),i("button",{class:"rec-cancel",onClick:u[4]||(u[4]=ee((...v)=>y(We)&&y(We)(...v),["stop"])),title:"Cancel"},"×")])):U("",!0),y(Oe).length?(l(),r("div",ro,[(l(!0),r(G,null,J(y(Oe),(v,D)=>(l(),r("div",{key:D,class:K(["attachment-thumb",{"audio-thumb":v.mimeType.startsWith("audio/")}])},[v.mimeType.startsWith("audio/")?(l(),r(G,{key:0},[u[15]||(u[15]=i("span",{class:"audio-icon"},"♫",-1)),i("span",co,V(v.fileName),1)],64)):(l(),r("img",{key:1,src:v.preview,alt:v.fileName},null,8,uo)),i("button",{class:"remove-att",onClick:ee(Z=>y(Tt)(D),["stop"])},"×",8,go)],2))),128))])):U("",!0),i("div",{class:K(["input-box",{"drag-over":Se.value}]),onClick:u[10]||(u[10]=v=>y(Pe)?.focus())},[i("button",{class:"attach-btn",onClick:u[5]||(u[5]=ee(v=>Fe.value?.click(),["stop"])),title:"Attach file"},[W(y(ds),{class:"w-4 h-4"})]),i("button",{class:K(["mic-btn",{recording:y(be)}]),onClick:ee(Lt,["stop"]),title:y(be)?"Stop recording":"Record audio"},[W(y(us),{class:"w-4 h-4"})],10,fo),i("input",{type:"file",ref_key:"fileInputEl",ref:Fe,class:"hidden",accept:"image/jpeg,image/png,image/gif,image/webp,application/pdf,audio/webm,audio/mp4,audio/ogg,audio/mpeg,audio/wav",multiple:"",onChange:Ut},null,544),xe(i("textarea",{ref_key:"inputEl",ref:Pe,"onUpdate:modelValue":u[6]||(u[6]=v=>Kt(z)?z.value=v:null),onKeydown:u[7]||(u[7]=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),Ve())}),onInput:u[8]||(u[8]=v=>{y(Mt)(),y(Ie)()}),onPaste:Bt,placeholder:"Message...",rows:"1",class:K(["chat-input",{shake:y(It)}])},null,34),[[Jt,y(z)]]),c.value==="AGENT_RUNNING"||c.value==="STOP_PENDING"?(l(),r("button",{key:0,class:"stop-btn",disabled:c.value==="STOP_PENDING",onClick:u[9]||(u[9]=v=>y(n).stop()),title:c.value==="STOP_PENDING"?"Stopping...":"Stop"},[W(y(hs),{class:"w-3.5 h-3.5"})],8,ho)):U("",!0),i("button",{class:"send-btn",onClick:Ve,disabled:!y(h)||y(j)||!y(z).trim()&&!y(Ge)()},[y(j)?(l(),r("span",mo,"…")):(l(),X(y(ss),{key:0,class:"w-4 h-4"}))],8,po)],2)],32)])],512),[[ze,!o.value]])])):(l(),r("div",vo,[i("p",null,[W(y(Xe),{class:"w-5 h-5 inline"}),u[16]||(u[16]=me(" Not logged in",-1))]),W(B,{to:"/login"},{default:ce(()=>[...u[17]||(u[17]=[me("Sign in →",-1)])]),_:1})]))}}}),bo=ve(wo,[["__scopeId","data-v-0fa961e5"]]);export{bo as default};