@adhdev/daemon-standalone 0.9.77-rc.57 → 0.9.77-rc.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-standalone",
3
- "version": "0.9.77-rc.57",
3
+ "version": "0.9.77-rc.59",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-Cn_eJIrc.js","assets/vendor-BoAU5RMW.js","assets/terminal-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-DeDH5nlv.js","assets/vendor-BoAU5RMW.js","assets/terminal-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
2
  var jf=Object.defineProperty;var Nf=(e,t,r)=>t in e?jf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ee=(e,t,r)=>Nf(e,typeof t!="symbol"?t+"":t,r);import{r as c,j as s,M as Ro,a as Cf,b as Tf,c as If,R as Et,d as hn,t as Af,e as Mf,u as Nr,D as _f,f as Yi,g as Ji,h as Po,i as Rf,k as Pf,l as Lf,B as Ef,m as Df,n as ps,N as Qi,o as $f}from"./vendor-BoAU5RMW.js";import*as ze from"path";import{join as ks}from"path";import{mkdir as Bf,realpath as Hc,stat as Of,access as Ff}from"fs/promises";import*as Dt from"fs";import{existsSync as Ot,mkdirSync as Lo,readFileSync as Ma,writeFileSync as _a,chmodSync as Wf,statSync as Uf,appendFileSync as Td,renameSync as Kf,constants as Hf}from"fs";import{execFile as Id,execSync as zf,exec as Vf}from"child_process";import{promisify as Ad}from"util";import*as vt from"os";import{homedir as Gf}from"os";import{randomUUID as yn}from"crypto";import{EventEmitter as qf}from"events";import"net";import"http";import"module";import"stream";import"chokidar";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();function Xf(e={}){const t=Math.max(1,Math.floor(e.capacity||200)),r=[];return{record(n){const a={id:`webdbg_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,ts:Date.now(),...n,payload:n.payload?{...n.payload}:{}};return r.push(a),r.length>t&&r.splice(0,r.length-t),a},list(n={}){const a=Math.max(1,Math.floor(n.limit||100));return r.filter(i=>!n.interactionId||i.interactionId===n.interactionId).filter(i=>!n.topic||i.topic===n.topic).filter(i=>!n.kind||i.kind===n.kind).slice(-a).map(i=>({...i,payload:i.payload?{...i.payload}:{}}))},clear(){r.splice(0,r.length)}}}const pr=Xf();function zc(e){const t={};for(const r of e)r.transport&&(t[r.transport]=(t[r.transport]||0)+1);return{count:e.length,ids:e.map(r=>r.id),statuses:e.map(r=>String(r.status||"unknown")),transports:t}}function Yf(e,t){return typeof e=="string"&&e.trim().length>0&&e!==t}function Md(e,t){if(!e)return t??null;if(!t)return e??null;const r=Object.prototype.hasOwnProperty.call(e,"messages"),n=Object.prototype.hasOwnProperty.call(e,"activeModal");return{...t,...e,messages:r?e.messages??[]:t.messages,activeModal:n?e.activeModal??null:t.activeModal,inputContent:e.inputContent??t.inputContent}}function qr(e,t){const r=Yf(e.providerName,e.providerType)?e.providerName:void 0;return{...e,parentId:e.parentId??(t==null?void 0:t.parentSessionId)??null,providerSessionId:e.providerSessionId??(t==null?void 0:t.providerSessionId),providerName:r??(t==null?void 0:t.providerName)??(t==null?void 0:t.cliName)??(t==null?void 0:t.type)??e.providerName??e.providerType,title:e.title??(t==null?void 0:t.title)??r??(t==null?void 0:t.providerName)??e.providerName??e.providerType,workspace:e.workspace??(t==null?void 0:t.workspace)??null,mode:e.mode??(t==null?void 0:t.mode),capabilities:e.capabilities??(t==null?void 0:t.sessionCapabilities)??(t==null?void 0:t.capabilities)??[],cdpConnected:e.cdpConnected??(t==null?void 0:t.cdpConnected),activeChat:Md(e.activeChat,t==null?void 0:t.activeChat),controlValues:e.controlValues??(t==null?void 0:t.controlValues),providerControls:e.providerControls??(t==null?void 0:t.providerControls),summaryMetadata:e.summaryMetadata??(t==null?void 0:t.summaryMetadata),runtimeWriteOwner:e.runtimeWriteOwner??(t==null?void 0:t.runtimeWriteOwner),runtimeAttachedClients:e.runtimeAttachedClients??(t==null?void 0:t.runtimeAttachedClients),lastMessagePreview:e.lastMessagePreview??(t==null?void 0:t.lastMessagePreview),lastMessageRole:e.lastMessageRole??(t==null?void 0:t.lastMessageRole),lastMessageAt:e.lastMessageAt??(t==null?void 0:t.lastMessageAt),lastMessageHash:e.lastMessageHash??(t==null?void 0:t.lastMessageHash),unread:e.unread??(t==null?void 0:t.unread),lastSeenAt:e.lastSeenAt??(t==null?void 0:t.lastSeenAt),inboxBucket:e.inboxBucket??(t==null?void 0:t.inboxBucket),completionMarker:e.completionMarker??(t==null?void 0:t.completionMarker),seenCompletionMarker:e.seenCompletionMarker??(t==null?void 0:t.seenCompletionMarker),surfaceHidden:e.surfaceHidden??(t==null?void 0:t.surfaceHidden),resume:e.resume??(t==null?void 0:t.resume),runtimeKey:e.runtimeKey??(t==null?void 0:t.runtimeKey),runtimeDisplayName:e.runtimeDisplayName??(t==null?void 0:t.runtimeDisplayName),runtimeWorkspaceLabel:e.runtimeWorkspaceLabel??(t==null?void 0:t.runtimeWorkspaceLabel),settings:e.settings??(t==null?void 0:t.settings)}}function _d(e,t,r){if(!(t!=null&&t.length))return(r==null?void 0:r.preserveMissing)===!1&&Array.isArray(t)?t:e;if(!(e!=null&&e.length))return t;const n=t.map(a=>{const i=e.find(o=>o.id===a.id);return i?qr(a,i):a});if((r==null?void 0:r.preserveMissing)!==!1){const a=new Set(t.map(i=>i.id));for(const i of e)a.has(i.id)||n.push(i)}return n}function Vc(e){return!!e&&typeof e=="object"&&"text"in e}function Eo(e,t){const r=(t==null?void 0:t.joiner)??" ",n=(t==null?void 0:t.normalizeWhitespace)??!1;let a="";return typeof e=="string"?a=e:Array.isArray(e)?a=e.map(i=>typeof i=="string"?i:Vc(i)?String(i.text||""):"").join(r):Vc(e)?a=String(e.text||""):a=String(e||""),n?a.replace(/\s+/g," ").trim():a}function fr(e){return Eo(e,{normalizeWhitespace:!0})}const Rd=c.createContext({ides:[],updateRouteChats:()=>{},initialLoaded:!1,toasts:[],setToasts:()=>{},wsStatus:"connected",isConnected:!0,connectionStates:{},connectionTransports:{},showReconnected:!1,userName:void 0,setUserName:()=>{},isP2PActive:!1,p2pStates:{},userRole:void 0,connectionRetryStatuses:void 0}),Pd=c.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function Gc(e){var r,n;let t=0;return e.activeChat!==void 0&&(t+=4),(r=e.childSessions)!=null&&r.length&&(t+=2),e.workspace&&(t+=1),e.machine&&(t+=1),(n=e.agents)!=null&&n.length&&(t+=1),t}function Ld(e,t,r){if(r.type!=="adhdev-daemon")return r;const n={...r},a=t.version??r.version??e.version,i=t.serverVersion??e.serverVersion??r.serverVersion,o=t.versionMismatch===!0||e.versionMismatch===!0,l=t.versionUpdateRequired===!0||e.versionUpdateRequired===!0,d=t.versionUpdateReason??e.versionUpdateReason??r.versionUpdateReason;return a&&(n.version=a),i&&(n.serverVersion=i),d&&(n.versionUpdateReason=d),a&&i&&a===i?(delete n.versionMismatch,delete n.serverVersion,delete n.versionUpdateRequired,delete n.versionUpdateReason,n):((t.versionMismatch===!0||o&&a&&i&&a!==i)&&(n.versionMismatch=!0),l&&(n.versionUpdateRequired=!0),n)}function Jf(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}function ei(e){if(!e||typeof e!="object")return"";const t=e,r=Jf(fr(t.content).slice(0,512));return[String(t.id||""),String(t._localId||""),String(t._turnKey||""),String(t.index??""),String(t.role||""),String(t.receivedAt??t.timestamp??""),r].join(":")}function Qf(e,t){if(!Array.isArray(e))return e;if(t!=null&&t.has(e))return{count:e.length,sharedRef:!0};let r=2166136261;for(const n of e){const a=ei(n);for(let i=0;i<a.length;i+=1)r^=a.charCodeAt(i),r=Math.imul(r,16777619)>>>0}return{count:e.length,hash:r.toString(16).padStart(8,"0"),first:ei(e[0]),last:ei(e[e.length-1])}}function Zi(e){return!!e&&typeof e=="object"&&"messages"in e&&("activeModal"in e||"inputContent"in e||"status"in e)}function eo(e,t,r){if(!e||!t||typeof e!="object"||typeof t!="object")return;if(Zi(e)&&Zi(t)){const o=e.messages;Array.isArray(o)&&o===t.messages&&r.add(o)}if(Array.isArray(e)&&Array.isArray(t)){const o=Math.min(e.length,t.length);for(let l=0;l<o;l+=1)eo(e[l],t[l],r);return}const n=e,a=t,i=new Set([...Object.keys(n),...Object.keys(a)]);for(const o of i)o!=="messages"&&eo(n[o],a[o],r)}function en(e,t){return Array.isArray(e)?e.map(r=>en(r,t)):!e||typeof e!="object"?e:Zi(e)?Object.fromEntries(Object.entries(e).filter(([n])=>n!=="timestamp"&&n!=="_lastUpdate").sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>[n,n==="messages"?Qf(a,t):en(a,t)])):Object.fromEntries(Object.entries(e).filter(([r])=>r!=="timestamp"&&r!=="_lastUpdate").sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>[r,en(n,t)]))}function Zf(e,t){try{const r=new WeakSet;return eo(e,t,r),JSON.stringify(en(e,r))===JSON.stringify(en(t,r))}catch{return!1}}function to(e,t,r){return Zf(e,t)?(e._lastUpdate=r,typeof t.timestamp=="number"&&(e.timestamp=t.timestamp),e):t}function Ed(e){var t;return e.daemonId||((t=e.id)==null?void 0:t.split(":")[0])||e.id}function em(e,t,r){t[r]!==void 0&&(e[r]=t[r])}function qc(e,t,r,n){var l;const a=(l=t.chats)!=null&&l.length?t.chats:e.chats,i=_d(e.childSessions,t.childSessions,{preserveMissing:n}),o=Md(t.activeChat,e.activeChat);return Ld(e,t,{...e,...t,chats:a,childSessions:i,activeChat:o,_lastUpdate:r})}function tm(e,t,r){var a,i;const n={};t.status&&t.status!==e.status&&(n.status=t.status),t.cdpConnected!==void 0&&(n.cdpConnected=t.cdpConnected),t.childSessions!==void 0&&(n.childSessions=_d(e.childSessions,t.childSessions,{preserveMissing:r})),(a=t.chats)!=null&&a.length&&!((i=e.chats)!=null&&i.length)&&(n.chats=t.chats);for(const o of["title","workspace","providerSessionId","parentSessionId","sessionKind","sessionCapabilities","controlValues","providerControls","summaryMetadata","lastMessagePreview","lastMessageRole","lastMessageAt","lastMessageHash","lastUpdated","unread","lastSeenAt","inboxBucket","completionMarker","seenCompletionMarker","surfaceHidden","runtimeKey","runtimeDisplayName","runtimeWorkspaceLabel","runtimeWriteOwner","runtimeAttachedClients","version","serverVersion","versionUpdateReason","versionUpdateRequired","updateCommand","updatePolicy","updateChannel","releaseChannel"])em(n,t,o);return t.machineNickname!==void 0&&t.machineNickname!==e.machineNickname&&(n.machineNickname=t.machineNickname),t.versionMismatch===!0&&(n.versionMismatch=!0),n}function sm(e,t,r,n){const a=tm(e,t,n),i=Object.keys(a).length>0?Ld(e,t,{...e,...a,_lastUpdate:r}):{...e,_lastUpdate:r};return to(e,i,r)}function rm(e){const t=new Set(e.map(i=>i.id)),r=new Set,n=new Set,a=new Set;for(const i of e){const o=Ed(i);o&&r.add(o),o&&i.type!=="adhdev-daemon"&&n.add(o),o&&i.type==="adhdev-daemon"&&i._sessionListAuthoritative&&a.add(o)}return{incomingIds:t,incomingDaemonIds:r,daemonIdsWithSessionEntries:n,daemonIdsWithAuthoritativeSessionList:a}}function nm(e,t,r,n,a,i){return!a.has(t)||!i.has(t)||n.has(e.id)?!1:e.transport==="pty"||e.transport==="acp"?r>1e4:e.transport==="cdp-page"?r>3e4:!1}function am(e,t,r,n,a){return e.transport?r.has(t)&&!n.has(t)?!0:a.has(t):!1}function im(e,t,r){var h,f;const n=Date.now(),a=new Set((r==null?void 0:r.authoritativeDaemonIds)||[]);if(t.length===0)return e.map(m=>({...m,_lastUpdate:n}));const i=new Map;for(const m of t)i.set(m.id,m);const{incomingIds:o,incomingDaemonIds:l,daemonIdsWithSessionEntries:d,daemonIdsWithAuthoritativeSessionList:u}=rm(e);for(const m of e){const v=i.get(m.id);if(!v){i.set(m.id,{...m,_lastUpdate:n});continue}const b=Gc(m),p=Gc(v),g=Ed(m),y=!a.has(g);if(b>p){const j=qc(v,m,n,y);i.set(m.id,to(v,j,n));continue}if(b<p){i.set(m.id,sm(v,m,n,y));continue}const x=m.timestamp||n,N=v._lastUpdate||v.timestamp||0;if(x>=N){const j=qc(v,m,n,y);i.set(m.id,to(v,j,n));continue}(h=m.chats)!=null&&h.length&&!((f=v.chats)!=null&&f.length)&&i.set(m.id,{...v,chats:m.chats})}for(const[m,v]of i){const b=v.daemonId||m.split(":")[0];if(!l.has(b))continue;if(a.has(b)&&u.has(b)&&!o.has(m)){i.delete(m);continue}const p=n-(v._lastUpdate||v.timestamp||0);nm(v,b,p,o,a,d)&&i.delete(m)}for(const[m,v]of i){const b=v.daemonId||m.split(":")[0];if(am(v,b,l,d,i))continue;n-(v._lastUpdate||v.timestamp||0)>3e5&&v.status!=="online"&&i.delete(m)}return Array.from(i.values())}function om(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r]!==t[r])return!1;return!0}function cm({children:e,connectionOverrides:t}){const[r,n]=c.useState([]),[a,i]=c.useState(!1),[o,l]=c.useState([]),[d,u]=c.useState(void 0),h=c.useRef(r);c.useEffect(()=>{h.current=r},[r]);const f=c.useCallback((y,x)=>{n(N=>{let j=!1;const w=N.map(A=>A.id!==y||A.chats===x?A:(j=!0,{...A,chats:x}));return j?w:N})},[]),m=c.useCallback((y,x)=>{n(N=>{const j=N.length===0?y:im(y,N,x),w=!om(N,j);return w&&pr.record({kind:"dashboard.entries_applied",payload:{incoming:zc(y),next:zc(j)}}),w?j:N})},[]),v=c.useCallback(()=>i(!0),[]),b=c.useMemo(()=>({injectEntries:m,markLoaded:v,getIdes:()=>h.current}),[m,v]),p=t,g=c.useMemo(()=>({ides:r,updateRouteChats:f,initialLoaded:a,toasts:o,setToasts:l,wsStatus:(p==null?void 0:p.wsStatus)??"connected",isConnected:(p==null?void 0:p.isConnected)??!0,connectionStates:(p==null?void 0:p.connectionStates)??{},connectionTransports:(p==null?void 0:p.connectionTransports)??{},showReconnected:(p==null?void 0:p.showReconnected)??!1,retryConnection:p==null?void 0:p.retryConnection,retryServerConnection:p==null?void 0:p.retryServerConnection,connectionLoginUrl:p==null?void 0:p.connectionLoginUrl,isP2PActive:(p==null?void 0:p.isP2PActive)??!1,p2pStates:(p==null?void 0:p.p2pStates)??{},userRole:p==null?void 0:p.userRole,connectionRetryStatuses:p==null?void 0:p.connectionRetryStatuses,userName:d,setUserName:u}),[r,f,a,o,p==null?void 0:p.wsStatus,p==null?void 0:p.isConnected,p==null?void 0:p.connectionStates,p==null?void 0:p.connectionTransports,p==null?void 0:p.showReconnected,p==null?void 0:p.retryConnection,p==null?void 0:p.retryServerConnection,p==null?void 0:p.connectionLoginUrl,p==null?void 0:p.isP2PActive,p==null?void 0:p.p2pStates,p==null?void 0:p.userRole,p==null?void 0:p.connectionRetryStatuses,d]);return s.jsx(Pd.Provider,{value:b,children:s.jsx(Rd.Provider,{value:g,children:e})})}function Ss(){return c.useContext(Rd)}function pn(){return c.useContext(Pd)}function Dd(e){const{baseUrl:t,getToken:r,onUnauthorized:n}=e;function a(l){return l.startsWith("http")?l:`${t}${l.startsWith("/")?"":"/"}${l}`}function i(l){const d=r==null?void 0:r(),u=a(l),h=l.startsWith("http")?new URL(u):new URL(u,typeof window<"u"?window.location.origin:"http://localhost");return d&&h.searchParams.set("token",d),!l.startsWith("http")&&!t?`${h.pathname}${h.search}${h.hash}`:h.toString()}async function o(l,d={}){const u={"Content-Type":"application/json",...d.headers||{}},h=r==null?void 0:r();h&&(u.Authorization=`Bearer ${h}`);const f=a(l),m=new AbortController,v=setTimeout(()=>m.abort(),15e3);try{const b=await fetch(f,{...d,headers:u,signal:m.signal});if(b.status===401)throw n==null||n(),new Error("Unauthorized");if(!b.ok){const p=await b.json().catch(()=>({error:b.statusText}));throw new Error(p.error||`API Error: ${b.status}`)}return b.json()}finally{clearTimeout(v)}}return{getDaemons:()=>o("/api/v1/daemons"),getDaemonStatus:l=>o(`/api/v1/daemons/${l}/status`),sendCommand:(l,d,u={})=>o(`/api/v1/daemons/${l}/command`,{method:"POST",body:JSON.stringify({type:d,payload:u})}),execTerminal:(l,d,u)=>o(`/api/v1/daemons/${l}/terminal`,{method:"POST",body:JSON.stringify({command:d,name:u})}),sendAgentMessage:(l,d,u)=>o(`/api/v1/shortcuts/${l}/chat`,{method:"POST",body:JSON.stringify({agentType:d,message:u})}),getAgentStatus:l=>o(`/api/v1/shortcuts/${l}/status`),approveAgent:(l,d,u)=>o(`/api/v1/shortcuts/${l}/approve`,{method:"POST",body:JSON.stringify({agentType:d,action:u?"approve":"reject"})}),getMuxState:l=>o(`/api/v1/mux/${encodeURIComponent(l)}/state`),getMuxSocketInfo:l=>o(`/api/v1/mux/${encodeURIComponent(l)}/socket-info`),controlMux:(l,d,u={})=>o(`/api/v1/mux/${encodeURIComponent(l)}/control`,{method:"POST",body:JSON.stringify({type:d,payload:u})}),getMuxEventsUrl:l=>i(`/api/v1/mux/${encodeURIComponent(l)}/events`),getRuntimeEventsUrl:l=>i(`/api/v1/runtime/${encodeURIComponent(l)}/events`),request:o}}const lm=Dd({baseUrl:"http://localhost:3847"}),dm=c.createContext(lm);function um({client:e,children:t}){return s.jsx(dm.Provider,{value:e,children:t})}const hm={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},$d=c.createContext(hm);function pm({value:e,children:t}){return s.jsx($d.Provider,{value:e,children:t})}function Ct(){return c.useContext($d)}function fm(e){let t=2166136261;for(const r of e){const n=String(r||"");for(let a=0;a<n.length;a+=1)t^=n.charCodeAt(a),t=Math.imul(t,16777619)>>>0;t^=255,t=Math.imul(t,16777619)>>>0}return t.toString(16).padStart(8,"0")}function mm(e){try{return JSON.stringify(e??"")}catch{return String(e??"")}}function xm(e){return e?fm([String(e.id||""),String(e.index??""),String(e.role||""),String(e.receivedAt??e.timestamp??""),mm(e.content)]):""}const He={size:18};function Bd({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),s.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),s.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),s.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}function Do({size:e=He.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("polyline",{points:"15 18 9 12 15 6"})})}function ys({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2"}),s.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2"}),s.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"6",cy:"18",r:"1",fill:"currentColor",stroke:"none"}),s.jsx("line",{x1:"10",y1:"6",x2:"18",y2:"6"}),s.jsx("line",{x1:"10",y1:"18",x2:"18",y2:"18"})]})}function Od({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"9",cy:"7",r:"4"}),s.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),s.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}function gm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}function bm({size:e=He.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})})}function Fd({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"}),s.jsx("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"}),s.jsx("line",{x1:"9",y1:"7",x2:"16",y2:"7"}),s.jsx("line",{x1:"9",y1:"11",x2:"14",y2:"11"})]})}function ym({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),s.jsx("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"}),s.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),s.jsx("line",{x1:"8",y1:"14",x2:"14",y2:"14"}),s.jsx("line",{x1:"8",y1:"18",x2:"12",y2:"18"})]})}function Ra({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function Wd({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),s.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}function vm({size:e=He.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})})}function cs({size:e=He.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function Bt({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),s.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),s.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function $o({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),s.jsx("line",{x1:"8",y1:"17",x2:"13",y2:"17"})]})}function wm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"11",cy:"11",r:"8"}),s.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function zs({size:e=He.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function vn({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("polyline",{points:"23 4 23 10 17 10"}),s.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]})}function fn({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}function mr({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M12 22v-5"}),s.jsx("path",{d:"M9 8V2"}),s.jsx("path",{d:"M15 8V2"}),s.jsx("path",{d:"M18 8v5a6 6 0 0 1-12 0V8z"})]})}function Rn({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"5",r:"2"}),s.jsx("circle",{cx:"5",cy:"19",r:"2"}),s.jsx("circle",{cx:"19",cy:"19",r:"2"}),s.jsx("line",{x1:"12",y1:"7",x2:"5",y2:"17"}),s.jsx("line",{x1:"12",y1:"7",x2:"19",y2:"17"}),s.jsx("line",{x1:"5",y1:"19",x2:"19",y2:"19"})]})}function Sm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("polygon",{points:"12 2 2 7 12 12 22 7 12 2"}),s.jsx("polyline",{points:"2 12 12 17 22 12"}),s.jsx("polyline",{points:"2 17 12 22 22 17"})]})}function Ud({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Bo({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M17.94 17.94A10.94 10.94 0 0 1 12 20C5 20 1 12 1 12a21.8 21.8 0 0 1 5.06-5.94"}),s.jsx("path",{d:"M9.9 4.24A10.93 10.93 0 0 1 12 4c7 0 11 8 11 8a21.77 21.77 0 0 1-2.16 3.19"}),s.jsx("path",{d:"M14.12 14.12a3 3 0 1 1-4.24-4.24"}),s.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}function Kd({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function km({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),s.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),s.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})}function Oo({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("polyline",{points:"4 17 10 11 4 5"}),s.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function jm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"})]})}function Fo({size:e=He.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}function Hd({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function It({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Nm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),s.jsx("path",{d:"M12 15l-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),s.jsx("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),s.jsx("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]})}function Cm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"3",y:"8",width:"18",height:"12",rx:"2"}),s.jsx("path",{d:"M12 2v6"}),s.jsx("circle",{cx:"8.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"15.5",cy:"14",r:"1.5",fill:"currentColor",stroke:"none"})]})}function Tm({size:e=He.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"})})}function Im({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"9",y:"10",width:"6",height:"12",rx:"1"}),s.jsx("path",{d:"M12 2c-1.5 2-3 3.5-3 5a3 3 0 0 0 6 0c0-1.5-1.5-3-3-5z"})]})}function Pa({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),s.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]})}function Am({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("circle",{cx:"12",cy:"12",r:"5"}),s.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),s.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),s.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),s.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),s.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),s.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),s.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),s.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})}function Mm({size:e=He.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function _m({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),s.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),s.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function Rm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),s.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]})}function Pm({size:e=He.size,className:t}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:s.jsx("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})})}function Lm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),s.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"})]})}function Em({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("path",{d:"M14.5 10c-.83 0-1.5-.89-1.5-2s.67-2 1.5-2 1.5.89 1.5 2-.67 2-1.5 2z"}),s.jsx("path",{d:"M9.5 10c-.83 0-1.5-.89-1.5-2s.67-2 1.5-2 1.5.89 1.5 2-.67 2-1.5 2z"}),s.jsx("path",{d:"M19.35 6.07A16.03 16.03 0 0 0 15 4a.84.84 0 0 0-.46.33 11 11 0 0 0-.74 1.5 15.68 15.68 0 0 0-3.6 0 11.23 11.23 0 0 0-.74-1.5A.84.84 0 0 0 9 4a16.03 16.03 0 0 0-4.35 2.07A16.8 16.8 0 0 0 2 15a16.22 16.22 0 0 0 4 3c.12.08.27.06.37-.04a11.14 11.14 0 0 0 1.2-1.92.35.35 0 0 0-.18-.46 10.4 10.4 0 0 1-1.63-.78.36.36 0 0 1 .03-.6 6.8 6.8 0 0 0 .32-.24.36.36 0 0 1 .37-.04c2.2.98 4.6.98 6.8 0a.36.36 0 0 1 .37.04c.1.08.21.16.32.24a.36.36 0 0 1 .03.6 10.4 10.4 0 0 1-1.63.78.35.35 0 0 0-.18.46c.39.67.8 1.3 1.2 1.92a.37.37 0 0 0 .37.04 16.22 16.22 0 0 0 4-3 16.8 16.8 0 0 0-2.65-8.93z"})]})}function Dm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"7",width:"15",height:"14",rx:"2"}),s.jsx("path",{d:"M13 2h9v9"}),s.jsx("path",{d:"M22 2L13 11"})]})}function $m({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("polyline",{points:"9 14 4 9 9 4"}),s.jsx("path",{d:"M20 20v-7a4 4 0 0 0-4-4H4"})]})}function Bm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),s.jsx("line",{x1:"6",y1:"8",x2:"6.01",y2:"8"}),s.jsx("line",{x1:"10",y1:"8",x2:"10.01",y2:"8"}),s.jsx("line",{x1:"14",y1:"8",x2:"14.01",y2:"8"}),s.jsx("line",{x1:"18",y1:"8",x2:"18.01",y2:"8"}),s.jsx("line",{x1:"6",y1:"12",x2:"6.01",y2:"12"}),s.jsx("line",{x1:"10",y1:"12",x2:"10.01",y2:"12"}),s.jsx("line",{x1:"14",y1:"12",x2:"14.01",y2:"12"}),s.jsx("line",{x1:"18",y1:"12",x2:"18.01",y2:"12"}),s.jsx("line",{x1:"7",y1:"16",x2:"17",y2:"16"})]})}function Om({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"2",y:"6",width:"13",height:"13",rx:"2"}),s.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2"})]})}function Fm({size:e=He.size,className:t}){return s.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),s.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"}),s.jsx("line",{x1:"3",y1:"12",x2:"12",y2:"12"})]})}const Wo="adhdev_chat_activity_visible",Xc=new Set(["hidden","debug","internal"]),Yc=new Set(["visible","user","chat"]),Wm=new Set(["debug","trace","internal"]),Um=new Set(["tool_call","terminal_command","runtime_activity"]),Km=new Set(["runtime_status","provider_chrome","control"]),Hm=new Set(["thought","tool","terminal"]);function zd(e){const t=e.meta;return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function er(e){return typeof e=="string"?e.trim().toLowerCase():""}function ti(e,t,r){return e[r]??(t==null?void 0:t[r])}function Jc(e,t,r){const n=e;return r.some(a=>n[a]===!0||(t==null?void 0:t[a])===!0)}function zm(e,t){const r=er(e.kind);return r||(t==="tool"?"tool":"standard")}function si(e,t,r){const n=zd(e),a=typeof(n==null?void 0:n.label)=="string"?n.label.trim():"";return a||(t==="terminal"||r==="terminal_command"?"Terminal":t==="tool"||r==="tool_call"?"Tool":t==="thought"?"Thought":r==="runtime_activity"?"Runtime":"Activity")}function Vm(e){const t=e.content;return Array.isArray(t)&&t.some(r=>!!r&&typeof r=="object"&&r.type!=="text")}function Uo(e){if(!e)return{surface:"internal",isUserFacing:!1,isActivityFacing:!1,isInternal:!0,role:"",kind:"standard",label:"Internal"};const t=zd(e),r=er(e.role),n=zm(e,r),a=er(ti(e,t,"visibility")),i=er(e.transcriptVisibility??(t==null?void 0:t.transcriptVisibility)??a),o=er(ti(e,t,"audience")),l=er(ti(e,t,"source")),d=Xc.has(a)||Xc.has(i)||Wm.has(o)||Jc(e,t,["internal","isInternal","debug","statusOnly","controlOnly"]),u=Yc.has(a)||Yc.has(i)||o==="chat"||Jc(e,t,["userFacing"]),h=Hm.has(n)||Um.has(l);if(d)return{surface:h?"activity":"internal",isUserFacing:!1,isActivityFacing:h,isInternal:!h,role:r,kind:n,label:si(e,n,l)};if(u)return{surface:"chat",isUserFacing:!0,isActivityFacing:!1,isInternal:!1,role:r,kind:n,label:si(e,n,l)};if((r==="system"||n==="system")&&Vm(e))return{surface:"chat",isUserFacing:!0,isActivityFacing:!1,isInternal:!1,role:r,kind:n,label:"Chat"};if(Km.has(l)||r==="system"||n==="system")return{surface:"internal",isUserFacing:!1,isActivityFacing:!1,isInternal:!0,role:r,kind:n,label:"Internal"};if(h)return{surface:"activity",isUserFacing:!1,isActivityFacing:!0,isInternal:!1,role:r,kind:n,label:si(e,n,l)};const f=(r==="user"||r==="human"||r==="assistant")&&(n==="standard"||n==="");return{surface:f?"chat":"internal",isUserFacing:f,isActivityFacing:!1,isInternal:!f,role:r,kind:n,label:f?"Chat":"Internal"}}function Gm(e){return(Array.isArray(e)?e:[]).filter(t=>Uo(t).isUserFacing)}function Vd(e){return(Array.isArray(e)?e:[]).filter(t=>Uo(t).isActivityFacing)}function qm(e,t,r){return!r||t.length===0?e:[...e,...t].sort((n,a)=>{const i=Number(n.receivedAt??n.timestamp??0)||0,o=Number(a.receivedAt??a.timestamp??0)||0;if(i!==o)return i-o;const l=Number(n.index??0)||0,d=Number(a.index??0)||0;return l-d})}function Qc(e=typeof localStorage<"u"?localStorage:void 0){try{return(e==null?void 0:e.getItem(Wo))==="1"}catch{return!1}}function Xm(e,t=typeof localStorage<"u"?localStorage:void 0){try{t==null||t.setItem(Wo,e?"1":"0")}catch{}}const Gd=[Cf,{singleTilde:!1}],qd=[Gd,Tf,If],Ym=[Gd],Ko=200,Jm=80,Zc=650,Pr=new Map;function ha(e,t){if(!e)return!1;const r=String(e.messageFingerprint||"");return r?r===String(t||""):!0}function Qm(e,t){if(!Array.isArray(e)||e.length===0)return"0:empty";const r=String(t||"").trim();if(r)return`${e.length}:${r}`;const n=e[e.length-1];return`${e.length}:${xm(n)}`}function Zm(e,t,r,n){return e||!t?!1:ha(r,n)}function ex({scrollTop:e,scrollHeight:t,clientHeight:r,topThresholdPx:n=Jm,bottomThresholdPx:a=Ko}){const i=Math.max(0,Number(e)||0),o=Math.max(0,Number(t)||0),l=Math.max(0,Number(r)||0);return Math.max(0,o-l)<=0?{showTop:!1,showBottom:!1}:{showTop:i>n,showBottom:Math.max(0,o-i-l)>a}}function tx(e){return ex({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight})}function Xr(e,t=Ko){return!!e&&e.fromBottom>=t}function sx(e,t){return ha(e,t)?!Xr(e):!0}function rx({hasSelection:e,userScrolledUp:t,hasChatContentChanged:r=!0}){return!(e||t||!r)}function nx({hasSelection:e,userScrolledUp:t,contextAutoScrollActive:r}){return e?!1:r||!t}function ri(e,t){const r=Math.max(0,e.scrollHeight-e.clientHeight-t.fromBottom);e.scrollTop=Number.isFinite(r)?r:t.top}function Xd(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}function ax(e,t,r){return Number(e.receivedAt||r[pa(e,t)]||0)||0}function Yd(e){return/[`*_#[\]()>-]|https?:\/\/|\n\s*[-*]\s|\n\s*\d+\.\s|\|/.test(e)}function ix(e){return Array.isArray(e)&&e.some(t=>!!t&&typeof t=="object"&&"type"in t)}function Lr(e,t){if(!e)return t;try{return(e.startsWith("file://")?new URL(e).pathname:e).split(/[\\/]/).filter(Boolean).pop()||t}catch{return e.split(/[\\/]/).filter(Boolean).pop()||t}}function ni(e){if(typeof e.uri=="string"&&e.uri)return e.uri;if(typeof e.data=="string"&&e.data&&typeof e.mimeType=="string"&&e.mimeType)return`data:${e.mimeType};base64,${e.data}`}function Pn(e,t,r){return s.jsxs("div",{className:"rounded-md border border-border-subtle p-2 text-sm",role:"note",children:[s.jsx("span",{className:"font-medium",children:e}),t?s.jsx("span",{className:"ml-1 break-all",children:t}):null,r?s.jsx("div",{className:"mt-1 opacity-80",style:{whiteSpace:"pre-wrap"},children:r}):null]})}function el(e,t){return e?t?s.jsx("pre",{className:"chat-preformatted",children:e}):Yd(e)?s.jsx(Ro,{remarkPlugins:qd,children:e}):s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:e}):null}function Er({parts:e,renderAsPreformatted:t}){return s.jsx("div",{className:"flex flex-col gap-2",children:e.map((r,n)=>{if(r.type==="text")return s.jsx("div",{children:el(String(r.text||""),t)},`text-${n}`);if(r.type==="image"){const a=ni(r),i=r.alt||r.description||Lr(r.uri,"image");return a?s.jsx("img",{src:a,alt:i,className:"max-w-full rounded-md border border-border-subtle"},`image-${n}`):s.jsx("div",{children:Pn("Image",i,r.mimeType)},`image-fallback-${n}`)}if(r.type==="audio"){const a=ni(r);return a?s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("audio",{controls:!0,src:a,className:"max-w-full"}),r.transcript?s.jsx("div",{className:"text-sm opacity-80",style:{whiteSpace:"pre-wrap"},children:r.transcript}):null]},`audio-${n}`):s.jsx("div",{children:Pn("Audio",Lr(r.uri,"audio"),r.transcript||r.mimeType)},`audio-fallback-${n}`)}if(r.type==="video"){const a=ni(r),i=r.title||r.name||r.alt||Lr(r.uri,"video"),o=[r.transcript,r.description,r.mimeType].filter(Boolean).join(`
3
3
  `);return s.jsxs("div",{className:"flex flex-col gap-1",children:[a?s.jsx("video",{controls:!0,src:a,poster:r.posterUri,className:"max-w-full rounded-md border border-border-subtle"}):Pn("Video",i,o),a&&o?s.jsx("div",{className:"text-sm opacity-80",style:{whiteSpace:"pre-wrap"},children:o}):null]},`video-${n}`)}if(r.type==="resource_link"){const a=r.title||r.name||Lr(r.uri,"resource"),i=[r.description,r.mimeType].filter(Boolean).join(`
4
4
  `);return s.jsxs("div",{className:"flex flex-col gap-1",children:[r.uri?s.jsx("a",{href:r.uri,target:"_blank",rel:"noreferrer",download:!0,className:"underline break-all",children:a}):Pn("Resource",a,i),r.uri&&i?s.jsx("div",{className:"text-sm opacity-80",style:{whiteSpace:"pre-wrap"},children:i}):null]},`resource-link-${n}`)}if(r.type==="resource"&&r.resource){const a=Lr(r.resource.uri,"resource");if(r.resource.text)return s.jsxs("div",{className:"rounded-md border border-border-subtle p-2",children:[s.jsx("div",{className:"text-[11px] opacity-70 mb-1",children:a}),el(r.resource.text,!0)]},`resource-${n}`);if(r.resource.uri)return s.jsx("a",{href:r.resource.uri,target:"_blank",rel:"noreferrer",className:"underline break-all",children:a},`resource-uri-${n}`)}return null})})}function pa(e,t){const r=e,n=Eo(e.content,{joiner:`
5
5
  `});return[e.id?`id:${e.id}`:"",r._localId?`local:${r._localId}`:"",r._turnKey?`turn:${r._turnKey}`:"",typeof e.index=="number"?`msgIndex:${e.index}`:"",e.role?`role:${e.role}`:"",n?`content:${n.slice(0,80)}`:"",`fallback:${t}`].filter(Boolean).join("|")}const ox=c.memo(function({log:t}){return s.jsxs("div",{className:"self-center chat-msg-action",children:[s.jsx(Ro,{remarkPlugins:Ym,children:t.text}),s.jsx("span",{className:"action-time",children:Xd(t.timestamp)})]})},(e,t)=>e.log===t.log),cx=c.memo(function({message:t,receivedAt:r,agentName:n,userName:a,isCliMode:i,isTextExpanded:o,onToggleTextExpanded:l}){var S,k,O;const d=(t.role||"").toLowerCase(),u=d==="user"||d==="human",h=t.kind||(d==="tool"?"tool":"standard"),f=Uo(t),m=ix(t.content)?t.content:null,v=!!(m!=null&&m.some(P=>P.type!=="text")),b=Eo(t.content,{joiner:`
6
- `});if(f.isActivityFacing&&h!=="thought"&&h!=="tool"&&h!=="terminal"){const P=f.label||"Activity";return s.jsxs("div",{className:"self-start chat-msg-activity","data-chat-activity-row":"true",children:[s.jsxs("div",{className:"chat-msg-activity-meta","aria-label":"Activity message",children:[s.jsx("span",{className:"activity-dot"}),s.jsx("span",{children:P})]}),v&&m?s.jsx("div",{className:"chat-msg-activity-body",children:s.jsx(Er,{parts:m,renderAsPreformatted:!1})}):s.jsx("div",{className:"chat-msg-activity-body",style:{whiteSpace:"pre-wrap"},children:b})]})}if(h==="thought"){const P=typeof((S=t.meta)==null?void 0:S.label)=="string"?t.meta.label:"Thought";return s.jsxs("div",{className:"self-start chat-msg-thought","data-chat-activity-row":f.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx(Tm,{size:13}),s.jsx("span",{children:P})]}),s.jsx("div",{className:"chat-msg-body",children:b})]})}if(h==="tool")return s.jsxs("div",{className:"self-start chat-msg-tool","data-chat-activity-row":f.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-tool-meta","aria-label":"Tool message",children:[s.jsx("span",{className:"tool-icon",children:"⏺"}),s.jsx("span",{className:"tool-label",children:"Tool"})]}),v&&m?s.jsx("div",{className:"tool-text w-full",children:s.jsx(Er,{parts:m,renderAsPreformatted:!1})}):s.jsx("div",{className:"tool-text w-full",style:{whiteSpace:"pre-wrap"},children:b})]});if(h==="terminal"){const P=(k=t.meta)!=null&&k.isRunning?"⏳":"✅",I=typeof((O=t.meta)==null?void 0:O.label)=="string"?t.meta.label:"Ran command";return s.jsxs("div",{className:"self-start chat-msg-terminal","data-chat-activity-row":f.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx("span",{children:P}),s.jsx("span",{children:I})]}),v&&m?s.jsx("div",{className:"chat-msg-body",children:s.jsx(Er,{parts:m,renderAsPreformatted:!0})}):s.jsx("pre",{className:"chat-msg-body",children:b})]})}if(h==="system")return s.jsx("div",{className:"self-center chat-msg-system",children:v&&m?s.jsx(Er,{parts:m,renderAsPreformatted:!1}):b.slice(0,100)});const p=t.meta,y=(typeof(p==null?void 0:p.renderMode)=="string"?p.renderMode.trim():"")==="preformatted",x=b,N=!1,j=x,w=y,A=!w&&Yd(j),M=["chat-message-row",u?"chat-message-row-user self-end":"chat-message-row-assistant self-start"].join(" ");return s.jsx("div",{className:M,children:(x||v||u)&&s.jsxs("div",{className:`chat-bubble ${u?"chat-bubble-user":"chat-bubble-assistant"}`,children:[s.jsxs("div",{className:`chat-bubble-header ${x||v?"mb-1.5":"mb-0"}`,children:[s.jsx("span",{className:"chat-sender",children:u?a||"You":t.senderName||n}),r!=null&&s.jsx("span",{className:"chat-time",children:Xd(r)})]}),(x||v)&&s.jsx("div",{className:"chat-markdown",children:v&&m?s.jsx(Er,{parts:m,renderAsPreformatted:w}):w?s.jsx("pre",{className:"chat-preformatted",children:j}):A?s.jsx(Ro,{remarkPlugins:qd,children:j}):s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:j})}),N]})})},(e,t)=>e.message===t.message&&e.receivedAt===t.receivedAt&&e.agentName===t.agentName&&e.userName===t.userName&&e.isCliMode===t.isCliMode&&e.isTextExpanded===t.isTextExpanded),lx=c.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",userName:a,isCliMode:i=!1,isWorking:o=!1,contextKey:l="",receivedAtMap:d={},lastMessageHash:u,showActivityMessages:h=!1,emptyState:f,onLoadMore:m,isLoadingMore:v,hasMoreHistory:b,hiddenLiveCount:p=0,loadError:g,scrollToBottomRequestNonce:y,isVisible:x=!0},N){const j=c.useRef(null),w=c.useRef(null),A=c.useRef(null),M=c.useRef(0),S=c.useRef(""),k=c.useRef(""),O=c.useRef(!1),P=c.useRef(null),I=c.useRef(!1),W=c.useRef(null),K=c.useRef(!1),[R,T]=c.useState(new Set),[C,F]=c.useState({showTop:!1,showBottom:!1}),L=c.useRef(!1),D=c.useRef(!1),H=c.useRef(x),Q=c.useRef(x),ge=c.useRef(null);Q.current=x;const ue=()=>{const re=j.current;return re?re.scrollHeight-re.scrollTop-re.clientHeight<Ko:!0},Z=c.useCallback(()=>{const re=j.current,q=re?tx(re):{showTop:!1,showBottom:!1};F(je=>je.showTop===q.showTop&&je.showBottom===q.showBottom?je:q)},[]),xe=c.useCallback((re="auto")=>{var je;const q=j.current;q&&(q.scrollTo({top:q.scrollHeight,behavior:re}),(je=q.ownerDocument.defaultView)==null||je.requestAnimationFrame(()=>Z()))},[Z]),Se=c.useCallback((re="auto")=>{var je;const q=j.current;q&&(q.scrollTo({top:0,behavior:re}),(je=q.ownerDocument.defaultView)==null||je.requestAnimationFrame(()=>Z()))},[Z]),be=c.useCallback(()=>{var Pe;const re=j.current,q=(Pe=window.getSelection)==null?void 0:Pe.call(window);if(!re||!q||q.rangeCount===0||q.isCollapsed){K.current=!1;return}const je=q.anchorNode,we=q.focusNode;K.current=!!(je&&we&&re.contains(je)&&re.contains(we))},[]),Y=c.useMemo(()=>{const re=Gm(t),q=Vd(t);return qm(re,q,h)},[t,h]),he=Y.length===t.length?u:void 0,ye=Qm(Y,he),se=c.useCallback(()=>{const re=j.current;if(!re||!l||!Q.current)return;const q={top:re.scrollTop,fromBottom:Math.max(0,re.scrollHeight-re.scrollTop-re.clientHeight),messageFingerprint:ye};ge.current={contextKey:l,snapshot:q},Pr.set(l,q)},[l,ye]),de=c.useCallback((re="auto")=>{P.current!=null&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>{P.current=null,xe(re)})},[xe]),Ce=c.useCallback(()=>{L.current=!1,I.current=!0,D.current=!0,W.current!=null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{I.current=!1,W.current=null},Zc)},[]);c.useEffect(()=>{const re=!O.current,q=k.current!==l;if(k.current=l,re||q){O.current=!0;const we=l?Pr.get(l):null,Pe=!!we&&ha(we,ye);L.current=Pe?Xr(we):!1,I.current=sx(we,ye),K.current||(Pe?requestAnimationFrame(()=>{const Re=j.current;Re&&(ri(Re,we),L.current=Xr(we),Z(),D.current=!0)}):de("auto")),M.current=Y.length,S.current=ye;return}Y.length>M.current;const je=ye!==S.current;rx({hasSelection:K.current,userScrolledUp:L.current,hasChatContentChanged:je})&&de("auto"),M.current=Y.length,S.current=ye},[ye,l,Y.length,de,Z]),c.useEffect(()=>{y&&(Ce(),K.current||de("auto"))},[Ce,de,y]),c.useEffect(()=>{const re=H.current;re&&!x&&se(),Q.current=x,H.current=x;const q=l?Pr.get(l):null;if(Zm(re,x,q,ye)){if(!q)return;L.current=Xr(q),I.current=!1,K.current||requestAnimationFrame(()=>{const je=j.current;je&&(ri(je,q),Z())});return}},[x,l,ye,Ce,se,de,Z]),c.useEffect(()=>()=>{const re=ge.current;re&&Pr.set(re.contextKey,re.snapshot),P.current!=null&&cancelAnimationFrame(P.current),W.current!=null&&window.clearTimeout(W.current)},[]),c.useEffect(()=>{const re=w.current,q=j.current;if(!re||!q)return;const je=()=>{W.current!=null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{I.current=!1,W.current=null},Zc)},we=new ResizeObserver(()=>{Z();const Pe=I.current;nx({hasSelection:K.current,userScrolledUp:L.current,contextAutoScrollActive:Pe})&&(de("auto"),Pe&&je())});return we.observe(re),q!==re&&we.observe(q),()=>{we.disconnect(),W.current!=null&&(window.clearTimeout(W.current),W.current=null)}},[de,l,Z]),c.useImperativeHandle(N,()=>({scrollToBottom:(re="smooth")=>{xe(re)}}),[xe]),c.useEffect(()=>{const re=j.current;if(!re)return;let q;const je=()=>{se(),clearTimeout(q),q=setTimeout(()=>{L.current=!ue(),Z()},50)};return re.addEventListener("scroll",je,{passive:!0}),()=>{re.removeEventListener("scroll",je),clearTimeout(q)}},[se,Z]),c.useEffect(()=>(document.addEventListener("selectionchange",be),()=>document.removeEventListener("selectionchange",be)),[be]);const pe=c.useRef(0),me=c.useRef(!1);c.useEffect(()=>{const re=j.current;if(!re||!me.current||pe.current===0)return;const q=re.scrollHeight-pe.current;q>0&&(re.scrollTop=q),Z(),se(),pe.current=0,me.current=!1},[Y.length,se,Z]),c.useEffect(()=>{if(D.current||!l)return;const re=Pr.get(l),q=j.current;if(!(!re||!q)){if(!ha(re,ye)){xe("auto"),D.current=!0;return}ri(q,re),L.current=Xr(re),Z(),D.current=!0}},[l,ye,Y.length,xe,Z]);const oe=()=>{const re=j.current;re&&(pe.current=re.scrollHeight),me.current=!0,m==null||m()},fe=()=>{L.current=!0,Se("smooth"),se()},ce=()=>{Ce(),xe("smooth"),se()},E=c.useMemo(()=>{const re=Y.map((Pe,Re)=>({type:"message",data:Pe,index:Re,ts:ax(Pe,Re,d)}));if(!r||r.length===0)return re;const q=[...r].sort((Pe,Re)=>Pe.timestamp-Re.timestamp).map((Pe,Re)=>({type:"action",data:Pe,index:Re,ts:Pe.timestamp})),je=[];let we=0;for(const Pe of re){for(;we<q.length&&Pe.ts>0&&q[we].ts<Pe.ts;)je.push(q[we++]);je.push(Pe)}for(;we<q.length;)je.push(q[we++]);return je},[Y,r,d]),z=p>0||!!b,le=p>0?`↑ Show ${Math.min(p,80)} earlier messages${p>80?` (${p} hidden)`:""}`:g?`↻ ${g}`:"↑ Load older messages";return s.jsxs("div",{className:"chat-scroll-frame",children:[s.jsx("div",{ref:j,"data-chat-scroll":!0,className:"chat-container",children:s.jsxs("div",{ref:w,className:"chat-container-content",children:[v&&s.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60 animate-pulse",children:"Loading older messages..."}),z&&!v&&s.jsx("div",{className:"text-center py-2",children:s.jsx("button",{type:"button",onClick:oe,className:`text-[11px] rounded-xl px-4 py-1.5 cursor-pointer border transition-all ${g&&p===0?"bg-transparent border-yellow-500/30 text-yellow-400 opacity-80 hover:opacity-100":"bg-transparent border-border-subtle text-text-muted opacity-70 hover:opacity-100 hover:border-accent/40"}`,children:le})}),E.length===0&&!z&&(f||s.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),E.map(re=>{if(re.type==="action"){const Ae=re.data;return s.jsx(ox,{log:Ae},`action-${re.index}`)}const q=re.data,je=re.index,we=pa(q,je),Pe=q.receivedAt||d[we],Re=`${l}-${we}`,B=R.has(Re);return s.jsx(cx,{message:q,receivedAt:Pe,agentName:n,userName:a,isCliMode:i,isTextExpanded:B,onToggleTextExpanded:()=>T(Ae=>{const Ee=new Set(Ae);return B?Ee.delete(Re):Ee.add(Re),Ee})},`msg-${we}`)}),o&&s.jsx("div",{className:"self-start chat-typing-wrapper",children:s.jsxs("div",{className:"typing-indicator",children:[s.jsx("div",{className:"dot"}),s.jsx("div",{className:"dot"}),s.jsx("div",{className:"dot"}),s.jsx("span",{className:"text-[11px] text-text-muted ml-1",children:"Agent generating..."})]})}),s.jsx("div",{className:"min-h-10",ref:A})]})}),(C.showTop||C.showBottom)&&s.jsxs("div",{className:"chat-scroll-jump-controls","aria-label":"Chat scroll shortcuts",children:[C.showTop&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button",onClick:fe,"aria-label":"Jump to oldest messages",title:"Jump to top",children:"↑ Top"}),C.showBottom&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button chat-scroll-jump-button-primary",onClick:ce,"aria-label":"Jump to latest messages",title:"Jump to bottom",children:"↓ Latest"})]})]})}),dx=c.memo(lx,(e,t)=>e.messages===t.messages&&e.actionLogs===t.actionLogs&&e.agentName===t.agentName&&e.userName===t.userName&&e.isCliMode===t.isCliMode&&e.isWorking===t.isWorking&&e.contextKey===t.contextKey&&e.receivedAtMap===t.receivedAtMap&&e.lastMessageHash===t.lastMessageHash&&e.showActivityMessages===t.showActivityMessages&&e.emptyState===t.emptyState&&e.onLoadMore===t.onLoadMore&&e.isLoadingMore===t.isLoadingMore&&e.hasMoreHistory===t.hasMoreHistory&&e.hiddenLiveCount===t.hiddenLiveCount&&e.loadError===t.loadError&&e.scrollToBottomRequestNonce===t.scrollToBottomRequestNonce&&e.isVisible===t.isVisible),ux="modulepreload",hx=function(e){return"/"+e},tl={},px=function(t,r,n){let a=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));a=Promise.allSettled(r.map(d=>{if(d=hx(d),d in tl)return;tl[d]=!0;const u=d.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":ux,u||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((m,v)=>{f.addEventListener("load",m),f.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return a.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};let sl=!1;const Jd=c.forwardRef(({onInput:e,onViewportMetrics:t,onScrollMetrics:r,fontSize:n=13,readOnly:a=!1,sizingMode:i="measured"},o)=>{const l=c.useRef(null),[d,u]=c.useState(null),h=c.useRef([]),f=c.useRef(!1),m=c.useRef(!1),v=c.useRef(!1),b=c.useRef(!1),p=()=>{const g=l.current;if(g){f.current&&(g.clear(),f.current=!1);for(const y of h.current)g.write(y.data,y.onProcessed);h.current=[],m.current&&(g.fit(),m.current=!1),v.current&&(g.bumpResize(),v.current=!1),b.current&&(g.scrollToTop(),b.current=!1)}};return c.useImperativeHandle(o,()=>({write:(g,y)=>{l.current?l.current.write(g,y):h.current.push({data:g,onProcessed:y})},clear:()=>{l.current?l.current.clear():(h.current=[],f.current=!0)},reset:()=>{l.current&&typeof l.current.reset=="function"?l.current.reset():(h.current=[],f.current=!0)},resize:(g,y)=>{l.current&&typeof l.current.resize=="function"&&l.current.resize(g,y)},fit:()=>{l.current?l.current.fit():m.current=!0},bumpResize:()=>{l.current?l.current.bumpResize():v.current=!0},scrollToTop:()=>{l.current?l.current.scrollToTop():b.current=!0},getSelection:()=>{var g,y;return((y=(g=l.current)==null?void 0:g.getSelection)==null?void 0:y.call(g))||""},getVisibleText:()=>{var g,y;return((y=(g=l.current)==null?void 0:g.getVisibleText)==null?void 0:y.call(g))||""}}),[]),c.useEffect(()=>{d&&p()},[d]),c.useEffect(()=>{let g=!1;return px(()=>import("./terminal-Cn_eJIrc.js"),__vite__mapDeps([0,1,2])).then(y=>{sl||(sl=!0,console.info("[CliTerminal] renderer module loaded: terminal-render-web")),g||u(()=>y.GhosttyTerminalView)}).catch(y=>{console.error("[CliTerminal] failed to load terminal renderer",y)}),()=>{g=!0}},[]),d?s.jsx(d,{ref:l,onInput:e,onViewportMetrics:t,onScrollMetrics:r,fontSize:n,readOnly:a,sizingMode:i,className:"w-full h-full rounded-lg overflow-hidden"}):s.jsx("div",{className:"w-full h-full rounded-lg overflow-hidden animate-pulse",style:{background:"#0f1117"}})});Jd.displayName="CliTerminal";function Ln({label:e,value:t,sub:r,icon:n}){return s.jsxs("div",{className:"px-4 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx("span",{className:"text-base flex items-center",children:n}),s.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wide font-semibold",children:e})]}),s.jsx("div",{className:"text-[22px] font-bold text-text-primary tracking-tight",children:t}),r&&s.jsx("div",{className:"text-[11px] text-text-muted mt-0.5",children:r})]})}function rl({value:e,max:t,label:r,color:n="#8b5cf6",detail:a,compact:i=!1}){const o=t>0?Math.min(Math.round(e/t*100),100):0,l=o>85?"#ef4444":o>60?"var(--status-warning)":n;return i?s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex justify-between mb-0.5",children:[s.jsx("span",{className:"text-[9px] text-text-muted uppercase tracking-wide font-semibold",children:r}),s.jsxs("span",{className:"text-[10px] text-text-secondary font-semibold",children:[o,"%"]})]}),s.jsx("div",{className:"h-1 bg-white/[0.04] rounded-sm overflow-hidden",children:s.jsx("div",{className:"h-full rounded-sm transition-[width] duration-500",style:{width:`${o}%`,background:l}})})]}):s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex justify-between mb-1.5",children:[s.jsx("span",{className:"text-[11px] text-text-secondary font-medium",children:r}),s.jsxs("span",{className:"text-[13px] text-text-primary font-bold",children:[o,"%"]})]}),s.jsx("div",{className:"h-1.5 bg-white/[0.04] rounded-sm overflow-hidden",children:s.jsx("div",{className:"h-full rounded-sm transition-[width] duration-[600ms]",style:{width:`${o}%`,background:`linear-gradient(90deg, ${l}, ${l}cc)`}})}),a&&s.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:a})]})}function fx({cursorPos:e,viewportRef:t,imgRef:r}){var x;if(!e||!r.current)return null;const n=r.current,a=n.getBoundingClientRect(),i=(x=t.current)==null?void 0:x.getBoundingClientRect();if(!i)return null;const o=n.naturalWidth||a.width,l=n.naturalHeight||a.height,d=o/l,u=a.width/a.height;let h,f,m,v;d>u?(h=a.width,f=a.width/d,m=0,v=(a.height-f)/2):(f=a.height,h=a.height*d,m=(a.width-h)/2,v=0);const b=a.left-i.left+m+h*e.nx,p=a.top-i.top+v+f*e.ny,g=Math.max(8,Math.min(i.width-8,b)),y=Math.max(8,Math.min(i.height-8,p));return s.jsxs("div",{style:{position:"absolute",left:g-8,top:y-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[s.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),s.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),s.jsx("div",{style:{position:"absolute",left:5,top:5,width:6,height:6,borderRadius:"50%",background:"#3b82f6",boxShadow:"0 0 8px rgba(59,130,246,0.6)"}})]})}function mx({inputMode:e,onToggleInputMode:t,isImeOpen:r,setIsImeOpen:n,isMenuOpen:a,setIsMenuOpen:i,imeText:o,setImeText:l,handleImeSubmit:d,isConnActive:u,zoom:h,isMobile:f,mobileFillZoom:m,onZoomOut:v,onZoomReset:b,onZoomIn:p,transportType:g,screenshotUsage:y,lastActionStatus:x}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{onTouchStart:N=>N.stopPropagation(),className:"absolute bottom-0 left-0 right-0 z-20 flex items-center justify-center gap-1.5 px-3 py-2 bg-black/75 backdrop-blur-xl border-t border-white/[0.08] touch-none",children:[s.jsxs("div",{onClick:t,className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${e==="mouse"?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:[s.jsx("span",{className:"text-sm",children:e==="mouse"?"🖱️":"👆"}),s.jsx("span",{className:`text-[10px] font-bold ${e==="mouse"?"text-blue-400":"text-slate-400"}`,children:e==="mouse"?"Mouse":"Touch"})]}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{onClick:()=>{n(N=>!N),i(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${r?"bg-emerald-500/25 border border-emerald-500/40":"bg-white/[0.08] border border-white/10"}`,children:s.jsx("span",{className:"text-sm",children:"⌨️"})}),r&&s.jsx("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 w-[220px] bg-neutral-950/[0.98] backdrop-blur-[30px] rounded-xl border border-white/20 p-[10px_12px] shadow-[0_10px_30px_rgba(0,0,0,0.8)] flex flex-col gap-2 z-20",style:{animation:"slideUp 0.15s ease-out"},children:s.jsx("input",{type:"text",placeholder:"Type & Enter...",value:o,autoFocus:!0,onTouchStart:N=>N.stopPropagation(),onChange:N=>l(N.target.value),onKeyDown:N=>{d(N)},className:"w-full bg-black/60 border border-white/15 rounded-lg px-2.5 py-2 text-white text-[13px] outline-none"})})]}),s.jsx("div",{className:"relative",children:s.jsx("div",{onClick:()=>{i(N=>!N),n(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${a?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:s.jsx("span",{className:"text-sm",children:"⚙️"})})}),s.jsx("div",{className:"w-px h-[18px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 rounded-md",style:{background:u?"rgba(34,197,94,0.12)":"rgba(234,179,8,0.12)"},children:[s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:u?"#22c55e":"#eab308",boxShadow:u?"0 0 4px #22c55e80":"0 0 4px #eab30880"}}),s.jsx("span",{className:"text-[8px] font-extrabold",style:{color:u?"#22c55e":"#eab308"},children:u?"Connected":"WS"})]}),h>1&&s.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(h*100),"%"]}),g==="direct"&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:"#22c55e",background:"rgba(34,197,94,0.12)"},title:"Direct P2P connection",children:"Direct"}),g==="relay"&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:"var(--status-warning)",background:"color-mix(in srgb, var(--status-warning) 12%, transparent)"},title:"TURN relay in use",children:"Relay"}),y&&y.dailyBudgetMinutes>0&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:y.budgetExhausted?"#ef4444":"#c4b5fd",background:y.budgetExhausted?"rgba(239,68,68,0.1)":"rgba(139,92,246,0.14)"},title:"Daily TURN relay usage",children:y.budgetExhausted?"TURN blocked":`TURN ${y.dailyUsedMinutes}/${y.dailyBudgetMinutes}m`}),x&&s.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:x})]})]}),a&&s.jsxs("div",{onTouchStart:N=>N.stopPropagation(),style:{position:"absolute",bottom:56,left:"50%",transform:"translateX(-50%)",width:220,background:"rgba(23, 23, 23, 0.95)",backdropFilter:"blur(25px)",borderRadius:14,border:"1px solid rgba(255,255,255,0.1)",padding:14,boxShadow:"0 12px 40px rgba(0,0,0,0.6)",display:"flex",flexDirection:"column",gap:12,zIndex:20,touchAction:"none",animation:"slideUpSidebar 0.15s ease-out"},children:[s.jsx("div",{style:{fontSize:9,fontWeight:900,color:"#3b82f6",letterSpacing:1.5},children:"SETTINGS"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("div",{style:{fontSize:10,color:"#888",fontWeight:700},children:["ZOOM: ",h<=(f?m:1)+.01?f?"FILL":"FIT":`${Math.round(h*100)}%`]}),s.jsxs("div",{style:{display:"flex",gap:4},children:[s.jsx("button",{onClick:N=>{N.stopPropagation(),v()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"−"}),s.jsx("button",{onClick:N=>{N.stopPropagation(),b()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:9,fontWeight:800,cursor:"pointer"},children:f?"FILL":"FIT"}),s.jsx("button",{onClick:N=>{N.stopPropagation(),p()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"+"})]})]})]})]})}function xx({waitingLabel:e,waitingHint:t,transportType:r}){return s.jsxs("div",{className:"text-center flex flex-col items-center gap-3 px-6",children:[s.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center border border-white/10 bg-white/[0.04] shadow-[0_10px_30px_rgba(0,0,0,0.35)]",style:{animation:"remote-float 2.8s ease-in-out infinite"},children:s.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-8 h-8 opacity-90"})}),s.jsx("div",{className:"text-white/85 text-[13px] font-semibold tracking-wide",children:e}),s.jsx("div",{className:"text-[11px] text-white/40",children:t}),r==="relay"&&s.jsx("div",{className:"text-[10px] font-medium",style:{color:"var(--status-warning)",opacity:.8},children:"TURN relay active"})]})}function gx(){if(typeof window>"u")return!1;try{return window.__ADHDEV_DEBUG_RENDERS__===!0||window.localStorage.getItem("adhdev_debug_renders")==="1"}catch{return window.__ADHDEV_DEBUG_RENDERS__===!0}}function nl(e){return e==null||typeof e=="number"||typeof e=="boolean"?e:typeof e=="string"?e.length>64?`${e.slice(0,61)}...`:e:Array.isArray(e)?`Array(${e.length})`:typeof e=="object"?"Object":typeof e}function wn(e,t){const r=c.useRef(null),n=c.useRef(0);c.useEffect(()=>{if(!gx())return;n.current+=1;const a=r.current;if(!a){console.debug(`[render-trace] ${e}#${n.current}`,{changed:["mount"],snapshot:Object.fromEntries(Object.entries(t).map(([o,l])=>[o,nl(l)]))}),r.current=t;return}const i=Object.keys({...a,...t}).filter(o=>!Object.is(a[o],t[o]));i.length>0&&console.debug(`[render-trace] ${e}#${n.current}`,{changed:i,snapshot:Object.fromEntries(i.map(o=>[o,nl(t[o])]))}),r.current=t})}function bx({containerRef:e,viewportRef:t,imgRef:r,inputMode:n,setInputMode:a,minZoom:i,zoomRef:o,panXRef:l,panYRef:d,setPanX:u,setPanY:h,setZoom:f,lastWheelTimeRef:m,onAction:v,setLastActionStatus:b,spawnRippleFromNormalized:p,clampPan:g,isMobile:y,mobileFillZoom:x}){const[N,j]=c.useState(null),w=c.useRef(null),A=c.useRef(null),M=c.useRef(null),S=c.useRef(!1),k=c.useRef(null),O=c.useRef(0),P=c.useRef(null),I=c.useRef(1),W=c.useRef({x:0,y:0}),K=c.useRef(!1),R=c.useRef(n),T=c.useRef(v),C=30,F=550,L=18,D=60,H=400,Q=12,ge=()=>{if(w.current)return;const xe={nx:.5,ny:.5};w.current=xe,j(xe)};return c.useEffect(()=>{R.current=n,n==="mouse"&&ge()},[n]),c.useEffect(()=>{T.current=v},[v]),c.useEffect(()=>{const xe=e.current;if(!xe)return;const Se=de=>{if(!r.current)return null;const Ce=r.current.getBoundingClientRect();return!Ce.width||!Ce.height?null:{nx:Math.max(0,Math.min(1,(de.clientX-Ce.left)/Ce.width)),ny:Math.max(0,Math.min(1,(de.clientY-Ce.top)/Ce.height))}},be=(de,Ce)=>{if(!r.current)return{dnx:0,dny:0};const pe=r.current,me=pe.getBoundingClientRect(),oe=pe.naturalWidth||me.width,fe=pe.naturalHeight||me.height,ce=oe/fe,E=me.width/me.height;let z,le;return ce>E?(z=me.width,le=me.width/ce):(le=me.height,z=me.height*ce),{dnx:de/z,dny:Ce/le}},Y=(de,Ce,pe)=>{if(pe<=1.05)return;const me=-(de-.5)*100,oe=-(Ce-.5)*100,fe=g(me,oe,pe);(Math.abs(fe.x-l.current)>.1||Math.abs(fe.y-d.current)>.1)&&(u(fe.x),h(fe.y),l.current=fe.x,d.current=fe.y)},he=de=>{const Ce=t.current;if(Ce&&de.target instanceof Node&&Ce.contains(de.target))de.preventDefault();else return;if(de.touches.length===1){const pe=de.touches[0];A.current={x:pe.clientX,y:pe.clientY,time:Date.now()},M.current={x:pe.clientX,y:pe.clientY},K.current||(S.current=!1),k.current=setTimeout(()=>{if(!S.current&&!K.current)if(S.current=!0,R.current==="mouse"){const me=w.current||{nx:.5,ny:.5};b("Right Click"),p(me.nx,me.ny,"right"),T.current("input_click",{...me,button:"right"}).catch(()=>{})}else{const me=Se(pe);me&&(b("Right Click"),p(me.nx,me.ny,"right"),T.current("input_click",{...me,button:"right"}).catch(()=>{}))}},500);return}if(de.touches.length===2){k.current&&clearTimeout(k.current),S.current=!0,K.current=!0;const pe=de.touches[1].clientX-de.touches[0].clientX,me=de.touches[1].clientY-de.touches[0].clientY;P.current=Math.sqrt(pe*pe+me*me),I.current=o.current,W.current={x:(de.touches[0].clientX+de.touches[1].clientX)/2,y:(de.touches[0].clientY+de.touches[1].clientY)/2}}},ye=de=>{const Ce=t.current;if(Ce&&de.target instanceof Node&&Ce.contains(de.target)&&de.preventDefault(),de.touches.length===1&&M.current){const pe=de.touches[0],me=pe.clientX-M.current.x,oe=pe.clientY-M.current.y;if(!S.current&&A.current){const fe=pe.clientX-A.current.x,ce=pe.clientY-A.current.y;Math.sqrt(fe*fe+ce*ce)>8&&(S.current=!0,k.current&&clearTimeout(k.current))}if(S.current)if(R.current==="mouse"){const fe=be(me,oe),ce=w.current||{nx:.5,ny:.5},E=Math.max(0,Math.min(1,ce.nx+fe.dnx)),z=Math.max(0,Math.min(1,ce.ny+fe.dny));w.current={nx:E,ny:z},j({nx:E,ny:z}),b(`Cursor: ${Math.round(E*100)}%, ${Math.round(z*100)}%`),Y(E,z,o.current);const le=Date.now();le-m.current>=30&&(m.current=le,T.current("input_mouseMoved",{nx:E,ny:z}).catch(()=>{}))}else if(o.current>1){const fe=t.current;if(fe){const ce=fe.clientWidth,E=fe.clientHeight,z=l.current+me/ce*100,le=d.current+oe/E*100,re=g(z,le,o.current);u(re.x),h(re.y),l.current=re.x,d.current=re.y}}else{const fe=Se(pe);if(fe){const ce=Date.now();ce-m.current>=40&&(m.current=ce,b("Scroll"),T.current("input_wheel",{nx:fe.nx,ny:fe.ny,deltaX:Math.round(-me*2.5),deltaY:Math.round(-oe*2.5)}).catch(()=>{}))}}M.current={x:pe.clientX,y:pe.clientY};return}if(de.touches.length===2&&P.current!==null){const pe=de.touches[1].clientX-de.touches[0].clientX,me=de.touches[1].clientY-de.touches[0].clientY,fe=Math.sqrt(pe*pe+me*me)/P.current,ce=(de.touches[0].clientX+de.touches[1].clientX)/2,E=(de.touches[0].clientY+de.touches[1].clientY)/2,z=ce-W.current.x,le=E-W.current.y,re=Math.abs(fe-1)>.03;if(R.current==="mouse"){if(re){const q=Math.max(i,Math.min(5,I.current*fe));f(q),o.current=q}else if(Math.abs(z)>2||Math.abs(le)>2){const q=w.current||{nx:.5,ny:.5},je=Date.now();je-m.current>=30&&(m.current=je,b("Scroll"),T.current("input_wheel",{nx:q.nx,ny:q.ny,deltaX:Math.round(-z*3),deltaY:Math.round(-le*3)}).catch(()=>{}))}}else{const q=Math.max(i,Math.min(5,I.current*fe));f(q),o.current=q;const je=t.current;if(je&&q>1){const we=je.clientWidth,Pe=je.clientHeight,Re=l.current+z/we*100,B=d.current+le/Pe*100,Ae=g(Re,B,q);u(Ae.x),h(Ae.y),l.current=Ae.x,d.current=Ae.y}}W.current={x:ce,y:E}}},se=de=>{var Ce;if(k.current&&clearTimeout(k.current),P.current=null,de.touches.length===1&&K.current){const pe=de.touches[0];A.current={x:pe.clientX,y:pe.clientY,time:Date.now()},M.current={x:pe.clientX,y:pe.clientY},S.current=!0;return}if(de.touches.length===0){if(K.current){K.current=!1,S.current=!1;return}if(de.changedTouches.length===1){const pe=de.changedTouches[0],me=Date.now(),oe=me-(((Ce=A.current)==null?void 0:Ce.time)||0),fe=A.current?pe.clientX-A.current.x:0,ce=A.current?pe.clientY-A.current.y:0,E=Math.sqrt(fe*fe+ce*ce);if(R.current==="mouse"){if(oe<C||oe>F||E>L){S.current=!1;return}const z=w.current||Se(pe);z&&(b(`Click: ${Math.round(z.nx*100)}%, ${Math.round(z.ny*100)}%`),p(z.nx,z.ny,"left"),T.current("input_click",{...z}).catch(()=>{}))}else{if(S.current){S.current=!1;return}if(oe<D||oe>H||E>Q){S.current=!1;return}const z=Se(pe);if(!z)return;me-O.current<300?(b("Double tap"),p(z.nx,z.ny,"double"),T.current("input_click",{...z,clickCount:2}).catch(()=>{}),O.current=0):(b(`Tap: ${Math.round(z.nx*100)}%, ${Math.round(z.ny*100)}%`),p(z.nx,z.ny,"left"),T.current("input_click",{...z}).catch(()=>{}),O.current=me)}}S.current=!1}};return xe.addEventListener("touchstart",he,{passive:!1}),xe.addEventListener("touchmove",ye,{passive:!1}),xe.addEventListener("touchend",se,{passive:!1}),()=>{xe.removeEventListener("touchstart",he),xe.removeEventListener("touchmove",ye),xe.removeEventListener("touchend",se),k.current&&clearTimeout(k.current)}},[e,t,r,i,o,l,d,u,h,f,m,b,p,g]),{cursorPos:N,cursorPosRef:w,handleToggleInputMode:()=>{a(xe=>{const Se=xe==="touch"?"mouse":"touch";return Se==="mouse"&&ge(),Se})},handleZoomReset:()=>{const xe=y?x:1;f(xe),o.current=xe,u(0),h(0),l.current=0,d.current=0}}}function Qd({onAction:e,addLog:t,connState:r,connScreenshot:n,screenshotUsage:a,transportType:i}){const o=c.useRef(null),l=c.useRef(null),d=c.useRef(null),[u,h]=c.useState(null),[f,m]=c.useState(""),[,v]=c.useState(!1),[b,p]=c.useState([]),g=c.useRef(0),[y,x]=c.useState(!1),[N,j]=c.useState(!1),w=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[A,M]=c.useState(w?"mouse":"touch"),[S,k]=c.useState(1),O=c.useRef(!1),[P,I]=c.useState(1),[W,K]=c.useState(0),[R,T]=c.useState(0);wn("RemoteView",{connState:r,hasScreenshot:!!n,inputMode:A,zoom:P,panX:W,panY:R,isMenuOpen:y,isImeOpen:N});const C=c.useRef(0),F=c.useRef(P),L=c.useRef(W),D=c.useRef(R);c.useEffect(()=>{F.current=P},[P]),c.useEffect(()=>{L.current=W},[W]),c.useEffect(()=>{D.current=R},[R]),c.useEffect(()=>{var oe;(oe=o.current)==null||oe.focus()},[]);const H=r==="connected",Q=n,ge=H?"Connected. Waiting for first frame...":r==="connecting"?"Connecting to Host...":"Reconnecting to Host...",ue=H?"The remote stream is warming up":"Waiting for the remote stream to catch up";c.useEffect(()=>{if(!w||O.current||!Q)return;const oe=d.current,fe=l.current;if(!oe||!fe)return;const ce=()=>{const E=fe.clientWidth,z=fe.clientHeight,le=oe.naturalWidth,re=oe.naturalHeight;if(!le||!re||!E||!z)return;const q=Math.min(E/le,z/re),we=Math.max(E/le,z/re)/q;we>1.01&&(k(we),I(we),F.current=we),O.current=!0};oe.complete&&oe.naturalWidth?ce():oe.addEventListener("load",ce,{once:!0})},[Q,w]);const Z=.5;c.useEffect(()=>{P<=Z&&(K(0),T(0))},[P,Z]);const xe=(oe,fe,ce)=>{if(ce<=Z)return{x:0,y:0};const E=(ce-1)/(2*ce)*100,z=(ce-1)/(2*ce)*100;return{x:Math.max(-E,Math.min(E,oe)),y:Math.max(-z,Math.min(z,fe))}},Se=(oe,fe)=>{if(!d.current)return null;const ce=d.current.getBoundingClientRect();return!ce.width||!ce.height?null:{nx:Math.max(0,Math.min(1,(oe-ce.left)/ce.width)),ny:Math.max(0,Math.min(1,(fe-ce.top)/ce.height))}},be=(oe,fe,ce)=>{const E=l.current;if(!E)return;const z=E.getBoundingClientRect(),le=++g.current;p(re=>[...re,{id:le,x:oe-z.left,y:fe-z.top,type:ce}]),setTimeout(()=>p(re=>re.filter(q=>q.id!==le)),600)},Y=(oe,fe,ce)=>{const E=d.current,z=l.current;if(!E||!z)return;const le=E.getBoundingClientRect(),re=z.getBoundingClientRect(),q=E.naturalWidth||le.width,je=E.naturalHeight||le.height,we=q/je,Pe=le.width/le.height;let Re,B,Ae,Ee;we>Pe?(Re=le.width,B=le.width/we,Ae=0,Ee=(le.height-B)/2):(B=le.height,Re=le.height*we,Ae=(le.width-Re)/2,Ee=0);const Ve=le.left-re.left+Ae+Re*oe,Ge=le.top-re.top+Ee+B*fe,Ze=++g.current;p(et=>[...et,{id:Ze,x:Ve,y:Ge,type:ce}]),setTimeout(()=>p(et=>et.filter(at=>at.id!==Ze)),600)},he=async oe=>{var ce;const fe=Se(oe.clientX,oe.clientY);if(fe){h(`Click: ${Math.round(fe.nx*100)}%, ${Math.round(fe.ny*100)}%`),be(oe.clientX,oe.clientY,"left"),(ce=o.current)==null||ce.focus();try{const E=await e("input_click",{nx:fe.nx,ny:fe.ny});E!=null&&E.success||t(`❌ Click failed: ${E==null?void 0:E.error}`)}catch(E){t(`❌ Click error: ${E.message||E}`)}}},ye=async(oe,fe,ce,E=0)=>{try{await e("input_key",{type:ce?"char":"keyDown",key:oe,code:fe,text:ce?oe:void 0,unmodifiedText:ce?oe:void 0,modifiers:E})}catch(z){t(`❌ Key error: ${z.message||z}`)}},se=async oe=>{if(oe.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(oe.key)&&oe.preventDefault();let ce=0;oe.altKey&&(ce|=1),oe.ctrlKey&&(ce|=2),oe.metaKey&&(ce|=4),oe.shiftKey&&(ce|=8),h(`Key: ${oe.key}`),await ye(oe.key,oe.code,oe.key.length===1,ce)},de=async oe=>{if(oe.key==="Enter"){if(oe.nativeEvent.isComposing)return;if(f){const fe=f;m(""),h(`IME Sent: ${fe}`);try{const ce=await e("input_type",{text:fe});ce!=null&&ce.success||t(`❌ IME error: ${ce==null?void 0:ce.error}`)}catch(ce){t(`❌ IME error: ${ce.message}`)}}else h("Key: Enter"),await ye("Enter","Enter",!1)}};c.useEffect(()=>{const oe=o.current;if(!oe)return;const fe=ce=>{var E;if((E=d.current)!=null&&E.contains(ce.target)){ce.preventDefault();const z=Date.now();if(z-C.current<40)return;C.current=z;const le=Se(ce.clientX,ce.clientY);if(!le)return;h(`Scroll: ${Math.round(ce.deltaY)}`),e("input_wheel",{nx:le.nx,ny:le.ny,deltaX:Math.round(ce.deltaX),deltaY:Math.round(ce.deltaY)}).catch(()=>{})}};return oe.addEventListener("wheel",fe,{passive:!1}),()=>oe.removeEventListener("wheel",fe)},[e]);const{cursorPos:Ce,handleToggleInputMode:pe,handleZoomReset:me}=bx({containerRef:o,viewportRef:l,imgRef:d,inputMode:A,setInputMode:M,minZoom:Z,zoomRef:F,panXRef:L,panYRef:D,setPanX:K,setPanY:T,setZoom:I,lastWheelTimeRef:C,onAction:e,setLastActionStatus:h,spawnRippleFromNormalized:Y,clampPan:xe,isMobile:w,mobileFillZoom:S});return s.jsxs("div",{ref:o,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:se,onContextMenu:oe=>oe.preventDefault(),onFocus:()=>v(!0),onBlur:()=>v(!1),tabIndex:0,children:[s.jsxs("div",{ref:l,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[Q?s.jsx("img",{ref:d,src:Q,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${P}) translate(${W}%, ${R}%)`,transformOrigin:"center center",cursor:A==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:he,onContextMenu:oe=>oe.preventDefault(),onDragStart:oe=>oe.preventDefault()}):s.jsx(xx,{waitingLabel:ge,waitingHint:ue,transportType:i}),A==="mouse"&&Q&&s.jsx(fx,{cursorPos:Ce,viewportRef:l,imgRef:d}),b.map(oe=>{const ce={left:"59,130,246",right:"239,68,68",double:"34,197,94"}[oe.type];return s.jsxs("div",{style:{position:"absolute",left:oe.x,top:oe.y,pointerEvents:"none",zIndex:200,transform:"translate(-50%, -50%)"},children:[s.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`2px solid rgba(${ce}, 0.8)`,animation:"click-ripple-ring 0.5s ease-out forwards",position:"absolute",left:-20,top:-20}}),s.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:`rgba(${ce}, 0.9)`,boxShadow:`0 0 12px rgba(${ce}, 0.6)`,animation:"click-ripple-dot 0.4s ease-out forwards",position:"absolute",left:-4,top:-4}})]},oe.id)})]}),s.jsx(mx,{inputMode:A,onToggleInputMode:pe,isImeOpen:N,setIsImeOpen:j,isMenuOpen:y,setIsMenuOpen:x,imeText:f,setImeText:m,handleImeSubmit:de,isConnActive:H,zoom:P,isMobile:w,mobileFillZoom:S,onZoomOut:()=>I(oe=>Math.max(.5,oe-.25)),onZoomReset:me,onZoomIn:()=>I(oe=>Math.min(5,oe+.25)),transportType:i,screenshotUsage:a,lastActionStatus:u}),s.jsx("style",{children:`
6
+ `});if(f.isActivityFacing&&h!=="thought"&&h!=="tool"&&h!=="terminal"){const P=f.label||"Activity";return s.jsxs("div",{className:"self-start chat-msg-activity","data-chat-activity-row":"true",children:[s.jsxs("div",{className:"chat-msg-activity-meta","aria-label":"Activity message",children:[s.jsx("span",{className:"activity-dot"}),s.jsx("span",{children:P})]}),v&&m?s.jsx("div",{className:"chat-msg-activity-body",children:s.jsx(Er,{parts:m,renderAsPreformatted:!1})}):s.jsx("div",{className:"chat-msg-activity-body",style:{whiteSpace:"pre-wrap"},children:b})]})}if(h==="thought"){const P=typeof((S=t.meta)==null?void 0:S.label)=="string"?t.meta.label:"Thought";return s.jsxs("div",{className:"self-start chat-msg-thought","data-chat-activity-row":f.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx(Tm,{size:13}),s.jsx("span",{children:P})]}),s.jsx("div",{className:"chat-msg-body",children:b})]})}if(h==="tool")return s.jsxs("div",{className:"self-start chat-msg-tool","data-chat-activity-row":f.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-tool-meta","aria-label":"Tool message",children:[s.jsx("span",{className:"tool-icon",children:"⏺"}),s.jsx("span",{className:"tool-label",children:"Tool"})]}),v&&m?s.jsx("div",{className:"tool-text w-full",children:s.jsx(Er,{parts:m,renderAsPreformatted:!1})}):s.jsx("div",{className:"tool-text w-full",style:{whiteSpace:"pre-wrap"},children:b})]});if(h==="terminal"){const P=(k=t.meta)!=null&&k.isRunning?"⏳":"✅",I=typeof((O=t.meta)==null?void 0:O.label)=="string"?t.meta.label:"Ran command";return s.jsxs("div",{className:"self-start chat-msg-terminal","data-chat-activity-row":f.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx("span",{children:P}),s.jsx("span",{children:I})]}),v&&m?s.jsx("div",{className:"chat-msg-body",children:s.jsx(Er,{parts:m,renderAsPreformatted:!0})}):s.jsx("pre",{className:"chat-msg-body",children:b})]})}if(h==="system")return s.jsx("div",{className:"self-center chat-msg-system",children:v&&m?s.jsx(Er,{parts:m,renderAsPreformatted:!1}):b.slice(0,100)});const p=t.meta,y=(typeof(p==null?void 0:p.renderMode)=="string"?p.renderMode.trim():"")==="preformatted",x=b,N=!1,j=x,w=y,A=!w&&Yd(j),M=["chat-message-row",u?"chat-message-row-user self-end":"chat-message-row-assistant self-start"].join(" ");return s.jsx("div",{className:M,children:(x||v||u)&&s.jsxs("div",{className:`chat-bubble ${u?"chat-bubble-user":"chat-bubble-assistant"}`,children:[s.jsxs("div",{className:`chat-bubble-header ${x||v?"mb-1.5":"mb-0"}`,children:[s.jsx("span",{className:"chat-sender",children:u?a||"You":t.senderName||n}),r!=null&&s.jsx("span",{className:"chat-time",children:Xd(r)})]}),(x||v)&&s.jsx("div",{className:"chat-markdown",children:v&&m?s.jsx(Er,{parts:m,renderAsPreformatted:w}):w?s.jsx("pre",{className:"chat-preformatted",children:j}):A?s.jsx(Ro,{remarkPlugins:qd,children:j}):s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:j})}),N]})})},(e,t)=>e.message===t.message&&e.receivedAt===t.receivedAt&&e.agentName===t.agentName&&e.userName===t.userName&&e.isCliMode===t.isCliMode&&e.isTextExpanded===t.isTextExpanded),lx=c.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",userName:a,isCliMode:i=!1,isWorking:o=!1,contextKey:l="",receivedAtMap:d={},lastMessageHash:u,showActivityMessages:h=!1,emptyState:f,onLoadMore:m,isLoadingMore:v,hasMoreHistory:b,hiddenLiveCount:p=0,loadError:g,scrollToBottomRequestNonce:y,isVisible:x=!0},N){const j=c.useRef(null),w=c.useRef(null),A=c.useRef(null),M=c.useRef(0),S=c.useRef(""),k=c.useRef(""),O=c.useRef(!1),P=c.useRef(null),I=c.useRef(!1),W=c.useRef(null),K=c.useRef(!1),[R,T]=c.useState(new Set),[C,F]=c.useState({showTop:!1,showBottom:!1}),L=c.useRef(!1),D=c.useRef(!1),H=c.useRef(x),Q=c.useRef(x),ge=c.useRef(null);Q.current=x;const ue=()=>{const re=j.current;return re?re.scrollHeight-re.scrollTop-re.clientHeight<Ko:!0},Z=c.useCallback(()=>{const re=j.current,q=re?tx(re):{showTop:!1,showBottom:!1};F(je=>je.showTop===q.showTop&&je.showBottom===q.showBottom?je:q)},[]),xe=c.useCallback((re="auto")=>{var je;const q=j.current;q&&(q.scrollTo({top:q.scrollHeight,behavior:re}),(je=q.ownerDocument.defaultView)==null||je.requestAnimationFrame(()=>Z()))},[Z]),Se=c.useCallback((re="auto")=>{var je;const q=j.current;q&&(q.scrollTo({top:0,behavior:re}),(je=q.ownerDocument.defaultView)==null||je.requestAnimationFrame(()=>Z()))},[Z]),be=c.useCallback(()=>{var Pe;const re=j.current,q=(Pe=window.getSelection)==null?void 0:Pe.call(window);if(!re||!q||q.rangeCount===0||q.isCollapsed){K.current=!1;return}const je=q.anchorNode,we=q.focusNode;K.current=!!(je&&we&&re.contains(je)&&re.contains(we))},[]),Y=c.useMemo(()=>{const re=Gm(t),q=Vd(t);return qm(re,q,h)},[t,h]),he=Y.length===t.length?u:void 0,ye=Qm(Y,he),se=c.useCallback(()=>{const re=j.current;if(!re||!l||!Q.current)return;const q={top:re.scrollTop,fromBottom:Math.max(0,re.scrollHeight-re.scrollTop-re.clientHeight),messageFingerprint:ye};ge.current={contextKey:l,snapshot:q},Pr.set(l,q)},[l,ye]),de=c.useCallback((re="auto")=>{P.current!=null&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>{P.current=null,xe(re)})},[xe]),Ce=c.useCallback(()=>{L.current=!1,I.current=!0,D.current=!0,W.current!=null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{I.current=!1,W.current=null},Zc)},[]);c.useEffect(()=>{const re=!O.current,q=k.current!==l;if(k.current=l,re||q){O.current=!0;const we=l?Pr.get(l):null,Pe=!!we&&ha(we,ye);L.current=Pe?Xr(we):!1,I.current=sx(we,ye),K.current||(Pe?requestAnimationFrame(()=>{const Re=j.current;Re&&(ri(Re,we),L.current=Xr(we),Z(),D.current=!0)}):de("auto")),M.current=Y.length,S.current=ye;return}Y.length>M.current;const je=ye!==S.current;rx({hasSelection:K.current,userScrolledUp:L.current,hasChatContentChanged:je})&&de("auto"),M.current=Y.length,S.current=ye},[ye,l,Y.length,de,Z]),c.useEffect(()=>{y&&(Ce(),K.current||de("auto"))},[Ce,de,y]),c.useEffect(()=>{const re=H.current;re&&!x&&se(),Q.current=x,H.current=x;const q=l?Pr.get(l):null;if(Zm(re,x,q,ye)){if(!q)return;L.current=Xr(q),I.current=!1,K.current||requestAnimationFrame(()=>{const je=j.current;je&&(ri(je,q),Z())});return}},[x,l,ye,Ce,se,de,Z]),c.useEffect(()=>()=>{const re=ge.current;re&&Pr.set(re.contextKey,re.snapshot),P.current!=null&&cancelAnimationFrame(P.current),W.current!=null&&window.clearTimeout(W.current)},[]),c.useEffect(()=>{const re=w.current,q=j.current;if(!re||!q)return;const je=()=>{W.current!=null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{I.current=!1,W.current=null},Zc)},we=new ResizeObserver(()=>{Z();const Pe=I.current;nx({hasSelection:K.current,userScrolledUp:L.current,contextAutoScrollActive:Pe})&&(de("auto"),Pe&&je())});return we.observe(re),q!==re&&we.observe(q),()=>{we.disconnect(),W.current!=null&&(window.clearTimeout(W.current),W.current=null)}},[de,l,Z]),c.useImperativeHandle(N,()=>({scrollToBottom:(re="smooth")=>{xe(re)}}),[xe]),c.useEffect(()=>{const re=j.current;if(!re)return;let q;const je=()=>{se(),clearTimeout(q),q=setTimeout(()=>{L.current=!ue(),Z()},50)};return re.addEventListener("scroll",je,{passive:!0}),()=>{re.removeEventListener("scroll",je),clearTimeout(q)}},[se,Z]),c.useEffect(()=>(document.addEventListener("selectionchange",be),()=>document.removeEventListener("selectionchange",be)),[be]);const pe=c.useRef(0),me=c.useRef(!1);c.useEffect(()=>{const re=j.current;if(!re||!me.current||pe.current===0)return;const q=re.scrollHeight-pe.current;q>0&&(re.scrollTop=q),Z(),se(),pe.current=0,me.current=!1},[Y.length,se,Z]),c.useEffect(()=>{if(D.current||!l)return;const re=Pr.get(l),q=j.current;if(!(!re||!q)){if(!ha(re,ye)){xe("auto"),D.current=!0;return}ri(q,re),L.current=Xr(re),Z(),D.current=!0}},[l,ye,Y.length,xe,Z]);const oe=()=>{const re=j.current;re&&(pe.current=re.scrollHeight),me.current=!0,m==null||m()},fe=()=>{L.current=!0,Se("smooth"),se()},ce=()=>{Ce(),xe("smooth"),se()},E=c.useMemo(()=>{const re=Y.map((Pe,Re)=>({type:"message",data:Pe,index:Re,ts:ax(Pe,Re,d)}));if(!r||r.length===0)return re;const q=[...r].sort((Pe,Re)=>Pe.timestamp-Re.timestamp).map((Pe,Re)=>({type:"action",data:Pe,index:Re,ts:Pe.timestamp})),je=[];let we=0;for(const Pe of re){for(;we<q.length&&Pe.ts>0&&q[we].ts<Pe.ts;)je.push(q[we++]);je.push(Pe)}for(;we<q.length;)je.push(q[we++]);return je},[Y,r,d]),z=p>0||!!b,le=p>0?`↑ Show ${Math.min(p,80)} earlier messages${p>80?` (${p} hidden)`:""}`:g?`↻ ${g}`:"↑ Load older messages";return s.jsxs("div",{className:"chat-scroll-frame",children:[s.jsx("div",{ref:j,"data-chat-scroll":!0,className:"chat-container",children:s.jsxs("div",{ref:w,className:"chat-container-content",children:[v&&s.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60 animate-pulse",children:"Loading older messages..."}),z&&!v&&s.jsx("div",{className:"text-center py-2",children:s.jsx("button",{type:"button",onClick:oe,className:`text-[11px] rounded-xl px-4 py-1.5 cursor-pointer border transition-all ${g&&p===0?"bg-transparent border-yellow-500/30 text-yellow-400 opacity-80 hover:opacity-100":"bg-transparent border-border-subtle text-text-muted opacity-70 hover:opacity-100 hover:border-accent/40"}`,children:le})}),E.length===0&&!z&&(f||s.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),E.map(re=>{if(re.type==="action"){const Ae=re.data;return s.jsx(ox,{log:Ae},`action-${re.index}`)}const q=re.data,je=re.index,we=pa(q,je),Pe=q.receivedAt||d[we],Re=`${l}-${we}`,B=R.has(Re);return s.jsx(cx,{message:q,receivedAt:Pe,agentName:n,userName:a,isCliMode:i,isTextExpanded:B,onToggleTextExpanded:()=>T(Ae=>{const Ee=new Set(Ae);return B?Ee.delete(Re):Ee.add(Re),Ee})},`msg-${we}`)}),o&&s.jsx("div",{className:"self-start chat-typing-wrapper",children:s.jsxs("div",{className:"typing-indicator",children:[s.jsx("div",{className:"dot"}),s.jsx("div",{className:"dot"}),s.jsx("div",{className:"dot"}),s.jsx("span",{className:"text-[11px] text-text-muted ml-1",children:"Agent generating..."})]})}),s.jsx("div",{className:"min-h-10",ref:A})]})}),(C.showTop||C.showBottom)&&s.jsxs("div",{className:"chat-scroll-jump-controls","aria-label":"Chat scroll shortcuts",children:[C.showTop&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button",onClick:fe,"aria-label":"Jump to oldest messages",title:"Jump to top",children:"↑ Top"}),C.showBottom&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button chat-scroll-jump-button-primary",onClick:ce,"aria-label":"Jump to latest messages",title:"Jump to bottom",children:"↓ Latest"})]})]})}),dx=c.memo(lx,(e,t)=>e.messages===t.messages&&e.actionLogs===t.actionLogs&&e.agentName===t.agentName&&e.userName===t.userName&&e.isCliMode===t.isCliMode&&e.isWorking===t.isWorking&&e.contextKey===t.contextKey&&e.receivedAtMap===t.receivedAtMap&&e.lastMessageHash===t.lastMessageHash&&e.showActivityMessages===t.showActivityMessages&&e.emptyState===t.emptyState&&e.onLoadMore===t.onLoadMore&&e.isLoadingMore===t.isLoadingMore&&e.hasMoreHistory===t.hasMoreHistory&&e.hiddenLiveCount===t.hiddenLiveCount&&e.loadError===t.loadError&&e.scrollToBottomRequestNonce===t.scrollToBottomRequestNonce&&e.isVisible===t.isVisible),ux="modulepreload",hx=function(e){return"/"+e},tl={},px=function(t,r,n){let a=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));a=Promise.allSettled(r.map(d=>{if(d=hx(d),d in tl)return;tl[d]=!0;const u=d.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":ux,u||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((m,v)=>{f.addEventListener("load",m),f.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${d}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return a.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};let sl=!1;const Jd=c.forwardRef(({onInput:e,onViewportMetrics:t,onScrollMetrics:r,fontSize:n=13,readOnly:a=!1,sizingMode:i="measured"},o)=>{const l=c.useRef(null),[d,u]=c.useState(null),h=c.useRef([]),f=c.useRef(!1),m=c.useRef(!1),v=c.useRef(!1),b=c.useRef(!1),p=()=>{const g=l.current;if(g){f.current&&(g.clear(),f.current=!1);for(const y of h.current)g.write(y.data,y.onProcessed);h.current=[],m.current&&(g.fit(),m.current=!1),v.current&&(g.bumpResize(),v.current=!1),b.current&&(g.scrollToTop(),b.current=!1)}};return c.useImperativeHandle(o,()=>({write:(g,y)=>{l.current?l.current.write(g,y):h.current.push({data:g,onProcessed:y})},clear:()=>{l.current?l.current.clear():(h.current=[],f.current=!0)},reset:()=>{l.current&&typeof l.current.reset=="function"?l.current.reset():(h.current=[],f.current=!0)},resize:(g,y)=>{l.current&&typeof l.current.resize=="function"&&l.current.resize(g,y)},fit:()=>{l.current?l.current.fit():m.current=!0},bumpResize:()=>{l.current?l.current.bumpResize():v.current=!0},scrollToTop:()=>{l.current?l.current.scrollToTop():b.current=!0},getSelection:()=>{var g,y;return((y=(g=l.current)==null?void 0:g.getSelection)==null?void 0:y.call(g))||""},getVisibleText:()=>{var g,y;return((y=(g=l.current)==null?void 0:g.getVisibleText)==null?void 0:y.call(g))||""}}),[]),c.useEffect(()=>{d&&p()},[d]),c.useEffect(()=>{let g=!1;return px(()=>import("./terminal-DeDH5nlv.js"),__vite__mapDeps([0,1,2])).then(y=>{sl||(sl=!0,console.info("[CliTerminal] renderer module loaded: terminal-render-web")),g||u(()=>y.GhosttyTerminalView)}).catch(y=>{console.error("[CliTerminal] failed to load terminal renderer",y)}),()=>{g=!0}},[]),d?s.jsx(d,{ref:l,onInput:e,onViewportMetrics:t,onScrollMetrics:r,fontSize:n,readOnly:a,sizingMode:i,className:"w-full h-full rounded-lg overflow-hidden"}):s.jsx("div",{className:"w-full h-full rounded-lg overflow-hidden animate-pulse",style:{background:"#0f1117"}})});Jd.displayName="CliTerminal";function Ln({label:e,value:t,sub:r,icon:n}){return s.jsxs("div",{className:"px-4 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx("span",{className:"text-base flex items-center",children:n}),s.jsx("span",{className:"text-[10px] text-text-muted uppercase tracking-wide font-semibold",children:e})]}),s.jsx("div",{className:"text-[22px] font-bold text-text-primary tracking-tight",children:t}),r&&s.jsx("div",{className:"text-[11px] text-text-muted mt-0.5",children:r})]})}function rl({value:e,max:t,label:r,color:n="#8b5cf6",detail:a,compact:i=!1}){const o=t>0?Math.min(Math.round(e/t*100),100):0,l=o>85?"#ef4444":o>60?"var(--status-warning)":n;return i?s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex justify-between mb-0.5",children:[s.jsx("span",{className:"text-[9px] text-text-muted uppercase tracking-wide font-semibold",children:r}),s.jsxs("span",{className:"text-[10px] text-text-secondary font-semibold",children:[o,"%"]})]}),s.jsx("div",{className:"h-1 bg-white/[0.04] rounded-sm overflow-hidden",children:s.jsx("div",{className:"h-full rounded-sm transition-[width] duration-500",style:{width:`${o}%`,background:l}})})]}):s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex justify-between mb-1.5",children:[s.jsx("span",{className:"text-[11px] text-text-secondary font-medium",children:r}),s.jsxs("span",{className:"text-[13px] text-text-primary font-bold",children:[o,"%"]})]}),s.jsx("div",{className:"h-1.5 bg-white/[0.04] rounded-sm overflow-hidden",children:s.jsx("div",{className:"h-full rounded-sm transition-[width] duration-[600ms]",style:{width:`${o}%`,background:`linear-gradient(90deg, ${l}, ${l}cc)`}})}),a&&s.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:a})]})}function fx({cursorPos:e,viewportRef:t,imgRef:r}){var x;if(!e||!r.current)return null;const n=r.current,a=n.getBoundingClientRect(),i=(x=t.current)==null?void 0:x.getBoundingClientRect();if(!i)return null;const o=n.naturalWidth||a.width,l=n.naturalHeight||a.height,d=o/l,u=a.width/a.height;let h,f,m,v;d>u?(h=a.width,f=a.width/d,m=0,v=(a.height-f)/2):(f=a.height,h=a.height*d,m=(a.width-h)/2,v=0);const b=a.left-i.left+m+h*e.nx,p=a.top-i.top+v+f*e.ny,g=Math.max(8,Math.min(i.width-8,b)),y=Math.max(8,Math.min(i.height-8,p));return s.jsxs("div",{style:{position:"absolute",left:g-8,top:y-8,width:16,height:16,pointerEvents:"none",zIndex:100},children:[s.jsx("div",{style:{position:"absolute",left:7,top:0,width:2,height:16,background:"rgba(59,130,246,0.8)"}}),s.jsx("div",{style:{position:"absolute",left:0,top:7,width:16,height:2,background:"rgba(59,130,246,0.8)"}}),s.jsx("div",{style:{position:"absolute",left:5,top:5,width:6,height:6,borderRadius:"50%",background:"#3b82f6",boxShadow:"0 0 8px rgba(59,130,246,0.6)"}})]})}function mx({inputMode:e,onToggleInputMode:t,isImeOpen:r,setIsImeOpen:n,isMenuOpen:a,setIsMenuOpen:i,imeText:o,setImeText:l,handleImeSubmit:d,isConnActive:u,zoom:h,isMobile:f,mobileFillZoom:m,onZoomOut:v,onZoomReset:b,onZoomIn:p,transportType:g,screenshotUsage:y,lastActionStatus:x}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{onTouchStart:N=>N.stopPropagation(),className:"absolute bottom-0 left-0 right-0 z-20 flex items-center justify-center gap-1.5 px-3 py-2 bg-black/75 backdrop-blur-xl border-t border-white/[0.08] touch-none",children:[s.jsxs("div",{onClick:t,className:`h-8 px-2.5 rounded-lg flex items-center gap-[5px] cursor-pointer ${e==="mouse"?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:[s.jsx("span",{className:"text-sm",children:e==="mouse"?"🖱️":"👆"}),s.jsx("span",{className:`text-[10px] font-bold ${e==="mouse"?"text-blue-400":"text-slate-400"}`,children:e==="mouse"?"Mouse":"Touch"})]}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{onClick:()=>{n(N=>!N),i(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${r?"bg-emerald-500/25 border border-emerald-500/40":"bg-white/[0.08] border border-white/10"}`,children:s.jsx("span",{className:"text-sm",children:"⌨️"})}),r&&s.jsx("div",{className:"absolute bottom-10 left-1/2 -translate-x-1/2 w-[220px] bg-neutral-950/[0.98] backdrop-blur-[30px] rounded-xl border border-white/20 p-[10px_12px] shadow-[0_10px_30px_rgba(0,0,0,0.8)] flex flex-col gap-2 z-20",style:{animation:"slideUp 0.15s ease-out"},children:s.jsx("input",{type:"text",placeholder:"Type & Enter...",value:o,autoFocus:!0,onTouchStart:N=>N.stopPropagation(),onChange:N=>l(N.target.value),onKeyDown:N=>{d(N)},className:"w-full bg-black/60 border border-white/15 rounded-lg px-2.5 py-2 text-white text-[13px] outline-none"})})]}),s.jsx("div",{className:"relative",children:s.jsx("div",{onClick:()=>{i(N=>!N),n(!1)},className:`w-8 h-8 rounded-lg flex items-center justify-center cursor-pointer ${a?"bg-blue-500/25 border border-blue-500/40":"bg-white/[0.08] border border-white/10"}`,children:s.jsx("span",{className:"text-sm",children:"⚙️"})})}),s.jsx("div",{className:"w-px h-[18px] bg-white/10"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 rounded-md",style:{background:u?"rgba(34,197,94,0.12)":"rgba(234,179,8,0.12)"},children:[s.jsx("div",{className:"w-1 h-1 rounded-full",style:{background:u?"#22c55e":"#eab308",boxShadow:u?"0 0 4px #22c55e80":"0 0 4px #eab30880"}}),s.jsx("span",{className:"text-[8px] font-extrabold",style:{color:u?"#22c55e":"#eab308"},children:u?"Connected":"WS"})]}),h>1&&s.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(h*100),"%"]}),g==="direct"&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:"#22c55e",background:"rgba(34,197,94,0.12)"},title:"Direct P2P connection",children:"Direct"}),g==="relay"&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:"var(--status-warning)",background:"color-mix(in srgb, var(--status-warning) 12%, transparent)"},title:"TURN relay in use",children:"Relay"}),y&&y.dailyBudgetMinutes>0&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:y.budgetExhausted?"#ef4444":"#c4b5fd",background:y.budgetExhausted?"rgba(239,68,68,0.1)":"rgba(139,92,246,0.14)"},title:"Daily TURN relay usage",children:y.budgetExhausted?"TURN blocked":`TURN ${y.dailyUsedMinutes}/${y.dailyBudgetMinutes}m`}),x&&s.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:x})]})]}),a&&s.jsxs("div",{onTouchStart:N=>N.stopPropagation(),style:{position:"absolute",bottom:56,left:"50%",transform:"translateX(-50%)",width:220,background:"rgba(23, 23, 23, 0.95)",backdropFilter:"blur(25px)",borderRadius:14,border:"1px solid rgba(255,255,255,0.1)",padding:14,boxShadow:"0 12px 40px rgba(0,0,0,0.6)",display:"flex",flexDirection:"column",gap:12,zIndex:20,touchAction:"none",animation:"slideUpSidebar 0.15s ease-out"},children:[s.jsx("div",{style:{fontSize:9,fontWeight:900,color:"#3b82f6",letterSpacing:1.5},children:"SETTINGS"}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[s.jsxs("div",{style:{fontSize:10,color:"#888",fontWeight:700},children:["ZOOM: ",h<=(f?m:1)+.01?f?"FILL":"FIT":`${Math.round(h*100)}%`]}),s.jsxs("div",{style:{display:"flex",gap:4},children:[s.jsx("button",{onClick:N=>{N.stopPropagation(),v()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"−"}),s.jsx("button",{onClick:N=>{N.stopPropagation(),b()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:9,fontWeight:800,cursor:"pointer"},children:f?"FILL":"FIT"}),s.jsx("button",{onClick:N=>{N.stopPropagation(),p()},style:{flex:1,background:"rgba(255,255,255,0.1)",color:"#fff",border:"none",padding:"6px",borderRadius:6,fontSize:12,fontWeight:800,cursor:"pointer"},children:"+"})]})]})]})]})}function xx({waitingLabel:e,waitingHint:t,transportType:r}){return s.jsxs("div",{className:"text-center flex flex-col items-center gap-3 px-6",children:[s.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center border border-white/10 bg-white/[0.04] shadow-[0_10px_30px_rgba(0,0,0,0.35)]",style:{animation:"remote-float 2.8s ease-in-out infinite"},children:s.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-8 h-8 opacity-90"})}),s.jsx("div",{className:"text-white/85 text-[13px] font-semibold tracking-wide",children:e}),s.jsx("div",{className:"text-[11px] text-white/40",children:t}),r==="relay"&&s.jsx("div",{className:"text-[10px] font-medium",style:{color:"var(--status-warning)",opacity:.8},children:"TURN relay active"})]})}function gx(){if(typeof window>"u")return!1;try{return window.__ADHDEV_DEBUG_RENDERS__===!0||window.localStorage.getItem("adhdev_debug_renders")==="1"}catch{return window.__ADHDEV_DEBUG_RENDERS__===!0}}function nl(e){return e==null||typeof e=="number"||typeof e=="boolean"?e:typeof e=="string"?e.length>64?`${e.slice(0,61)}...`:e:Array.isArray(e)?`Array(${e.length})`:typeof e=="object"?"Object":typeof e}function wn(e,t){const r=c.useRef(null),n=c.useRef(0);c.useEffect(()=>{if(!gx())return;n.current+=1;const a=r.current;if(!a){console.debug(`[render-trace] ${e}#${n.current}`,{changed:["mount"],snapshot:Object.fromEntries(Object.entries(t).map(([o,l])=>[o,nl(l)]))}),r.current=t;return}const i=Object.keys({...a,...t}).filter(o=>!Object.is(a[o],t[o]));i.length>0&&console.debug(`[render-trace] ${e}#${n.current}`,{changed:i,snapshot:Object.fromEntries(i.map(o=>[o,nl(t[o])]))}),r.current=t})}function bx({containerRef:e,viewportRef:t,imgRef:r,inputMode:n,setInputMode:a,minZoom:i,zoomRef:o,panXRef:l,panYRef:d,setPanX:u,setPanY:h,setZoom:f,lastWheelTimeRef:m,onAction:v,setLastActionStatus:b,spawnRippleFromNormalized:p,clampPan:g,isMobile:y,mobileFillZoom:x}){const[N,j]=c.useState(null),w=c.useRef(null),A=c.useRef(null),M=c.useRef(null),S=c.useRef(!1),k=c.useRef(null),O=c.useRef(0),P=c.useRef(null),I=c.useRef(1),W=c.useRef({x:0,y:0}),K=c.useRef(!1),R=c.useRef(n),T=c.useRef(v),C=30,F=550,L=18,D=60,H=400,Q=12,ge=()=>{if(w.current)return;const xe={nx:.5,ny:.5};w.current=xe,j(xe)};return c.useEffect(()=>{R.current=n,n==="mouse"&&ge()},[n]),c.useEffect(()=>{T.current=v},[v]),c.useEffect(()=>{const xe=e.current;if(!xe)return;const Se=de=>{if(!r.current)return null;const Ce=r.current.getBoundingClientRect();return!Ce.width||!Ce.height?null:{nx:Math.max(0,Math.min(1,(de.clientX-Ce.left)/Ce.width)),ny:Math.max(0,Math.min(1,(de.clientY-Ce.top)/Ce.height))}},be=(de,Ce)=>{if(!r.current)return{dnx:0,dny:0};const pe=r.current,me=pe.getBoundingClientRect(),oe=pe.naturalWidth||me.width,fe=pe.naturalHeight||me.height,ce=oe/fe,E=me.width/me.height;let z,le;return ce>E?(z=me.width,le=me.width/ce):(le=me.height,z=me.height*ce),{dnx:de/z,dny:Ce/le}},Y=(de,Ce,pe)=>{if(pe<=1.05)return;const me=-(de-.5)*100,oe=-(Ce-.5)*100,fe=g(me,oe,pe);(Math.abs(fe.x-l.current)>.1||Math.abs(fe.y-d.current)>.1)&&(u(fe.x),h(fe.y),l.current=fe.x,d.current=fe.y)},he=de=>{const Ce=t.current;if(Ce&&de.target instanceof Node&&Ce.contains(de.target))de.preventDefault();else return;if(de.touches.length===1){const pe=de.touches[0];A.current={x:pe.clientX,y:pe.clientY,time:Date.now()},M.current={x:pe.clientX,y:pe.clientY},K.current||(S.current=!1),k.current=setTimeout(()=>{if(!S.current&&!K.current)if(S.current=!0,R.current==="mouse"){const me=w.current||{nx:.5,ny:.5};b("Right Click"),p(me.nx,me.ny,"right"),T.current("input_click",{...me,button:"right"}).catch(()=>{})}else{const me=Se(pe);me&&(b("Right Click"),p(me.nx,me.ny,"right"),T.current("input_click",{...me,button:"right"}).catch(()=>{}))}},500);return}if(de.touches.length===2){k.current&&clearTimeout(k.current),S.current=!0,K.current=!0;const pe=de.touches[1].clientX-de.touches[0].clientX,me=de.touches[1].clientY-de.touches[0].clientY;P.current=Math.sqrt(pe*pe+me*me),I.current=o.current,W.current={x:(de.touches[0].clientX+de.touches[1].clientX)/2,y:(de.touches[0].clientY+de.touches[1].clientY)/2}}},ye=de=>{const Ce=t.current;if(Ce&&de.target instanceof Node&&Ce.contains(de.target)&&de.preventDefault(),de.touches.length===1&&M.current){const pe=de.touches[0],me=pe.clientX-M.current.x,oe=pe.clientY-M.current.y;if(!S.current&&A.current){const fe=pe.clientX-A.current.x,ce=pe.clientY-A.current.y;Math.sqrt(fe*fe+ce*ce)>8&&(S.current=!0,k.current&&clearTimeout(k.current))}if(S.current)if(R.current==="mouse"){const fe=be(me,oe),ce=w.current||{nx:.5,ny:.5},E=Math.max(0,Math.min(1,ce.nx+fe.dnx)),z=Math.max(0,Math.min(1,ce.ny+fe.dny));w.current={nx:E,ny:z},j({nx:E,ny:z}),b(`Cursor: ${Math.round(E*100)}%, ${Math.round(z*100)}%`),Y(E,z,o.current);const le=Date.now();le-m.current>=30&&(m.current=le,T.current("input_mouseMoved",{nx:E,ny:z}).catch(()=>{}))}else if(o.current>1){const fe=t.current;if(fe){const ce=fe.clientWidth,E=fe.clientHeight,z=l.current+me/ce*100,le=d.current+oe/E*100,re=g(z,le,o.current);u(re.x),h(re.y),l.current=re.x,d.current=re.y}}else{const fe=Se(pe);if(fe){const ce=Date.now();ce-m.current>=40&&(m.current=ce,b("Scroll"),T.current("input_wheel",{nx:fe.nx,ny:fe.ny,deltaX:Math.round(-me*2.5),deltaY:Math.round(-oe*2.5)}).catch(()=>{}))}}M.current={x:pe.clientX,y:pe.clientY};return}if(de.touches.length===2&&P.current!==null){const pe=de.touches[1].clientX-de.touches[0].clientX,me=de.touches[1].clientY-de.touches[0].clientY,fe=Math.sqrt(pe*pe+me*me)/P.current,ce=(de.touches[0].clientX+de.touches[1].clientX)/2,E=(de.touches[0].clientY+de.touches[1].clientY)/2,z=ce-W.current.x,le=E-W.current.y,re=Math.abs(fe-1)>.03;if(R.current==="mouse"){if(re){const q=Math.max(i,Math.min(5,I.current*fe));f(q),o.current=q}else if(Math.abs(z)>2||Math.abs(le)>2){const q=w.current||{nx:.5,ny:.5},je=Date.now();je-m.current>=30&&(m.current=je,b("Scroll"),T.current("input_wheel",{nx:q.nx,ny:q.ny,deltaX:Math.round(-z*3),deltaY:Math.round(-le*3)}).catch(()=>{}))}}else{const q=Math.max(i,Math.min(5,I.current*fe));f(q),o.current=q;const je=t.current;if(je&&q>1){const we=je.clientWidth,Pe=je.clientHeight,Re=l.current+z/we*100,B=d.current+le/Pe*100,Ae=g(Re,B,q);u(Ae.x),h(Ae.y),l.current=Ae.x,d.current=Ae.y}}W.current={x:ce,y:E}}},se=de=>{var Ce;if(k.current&&clearTimeout(k.current),P.current=null,de.touches.length===1&&K.current){const pe=de.touches[0];A.current={x:pe.clientX,y:pe.clientY,time:Date.now()},M.current={x:pe.clientX,y:pe.clientY},S.current=!0;return}if(de.touches.length===0){if(K.current){K.current=!1,S.current=!1;return}if(de.changedTouches.length===1){const pe=de.changedTouches[0],me=Date.now(),oe=me-(((Ce=A.current)==null?void 0:Ce.time)||0),fe=A.current?pe.clientX-A.current.x:0,ce=A.current?pe.clientY-A.current.y:0,E=Math.sqrt(fe*fe+ce*ce);if(R.current==="mouse"){if(oe<C||oe>F||E>L){S.current=!1;return}const z=w.current||Se(pe);z&&(b(`Click: ${Math.round(z.nx*100)}%, ${Math.round(z.ny*100)}%`),p(z.nx,z.ny,"left"),T.current("input_click",{...z}).catch(()=>{}))}else{if(S.current){S.current=!1;return}if(oe<D||oe>H||E>Q){S.current=!1;return}const z=Se(pe);if(!z)return;me-O.current<300?(b("Double tap"),p(z.nx,z.ny,"double"),T.current("input_click",{...z,clickCount:2}).catch(()=>{}),O.current=0):(b(`Tap: ${Math.round(z.nx*100)}%, ${Math.round(z.ny*100)}%`),p(z.nx,z.ny,"left"),T.current("input_click",{...z}).catch(()=>{}),O.current=me)}}S.current=!1}};return xe.addEventListener("touchstart",he,{passive:!1}),xe.addEventListener("touchmove",ye,{passive:!1}),xe.addEventListener("touchend",se,{passive:!1}),()=>{xe.removeEventListener("touchstart",he),xe.removeEventListener("touchmove",ye),xe.removeEventListener("touchend",se),k.current&&clearTimeout(k.current)}},[e,t,r,i,o,l,d,u,h,f,m,b,p,g]),{cursorPos:N,cursorPosRef:w,handleToggleInputMode:()=>{a(xe=>{const Se=xe==="touch"?"mouse":"touch";return Se==="mouse"&&ge(),Se})},handleZoomReset:()=>{const xe=y?x:1;f(xe),o.current=xe,u(0),h(0),l.current=0,d.current=0}}}function Qd({onAction:e,addLog:t,connState:r,connScreenshot:n,screenshotUsage:a,transportType:i}){const o=c.useRef(null),l=c.useRef(null),d=c.useRef(null),[u,h]=c.useState(null),[f,m]=c.useState(""),[,v]=c.useState(!1),[b,p]=c.useState([]),g=c.useRef(0),[y,x]=c.useState(!1),[N,j]=c.useState(!1),w=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[A,M]=c.useState(w?"mouse":"touch"),[S,k]=c.useState(1),O=c.useRef(!1),[P,I]=c.useState(1),[W,K]=c.useState(0),[R,T]=c.useState(0);wn("RemoteView",{connState:r,hasScreenshot:!!n,inputMode:A,zoom:P,panX:W,panY:R,isMenuOpen:y,isImeOpen:N});const C=c.useRef(0),F=c.useRef(P),L=c.useRef(W),D=c.useRef(R);c.useEffect(()=>{F.current=P},[P]),c.useEffect(()=>{L.current=W},[W]),c.useEffect(()=>{D.current=R},[R]),c.useEffect(()=>{var oe;(oe=o.current)==null||oe.focus()},[]);const H=r==="connected",Q=n,ge=H?"Connected. Waiting for first frame...":r==="connecting"?"Connecting to Host...":"Reconnecting to Host...",ue=H?"The remote stream is warming up":"Waiting for the remote stream to catch up";c.useEffect(()=>{if(!w||O.current||!Q)return;const oe=d.current,fe=l.current;if(!oe||!fe)return;const ce=()=>{const E=fe.clientWidth,z=fe.clientHeight,le=oe.naturalWidth,re=oe.naturalHeight;if(!le||!re||!E||!z)return;const q=Math.min(E/le,z/re),we=Math.max(E/le,z/re)/q;we>1.01&&(k(we),I(we),F.current=we),O.current=!0};oe.complete&&oe.naturalWidth?ce():oe.addEventListener("load",ce,{once:!0})},[Q,w]);const Z=.5;c.useEffect(()=>{P<=Z&&(K(0),T(0))},[P,Z]);const xe=(oe,fe,ce)=>{if(ce<=Z)return{x:0,y:0};const E=(ce-1)/(2*ce)*100,z=(ce-1)/(2*ce)*100;return{x:Math.max(-E,Math.min(E,oe)),y:Math.max(-z,Math.min(z,fe))}},Se=(oe,fe)=>{if(!d.current)return null;const ce=d.current.getBoundingClientRect();return!ce.width||!ce.height?null:{nx:Math.max(0,Math.min(1,(oe-ce.left)/ce.width)),ny:Math.max(0,Math.min(1,(fe-ce.top)/ce.height))}},be=(oe,fe,ce)=>{const E=l.current;if(!E)return;const z=E.getBoundingClientRect(),le=++g.current;p(re=>[...re,{id:le,x:oe-z.left,y:fe-z.top,type:ce}]),setTimeout(()=>p(re=>re.filter(q=>q.id!==le)),600)},Y=(oe,fe,ce)=>{const E=d.current,z=l.current;if(!E||!z)return;const le=E.getBoundingClientRect(),re=z.getBoundingClientRect(),q=E.naturalWidth||le.width,je=E.naturalHeight||le.height,we=q/je,Pe=le.width/le.height;let Re,B,Ae,Ee;we>Pe?(Re=le.width,B=le.width/we,Ae=0,Ee=(le.height-B)/2):(B=le.height,Re=le.height*we,Ae=(le.width-Re)/2,Ee=0);const Ve=le.left-re.left+Ae+Re*oe,Ge=le.top-re.top+Ee+B*fe,Ze=++g.current;p(et=>[...et,{id:Ze,x:Ve,y:Ge,type:ce}]),setTimeout(()=>p(et=>et.filter(at=>at.id!==Ze)),600)},he=async oe=>{var ce;const fe=Se(oe.clientX,oe.clientY);if(fe){h(`Click: ${Math.round(fe.nx*100)}%, ${Math.round(fe.ny*100)}%`),be(oe.clientX,oe.clientY,"left"),(ce=o.current)==null||ce.focus();try{const E=await e("input_click",{nx:fe.nx,ny:fe.ny});E!=null&&E.success||t(`❌ Click failed: ${E==null?void 0:E.error}`)}catch(E){t(`❌ Click error: ${E.message||E}`)}}},ye=async(oe,fe,ce,E=0)=>{try{await e("input_key",{type:ce?"char":"keyDown",key:oe,code:fe,text:ce?oe:void 0,unmodifiedText:ce?oe:void 0,modifiers:E})}catch(z){t(`❌ Key error: ${z.message||z}`)}},se=async oe=>{if(oe.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(oe.key)&&oe.preventDefault();let ce=0;oe.altKey&&(ce|=1),oe.ctrlKey&&(ce|=2),oe.metaKey&&(ce|=4),oe.shiftKey&&(ce|=8),h(`Key: ${oe.key}`),await ye(oe.key,oe.code,oe.key.length===1,ce)},de=async oe=>{if(oe.key==="Enter"){if(oe.nativeEvent.isComposing)return;if(f){const fe=f;m(""),h(`IME Sent: ${fe}`);try{const ce=await e("input_type",{text:fe});ce!=null&&ce.success||t(`❌ IME error: ${ce==null?void 0:ce.error}`)}catch(ce){t(`❌ IME error: ${ce.message}`)}}else h("Key: Enter"),await ye("Enter","Enter",!1)}};c.useEffect(()=>{const oe=o.current;if(!oe)return;const fe=ce=>{var E;if((E=d.current)!=null&&E.contains(ce.target)){ce.preventDefault();const z=Date.now();if(z-C.current<40)return;C.current=z;const le=Se(ce.clientX,ce.clientY);if(!le)return;h(`Scroll: ${Math.round(ce.deltaY)}`),e("input_wheel",{nx:le.nx,ny:le.ny,deltaX:Math.round(ce.deltaX),deltaY:Math.round(ce.deltaY)}).catch(()=>{})}};return oe.addEventListener("wheel",fe,{passive:!1}),()=>oe.removeEventListener("wheel",fe)},[e]);const{cursorPos:Ce,handleToggleInputMode:pe,handleZoomReset:me}=bx({containerRef:o,viewportRef:l,imgRef:d,inputMode:A,setInputMode:M,minZoom:Z,zoomRef:F,panXRef:L,panYRef:D,setPanX:K,setPanY:T,setZoom:I,lastWheelTimeRef:C,onAction:e,setLastActionStatus:h,spawnRippleFromNormalized:Y,clampPan:xe,isMobile:w,mobileFillZoom:S});return s.jsxs("div",{ref:o,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:se,onContextMenu:oe=>oe.preventDefault(),onFocus:()=>v(!0),onBlur:()=>v(!1),tabIndex:0,children:[s.jsxs("div",{ref:l,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[Q?s.jsx("img",{ref:d,src:Q,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${P}) translate(${W}%, ${R}%)`,transformOrigin:"center center",cursor:A==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:he,onContextMenu:oe=>oe.preventDefault(),onDragStart:oe=>oe.preventDefault()}):s.jsx(xx,{waitingLabel:ge,waitingHint:ue,transportType:i}),A==="mouse"&&Q&&s.jsx(fx,{cursorPos:Ce,viewportRef:l,imgRef:d}),b.map(oe=>{const ce={left:"59,130,246",right:"239,68,68",double:"34,197,94"}[oe.type];return s.jsxs("div",{style:{position:"absolute",left:oe.x,top:oe.y,pointerEvents:"none",zIndex:200,transform:"translate(-50%, -50%)"},children:[s.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`2px solid rgba(${ce}, 0.8)`,animation:"click-ripple-ring 0.5s ease-out forwards",position:"absolute",left:-20,top:-20}}),s.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:`rgba(${ce}, 0.9)`,boxShadow:`0 0 12px rgba(${ce}, 0.6)`,animation:"click-ripple-dot 0.4s ease-out forwards",position:"absolute",left:-4,top:-4}})]},oe.id)})]}),s.jsx(mx,{inputMode:A,onToggleInputMode:pe,isImeOpen:N,setIsImeOpen:j,isMenuOpen:y,setIsMenuOpen:x,imeText:f,setImeText:m,handleImeSubmit:de,isConnActive:H,zoom:P,isMobile:w,mobileFillZoom:S,onZoomOut:()=>I(oe=>Math.max(.5,oe-.25)),onZoomReset:me,onZoomIn:()=>I(oe=>Math.min(5,oe+.25)),transportType:i,screenshotUsage:a,lastActionStatus:u}),s.jsx("style",{children:`
7
7
  @keyframes slideUp {
8
8
  from { opacity: 0; transform: translateY(6px); }
9
9
  to { opacity: 1; transform: translateY(0); }
@@ -109,7 +109,7 @@ void main() {
109
109
  * Fabrice Bellard's javascript vt100 for jslinux:
110
110
  * http://bellard.org/jslinux/
111
111
  * Copyright (c) 2011 Fabrice Bellard
112
- */var zu=2,Hu=1,Uu=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){var d;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:((d=this._terminal.options.overviewRuler)==null?void 0:d.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},h=o.top+o.bottom,l=o.right+o.left,a=s-h,c=r-l-e;return{cols:Math.max(zu,Math.floor(c/t.css.cell.width)),rows:Math.max(Hu,Math.floor(a/t.css.cell.height))}}},Ku=80,Co=32;const yo={background:"#0f1117",foreground:"#cdd6f4",cursor:"#f38ba8",cursorAccent:"#0f1117",selectionBackground:"rgba(166, 227, 161, 0.3)",selectionForeground:"#cdd6f4",black:"#45475a",red:"#f38ba8",green:"#a6e3a1",yellow:"#f9e2af",blue:"#89b4fa",magenta:"#cba6f7",cyan:"#94e2d5",white:"#bac2de",brightBlack:"#585b70",brightRed:"#f38ba8",brightGreen:"#a6e3a1",brightYellow:"#f9e2af",brightBlue:"#89b4fa",brightMagenta:"#cba6f7",brightCyan:"#94e2d5",brightWhite:"#a6adc8"},xo=8,ko=14,qu=5e4,Vu=`
112
+ */var zu=2,Hu=1,Uu=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){var d;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:((d=this._terminal.options.overviewRuler)==null?void 0:d.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},h=o.top+o.bottom,l=o.right+o.left,a=s-h,c=r-l-e;return{cols:Math.max(zu,Math.floor(c/t.css.cell.width)),rows:Math.max(Hu,Math.floor(a/t.css.cell.height))}}};const Ku=80,Co=32,yo={background:"#0f1117",foreground:"#cdd6f4",cursor:"#f38ba8",cursorAccent:"#0f1117",selectionBackground:"rgba(166, 227, 161, 0.3)",selectionForeground:"#cdd6f4",black:"#45475a",red:"#f38ba8",green:"#a6e3a1",yellow:"#f9e2af",blue:"#89b4fa",magenta:"#cba6f7",cyan:"#94e2d5",white:"#bac2de",brightBlack:"#585b70",brightRed:"#f38ba8",brightGreen:"#a6e3a1",brightYellow:"#f9e2af",brightBlue:"#89b4fa",brightMagenta:"#cba6f7",brightCyan:"#94e2d5",brightWhite:"#a6adc8"},xo=8,ko=14,qu=5e4,Vu=`
113
113
  .adhdev-terminal-renderer .xterm-viewport {
114
114
  scrollbar-width: thin;
115
115
  scrollbar-color: rgba(137, 180, 250, 0.45) rgba(255, 255, 255, 0.04);
package/public/index.html CHANGED
@@ -7,7 +7,7 @@
7
7
  <meta name="description" content="ADHDev self-hosted dashboard for controlling AI agents" />
8
8
  <link rel="icon" href="/otter-logo.png" />
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" />
10
- <script type="module" crossorigin src="/assets/index-m6K5hfST.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-DrOZKxcS.js"></script>
11
11
  <link rel="modulepreload" crossorigin href="/assets/vendor-BoAU5RMW.js">
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-01wE493H.css">
13
13
  </head>