@adhdev/daemon-standalone 0.9.82-rc.33 → 0.9.82-rc.34
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,9 +1,9 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-D46M5EWH.js","assets/vendor-CgiI0UIA.js","assets/terminal-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var im=Object.defineProperty;var lm=(e,t,r)=>t in e?im(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ze=(e,t,r)=>lm(e,typeof t!="symbol"?t+"":t,r);import{r as i,j as s,M as Io,a as cm,b as dm,c as um,R as Nt,d as Tr,t as mm,e as pm,u as As,D as hm,f as eo,g as to,i as fm,h as xm,C as bm,B as gm,k as ym,l as vm,H as ki,P as Si,m as wm,n as jm,o as To,p as km,q as Sm,s as Nm,v as Cm,w as rs,N as so,x as Im}from"./vendor-CgiI0UIA.js";(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 o of a)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function r(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(a){if(a.ep)return;a.ep=!0;const o=r(a);fetch(a.href,o)}})();function Tm(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(o=>!n.interactionId||o.interactionId===n.interactionId).filter(o=>!n.topic||o.topic===n.topic).filter(o=>!n.kind||o.kind===n.kind).slice(-a).map(o=>({...o,payload:o.payload?{...o.payload}:{}}))},clear(){r.splice(0,r.length)}}}const Hs=Tm();function Ni(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 Mm(e,t){return typeof e=="string"&&e.trim().length>0&&e!==t}function Ci(e){return Array.isArray(e)?[...e]:[]}function cc(e,t){if(!e)return t??null;const r=Object.prototype.hasOwnProperty.call(e,"messages"),n=Object.prototype.hasOwnProperty.call(e,"activeModal");return t?{...t,...e,messages:r?Ci(e.messages):t.messages,activeModal:n?e.activeModal??null:t.activeModal,inputContent:e.inputContent??t.inputContent}:{...e,...r?{messages:Ci(e.messages)}:{},...n?{activeModal:e.activeModal??null}:{}}}function br(e,t){const r=Mm(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:cc(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 dc(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 o=e.find(l=>l.id===a.id);return o?br(a,o):a});if((r==null?void 0:r.preserveMissing)!==!1){const a=new Set(t.map(o=>o.id));for(const o of e)a.has(o.id)||n.push(o)}return n}function Ii(e){return!!e&&typeof e=="object"&&"text"in e}function Mo(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(o=>typeof o=="string"?o:Ii(o)?String(o.text||""):"").join(r):Ii(e)?a=String(e.text||""):a=String(e||""),n?a.replace(/\s+/g," ").trim():a}function Us(e){return Mo(e,{normalizeWhitespace:!0})}const uc=i.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}),mc=i.createContext({injectEntries:()=>{},markLoaded:()=>{},getIdes:()=>[]});function Ti(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 pc(e,t,r){if(r.type!=="adhdev-daemon")return r;const n={...r},a=t.version??r.version??e.version,o=t.serverVersion??e.serverVersion??r.serverVersion,l=t.versionMismatch===!0||e.versionMismatch===!0,c=t.versionUpdateRequired===!0||e.versionUpdateRequired===!0,d=t.versionUpdateReason??e.versionUpdateReason??r.versionUpdateReason;return a&&(n.version=a),o&&(n.serverVersion=o),d&&(n.versionUpdateReason=d),a&&o&&a===o?(delete n.versionMismatch,delete n.serverVersion,delete n.versionUpdateRequired,delete n.versionUpdateReason,n):((t.versionMismatch===!0||l&&a&&o&&a!==o)&&(n.versionMismatch=!0),c&&(n.versionUpdateRequired=!0),n)}function Am(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 na(e){if(!e||typeof e!="object")return"";const t=e,r=Am(Us(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 _m(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=na(n);for(let o=0;o<a.length;o+=1)r^=a.charCodeAt(o),r=Math.imul(r,16777619)>>>0}return{count:e.length,hash:r.toString(16).padStart(8,"0"),first:na(e[0]),last:na(e[e.length-1])}}function ro(e){return!!e&&typeof e=="object"&&"messages"in e&&("activeModal"in e||"inputContent"in e||"status"in e)}function no(e,t,r){if(!e||!t||typeof e!="object"||typeof t!="object")return;if(ro(e)&&ro(t)){const l=e.messages;Array.isArray(l)&&l===t.messages&&r.add(l)}if(Array.isArray(e)&&Array.isArray(t)){const l=Math.min(e.length,t.length);for(let c=0;c<l;c+=1)no(e[c],t[c],r);return}const n=e,a=t,o=new Set([...Object.keys(n),...Object.keys(a)]);for(const l of o)l!=="messages"&&no(n[l],a[l],r)}function vr(e,t){return Array.isArray(e)?e.map(r=>vr(r,t)):!e||typeof e!="object"?e:ro(e)?Object.fromEntries(Object.entries(e).filter(([n])=>n!=="timestamp"&&n!=="_lastUpdate").sort(([n],[a])=>n.localeCompare(a)).map(([n,a])=>[n,n==="messages"?_m(a,t):vr(a,t)])):Object.fromEntries(Object.entries(e).filter(([r])=>r!=="timestamp"&&r!=="_lastUpdate").sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>[r,vr(n,t)]))}function Lm(e,t){try{const r=new WeakSet;return no(e,t,r),JSON.stringify(vr(e,r))===JSON.stringify(vr(t,r))}catch{return!1}}function ao(e,t,r){return Lm(e,t)?(e._lastUpdate=r,typeof t.timestamp=="number"&&(e.timestamp=t.timestamp),e):t}function hc(e){var t;return e.daemonId||((t=e.id)==null?void 0:t.split(":")[0])||e.id}function Rm(e,t,r){t[r]!==void 0&&(e[r]=t[r])}function Mi(e,t,r,n){var c;const a=(c=t.chats)!=null&&c.length?t.chats:e.chats,o=dc(e.childSessions,t.childSessions,{preserveMissing:n}),l=cc(t.activeChat,e.activeChat);return pc(e,t,{...e,...t,chats:a,childSessions:o,activeChat:l,_lastUpdate:r})}function Pm(e,t,r){var a,o;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=dc(e.childSessions,t.childSessions,{preserveMissing:r})),(a=t.chats)!=null&&a.length&&!((o=e.chats)!=null&&o.length)&&(n.chats=t.chats);for(const l 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"])Rm(n,t,l);return t.machineNickname!==void 0&&t.machineNickname!==e.machineNickname&&(n.machineNickname=t.machineNickname),t.versionMismatch===!0&&(n.versionMismatch=!0),n}function Dm(e,t,r,n){const a=Pm(e,t,n),o=Object.keys(a).length>0?pc(e,t,{...e,...a,_lastUpdate:r}):{...e,_lastUpdate:r};return ao(e,o,r)}function Em(e){const t=new Set(e.map(o=>o.id)),r=new Set,n=new Set,a=new Set;for(const o of e){const l=hc(o);l&&r.add(l),l&&o.type!=="adhdev-daemon"&&n.add(l),l&&o.type==="adhdev-daemon"&&o._sessionListAuthoritative&&a.add(l)}return{incomingIds:t,incomingDaemonIds:r,daemonIdsWithSessionEntries:n,daemonIdsWithAuthoritativeSessionList:a}}function $m(e,t,r,n,a,o){return!a.has(t)||!o.has(t)||n.has(e.id)?!1:e.transport==="pty"||e.transport==="acp"?r>1e4:e.transport==="cdp-page"?r>3e4:!1}function Bm(e,t,r,n,a){return e.transport?r.has(t)&&!n.has(t)?!0:a.has(t):!1}function Om(e,t,r){var u,h;const n=Date.now(),a=new Set((r==null?void 0:r.authoritativeDaemonIds)||[]);if(t.length===0)return e.map(x=>({...x,_lastUpdate:n}));const o=new Map;for(const x of t)o.set(x.id,x);const{incomingIds:l,incomingDaemonIds:c,daemonIdsWithSessionEntries:d,daemonIdsWithAuthoritativeSessionList:m}=Em(e);for(const x of e){const S=o.get(x.id);if(!S){o.set(x.id,{...x,_lastUpdate:n});continue}const b=Ti(x),p=Ti(S),g=hc(x),v=!a.has(g);if(b>p){const T=Mi(S,x,n,v);o.set(x.id,ao(S,T,n));continue}if(b<p){o.set(x.id,Dm(S,x,n,v));continue}const f=x.timestamp||n,C=S._lastUpdate||S.timestamp||0;if(f>=C){const T=Mi(S,x,n,v);o.set(x.id,ao(S,T,n));continue}(u=x.chats)!=null&&u.length&&!((h=S.chats)!=null&&h.length)&&o.set(x.id,{...S,chats:x.chats})}for(const[x,S]of o){const b=S.daemonId||x.split(":")[0];if(!c.has(b))continue;if(a.has(b)&&m.has(b)&&!l.has(x)){o.delete(x);continue}const p=n-(S._lastUpdate||S.timestamp||0);$m(S,b,p,l,a,d)&&o.delete(x)}for(const[x,S]of o){const b=S.daemonId||x.split(":")[0];if(Bm(S,b,c,d,o))continue;n-(S._lastUpdate||S.timestamp||0)>3e5&&S.status!=="online"&&o.delete(x)}return Array.from(o.values())}function Fm(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 Wm({children:e,connectionOverrides:t}){const[r,n]=i.useState([]),[a,o]=i.useState(!1),[l,c]=i.useState([]),[d,m]=i.useState(void 0),u=i.useRef(r);i.useEffect(()=>{u.current=r},[r]);const h=i.useCallback((v,f)=>{n(C=>{let T=!1;const k=C.map(A=>A.id!==v||A.chats===f?A:(T=!0,{...A,chats:f}));return T?k:C})},[]),x=i.useCallback((v,f)=>{n(C=>{const T=C.length===0?v:Om(v,C,f),k=!Fm(C,T);return k&&Hs.record({kind:"dashboard.entries_applied",payload:{incoming:Ni(v),next:Ni(T)}}),k?T:C})},[]),S=i.useCallback(()=>o(!0),[]),b=i.useMemo(()=>({injectEntries:x,markLoaded:S,getIdes:()=>u.current}),[x,S]),p=t,g=i.useMemo(()=>({ides:r,updateRouteChats:h,initialLoaded:a,toasts:l,setToasts:c,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:m}),[r,h,a,l,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(mc.Provider,{value:b,children:s.jsx(uc.Provider,{value:g,children:e})})}function cs(){return i.useContext(uc)}function Mr(){return i.useContext(mc)}function fc(e){const{baseUrl:t,getToken:r,onUnauthorized:n}=e;function a(c){return c.startsWith("http")?c:`${t}${c.startsWith("/")?"":"/"}${c}`}function o(c){const d=r==null?void 0:r(),m=a(c),u=c.startsWith("http")?new URL(m):new URL(m,typeof window<"u"?window.location.origin:"http://localhost");return d&&u.searchParams.set("token",d),!c.startsWith("http")&&!t?`${u.pathname}${u.search}${u.hash}`:u.toString()}async function l(c,d={}){const m={"Content-Type":"application/json",...d.headers||{}},u=r==null?void 0:r();u&&(m.Authorization=`Bearer ${u}`);const h=a(c),x=new AbortController,S=setTimeout(()=>x.abort(),15e3);try{const b=await fetch(h,{...d,headers:m,signal:x.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(S)}}return{getDaemons:()=>l("/api/v1/daemons"),getDaemonStatus:c=>l(`/api/v1/daemons/${c}/status`),sendCommand:(c,d,m={})=>l(`/api/v1/daemons/${c}/command`,{method:"POST",body:JSON.stringify({type:d,payload:m})}),execTerminal:(c,d,m)=>l(`/api/v1/daemons/${c}/terminal`,{method:"POST",body:JSON.stringify({command:d,name:m})}),sendAgentMessage:(c,d,m)=>l(`/api/v1/shortcuts/${c}/chat`,{method:"POST",body:JSON.stringify({agentType:d,message:m})}),getAgentStatus:c=>l(`/api/v1/shortcuts/${c}/status`),approveAgent:(c,d,m)=>l(`/api/v1/shortcuts/${c}/approve`,{method:"POST",body:JSON.stringify({agentType:d,action:m?"approve":"reject"})}),getMuxState:c=>l(`/api/v1/mux/${encodeURIComponent(c)}/state`),getMuxSocketInfo:c=>l(`/api/v1/mux/${encodeURIComponent(c)}/socket-info`),controlMux:(c,d,m={})=>l(`/api/v1/mux/${encodeURIComponent(c)}/control`,{method:"POST",body:JSON.stringify({type:d,payload:m})}),getMuxEventsUrl:c=>o(`/api/v1/mux/${encodeURIComponent(c)}/events`),getRuntimeEventsUrl:c=>o(`/api/v1/runtime/${encodeURIComponent(c)}/events`),request:l}}const Km=fc({baseUrl:"http://localhost:3847"}),Hm=i.createContext(Km);function Um({client:e,children:t}){return s.jsx(Hm.Provider,{value:e,children:t})}const zm={sendCommand:async()=>{throw new Error("TransportContext not initialized")}},xc=i.createContext(zm);function Vm({value:e,children:t}){return s.jsx(xc.Provider,{value:e,children:t})}function jt(){return i.useContext(xc)}function Gm(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 qm(e){try{return JSON.stringify(e??"")}catch{return String(e??"")}}function Ym(e){return e?Gm([String(e.id||""),String(e.index??""),String(e.role||""),String(e.receivedAt??e.timestamp??""),qm(e.content)]):""}const We={size:18};function bc({size:e=We.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 Ao({size:e=We.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 is({size:e=We.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 gc({size:e=We.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 Xm({size:e=We.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 Jm({size:e=We.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 yc({size:e=We.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 Qm({size:e=We.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 Kn({size:e=We.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 vc({size:e=We.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 Zm({size:e=We.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 es({size:e=We.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 _t({size:e=We.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=We.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 ep({size:e=We.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 Ns({size:e=We.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 Rr({size:e=We.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 Ar({size:e=We.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 zs({size:e=We.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 as({size:e=We.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 tp({size:e=We.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 wc({size:e=We.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 Lo({size:e=We.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 jc({size:e=We.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 sp({size:e=We.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 Ro({size:e=We.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 rp({size:e=We.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 Po({size:e=We.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 kc({size:e=We.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 wt({size:e=We.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 np({size:e=We.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 ap({size:e=We.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 op({size:e=We.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 ip({size:e=We.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 Hn({size:e=We.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 lp({size:e=We.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 cp({size:e=We.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 dp({size:e=We.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 up({size:e=We.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 mp({size:e=We.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 pp({size:e=We.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 hp({size:e=We.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 fp({size:e=We.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 xp({size:e=We.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 bp({size:e=We.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 gp({size:e=We.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 yp({size:e=We.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 Do="adhdev_chat_activity_visible",Ai=new Set(["hidden","debug","internal"]),_i=new Set(["visible","user","chat"]),vp=new Set(["debug","trace","internal"]),wp=new Set(["tool_call","terminal_command","runtime_activity"]),jp=new Set(["runtime_status","provider_chrome","control"]),kp=new Set(["thought","tool","terminal"]);function Sc(e){const t=e.meta;return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Ps(e){return typeof e=="string"?e.trim().toLowerCase():""}function aa(e,t,r){return e[r]??(t==null?void 0:t[r])}function Li(e,t,r){const n=e;return r.some(a=>n[a]===!0||(t==null?void 0:t[a])===!0)}function Sp(e,t){const r=Ps(e.kind);return r||(t==="tool"?"tool":"standard")}function oa(e,t,r){const n=Sc(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 Np(e){const t=e.content;return Array.isArray(t)&&t.some(r=>!!r&&typeof r=="object"&&r.type!=="text")}function Eo(e){if(!e)return{surface:"internal",isUserFacing:!1,isActivityFacing:!1,isInternal:!0,role:"",kind:"standard",label:"Internal"};const t=Sc(e),r=Ps(e.role),n=Sp(e,r),a=Ps(aa(e,t,"visibility")),o=Ps(e.transcriptVisibility??(t==null?void 0:t.transcriptVisibility)??a),l=Ps(aa(e,t,"audience")),c=Ps(aa(e,t,"source")),d=Ai.has(a)||Ai.has(o)||vp.has(l)||Li(e,t,["internal","isInternal","debug","statusOnly","controlOnly"]),m=_i.has(a)||_i.has(o)||l==="chat"||Li(e,t,["userFacing"]),u=kp.has(n)||wp.has(c);if(d)return{surface:u?"activity":"internal",isUserFacing:!1,isActivityFacing:u,isInternal:!u,role:r,kind:n,label:oa(e,n,c)};if(m)return{surface:"chat",isUserFacing:!0,isActivityFacing:!1,isInternal:!1,role:r,kind:n,label:oa(e,n,c)};if((r==="system"||n==="system")&&Np(e))return{surface:"chat",isUserFacing:!0,isActivityFacing:!1,isInternal:!1,role:r,kind:n,label:"Chat"};if(jp.has(c)||r==="system"||n==="system")return{surface:"internal",isUserFacing:!1,isActivityFacing:!1,isInternal:!0,role:r,kind:n,label:"Internal"};if(u)return{surface:"activity",isUserFacing:!1,isActivityFacing:!0,isInternal:!1,role:r,kind:n,label:oa(e,n,c)};const h=(r==="user"||r==="human"||r==="assistant")&&(n==="standard"||n==="");return{surface:h?"chat":"internal",isUserFacing:h,isActivityFacing:!1,isInternal:!h,role:r,kind:n,label:h?"Chat":"Internal"}}function Cp(e){return(Array.isArray(e)?e:[]).filter(t=>Eo(t).isUserFacing)}function Nc(e){return(Array.isArray(e)?e:[]).filter(t=>Eo(t).isActivityFacing)}function Ip(e,t,r){return!r||t.length===0?e:[...e,...t].sort((n,a)=>{const o=Number(n.receivedAt??n.timestamp??0)||0,l=Number(a.receivedAt??a.timestamp??0)||0;if(o!==l)return o-l;const c=Number(n.index??0)||0,d=Number(a.index??0)||0;return c-d})}function Ri(e=typeof localStorage<"u"?localStorage:void 0){try{return(e==null?void 0:e.getItem(Do))==="1"}catch{return!1}}function Tp(e,t=typeof localStorage<"u"?localStorage:void 0){try{t==null||t.setItem(Do,e?"1":"0")}catch{}}const Cc=[cm,{singleTilde:!1}],Ic=[Cc,dm,um],Mp=[Cc],$o=200,Ap=80,Pi=650,rr=new Map;function Cn(e,t){if(!e)return!1;const r=String(e.messageFingerprint||"");return r?r===String(t||""):!0}function _p(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}:${Ym(n)}`}function Lp(e,t,r,n){return e||!t?!1:Cn(r,n)}function Rp({scrollTop:e,scrollHeight:t,clientHeight:r,topThresholdPx:n=Ap,bottomThresholdPx:a=$o}){const o=Math.max(0,Number(e)||0),l=Math.max(0,Number(t)||0),c=Math.max(0,Number(r)||0);return Math.max(0,l-c)<=0?{showTop:!1,showBottom:!1}:{showTop:o>n,showBottom:Math.max(0,l-o-c)>a}}function Pp(e){return Rp({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight})}function gr(e,t=$o){return!!e&&e.fromBottom>=t}function Dp(e,t){return Cn(e,t)?!gr(e):!0}function Ep({hasSelection:e,userScrolledUp:t,hasChatContentChanged:r=!0}){return!(e||t||!r)}function $p({hasSelection:e,userScrolledUp:t,contextAutoScrollActive:r}){return e?!1:r||!t}function ia(e,t){const r=Math.max(0,e.scrollHeight-e.clientHeight-t.fromBottom);e.scrollTop=Number.isFinite(r)?r:t.top}function Tc(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):""}function Bp(e,t,r){return Number(e.receivedAt||r[In(e,t)]||0)||0}function Mc(e){return/[`*_#[\]()>-]|https?:\/\/|\n\s*[-*]\s|\n\s*\d+\.\s|\|/.test(e)}function Op(e){return Array.isArray(e)&&e.some(t=>!!t&&typeof t=="object"&&"type"in t)}function nr(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 la(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 qr(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 Di(e,t){return e?t?s.jsx("pre",{className:"chat-preformatted",children:e}):Mc(e)?s.jsx(Io,{remarkPlugins:Ic,children:e}):s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:e}):null}function ar({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:Di(String(r.text||""),t)},`text-${n}`);if(r.type==="image"){const a=la(r),o=r.alt||r.description||nr(r.uri,"image");return a?s.jsx("img",{src:a,alt:o,className:"max-w-full rounded-md border border-border-subtle"},`image-${n}`):s.jsx("div",{children:qr("Image",o,r.mimeType)},`image-fallback-${n}`)}if(r.type==="audio"){const a=la(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:qr("Audio",nr(r.uri,"audio"),r.transcript||r.mimeType)},`audio-fallback-${n}`)}if(r.type==="video"){const a=la(r),o=r.title||r.name||r.alt||nr(r.uri,"video"),l=[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"}):qr("Video",o,l),a&&l?s.jsx("div",{className:"text-sm opacity-80",style:{whiteSpace:"pre-wrap"},children:l}):null]},`video-${n}`)}if(r.type==="resource_link"){const a=r.title||r.name||nr(r.uri,"resource"),o=[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}):qr("Resource",a,o),r.uri&&o?s.jsx("div",{className:"text-sm opacity-80",style:{whiteSpace:"pre-wrap"},children:o}):null]},`resource-link-${n}`)}if(r.type==="resource"&&r.resource){const a=nr(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}),Di(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 In(e,t){const r=e,n=Mo(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 Fp=i.memo(function({log:t}){return s.jsxs("div",{className:"self-center chat-msg-action",children:[s.jsx(Io,{remarkPlugins:Mp,children:t.text}),s.jsx("span",{className:"action-time",children:Tc(t.timestamp)})]})},(e,t)=>e.log===t.log),Wp=i.memo(function({message:t,receivedAt:r,agentName:n,userName:a,isCliMode:o,isTextExpanded:l,onToggleTextExpanded:c}){var N,w,D;const d=(t.role||"").toLowerCase(),m=d==="user"||d==="human",u=t.kind||(d==="tool"?"tool":"standard"),h=Eo(t),x=Op(t.content)?t.content:null,S=!!(x!=null&&x.some(M=>M.type!=="text")),b=Mo(t.content,{joiner:`
|
|
6
|
-
`});if(h.isActivityFacing&&u!=="thought"&&u!=="tool"&&u!=="terminal"){const M=h.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:M})]}),S&&x?s.jsx("div",{className:"chat-msg-activity-body",children:s.jsx(ar,{parts:x,renderAsPreformatted:!1})}):s.jsx("div",{className:"chat-msg-activity-body",style:{whiteSpace:"pre-wrap"},children:b})]})}if(u==="thought"){const M=typeof((N=t.meta)==null?void 0:N.label)=="string"?t.meta.label:"Thought";return s.jsxs("div",{className:"self-start chat-msg-thought","data-chat-activity-row":h.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx(op,{size:13}),s.jsx("span",{children:M})]}),s.jsx("div",{className:"chat-msg-body",children:b})]})}if(u==="tool")return s.jsxs("div",{className:"self-start chat-msg-tool","data-chat-activity-row":h.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"})]}),S&&x?s.jsx("div",{className:"tool-text w-full",children:s.jsx(ar,{parts:x,renderAsPreformatted:!1})}):s.jsx("div",{className:"tool-text w-full",style:{whiteSpace:"pre-wrap"},children:b})]});if(u==="terminal"){const M=(w=t.meta)!=null&&w.isRunning?"⏳":"✅",j=typeof((D=t.meta)==null?void 0:D.label)=="string"?t.meta.label:"Ran command";return s.jsxs("div",{className:"self-start chat-msg-terminal","data-chat-activity-row":h.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx("span",{children:M}),s.jsx("span",{children:j})]}),S&&x?s.jsx("div",{className:"chat-msg-body",children:s.jsx(ar,{parts:x,renderAsPreformatted:!0})}):s.jsx("pre",{className:"chat-msg-body",children:b})]})}if(u==="system")return s.jsx("div",{className:"self-center chat-msg-system",children:S&&x?s.jsx(ar,{parts:x,renderAsPreformatted:!1}):b.slice(0,100)});const p=t.meta,v=(typeof(p==null?void 0:p.renderMode)=="string"?p.renderMode.trim():"")==="preformatted",f=b,C=!1,T=f,k=v,A=!k&&Mc(T),_=["chat-message-row",m?"chat-message-row-user self-end":"chat-message-row-assistant self-start"].join(" ");return s.jsx("div",{className:_,children:(f||S||m)&&s.jsxs("div",{className:`chat-bubble ${m?"chat-bubble-user":"chat-bubble-assistant"}`,children:[s.jsxs("div",{className:`chat-bubble-header ${f||S?"mb-1.5":"mb-0"}`,children:[s.jsx("span",{className:"chat-sender",children:m?a||"You":t.senderName||n}),r!=null&&s.jsx("span",{className:"chat-time",children:Tc(r)})]}),(f||S)&&s.jsx("div",{className:"chat-markdown",children:S&&x?s.jsx(ar,{parts:x,renderAsPreformatted:k}):k?s.jsx("pre",{className:"chat-preformatted",children:T}):A?s.jsx(Io,{remarkPlugins:Ic,children:T}):s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:T})}),C]})})},(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),Kp=i.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",userName:a,isCliMode:o=!1,isWorking:l=!1,contextKey:c="",receivedAtMap:d={},lastMessageHash:m,showActivityMessages:u=!1,emptyState:h,onLoadMore:x,isLoadingMore:S,hasMoreHistory:b,hiddenLiveCount:p=0,loadError:g,scrollToBottomRequestNonce:v,isVisible:f=!0},C){const T=i.useRef(null),k=i.useRef(null),A=i.useRef(null),_=i.useRef(0),N=i.useRef(""),w=i.useRef(""),D=i.useRef(!1),M=i.useRef(null),j=i.useRef(!1),W=i.useRef(null),H=i.useRef(!1),[$,I]=i.useState(new Set),[y,F]=i.useState({showTop:!1,showBottom:!1}),P=i.useRef(!1),E=i.useRef(!1),G=i.useRef(f),J=i.useRef(f),ye=i.useRef(null);J.current=f;const he=()=>{const re=T.current;return re?re.scrollHeight-re.scrollTop-re.clientHeight<$o:!0},ne=i.useCallback(()=>{const re=T.current,R=re?Pp(re):{showTop:!1,showBottom:!1};F(q=>q.showTop===R.showTop&&q.showBottom===R.showBottom?q:R)},[]),ue=i.useCallback((re="auto")=>{var q;const R=T.current;R&&(R.scrollTo({top:R.scrollHeight,behavior:re}),(q=R.ownerDocument.defaultView)==null||q.requestAnimationFrame(()=>ne()))},[ne]),Se=i.useCallback((re="auto")=>{var q;const R=T.current;R&&(R.scrollTo({top:0,behavior:re}),(q=R.ownerDocument.defaultView)==null||q.requestAnimationFrame(()=>ne()))},[ne]),ve=i.useCallback(()=>{var Ne;const re=T.current,R=(Ne=window.getSelection)==null?void 0:Ne.call(window);if(!re||!R||R.rangeCount===0||R.isCollapsed){H.current=!1;return}const q=R.anchorNode,ce=R.focusNode;H.current=!!(q&&ce&&re.contains(q)&&re.contains(ce))},[]),X=i.useMemo(()=>{const re=Cp(t),R=Nc(t);return Ip(re,R,u)},[t,u]),xe=X.length===t.length?m:void 0,fe=_p(X,xe),we=i.useCallback(()=>{const re=T.current;if(!re||!c||!J.current)return;const R={top:re.scrollTop,fromBottom:Math.max(0,re.scrollHeight-re.scrollTop-re.clientHeight),messageFingerprint:fe};ye.current={contextKey:c,snapshot:R},rr.set(c,R)},[c,fe]),be=i.useCallback((re="auto")=>{M.current!=null&&cancelAnimationFrame(M.current),M.current=requestAnimationFrame(()=>{M.current=null,ue(re)})},[ue]),Ce=i.useCallback(()=>{P.current=!1,j.current=!0,E.current=!0,W.current!=null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{j.current=!1,W.current=null},Pi)},[]);i.useEffect(()=>{const re=!D.current,R=w.current!==c;if(w.current=c,re||R){D.current=!0;const ce=c?rr.get(c):null,Ne=!!ce&&Cn(ce,fe);P.current=Ne?gr(ce):!1,j.current=Dp(ce,fe),H.current||(Ne?requestAnimationFrame(()=>{const je=T.current;je&&(ia(je,ce),P.current=gr(ce),ne(),E.current=!0)}):be("auto")),_.current=X.length,N.current=fe;return}X.length>_.current;const q=fe!==N.current;Ep({hasSelection:H.current,userScrolledUp:P.current,hasChatContentChanged:q})&&be("auto"),_.current=X.length,N.current=fe},[fe,c,X.length,be,ne]),i.useEffect(()=>{v&&(Ce(),H.current||be("auto"))},[Ce,be,v]),i.useEffect(()=>{const re=G.current;re&&!f&&we(),J.current=f,G.current=f;const R=c?rr.get(c):null;if(Lp(re,f,R,fe)){if(!R)return;P.current=gr(R),j.current=!1,H.current||requestAnimationFrame(()=>{const q=T.current;q&&(ia(q,R),ne())});return}},[f,c,fe,Ce,we,be,ne]),i.useEffect(()=>()=>{const re=ye.current;re&&rr.set(re.contextKey,re.snapshot),M.current!=null&&cancelAnimationFrame(M.current),W.current!=null&&window.clearTimeout(W.current)},[]),i.useEffect(()=>{const re=k.current,R=T.current;if(!re||!R)return;const q=()=>{W.current!=null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{j.current=!1,W.current=null},Pi)},ce=new ResizeObserver(()=>{ne();const Ne=j.current;$p({hasSelection:H.current,userScrolledUp:P.current,contextAutoScrollActive:Ne})&&(be("auto"),Ne&&q())});return ce.observe(re),R!==re&&ce.observe(R),()=>{ce.disconnect(),W.current!=null&&(window.clearTimeout(W.current),W.current=null)}},[be,c,ne]),i.useImperativeHandle(C,()=>({scrollToBottom:(re="smooth")=>{ue(re)}}),[ue]),i.useEffect(()=>{const re=T.current;if(!re)return;let R;const q=()=>{we(),clearTimeout(R),R=setTimeout(()=>{P.current=!he(),ne()},50)};return re.addEventListener("scroll",q,{passive:!0}),()=>{re.removeEventListener("scroll",q),clearTimeout(R)}},[we,ne]),i.useEffect(()=>(document.addEventListener("selectionchange",ve),()=>document.removeEventListener("selectionchange",ve)),[ve]);const ee=i.useRef(0),me=i.useRef(!1);i.useEffect(()=>{const re=T.current;if(!re||!me.current||ee.current===0)return;const R=re.scrollHeight-ee.current;R>0&&(re.scrollTop=R),ne(),we(),ee.current=0,me.current=!1},[X.length,we,ne]),i.useEffect(()=>{if(E.current||!c)return;const re=rr.get(c),R=T.current;if(!(!re||!R)){if(!Cn(re,fe)){ue("auto"),E.current=!0;return}ia(R,re),P.current=gr(re),ne(),E.current=!0}},[c,fe,X.length,ue,ne]);const ie=()=>{const re=T.current;re&&(ee.current=re.scrollHeight),me.current=!0,x==null||x()},pe=()=>{P.current=!0,Se("smooth"),we()},le=()=>{Ce(),ue("smooth"),we()},B=i.useMemo(()=>{const re=X.map((Ne,je)=>({type:"message",data:Ne,index:je,ts:Bp(Ne,je,d)}));if(!r||r.length===0)return re;const R=[...r].sort((Ne,je)=>Ne.timestamp-je.timestamp).map((Ne,je)=>({type:"action",data:Ne,index:je,ts:Ne.timestamp})),q=[];let ce=0;for(const Ne of re){for(;ce<R.length&&Ne.ts>0&&R[ce].ts<Ne.ts;)q.push(R[ce++]);q.push(Ne)}for(;ce<R.length;)q.push(R[ce++]);return q},[X,r,d]),z=p>0||!!b,de=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:T,"data-chat-scroll":!0,className:"chat-container",children:s.jsxs("div",{ref:k,className:"chat-container-content",children:[S&&s.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60 animate-pulse",children:"Loading older messages..."}),z&&!S&&s.jsx("div",{className:"text-center py-2",children:s.jsx("button",{type:"button",onClick:ie,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:de})}),B.length===0&&!z&&(h||s.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),B.map(re=>{if(re.type==="action"){const Ie=re.data;return s.jsx(Fp,{log:Ie},`action-${re.index}`)}const R=re.data,q=re.index,ce=In(R,q),Ne=R.receivedAt||d[ce],je=`${c}-${ce}`,O=$.has(je);return s.jsx(Wp,{message:R,receivedAt:Ne,agentName:n,userName:a,isCliMode:o,isTextExpanded:O,onToggleTextExpanded:()=>I(Ie=>{const Le=new Set(Ie);return O?Le.delete(je):Le.add(je),Le})},`msg-${ce}`)}),l&&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})]})}),(y.showTop||y.showBottom)&&s.jsxs("div",{className:"chat-scroll-jump-controls","aria-label":"Chat scroll shortcuts",children:[y.showTop&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button",onClick:pe,"aria-label":"Jump to oldest messages",title:"Jump to top",children:"↑ Top"}),y.showBottom&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button chat-scroll-jump-button-primary",onClick:le,"aria-label":"Jump to latest messages",title:"Jump to bottom",children:"↓ Latest"})]})]})}),Hp=i.memo(Kp,(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),Up="modulepreload",zp=function(e){return"/"+e},Ei={},Vp=function(t,r,n){let a=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=Promise.allSettled(r.map(d=>{if(d=zp(d),d in Ei)return;Ei[d]=!0;const m=d.endsWith(".css"),u=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${u}`))return;const h=document.createElement("link");if(h.rel=m?"stylesheet":Up,m||(h.as="script"),h.crossOrigin="",h.href=d,c&&h.setAttribute("nonce",c),document.head.appendChild(h),m)return new Promise((x,S)=>{h.addEventListener("load",x),h.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return a.then(l=>{for(const c of l||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})};let $i=!1;const Ac=i.forwardRef(({onInput:e,onViewportMetrics:t,onScrollMetrics:r,fontSize:n=13,readOnly:a=!1,sizingMode:o="measured"},l)=>{const c=i.useRef(null),[d,m]=i.useState(null),u=i.useRef([]),h=i.useRef(!1),x=i.useRef(!1),S=i.useRef(!1),b=i.useRef(!1),p=()=>{const g=c.current;if(g){h.current&&(g.clear(),h.current=!1);for(const v of u.current)g.write(v.data,v.onProcessed);u.current=[],x.current&&(g.fit(),x.current=!1),S.current&&(g.bumpResize(),S.current=!1),b.current&&(g.scrollToTop(),b.current=!1)}};return i.useImperativeHandle(l,()=>({write:(g,v)=>{c.current?c.current.write(g,v):u.current.push({data:g,onProcessed:v})},clear:()=>{c.current?c.current.clear():(u.current=[],h.current=!0)},reset:()=>{c.current&&typeof c.current.reset=="function"?c.current.reset():(u.current=[],h.current=!0)},resize:(g,v)=>{c.current&&typeof c.current.resize=="function"&&c.current.resize(g,v)},fit:()=>{c.current?c.current.fit():x.current=!0},bumpResize:()=>{c.current?c.current.bumpResize():S.current=!0},scrollToTop:()=>{c.current?c.current.scrollToTop():b.current=!0},getSelection:()=>{var g,v;return((v=(g=c.current)==null?void 0:g.getSelection)==null?void 0:v.call(g))||""},getVisibleText:()=>{var g,v;return((v=(g=c.current)==null?void 0:g.getVisibleText)==null?void 0:v.call(g))||""}}),[]),i.useEffect(()=>{d&&p()},[d]),i.useEffect(()=>{let g=!1;return Vp(()=>import("./terminal-CfAvHQvJ.js"),__vite__mapDeps([0,1,2])).then(v=>{$i||($i=!0,console.info("[CliTerminal] renderer module loaded: terminal-render-web")),g||m(()=>v.GhosttyTerminalView)}).catch(v=>{console.error("[CliTerminal] failed to load terminal renderer",v)}),()=>{g=!0}},[]),d?s.jsx(d,{ref:c,onInput:e,onViewportMetrics:t,onScrollMetrics:r,fontSize:n,readOnly:a,sizingMode:o,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"}})});Ac.displayName="CliTerminal";function Yr({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 Bi({value:e,max:t,label:r,color:n="#8b5cf6",detail:a,compact:o=!1}){const l=t>0?Math.min(Math.round(e/t*100),100):0,c=l>85?"#ef4444":l>60?"var(--status-warning)":n;return o?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:[l,"%"]})]}),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:`${l}%`,background:c}})})]}):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:[l,"%"]})]}),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:`${l}%`,background:`linear-gradient(90deg, ${c}, ${c}cc)`}})}),a&&s.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:a})]})}function Gp({cursorPos:e,viewportRef:t,imgRef:r}){var f;if(!e||!r.current)return null;const n=r.current,a=n.getBoundingClientRect(),o=(f=t.current)==null?void 0:f.getBoundingClientRect();if(!o)return null;const l=n.naturalWidth||a.width,c=n.naturalHeight||a.height,d=l/c,m=a.width/a.height;let u,h,x,S;d>m?(u=a.width,h=a.width/d,x=0,S=(a.height-h)/2):(h=a.height,u=a.height*d,x=(a.width-u)/2,S=0);const b=a.left-o.left+x+u*e.nx,p=a.top-o.top+S+h*e.ny,g=Math.max(8,Math.min(o.width-8,b)),v=Math.max(8,Math.min(o.height-8,p));return s.jsxs("div",{style:{position:"absolute",left:g-8,top:v-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 qp({inputMode:e,onToggleInputMode:t,isImeOpen:r,setIsImeOpen:n,isMenuOpen:a,setIsMenuOpen:o,imeText:l,setImeText:c,handleImeSubmit:d,isConnActive:m,zoom:u,isMobile:h,mobileFillZoom:x,onZoomOut:S,onZoomReset:b,onZoomIn:p,transportType:g,screenshotUsage:v,lastActionStatus:f}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{onTouchStart:C=>C.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(C=>!C),o(!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:l,autoFocus:!0,onTouchStart:C=>C.stopPropagation(),onChange:C=>c(C.target.value),onKeyDown:C=>{d(C)},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:()=>{o(C=>!C),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:m?"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:m?"#22c55e":"#eab308",boxShadow:m?"0 0 4px #22c55e80":"0 0 4px #eab30880"}}),s.jsx("span",{className:"text-[8px] font-extrabold",style:{color:m?"#22c55e":"#eab308"},children:m?"Connected":"WS"})]}),u>1&&s.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(u*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"}),v&&v.dailyBudgetMinutes>0&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:v.budgetExhausted?"#ef4444":"#c4b5fd",background:v.budgetExhausted?"rgba(239,68,68,0.1)":"rgba(139,92,246,0.14)"},title:"Daily TURN relay usage",children:v.budgetExhausted?"TURN blocked":`TURN ${v.dailyUsedMinutes}/${v.dailyBudgetMinutes}m`}),f&&s.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:f})]})]}),a&&s.jsxs("div",{onTouchStart:C=>C.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: ",u<=(h?x:1)+.01?h?"FILL":"FIT":`${Math.round(u*100)}%`]}),s.jsxs("div",{style:{display:"flex",gap:4},children:[s.jsx("button",{onClick:C=>{C.stopPropagation(),S()},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:C=>{C.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:h?"FILL":"FIT"}),s.jsx("button",{onClick:C=>{C.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 Yp({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 Xp(){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 Oi(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 Pr(e,t){const r=i.useRef(null),n=i.useRef(0);i.useEffect(()=>{if(!Xp())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(([l,c])=>[l,Oi(c)]))}),r.current=t;return}const o=Object.keys({...a,...t}).filter(l=>!Object.is(a[l],t[l]));o.length>0&&console.debug(`[render-trace] ${e}#${n.current}`,{changed:o,snapshot:Object.fromEntries(o.map(l=>[l,Oi(t[l])]))}),r.current=t})}function Jp({containerRef:e,viewportRef:t,imgRef:r,inputMode:n,setInputMode:a,minZoom:o,zoomRef:l,panXRef:c,panYRef:d,setPanX:m,setPanY:u,setZoom:h,lastWheelTimeRef:x,onAction:S,setLastActionStatus:b,spawnRippleFromNormalized:p,clampPan:g,isMobile:v,mobileFillZoom:f}){const[C,T]=i.useState(null),k=i.useRef(null),A=i.useRef(null),_=i.useRef(null),N=i.useRef(!1),w=i.useRef(null),D=i.useRef(0),M=i.useRef(null),j=i.useRef(1),W=i.useRef({x:0,y:0}),H=i.useRef(!1),$=i.useRef(n),I=i.useRef(S),y=30,F=550,P=18,E=60,G=400,J=12,ye=()=>{if(k.current)return;const ue={nx:.5,ny:.5};k.current=ue,T(ue)};return i.useEffect(()=>{$.current=n,n==="mouse"&&ye()},[n]),i.useEffect(()=>{I.current=S},[S]),i.useEffect(()=>{const ue=e.current;if(!ue)return;const Se=be=>{if(!r.current)return null;const Ce=r.current.getBoundingClientRect();return!Ce.width||!Ce.height?null:{nx:Math.max(0,Math.min(1,(be.clientX-Ce.left)/Ce.width)),ny:Math.max(0,Math.min(1,(be.clientY-Ce.top)/Ce.height))}},ve=(be,Ce)=>{if(!r.current)return{dnx:0,dny:0};const ee=r.current,me=ee.getBoundingClientRect(),ie=ee.naturalWidth||me.width,pe=ee.naturalHeight||me.height,le=ie/pe,B=me.width/me.height;let z,de;return le>B?(z=me.width,de=me.width/le):(de=me.height,z=me.height*le),{dnx:be/z,dny:Ce/de}},X=(be,Ce,ee)=>{if(ee<=1.05)return;const me=-(be-.5)*100,ie=-(Ce-.5)*100,pe=g(me,ie,ee);(Math.abs(pe.x-c.current)>.1||Math.abs(pe.y-d.current)>.1)&&(m(pe.x),u(pe.y),c.current=pe.x,d.current=pe.y)},xe=be=>{const Ce=t.current;if(Ce&&be.target instanceof Node&&Ce.contains(be.target))be.preventDefault();else return;if(be.touches.length===1){const ee=be.touches[0];A.current={x:ee.clientX,y:ee.clientY,time:Date.now()},_.current={x:ee.clientX,y:ee.clientY},H.current||(N.current=!1),w.current=setTimeout(()=>{if(!N.current&&!H.current)if(N.current=!0,$.current==="mouse"){const me=k.current||{nx:.5,ny:.5};b("Right Click"),p(me.nx,me.ny,"right"),I.current("input_click",{...me,button:"right"}).catch(()=>{})}else{const me=Se(ee);me&&(b("Right Click"),p(me.nx,me.ny,"right"),I.current("input_click",{...me,button:"right"}).catch(()=>{}))}},500);return}if(be.touches.length===2){w.current&&clearTimeout(w.current),N.current=!0,H.current=!0;const ee=be.touches[1].clientX-be.touches[0].clientX,me=be.touches[1].clientY-be.touches[0].clientY;M.current=Math.sqrt(ee*ee+me*me),j.current=l.current,W.current={x:(be.touches[0].clientX+be.touches[1].clientX)/2,y:(be.touches[0].clientY+be.touches[1].clientY)/2}}},fe=be=>{const Ce=t.current;if(Ce&&be.target instanceof Node&&Ce.contains(be.target)&&be.preventDefault(),be.touches.length===1&&_.current){const ee=be.touches[0],me=ee.clientX-_.current.x,ie=ee.clientY-_.current.y;if(!N.current&&A.current){const pe=ee.clientX-A.current.x,le=ee.clientY-A.current.y;Math.sqrt(pe*pe+le*le)>8&&(N.current=!0,w.current&&clearTimeout(w.current))}if(N.current)if($.current==="mouse"){const pe=ve(me,ie),le=k.current||{nx:.5,ny:.5},B=Math.max(0,Math.min(1,le.nx+pe.dnx)),z=Math.max(0,Math.min(1,le.ny+pe.dny));k.current={nx:B,ny:z},T({nx:B,ny:z}),b(`Cursor: ${Math.round(B*100)}%, ${Math.round(z*100)}%`),X(B,z,l.current);const de=Date.now();de-x.current>=30&&(x.current=de,I.current("input_mouseMoved",{nx:B,ny:z}).catch(()=>{}))}else if(l.current>1){const pe=t.current;if(pe){const le=pe.clientWidth,B=pe.clientHeight,z=c.current+me/le*100,de=d.current+ie/B*100,re=g(z,de,l.current);m(re.x),u(re.y),c.current=re.x,d.current=re.y}}else{const pe=Se(ee);if(pe){const le=Date.now();le-x.current>=40&&(x.current=le,b("Scroll"),I.current("input_wheel",{nx:pe.nx,ny:pe.ny,deltaX:Math.round(-me*2.5),deltaY:Math.round(-ie*2.5)}).catch(()=>{}))}}_.current={x:ee.clientX,y:ee.clientY};return}if(be.touches.length===2&&M.current!==null){const ee=be.touches[1].clientX-be.touches[0].clientX,me=be.touches[1].clientY-be.touches[0].clientY,pe=Math.sqrt(ee*ee+me*me)/M.current,le=(be.touches[0].clientX+be.touches[1].clientX)/2,B=(be.touches[0].clientY+be.touches[1].clientY)/2,z=le-W.current.x,de=B-W.current.y,re=Math.abs(pe-1)>.03;if($.current==="mouse"){if(re){const R=Math.max(o,Math.min(5,j.current*pe));h(R),l.current=R}else if(Math.abs(z)>2||Math.abs(de)>2){const R=k.current||{nx:.5,ny:.5},q=Date.now();q-x.current>=30&&(x.current=q,b("Scroll"),I.current("input_wheel",{nx:R.nx,ny:R.ny,deltaX:Math.round(-z*3),deltaY:Math.round(-de*3)}).catch(()=>{}))}}else{const R=Math.max(o,Math.min(5,j.current*pe));h(R),l.current=R;const q=t.current;if(q&&R>1){const ce=q.clientWidth,Ne=q.clientHeight,je=c.current+z/ce*100,O=d.current+de/Ne*100,Ie=g(je,O,R);m(Ie.x),u(Ie.y),c.current=Ie.x,d.current=Ie.y}}W.current={x:le,y:B}}},we=be=>{var Ce;if(w.current&&clearTimeout(w.current),M.current=null,be.touches.length===1&&H.current){const ee=be.touches[0];A.current={x:ee.clientX,y:ee.clientY,time:Date.now()},_.current={x:ee.clientX,y:ee.clientY},N.current=!0;return}if(be.touches.length===0){if(H.current){H.current=!1,N.current=!1;return}if(be.changedTouches.length===1){const ee=be.changedTouches[0],me=Date.now(),ie=me-(((Ce=A.current)==null?void 0:Ce.time)||0),pe=A.current?ee.clientX-A.current.x:0,le=A.current?ee.clientY-A.current.y:0,B=Math.sqrt(pe*pe+le*le);if($.current==="mouse"){if(ie<y||ie>F||B>P){N.current=!1;return}const z=k.current||Se(ee);z&&(b(`Click: ${Math.round(z.nx*100)}%, ${Math.round(z.ny*100)}%`),p(z.nx,z.ny,"left"),I.current("input_click",{...z}).catch(()=>{}))}else{if(N.current){N.current=!1;return}if(ie<E||ie>G||B>J){N.current=!1;return}const z=Se(ee);if(!z)return;me-D.current<300?(b("Double tap"),p(z.nx,z.ny,"double"),I.current("input_click",{...z,clickCount:2}).catch(()=>{}),D.current=0):(b(`Tap: ${Math.round(z.nx*100)}%, ${Math.round(z.ny*100)}%`),p(z.nx,z.ny,"left"),I.current("input_click",{...z}).catch(()=>{}),D.current=me)}}N.current=!1}};return ue.addEventListener("touchstart",xe,{passive:!1}),ue.addEventListener("touchmove",fe,{passive:!1}),ue.addEventListener("touchend",we,{passive:!1}),()=>{ue.removeEventListener("touchstart",xe),ue.removeEventListener("touchmove",fe),ue.removeEventListener("touchend",we),w.current&&clearTimeout(w.current)}},[e,t,r,o,l,c,d,m,u,h,x,b,p,g]),{cursorPos:C,cursorPosRef:k,handleToggleInputMode:()=>{a(ue=>{const Se=ue==="touch"?"mouse":"touch";return Se==="mouse"&&ye(),Se})},handleZoomReset:()=>{const ue=v?f:1;h(ue),l.current=ue,m(0),u(0),c.current=0,d.current=0}}}function _c({onAction:e,addLog:t,connState:r,connScreenshot:n,screenshotUsage:a,transportType:o}){const l=i.useRef(null),c=i.useRef(null),d=i.useRef(null),[m,u]=i.useState(null),[h,x]=i.useState(""),[,S]=i.useState(!1),[b,p]=i.useState([]),g=i.useRef(0),[v,f]=i.useState(!1),[C,T]=i.useState(!1),k=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[A,_]=i.useState(k?"mouse":"touch"),[N,w]=i.useState(1),D=i.useRef(!1),[M,j]=i.useState(1),[W,H]=i.useState(0),[$,I]=i.useState(0);Pr("RemoteView",{connState:r,hasScreenshot:!!n,inputMode:A,zoom:M,panX:W,panY:$,isMenuOpen:v,isImeOpen:C});const y=i.useRef(0),F=i.useRef(M),P=i.useRef(W),E=i.useRef($);i.useEffect(()=>{F.current=M},[M]),i.useEffect(()=>{P.current=W},[W]),i.useEffect(()=>{E.current=$},[$]),i.useEffect(()=>{var ie;(ie=l.current)==null||ie.focus()},[]);const G=r==="connected",J=n,ye=G?"Connected. Waiting for first frame...":r==="connecting"?"Connecting to Host...":"Reconnecting to Host...",he=G?"The remote stream is warming up":"Waiting for the remote stream to catch up";i.useEffect(()=>{if(!k||D.current||!J)return;const ie=d.current,pe=c.current;if(!ie||!pe)return;const le=()=>{const B=pe.clientWidth,z=pe.clientHeight,de=ie.naturalWidth,re=ie.naturalHeight;if(!de||!re||!B||!z)return;const R=Math.min(B/de,z/re),ce=Math.max(B/de,z/re)/R;ce>1.01&&(w(ce),j(ce),F.current=ce),D.current=!0};ie.complete&&ie.naturalWidth?le():ie.addEventListener("load",le,{once:!0})},[J,k]);const ne=.5;i.useEffect(()=>{M<=ne&&(H(0),I(0))},[M,ne]);const ue=(ie,pe,le)=>{if(le<=ne)return{x:0,y:0};const B=(le-1)/(2*le)*100,z=(le-1)/(2*le)*100;return{x:Math.max(-B,Math.min(B,ie)),y:Math.max(-z,Math.min(z,pe))}},Se=(ie,pe)=>{if(!d.current)return null;const le=d.current.getBoundingClientRect();return!le.width||!le.height?null:{nx:Math.max(0,Math.min(1,(ie-le.left)/le.width)),ny:Math.max(0,Math.min(1,(pe-le.top)/le.height))}},ve=(ie,pe,le)=>{const B=c.current;if(!B)return;const z=B.getBoundingClientRect(),de=++g.current;p(re=>[...re,{id:de,x:ie-z.left,y:pe-z.top,type:le}]),setTimeout(()=>p(re=>re.filter(R=>R.id!==de)),600)},X=(ie,pe,le)=>{const B=d.current,z=c.current;if(!B||!z)return;const de=B.getBoundingClientRect(),re=z.getBoundingClientRect(),R=B.naturalWidth||de.width,q=B.naturalHeight||de.height,ce=R/q,Ne=de.width/de.height;let je,O,Ie,Le;ce>Ne?(je=de.width,O=de.width/ce,Ie=0,Le=(de.height-O)/2):(O=de.height,je=de.height*ce,Ie=(de.width-je)/2,Le=0);const He=de.left-re.left+Ie+je*ie,ze=de.top-re.top+Le+O*pe,Xe=++g.current;p(Je=>[...Je,{id:Xe,x:He,y:ze,type:le}]),setTimeout(()=>p(Je=>Je.filter(rt=>rt.id!==Xe)),600)},xe=async ie=>{var le;const pe=Se(ie.clientX,ie.clientY);if(pe){u(`Click: ${Math.round(pe.nx*100)}%, ${Math.round(pe.ny*100)}%`),ve(ie.clientX,ie.clientY,"left"),(le=l.current)==null||le.focus();try{const B=await e("input_click",{nx:pe.nx,ny:pe.ny});B!=null&&B.success||t(`❌ Click failed: ${B==null?void 0:B.error}`)}catch(B){t(`❌ Click error: ${B.message||B}`)}}},fe=async(ie,pe,le,B=0)=>{try{await e("input_key",{type:le?"char":"keyDown",key:ie,code:pe,text:le?ie:void 0,unmodifiedText:le?ie:void 0,modifiers:B})}catch(z){t(`❌ Key error: ${z.message||z}`)}},we=async ie=>{if(ie.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(ie.key)&&ie.preventDefault();let le=0;ie.altKey&&(le|=1),ie.ctrlKey&&(le|=2),ie.metaKey&&(le|=4),ie.shiftKey&&(le|=8),u(`Key: ${ie.key}`),await fe(ie.key,ie.code,ie.key.length===1,le)},be=async ie=>{if(ie.key==="Enter"){if(ie.nativeEvent.isComposing)return;if(h){const pe=h;x(""),u(`IME Sent: ${pe}`);try{const le=await e("input_type",{text:pe});le!=null&&le.success||t(`❌ IME error: ${le==null?void 0:le.error}`)}catch(le){t(`❌ IME error: ${le.message}`)}}else u("Key: Enter"),await fe("Enter","Enter",!1)}};i.useEffect(()=>{const ie=l.current;if(!ie)return;const pe=le=>{var B;if((B=d.current)!=null&&B.contains(le.target)){le.preventDefault();const z=Date.now();if(z-y.current<40)return;y.current=z;const de=Se(le.clientX,le.clientY);if(!de)return;u(`Scroll: ${Math.round(le.deltaY)}`),e("input_wheel",{nx:de.nx,ny:de.ny,deltaX:Math.round(le.deltaX),deltaY:Math.round(le.deltaY)}).catch(()=>{})}};return ie.addEventListener("wheel",pe,{passive:!1}),()=>ie.removeEventListener("wheel",pe)},[e]);const{cursorPos:Ce,handleToggleInputMode:ee,handleZoomReset:me}=Jp({containerRef:l,viewportRef:c,imgRef:d,inputMode:A,setInputMode:_,minZoom:ne,zoomRef:F,panXRef:P,panYRef:E,setPanX:H,setPanY:I,setZoom:j,lastWheelTimeRef:y,onAction:e,setLastActionStatus:u,spawnRippleFromNormalized:X,clampPan:ue,isMobile:k,mobileFillZoom:N});return s.jsxs("div",{ref:l,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:we,onContextMenu:ie=>ie.preventDefault(),onFocus:()=>S(!0),onBlur:()=>S(!1),tabIndex:0,children:[s.jsxs("div",{ref:c,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[J?s.jsx("img",{ref:d,src:J,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${M}) translate(${W}%, ${$}%)`,transformOrigin:"center center",cursor:A==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:xe,onContextMenu:ie=>ie.preventDefault(),onDragStart:ie=>ie.preventDefault()}):s.jsx(Yp,{waitingLabel:ye,waitingHint:he,transportType:o}),A==="mouse"&&J&&s.jsx(Gp,{cursorPos:Ce,viewportRef:c,imgRef:d}),b.map(ie=>{const le={left:"59,130,246",right:"239,68,68",double:"34,197,94"}[ie.type];return s.jsxs("div",{style:{position:"absolute",left:ie.x,top:ie.y,pointerEvents:"none",zIndex:200,transform:"translate(-50%, -50%)"},children:[s.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`2px solid rgba(${le}, 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(${le}, 0.9)`,boxShadow:`0 0 12px rgba(${le}, 0.6)`,animation:"click-ripple-dot 0.4s ease-out forwards",position:"absolute",left:-4,top:-4}})]},ie.id)})]}),s.jsx(qp,{inputMode:A,onToggleInputMode:ee,isImeOpen:C,setIsImeOpen:T,isMenuOpen:v,setIsMenuOpen:f,imeText:h,setImeText:x,handleImeSubmit:be,isConnActive:G,zoom:M,isMobile:k,mobileFillZoom:N,onZoomOut:()=>j(ie=>Math.max(.5,ie-.25)),onZoomReset:me,onZoomIn:()=>j(ie=>Math.min(5,ie+.25)),transportType:o,screenshotUsage:a,lastActionStatus:m}),s.jsx("style",{children:`
|
|
6
|
+
`});if(h.isActivityFacing&&u!=="thought"&&u!=="tool"&&u!=="terminal"){const M=h.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:M})]}),S&&x?s.jsx("div",{className:"chat-msg-activity-body",children:s.jsx(ar,{parts:x,renderAsPreformatted:!1})}):s.jsx("div",{className:"chat-msg-activity-body",style:{whiteSpace:"pre-wrap"},children:b})]})}if(u==="thought"){const M=typeof((N=t.meta)==null?void 0:N.label)=="string"?t.meta.label:"Thought";return s.jsxs("div",{className:"self-start chat-msg-thought","data-chat-activity-row":h.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx(op,{size:13}),s.jsx("span",{children:M})]}),s.jsx("div",{className:"chat-msg-body",children:b})]})}if(u==="tool")return s.jsxs("div",{className:"self-start chat-msg-tool","data-chat-activity-row":h.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"})]}),S&&x?s.jsx("div",{className:"tool-text w-full",children:s.jsx(ar,{parts:x,renderAsPreformatted:!1})}):s.jsx("div",{className:"tool-text w-full",style:{whiteSpace:"pre-wrap"},children:b})]});if(u==="terminal"){const M=(w=t.meta)!=null&&w.isRunning?"⏳":"✅",j=typeof((D=t.meta)==null?void 0:D.label)=="string"?t.meta.label:"Ran command";return s.jsxs("div",{className:"self-start chat-msg-terminal","data-chat-activity-row":h.isActivityFacing?"true":void 0,children:[s.jsxs("div",{className:"chat-msg-header",children:[s.jsx("span",{children:M}),s.jsx("span",{children:j})]}),S&&x?s.jsx("div",{className:"chat-msg-body",children:s.jsx(ar,{parts:x,renderAsPreformatted:!0})}):s.jsx("pre",{className:"chat-msg-body",children:b})]})}if(u==="system")return s.jsx("div",{className:"self-center chat-msg-system",children:S&&x?s.jsx(ar,{parts:x,renderAsPreformatted:!1}):b.slice(0,100)});const p=t.meta,v=(typeof(p==null?void 0:p.renderMode)=="string"?p.renderMode.trim():"")==="preformatted",f=b,C=!1,T=f,k=v,A=!k&&Mc(T),_=["chat-message-row",m?"chat-message-row-user self-end":"chat-message-row-assistant self-start"].join(" ");return s.jsx("div",{className:_,children:(f||S||m)&&s.jsxs("div",{className:`chat-bubble ${m?"chat-bubble-user":"chat-bubble-assistant"}`,children:[s.jsxs("div",{className:`chat-bubble-header ${f||S?"mb-1.5":"mb-0"}`,children:[s.jsx("span",{className:"chat-sender",children:m?a||"You":t.senderName||n}),r!=null&&s.jsx("span",{className:"chat-time",children:Tc(r)})]}),(f||S)&&s.jsx("div",{className:"chat-markdown",children:S&&x?s.jsx(ar,{parts:x,renderAsPreformatted:k}):k?s.jsx("pre",{className:"chat-preformatted",children:T}):A?s.jsx(Io,{remarkPlugins:Ic,children:T}):s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:T})}),C]})})},(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),Kp=i.forwardRef(function({messages:t,actionLogs:r,agentName:n="Agent",userName:a,isCliMode:o=!1,isWorking:l=!1,contextKey:c="",receivedAtMap:d={},lastMessageHash:m,showActivityMessages:u=!1,emptyState:h,onLoadMore:x,isLoadingMore:S,hasMoreHistory:b,hiddenLiveCount:p=0,loadError:g,scrollToBottomRequestNonce:v,isVisible:f=!0},C){const T=i.useRef(null),k=i.useRef(null),A=i.useRef(null),_=i.useRef(0),N=i.useRef(""),w=i.useRef(""),D=i.useRef(!1),M=i.useRef(null),j=i.useRef(!1),W=i.useRef(null),H=i.useRef(!1),[$,I]=i.useState(new Set),[y,F]=i.useState({showTop:!1,showBottom:!1}),P=i.useRef(!1),E=i.useRef(!1),G=i.useRef(f),J=i.useRef(f),ye=i.useRef(null);J.current=f;const he=()=>{const re=T.current;return re?re.scrollHeight-re.scrollTop-re.clientHeight<$o:!0},ne=i.useCallback(()=>{const re=T.current,R=re?Pp(re):{showTop:!1,showBottom:!1};F(q=>q.showTop===R.showTop&&q.showBottom===R.showBottom?q:R)},[]),ue=i.useCallback((re="auto")=>{var q;const R=T.current;R&&(R.scrollTo({top:R.scrollHeight,behavior:re}),(q=R.ownerDocument.defaultView)==null||q.requestAnimationFrame(()=>ne()))},[ne]),Se=i.useCallback((re="auto")=>{var q;const R=T.current;R&&(R.scrollTo({top:0,behavior:re}),(q=R.ownerDocument.defaultView)==null||q.requestAnimationFrame(()=>ne()))},[ne]),ve=i.useCallback(()=>{var Ne;const re=T.current,R=(Ne=window.getSelection)==null?void 0:Ne.call(window);if(!re||!R||R.rangeCount===0||R.isCollapsed){H.current=!1;return}const q=R.anchorNode,ce=R.focusNode;H.current=!!(q&&ce&&re.contains(q)&&re.contains(ce))},[]),X=i.useMemo(()=>{const re=Cp(t),R=Nc(t);return Ip(re,R,u)},[t,u]),xe=X.length===t.length?m:void 0,fe=_p(X,xe),we=i.useCallback(()=>{const re=T.current;if(!re||!c||!J.current)return;const R={top:re.scrollTop,fromBottom:Math.max(0,re.scrollHeight-re.scrollTop-re.clientHeight),messageFingerprint:fe};ye.current={contextKey:c,snapshot:R},rr.set(c,R)},[c,fe]),be=i.useCallback((re="auto")=>{M.current!=null&&cancelAnimationFrame(M.current),M.current=requestAnimationFrame(()=>{M.current=null,ue(re)})},[ue]),Ce=i.useCallback(()=>{P.current=!1,j.current=!0,E.current=!0,W.current!=null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{j.current=!1,W.current=null},Pi)},[]);i.useEffect(()=>{const re=!D.current,R=w.current!==c;if(w.current=c,re||R){D.current=!0;const ce=c?rr.get(c):null,Ne=!!ce&&Cn(ce,fe);P.current=Ne?gr(ce):!1,j.current=Dp(ce,fe),H.current||(Ne?requestAnimationFrame(()=>{const je=T.current;je&&(ia(je,ce),P.current=gr(ce),ne(),E.current=!0)}):be("auto")),_.current=X.length,N.current=fe;return}X.length>_.current;const q=fe!==N.current;Ep({hasSelection:H.current,userScrolledUp:P.current,hasChatContentChanged:q})&&be("auto"),_.current=X.length,N.current=fe},[fe,c,X.length,be,ne]),i.useEffect(()=>{v&&(Ce(),H.current||be("auto"))},[Ce,be,v]),i.useEffect(()=>{const re=G.current;re&&!f&&we(),J.current=f,G.current=f;const R=c?rr.get(c):null;if(Lp(re,f,R,fe)){if(!R)return;P.current=gr(R),j.current=!1,H.current||requestAnimationFrame(()=>{const q=T.current;q&&(ia(q,R),ne())});return}},[f,c,fe,Ce,we,be,ne]),i.useEffect(()=>()=>{const re=ye.current;re&&rr.set(re.contextKey,re.snapshot),M.current!=null&&cancelAnimationFrame(M.current),W.current!=null&&window.clearTimeout(W.current)},[]),i.useEffect(()=>{const re=k.current,R=T.current;if(!re||!R)return;const q=()=>{W.current!=null&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{j.current=!1,W.current=null},Pi)},ce=new ResizeObserver(()=>{ne();const Ne=j.current;$p({hasSelection:H.current,userScrolledUp:P.current,contextAutoScrollActive:Ne})&&(be("auto"),Ne&&q())});return ce.observe(re),R!==re&&ce.observe(R),()=>{ce.disconnect(),W.current!=null&&(window.clearTimeout(W.current),W.current=null)}},[be,c,ne]),i.useImperativeHandle(C,()=>({scrollToBottom:(re="smooth")=>{ue(re)}}),[ue]),i.useEffect(()=>{const re=T.current;if(!re)return;let R;const q=()=>{we(),clearTimeout(R),R=setTimeout(()=>{P.current=!he(),ne()},50)};return re.addEventListener("scroll",q,{passive:!0}),()=>{re.removeEventListener("scroll",q),clearTimeout(R)}},[we,ne]),i.useEffect(()=>(document.addEventListener("selectionchange",ve),()=>document.removeEventListener("selectionchange",ve)),[ve]);const ee=i.useRef(0),me=i.useRef(!1);i.useEffect(()=>{const re=T.current;if(!re||!me.current||ee.current===0)return;const R=re.scrollHeight-ee.current;R>0&&(re.scrollTop=R),ne(),we(),ee.current=0,me.current=!1},[X.length,we,ne]),i.useEffect(()=>{if(E.current||!c)return;const re=rr.get(c),R=T.current;if(!(!re||!R)){if(!Cn(re,fe)){ue("auto"),E.current=!0;return}ia(R,re),P.current=gr(re),ne(),E.current=!0}},[c,fe,X.length,ue,ne]);const ie=()=>{const re=T.current;re&&(ee.current=re.scrollHeight),me.current=!0,x==null||x()},pe=()=>{P.current=!0,Se("smooth"),we()},le=()=>{Ce(),ue("smooth"),we()},B=i.useMemo(()=>{const re=X.map((Ne,je)=>({type:"message",data:Ne,index:je,ts:Bp(Ne,je,d)}));if(!r||r.length===0)return re;const R=[...r].sort((Ne,je)=>Ne.timestamp-je.timestamp).map((Ne,je)=>({type:"action",data:Ne,index:je,ts:Ne.timestamp})),q=[];let ce=0;for(const Ne of re){for(;ce<R.length&&Ne.ts>0&&R[ce].ts<Ne.ts;)q.push(R[ce++]);q.push(Ne)}for(;ce<R.length;)q.push(R[ce++]);return q},[X,r,d]),z=p>0||!!b,de=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:T,"data-chat-scroll":!0,className:"chat-container",children:s.jsxs("div",{ref:k,className:"chat-container-content",children:[S&&s.jsx("div",{className:"text-center py-3 text-text-muted text-xs opacity-60 animate-pulse",children:"Loading older messages..."}),z&&!S&&s.jsx("div",{className:"text-center py-2",children:s.jsx("button",{type:"button",onClick:ie,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:de})}),B.length===0&&!z&&(h||s.jsx("div",{className:"text-center mt-16 opacity-20 text-[13px]",children:"Waiting for messages..."})),B.map(re=>{if(re.type==="action"){const Ie=re.data;return s.jsx(Fp,{log:Ie},`action-${re.index}`)}const R=re.data,q=re.index,ce=In(R,q),Ne=R.receivedAt||d[ce],je=`${c}-${ce}`,O=$.has(je);return s.jsx(Wp,{message:R,receivedAt:Ne,agentName:n,userName:a,isCliMode:o,isTextExpanded:O,onToggleTextExpanded:()=>I(Ie=>{const Le=new Set(Ie);return O?Le.delete(je):Le.add(je),Le})},`msg-${ce}`)}),l&&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})]})}),(y.showTop||y.showBottom)&&s.jsxs("div",{className:"chat-scroll-jump-controls","aria-label":"Chat scroll shortcuts",children:[y.showTop&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button",onClick:pe,"aria-label":"Jump to oldest messages",title:"Jump to top",children:"↑ Top"}),y.showBottom&&s.jsx("button",{type:"button",className:"chat-scroll-jump-button chat-scroll-jump-button-primary",onClick:le,"aria-label":"Jump to latest messages",title:"Jump to bottom",children:"↓ Latest"})]})]})}),Hp=i.memo(Kp,(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),Up="modulepreload",zp=function(e){return"/"+e},Ei={},Vp=function(t,r,n){let a=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=Promise.allSettled(r.map(d=>{if(d=zp(d),d in Ei)return;Ei[d]=!0;const m=d.endsWith(".css"),u=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${u}`))return;const h=document.createElement("link");if(h.rel=m?"stylesheet":Up,m||(h.as="script"),h.crossOrigin="",h.href=d,c&&h.setAttribute("nonce",c),document.head.appendChild(h),m)return new Promise((x,S)=>{h.addEventListener("load",x),h.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return a.then(l=>{for(const c of l||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})};let $i=!1;const Ac=i.forwardRef(({onInput:e,onViewportMetrics:t,onScrollMetrics:r,fontSize:n=13,readOnly:a=!1,sizingMode:o="measured"},l)=>{const c=i.useRef(null),[d,m]=i.useState(null),u=i.useRef([]),h=i.useRef(!1),x=i.useRef(!1),S=i.useRef(!1),b=i.useRef(!1),p=()=>{const g=c.current;if(g){h.current&&(g.clear(),h.current=!1);for(const v of u.current)g.write(v.data,v.onProcessed);u.current=[],x.current&&(g.fit(),x.current=!1),S.current&&(g.bumpResize(),S.current=!1),b.current&&(g.scrollToTop(),b.current=!1)}};return i.useImperativeHandle(l,()=>({write:(g,v)=>{c.current?c.current.write(g,v):u.current.push({data:g,onProcessed:v})},clear:()=>{c.current?c.current.clear():(u.current=[],h.current=!0)},reset:()=>{c.current&&typeof c.current.reset=="function"?c.current.reset():(u.current=[],h.current=!0)},resize:(g,v)=>{c.current&&typeof c.current.resize=="function"&&c.current.resize(g,v)},fit:()=>{c.current?c.current.fit():x.current=!0},bumpResize:()=>{c.current?c.current.bumpResize():S.current=!0},scrollToTop:()=>{c.current?c.current.scrollToTop():b.current=!0},getSelection:()=>{var g,v;return((v=(g=c.current)==null?void 0:g.getSelection)==null?void 0:v.call(g))||""},getVisibleText:()=>{var g,v;return((v=(g=c.current)==null?void 0:g.getVisibleText)==null?void 0:v.call(g))||""}}),[]),i.useEffect(()=>{d&&p()},[d]),i.useEffect(()=>{let g=!1;return Vp(()=>import("./terminal-D46M5EWH.js"),__vite__mapDeps([0,1,2])).then(v=>{$i||($i=!0,console.info("[CliTerminal] renderer module loaded: terminal-render-web")),g||m(()=>v.GhosttyTerminalView)}).catch(v=>{console.error("[CliTerminal] failed to load terminal renderer",v)}),()=>{g=!0}},[]),d?s.jsx(d,{ref:c,onInput:e,onViewportMetrics:t,onScrollMetrics:r,fontSize:n,readOnly:a,sizingMode:o,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"}})});Ac.displayName="CliTerminal";function Yr({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 Bi({value:e,max:t,label:r,color:n="#8b5cf6",detail:a,compact:o=!1}){const l=t>0?Math.min(Math.round(e/t*100),100):0,c=l>85?"#ef4444":l>60?"var(--status-warning)":n;return o?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:[l,"%"]})]}),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:`${l}%`,background:c}})})]}):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:[l,"%"]})]}),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:`${l}%`,background:`linear-gradient(90deg, ${c}, ${c}cc)`}})}),a&&s.jsx("div",{className:"text-[10px] text-text-muted mt-0.5",children:a})]})}function Gp({cursorPos:e,viewportRef:t,imgRef:r}){var f;if(!e||!r.current)return null;const n=r.current,a=n.getBoundingClientRect(),o=(f=t.current)==null?void 0:f.getBoundingClientRect();if(!o)return null;const l=n.naturalWidth||a.width,c=n.naturalHeight||a.height,d=l/c,m=a.width/a.height;let u,h,x,S;d>m?(u=a.width,h=a.width/d,x=0,S=(a.height-h)/2):(h=a.height,u=a.height*d,x=(a.width-u)/2,S=0);const b=a.left-o.left+x+u*e.nx,p=a.top-o.top+S+h*e.ny,g=Math.max(8,Math.min(o.width-8,b)),v=Math.max(8,Math.min(o.height-8,p));return s.jsxs("div",{style:{position:"absolute",left:g-8,top:v-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 qp({inputMode:e,onToggleInputMode:t,isImeOpen:r,setIsImeOpen:n,isMenuOpen:a,setIsMenuOpen:o,imeText:l,setImeText:c,handleImeSubmit:d,isConnActive:m,zoom:u,isMobile:h,mobileFillZoom:x,onZoomOut:S,onZoomReset:b,onZoomIn:p,transportType:g,screenshotUsage:v,lastActionStatus:f}){return s.jsxs(s.Fragment,{children:[s.jsxs("div",{onTouchStart:C=>C.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(C=>!C),o(!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:l,autoFocus:!0,onTouchStart:C=>C.stopPropagation(),onChange:C=>c(C.target.value),onKeyDown:C=>{d(C)},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:()=>{o(C=>!C),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:m?"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:m?"#22c55e":"#eab308",boxShadow:m?"0 0 4px #22c55e80":"0 0 4px #eab30880"}}),s.jsx("span",{className:"text-[8px] font-extrabold",style:{color:m?"#22c55e":"#eab308"},children:m?"Connected":"WS"})]}),u>1&&s.jsxs("span",{className:"text-[8px] font-bold text-indigo-400",children:[Math.round(u*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"}),v&&v.dailyBudgetMinutes>0&&s.jsx("span",{className:"text-[8px] font-bold px-1 py-0.5 rounded",style:{color:v.budgetExhausted?"#ef4444":"#c4b5fd",background:v.budgetExhausted?"rgba(239,68,68,0.1)":"rgba(139,92,246,0.14)"},title:"Daily TURN relay usage",children:v.budgetExhausted?"TURN blocked":`TURN ${v.dailyUsedMinutes}/${v.dailyBudgetMinutes}m`}),f&&s.jsx("span",{className:"text-[8px] text-neutral-500 font-semibold max-w-[100px] overflow-hidden text-ellipsis whitespace-nowrap",children:f})]})]}),a&&s.jsxs("div",{onTouchStart:C=>C.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: ",u<=(h?x:1)+.01?h?"FILL":"FIT":`${Math.round(u*100)}%`]}),s.jsxs("div",{style:{display:"flex",gap:4},children:[s.jsx("button",{onClick:C=>{C.stopPropagation(),S()},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:C=>{C.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:h?"FILL":"FIT"}),s.jsx("button",{onClick:C=>{C.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 Yp({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 Xp(){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 Oi(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 Pr(e,t){const r=i.useRef(null),n=i.useRef(0);i.useEffect(()=>{if(!Xp())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(([l,c])=>[l,Oi(c)]))}),r.current=t;return}const o=Object.keys({...a,...t}).filter(l=>!Object.is(a[l],t[l]));o.length>0&&console.debug(`[render-trace] ${e}#${n.current}`,{changed:o,snapshot:Object.fromEntries(o.map(l=>[l,Oi(t[l])]))}),r.current=t})}function Jp({containerRef:e,viewportRef:t,imgRef:r,inputMode:n,setInputMode:a,minZoom:o,zoomRef:l,panXRef:c,panYRef:d,setPanX:m,setPanY:u,setZoom:h,lastWheelTimeRef:x,onAction:S,setLastActionStatus:b,spawnRippleFromNormalized:p,clampPan:g,isMobile:v,mobileFillZoom:f}){const[C,T]=i.useState(null),k=i.useRef(null),A=i.useRef(null),_=i.useRef(null),N=i.useRef(!1),w=i.useRef(null),D=i.useRef(0),M=i.useRef(null),j=i.useRef(1),W=i.useRef({x:0,y:0}),H=i.useRef(!1),$=i.useRef(n),I=i.useRef(S),y=30,F=550,P=18,E=60,G=400,J=12,ye=()=>{if(k.current)return;const ue={nx:.5,ny:.5};k.current=ue,T(ue)};return i.useEffect(()=>{$.current=n,n==="mouse"&&ye()},[n]),i.useEffect(()=>{I.current=S},[S]),i.useEffect(()=>{const ue=e.current;if(!ue)return;const Se=be=>{if(!r.current)return null;const Ce=r.current.getBoundingClientRect();return!Ce.width||!Ce.height?null:{nx:Math.max(0,Math.min(1,(be.clientX-Ce.left)/Ce.width)),ny:Math.max(0,Math.min(1,(be.clientY-Ce.top)/Ce.height))}},ve=(be,Ce)=>{if(!r.current)return{dnx:0,dny:0};const ee=r.current,me=ee.getBoundingClientRect(),ie=ee.naturalWidth||me.width,pe=ee.naturalHeight||me.height,le=ie/pe,B=me.width/me.height;let z,de;return le>B?(z=me.width,de=me.width/le):(de=me.height,z=me.height*le),{dnx:be/z,dny:Ce/de}},X=(be,Ce,ee)=>{if(ee<=1.05)return;const me=-(be-.5)*100,ie=-(Ce-.5)*100,pe=g(me,ie,ee);(Math.abs(pe.x-c.current)>.1||Math.abs(pe.y-d.current)>.1)&&(m(pe.x),u(pe.y),c.current=pe.x,d.current=pe.y)},xe=be=>{const Ce=t.current;if(Ce&&be.target instanceof Node&&Ce.contains(be.target))be.preventDefault();else return;if(be.touches.length===1){const ee=be.touches[0];A.current={x:ee.clientX,y:ee.clientY,time:Date.now()},_.current={x:ee.clientX,y:ee.clientY},H.current||(N.current=!1),w.current=setTimeout(()=>{if(!N.current&&!H.current)if(N.current=!0,$.current==="mouse"){const me=k.current||{nx:.5,ny:.5};b("Right Click"),p(me.nx,me.ny,"right"),I.current("input_click",{...me,button:"right"}).catch(()=>{})}else{const me=Se(ee);me&&(b("Right Click"),p(me.nx,me.ny,"right"),I.current("input_click",{...me,button:"right"}).catch(()=>{}))}},500);return}if(be.touches.length===2){w.current&&clearTimeout(w.current),N.current=!0,H.current=!0;const ee=be.touches[1].clientX-be.touches[0].clientX,me=be.touches[1].clientY-be.touches[0].clientY;M.current=Math.sqrt(ee*ee+me*me),j.current=l.current,W.current={x:(be.touches[0].clientX+be.touches[1].clientX)/2,y:(be.touches[0].clientY+be.touches[1].clientY)/2}}},fe=be=>{const Ce=t.current;if(Ce&&be.target instanceof Node&&Ce.contains(be.target)&&be.preventDefault(),be.touches.length===1&&_.current){const ee=be.touches[0],me=ee.clientX-_.current.x,ie=ee.clientY-_.current.y;if(!N.current&&A.current){const pe=ee.clientX-A.current.x,le=ee.clientY-A.current.y;Math.sqrt(pe*pe+le*le)>8&&(N.current=!0,w.current&&clearTimeout(w.current))}if(N.current)if($.current==="mouse"){const pe=ve(me,ie),le=k.current||{nx:.5,ny:.5},B=Math.max(0,Math.min(1,le.nx+pe.dnx)),z=Math.max(0,Math.min(1,le.ny+pe.dny));k.current={nx:B,ny:z},T({nx:B,ny:z}),b(`Cursor: ${Math.round(B*100)}%, ${Math.round(z*100)}%`),X(B,z,l.current);const de=Date.now();de-x.current>=30&&(x.current=de,I.current("input_mouseMoved",{nx:B,ny:z}).catch(()=>{}))}else if(l.current>1){const pe=t.current;if(pe){const le=pe.clientWidth,B=pe.clientHeight,z=c.current+me/le*100,de=d.current+ie/B*100,re=g(z,de,l.current);m(re.x),u(re.y),c.current=re.x,d.current=re.y}}else{const pe=Se(ee);if(pe){const le=Date.now();le-x.current>=40&&(x.current=le,b("Scroll"),I.current("input_wheel",{nx:pe.nx,ny:pe.ny,deltaX:Math.round(-me*2.5),deltaY:Math.round(-ie*2.5)}).catch(()=>{}))}}_.current={x:ee.clientX,y:ee.clientY};return}if(be.touches.length===2&&M.current!==null){const ee=be.touches[1].clientX-be.touches[0].clientX,me=be.touches[1].clientY-be.touches[0].clientY,pe=Math.sqrt(ee*ee+me*me)/M.current,le=(be.touches[0].clientX+be.touches[1].clientX)/2,B=(be.touches[0].clientY+be.touches[1].clientY)/2,z=le-W.current.x,de=B-W.current.y,re=Math.abs(pe-1)>.03;if($.current==="mouse"){if(re){const R=Math.max(o,Math.min(5,j.current*pe));h(R),l.current=R}else if(Math.abs(z)>2||Math.abs(de)>2){const R=k.current||{nx:.5,ny:.5},q=Date.now();q-x.current>=30&&(x.current=q,b("Scroll"),I.current("input_wheel",{nx:R.nx,ny:R.ny,deltaX:Math.round(-z*3),deltaY:Math.round(-de*3)}).catch(()=>{}))}}else{const R=Math.max(o,Math.min(5,j.current*pe));h(R),l.current=R;const q=t.current;if(q&&R>1){const ce=q.clientWidth,Ne=q.clientHeight,je=c.current+z/ce*100,O=d.current+de/Ne*100,Ie=g(je,O,R);m(Ie.x),u(Ie.y),c.current=Ie.x,d.current=Ie.y}}W.current={x:le,y:B}}},we=be=>{var Ce;if(w.current&&clearTimeout(w.current),M.current=null,be.touches.length===1&&H.current){const ee=be.touches[0];A.current={x:ee.clientX,y:ee.clientY,time:Date.now()},_.current={x:ee.clientX,y:ee.clientY},N.current=!0;return}if(be.touches.length===0){if(H.current){H.current=!1,N.current=!1;return}if(be.changedTouches.length===1){const ee=be.changedTouches[0],me=Date.now(),ie=me-(((Ce=A.current)==null?void 0:Ce.time)||0),pe=A.current?ee.clientX-A.current.x:0,le=A.current?ee.clientY-A.current.y:0,B=Math.sqrt(pe*pe+le*le);if($.current==="mouse"){if(ie<y||ie>F||B>P){N.current=!1;return}const z=k.current||Se(ee);z&&(b(`Click: ${Math.round(z.nx*100)}%, ${Math.round(z.ny*100)}%`),p(z.nx,z.ny,"left"),I.current("input_click",{...z}).catch(()=>{}))}else{if(N.current){N.current=!1;return}if(ie<E||ie>G||B>J){N.current=!1;return}const z=Se(ee);if(!z)return;me-D.current<300?(b("Double tap"),p(z.nx,z.ny,"double"),I.current("input_click",{...z,clickCount:2}).catch(()=>{}),D.current=0):(b(`Tap: ${Math.round(z.nx*100)}%, ${Math.round(z.ny*100)}%`),p(z.nx,z.ny,"left"),I.current("input_click",{...z}).catch(()=>{}),D.current=me)}}N.current=!1}};return ue.addEventListener("touchstart",xe,{passive:!1}),ue.addEventListener("touchmove",fe,{passive:!1}),ue.addEventListener("touchend",we,{passive:!1}),()=>{ue.removeEventListener("touchstart",xe),ue.removeEventListener("touchmove",fe),ue.removeEventListener("touchend",we),w.current&&clearTimeout(w.current)}},[e,t,r,o,l,c,d,m,u,h,x,b,p,g]),{cursorPos:C,cursorPosRef:k,handleToggleInputMode:()=>{a(ue=>{const Se=ue==="touch"?"mouse":"touch";return Se==="mouse"&&ye(),Se})},handleZoomReset:()=>{const ue=v?f:1;h(ue),l.current=ue,m(0),u(0),c.current=0,d.current=0}}}function _c({onAction:e,addLog:t,connState:r,connScreenshot:n,screenshotUsage:a,transportType:o}){const l=i.useRef(null),c=i.useRef(null),d=i.useRef(null),[m,u]=i.useState(null),[h,x]=i.useState(""),[,S]=i.useState(!1),[b,p]=i.useState([]),g=i.useRef(0),[v,f]=i.useState(!1),[C,T]=i.useState(!1),k=typeof window<"u"&&window.matchMedia("(max-width: 768px)").matches,[A,_]=i.useState(k?"mouse":"touch"),[N,w]=i.useState(1),D=i.useRef(!1),[M,j]=i.useState(1),[W,H]=i.useState(0),[$,I]=i.useState(0);Pr("RemoteView",{connState:r,hasScreenshot:!!n,inputMode:A,zoom:M,panX:W,panY:$,isMenuOpen:v,isImeOpen:C});const y=i.useRef(0),F=i.useRef(M),P=i.useRef(W),E=i.useRef($);i.useEffect(()=>{F.current=M},[M]),i.useEffect(()=>{P.current=W},[W]),i.useEffect(()=>{E.current=$},[$]),i.useEffect(()=>{var ie;(ie=l.current)==null||ie.focus()},[]);const G=r==="connected",J=n,ye=G?"Connected. Waiting for first frame...":r==="connecting"?"Connecting to Host...":"Reconnecting to Host...",he=G?"The remote stream is warming up":"Waiting for the remote stream to catch up";i.useEffect(()=>{if(!k||D.current||!J)return;const ie=d.current,pe=c.current;if(!ie||!pe)return;const le=()=>{const B=pe.clientWidth,z=pe.clientHeight,de=ie.naturalWidth,re=ie.naturalHeight;if(!de||!re||!B||!z)return;const R=Math.min(B/de,z/re),ce=Math.max(B/de,z/re)/R;ce>1.01&&(w(ce),j(ce),F.current=ce),D.current=!0};ie.complete&&ie.naturalWidth?le():ie.addEventListener("load",le,{once:!0})},[J,k]);const ne=.5;i.useEffect(()=>{M<=ne&&(H(0),I(0))},[M,ne]);const ue=(ie,pe,le)=>{if(le<=ne)return{x:0,y:0};const B=(le-1)/(2*le)*100,z=(le-1)/(2*le)*100;return{x:Math.max(-B,Math.min(B,ie)),y:Math.max(-z,Math.min(z,pe))}},Se=(ie,pe)=>{if(!d.current)return null;const le=d.current.getBoundingClientRect();return!le.width||!le.height?null:{nx:Math.max(0,Math.min(1,(ie-le.left)/le.width)),ny:Math.max(0,Math.min(1,(pe-le.top)/le.height))}},ve=(ie,pe,le)=>{const B=c.current;if(!B)return;const z=B.getBoundingClientRect(),de=++g.current;p(re=>[...re,{id:de,x:ie-z.left,y:pe-z.top,type:le}]),setTimeout(()=>p(re=>re.filter(R=>R.id!==de)),600)},X=(ie,pe,le)=>{const B=d.current,z=c.current;if(!B||!z)return;const de=B.getBoundingClientRect(),re=z.getBoundingClientRect(),R=B.naturalWidth||de.width,q=B.naturalHeight||de.height,ce=R/q,Ne=de.width/de.height;let je,O,Ie,Le;ce>Ne?(je=de.width,O=de.width/ce,Ie=0,Le=(de.height-O)/2):(O=de.height,je=de.height*ce,Ie=(de.width-je)/2,Le=0);const He=de.left-re.left+Ie+je*ie,ze=de.top-re.top+Le+O*pe,Xe=++g.current;p(Je=>[...Je,{id:Xe,x:He,y:ze,type:le}]),setTimeout(()=>p(Je=>Je.filter(rt=>rt.id!==Xe)),600)},xe=async ie=>{var le;const pe=Se(ie.clientX,ie.clientY);if(pe){u(`Click: ${Math.round(pe.nx*100)}%, ${Math.round(pe.ny*100)}%`),ve(ie.clientX,ie.clientY,"left"),(le=l.current)==null||le.focus();try{const B=await e("input_click",{nx:pe.nx,ny:pe.ny});B!=null&&B.success||t(`❌ Click failed: ${B==null?void 0:B.error}`)}catch(B){t(`❌ Click error: ${B.message||B}`)}}},fe=async(ie,pe,le,B=0)=>{try{await e("input_key",{type:le?"char":"keyDown",key:ie,code:pe,text:le?ie:void 0,unmodifiedText:le?ie:void 0,modifiers:B})}catch(z){t(`❌ Key error: ${z.message||z}`)}},we=async ie=>{if(ie.target.tagName==="INPUT")return;["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Backspace","Tab","Enter","Escape"].includes(ie.key)&&ie.preventDefault();let le=0;ie.altKey&&(le|=1),ie.ctrlKey&&(le|=2),ie.metaKey&&(le|=4),ie.shiftKey&&(le|=8),u(`Key: ${ie.key}`),await fe(ie.key,ie.code,ie.key.length===1,le)},be=async ie=>{if(ie.key==="Enter"){if(ie.nativeEvent.isComposing)return;if(h){const pe=h;x(""),u(`IME Sent: ${pe}`);try{const le=await e("input_type",{text:pe});le!=null&&le.success||t(`❌ IME error: ${le==null?void 0:le.error}`)}catch(le){t(`❌ IME error: ${le.message}`)}}else u("Key: Enter"),await fe("Enter","Enter",!1)}};i.useEffect(()=>{const ie=l.current;if(!ie)return;const pe=le=>{var B;if((B=d.current)!=null&&B.contains(le.target)){le.preventDefault();const z=Date.now();if(z-y.current<40)return;y.current=z;const de=Se(le.clientX,le.clientY);if(!de)return;u(`Scroll: ${Math.round(le.deltaY)}`),e("input_wheel",{nx:de.nx,ny:de.ny,deltaX:Math.round(le.deltaX),deltaY:Math.round(le.deltaY)}).catch(()=>{})}};return ie.addEventListener("wheel",pe,{passive:!1}),()=>ie.removeEventListener("wheel",pe)},[e]);const{cursorPos:Ce,handleToggleInputMode:ee,handleZoomReset:me}=Jp({containerRef:l,viewportRef:c,imgRef:d,inputMode:A,setInputMode:_,minZoom:ne,zoomRef:F,panXRef:P,panYRef:E,setPanX:H,setPanY:I,setZoom:j,lastWheelTimeRef:y,onAction:e,setLastActionStatus:u,spawnRippleFromNormalized:X,clampPan:ue,isMobile:k,mobileFillZoom:N});return s.jsxs("div",{ref:l,className:"flex-1 flex flex-col bg-black relative overflow-hidden outline-none touch-none",onKeyDown:we,onContextMenu:ie=>ie.preventDefault(),onFocus:()=>S(!0),onBlur:()=>S(!1),tabIndex:0,children:[s.jsxs("div",{ref:c,className:"flex-1 relative overflow-hidden flex items-center justify-center bg-black",children:[J?s.jsx("img",{ref:d,src:J,alt:"Remote View",style:{display:"block",maxWidth:"100%",maxHeight:"100%",width:"auto",height:"auto",transform:`scale(${M}) translate(${W}%, ${$}%)`,transformOrigin:"center center",cursor:A==="mouse"?"default":"crosshair",userSelect:"none",WebkitTouchCallout:"none"},onClick:xe,onContextMenu:ie=>ie.preventDefault(),onDragStart:ie=>ie.preventDefault()}):s.jsx(Yp,{waitingLabel:ye,waitingHint:he,transportType:o}),A==="mouse"&&J&&s.jsx(Gp,{cursorPos:Ce,viewportRef:c,imgRef:d}),b.map(ie=>{const le={left:"59,130,246",right:"239,68,68",double:"34,197,94"}[ie.type];return s.jsxs("div",{style:{position:"absolute",left:ie.x,top:ie.y,pointerEvents:"none",zIndex:200,transform:"translate(-50%, -50%)"},children:[s.jsx("div",{style:{width:40,height:40,borderRadius:"50%",border:`2px solid rgba(${le}, 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(${le}, 0.9)`,boxShadow:`0 0 12px rgba(${le}, 0.6)`,animation:"click-ripple-dot 0.4s ease-out forwards",position:"absolute",left:-4,top:-4}})]},ie.id)})]}),s.jsx(qp,{inputMode:A,onToggleInputMode:ee,isImeOpen:C,setIsImeOpen:T,isMenuOpen:v,setIsMenuOpen:f,imeText:h,setImeText:x,handleImeSubmit:be,isConnActive:G,zoom:M,isMobile:k,mobileFillZoom:N,onZoomOut:()=>j(ie=>Math.max(.5,ie-.25)),onZoomReset:me,onZoomIn:()=>j(ie=>Math.min(5,ie+.25)),transportType:o,screenshotUsage:a,lastActionStatus:m}),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))}}};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,
|
|
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=/\x1b\]11;[^\x07\x1b]*(?:\x07|\x1b\\)/g,qu=/\x1b\]11;rgb:[0-9a-fA-F]{1,4}\/[0-9a-fA-F]{1,4}\/[0-9a-fA-F]{1,4}/g,Vu=/(^|[\r\n])\]11;rgb:[0-9a-fA-F]{1,4}\/[0-9a-fA-F]{1,4}\/[0-9a-fA-F]{1,4}(?:\x07|\x1b\\)?(?=$|[\r\n])/g,Yu=/\x1b\[[?>][0-9;]*c/g;function Gu(t){return t.replace(Ku,"").replace(qu,"").replace(Vu,"$1").replace(Yu,"")}const ju=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,Xu=5e4,Zu=`
|
|
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);
|
|
@@ -139,5 +139,5 @@ void main() {
|
|
|
139
139
|
border-radius: 999px;
|
|
140
140
|
border: 2px solid rgba(15, 17, 23, 0.9);
|
|
141
141
|
}
|
|
142
|
-
`;let Lo=!1;const
|
|
143
|
-
`).replace(/[\s\n]+$/g,"")},y=()=>{const g=d.current;if(g){try{g.refresh(0,Math.max(0,g.rows-1))}catch{}S()}},E=g=>{g&&g()&&(v(),y())};return Q.useEffect(()=>{var g,b,T,F;if(C.current=n,!!n){try{(g=d.current)==null||g.blur()}catch{}try{const P=(T=(b=c.current)==null?void 0:b.ownerDocument)==null?void 0:T.activeElement;P instanceof HTMLElement&&((F=c.current)!=null&&F.contains(P))&&P.blur()}catch{}}},[n]),Q.useImperativeHandle(a,()=>({write:(g,b)=>{d.current?d.current.write(g,b):f.current.push({data:g,onProcessed:b})},clear:()=>{d.current?d.current.clear():f.current=[]},reset:()=>{d.current?d.current.reset():f.current=[]},resize:(g,b)=>{d.current&&(d.current.resize(g,b),A.current={cols:g,rows:b},W(()=>{S()}))},fit:()=>m(!0),bumpResize:()=>{o==="fit"?m(!1):W(()=>{y()})},scrollToTop:()=>{const g=(b=4)=>{const T=d.current;if(T){try{T.scrollToTop()}catch{}v(),y(),b>0&&W(()=>g(b-1))}};g()},getSelection:()=>{var g,b;return((b=(g=d.current)==null?void 0:g.getSelection)==null?void 0:b.call(g))||""},getVisibleText:x}),[]),Q.useEffect(()=>{let g=!1,b=null,T=null,F=null,P=null;function V(){var Vr,Yr,Gr,jr,Xr;if(!c.current||g)return;const $=new nd({cols:
|
|
142
|
+
`;let Lo=!1;const Ju=(t,e,i)=>{if(e>=i)return!1;const s=t.buffer.active;if(!s||s.baseY!==i||s.viewportY===e)return!1;try{return t.scrollLines(e-s.viewportY),t.buffer.active.viewportY===e}catch{return!1}},Eo=t=>{const e=t.buffer.active;if(!e)return;const i=e.viewportY,s=e.baseY;if(!(i>=s))return()=>Ju(t,i,s)},Qu=Q.forwardRef(({onInput:t,onResize:e,onViewportMetrics:i,onScrollMetrics:s,fontSize:r=13,readOnly:n=!1,sizingMode:o="measured",className:h,style:l},a)=>{const c=Q.useRef(null),d=Q.useRef(null),u=Q.useRef(null),_=Q.useRef(null),f=Q.useRef([]),w=Q.useRef(null),L=Q.useRef(t),M=Q.useRef(e),R=Q.useRef(i),D=Q.useRef(s),C=Q.useRef(n),A=Q.useRef(null),[I,K]=Q.useState(!1),[j,oe]=Q.useState(null),be=()=>{var g,b;return((b=(g=c.current)==null?void 0:g.ownerDocument)==null?void 0:b.defaultView)||window},W=g=>be().requestAnimationFrame(g),m=(g=!1)=>{var b,T;if(o==="fit")try{(b=u.current)==null||b.fit();const F=d.current;if(!F)return;const{cols:P,rows:V}=F,$=A.current;(g||!$||$.cols!==P||$.rows!==V)&&(A.current={cols:P,rows:V},(T=M.current)==null||T.call(M,P,V))}catch{}};Q.useEffect(()=>{L.current=t},[t]),Q.useEffect(()=>{M.current=e},[e]),Q.useEffect(()=>{R.current=i},[i]),Q.useEffect(()=>{D.current=s},[s]);const p=()=>{var g;return(g=c.current)==null?void 0:g.querySelector(".xterm-viewport")},v=()=>{var V;const g=p();if(!g)return;const b=g.scrollTop,T=g.scrollHeight,F=g.clientHeight,P=T>F+2;(V=D.current)==null||V.call(D,{scrollTop:b,scrollHeight:T,clientHeight:F,canScroll:P,atTop:P&&b<=2})},S=()=>{var V,$,q;const g=(V=c.current)==null?void 0:V.querySelector(".xterm-screen"),b=($=c.current)==null?void 0:$.querySelector(".xterm-viewport"),T=g||b;if(!T)return;let F=Math.max(T.clientWidth||0,T.scrollWidth||0),P=Math.max(T.clientHeight||0,T.scrollHeight||0);F<=0||P<=0||(F+=ko*2,P+=xo*2,(q=R.current)==null||q.call(R,{width:F,height:P}),v())},x=()=>{var V;const g=d.current,b=(V=g==null?void 0:g.buffer)==null?void 0:V.active;if(!g||!b)return"";const T=Math.max(0,b.viewportY||0),F=Math.min(b.length,T+g.rows),P=[];for(let $=T;$<F;$+=1){const q=b.getLine($);P.push((q==null?void 0:q.translateToString(!0))||"")}return P.join(`
|
|
143
|
+
`).replace(/[\s\n]+$/g,"")},y=()=>{const g=d.current;if(g){try{g.refresh(0,Math.max(0,g.rows-1))}catch{}S()}},E=g=>{g&&g()&&(v(),y())};return Q.useEffect(()=>{var g,b,T,F;if(C.current=n,!!n){try{(g=d.current)==null||g.blur()}catch{}try{const P=(T=(b=c.current)==null?void 0:b.ownerDocument)==null?void 0:T.activeElement;P instanceof HTMLElement&&((F=c.current)!=null&&F.contains(P))&&P.blur()}catch{}}},[n]),Q.useImperativeHandle(a,()=>({write:(g,b)=>{d.current?d.current.write(g,b):f.current.push({data:g,onProcessed:b})},clear:()=>{d.current?d.current.clear():f.current=[]},reset:()=>{d.current?d.current.reset():f.current=[]},resize:(g,b)=>{d.current&&(d.current.resize(g,b),A.current={cols:g,rows:b},W(()=>{S()}))},fit:()=>m(!0),bumpResize:()=>{o==="fit"?m(!1):W(()=>{y()})},scrollToTop:()=>{const g=(b=4)=>{const T=d.current;if(T){try{T.scrollToTop()}catch{}v(),y(),b>0&&W(()=>g(b-1))}};g()},getSelection:()=>{var g,b;return((b=(g=d.current)==null?void 0:g.getSelection)==null?void 0:b.call(g))||""},getVisibleText:x}),[]),Q.useEffect(()=>{let g=!1,b=null,T=null,F=null,P=null;function V(){var Vr,Yr,Gr,jr,Xr;if(!c.current||g)return;const $=new nd({cols:ju,rows:Co,cursorBlink:!0,cursorStyle:"bar",cursorWidth:8,fontSize:r,fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', 'Menlo', monospace",fontWeight:"400",letterSpacing:0,lineHeight:1.2,theme:yo,allowTransparency:!0,scrollback:Xu,scrollSensitivity:1.15,fastScrollSensitivity:4,smoothScrollDuration:120,scrollOnUserInput:!1,convertEol:!1,disableStdin:!1});if($.open(c.current),d.current=$,T=$,u.current=null,o==="fit"){const J=new Uu;$.loadAddon(J),u.current=J}const q=(Yr=(Vr=c.current)==null?void 0:Vr.ownerDocument)==null?void 0:Yr.defaultView,Y=((Gr=q==null?void 0:q.location)==null?void 0:Gr.pathname)==="/popout.html"||((Xr=(jr=q==null?void 0:q.location)==null?void 0:jr.pathname)==null?void 0:Xr.endsWith("/popout.html"))||!!(q!=null&&q.opener);let G="dom";if(!Y)try{const J=new Wu;J.onContextLoss(()=>{J.dispose()}),$.loadAddon(J),G="webgl"}catch{}Lo||(Lo=!0,console.info(`[terminal-render-web] renderer=${G}`)),oe(G),b=$.onData(J=>{if(C.current)return;const ae=Gu(J);if(!ae)return;const qe=w.current??Eo($);w.current=null,L.current(ae),E(qe),W(()=>{E(qe)})}),W(()=>{try{m(!0),S(),v(),K(!0),C.current||$.focus();for(const J of f.current)$.write(J.data,J.onProcessed);f.current=[]}catch{}});const X=c.current,pe=p(),Ge=()=>v();pe==null||pe.addEventListener("scroll",Ge,{passive:!0});const Ke=()=>{C.current||(w.current=Eo($)||null)};X.addEventListener("keydown",Ke,{capture:!0}),P=()=>{X.removeEventListener("keydown",Ke,{capture:!0})};let ve=null,z=0;const Lt={passive:!1,capture:!0},Et={passive:!0,capture:!0},ci=J=>{var gt,Mt;const ae=(Mt=(gt=d.current)==null?void 0:gt.buffer)==null?void 0:Mt.active,qe=!!J&&J.scrollHeight>J.clientHeight+2,ft=!!ae&&!!d.current&&ae.length>d.current.rows;return qe||ft},Xt=J=>{var pt;const ae=d.current,qe=Math.max(1,(ae==null?void 0:ae.rows)||Co),ft=J.clientHeight/qe;if(Number.isFinite(ft)&&ft>0)return ft;const gt=(pt=c.current)==null?void 0:pt.querySelector(".xterm-rows > div"),Mt=(gt==null?void 0:gt.getBoundingClientRect().height)||0;return Number.isFinite(Mt)&&Mt>0?Mt:r*1.2},di=J=>{var qe;if(J.touches.length!==1){ve=null,z=0;return}const ae=p();if(!ae||!ci(ae)){ve=null,z=0;return}ve=((qe=J.touches[0])==null?void 0:qe.clientY)??null,z=0},Fi=J=>{var Zr,Jr;if(ve===null||J.touches.length!==1)return;const ae=p(),qe=(Zr=J.touches[0])==null?void 0:Zr.clientY;if(!ae||typeof qe!="number")return;const ft=ve-qe;if(ve=qe,Math.abs(ft)<1)return;const gt=ae.scrollTop,Mt=Math.max(0,ae.scrollHeight-ae.clientHeight);if(ae.scrollTop=Math.max(0,Math.min(Mt,gt+ft)),ae.scrollTop!==gt){J.preventDefault(),z=0,v();return}const pt=d.current,Wi=(Jr=pt==null?void 0:pt.buffer)==null?void 0:Jr.active;if(!pt||!Wi||Wi.length<=pt.rows)return;z+=ft;const ms=Math.trunc(z/Xt(ae));if(ms===0)return;const Xa=Wi.viewportY;try{pt.scrollLines(ms)}catch{}z-=ms*Xt(ae),(Wi.viewportY!==Xa||Math.abs(z)<Xt(ae))&&(J.preventDefault(),v(),y())},Ni=()=>{ve=null,z=0};X.addEventListener("touchstart",di,Et),X.addEventListener("touchmove",Fi,Lt),X.addEventListener("touchend",Ni,Et),X.addEventListener("touchcancel",Ni,Et),F=()=>{pe==null||pe.removeEventListener("scroll",Ge),X.removeEventListener("touchstart",di,Et),X.removeEventListener("touchmove",Fi,Lt),X.removeEventListener("touchend",Ni,Et),X.removeEventListener("touchcancel",Ni,Et)},g&&(F==null||F(),P==null||P(),b.dispose(),$.dispose())}try{V()}catch($){console.error("[terminal-render-web] failed to initialize terminal renderer",$)}return()=>{var $;g=!0,A.current=null,($=_.current)==null||$.disconnect(),_.current=null,b==null||b.dispose(),F==null||F(),P==null||P(),w.current=null,T==null||T.dispose(),d.current=null,u.current=null}},[o]),Q.useEffect(()=>{const g=d.current;if(g){if(g.options.fontSize===r){W(()=>{S()});return}try{g.options.fontSize=r,g.refresh(0,Math.max(0,g.rows-1))}catch{}W(()=>{m(!0),S()})}},[r]),Q.useEffect(()=>{var F,P;if(o!=="fit")return;const g=c.current,b=(P=(F=g==null?void 0:g.ownerDocument)==null?void 0:F.defaultView)==null?void 0:P.ResizeObserver;if(!g||!b)return;const T=new b(V=>{const $=V[0];if(!$)return;const{width:q,height:Y}=$.contentRect;q<=0||Y<=0||W(()=>{m(!1)})});return T.observe(g),_.current=T,()=>{T.disconnect(),_.current===T&&(_.current=null)}},[o]),Q.useEffect(()=>{var F,P,V;const g=(P=(F=c.current)==null?void 0:F.ownerDocument)==null?void 0:P.defaultView,b=(V=c.current)==null?void 0:V.ownerDocument;if(!g||!b)return;const T=()=>{W(()=>{y()})};return g.addEventListener("focus",T),g.addEventListener("resize",T),g.addEventListener("pageshow",T),b.addEventListener("visibilitychange",T),()=>{g.removeEventListener("focus",T),g.removeEventListener("resize",T),g.removeEventListener("pageshow",T),b.removeEventListener("visibilitychange",T)}},[j,o]),ui.jsxs(ui.Fragment,{children:[ui.jsx("style",{children:Zu}),ui.jsx("div",{"data-terminal-renderer":j||"pending",className:["adhdev-terminal-renderer",h].filter(Boolean).join(" "),style:{width:"100%",height:"100%",overflow:"hidden",background:yo.background,padding:`${xo}px ${ko}px`,boxSizing:"border-box",opacity:I?1:0,transition:"opacity 200ms ease",...l},children:ui.jsx("div",{ref:c,className:"adhdev-terminal-renderer-mount h-full w-full",style:{width:"100%",height:"100%",overflow:"hidden"}})})]})});Qu.displayName="GhosttyTerminalView";export{Qu as GhosttyTerminalView,Gu as sanitizeTerminalInputForProvider};
|
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-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-CiuXW9si.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/vendor-CgiI0UIA.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-BNKDsz6G.css">
|
|
13
13
|
</head>
|