@adhdev/daemon-standalone 0.5.26 → 0.5.27
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
|
@@ -174,7 +174,7 @@ WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){t
|
|
|
174
174
|
100% { transform: scale(0.5); opacity: 0; }
|
|
175
175
|
}
|
|
176
176
|
`})]})}function kR({screenshotUrl:e,mode:t="preview",zoom:r=100,interactive:n=!1,connectionState:i,onDismiss:s,onClickAt:o,onKeyDown:l,badge:a,emptyMessage:c,aspectRatio:d,className:h,style:f}){const p=b.useRef(null),m=b.useCallback(g=>{if(!n||!o||!p.current)return;const S=p.current,_=S.getBoundingClientRect(),x=(g.clientX-_.left)/_.width*S.naturalWidth,w=(g.clientY-_.top)/_.height*S.naturalHeight;o(x,w,S.naturalWidth,S.naturalHeight)},[n,o]);return t==="preview"?e?u.jsxs("div",{className:`relative rounded-xl overflow-hidden border border-border-subtle bg-bg-secondary ${h||""}`,style:{aspectRatio:d||"16/9",...f},children:[u.jsx("img",{ref:p,src:e,alt:"IDE Screenshot",className:"w-full h-full object-cover"}),s&&u.jsx("button",{onClick:s,className:"absolute top-2.5 right-2.5 bg-black/50 border-none text-white w-5 h-5 rounded-full text-[10px] z-10 cursor-pointer flex items-center justify-center",children:"✕"})]}):null:e?u.jsxs("div",{className:`${n?"screenshot-interactive":""} ${h||""} relative h-full flex items-center justify-center overflow-auto`,tabIndex:n?0:void 0,onKeyDown:n?l:void 0,style:f,children:[u.jsx("img",{ref:p,src:e,alt:"IDE Screenshot",onClick:n?m:void 0,className:"max-w-full max-h-full object-contain",style:{...n?{cursor:"crosshair"}:{},...r!==100?{transform:`scale(${r/100})`,transformOrigin:"center center"}:{}}}),a&&u.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 bg-black/70 text-white px-3.5 py-1.5 rounded-[20px] text-xs font-semibold backdrop-blur-sm",children:a})]}):u.jsxs("div",{className:`flex items-center justify-center flex-col gap-2 h-full text-text-muted ${h||""}`,style:f,children:[u.jsx("p",{className:"text-base",children:c||"🖥 Waiting for screenshot stream..."}),i&&u.jsxs("p",{className:"text-[13px] mt-2 opacity-50",children:["P2P: ",i]})]})}function F1({activeConv:e,onModalButton:t}){const[r,n]=b.useState(null);if(b.useEffect(()=>{n(null)},[e.modalMessage,e.status]),e.status!=="waiting_approval"||!e.modalButtons)return null;const i=o=>{r||(n(o),t(o))},s=o=>o.replace(/[⌥⏎⇧⌫⌘⌃↵]/g,"").replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi,"").trim();return u.jsxs("div",{className:"bg-gradient-to-br from-amber-600 to-amber-700 text-white py-2.5 px-4 shrink-0 z-[5]",children:[e.modalMessage&&u.jsx("div",{className:"text-[11px] opacity-85 mb-1.5 whitespace-nowrap overflow-hidden text-ellipsis max-w-full",children:e.modalMessage.replace(/[\n\r]+/g," ").slice(0,120)}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"font-black text-xs flex items-center gap-2",children:[u.jsx(qy,{size:14})," ",r?"PROCESSING...":"ACTION REQUIRED"]}),u.jsx("div",{className:"flex gap-2 flex-wrap",children:e.modalButtons.map((o,l)=>{const a=s(o).toLowerCase(),c=/^(run|approve|accept|yes|allow|always)/.test(a),d=/^(reject|deny|delete|remove|abort)/.test(a),h=r===o,f=r!==null;return u.jsx("button",{onClick:()=>i(o),disabled:f,className:`btn btn-sm border-none rounded-md text-xs px-3 py-1 ${c?"bg-white text-amber-700 font-extrabold":d?"bg-red-500/30 text-white font-semibold":"bg-white/15 text-white font-semibold"} ${f&&!h?"opacity-40":"opacity-100"} ${f?"cursor-not-allowed":"cursor-pointer"}`,children:h?"⏳ ...":s(o)},l)})})]})]})}const Dr=new Map;function CR({ideId:e,ideType:t,agentType:r,agentName:n,serverModel:i,serverMode:s,acpConfigOptions:o,acpModes:l}){var we;const{sendCommand:a}=gi(),c=!!(o||l),d=`${e}:${r}`,h=Dr.get(d),[f,p]=b.useState(!1),[m,g]=b.useState(!1),[S,_]=b.useState((h==null?void 0:h.models)||[]),[x,w]=b.useState((h==null?void 0:h.modes)||[]),N=U=>U?typeof U=="string"?U:typeof U=="object"?U.name||U.id||JSON.stringify(U):String(U):"",[L,C]=b.useState(N(i)),[F,P]=b.useState(N(s)),[q,E]=b.useState(!1),[A,R]=b.useState(!1),T=b.useRef(0),$=U=>U.map(Y=>typeof Y=="string"?Y:(Y==null?void 0:Y.name)||(Y==null?void 0:Y.id)||String(Y));b.useEffect(()=>{if(o){const U=o.find(Y=>Y.category==="model");if(U){const Y=$(U.options.map(fe=>fe.value));_(Y),U.currentValue&&C(N(U.currentValue));const te=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...te,models:Y})}}if(l&&l.length>0){const U=$(l.map(te=>te.id));w(U);const Y=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...Y,modes:U})}else if(o){const U=o.find(Y=>Y.category!=="model");if(U){const Y=$(U.options.map(fe=>fe.value));w(Y),U.currentValue&&P(N(U.currentValue));const te=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...te,modes:Y})}}},[o,l,d]),b.useEffect(()=>{p(!1),g(!1),C(N(i)),P(N(s));const U=Dr.get(d);U?(_(U.models),w(U.modes)):(_([]),w([]))},[e,r]),b.useEffect(()=>{i&&Date.now()>T.current&&C(N(i))},[i]),b.useEffect(()=>{s&&Date.now()>T.current&&P(N(s))},[s]);const z=b.useCallback(async(U,Y={})=>{const te={...Y},fe=e.split(":");return fe.length>=3&&(fe[1]==="ide"||fe[1]==="cli"||fe[1]==="acp")&&(te._targetInstance=fe.slice(2).join(":"),te._targetType=fe[1]),await a(e,U,te)},[e]),D=async()=>{var U,Y;if(S.length>0){p(!f);return}if(c){p(!0);return}E(!0);try{const te=await z("list_extension_models",{agentType:r,ideType:t}),fe=(te==null?void 0:te.models)||((U=te==null?void 0:te.result)==null?void 0:U.models)||[],de=$(fe);_(de),te!=null&&te.current&&C(N(te.current)),(Y=te==null?void 0:te.result)!=null&&Y.current&&C(N(te.result.current));const Oe=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...Oe,models:de}),p(!0)}catch{}finally{E(!1)}},H=async()=>{var U,Y;if(x.length>0){g(!m);return}if(c){g(!0);return}R(!0);try{const te=await z("list_extension_modes",{agentType:r,ideType:t}),fe=(te==null?void 0:te.modes)||((U=te==null?void 0:te.result)==null?void 0:U.modes)||[],de=$(fe);w(de),te!=null&&te.current&&P(N(te.current)),(Y=te==null?void 0:te.result)!=null&&Y.current&&P(N(te.result.current));const Oe=Dr.get(d)||{models:[],modes:[]};Dr.set(d,{...Oe,modes:de}),g(!0)}catch{}finally{R(!1)}},I=async U=>{p(!1),C(U),T.current=Date.now()+5e3;try{c?await z("change_model",{agentType:r,ideType:t,model:U}):await z("set_extension_model",{agentType:r,ideType:t,model:U})}catch{}},W=c&&!(l&&l.length>0)&&(o==null?void 0:o.some(U=>U.category!=="model")),y=W?(we=o==null?void 0:o.find(U=>U.category!=="model"))==null?void 0:we.configId:void 0,J=async U=>{g(!1),P(U),T.current=Date.now()+5e3;try{c&&W&&y?await z("set_thought_level",{agentType:r,ideType:t,configId:y,value:U}):c?await z("set_mode",{agentType:r,ideType:t,mode:U}):await z("set_extension_mode",{agentType:r,ideType:t,mode:U})}catch{}},k={cline:"#22d3ee","roo-code":"#a78bfa",cursor:"#60a5fa",antigravity:"#f97316",windsurf:"#34d399"}[r]||"#94a3b8";return u.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1 flex-wrap text-[10px] border-t border-border-subtle bg-[var(--surface-primary)]",children:[u.jsx("span",{className:"text-[9px] font-bold tracking-wide uppercase opacity-70",style:{color:k},children:n}),u.jsx("span",{className:"text-border-subtle text-[10px]",children:"│"}),u.jsxs("div",{className:"relative",children:[u.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:f?`${k}55`:"transparent",border:"1px solid",color:L?"var(--text-primary)":"var(--text-muted)"},onClick:D,children:[u.jsx("span",{className:"text-[9px] opacity-60",children:"🤖"}),q?"...":L||"Model",u.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),f&&S.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>p(!1)}),u.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[u.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:"SELECT MODEL"}),S.map(U=>u.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:U===L?`${k}18`:"transparent",color:U===L?k:"var(--text-secondary)",fontWeight:U===L?600:400,borderLeft:U===L?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Y=>{Y.currentTarget.style.background=`${k}12`},onMouseLeave:Y=>{Y.currentTarget.style.background=U===L?`${k}18`:"transparent"},onClick:()=>I(U),children:U},U))]})]})]}),u.jsxs("div",{className:"relative",children:[u.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-xl text-[10px] font-medium cursor-pointer transition-all bg-[var(--surface-tertiary)] whitespace-nowrap max-w-40 overflow-hidden text-ellipsis",style:{borderColor:m?`${k}55`:"transparent",border:"1px solid",color:F?"var(--text-primary)":"var(--text-muted)"},onClick:H,children:[u.jsx("span",{className:"text-[9px] opacity-60",children:W?"🧠":"⚡"}),A?"...":F||(W?"Thinking":"Mode"),u.jsx("span",{className:"text-[7px] opacity-50",children:"▼"})]}),m&&x.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"fixed inset-0 z-[59]",onClick:()=>g(!1)}),u.jsxs("div",{className:"absolute bottom-full left-0 z-[60] bg-[var(--surface-primary)] border border-border-subtle rounded-lg mb-1 max-h-[220px] overflow-y-auto min-w-40 shadow-[0_-4px_16px_rgba(0,0,0,0.3)]",children:[u.jsx("div",{className:"px-3 py-1.5 text-[9px] font-bold text-text-muted tracking-wider border-b border-border-subtle",children:W?"SELECT THINKING LEVEL":"SELECT MODE"}),x.map(U=>u.jsx("div",{className:"px-3 py-[7px] text-[11px] cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis",style:{background:U===F?`${k}18`:"transparent",color:U===F?k:"var(--text-secondary)",fontWeight:U===F?600:400,borderLeft:U===F?`2px solid ${k}`:"2px solid transparent"},onMouseEnter:Y=>{Y.currentTarget.style.background=`${k}12`},onMouseLeave:Y=>{Y.currentTarget.style.background=U===F?`${k}18`:"transparent"},onClick:()=>J(U),children:U},U))]})]})]})]})}const In=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),tn=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function W1({activeConv:e,ides:t,agentInput:r,setAgentInput:n,handleSendChat:i,handleFocusAgent:s,isFocusingAgent:o,messageReceivedAt:l,actionLogs:a,userName:c}){const d=b.useRef(null),{sendCommand:h}=gi(),[f,p]=b.useState([]),[m,g]=b.useState(0),[S,_]=b.useState(!0),[x,w]=b.useState(!1),N=b.useRef("");e.tabKey!==N.current&&(N.current=e.tabKey,p([]),g(0),_(!0));const L=b.useCallback(async()=>{var P,q,E,A,R,T;if(!(x||!S)){w(!0);try{const $=t.find(y=>y.id===e.ideId),z=($==null?void 0:$.daemonId)||((P=e.ideId)==null?void 0:P.split(":")[0])||"";if(!z){_(!1);return}const D=e.ideType||e.agentType||"",H=(e.ideId||"").split(":"),I=H.length>=3?H.slice(2).join(":"):void 0;console.log("[ChatPane] requestChatHistory:",{daemonId:z,agentType:D,instanceId:I,offset:m});const W=await h(z,"chat_history",{agentType:D,offset:m,limit:30,instanceId:I});console.log("[ChatPane] got result:",{count:((q=W.messages)==null?void 0:q.length)||0,hasMore:W.hasMore}),((E=W.messages)==null?void 0:E.length)>0&&(p(y=>[...W.messages,...y]),g(y=>y+W.messages.length)),_(W.hasMore)}catch($){console.warn("[ChatPane] Failed to load history:",$),!((A=$==null?void 0:$.message)!=null&&A.includes("P2P not available"))&&!((R=$==null?void 0:$.message)!=null&&R.includes("channel not open"))&&!((T=$==null?void 0:$.message)!=null&&T.includes("P2P not connected"))&&_(!1)}finally{w(!1)}}},[x,S,m,t,e]),C=b.useRef(0);b.useEffect(()=>{if(e.messages.length<10&&S&&!x&&f.length===0){const P=C.current;if(P>8)return;const E=setTimeout(()=>{C.current=P+1,L()},P===0?500:3e3);return()=>clearTimeout(E)}else f.length>0&&(C.current=0)},[e.tabKey,e.messages.length,S,x,f.length,L]);const F=(()=>{const P=e.messages.map((A,R)=>{const T=`${e.ideId}-${A.id??`i-${R}`}`;return{...A,receivedAt:A.receivedAt||l[T]||0}});if(f.length===0)return P;const q=new Set(P.map(A=>`${A.role}:${(A.content||"").slice(0,100)}`));return[...f.filter(A=>!q.has(`${A.role}:${(A.content||"").slice(0,100)}`)),...P]})();return u.jsxs(u.Fragment,{children:[u.jsx(Xy,{messages:F,actionLogs:a.filter(P=>P.ideId===e.tabKey).sort((P,q)=>P.timestamp-q.timestamp),agentName:e.agentName||e.displayPrimary||"Agent",userName:c,isCliMode:In(e)||tn(e),isWorking:e.status==="working",contextKey:e.tabKey,onLoadMore:L,isLoadingMore:x,hasMoreHistory:S,emptyState:e.messages.length===0?e.status==="not_monitored"?u.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[u.jsx("div",{className:"text-3xl opacity-60",children:u.jsx(Yy,{size:28})}),u.jsx("div",{className:"text-[13px] opacity-50",children:"Agent not monitored"}),u.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Switching...":u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," Open ",e.displayPrimary," Panel"]})}),u.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Click to switch monitoring to this agent"})]}):e.status==="panel_hidden"?u.jsxs("div",{className:"text-center mt-16 flex flex-col items-center gap-3",children:[u.jsx("div",{className:"text-3xl opacity-60",children:u.jsx(qP,{size:28})}),u.jsx("div",{className:"text-[13px] opacity-50",children:"Panel is not visible in IDE"}),u.jsx("button",{onClick:s,disabled:o,className:"btn btn-sm bg-accent text-white border-none rounded-[10px] px-5 py-2 font-bold text-[13px] cursor-pointer transition-all",children:o?"⌛ Opening...":u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," Open ",e.displayPrimary," Panel"]})}),u.jsx("div",{className:"text-[11px] opacity-35 max-w-[280px]",children:"Open the agent sidebar in your IDE to start viewing messages"})]}):void 0:void 0}),!In(e)&&(()=>{var q,E,A,R;const P=t.find(T=>T.id===e.ideId);return u.jsx(CR,{ideId:e.ideId,ideType:e.ideType,agentType:e.streamSource==="agent-stream"?e.agentType:((E=(q=P==null?void 0:P.agents)==null?void 0:q[0])==null?void 0:E.type)||e.ideType,agentName:e.streamSource==="agent-stream"?e.agentName:((R=(A=P==null?void 0:P.agents)==null?void 0:A[0])==null?void 0:R.name)||e.agentName,serverModel:(P==null?void 0:P.currentModel)||void 0,serverMode:(P==null?void 0:P.currentPlan)||void 0,acpConfigOptions:tn(e)?P==null?void 0:P.acpConfigOptions:void 0,acpModes:tn(e)?P==null?void 0:P.acpModes:void 0})})(),u.jsx("div",{className:"dashboard-input-area px-3 py-2.5 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:u.jsxs("div",{className:"flex gap-2.5 items-center",children:[u.jsx("div",{className:"flex-1 relative",children:u.jsx("input",{ref:d,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:r,onChange:P=>n(P.target.value),onPaste:P=>{const q=P.clipboardData.getData("text");q&&n(E=>E+q),P.preventDefault()},onKeyDown:P=>{if(P.key==="Enter"){if(P.nativeEvent.isComposing){P.preventDefault();return}P.preventDefault(),i()}},onBlur:P=>{if(window.innerWidth<768){const q=P.relatedTarget;if((q==null?void 0:q.tagName)==="BUTTON")return;setTimeout(()=>{document.documentElement.scrollTop=0},300)}},className:"w-full h-10 rounded-[20px] px-4 bg-bg-secondary border border-border-subtle text-sm text-text-primary"})}),u.jsx("button",{onClick:i,disabled:!r.trim(),className:`w-10 h-10 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${r.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:r.trim()?"text-white":"text-text-muted",children:u.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}const Ou=new Set,H1={emit(e,t){for(const r of Ou)r(e,t)},on(e){return Ou.add(e),()=>{Ou.delete(e)}}};function ER({activeConv:e,ptyBuffers:t,terminalRef:r,agentInput:n,setAgentInput:i,handleSendChat:s,handleModalButton:o}){var p;const l=b.useRef(null),{sendCommand:a,sendData:c}=gi(),d=(p=e.ideId)!=null&&p.includes(":cli:")?e.ideId.split(":cli:")[1]:"",h=e.tabKey,f=e.ideType||e.agentType||"";return b.useEffect(()=>{const m=t.current.get(h);if(m&&m.length>0){const g=setTimeout(()=>{var S;for(const _ of m)(S=r.current)==null||S.write(_);requestAnimationFrame(()=>{var _;(_=r.current)==null||_.bumpResize()})},100);return()=>clearTimeout(g)}},[h]),b.useEffect(()=>{const m=H1.on((g,S)=>{var x;if(!S)return;(g===d||g===f)&&((x=r.current)==null||x.write(S))});return()=>{m()}},[d,f]),u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--surface-primary)] border-b border-border-subtle shrink-0",children:[u.jsx("div",{className:"flex gap-1",children:u.jsx("div",{className:"px-3 py-1 rounded-md text-[11px] font-semibold bg-accent text-white",children:"⬛ Terminal"})}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsxs("div",{className:"text-[10px] text-text-muted",children:[e.agentName," — Terminal"]}),u.jsx("button",{onClick:()=>{if(!r.current||!e)return;const m=t.current.get(e.tabKey);if(m&&m.length>0)for(const g of m)r.current.write(g);requestAnimationFrame(()=>{requestAnimationFrame(()=>{var g;(g=r.current)==null||g.bumpResize()})})},title:"Refresh terminal (replay buffer + TUI redraw)",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-bg-secondary text-text-secondary border border-border-subtle cursor-pointer leading-none",children:"↺"}),u.jsx("button",{onClick:async()=>{var S;const m=(S=e.ideId)!=null&&S.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";if(!window.confirm(`Stop ${m}?
|
|
177
|
-
This will terminate the CLI process.`))return;const g=e.ideId||e.daemonId||"";try{await a(g,"stop_cli",{cliType:m})}catch(_){console.error("Stop CLI failed:",_)}},title:"Stop CLI process",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-red-500/[0.08] text-red-400 border border-red-500/30 cursor-pointer leading-none font-semibold",children:"■ Stop"})]})]}),u.jsx(F1,{activeConv:e,onModalButton:o}),u.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:u.jsx($1,{ref:r,onInput:m=>{var _;const g=e.ideId||e.daemonId||"",S=(_=e.ideId)!=null&&_.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(g,{type:"pty_input",cliType:S,data:m})||a(g,"pty_input",{cliType:S,data:m}).catch(console.error)},onResize:(m,g)=>{var x;const S=e.ideId||e.daemonId||"",_=(x=e.ideId)!=null&&x.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(S,{type:"pty_resize",cliType:_,cols:m,rows:g})||a(S,"pty_resize",{cliType:_,cols:m,rows:g,force:!0}).catch(()=>{})}},e.tabKey)}),u.jsx("div",{className:"px-3 py-2 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:u.jsxs("div",{className:"flex gap-2.5 items-center",children:[u.jsx("div",{className:"flex-1 relative",children:u.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:n,onChange:m=>i(m.target.value),onPaste:m=>{const g=m.clipboardData.getData("text");g&&i(S=>S+g),m.preventDefault()},onKeyDown:m=>{if(m.key==="Enter"){if(m.nativeEvent.isComposing){m.preventDefault();return}m.preventDefault(),s()}},className:"w-full h-9 rounded-[18px] px-4 bg-bg-secondary border border-border-subtle text-[13px] text-text-primary"})}),u.jsx("button",{onClick:s,disabled:!n.trim(),className:`w-9 h-9 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${n.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:n.trim()?"text-white":"text-text-muted",children:u.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function NR({wsStatus:e,showReconnected:t,loginUrl:r}){const n=e==="disconnected"||e==="reconnecting"||e==="offline"||e==="auth_failed",i=e==="auth_failed"?"red":e==="offline"?"orange":"violet",s={red:"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))",orange:"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))",violet:"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))"},o={red:"1px solid rgba(239,68,68,0.2)",orange:"1px solid rgba(255,107,53,0.2)",violet:"1px solid rgba(139,92,246,0.2)"},l={red:"#ef4444",orange:"#ff6b35",violet:"#a78bfa"};return u.jsxs(u.Fragment,{children:[n&&u.jsxs("div",{className:"py-2.5 px-5 text-[13px] font-semibold flex items-center gap-2.5 justify-center",style:{background:s[i],borderBottom:o[i],color:l[i]},children:[u.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-5 h-5",style:{opacity:e==="auth_failed"?.6:1,animation:e==="auth_failed"?void 0:"pulse 2s ease-in-out infinite",filter:e==="auth_failed"?"grayscale(1)":void 0}}),e==="offline"&&"Network offline — waiting for connection...",e==="disconnected"&&"Reconnecting to server...",e==="reconnecting"&&"Reconnecting to server...",e==="auth_failed"&&(r?u.jsxs(u.Fragment,{children:["Session expired."," ",u.jsx("a",{href:r,className:"text-inherit underline",children:"Log in again"})]}):"Connection failed — please restart the server.")]}),t&&e==="connected"&&u.jsxs("div",{className:"py-2 px-4 text-xs font-semibold flex items-center gap-2 justify-center bg-gradient-to-r from-green-500/[0.12] to-green-500/[0.04] text-green-400 border-b border-green-500/15 animate-[fadeIn_0.3s_ease]",children:[u.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-4 h-4"}),"Connected"]})]})}const zu=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),$u=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function PR({activeConv:e,agentCount:t,wsStatus:r,isConnected:n,onOpenHistory:i}){const s=Os(),o=n?"#22c55e":r==="connected"?"#eab308":"#ef4444",l=n?"0 0 4px #22c55e80":r==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480";return u.jsxs("div",{className:"dashboard-header",children:[u.jsx("div",{className:"flex items-center gap-3",children:u.jsxs("div",{className:"leading-tight",children:[u.jsxs("h1",{className:"header-title m-0 flex items-center gap-1.5",children:[u.jsx(Xa,{size:18}),u.jsx("span",{className:"header-title-desktop",children:"Dashboard"}),u.jsx("span",{className:"header-title-mobile",children:(e==null?void 0:e.displayPrimary)||"Dashboard"}),u.jsx("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:u.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full align-middle",style:{background:o,boxShadow:l}})})]}),u.jsxs("div",{className:"header-subtitle text-[11px] items-center gap-1",children:[t," agent",t!==1?"s":""," active",u.jsx("span",{title:n?"Connected":r==="connected"?"Partial":"Disconnected",className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{background:o,boxShadow:l}})]})]})}),u.jsxs("div",{className:"flex gap-2 items-center",children:[e&&!zu(e)&&!$u(e)&&u.jsxs("button",{onClick:()=>s(`/ide/${e.ideId}`),className:"btn btn-primary btn-sm border-none px-2.5 py-1.5 flex items-center gap-1 text-xs",title:"IDE View",children:[u.jsx(XP,{size:14})," IDE"]}),e&&!zu(e)&&!$u(e)&&u.jsx("button",{onClick:i,className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5 flex items-center gap-1",title:"Chat History",children:u.jsx(UP,{size:16})}),e&&!zu(e)&&!$u(e)&&u.jsx("button",{onClick:()=>s(`/ide/${e.ideId}?view=remote`),className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5",title:"Remote Control",children:u.jsx(Ro,{size:16})})]})]})}function Ar(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function TR(e){if(e<60)return`${Math.round(e)}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const r=Math.floor(t/60),n=t%60;if(r<24)return n>0?`${r}h ${n}m`:`${r}h`;const i=Math.floor(r/24),s=r%24;return`${i}d ${s}h`}function W_(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function H_(e){return(e.id||"").includes(":cli:")}function U_(e){return(e.id||"").includes(":acp:")}function Ad(e,t){return Ar(e)}function LR(e){if(!Array.isArray(e)||e.length<=1)return e;const t=new Map,r=["generating","streaming","active","connected","idle","panel_hidden"];for(const n of e){const i=(n.name||n.id||"").toLowerCase().replace(/\s+/g,"-"),s=t.get(i);if(!s){t.set(i,n);continue}const o=r.indexOf(s.status||"idle"),l=r.indexOf(n.status||"idle");l>=0&&(o<0||l<o)&&t.set(i,n)}return Array.from(t.values())}function RR({activeConv:e,ides:t,isCreatingChat:r,isRefreshingHistory:n,onClose:i,onNewChat:s,onSwitchSession:o,onRefreshHistory:l}){var h;const a=t.find(f=>f.id===e.ideId),c=(a==null?void 0:a.chats)||[],d=(h=a==null?void 0:a.activeChat)==null?void 0:h.id;return u.jsxs("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center",children:[u.jsx("div",{onClick:i,className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),u.jsxs("div",{className:"card fade-in relative w-[90%] max-w-[500px] max-h-[80vh] flex flex-col p-0 overflow-hidden shadow-[0_20px_40px_rgba(0,0,0,0.4)] rounded-[20px]",children:[u.jsxs("div",{className:"px-6 py-5 border-b border-border-subtle flex justify-between items-center bg-[var(--surface-primary)]",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"m-0 text-lg font-extrabold",children:"Chat History"}),u.jsxs("div",{className:"text-xs text-text-muted mt-0.5",children:[e.displayPrimary," — ",Ar(e.ideType)]})]}),u.jsx("button",{onClick:i,className:"bg-transparent border-none text-xl text-text-muted cursor-pointer",children:"✕"})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-3 bg-bg-primary",children:[u.jsx("button",{onClick:s,disabled:r,className:"w-full p-3.5 rounded-xl mb-3 bg-indigo-500/10 border border-dashed border-accent text-accent font-bold text-sm cursor-pointer",children:r?"⌛ Creating...":"+ Start New Chat Session"}),c.map(f=>u.jsxs("div",{onClick:()=>{o(e.ideId,f.id),i()},className:`p-4 rounded-xl mb-2 cursor-pointer border transition-all ${d===f.id?"bg-[var(--bg-glass-hover)] border-accent":"bg-[var(--surface-secondary)] border-border-subtle"}`,children:[u.jsx("div",{className:`font-bold text-sm mb-1 ${d===f.id?"text-[var(--accent-primary-light)]":"text-text-primary"}`,children:f.title||"Untitled Session"}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-mono",children:[f.id.substring(0,12),"..."]}),d===f.id&&u.jsx("span",{className:"text-[10px] bg-accent text-white px-2 py-0.5 rounded-[10px] font-extrabold",children:"ACTIVE"})]})]},f.id)),c.length===0&&u.jsxs("div",{className:"py-10 px-5 text-center text-text-muted",children:[u.jsx("div",{className:"text-3xl mb-3 opacity-60",children:u.jsx(ZP,{size:32})}),u.jsx("div",{className:"text-[13px]",children:"No recent chat sessions found."})]})]}),u.jsx("div",{className:"px-5 py-4 bg-[var(--surface-tertiary)] border-t border-border-subtle text-right",children:u.jsx("button",{onClick:l,disabled:n,className:"btn btn-secondary btn-sm rounded-[10px]",children:n?"⌛ Refreshing...":u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(KP,{size:13})," Refresh History"]})})})]})]})}const V_={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function MR({toasts:e,onDismiss:t,onClickToast:r}){return u.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:e.map(n=>u.jsx("div",{className:"fade-in text-white px-5 py-3 rounded-xl text-[13px] font-semibold shadow-[0_8px_32px_rgba(0,0,0,0.3)] backdrop-blur-lg pointer-events-auto cursor-pointer animate-[toast-in_0.3s_ease-out] max-w-[360px]",style:{background:V_[n.type]||V_.info},onClick:()=>{r&&r(n),t(n.id)},children:n.message},n.id))})}const IR=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function DR(e){return e.workspace||"Workspace"}function jR(e,t,r,n){var s;const i={};if(r)for(const o of r){const l=o;if(l.type==="adhdev-daemon"||l.daemonMode){const a=l.machine||{},c=l.machineNickname,d=a.hostname||((s=l.system)==null?void 0:s.hostname)||"",h=c||(d&&d!=="Unknown"?d.replace(/\.local$/,""):null)||`Machine ${(l.id||"").substring(0,6)}`;i[l.id]=h}}return e.flatMap(o=>{var S,_,x,w,N;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((S=o.id)==null?void 0:S.split(":")[0])||o.id,d=n?n[c]||"new":void 0,h=DR(o),f=Ar(o.type),p=o.agentStreams,m=Array.isArray(p)?p.map(L=>({...L,activeModal:L.activeModal??void 0})):[],g=IR(o);if(g){const L=Ad(o.type),C=(_=o.agents)==null?void 0:_[0],F=(x=o.activeChat)==null?void 0:x.activeModal,P=F&&Array.isArray(F.buttons)&&F.buttons.length>0,q=(w=o.activeChat)==null?void 0:w.status,E=q==="generating"||q==="loading"||q&&q.toLowerCase()==="thinking",R=P||q==="waiting_approval"?"waiting_approval":E?"working":(C==null?void 0:C.status)||"idle",T=o.activeChat||{title:"",messages:[]};let $=T.title&&String(T.title).trim()?String(T.title).trim():"";const z=(N=o.activeChat)==null?void 0:N.id,D=o.chats;if(z&&Array.isArray(D)&&D.length>0){const J=D.find(ae=>ae.id===z||ae.id&&String(ae.id)===String(z));J!=null&&J.title&&String(J.title).trim()&&($=String(J.title).trim())}const H=T.messages||[],I=t[o.id]||[],W=new Map;H.filter(J=>J.role==="user").forEach(J=>{W.set(J.content,(W.get(J.content)||0)+1)});const y=I.filter(J=>{const ae=W.get(J.content)||0;return ae>0?(W.set(J.content,ae-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:L,agentType:In(o)||tn(o)?o.type:(C==null?void 0:C.type)||"ide-native",status:R,title:$,messages:[...H,...y],ideType:o.type,workspaceName:h,displayPrimary:h,displaySecondary:f,cdpConnected:o.cdpConnected,modalButtons:P?F.buttons:void 0,modalMessage:P?F.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,connectionState:d})}if(g&&(In(o)||tn(o)))return l;for(const L of m){const C=L.activeModal&&Array.isArray(L.activeModal.buttons)&&L.activeModal.buttons.length>0,F=C?"waiting_approval":L.status==="streaming"?"working":L.status,P=`${o.id}:${L.agentType}`,q=L.messages||[],E=t[P]||[],A=new Map;q.filter(T=>T.role==="user").forEach(T=>{A.set(T.content,(A.get(T.content)||0)+1)});const R=E.filter(T=>{const $=A.get(T.content)||0;return $>0?(A.set(T.content,$-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:L.agentName,agentType:L.agentType,status:F,title:"",messages:[...q,...R],ideType:o.type,workspaceName:h,displayPrimary:h,displaySecondary:`${f}·${L.agentName}`,cdpConnected:o.cdpConnected,modalButtons:C?L.activeModal.buttons:void 0,modalMessage:C?L.activeModal.message:void 0,streamSource:"agent-stream",tabKey:P,machineName:a,connectionState:d})}return l.length===0&&l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:Ad(o.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:o.type,workspaceName:h,displayPrimary:h,displaySecondary:f,cdpConnected:o.cdpConnected,streamSource:"native",tabKey:o.id,connectionState:d}),l})}function AR(e,t){var l,a,c,d;const r=[],{daemonId:n,existingDaemon:i,timestamp:s}=t,o=s||e.timestamp||Date.now();r.push({...i||{},id:n,type:"adhdev-daemon",status:"online",daemonMode:!0,timestamp:o,...e.version&&{version:e.version},...e.machine&&{machine:e.machine,platform:e.machine.platform},...e.instanceId&&{instanceId:e.instanceId},...e.machineNickname!==void 0&&{machineNickname:e.machineNickname},...e.p2p&&{p2p:e.p2p},..."system"in e&&{system:e.system},..."hostname"in e&&{hostname:e.hostname},...e.workspaces&&{workspaces:e.workspaces},...e.defaultWorkspaceId!==void 0&&{defaultWorkspaceId:e.defaultWorkspaceId},...e.defaultWorkspacePath!==void 0&&{defaultWorkspacePath:e.defaultWorkspacePath},...e.workspaceActivity&&{workspaceActivity:e.workspaceActivity},...e.detectedIdes&&{detectedIdes:e.detectedIdes},..."availableProviders"in e&&{availableProviders:e.availableProviders},cdpConnected:e.managedIdes.some(h=>h.cdpConnected),managedIdeIds:e.managedIdes.map(h=>`${n}:ide:${h.instanceId}`),managedCliIds:e.managedClis.map(h=>h.id?`${n}:cli:${h.id}`:`${n}:cli:${h.cliType}`),managedAcpIds:e.managedAcps.map(h=>h.id?`${n}:acp:${h.id}`:`${n}:acp:${h.acpType}`)});for(const h of e.managedIdes)r.push({id:`${n}:ide:${h.instanceId}`,type:h.ideType,ideType:h.ideType,version:h.ideVersion,status:h.cdpConnected?"online":"detected",daemonId:n,instanceId:h.instanceId,workspace:h.workspace,terminals:h.terminals,agents:h.aiAgents,activeChat:h.activeChat,chats:h.chats,agentStreams:h.agentStreams,cdpConnected:h.cdpConnected,currentModel:h.currentModel,currentPlan:h.currentPlan,currentAutoApprove:h.currentAutoApprove,timestamp:o});for(const h of e.managedClis){const f=h.id?`${n}:cli:${h.id}`:`${n}:cli:${h.cliType}`;r.push({id:f,type:h.cliType,ideType:h.cliType,agentType:h.cliType,status:h.status||"running",daemonId:n,instanceId:h.id,cliName:h.cliName,mode:h.mode||"terminal",workspace:h.workspace,activeChat:h.activeChat,agentStreams:[{agentType:h.cliType,agentName:h.cliName,extensionId:"cli-agent",status:h.status==="generating"?"streaming":h.status==="waiting_approval"?"waiting_approval":"idle",messages:((l=h.activeChat)==null?void 0:l.messages)||[],inputContent:"",activeModal:(a=h.activeChat)==null?void 0:a.activeModal}],timestamp:o,_isCli:!0})}for(const h of e.managedAcps){const f=h.id?`${n}:acp:${h.id}`:`${n}:acp:${h.acpType}`;r.push({id:f,type:h.acpType,ideType:h.acpType,agentType:h.acpType,status:h.status||"running",daemonId:n,instanceId:h.id,cliName:h.acpName,mode:"chat",workspace:h.workspace,activeChat:h.activeChat,currentModel:h.currentModel,currentPlan:h.currentPlan,acpConfigOptions:h.acpConfigOptions,acpModes:h.acpModes,agentStreams:[{agentType:h.acpType,agentName:h.acpName,extensionId:"acp-agent",status:h.status==="generating"?"streaming":h.status==="waiting_approval"?"waiting_approval":"idle",messages:((c=h.activeChat)==null?void 0:c.messages)||[],inputContent:"",activeModal:(d=h.activeChat)==null?void 0:d.activeModal}],timestamp:o,_isAcp:!0})}return r}function U1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=U1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function BR(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=U1(e))&&(n&&(n+=" "),n+=t);return n}const OR=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},zR=(e,t)=>({classGroupId:e,validator:t}),V1=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),rc="-",K_=[],$R="arbitrary..",FR=e=>{const t=HR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return WR(o);const l=o.split(rc),a=l[0]===""&&l.length>1?1:0;return K1(l,a,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const a=n[o],c=r[o];return a?c?OR(c,a):a:c||K_}return r[o]||K_}}},K1=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],s=r.nextPart.get(i);if(s){const c=K1(e,t+1,s);if(c)return c}const o=r.validators;if(o===null)return;const l=t===0?e.join(rc):e.slice(t).join(rc),a=o.length;for(let c=0;c<a;c++){const d=o[c];if(d.validator(l))return d.classGroupId}},WR=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?$R+n:void 0})(),HR=e=>{const{theme:t,classGroups:r}=e;return UR(r,t)},UR=(e,t)=>{const r=V1();for(const n in e){const i=e[n];hp(i,r,n,t)}return r},hp=(e,t,r,n)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];VR(o,t,r,n)}},VR=(e,t,r,n)=>{if(typeof e=="string"){KR(e,t,r);return}if(typeof e=="function"){qR(e,t,r,n);return}YR(e,t,r,n)},KR=(e,t,r)=>{const n=e===""?t:q1(t,e);n.classGroupId=r},qR=(e,t,r,n)=>{if(XR(e)){hp(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(zR(r,e))},YR=(e,t,r,n)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,a]=i[o];hp(a,q1(t,l),r,n)}},q1=(e,t)=>{let r=e;const n=t.split(rc),i=n.length;for(let s=0;s<i;s++){const o=n[s];let l=r.nextPart.get(o);l||(l=V1(),r.nextPart.set(o,l)),r=l}return r},XR=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,GR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const i=(s,o)=>{r[s]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in r?r[s]=o:i(s,o)}}},Bd="!",q_=":",QR=[],Y_=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),JR=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=i=>{const s=[];let o=0,l=0,a=0,c;const d=i.length;for(let g=0;g<d;g++){const S=i[g];if(o===0&&l===0){if(S===q_){s.push(i.slice(a,g)),a=g+1;continue}if(S==="/"){c=g;continue}}S==="["?o++:S==="]"?o--:S==="("?l++:S===")"&&l--}const h=s.length===0?i:i.slice(a);let f=h,p=!1;h.endsWith(Bd)?(f=h.slice(0,-1),p=!0):h.startsWith(Bd)&&(f=h.slice(1),p=!0);const m=c&&c>a?c-a:void 0;return Y_(s,p,f,m)};if(t){const i=t+q_,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):Y_(QR,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},ZR=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let s=0;s<r.length;s++){const o=r[s],l=o[0]==="[",a=t.has(o);l||a?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},eM=e=>({cache:GR(e.cacheSize),parseClassName:JR(e),sortModifiers:ZR(e),...FR(e)}),tM=/\s+/,rM=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(tM);let a="";for(let c=l.length-1;c>=0;c-=1){const d=l[c],{isExternal:h,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=r(d);if(h){a=d+(a.length>0?" "+a:a);continue}let S=!!g,_=n(S?m.substring(0,g):m);if(!_){if(!S){a=d+(a.length>0?" "+a:a);continue}if(_=n(m),!_){a=d+(a.length>0?" "+a:a);continue}S=!1}const x=f.length===0?"":f.length===1?f[0]:s(f).join(":"),w=p?x+Bd:x,N=w+_;if(o.indexOf(N)>-1)continue;o.push(N);const L=i(_,S);for(let C=0;C<L.length;++C){const F=L[C];o.push(w+F)}a=d+(a.length>0?" "+a:a)}return a},nM=(...e)=>{let t=0,r,n,i="";for(;t<e.length;)(r=e[t++])&&(n=Y1(r))&&(i&&(i+=" "),i+=n);return i},Y1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Y1(e[n]))&&(r&&(r+=" "),r+=t);return r},iM=(e,...t)=>{let r,n,i,s;const o=a=>{const c=t.reduce((d,h)=>h(d),e());return r=eM(c),n=r.cache.get,i=r.cache.set,s=l,l(a)},l=a=>{const c=n(a);if(c)return c;const d=rM(a,r);return i(a,d),d};return s=o,(...a)=>s(nM(...a))},sM=[],Pt=e=>{const t=r=>r[e]||sM;return t.isThemeGetter=!0,t},X1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,G1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oM=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,uM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=e=>oM.test(e),Ae=e=>!!e&&!Number.isNaN(Number(e)),Vn=e=>!!e&&Number.isInteger(Number(e)),Fu=e=>e.endsWith("%")&&Ae(e.slice(0,-1)),xn=e=>lM.test(e),Q1=()=>!0,dM=e=>aM.test(e)&&!cM.test(e),dp=()=>!1,fM=e=>uM.test(e),pM=e=>hM.test(e),mM=e=>!ye(e)&&!be(e),gM=e=>vi(e,eb,dp),ye=e=>X1.test(e),wi=e=>vi(e,tb,dM),X_=e=>vi(e,kM,Ae),_M=e=>vi(e,nb,Q1),vM=e=>vi(e,rb,dp),G_=e=>vi(e,J1,dp),xM=e=>vi(e,Z1,pM),Yl=e=>vi(e,ib,fM),be=e=>G1.test(e),lo=e=>Qi(e,tb),yM=e=>Qi(e,rb),Q_=e=>Qi(e,J1),bM=e=>Qi(e,eb),wM=e=>Qi(e,Z1),Xl=e=>Qi(e,ib,!0),SM=e=>Qi(e,nb,!0),vi=(e,t,r)=>{const n=X1.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Qi=(e,t,r=!1)=>{const n=G1.exec(e);return n?n[1]?t(n[1]):r:!1},J1=e=>e==="position"||e==="percentage",Z1=e=>e==="image"||e==="url",eb=e=>e==="length"||e==="size"||e==="bg-size",tb=e=>e==="length",kM=e=>e==="number",rb=e=>e==="family-name",nb=e=>e==="number"||e==="weight",ib=e=>e==="shadow",CM=()=>{const e=Pt("color"),t=Pt("font"),r=Pt("text"),n=Pt("font-weight"),i=Pt("tracking"),s=Pt("leading"),o=Pt("breakpoint"),l=Pt("container"),a=Pt("spacing"),c=Pt("radius"),d=Pt("shadow"),h=Pt("inset-shadow"),f=Pt("text-shadow"),p=Pt("drop-shadow"),m=Pt("blur"),g=Pt("perspective"),S=Pt("aspect"),_=Pt("ease"),x=Pt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...N(),be,ye],C=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],P=()=>[be,ye,a],q=()=>[Un,"full","auto",...P()],E=()=>[Vn,"none","subgrid",be,ye],A=()=>["auto",{span:["full",Vn,be,ye]},Vn,be,ye],R=()=>[Vn,"auto",be,ye],T=()=>["auto","min","max","fr",be,ye],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...P()],H=()=>[Un,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],I=()=>[Un,"screen","full","dvw","lvw","svw","min","max","fit",...P()],W=()=>[Un,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],y=()=>[e,be,ye],J=()=>[...N(),Q_,G_,{position:[be,ye]}],ae=()=>["no-repeat",{repeat:["","x","y","space","round"]}],k=()=>["auto","cover","contain",bM,gM,{size:[be,ye]}],we=()=>[Fu,lo,wi],U=()=>["","none","full",c,be,ye],Y=()=>["",Ae,lo,wi],te=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[Ae,Fu,Q_,G_],Oe=()=>["","none",m,be,ye],Ve=()=>["none",Ae,be,ye],Ie=()=>["none",Ae,be,ye],G=()=>[Ae,be,ye],me=()=>[Un,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xn],breakpoint:[xn],color:[Q1],container:[xn],"drop-shadow":[xn],ease:["in","out","in-out"],font:[mM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xn],shadow:[xn],spacing:["px",Ae],text:[xn],"text-shadow":[xn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Un,ye,be,S]}],container:["container"],columns:[{columns:[Ae,ye,be,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{"inset-s":q(),start:q()}],end:[{"inset-e":q(),end:q()}],"inset-bs":[{"inset-bs":q()}],"inset-be":[{"inset-be":q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[Vn,"auto",be,ye]}],basis:[{basis:[Un,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ae,Un,"auto","initial","none",ye]}],grow:[{grow:["",Ae,be,ye]}],shrink:[{shrink:["",Ae,be,ye]}],order:[{order:[Vn,"first","last","none",be,ye]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...I()]}],"min-inline-size":[{"min-inline":["auto",...I()]}],"max-inline-size":[{"max-inline":["none",...I()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[l,"screen",...H()]}],"min-w":[{"min-w":[l,"screen","none",...H()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,lo,wi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,SM,_M]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fu,ye]}],"font-family":[{font:[yM,vM,t]}],"font-features":[{"font-features":[ye]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,be,ye]}],"line-clamp":[{"line-clamp":[Ae,"none",be,X_]}],leading:[{leading:[s,...P()]}],"list-image":[{"list-image":["none",be,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",be,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:y()}],"text-color":[{text:y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ae,"from-font","auto",be,wi]}],"text-decoration-color":[{decoration:y()}],"underline-offset":[{"underline-offset":[Ae,"auto",be,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be,ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",be,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:k()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Vn,be,ye],radial:["",be,ye],conic:[Vn,be,ye]},wM,xM]}],"bg-color":[{bg:y()}],"gradient-from-pos":[{from:we()}],"gradient-via-pos":[{via:we()}],"gradient-to-pos":[{to:we()}],"gradient-from":[{from:y()}],"gradient-via":[{via:y()}],"gradient-to":[{to:y()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:y()}],"border-color-x":[{"border-x":y()}],"border-color-y":[{"border-y":y()}],"border-color-s":[{"border-s":y()}],"border-color-e":[{"border-e":y()}],"border-color-bs":[{"border-bs":y()}],"border-color-be":[{"border-be":y()}],"border-color-t":[{"border-t":y()}],"border-color-r":[{"border-r":y()}],"border-color-b":[{"border-b":y()}],"border-color-l":[{"border-l":y()}],"divide-color":[{divide:y()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ae,be,ye]}],"outline-w":[{outline:["",Ae,lo,wi]}],"outline-color":[{outline:y()}],shadow:[{shadow:["","none",d,Xl,Yl]}],"shadow-color":[{shadow:y()}],"inset-shadow":[{"inset-shadow":["none",h,Xl,Yl]}],"inset-shadow-color":[{"inset-shadow":y()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:y()}],"ring-offset-w":[{"ring-offset":[Ae,wi]}],"ring-offset-color":[{"ring-offset":y()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":y()}],"text-shadow":[{"text-shadow":["none",f,Xl,Yl]}],"text-shadow-color":[{"text-shadow":y()}],opacity:[{opacity:[Ae,be,ye]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":y()}],"mask-image-linear-to-color":[{"mask-linear-to":y()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":y()}],"mask-image-t-to-color":[{"mask-t-to":y()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":y()}],"mask-image-r-to-color":[{"mask-r-to":y()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":y()}],"mask-image-b-to-color":[{"mask-b-to":y()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":y()}],"mask-image-l-to-color":[{"mask-l-to":y()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":y()}],"mask-image-x-to-color":[{"mask-x-to":y()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":y()}],"mask-image-y-to-color":[{"mask-y-to":y()}],"mask-image-radial":[{"mask-radial":[be,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":y()}],"mask-image-radial-to-color":[{"mask-radial-to":y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[Ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":y()}],"mask-image-conic-to-color":[{"mask-conic-to":y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:k()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",be,ye]}],filter:[{filter:["","none",be,ye]}],blur:[{blur:Oe()}],brightness:[{brightness:[Ae,be,ye]}],contrast:[{contrast:[Ae,be,ye]}],"drop-shadow":[{"drop-shadow":["","none",p,Xl,Yl]}],"drop-shadow-color":[{"drop-shadow":y()}],grayscale:[{grayscale:["",Ae,be,ye]}],"hue-rotate":[{"hue-rotate":[Ae,be,ye]}],invert:[{invert:["",Ae,be,ye]}],saturate:[{saturate:[Ae,be,ye]}],sepia:[{sepia:["",Ae,be,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",be,ye]}],"backdrop-blur":[{"backdrop-blur":Oe()}],"backdrop-brightness":[{"backdrop-brightness":[Ae,be,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Ae,be,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ae,be,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ae,be,ye]}],"backdrop-invert":[{"backdrop-invert":["",Ae,be,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Ae,be,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Ae,be,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Ae,be,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",be,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ae,"initial",be,ye]}],ease:[{ease:["linear","initial",_,be,ye]}],delay:[{delay:[Ae,be,ye]}],animate:[{animate:["none",x,be,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,be,ye]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ve()}],"rotate-x":[{"rotate-x":Ve()}],"rotate-y":[{"rotate-y":Ve()}],"rotate-z":[{"rotate-z":Ve()}],scale:[{scale:Ie()}],"scale-x":[{"scale-x":Ie()}],"scale-y":[{"scale-y":Ie()}],"scale-z":[{"scale-z":Ie()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[be,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":["translate-none"],accent:[{accent:y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",be,ye]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",be,ye]}],fill:[{fill:["none",...y()]}],"stroke-w":[{stroke:[Ae,lo,wi,X_]}],stroke:[{stroke:["none",...y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},EM=iM(CM);function sl(...e){return EM(BR(e))}function NM({icon:e,title:t,subtitle:r,badge:n,actions:i,className:s}){return u.jsxs("div",{className:sl("flex items-center justify-between px-6 py-4 border-b border-border-subtle bg-surface-primary animate-[fadeIn_0.3s_ease-out_forwards]",s),children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"text-lg font-bold text-text-primary flex items-center gap-2.5 tracking-tight",children:[u.jsx("span",{children:e})," ",t,n&&u.jsxs("span",{className:"text-xs font-semibold px-2 py-0.5 rounded-full bg-accent/10 text-accent-light",children:[n.count!==void 0?n.count:""," ",n.text]})]}),u.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:r})]}),i&&u.jsx("div",{className:"flex gap-2",children:i})]})}function ao({title:e,icon:t,description:r,accentColor:n,className:i,children:s}){return u.jsxs("div",{className:sl("bg-bg-card border border-border-subtle rounded-2xl p-5 backdrop-blur-xl transition-all","hover:border-border-default hover:shadow-glow",n&&"border-l-[3px]",i),style:n?{borderLeftColor:n}:void 0,children:[(e||r)&&u.jsxs("div",{className:"mb-4",children:[e&&u.jsxs("h3",{className:"text-base font-semibold text-text-primary",children:[t&&u.jsx("span",{className:"mr-1.5",children:t}),e]}),r&&u.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:r})]}),s]})}function PM({icon:e,title:t,description:r,action:n,className:i}){return u.jsxs("div",{className:sl("py-16 px-5 text-center bg-bg-glass border-2 border-dashed border-border-subtle rounded-2xl",i),children:[u.jsx("div",{className:"text-5xl mb-4 opacity-50",children:e}),u.jsx("h3",{className:"text-lg font-bold text-text-secondary mb-2",children:t}),u.jsx("p",{className:"text-sm text-text-muted max-w-sm mx-auto mb-5 leading-relaxed",children:r}),n]})}const TM={online:"bg-green-500/10 text-green-400 border-green-500/30",idle:"bg-yellow-500/10 text-yellow-400 border-yellow-500/30",busy:"bg-orange-500/10 text-orange-400 border-orange-500/30",error:"bg-red-500/10 text-red-400 border-red-500/30",offline:"bg-gray-500/10 text-text-secondary border-gray-500/30"},LM={online:"bg-green-500",idle:"bg-yellow-500",busy:"bg-orange-500",error:"bg-red-500",offline:"bg-gray-500"};function RM({status:e,label:t,className:r}){const n=t||e;return u.jsxs("span",{className:sl("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",TM[e],r),children:[u.jsx("span",{className:sl("w-2 h-2 rounded-full animate-[pulse-dot_2s_ease-in-out_infinite]",LM[e])}),n]})}function MM(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function J_(){try{const e=localStorage.getItem("theme");if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function Wu(e){return e==="system"?MM():e}function IM(){const[e,t]=b.useState(J_),[r,n]=b.useState(()=>Wu(J_()));b.useEffect(()=>{document.documentElement.setAttribute("data-theme",r)},[r]),b.useEffect(()=>{const o=window.matchMedia("(prefers-color-scheme: light)"),l=a=>{e==="system"&&n(a.matches?"light":"dark")};return o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[e]);const i=b.useCallback(o=>{t(o),n(Wu(o));try{localStorage.setItem("theme",o)}catch{}},[]),s=b.useCallback(()=>{t(o=>{const l=o==="dark"?"light":o==="light"?"system":"dark";n(Wu(l));try{localStorage.setItem("theme",l)}catch{}return l})},[]);return{theme:r,preference:e,setPreference:i,cycleTheme:s,isDark:r==="dark"}}const Z_={dark:"Dark",light:"Light",system:"System"};function DM({collapsed:e}){const{preference:t,cycleTheme:r}=IM(),n=t==="dark"?u.jsx(tT,{size:16}):t==="light"?u.jsx(eT,{size:16}):u.jsx(rT,{size:16});return u.jsxs("div",{className:`nav-item cursor-pointer ${e?"justify-center py-2.5 px-0":""}`,onClick:r,title:`Theme: ${Z_[t]} (click to cycle)`,children:[u.jsx("span",{className:"nav-icon",children:n}),!e&&u.jsx("span",{className:"text-xs",children:Z_[t]})]})}function is({label:e,description:t,checked:r,disabled:n,onChange:i,extra:s}){return u.jsxs("label",{className:"flex justify-between items-center cursor-pointer",children:[u.jsxs("div",{children:[u.jsx("div",{className:"font-medium text-sm",children:e}),u.jsx("div",{className:"text-[11px] text-text-muted",children:t})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[s,u.jsx("input",{type:"checkbox",checked:r,disabled:n,onChange:o=>i(o.target.checked),className:"w-5 h-5 accent-accent"})]})]})}const sb="adhdev_notification_prefs",ev={globalEnabled:!0,disconnectAlert:!0,browserNotifications:!0,completionAlert:!0,approvalAlert:!0};function jM(){try{const e=localStorage.getItem(sb);if(e){const t=JSON.parse(e);return{...ev,...t}}}catch{}return{...ev}}function AM(e){try{localStorage.setItem(sb,JSON.stringify(e))}catch{}}let kn=jM(),va=[];function BM(){va.forEach(e=>e())}function OM(e){kn={...kn,...e},AM(kn),BM()}function zM(){const[,e]=b.useState(0);b.useEffect(()=>{const r=()=>e(n=>n+1);return va.push(r),()=>{va=va.filter(n=>n!==r)}},[]);const t=b.useCallback(r=>{OM(r)},[]);return[{...kn},t]}function Hu(e){if(!kn.globalEnabled)return!1;switch(e){case"disconnect":return kn.disconnectAlert;case"completion":return kn.completionAlert;case"approval":return kn.approvalAlert;case"browser":return kn.browserNotifications;default:return!0}}function $M({onPrefChange:e}){const[t,r]=zM(),n=(i,s)=>{r({[i]:s}),e==null||e(i,s)};return u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsx(is,{label:"🔔 Notifications",description:"Master toggle for all alerts",checked:t.globalEnabled,onChange:i=>n("globalEnabled",i)}),t.globalEnabled&&u.jsx("div",{className:"border-t border-border-subtle my-0.5"}),t.globalEnabled&&u.jsx(is,{label:"🖥️ Browser Notifications",description:"Desktop alerts when tab is inactive",checked:t.browserNotifications,onChange:i=>n("browserNotifications",i)}),t.globalEnabled&&t.browserNotifications&&u.jsxs("div",{className:"ml-5 pl-3 border-l-2 border-border-subtle flex flex-col gap-2",children:[u.jsx(is,{label:"✅ Completion Alerts",description:"Notify when agent finishes a task",checked:t.completionAlert,onChange:i=>n("completionAlert",i)}),u.jsx(is,{label:"⚡ Approval Alerts",description:"Notify when agent needs approval",checked:t.approvalAlert,onChange:i=>n("approvalAlert",i)}),u.jsx(is,{label:"📡 Connection Alerts",description:"Alert when a daemon disconnects",checked:t.disconnectAlert,onChange:i=>n("disconnectAlert",i)})]}),!t.globalEnabled&&u.jsx("p",{className:"text-[11px] text-text-muted italic",children:"All notifications are disabled. Enable the master toggle to configure individual alerts."})]})}function FM({ides:e,emptyMessage:t,sendDaemonCommand:r,onDisconnect:n,onRevokeToken:i}){const s=e.filter(o=>o.type==="adhdev-daemon");return s.length===0?u.jsx(PM,{icon:"🔌",title:"No machines connected",description:t||"Run 'adhdev daemon' on your machine to connect."}):u.jsx("div",{className:"flex flex-col gap-2",children:s.map(o=>u.jsx(WM,{ide:o,sendDaemonCommand:r,onDisconnect:n,onRevokeToken:i},o.id))})}function tv({title:e,message:t,confirmLabel:r,confirmColor:n,onConfirm:i,onCancel:s}){const o=n==="red"?"bg-red-500/20 text-red-400 border-red-500/30 hover:bg-red-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30 hover:bg-amber-500/30";return b0.createPortal(u.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",style:{zIndex:9999},onClick:s,children:u.jsxs("div",{className:"bg-bg-primary border border-border-subtle rounded-xl p-5 max-w-sm w-full mx-4 shadow-2xl",onClick:l=>l.stopPropagation(),children:[u.jsx("div",{className:"font-semibold text-sm mb-3",children:e}),u.jsx("div",{className:"text-xs text-text-muted leading-relaxed mb-5 whitespace-pre-line",children:t}),u.jsxs("div",{className:"flex gap-2 justify-end",children:[u.jsx("button",{onClick:s,className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-bg-secondary text-text-secondary border border-border-subtle hover:bg-bg-glass transition-colors",children:"Cancel"}),u.jsx("button",{onClick:i,className:`text-xs px-3 py-1.5 rounded-lg font-medium border transition-colors ${o}`,children:r})]})]})}),document.body)}function WM({ide:e,sendDaemonCommand:t,onDisconnect:r,onRevokeToken:n}){var q,E,A,R;const[i,s]=b.useState("idle"),[o,l]=b.useState(""),[a,c]=b.useState(null),[d,h]=b.useState("idle"),[f,p]=b.useState(""),m=e,g=m.version||m.daemonVersion||null,S=((q=m.machine)==null?void 0:q.hostname)||((E=m.system)==null?void 0:E.hostname)||"",_=((A=m.machine)==null?void 0:A.platform)||((R=m.system)==null?void 0:R.platform)||"",x=m.machineNickname||(S==null?void 0:S.replace(/\.local$/,""))||"Machine",w=_==="win32"?"🪟":_==="darwin"?"🍎":"🐧",N=async()=>{var T,$,z;if(t){s("upgrading"),l("Installing latest version...");try{const D=await t(e.id,"daemon_upgrade",{});(T=D==null?void 0:D.result)!=null&&T.upgraded||($=D==null?void 0:D.result)!=null&&$.success?(s("done"),l(`Upgraded to v${D.result.version||"latest"}. Daemon is restarting...`)):(s("error"),l(((z=D==null?void 0:D.result)==null?void 0:z.error)||"Upgrade failed"))}catch(D){s("error"),l((D==null?void 0:D.message)||"Connection lost during upgrade")}}},L=async()=>{if(c(null),!!r){h("loading");try{await r(e.id),h("done"),p("Machine disconnected.")}catch(T){h("error"),p((T==null?void 0:T.message)||"Failed to disconnect")}}},C=async()=>{if(c(null),!!n){h("loading");try{await n(e.id),h("done"),p('Token revoked. Machine must run "adhdev setup" to reconnect.')}catch(T){h("error"),p((T==null?void 0:T.message)||"Failed to revoke token")}}},F="0.5.26",P=!g||g!==F;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"bg-bg-glass rounded-lg px-4 py-3 border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("span",{className:"text-xl",children:w}),u.jsxs("div",{children:[u.jsx("div",{className:"font-medium text-sm",children:x}),u.jsxs("div",{className:"text-xs text-text-muted font-mono flex items-center gap-2",children:[u.jsxs("span",{children:[e.id.substring(0,12),"…"]}),g&&u.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${P?"bg-amber-500/15 text-amber-400":"bg-bg-secondary"}`,children:["v",g,!P&&" ✓"]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[t&&P&&u.jsx("button",{onClick:N,disabled:i==="upgrading"||i==="done",className:`text-xs px-2.5 py-1 rounded-md font-medium transition-all
|
|
177
|
+
This will terminate the CLI process.`))return;const g=e.ideId||e.daemonId||"";try{await a(g,"stop_cli",{cliType:m})}catch(_){console.error("Stop CLI failed:",_)}},title:"Stop CLI process",className:"px-2 py-0.5 rounded-[5px] text-[11px] bg-red-500/[0.08] text-red-400 border border-red-500/30 cursor-pointer leading-none font-semibold",children:"■ Stop"})]})]}),u.jsx(F1,{activeConv:e,onModalButton:o}),u.jsx("div",{className:"flex-1 min-h-0 p-2 bg-[#0f1117]",children:u.jsx($1,{ref:r,onInput:m=>{var _;const g=e.ideId||e.daemonId||"",S=(_=e.ideId)!=null&&_.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(g,{type:"pty_input",cliType:S,data:m})||a(g,"pty_input",{cliType:S,data:m}).catch(console.error)},onResize:(m,g)=>{var x;const S=e.ideId||e.daemonId||"",_=(x=e.ideId)!=null&&x.includes(":cli:")?e.ideId.split(":cli:")[1]:e.ideType||e.agentType||"";c!=null&&c(S,{type:"pty_resize",cliType:_,cols:m,rows:g})||a(S,"pty_resize",{cliType:_,cols:m,rows:g,force:!0}).catch(()=>{})}},e.tabKey)}),u.jsx("div",{className:"px-3 py-2 bg-[var(--surface-primary)] border-t border-border-subtle shrink-0",children:u.jsxs("div",{className:"flex gap-2.5 items-center",children:[u.jsx("div",{className:"flex-1 relative",children:u.jsx("input",{ref:l,type:"text",placeholder:`Send message to ${e.displayPrimary}...`,value:n,onChange:m=>i(m.target.value),onPaste:m=>{const g=m.clipboardData.getData("text");g&&i(S=>S+g),m.preventDefault()},onKeyDown:m=>{if(m.key==="Enter"){if(m.nativeEvent.isComposing){m.preventDefault();return}m.preventDefault(),s()}},className:"w-full h-9 rounded-[18px] px-4 bg-bg-secondary border border-border-subtle text-[13px] text-text-primary"})}),u.jsx("button",{onClick:s,disabled:!n.trim(),className:`w-9 h-9 rounded-full flex items-center justify-center border-none shrink-0 transition-all duration-300 ${n.trim()?"bg-accent cursor-pointer":"bg-bg-secondary cursor-default"}`,children:u.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:n.trim()?"text-white":"text-text-muted",children:u.jsx("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})})]})})]})}function NR({wsStatus:e,showReconnected:t,loginUrl:r}){const n=e==="disconnected"||e==="reconnecting"||e==="offline"||e==="auth_failed",i=e==="auth_failed"?"red":e==="offline"?"orange":"violet",s={red:"linear-gradient(90deg, rgba(239,68,68,0.12), rgba(239,68,68,0.04))",orange:"linear-gradient(90deg, rgba(255,107,53,0.12), rgba(255,107,53,0.04))",violet:"linear-gradient(90deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04))"},o={red:"1px solid rgba(239,68,68,0.2)",orange:"1px solid rgba(255,107,53,0.2)",violet:"1px solid rgba(139,92,246,0.2)"},l={red:"#ef4444",orange:"#ff6b35",violet:"#a78bfa"};return u.jsxs(u.Fragment,{children:[n&&u.jsxs("div",{className:"py-2.5 px-5 text-[13px] font-semibold flex items-center gap-2.5 justify-center",style:{background:s[i],borderBottom:o[i],color:l[i]},children:[u.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-5 h-5",style:{opacity:e==="auth_failed"?.6:1,animation:e==="auth_failed"?void 0:"pulse 2s ease-in-out infinite",filter:e==="auth_failed"?"grayscale(1)":void 0}}),e==="offline"&&"Network offline — waiting for connection...",e==="disconnected"&&"Reconnecting to server...",e==="reconnecting"&&"Reconnecting to server...",e==="auth_failed"&&(r?u.jsxs(u.Fragment,{children:["Session expired."," ",u.jsx("a",{href:r,className:"text-inherit underline",children:"Log in again"})]}):"Connection failed — please restart the server.")]}),t&&e==="connected"&&u.jsxs("div",{className:"py-2 px-4 text-xs font-semibold flex items-center gap-2 justify-center bg-gradient-to-r from-green-500/[0.12] to-green-500/[0.04] text-green-400 border-b border-green-500/15 animate-[fadeIn_0.3s_ease]",children:[u.jsx("img",{src:"/otter-logo.png",alt:"",className:"w-4 h-4"}),"Connected"]})]})}const zu=e=>(e.ideId||e.tabKey||e.id||"").includes(":cli:"),$u=e=>(e.ideId||e.tabKey||e.id||"").includes(":acp:");function PR({activeConv:e,agentCount:t,wsStatus:r,isConnected:n,onOpenHistory:i}){const s=Os(),o=n?"#22c55e":r==="connected"?"#eab308":"#ef4444",l=n?"0 0 4px #22c55e80":r==="connected"?"0 0 4px #eab30880":"0 0 4px #ef444480";return u.jsxs("div",{className:"dashboard-header",children:[u.jsx("div",{className:"flex items-center gap-3",children:u.jsxs("div",{className:"leading-tight",children:[u.jsxs("h1",{className:"header-title m-0 flex items-center gap-1.5",children:[u.jsx(Xa,{size:18}),u.jsx("span",{className:"header-title-desktop",children:"Dashboard"}),u.jsx("span",{className:"header-title-mobile",children:(e==null?void 0:e.displayPrimary)||"Dashboard"}),u.jsx("span",{className:"header-count-mobile text-[10px] font-semibold opacity-60 ml-2 tracking-wide",children:u.jsx("span",{className:"inline-block w-[6px] h-[6px] rounded-full align-middle",style:{background:o,boxShadow:l}})})]}),u.jsxs("div",{className:"header-subtitle text-[11px] items-center gap-1",children:[t," agent",t!==1?"s":""," active",u.jsx("span",{title:n?"Connected":r==="connected"?"Partial":"Disconnected",className:"inline-block w-1.5 h-1.5 rounded-full shrink-0",style:{background:o,boxShadow:l}})]})]})}),u.jsxs("div",{className:"flex gap-2 items-center",children:[e&&!zu(e)&&!$u(e)&&u.jsxs("button",{onClick:()=>s(`/ide/${e.ideId}`),className:"btn btn-primary btn-sm border-none px-2.5 py-1.5 flex items-center gap-1 text-xs",title:"IDE View",children:[u.jsx(XP,{size:14})," IDE"]}),e&&!zu(e)&&!$u(e)&&u.jsx("button",{onClick:i,className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5 flex items-center gap-1",title:"Chat History",children:u.jsx(UP,{size:16})}),e&&!zu(e)&&!$u(e)&&u.jsx("button",{onClick:()=>s(`/ide/${e.ideId}?view=remote`),className:"btn btn-secondary btn-sm border-none bg-bg-secondary px-2.5 py-1.5",title:"Remote Control",children:u.jsx(Ro,{size:16})})]})]})}function Ar(e){return e?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():"IDE"}function TR(e){if(e<60)return`${Math.round(e)}s`;const t=Math.floor(e/60);if(t<60)return`${t}m`;const r=Math.floor(t/60),n=t%60;if(r<24)return n>0?`${r}h ${n}m`:`${r}h`;const i=Math.floor(r/24),s=r%24;return`${i}d ${s}h`}function W_(e){return e<1024*1024*1024?`${(e/(1024*1024)).toFixed(0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function H_(e){return(e.id||"").includes(":cli:")}function U_(e){return(e.id||"").includes(":acp:")}function Ad(e,t){return Ar(e)}function LR(e){if(!Array.isArray(e)||e.length<=1)return e;const t=new Map,r=["generating","streaming","active","connected","idle","panel_hidden"];for(const n of e){const i=(n.name||n.id||"").toLowerCase().replace(/\s+/g,"-"),s=t.get(i);if(!s){t.set(i,n);continue}const o=r.indexOf(s.status||"idle"),l=r.indexOf(n.status||"idle");l>=0&&(o<0||l<o)&&t.set(i,n)}return Array.from(t.values())}function RR({activeConv:e,ides:t,isCreatingChat:r,isRefreshingHistory:n,onClose:i,onNewChat:s,onSwitchSession:o,onRefreshHistory:l}){var h;const a=t.find(f=>f.id===e.ideId),c=(a==null?void 0:a.chats)||[],d=(h=a==null?void 0:a.activeChat)==null?void 0:h.id;return u.jsxs("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center",children:[u.jsx("div",{onClick:i,className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),u.jsxs("div",{className:"card fade-in relative w-[90%] max-w-[500px] max-h-[80vh] flex flex-col p-0 overflow-hidden shadow-[0_20px_40px_rgba(0,0,0,0.4)] rounded-[20px]",children:[u.jsxs("div",{className:"px-6 py-5 border-b border-border-subtle flex justify-between items-center bg-[var(--surface-primary)]",children:[u.jsxs("div",{children:[u.jsx("h3",{className:"m-0 text-lg font-extrabold",children:"Chat History"}),u.jsxs("div",{className:"text-xs text-text-muted mt-0.5",children:[e.displayPrimary," — ",Ar(e.ideType)]})]}),u.jsx("button",{onClick:i,className:"bg-transparent border-none text-xl text-text-muted cursor-pointer",children:"✕"})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-3 bg-bg-primary",children:[u.jsx("button",{onClick:s,disabled:r,className:"w-full p-3.5 rounded-xl mb-3 bg-indigo-500/10 border border-dashed border-accent text-accent font-bold text-sm cursor-pointer",children:r?"⌛ Creating...":"+ Start New Chat Session"}),c.map(f=>u.jsxs("div",{onClick:()=>{o(e.ideId,f.id),i()},className:`p-4 rounded-xl mb-2 cursor-pointer border transition-all ${d===f.id?"bg-[var(--bg-glass-hover)] border-accent":"bg-[var(--surface-secondary)] border-border-subtle"}`,children:[u.jsx("div",{className:`font-bold text-sm mb-1 ${d===f.id?"text-[var(--accent-primary-light)]":"text-text-primary"}`,children:f.title||"Untitled Session"}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-mono",children:[f.id.substring(0,12),"..."]}),d===f.id&&u.jsx("span",{className:"text-[10px] bg-accent text-white px-2 py-0.5 rounded-[10px] font-extrabold",children:"ACTIVE"})]})]},f.id)),c.length===0&&u.jsxs("div",{className:"py-10 px-5 text-center text-text-muted",children:[u.jsx("div",{className:"text-3xl mb-3 opacity-60",children:u.jsx(ZP,{size:32})}),u.jsx("div",{className:"text-[13px]",children:"No recent chat sessions found."})]})]}),u.jsx("div",{className:"px-5 py-4 bg-[var(--surface-tertiary)] border-t border-border-subtle text-right",children:u.jsx("button",{onClick:l,disabled:n,className:"btn btn-secondary btn-sm rounded-[10px]",children:n?"⌛ Refreshing...":u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(KP,{size:13})," Refresh History"]})})})]})]})}const V_={success:"rgba(16, 185, 129, 0.95)",warning:"rgba(245, 158, 11, 0.95)",info:"rgba(99, 102, 241, 0.95)"};function MR({toasts:e,onDismiss:t,onClickToast:r}){return u.jsx("div",{className:"fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none",children:e.map(n=>u.jsx("div",{className:"fade-in text-white px-5 py-3 rounded-xl text-[13px] font-semibold shadow-[0_8px_32px_rgba(0,0,0,0.3)] backdrop-blur-lg pointer-events-auto cursor-pointer animate-[toast-in_0.3s_ease-out] max-w-[360px]",style:{background:V_[n.type]||V_.info},onClick:()=>{r&&r(n),t(n.id)},children:n.message},n.id))})}const IR=e=>(e.id||"").includes(":cli:")||(e.id||"").includes(":acp:")||(e.id||"").includes(":ide:")?!0:e.daemonId!==e.id;function DR(e){return e.workspace||"Workspace"}function jR(e,t,r,n){var s;const i={};if(r)for(const o of r){const l=o;if(l.type==="adhdev-daemon"||l.daemonMode){const a=l.machine||{},c=l.machineNickname,d=a.hostname||((s=l.system)==null?void 0:s.hostname)||"",h=c||(d&&d!=="Unknown"?d.replace(/\.local$/,""):null)||`Machine ${(l.id||"").substring(0,6)}`;i[l.id]=h}}return e.flatMap(o=>{var S,_,x,w,N;const l=[],a=o.daemonId&&i[o.daemonId]||void 0,c=o.daemonId||((S=o.id)==null?void 0:S.split(":")[0])||o.id,d=n?n[c]||"new":void 0,h=DR(o),f=Ar(o.type),p=o.agentStreams,m=Array.isArray(p)?p.map(L=>({...L,activeModal:L.activeModal??void 0})):[],g=IR(o);if(g){const L=Ad(o.type),C=(_=o.agents)==null?void 0:_[0],F=(x=o.activeChat)==null?void 0:x.activeModal,P=F&&Array.isArray(F.buttons)&&F.buttons.length>0,q=(w=o.activeChat)==null?void 0:w.status,E=q==="generating"||q==="loading"||q&&q.toLowerCase()==="thinking",R=P||q==="waiting_approval"?"waiting_approval":E?"working":(C==null?void 0:C.status)||"idle",T=o.activeChat||{title:"",messages:[]};let $=T.title&&String(T.title).trim()?String(T.title).trim():"";const z=(N=o.activeChat)==null?void 0:N.id,D=o.chats;if(z&&Array.isArray(D)&&D.length>0){const J=D.find(ae=>ae.id===z||ae.id&&String(ae.id)===String(z));J!=null&&J.title&&String(J.title).trim()&&($=String(J.title).trim())}const H=T.messages||[],I=t[o.id]||[],W=new Map;H.filter(J=>J.role==="user").forEach(J=>{W.set(J.content,(W.get(J.content)||0)+1)});const y=I.filter(J=>{const ae=W.get(J.content)||0;return ae>0?(W.set(J.content,ae-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:L,agentType:In(o)||tn(o)?o.type:(C==null?void 0:C.type)||"ide-native",status:R,title:$,messages:[...H,...y],ideType:o.type,workspaceName:h,displayPrimary:$||h,displaySecondary:f,cdpConnected:o.cdpConnected,modalButtons:P?F.buttons:void 0,modalMessage:P?F.message:void 0,streamSource:"native",tabKey:o.id,machineName:a,connectionState:d})}if(g&&(In(o)||tn(o)))return l;for(const L of m){const C=L.activeModal&&Array.isArray(L.activeModal.buttons)&&L.activeModal.buttons.length>0,F=C?"waiting_approval":L.status==="streaming"?"working":L.status,P=`${o.id}:${L.agentType}`,q=L.messages||[],E=t[P]||[],A=new Map;q.filter(T=>T.role==="user").forEach(T=>{A.set(T.content,(A.get(T.content)||0)+1)});const R=E.filter(T=>{const $=A.get(T.content)||0;return $>0?(A.set(T.content,$-1),!1):!0});l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:L.agentName,agentType:L.agentType,status:F,title:"",messages:[...q,...R],ideType:o.type,workspaceName:h,displayPrimary:h,displaySecondary:`${f}·${L.agentName}`,cdpConnected:o.cdpConnected,modalButtons:C?L.activeModal.buttons:void 0,modalMessage:C?L.activeModal.message:void 0,streamSource:"agent-stream",tabKey:P,machineName:a,connectionState:d})}return l.length===0&&l.push({ideId:o.id,daemonId:o.daemonId||void 0,agentName:Ad(o.type),agentType:"ide-native",status:"idle",title:"",messages:[],ideType:o.type,workspaceName:h,displayPrimary:h,displaySecondary:f,cdpConnected:o.cdpConnected,streamSource:"native",tabKey:o.id,connectionState:d}),l})}function AR(e,t){var l,a,c,d;const r=[],{daemonId:n,existingDaemon:i,timestamp:s}=t,o=s||e.timestamp||Date.now();r.push({...i||{},id:n,type:"adhdev-daemon",status:"online",daemonMode:!0,timestamp:o,...e.version&&{version:e.version},...e.machine&&{machine:e.machine,platform:e.machine.platform},...e.instanceId&&{instanceId:e.instanceId},...e.machineNickname!==void 0&&{machineNickname:e.machineNickname},...e.p2p&&{p2p:e.p2p},..."system"in e&&{system:e.system},..."hostname"in e&&{hostname:e.hostname},...e.workspaces&&{workspaces:e.workspaces},...e.defaultWorkspaceId!==void 0&&{defaultWorkspaceId:e.defaultWorkspaceId},...e.defaultWorkspacePath!==void 0&&{defaultWorkspacePath:e.defaultWorkspacePath},...e.workspaceActivity&&{workspaceActivity:e.workspaceActivity},...e.detectedIdes&&{detectedIdes:e.detectedIdes},..."availableProviders"in e&&{availableProviders:e.availableProviders},cdpConnected:e.managedIdes.some(h=>h.cdpConnected),managedIdeIds:e.managedIdes.map(h=>`${n}:ide:${h.instanceId}`),managedCliIds:e.managedClis.map(h=>h.id?`${n}:cli:${h.id}`:`${n}:cli:${h.cliType}`),managedAcpIds:e.managedAcps.map(h=>h.id?`${n}:acp:${h.id}`:`${n}:acp:${h.acpType}`)});for(const h of e.managedIdes)r.push({id:`${n}:ide:${h.instanceId}`,type:h.ideType,ideType:h.ideType,version:h.ideVersion,status:h.cdpConnected?"online":"detected",daemonId:n,instanceId:h.instanceId,workspace:h.workspace,terminals:h.terminals,agents:h.aiAgents,activeChat:h.activeChat,chats:h.chats,agentStreams:h.agentStreams,cdpConnected:h.cdpConnected,currentModel:h.currentModel,currentPlan:h.currentPlan,currentAutoApprove:h.currentAutoApprove,timestamp:o});for(const h of e.managedClis){const f=h.id?`${n}:cli:${h.id}`:`${n}:cli:${h.cliType}`;r.push({id:f,type:h.cliType,ideType:h.cliType,agentType:h.cliType,status:h.status||"running",daemonId:n,instanceId:h.id,cliName:h.cliName,mode:h.mode||"terminal",workspace:h.workspace,activeChat:h.activeChat,agentStreams:[{agentType:h.cliType,agentName:h.cliName,extensionId:"cli-agent",status:h.status==="generating"?"streaming":h.status==="waiting_approval"?"waiting_approval":"idle",messages:((l=h.activeChat)==null?void 0:l.messages)||[],inputContent:"",activeModal:(a=h.activeChat)==null?void 0:a.activeModal}],timestamp:o,_isCli:!0})}for(const h of e.managedAcps){const f=h.id?`${n}:acp:${h.id}`:`${n}:acp:${h.acpType}`;r.push({id:f,type:h.acpType,ideType:h.acpType,agentType:h.acpType,status:h.status||"running",daemonId:n,instanceId:h.id,cliName:h.acpName,mode:"chat",workspace:h.workspace,activeChat:h.activeChat,currentModel:h.currentModel,currentPlan:h.currentPlan,acpConfigOptions:h.acpConfigOptions,acpModes:h.acpModes,agentStreams:[{agentType:h.acpType,agentName:h.acpName,extensionId:"acp-agent",status:h.status==="generating"?"streaming":h.status==="waiting_approval"?"waiting_approval":"idle",messages:((c=h.activeChat)==null?void 0:c.messages)||[],inputContent:"",activeModal:(d=h.activeChat)==null?void 0:d.activeModal}],timestamp:o,_isAcp:!0})}return r}function U1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=U1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function BR(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=U1(e))&&(n&&(n+=" "),n+=t);return n}const OR=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},zR=(e,t)=>({classGroupId:e,validator:t}),V1=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),rc="-",K_=[],$R="arbitrary..",FR=e=>{const t=HR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return WR(o);const l=o.split(rc),a=l[0]===""&&l.length>1?1:0;return K1(l,a,t)},getConflictingClassGroupIds:(o,l)=>{if(l){const a=n[o],c=r[o];return a?c?OR(c,a):a:c||K_}return r[o]||K_}}},K1=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const i=e[t],s=r.nextPart.get(i);if(s){const c=K1(e,t+1,s);if(c)return c}const o=r.validators;if(o===null)return;const l=t===0?e.join(rc):e.slice(t).join(rc),a=o.length;for(let c=0;c<a;c++){const d=o[c];if(d.validator(l))return d.classGroupId}},WR=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?$R+n:void 0})(),HR=e=>{const{theme:t,classGroups:r}=e;return UR(r,t)},UR=(e,t)=>{const r=V1();for(const n in e){const i=e[n];hp(i,r,n,t)}return r},hp=(e,t,r,n)=>{const i=e.length;for(let s=0;s<i;s++){const o=e[s];VR(o,t,r,n)}},VR=(e,t,r,n)=>{if(typeof e=="string"){KR(e,t,r);return}if(typeof e=="function"){qR(e,t,r,n);return}YR(e,t,r,n)},KR=(e,t,r)=>{const n=e===""?t:q1(t,e);n.classGroupId=r},qR=(e,t,r,n)=>{if(XR(e)){hp(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(zR(r,e))},YR=(e,t,r,n)=>{const i=Object.entries(e),s=i.length;for(let o=0;o<s;o++){const[l,a]=i[o];hp(a,q1(t,l),r,n)}},q1=(e,t)=>{let r=e;const n=t.split(rc),i=n.length;for(let s=0;s<i;s++){const o=n[s];let l=r.nextPart.get(o);l||(l=V1(),r.nextPart.set(o,l)),r=l}return r},XR=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,GR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const i=(s,o)=>{r[s]=o,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(s){let o=r[s];if(o!==void 0)return o;if((o=n[s])!==void 0)return i(s,o),o},set(s,o){s in r?r[s]=o:i(s,o)}}},Bd="!",q_=":",QR=[],Y_=(e,t,r,n,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),JR=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=i=>{const s=[];let o=0,l=0,a=0,c;const d=i.length;for(let g=0;g<d;g++){const S=i[g];if(o===0&&l===0){if(S===q_){s.push(i.slice(a,g)),a=g+1;continue}if(S==="/"){c=g;continue}}S==="["?o++:S==="]"?o--:S==="("?l++:S===")"&&l--}const h=s.length===0?i:i.slice(a);let f=h,p=!1;h.endsWith(Bd)?(f=h.slice(0,-1),p=!0):h.startsWith(Bd)&&(f=h.slice(1),p=!0);const m=c&&c>a?c-a:void 0;return Y_(s,p,f,m)};if(t){const i=t+q_,s=n;n=o=>o.startsWith(i)?s(o.slice(i.length)):Y_(QR,!1,o,void 0,!0)}if(r){const i=n;n=s=>r({className:s,parseClassName:i})}return n},ZR=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let s=0;s<r.length;s++){const o=r[s],l=o[0]==="[",a=t.has(o);l||a?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},eM=e=>({cache:GR(e.cacheSize),parseClassName:JR(e),sortModifiers:ZR(e),...FR(e)}),tM=/\s+/,rM=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:s}=t,o=[],l=e.trim().split(tM);let a="";for(let c=l.length-1;c>=0;c-=1){const d=l[c],{isExternal:h,modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=r(d);if(h){a=d+(a.length>0?" "+a:a);continue}let S=!!g,_=n(S?m.substring(0,g):m);if(!_){if(!S){a=d+(a.length>0?" "+a:a);continue}if(_=n(m),!_){a=d+(a.length>0?" "+a:a);continue}S=!1}const x=f.length===0?"":f.length===1?f[0]:s(f).join(":"),w=p?x+Bd:x,N=w+_;if(o.indexOf(N)>-1)continue;o.push(N);const L=i(_,S);for(let C=0;C<L.length;++C){const F=L[C];o.push(w+F)}a=d+(a.length>0?" "+a:a)}return a},nM=(...e)=>{let t=0,r,n,i="";for(;t<e.length;)(r=e[t++])&&(n=Y1(r))&&(i&&(i+=" "),i+=n);return i},Y1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Y1(e[n]))&&(r&&(r+=" "),r+=t);return r},iM=(e,...t)=>{let r,n,i,s;const o=a=>{const c=t.reduce((d,h)=>h(d),e());return r=eM(c),n=r.cache.get,i=r.cache.set,s=l,l(a)},l=a=>{const c=n(a);if(c)return c;const d=rM(a,r);return i(a,d),d};return s=o,(...a)=>s(nM(...a))},sM=[],Pt=e=>{const t=r=>r[e]||sM;return t.isThemeGetter=!0,t},X1=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,G1=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oM=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,aM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,cM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,uM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=e=>oM.test(e),Ae=e=>!!e&&!Number.isNaN(Number(e)),Vn=e=>!!e&&Number.isInteger(Number(e)),Fu=e=>e.endsWith("%")&&Ae(e.slice(0,-1)),xn=e=>lM.test(e),Q1=()=>!0,dM=e=>aM.test(e)&&!cM.test(e),dp=()=>!1,fM=e=>uM.test(e),pM=e=>hM.test(e),mM=e=>!ye(e)&&!be(e),gM=e=>vi(e,eb,dp),ye=e=>X1.test(e),wi=e=>vi(e,tb,dM),X_=e=>vi(e,kM,Ae),_M=e=>vi(e,nb,Q1),vM=e=>vi(e,rb,dp),G_=e=>vi(e,J1,dp),xM=e=>vi(e,Z1,pM),Yl=e=>vi(e,ib,fM),be=e=>G1.test(e),lo=e=>Qi(e,tb),yM=e=>Qi(e,rb),Q_=e=>Qi(e,J1),bM=e=>Qi(e,eb),wM=e=>Qi(e,Z1),Xl=e=>Qi(e,ib,!0),SM=e=>Qi(e,nb,!0),vi=(e,t,r)=>{const n=X1.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},Qi=(e,t,r=!1)=>{const n=G1.exec(e);return n?n[1]?t(n[1]):r:!1},J1=e=>e==="position"||e==="percentage",Z1=e=>e==="image"||e==="url",eb=e=>e==="length"||e==="size"||e==="bg-size",tb=e=>e==="length",kM=e=>e==="number",rb=e=>e==="family-name",nb=e=>e==="number"||e==="weight",ib=e=>e==="shadow",CM=()=>{const e=Pt("color"),t=Pt("font"),r=Pt("text"),n=Pt("font-weight"),i=Pt("tracking"),s=Pt("leading"),o=Pt("breakpoint"),l=Pt("container"),a=Pt("spacing"),c=Pt("radius"),d=Pt("shadow"),h=Pt("inset-shadow"),f=Pt("text-shadow"),p=Pt("drop-shadow"),m=Pt("blur"),g=Pt("perspective"),S=Pt("aspect"),_=Pt("ease"),x=Pt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...N(),be,ye],C=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],P=()=>[be,ye,a],q=()=>[Un,"full","auto",...P()],E=()=>[Vn,"none","subgrid",be,ye],A=()=>["auto",{span:["full",Vn,be,ye]},Vn,be,ye],R=()=>[Vn,"auto",be,ye],T=()=>["auto","min","max","fr",be,ye],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],D=()=>["auto",...P()],H=()=>[Un,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],I=()=>[Un,"screen","full","dvw","lvw","svw","min","max","fit",...P()],W=()=>[Un,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],y=()=>[e,be,ye],J=()=>[...N(),Q_,G_,{position:[be,ye]}],ae=()=>["no-repeat",{repeat:["","x","y","space","round"]}],k=()=>["auto","cover","contain",bM,gM,{size:[be,ye]}],we=()=>[Fu,lo,wi],U=()=>["","none","full",c,be,ye],Y=()=>["",Ae,lo,wi],te=()=>["solid","dashed","dotted","double"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[Ae,Fu,Q_,G_],Oe=()=>["","none",m,be,ye],Ve=()=>["none",Ae,be,ye],Ie=()=>["none",Ae,be,ye],G=()=>[Ae,be,ye],me=()=>[Un,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xn],breakpoint:[xn],color:[Q1],container:[xn],"drop-shadow":[xn],ease:["in","out","in-out"],font:[mM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xn],shadow:[xn],spacing:["px",Ae],text:[xn],"text-shadow":[xn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Un,ye,be,S]}],container:["container"],columns:[{columns:[Ae,ye,be,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{"inset-s":q(),start:q()}],end:[{"inset-e":q(),end:q()}],"inset-bs":[{"inset-bs":q()}],"inset-be":[{"inset-be":q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[Vn,"auto",be,ye]}],basis:[{basis:[Un,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ae,Un,"auto","initial","none",ye]}],grow:[{grow:["",Ae,be,ye]}],shrink:[{shrink:["",Ae,be,ye]}],order:[{order:[Vn,"first","last","none",be,ye]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:D()}],mx:[{mx:D()}],my:[{my:D()}],ms:[{ms:D()}],me:[{me:D()}],mbs:[{mbs:D()}],mbe:[{mbe:D()}],mt:[{mt:D()}],mr:[{mr:D()}],mb:[{mb:D()}],ml:[{ml:D()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...I()]}],"min-inline-size":[{"min-inline":["auto",...I()]}],"max-inline-size":[{"max-inline":["none",...I()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[l,"screen",...H()]}],"min-w":[{"min-w":[l,"screen","none",...H()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,lo,wi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,SM,_M]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fu,ye]}],"font-family":[{font:[yM,vM,t]}],"font-features":[{"font-features":[ye]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,be,ye]}],"line-clamp":[{"line-clamp":[Ae,"none",be,X_]}],leading:[{leading:[s,...P()]}],"list-image":[{"list-image":["none",be,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",be,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:y()}],"text-color":[{text:y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ae,"from-font","auto",be,wi]}],"text-decoration-color":[{decoration:y()}],"underline-offset":[{"underline-offset":[Ae,"auto",be,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be,ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",be,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:k()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Vn,be,ye],radial:["",be,ye],conic:[Vn,be,ye]},wM,xM]}],"bg-color":[{bg:y()}],"gradient-from-pos":[{from:we()}],"gradient-via-pos":[{via:we()}],"gradient-to-pos":[{to:we()}],"gradient-from":[{from:y()}],"gradient-via":[{via:y()}],"gradient-to":[{to:y()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Y()}],"border-w-x":[{"border-x":Y()}],"border-w-y":[{"border-y":Y()}],"border-w-s":[{"border-s":Y()}],"border-w-e":[{"border-e":Y()}],"border-w-bs":[{"border-bs":Y()}],"border-w-be":[{"border-be":Y()}],"border-w-t":[{"border-t":Y()}],"border-w-r":[{"border-r":Y()}],"border-w-b":[{"border-b":Y()}],"border-w-l":[{"border-l":Y()}],"divide-x":[{"divide-x":Y()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Y()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:y()}],"border-color-x":[{"border-x":y()}],"border-color-y":[{"border-y":y()}],"border-color-s":[{"border-s":y()}],"border-color-e":[{"border-e":y()}],"border-color-bs":[{"border-bs":y()}],"border-color-be":[{"border-be":y()}],"border-color-t":[{"border-t":y()}],"border-color-r":[{"border-r":y()}],"border-color-b":[{"border-b":y()}],"border-color-l":[{"border-l":y()}],"divide-color":[{divide:y()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ae,be,ye]}],"outline-w":[{outline:["",Ae,lo,wi]}],"outline-color":[{outline:y()}],shadow:[{shadow:["","none",d,Xl,Yl]}],"shadow-color":[{shadow:y()}],"inset-shadow":[{"inset-shadow":["none",h,Xl,Yl]}],"inset-shadow-color":[{"inset-shadow":y()}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:y()}],"ring-offset-w":[{"ring-offset":[Ae,wi]}],"ring-offset-color":[{"ring-offset":y()}],"inset-ring-w":[{"inset-ring":Y()}],"inset-ring-color":[{"inset-ring":y()}],"text-shadow":[{"text-shadow":["none",f,Xl,Yl]}],"text-shadow-color":[{"text-shadow":y()}],opacity:[{opacity:[Ae,be,ye]}],"mix-blend":[{"mix-blend":[...fe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":fe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":y()}],"mask-image-linear-to-color":[{"mask-linear-to":y()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":y()}],"mask-image-t-to-color":[{"mask-t-to":y()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":y()}],"mask-image-r-to-color":[{"mask-r-to":y()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":y()}],"mask-image-b-to-color":[{"mask-b-to":y()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":y()}],"mask-image-l-to-color":[{"mask-l-to":y()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":y()}],"mask-image-x-to-color":[{"mask-x-to":y()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":y()}],"mask-image-y-to-color":[{"mask-y-to":y()}],"mask-image-radial":[{"mask-radial":[be,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":y()}],"mask-image-radial-to-color":[{"mask-radial-to":y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[Ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":y()}],"mask-image-conic-to-color":[{"mask-conic-to":y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:k()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",be,ye]}],filter:[{filter:["","none",be,ye]}],blur:[{blur:Oe()}],brightness:[{brightness:[Ae,be,ye]}],contrast:[{contrast:[Ae,be,ye]}],"drop-shadow":[{"drop-shadow":["","none",p,Xl,Yl]}],"drop-shadow-color":[{"drop-shadow":y()}],grayscale:[{grayscale:["",Ae,be,ye]}],"hue-rotate":[{"hue-rotate":[Ae,be,ye]}],invert:[{invert:["",Ae,be,ye]}],saturate:[{saturate:[Ae,be,ye]}],sepia:[{sepia:["",Ae,be,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",be,ye]}],"backdrop-blur":[{"backdrop-blur":Oe()}],"backdrop-brightness":[{"backdrop-brightness":[Ae,be,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Ae,be,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ae,be,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ae,be,ye]}],"backdrop-invert":[{"backdrop-invert":["",Ae,be,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Ae,be,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Ae,be,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Ae,be,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",be,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ae,"initial",be,ye]}],ease:[{ease:["linear","initial",_,be,ye]}],delay:[{delay:[Ae,be,ye]}],animate:[{animate:["none",x,be,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,be,ye]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Ve()}],"rotate-x":[{"rotate-x":Ve()}],"rotate-y":[{"rotate-y":Ve()}],"rotate-z":[{"rotate-z":Ve()}],scale:[{scale:Ie()}],"scale-x":[{"scale-x":Ie()}],"scale-y":[{"scale-y":Ie()}],"scale-z":[{"scale-z":Ie()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[be,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":["translate-none"],accent:[{accent:y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",be,ye]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",be,ye]}],fill:[{fill:["none",...y()]}],"stroke-w":[{stroke:[Ae,lo,wi,X_]}],stroke:[{stroke:["none",...y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},EM=iM(CM);function sl(...e){return EM(BR(e))}function NM({icon:e,title:t,subtitle:r,badge:n,actions:i,className:s}){return u.jsxs("div",{className:sl("flex items-center justify-between px-6 py-4 border-b border-border-subtle bg-surface-primary animate-[fadeIn_0.3s_ease-out_forwards]",s),children:[u.jsxs("div",{children:[u.jsxs("h1",{className:"text-lg font-bold text-text-primary flex items-center gap-2.5 tracking-tight",children:[u.jsx("span",{children:e})," ",t,n&&u.jsxs("span",{className:"text-xs font-semibold px-2 py-0.5 rounded-full bg-accent/10 text-accent-light",children:[n.count!==void 0?n.count:""," ",n.text]})]}),u.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:r})]}),i&&u.jsx("div",{className:"flex gap-2",children:i})]})}function ao({title:e,icon:t,description:r,accentColor:n,className:i,children:s}){return u.jsxs("div",{className:sl("bg-bg-card border border-border-subtle rounded-2xl p-5 backdrop-blur-xl transition-all","hover:border-border-default hover:shadow-glow",n&&"border-l-[3px]",i),style:n?{borderLeftColor:n}:void 0,children:[(e||r)&&u.jsxs("div",{className:"mb-4",children:[e&&u.jsxs("h3",{className:"text-base font-semibold text-text-primary",children:[t&&u.jsx("span",{className:"mr-1.5",children:t}),e]}),r&&u.jsx("p",{className:"text-[13px] text-text-muted mt-1",children:r})]}),s]})}function PM({icon:e,title:t,description:r,action:n,className:i}){return u.jsxs("div",{className:sl("py-16 px-5 text-center bg-bg-glass border-2 border-dashed border-border-subtle rounded-2xl",i),children:[u.jsx("div",{className:"text-5xl mb-4 opacity-50",children:e}),u.jsx("h3",{className:"text-lg font-bold text-text-secondary mb-2",children:t}),u.jsx("p",{className:"text-sm text-text-muted max-w-sm mx-auto mb-5 leading-relaxed",children:r}),n]})}const TM={online:"bg-green-500/10 text-green-400 border-green-500/30",idle:"bg-yellow-500/10 text-yellow-400 border-yellow-500/30",busy:"bg-orange-500/10 text-orange-400 border-orange-500/30",error:"bg-red-500/10 text-red-400 border-red-500/30",offline:"bg-gray-500/10 text-text-secondary border-gray-500/30"},LM={online:"bg-green-500",idle:"bg-yellow-500",busy:"bg-orange-500",error:"bg-red-500",offline:"bg-gray-500"};function RM({status:e,label:t,className:r}){const n=t||e;return u.jsxs("span",{className:sl("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",TM[e],r),children:[u.jsx("span",{className:sl("w-2 h-2 rounded-full animate-[pulse-dot_2s_ease-in-out_infinite]",LM[e])}),n]})}function MM(){return typeof window>"u"?"dark":window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"}function J_(){try{const e=localStorage.getItem("theme");if(e==="dark"||e==="light"||e==="system")return e}catch{}return"system"}function Wu(e){return e==="system"?MM():e}function IM(){const[e,t]=b.useState(J_),[r,n]=b.useState(()=>Wu(J_()));b.useEffect(()=>{document.documentElement.setAttribute("data-theme",r)},[r]),b.useEffect(()=>{const o=window.matchMedia("(prefers-color-scheme: light)"),l=a=>{e==="system"&&n(a.matches?"light":"dark")};return o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[e]);const i=b.useCallback(o=>{t(o),n(Wu(o));try{localStorage.setItem("theme",o)}catch{}},[]),s=b.useCallback(()=>{t(o=>{const l=o==="dark"?"light":o==="light"?"system":"dark";n(Wu(l));try{localStorage.setItem("theme",l)}catch{}return l})},[]);return{theme:r,preference:e,setPreference:i,cycleTheme:s,isDark:r==="dark"}}const Z_={dark:"Dark",light:"Light",system:"System"};function DM({collapsed:e}){const{preference:t,cycleTheme:r}=IM(),n=t==="dark"?u.jsx(tT,{size:16}):t==="light"?u.jsx(eT,{size:16}):u.jsx(rT,{size:16});return u.jsxs("div",{className:`nav-item cursor-pointer ${e?"justify-center py-2.5 px-0":""}`,onClick:r,title:`Theme: ${Z_[t]} (click to cycle)`,children:[u.jsx("span",{className:"nav-icon",children:n}),!e&&u.jsx("span",{className:"text-xs",children:Z_[t]})]})}function is({label:e,description:t,checked:r,disabled:n,onChange:i,extra:s}){return u.jsxs("label",{className:"flex justify-between items-center cursor-pointer",children:[u.jsxs("div",{children:[u.jsx("div",{className:"font-medium text-sm",children:e}),u.jsx("div",{className:"text-[11px] text-text-muted",children:t})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[s,u.jsx("input",{type:"checkbox",checked:r,disabled:n,onChange:o=>i(o.target.checked),className:"w-5 h-5 accent-accent"})]})]})}const sb="adhdev_notification_prefs",ev={globalEnabled:!0,disconnectAlert:!0,browserNotifications:!0,completionAlert:!0,approvalAlert:!0};function jM(){try{const e=localStorage.getItem(sb);if(e){const t=JSON.parse(e);return{...ev,...t}}}catch{}return{...ev}}function AM(e){try{localStorage.setItem(sb,JSON.stringify(e))}catch{}}let kn=jM(),va=[];function BM(){va.forEach(e=>e())}function OM(e){kn={...kn,...e},AM(kn),BM()}function zM(){const[,e]=b.useState(0);b.useEffect(()=>{const r=()=>e(n=>n+1);return va.push(r),()=>{va=va.filter(n=>n!==r)}},[]);const t=b.useCallback(r=>{OM(r)},[]);return[{...kn},t]}function Hu(e){if(!kn.globalEnabled)return!1;switch(e){case"disconnect":return kn.disconnectAlert;case"completion":return kn.completionAlert;case"approval":return kn.approvalAlert;case"browser":return kn.browserNotifications;default:return!0}}function $M({onPrefChange:e}){const[t,r]=zM(),n=(i,s)=>{r({[i]:s}),e==null||e(i,s)};return u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsx(is,{label:"🔔 Notifications",description:"Master toggle for all alerts",checked:t.globalEnabled,onChange:i=>n("globalEnabled",i)}),t.globalEnabled&&u.jsx("div",{className:"border-t border-border-subtle my-0.5"}),t.globalEnabled&&u.jsx(is,{label:"🖥️ Browser Notifications",description:"Desktop alerts when tab is inactive",checked:t.browserNotifications,onChange:i=>n("browserNotifications",i)}),t.globalEnabled&&t.browserNotifications&&u.jsxs("div",{className:"ml-5 pl-3 border-l-2 border-border-subtle flex flex-col gap-2",children:[u.jsx(is,{label:"✅ Completion Alerts",description:"Notify when agent finishes a task",checked:t.completionAlert,onChange:i=>n("completionAlert",i)}),u.jsx(is,{label:"⚡ Approval Alerts",description:"Notify when agent needs approval",checked:t.approvalAlert,onChange:i=>n("approvalAlert",i)}),u.jsx(is,{label:"📡 Connection Alerts",description:"Alert when a daemon disconnects",checked:t.disconnectAlert,onChange:i=>n("disconnectAlert",i)})]}),!t.globalEnabled&&u.jsx("p",{className:"text-[11px] text-text-muted italic",children:"All notifications are disabled. Enable the master toggle to configure individual alerts."})]})}function FM({ides:e,emptyMessage:t,sendDaemonCommand:r,onDisconnect:n,onRevokeToken:i}){const s=e.filter(o=>o.type==="adhdev-daemon");return s.length===0?u.jsx(PM,{icon:"🔌",title:"No machines connected",description:t||"Run 'adhdev daemon' on your machine to connect."}):u.jsx("div",{className:"flex flex-col gap-2",children:s.map(o=>u.jsx(WM,{ide:o,sendDaemonCommand:r,onDisconnect:n,onRevokeToken:i},o.id))})}function tv({title:e,message:t,confirmLabel:r,confirmColor:n,onConfirm:i,onCancel:s}){const o=n==="red"?"bg-red-500/20 text-red-400 border-red-500/30 hover:bg-red-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30 hover:bg-amber-500/30";return b0.createPortal(u.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",style:{zIndex:9999},onClick:s,children:u.jsxs("div",{className:"bg-bg-primary border border-border-subtle rounded-xl p-5 max-w-sm w-full mx-4 shadow-2xl",onClick:l=>l.stopPropagation(),children:[u.jsx("div",{className:"font-semibold text-sm mb-3",children:e}),u.jsx("div",{className:"text-xs text-text-muted leading-relaxed mb-5 whitespace-pre-line",children:t}),u.jsxs("div",{className:"flex gap-2 justify-end",children:[u.jsx("button",{onClick:s,className:"text-xs px-3 py-1.5 rounded-lg font-medium bg-bg-secondary text-text-secondary border border-border-subtle hover:bg-bg-glass transition-colors",children:"Cancel"}),u.jsx("button",{onClick:i,className:`text-xs px-3 py-1.5 rounded-lg font-medium border transition-colors ${o}`,children:r})]})]})}),document.body)}function WM({ide:e,sendDaemonCommand:t,onDisconnect:r,onRevokeToken:n}){var q,E,A,R;const[i,s]=b.useState("idle"),[o,l]=b.useState(""),[a,c]=b.useState(null),[d,h]=b.useState("idle"),[f,p]=b.useState(""),m=e,g=m.version||m.daemonVersion||null,S=((q=m.machine)==null?void 0:q.hostname)||((E=m.system)==null?void 0:E.hostname)||"",_=((A=m.machine)==null?void 0:A.platform)||((R=m.system)==null?void 0:R.platform)||"",x=m.machineNickname||(S==null?void 0:S.replace(/\.local$/,""))||"Machine",w=_==="win32"?"🪟":_==="darwin"?"🍎":"🐧",N=async()=>{var T,$,z;if(t){s("upgrading"),l("Installing latest version...");try{const D=await t(e.id,"daemon_upgrade",{});(T=D==null?void 0:D.result)!=null&&T.upgraded||($=D==null?void 0:D.result)!=null&&$.success?(s("done"),l(`Upgraded to v${D.result.version||"latest"}. Daemon is restarting...`)):(s("error"),l(((z=D==null?void 0:D.result)==null?void 0:z.error)||"Upgrade failed"))}catch(D){s("error"),l((D==null?void 0:D.message)||"Connection lost during upgrade")}}},L=async()=>{if(c(null),!!r){h("loading");try{await r(e.id),h("done"),p("Machine disconnected.")}catch(T){h("error"),p((T==null?void 0:T.message)||"Failed to disconnect")}}},C=async()=>{if(c(null),!!n){h("loading");try{await n(e.id),h("done"),p('Token revoked. Machine must run "adhdev setup" to reconnect.')}catch(T){h("error"),p((T==null?void 0:T.message)||"Failed to revoke token")}}},F="0.5.27",P=!g||g!==F;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"bg-bg-glass rounded-lg px-4 py-3 border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("span",{className:"text-xl",children:w}),u.jsxs("div",{children:[u.jsx("div",{className:"font-medium text-sm",children:x}),u.jsxs("div",{className:"text-xs text-text-muted font-mono flex items-center gap-2",children:[u.jsxs("span",{children:[e.id.substring(0,12),"…"]}),g&&u.jsxs("span",{className:`px-1.5 py-0.5 rounded text-[10px] ${P?"bg-amber-500/15 text-amber-400":"bg-bg-secondary"}`,children:["v",g,!P&&" ✓"]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[t&&P&&u.jsx("button",{onClick:N,disabled:i==="upgrading"||i==="done",className:`text-xs px-2.5 py-1 rounded-md font-medium transition-all
|
|
178
178
|
disabled:opacity-50 disabled:cursor-not-allowed
|
|
179
179
|
bg-accent-primary/10 text-accent-primary hover:bg-accent-primary/20`,title:`Update to v${F}`,children:i==="upgrading"?u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx("span",{className:"animate-spin",children:"⟳"})," Upgrading..."]}):i==="done"?"✓ Updated":`↑ Update${` to v${F}`}`}),r&&u.jsx("button",{onClick:()=>c("disconnect"),disabled:d==="loading",className:`text-xs px-2 py-1 rounded-md font-medium transition-all
|
|
180
180
|
bg-amber-500/10 text-amber-400 hover:bg-amber-500/20
|
|
@@ -211,4 +211,4 @@ ${pe}`,_localId:`sys_approval_${Date.now()}`};Y(Pe=>{for(const _e of Object.keys
|
|
|
211
211
|
}
|
|
212
212
|
`})]})}function eI(e){return e.split(":")[0]||""}function tI({renderHeaderActions:e}={}){var Oe,Ve,Ie;const{id:t}=M0(),r=Os(),n=fp(),i=n.ides||[],s=n.connectionStates||{},{sendCommand:o}=gi(),l=b.useMemo(()=>eI(t||""),[t]),a=b.useMemo(()=>i.find(G=>G.id===t),[i,t]),c=(a==null?void 0:a.type)||void 0,d=c?c.charAt(0).toUpperCase()+c.slice(1):"IDE",h=(a==null?void 0:a.activeChat)||null,f=(a==null?void 0:a.agentStreams)||[],p=n.isConnected??!0,m=s[l]||(p?"connected":"new"),g=b.useMemo(()=>i.find(G=>G.id===l||G.daemonId===l),[i,l]),S=(g==null?void 0:g.machineNickname)||((Oe=g==null?void 0:g.machine)==null?void 0:Oe.hostname)||"",_=(a==null?void 0:a.workspace)||"",[x]=A0(),w=typeof window<"u"&&window.innerWidth<=768,N=x.get("view")||(w?"chat":"split"),[L,C]=b.useState(N),[F,P]=b.useState("ide"),[q,E]=b.useState(""),[A,R]=b.useState(!1),[T,$]=b.useState(null),[z,D]=b.useState(null),[H,I]=b.useState([]),W=h==null?void 0:h.status,y=(((Ie=(Ve=h==null?void 0:h.activeModal)==null?void 0:Ve.buttons)==null?void 0:Ie.length)??0)>0,J=W==="generating"||W==="loading"||W&&W.toLowerCase()==="thinking",k=y||W==="waiting_approval"?"waiting_approval":J?"working":W||"idle",we=b.useMemo(()=>{var G,me;return{ideId:t||"",daemonId:l,agentName:Ad(c||""),agentType:c||"",status:k,title:(h==null?void 0:h.title)||"",messages:(h==null?void 0:h.messages)||[],ideType:c||"",workspaceName:(a==null?void 0:a.workspaceName)||"",displayPrimary:d,displaySecondary:(a==null?void 0:a.workspaceName)||"",cdpConnected:!0,modalButtons:(G=h==null?void 0:h.activeModal)==null?void 0:G.buttons,modalMessage:(me=h==null?void 0:h.activeModal)==null?void 0:me.message,streamSource:"native",tabKey:`ide-${t}`}},[t,l,c,h,a,d,k]);b.useEffect(()=>l?dr.onScreenshot("ide-page",(me,Re)=>{if(me!==l)return;const Q=new FileReader;Q.onload=()=>$(Q.result),Q.readAsDataURL(Re)}):void 0,[l]),b.useEffect(()=>l?dr.onStatusEvent((me,Re)=>{if(me!==l)return;let Q="",oe="info";if(Re.event==="agent:generating_completed"?(Q=`✅ Task completed${Re.duration?` (${Re.duration}s)`:""}`,oe="success"):(Re.event==="agent:waiting_approval"||Re.event==="agent:approval_requested")&&(Q="⚡ Approval needed",oe="warning"),Q){const Fe=Date.now();I(Ne=>[...Ne.slice(-4),{id:Fe,message:Q,type:oe}]),setTimeout(()=>I(Ne=>Ne.filter(ze=>ze.id!==Fe)),oe==="warning"?1e4:5e3)}}):void 0,[l]);const U=b.useMemo(()=>{if(!t)return c;const G=t.split(":");return G.length>=3&&G[1]==="ide"?G.slice(2).join(":"):c},[t,c]);b.useEffect(()=>{const G=l?dr.get(l):null;!G||!(m==="connected")||(L!=="chat"&&U?G.startScreenshots(U):G.stopScreenshots(U))},[L,m,U,l]);const Y=b.useCallback(async(G,me={})=>{if(!t)throw new Error("No IDE ID");const Re={...me};if(!Re._targetInstance&&t){const oe=t.split(":");oe.length>=3&&(oe[1]==="ide"||oe[1]==="cli")&&(Re._targetInstance=oe.slice(2).join(":"),Re._targetType=oe[1])}const Q=l?dr.get(l):null;return Q!=null&&Q.hasCommandChannel?await Q.sendCommand(G,Re):Q&&Q.connectionState!=="failed"&&Q.connectionState!=="closed"&&await new Promise(Fe=>{const We=Date.now(),Ne=()=>{if(Q.hasCommandChannel)return Fe(!0);if(Date.now()-We>3e3)return Fe(!1);setTimeout(Ne,200)};Ne()})&&Q.hasCommandChannel?await Q.sendCommand(G,Re):await o(t,G,Re)},[t,l]),te=async()=>{const G=q.trim();if(!(!G||!t||A)){E(""),R(!0);try{await Y("send_chat",{message:G,waitForResponse:!0})}catch(me){console.error("[IDE] Send failed:",me)}finally{R(!1)}}},fe=async G=>{if(t)try{const me=await o(t,"screenshot",{width:G?Math.min(G,1280):1280});me!=null&&me.success&&(me!=null&&me.base64)&&D(`data:image/jpeg;base64,${me.base64}`)}catch(me){console.error("[IDE] Screenshot failed:",me)}},de=f.length>0;return t?u.jsxs("div",{className:"ide-page",children:[u.jsxs("header",{className:"ide-header",children:[u.jsxs("div",{className:"ide-header-left",children:[u.jsxs("div",{className:"ide-title",children:[u.jsx(Xa,{size:16}),u.jsx("span",{className:"ide-name",children:d}),u.jsx("span",{className:"ide-name-mobile",children:"IDE"}),_&&u.jsx("span",{className:"ide-workspace",children:_}),u.jsx("span",{className:"ide-badge",children:"REMOTE"})]}),u.jsxs("div",{className:"ide-status-pill",children:[u.jsx("span",{className:`ide-dot ${m==="connected"?"online":"connecting"}`}),u.jsx("span",{className:"ide-status-text",children:m==="connected"?"Connected":m==="connecting"?"Connecting":"WS"})]}),S&&u.jsx("span",{className:"ide-machine-label",children:S})]}),u.jsxs("div",{className:"ide-header-right",children:[["chat","split","remote"].map(G=>u.jsx("button",{className:"btn btn-secondary btn-sm",style:{border:L===G?"1px solid var(--accent-primary)":"none",background:L===G?"rgba(99,102,241,0.12)":"var(--bg-secondary)",padding:"6px 10px",color:L===G?"var(--accent-primary)":void 0},onClick:()=>C(G),children:G==="chat"?u.jsx(Xa,{size:14}):G==="split"?"⊞":u.jsx(Ro,{size:14})},G)),e&&e({daemonId:l,ideInstanceId:t||""}),u.jsxs("button",{className:"btn btn-primary btn-sm border-none px-3 py-1.5 text-xs flex items-center justify-center shrink-0",onClick:()=>r(-1),children:["←",u.jsx("span",{className:"hidden md:inline ml-1",children:"Back"})]})]})]}),u.jsxs("div",{className:"ide-content",children:[u.jsxs("div",{className:`ide-chat-panel ${L==="chat"?"full":""} ${L==="remote"?"hidden":""}`,children:[de&&u.jsxs("div",{className:"ide-chat-tabs",children:[u.jsx("button",{className:`ide-chat-tab ${F==="ide"?"active":""}`,onClick:()=>P("ide"),children:d}),u.jsxs("button",{className:`ide-chat-tab ext ${F==="extensions"?"active":""}`,onClick:()=>P("extensions"),children:["Extensions ",u.jsx("span",{className:"ide-ext-badge",children:f.length})]})]}),F==="extensions"&&de?u.jsx(iT,{ideId:t,agentStreams:f,sendCommand:async(G,me)=>{try{const Re=l?dr.get(l):null;if(Re&&m==="connected"){await Promise.race([Re.sendCommand(G,me),new Promise((Q,oe)=>setTimeout(()=>oe(new Error("connection timeout")),3e3))]);return}}catch{}await o(t,G,me)}}):u.jsx(W1,{activeConv:we,ides:i,agentInput:q,setAgentInput:E,handleSendChat:te,handleFocusAgent:()=>{},isFocusingAgent:!1,messageReceivedAt:{},actionLogs:[],userName:n.userName})]}),u.jsx("div",{className:`ide-remote-panel ${L==="remote"?"full":""} ${L==="chat"?"hidden":""}`,children:u.jsx(SR,{screenshot:z,isCapturing:!1,onRefresh:fe,addLog:()=>{},connState:m,connScreenshot:T,onAction:async(G,me)=>{const Re=l?dr.get(l):null;if(!Re||m!=="connected")return console.warn("[RemoteInput] P2P not connected"),{success:!1,error:"P2P not connected"};const Q=(a==null?void 0:a.instanceId)||U;return await Re.sendInput(G,me,Q)}})})]}),H.length>0&&u.jsx("div",{className:"ide-toasts",children:H.map(G=>u.jsx("div",{className:`ide-toast ${G.type}`,onClick:()=>I(me=>me.filter(Re=>Re.id!==G.id)),children:G.message},G.id))})]}):u.jsx("div",{className:"ide-empty",children:"No IDE selected"})}function rI(e){const t=Math.floor((Date.now()-e)/1e3);return t<45?"just now":t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function nI(){var _p,vp,xp,yp,bp,wp,Sp,kp,Cp,Ep;const{id:e}=M0(),t=Os(),{sendCommand:r}=gi(),n=r,i=fp(),s=i.ides||[],o=i.initialLoaded??!0,[l,a]=b.useState([]),[c,d]=b.useState([]),[h,f]=b.useState(0),[p,m]=b.useState(!0),[g,S]=b.useState("debug"),[_,x]=b.useState(null),[w,N]=b.useState([]),[L,C]=b.useState(!1),[F,P]=b.useState(""),[q,E]=b.useState(""),[A,R]=b.useState(""),[T,$]=b.useState(""),[z,D]=b.useState(""),[H,I]=b.useState(""),[W,y]=b.useState(""),[J,ae]=b.useState("overview"),[k,we]=b.useState([]),[U,Y]=b.useState(!1),[te,fe]=b.useState(!1),[de,Oe]=b.useState(""),[Ve,Ie]=b.useState([]),[G,me]=b.useState(!1),[Re,Q]=b.useState(null),[oe,Fe]=b.useState("all"),[We,Ne]=b.useState(""),[ze,Te]=b.useState(!1),[qe,Mt]=b.useState({}),[Mr,K]=b.useState(null),[ne,Se]=b.useState(null),Me=b.useRef(null),$e=b.useRef(!1);b.useEffect(()=>{if(!e||J!=="logs"||!p)return;const v=async()=>{try{const ie=await r(e,"get_logs",{count:200,minLevel:g,since:h}),ke=(ie==null?void 0:ie.result)||ie;if(ie!=null&&ie.success&&Array.isArray(ke==null?void 0:ke.logs)&&ke.logs.length>0){d(yr=>[...yr,...ke.logs.map(Kr=>({timestamp:Kr.ts,level:Kr.level,message:`[${Kr.category}] ${Kr.message}`}))].slice(-300));const Ge=Math.max(...ke.logs.map(yr=>yr.ts));f(Ge)}}catch{}};v();const B=setInterval(v,3e3);return()=>clearInterval(B)},[e,J,p,h,g]),b.useEffect(()=>{if(p&&c.length>0){const v=$e.current?"smooth":"instant";setTimeout(()=>{var B;(B=Me.current)==null||B.scrollIntoView({behavior:v}),$e.current=!0},50)}},[c.length,l.length,p]),b.useEffect(()=>{J!=="logs"&&($e.current=!1)},[J]),b.useEffect(()=>{if(!e||J!=="ides")return;(async()=>{try{const B=await r(e,"get_ide_extensions",{}),ie=(B==null?void 0:B.result)||B;ie!=null&&ie.success&&(ie!=null&&ie.ides)&&Mt(ie.ides)}catch{}})()},[e,J]);const ft=async()=>{var v;if(e){me(!0);try{const B=await r(e,"get_provider_settings",{}),ie=(B==null?void 0:B.result)||B;if(B!=null&&B.success&&(ie!=null&&ie.settings)){const ke=[];for(const[Ge,yr]of Object.entries(ie.settings)){const cr=ue.find(Kr=>Kr.type===Ge);ke.push({type:Ge,displayName:(cr==null?void 0:cr.displayName)||Ge,icon:(cr==null?void 0:cr.icon)||"",category:(cr==null?void 0:cr.category)||"unknown",schema:yr,values:((v=ie.values)==null?void 0:v[Ge])||{}})}ke.sort((Ge,yr)=>Ge.category.localeCompare(yr.category)||Ge.displayName.localeCompare(yr.displayName)),Ie(ke)}}catch{}me(!1)}};b.useEffect(()=>{J==="providers"&&Ve.length===0&&ft()},[J]);const It=async(v,B,ie)=>{Q(`${v}.${B}`),Ie(ke=>ke.map(Ge=>Ge.type===v?{...Ge,values:{...Ge.values,[B]:ie}}:Ge));try{const ke=await r(e,"set_provider_setting",{providerType:v,key:B,value:ie});ke!=null&&ke.success||ft()}catch{ft()}Q(null)},Ee=s.find(v=>v.id===e&&v.daemonMode),O=Ee?{id:Ee.id,hostname:((_p=Ee.machine)==null?void 0:_p.hostname)||Ee.id,platform:((vp=Ee.machine)==null?void 0:vp.platform)||"unknown",arch:((xp=Ee.machine)==null?void 0:xp.arch)||"",cpus:((yp=Ee.machine)==null?void 0:yp.cpus)||0,totalMem:((bp=Ee.machine)==null?void 0:bp.totalMem)||0,freeMem:((wp=Ee.machine)==null?void 0:wp.freeMem)||0,availableMem:(Sp=Ee.machine)==null?void 0:Sp.availableMem,loadavg:((kp=Ee.machine)==null?void 0:kp.loadavg)||[],uptime:((Cp=Ee.machine)==null?void 0:Cp.uptime)||0,release:((Ep=Ee.machine)==null?void 0:Ep.release)||"",cdpConnected:!!(Ee.ides||[]).some(v=>v.cdpConnected),machineNickname:Ee.machineNickname||null,p2p:Ee.p2p||{available:!1,state:"unavailable",peers:0,screenshotActive:!1},detectedIdes:Ee.detectedIdes||[],managedIdeIds:Ee.managedIdeIds||[],managedCliIds:Ee.managedCliIds||[],workspaces:Ee.workspaces||[],defaultWorkspaceId:Ee.defaultWorkspaceId??Ee.activeWorkspaceId??null,defaultWorkspacePath:Ee.defaultWorkspacePath??Ee.activeWorkspacePath??null,workspaceActivity:Ee.workspaceActivity||[]}:null,ue=(Ee==null?void 0:Ee.availableProviders)||[],M={};for(const v of ue)M[v.type]=v.icon;const j=v=>M[v]||"",V=ue.filter(v=>v.category==="cli"),X=ue.filter(v=>v.category==="acp");b.useEffect(()=>{!A&&V.length>0&&R(V[0].type)},[A,V.length]),b.useEffect(()=>{!T&&X.length>0&&$(X[0].type)},[T,X.length]);const he=s.filter(v=>v.daemonId===e&&!v.daemonMode).filter(v=>!H_(v)&&!U_(v)).map(v=>({id:v.id,type:v.type,version:v.version||"",instanceId:v.instanceId||"",status:v.status,workspace:v.workspace||null,terminals:v.terminals||0,aiAgents:LR(v.aiAgents||v.agents||[]),activeChat:v.activeChat||null,chats:v.chats||[],agentStreams:v.agentStreams||[],cdpConnected:v.cdpConnected||!1,daemonId:e})),ce=s.filter(v=>v.daemonId===e&&H_(v)).map(v=>({id:v.id,type:v.type,cliName:v.cliName||v.type,status:v.status,workspace:v.workspace||"",activeChat:v.activeChat||null,daemonId:e})),ve=s.filter(v=>v.daemonId===e&&U_(v)).map(v=>({id:v.id,type:v.type,acpName:v.cliName||v.type,status:v.status,workspace:v.workspace||"",activeChat:v.activeChat||null,currentModel:v.currentModel,currentPlan:v.currentPlan,daemonId:e})),pe=(O==null?void 0:O.detectedIdes)||[],le=(v,B)=>{a(ie=>[...ie.slice(-100),{timestamp:Date.now(),level:v,message:B}]),setTimeout(()=>{var ie;return(ie=Me.current)==null?void 0:ie.scrollIntoView({behavior:"smooth"})},100)},Pe=async v=>{if(!(!e||_)){x(v),le("info",`Launching ${Ar(v)}...`);try{const B=await r(e,"launch_ide",{ideType:v,enableCdp:!0});le(B!=null&&B.success?"info":"error",B!=null&&B.success?`${Ar(v)} launched`:`Failed: ${B==null?void 0:B.error}`)}catch(B){le("error",`Launch error: ${B.message}`)}finally{x(null)}}},_e=async v=>{if(!e)return;const{cliType:B,dir:ie,workspaceId:ke,useDefaultWorkspace:Ge,useHome:yr,argsStr:cr,model:Kr}=v;if(!B){le("warn","Select a CLI or ACP provider first");return}const fb=cr?cr.split(/\s+/).filter(Boolean):void 0,Np=(ie==null?void 0:ie.trim())||(ke?"(saved id)":Ge?"(default workspace)":yr?"(home)":"");le("info",`Launching ${B}${Np?` in ${Np}`:""}${Kr?` (model: ${Kr})`:""}...`);try{const xi={cliType:B,cliArgs:fb,initialModel:Kr||void 0};ie!=null&&ie.trim()?xi.dir=ie.trim():ke?xi.workspaceId=ke:Ge?xi.useDefaultWorkspace=!0:yr&&(xi.useHome=!0);const br=await r(e,"launch_cli",xi),_n=(br==null?void 0:br.result)||br;br!=null&&br.success?(le("info",`${B} launched`),(_n==null?void 0:_n.launchSource)==="home"?le("info","📂 Running in home directory (explicit choice)"):(_n==null?void 0:_n.launchSource)==="defaultWorkspace"&&le("info","📂 Using default workspace (explicit choice)")):(le("error",`Failed: ${(br==null?void 0:br.error)||(_n==null?void 0:_n.error)}`),(br==null?void 0:br.code)==="WORKSPACE_LAUNCH_CONTEXT_REQUIRED"&&Se({cliType:B,argsStr:cr,model:Kr}))}catch(xi){le("error",`Launch error: ${xi.message}`)}},Ye=(v,B,ie,ke)=>{if(e){if(!v){le("warn","Select a provider");return}if(!B.trim()){Se({cliType:v,argsStr:ie,model:ke});return}_e({cliType:v,dir:B,argsStr:ie,model:ke})}},pt=async(v,B,ie)=>{if(e&&window.confirm(`Stop ${v}?
|
|
213
213
|
This will terminate the process.`))try{const ke=await r(e,"stop_cli",{cliType:v,dir:B,_targetInstance:ie});ke!=null&&ke.success?le("info",`${v} stopped`):le("error",`Stop failed: ${(ke==null?void 0:ke.error)||"Unknown error"}`)}catch(ke){le("error",`Stop failed: ${ke.message}`)}},Ct=async v=>{try{await r(v.daemonId,"restart_ide",{ideType:v.type}),le("info",`${Ar(v.type)} restart initiated`)}catch(B){le("error",`Restart failed: ${B.message}`)}},ar=async v=>{if(window.confirm(`Stop ${Ar(v.type)}?
|
|
214
|
-
This will disconnect CDP and optionally kill the process.`))try{const B=await r(v.daemonId,"stop_ide",{ideType:v.type,killProcess:!0});B!=null&&B.success?le("info",`${Ar(v.type)} stopped`):le("error",`Stop failed: ${(B==null?void 0:B.error)||"Unknown error"}`)}catch(B){le("error",`Stop failed: ${B.message}`)}},Zt=async()=>{if(e)try{const v=await r(e,"detect_ides",{});le("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){le("error",`Detection failed: ${v.message}`)}},xr=async()=>{if(e){C(!0);try{const v=await r(e,"get_recent_workspaces",{});v!=null&&v.success&&Array.isArray(v==null?void 0:v.result)&&N(v.result)}catch(v){le("error",`Failed: ${v.message}`)}finally{C(!1)}}},Ji=async()=>{if(!(!e||!We.trim())){Te(!0);try{const v=await r(e,"workspace_add",{path:We.trim()});v!=null&&v.success?(le("info",`Workspace added: ${We.trim()}`),Ne("")):le("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){le("error",v.message)}finally{Te(!1)}}},Mc=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){Te(!0);try{const B=await r(e,"workspace_remove",{id:v});B!=null&&B.success?le("info","Workspace removed"):le("error",(B==null?void 0:B.error)||"workspace_remove failed")}catch(B){le("error",B.message)}finally{Te(!1)}}},Ic=async v=>{if(e){Te(!0);try{const B=await r(e,"workspace_set_default",v===null?{clear:!0}:{id:v});if(B!=null&&B.success){le("info",v?"Default workspace updated":"Default workspace cleared");const ie=typeof B.defaultWorkspacePath=="string"?B.defaultWorkspacePath:"";ie&&(P(ie),D(ie))}else le("error",(B==null?void 0:B.error)||"workspace_set_default failed")}catch(B){le("error",B.message)}finally{Te(!1)}}},Dc=async v=>{if(!e||!v.trim())return;const B=v.trim();Te(!0);try{const ie=await r(e,"workspace_set_default",{path:B});ie!=null&&ie.success?(le("info","Default workspace set from history"),P(B),D(B)):le("error",(ie==null?void 0:ie.error)||"Could not set default (path missing on disk?)")}catch(ie){le("error",ie.message)}finally{Te(!1)}},On=b.useCallback(async()=>{var v;if(e){Y(!0);try{let B=await r(e,"get_cli_history",{});B!=null&&B.success||(B=await n(e,"get_cli_history"));const ie=(B==null?void 0:B.history)??((v=B==null?void 0:B.result)==null?void 0:v.history);B!=null&&B.success&&Array.isArray(ie)&&we(ie)}catch{}Y(!1)}},[e,r,n]);b.useEffect(()=>{J==="overview"&&e&&On()},[J,e,On]);const pp=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:de}),le("info",`Nickname set to "${de||"(cleared)"}"`),fe(!1)}catch(v){le("error",`Failed: ${v.message}`)}};if(!O)return o?u.jsxs("div",{className:"p-10 text-center text-text-muted",children:[u.jsx("h2",{className:"text-text-primary",children:"Machine not found"}),u.jsx("p",{className:"mt-3",children:"The machine may be offline or not yet connected."}),u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):u.jsx("div",{className:"p-10 text-center text-text-muted",children:u.jsx("p",{children:"⏳ Loading machine..."})});const mp=O.availableMem??O.freeMem,cb=O.totalMem>0?Math.min(100,Math.max(0,Math.round((O.totalMem-mp)/O.totalMem*100))):0,gp=O.loadavg[0]||0,ub=O.machineNickname||O.hostname,hb=(v,B,ie)=>{const ke=ue.find(yr=>yr.type===v),Ge=(ie||[]).join(" ");(ke==null?void 0:ke.category)==="acp"?($(v),D(B),y(Ge),ae("acps")):(R(v),P(B),E(Ge),ae("clis"))},db=[{id:"overview",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(YP,{size:14})," Overview"]})},{id:"ides",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Ro,{size:14})," IDEs"]}),count:he.length},{id:"clis",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Yy,{size:14})," CLIs"]}),count:ce.length},{id:"acps",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(QP,{size:14})," ACP Agents"]}),count:ve.length},{id:"providers",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Ky,{size:14})," Providers"]}),count:Ve.length>0?Ve.length:void 0},{id:"logs",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(WP,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsxs("div",{className:"dashboard-header !flex-col !items-stretch",children:[u.jsx("div",{className:"flex items-center justify-between w-full",children:u.jsxs("div",{className:"flex items-center gap-2 md:gap-3.5 w-full min-w-0",children:[u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back flex shrink-0",children:"←"}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[te?u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsx("input",{autoFocus:!0,value:de,onChange:v=>Oe(v.target.value),onKeyDown:v=>{v.key==="Enter"&&pp(),v.key==="Escape"&&fe(!1)},placeholder:"Machine nickname...",className:"px-2.5 py-1 rounded-md border border-violet-500/30 bg-bg-secondary text-text-primary text-sm font-semibold w-[140px] md:w-[200px]"}),u.jsx("button",{onClick:pp,className:"machine-btn text-green-500 border-green-500/30 shrink-0",children:"✓"}),u.jsx("button",{onClick:()=>fe(!1),className:"machine-btn shrink-0",children:"✕"})]}):u.jsx("h1",{className:"header-title cursor-pointer truncate",onClick:()=>{fe(!0),Oe(O.machineNickname||"")},title:"Click to set nickname",children:ub}),u.jsx("span",{className:"status-dot-md online shrink-0"})]}),u.jsxs("div",{className:"header-subtitle mt-1 flex-wrap gap-1 md:gap-2 items-center display-none-mobile",children:[u.jsxs("span",{children:[O.platform," · ",O.arch," · ",O.cpus," cores"]}),O.p2p.available&&u.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:O.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:O.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",O.p2p.state==="connected"?`● ${O.p2p.peers}`:"○"]}),O.cdpConnected&&u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500 shrink-0",children:"CDP ●"}),O.machineNickname&&u.jsxs("span",{className:"text-text-muted opacity-80 shrink-0",children:["(",O.hostname,")"]})]})]})]})}),u.jsx("div",{className:"machine-tabs w-full overflow-x-auto overflow-y-hidden pb-1 -mb-1 mt-2",children:db.map(v=>u.jsxs("button",{onClick:()=>ae(v.id),className:`machine-tab shrink-0${J===v.id?" active":""}`,children:[v.label,v.count!==void 0&&u.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),u.jsxs("div",{className:"page-content",children:[J==="overview"&&u.jsxs("div",{children:[u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[u.jsx($_,{icon:u.jsx(Ug,{size:16}),label:"Uptime",value:TR(O.uptime)}),u.jsx($_,{icon:u.jsx(Ro,{size:16}),label:"IDEs",value:`${he.length}`,sub:`${ce.length} CLIs`})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),u.jsxs("div",{className:"flex gap-6",children:[u.jsx(F_,{value:Math.min(Math.round(gp/O.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${gp.toFixed(2)} avg / ${O.cpus} cores`}),u.jsx(F_,{value:cb,max:100,label:"Memory",color:"#3b82f6",detail:`${W_(O.totalMem-mp)} / ${W_(O.totalMem)}${O.platform==="darwin"?" (approx.)":""}`})]})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," Workspaces"]})}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:["One list for IDE, CLI, and ACP: saved paths below, and a single ",u.jsx("strong",{className:"text-text-secondary font-medium",children:"default"}),'. The default opens in the IDE when you launch it, pre-fills CLI/ACP directories, and is what "Default" launch uses.']}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-3",children:[u.jsx("span",{className:"text-[10px] text-text-muted",children:"Default:"}),u.jsxs("select",{className:"text-xs bg-bg-primary border border-border-subtle rounded-lg px-2 py-1 max-w-[min(100%,420px)]",disabled:ze,value:O.defaultWorkspaceId||"",onChange:v=>{const B=v.target.value;Ic(B===""?null:B)},children:[u.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(O.workspaces||[]).map(v=>u.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),O.defaultWorkspacePath&&u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:O.defaultWorkspacePath,children:O.defaultWorkspacePath})]}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[u.jsx("input",{className:"flex-1 min-w-[200px] text-xs bg-bg-primary border border-border-subtle rounded-lg px-2.5 py-1.5",placeholder:"Absolute workspace path to add…",value:We,disabled:ze,onChange:v=>Ne(v.target.value),onKeyDown:v=>v.key==="Enter"&&void Ji()}),u.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:ze,onClick:()=>void Ji(),children:"Add"})]}),(O.workspaces||[]).length>0&&u.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(O.workspaces||[]).map(v=>u.jsxs("li",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[u.jsx("span",{className:"font-mono truncate flex-1",title:v.path,children:v.path}),u.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:ze,onClick:()=>void Mc(v.id),children:"Remove"})]},v.id))})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle border-violet-500/15",children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1 flex items-center gap-1.5",children:[u.jsx(Ug,{size:14})," Pick up where you left off"]}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:"Same workspaces as above. Re-run CLI/ACP, or open CLIs/ACP tab with a path filled; IDE launch uses the default automatically when set."}),u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent CLI / ACP launches"}),k.length>0?u.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:k.slice(0,10).map((v,B)=>{const ie=v.label||`${v.cliType} · ${(v.dir||"").split("/").filter(Boolean).pop()||v.dir||"?"}`;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsxs("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,240px)]",title:v.dir,children:[j(v.cliType)," ",ie]}),u.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:v.dir,children:v.dir}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void _e({cliType:v.cliType,dir:v.dir,argsStr:(v.cliArgs||[]).join(" ")}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>hb(v.cliType,v.dir,v.cliArgs),children:"Open tab…"})]})]},`${v.cliType}-${v.dir}-${v.timestamp}-${B}`)})}):u.jsx("p",{className:"text-[11px] text-text-muted mb-4",children:"No launch history yet — start a CLI or ACP from the tabs below, then return here."}),(O.workspaceActivity||[]).length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent workspace paths"}),u.jsx("div",{className:"flex flex-col gap-1.5",children:(O.workspaceActivity||[]).slice(0,12).map(v=>{const B=v.path.split("/").filter(Boolean).pop()||v.path,ie=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="default"||v.kind==="active"?"●":"",ke=(v.kind==="cli"||v.kind==="acp")&&!!v.agentType;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsx("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,200px)]",title:v.path,children:B}),ie&&u.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:ie}),v.agentType&&u.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),u.jsx("span",{className:"text-[9px] text-text-muted",children:rI(v.lastUsedAt)}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[ke&&u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void _e({cliType:v.agentType,dir:v.path}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{P(v.path),D(v.path),ae("clis")},children:"CLIs tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{P(v.path),D(v.path),ae("acps")},children:"ACP tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:ze,onClick:()=>void Dc(v.path),children:"Set default"})]})]},`${v.path}-${v.lastUsedAt}`)})})]})]}),u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"IDEs"}),u.jsx("button",{onClick:()=>ae("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),he.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No IDEs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:he.map(v=>{var ie;const B=(v.agentStreams||[]).some(ke=>ke.status==="generating"||ke.status==="streaming")||((ie=v.activeChat)==null?void 0:ie.status)==="generating";return u.jsxs("div",{onClick:()=>t(`/ide/${v.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${B?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[u.jsx("span",{children:j(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:Ar(v.type)}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace||""}),B&&u.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),u.jsx("span",{className:`${B?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:B?"#fb923c":"#22c55e",boxShadow:B?"0 0 8px rgba(249,115,22,0.4)":"none",animation:B?"pulse-dot 1.5s infinite":"none"}})]},v.id)})})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"CLIs"}),u.jsx("button",{onClick:()=>ae("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),ce.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:ce.map(v=>u.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-glass",children:[u.jsx("span",{children:j(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace.split("/").pop()}),u.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),O.detectedIdes.length>0&&u.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),u.jsx("div",{className:"flex flex-wrap gap-1.5",children:O.detectedIdes.map(v=>u.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${v.running?"bg-green-500/[0.06] border border-green-500/[0.12] text-green-300":"bg-bg-glass border border-border-subtle text-text-muted"}`,children:[u.jsx("span",{children:j(v.type)}),v.name||v.type,u.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),J==="ides"&&u.jsxs("div",{children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",he.length,")"]}),he.length===0?u.jsx("div",{className:"py-10 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No IDEs currently running. Launch one below."}):u.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:he.map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsx("span",{className:"font-semibold text-sm text-text-primary",children:Ar(v.type)}),v.version&&u.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.version]}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),u.jsxs("div",{className:"flex gap-1.5",children:[u.jsxs("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[u.jsx(Ro,{size:13})," Control"]}),u.jsx("button",{onClick:()=>Ct(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"}),u.jsx("button",{onClick:()=>ar(v),className:"machine-btn text-red-400 border-red-500/30",children:"■ Stop"})]})]}),u.jsxs("div",{className:"text-xs text-text-secondary mb-2",children:[u.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",v.workspace||"—"]}),v.aiAgents.length>0&&u.jsx("div",{className:"flex gap-1 mb-2 flex-wrap",children:v.aiAgents.map(B=>u.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${B.status==="generating"||B.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[B.name," · ",B.status]},B.id))}),(qe[v.type]||[]).length>0&&u.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:[u.jsx("div",{className:"text-[10px] text-text-muted font-semibold uppercase tracking-wider mb-1.5",children:"Extensions"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:(qe[v.type]||[]).map(B=>u.jsxs("button",{disabled:Mr===`${v.type}.${B.type}`,onClick:async()=>{const ie=`${v.type}.${B.type}`;K(ie);try{await r(e,"set_ide_extension",{ideType:v.type,extensionType:B.type,enabled:!B.enabled}),Mt(ke=>({...ke,[v.type]:(ke[v.type]||[]).map(Ge=>Ge.type===B.type?{...Ge,enabled:!Ge.enabled}:Ge)}))}catch(ke){console.error("Extension toggle failed:",ke)}finally{K(null)}},className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-medium border transition-colors duration-150 cursor-pointer ${B.enabled?"bg-violet-500/[0.08] border-violet-500/20 text-violet-400":"bg-bg-glass border-border-subtle text-text-muted"}`,children:[u.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${B.enabled?"bg-violet-400 shadow-[0_0_4px_rgba(139,92,246,0.4)]":"bg-zinc-600"}`}),B.name,u.jsx("span",{className:"text-[9px] font-normal",children:B.enabled?"ON":"OFF"})]},B.type))})]})]},v.id))}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",pe.length,")"]}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:[O.defaultWorkspacePath?`Opens in default workspace: ${O.defaultWorkspacePath.split("/").filter(Boolean).pop()||O.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."," ","Multi-window supported — running IDEs can be launched again as a new window."]}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[pe.map(v=>{const B=v.running||he.some(ie=>(ie.type||"").toLowerCase()===(v.type||"").toLowerCase());return u.jsxs("button",{onClick:()=>Pe(v.type||v.id||""),disabled:!!_,className:`machine-btn-primary flex items-center gap-1.5 ${B?"!border-green-500/30":""}`,style:{opacity:_&&_!==v.type?.4:1},children:[u.jsx("span",{children:j(v.type)}),B&&u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_4px_rgba(34,197,94,0.4)]"}),_===v.type?"⏳ Launching...":`▶ ${v.name||Ar(v.type)}`,B&&u.jsx("span",{className:"text-[9px] text-green-400 font-normal",children:"+ window"})]},v.type)}),pe.length===0&&u.jsxs("div",{className:"text-xs text-text-muted italic",children:["No IDEs detected.",u.jsxs("button",{onClick:Zt,className:"machine-btn ml-2 flex items-center gap-1",children:[u.jsx(VP,{size:12})," Scan"]})]})]})]}),J==="clis"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch New CLI"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:A,onChange:v=>R(v.target.value),className:"machine-input",children:V.length>0?V.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:F,onChange:v=>P(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:q,onChange:v=>E(v.target.value),className:"machine-input min-w-[150px]"}),u.jsx("button",{onClick:()=>Ye(A,F,q||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(O!=null&&O.defaultWorkspacePath),title:O!=null&&O.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void _e({cliType:A,useDefaultWorkspace:!0,argsStr:q||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void _e({cliType:A,useHome:!0,argsStr:q||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ce.length,")"]}),ce.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:ce.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),u.jsx("div",{className:"text-[11px] text-text-muted",children:v.workspace})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),v.status==="stopped"?u.jsx("button",{onClick:()=>Ye(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"History"}),u.jsx("button",{onClick:On,disabled:U,className:"machine-btn",children:U?"⏳":"↻ Load"})]}),k.length>0&&u.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,B)=>{var ie,ke;return u.jsxs("div",{onClick:()=>{R(v.cliType),P(v.dir),E((v.cliArgs||[]).join(" "))},className:"flex justify-between items-center px-2.5 py-1.5 rounded-md cursor-pointer bg-bg-glass border border-border-subtle text-xs transition-[background] duration-150",onMouseEnter:Ge=>Ge.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:Ge=>Ge.currentTarget.style.background="var(--bg-glass)",children:[u.jsxs("div",{className:"flex gap-1.5 items-center text-text-secondary",children:[u.jsx("span",{children:j(v.cliType)}),u.jsx("span",{children:((ie=v.dir)==null?void 0:ie.split("/").filter(Boolean).pop())||"root"}),((ke=v.cliArgs)==null?void 0:ke.length)>0&&u.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),u.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},B)})}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:L,className:"machine-btn",children:L?"⏳":"↻ Load"})]}),w.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((v,B)=>u.jsx("button",{onClick:()=>P(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Mo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),J==="acps"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch ACP Agent"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:T,onChange:v=>$(v.target.value),className:"machine-input",children:X.length>0?X.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or picker / Default / Home)",value:z,onChange:v=>D(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Model (default)",value:H,onChange:v=>I(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:W,onChange:v=>y(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("button",{onClick:()=>Ye(T,z,W||void 0,H||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(O!=null&&O.defaultWorkspacePath),title:O!=null&&O.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void _e({cliType:T,useDefaultWorkspace:!0,argsStr:W||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void _e({cliType:T,useHome:!0,argsStr:W||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ve.length,")"]}),ve.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No ACP agents running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:ve.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),u.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[u.jsx("span",{children:v.workspace}),v.currentModel&&u.jsxs("span",{className:"text-cyan-500",children:["🤖 ",v.currentModel]}),v.currentPlan&&u.jsxs("span",{className:"text-amber-500",children:["📋 ",v.currentPlan]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":v.status==="generating"?"bg-orange-500/[0.08] text-orange-400":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),u.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:u.jsx(Xa,{size:14})}),v.status==="stopped"?u.jsx("button",{onClick:()=>Ye(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:L,className:"machine-btn",children:L?"⏳":"↻ Load"})]}),w.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((v,B)=>u.jsx("button",{onClick:()=>D(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Mo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),J==="providers"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-4",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(v=>u.jsx("button",{onClick:()=>Fe(v),className:`machine-btn text-[10px] px-2 py-0.5 ${oe===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsx("button",{onClick:ft,disabled:G,className:"machine-btn",children:G?"⏳ Loading...":"↻ Refresh"})]}),G&&Ve.length===0?u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading provider settings..."}):u.jsx("div",{className:"flex flex-col gap-2",children:Ve.filter(v=>oe==="all"||v.category===oe).map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-lg",children:v.icon}),u.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:v.category==="acp"?"rgba(139,92,246,0.08)":v.category==="cli"?"rgba(59,130,246,0.08)":v.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:v.category==="acp"?"#a78bfa":v.category==="cli"?"#60a5fa":v.category==="ide"?"#86efac":"#fbbf24"},children:v.category})]}),u.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(B=>u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"text-xs font-medium text-text-primary",children:[B.label||B.key,Re===`${v.type}.${B.key}`&&u.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),B.description&&u.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:B.description})]}),u.jsx("div",{className:"shrink-0",children:B.type==="boolean"?u.jsx("button",{onClick:()=>It(v.type,B.key,!(v.values[B.key]??B.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[B.key]??B.default?"#8b5cf6":"var(--border-subtle)"},children:u.jsx("div",{className:"w-4 h-4 rounded-full bg-white absolute top-[3px] transition-[left] duration-200 shadow-[0_1px_3px_rgba(0,0,0,0.3)]",style:{left:v.values[B.key]??B.default?21:3}})}):B.type==="number"?u.jsx("input",{type:"number",value:v.values[B.key]??B.default??0,min:B.min,max:B.max,onChange:ie=>{const ke=parseInt(ie.target.value)||0;B.min!==void 0&&ke<B.min||B.max!==void 0&&ke>B.max||It(v.type,B.key,ke)},className:"machine-input w-20 text-center text-[11px]"}):B.type==="select"&&B.options?u.jsx("select",{value:v.values[B.key]??B.default??"",onChange:ie=>It(v.type,B.key,ie.target.value),className:"machine-input text-[11px]",children:B.options.map(ie=>u.jsx("option",{value:ie,children:ie},ie))}):u.jsx("input",{type:"text",value:v.values[B.key]??B.default??"",onBlur:ie=>It(v.type,B.key,ie.target.value),className:"machine-input w-[120px] text-[11px]"})})]},B.key))})]},v.type))})]}),J==="logs"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-3",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(v=>u.jsx("button",{onClick:()=>{S(v),d([]),f(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${g===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),u.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"⏸ Pause":"▶ Resume"}),u.jsx("button",{onClick:()=>{d([]),f(0)},className:"machine-btn",children:"Clear"})]})]}),u.jsxs("div",{className:"bg-bg-secondary border border-border-subtle rounded-xl p-3 min-h-[200px] max-h-[500px] overflow-y-auto font-mono text-[11px] leading-relaxed",children:[c.length===0&&u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,B)=>u.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[u.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),u.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#475569":"#8b5cf6"},children:v.level==="error"?"ERR":v.level==="warn"?"WRN":v.level==="debug"?"DBG":"INF"}),u.jsx("span",{children:v.message})]},B)),u.jsx("div",{ref:Me})]})]})]}),ne&&O&&u.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/55 backdrop-blur-[2px]",role:"dialog","aria-modal":"true","aria-labelledby":"launch-pick-title",children:u.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border-subtle bg-bg-secondary shadow-xl p-5",children:[u.jsx("h2",{id:"launch-pick-title",className:"text-sm font-semibold text-text-primary m-0 mb-1",children:"Where should this run?"}),u.jsx("p",{className:"text-[11px] text-text-muted m-0 mb-4",children:"Nothing is assumed. Pick a saved workspace, your default workspace, or home — or cancel and type a path."}),u.jsx("div",{className:"flex flex-col gap-2 mb-4 max-h-48 overflow-y-auto",children:(O.workspaces||[]).length===0?u.jsx("span",{className:"text-[11px] text-text-muted",children:"No saved workspaces yet. Add one in Overview or type a path above."}):(O.workspaces||[]).map(v=>u.jsxs("button",{type:"button",className:"text-left text-xs px-3 py-2 rounded-lg border border-border-subtle bg-bg-primary hover:bg-violet-500/[0.08] transition-colors",onClick:()=>{const B=ne;Se(null),_e({cliType:B.cliType,workspaceId:v.id,argsStr:B.argsStr,model:B.model})},children:[u.jsx("span",{className:"font-medium text-text-primary block truncate",children:v.label||v.path}),u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:v.path})]},v.id))}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",disabled:!O.defaultWorkspacePath,onClick:()=>{const v=ne;Se(null),_e({cliType:v.cliType,useDefaultWorkspace:!0,argsStr:v.argsStr,model:v.model})},children:"Default workspace"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{const v=ne;Se(null),_e({cliType:v.cliType,useHome:!0,argsStr:v.argsStr,model:v.model})},children:"Home directory"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>Se(null),children:"Cancel"})]})]})})]})}function iI(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new URLSearchParams(window.location.search).get("token");return n?`${t}?token=${encodeURIComponent(n)}`:t}const rv=iI(),nv=3e3,sI=3e4;let Sn=null,oI=0;const nc=new Map,Od=new Set;let ki=null;async function xa(e,t,r){const n=Sn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++oI}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{nc.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);nc.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),n.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:r||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:r||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class lI{constructor(t){Hs(this,"daemonId");Hs(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN}get connectionState(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return xa(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId;return xa(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ki&&(clearInterval(ki),ki=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId,i=await xa(n,"screenshot",{width:1280});if(i!=null&&i.success&&(i!=null&&i.base64)){const s=await fetch(`data:image/jpeg;base64,${i.base64}`).then(o=>o.blob());Od.forEach(o=>o(this.daemonId,s))}}catch{}};r(),ki=setInterval(r,2e3)}stopScreenshots(t){ki&&(clearInterval(ki),ki=null)}}let Ci=null;function aI(e){(!Ci||Ci.daemonId!==e)&&(Ci=new lI(e));const t=dr._originalGet||dr.get.bind(dr);dr._originalGet=t,dr.get=r=>r===e||r.startsWith("standalone")?Ci:t(r),dr.getState=r=>(r===e||r.startsWith("standalone"))&&(Ci==null?void 0:Ci.connectionState)||"disconnected",dr.onScreenshot=(r,n)=>(Od.add(n),()=>{Od.delete(n)})}function cI({children:e}){const t=b.useRef(Km()),r=Km();t.current=r;const{setUserName:n}=Zo(),i=b.useRef(n);i.current=n;const[,s]=b.useState("disconnected"),o=b.useRef(null),l=b.useRef(),a=b.useRef(nv),c=b.useRef(!0);return b.useEffect(()=>{c.current=!0;function d(){var p,m;if(!c.current||((p=o.current)==null?void 0:p.readyState)===WebSocket.OPEN||((m=o.current)==null?void 0:m.readyState)===WebSocket.CONNECTING)return;s("connecting"),console.log(`[Standalone WS] Connecting to ${rv}...`);let f;try{f=new WebSocket(rv)}catch(g){console.error("[Standalone WS] Failed to create WebSocket:",g),h();return}o.current=f,f.onopen=()=>{if(!c.current){f.close();return}s("connected"),a.current=nv,console.log("[Standalone WS] Connected")},Sn=f,f.onmessage=g=>{var S;try{const _=JSON.parse(g.data);if((_.type==="command_result"||_.type==="error")&&_.requestId){const x=nc.get(_.requestId);x&&(nc.delete(_.requestId),_.type==="error"?x.reject(new Error(((S=_.data)==null?void 0:S.message)||"Command failed")):x.resolve(_.data));return}if(_.type==="status"||_.type==="initial_state"){const x=_.data;if(!x)return;const{injectEntries:w,markLoaded:N}=t.current,L=x.id||"standalone";aI(L);const C=AR(x,{daemonId:L});C.length>0&&w(C),N(),x.userName&&i.current&&i.current(x.userName)}}catch(_){console.error("[Standalone WS] Parse error:",_)}},f.onclose=()=>{c.current&&(s("disconnected"),o.current=null,h())},f.onerror=g=>{console.warn("[Standalone WS] Error, will reconnect:",g)}}function h(){if(!c.current)return;clearTimeout(l.current);const f=a.current;console.log(`[Standalone WS] Reconnecting in ${f}ms...`),l.current=setTimeout(()=>{a.current=Math.min(a.current*1.5,sI),d()},f)}return d(),()=>{c.current=!1,clearTimeout(l.current),o.current&&(o.current.onclose=null,o.current.close(),o.current=null,Sn=null)}},[]),u.jsx(u.Fragment,{children:e})}function uI({children:e}){return u.jsx(zk,{children:u.jsx(cI,{children:e})})}const hI=[{id:"dashboard",path:"/dashboard",icon:u.jsx($P,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:u.jsx(FP,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:u.jsx(Ky,{}),label:"Settings"}];function dI({children:e}){const t=Os(),r=fl(),[n,i]=b.useState(!1),[s,o]=b.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),l=d=>{t(d),i(!1)},a=()=>{o(d=>{const h=!d;try{localStorage.setItem("sidebar-collapsed",h?"1":"0")}catch{}return h})},c=d=>`nav-item${r.pathname.startsWith(d)?" active":""} cursor-pointer ${s?"justify-center py-2.5 px-0":""}`;return u.jsxs("div",{className:`app-layout${n?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"})]}),n&&u.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:d=>d.key==="Escape"&&i(!1)}),u.jsxs("aside",{className:`sidebar ${n?"sidebar-open":""}`,children:[u.jsxs("div",{className:"sidebar-header",children:[u.jsxs("div",{className:`sidebar-logo ${s?"justify-center gap-0":""}`,children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!s&&u.jsx("span",{children:"ADHDev"})]}),u.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),u.jsx("nav",{className:"sidebar-nav",children:hI.map(d=>u.jsxs("div",{className:c(d.path),id:`nav-${d.id}`,onClick:()=>l(d.path),title:s?d.label:void 0,children:[u.jsx("span",{className:"nav-icon",children:d.icon}),!s&&d.label]},d.id))}),u.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[u.jsxs("div",{className:`nav-item cursor-pointer${r.pathname==="/about"?" active":""} ${s?"justify-center py-2.5 px-0":""}`,id:"nav-about",onClick:()=>t("/about"),title:s?"About":void 0,children:[u.jsx("span",{className:"nav-icon",children:u.jsx(HP,{})}),!s&&"About"]}),!s&&u.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.26"]}),u.jsx(DM,{collapsed:s}),u.jsxs("div",{className:`nav-item cursor-pointer ${s?"justify-center py-2.5 px-0":"mt-1"}`,onClick:a,title:s?"Expand sidebar":"Collapse sidebar",children:[u.jsx("span",{className:"nav-icon text-base",children:s?"›":"‹"}),!s&&u.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),u.jsx("main",{className:"main-content relative",children:u.jsx("div",{className:"main-content-inner",children:e})})]})}const fI=[{icon:"🏠",title:"Local-first",desc:"Everything runs on your machine. No data leaves your network. Full privacy by design."},{icon:"💬",title:"Agent chat relay",desc:"Read and respond to AI conversations in real-time across all connected IDEs."},{icon:"📸",title:"Live screenshots",desc:"View your IDE screens directly in the browser via local WebSocket streaming."},{icon:"🎛️",title:"Remote control",desc:"Click, type, and interact with your IDE from the dashboard — no window switching."},{icon:"🔌",title:"Multi-IDE support",desc:"Monitor and control multiple IDEs simultaneously — VS Code, Cursor, Windsurf, and more."},{icon:"⚡",title:"Extension agents",desc:"Manage extension-based agents like Cline and Roo Code alongside native IDE agents."}],pI=[{icon:"🌍",title:"Access from anywhere",desc:"Control your agents from any device, any network. No VPN or port forwarding needed."},{icon:"🔗",title:"WebRTC P2P streaming",desc:"End-to-end encrypted peer-to-peer connection for zero-latency remote screenshots and control."},{icon:"📱",title:"Mobile notifications",desc:"Get push notifications when agents need approval. Quick approve/reject from your phone."},{icon:"📡",title:"REST API access",desc:"Integrate with Slack, CI/CD pipelines, or custom tools. Scoped API keys with granular permissions."},{icon:"👥",title:"Team dashboard",desc:"Share a unified view across your team. See who's running what, where, in real time."},{icon:"🔐",title:"Enterprise security",desc:"SSO, RBAC, audit logs, and SLA guarantees for production teams."}],mI=[{feature:"Agent chat relay",selfhost:!0,cloud:!0},{feature:"Live IDE screenshots",selfhost:!0,cloud:!0},{feature:"Remote IDE control",selfhost:!0,cloud:!0},{feature:"Multi-IDE monitoring",selfhost:!0,cloud:!0},{feature:"Extension agent support",selfhost:!0,cloud:!0},{feature:"CLI agent support",selfhost:!0,cloud:!0},{feature:"Access from any network",selfhost:!1,cloud:!0},{feature:"WebRTC P2P streaming",selfhost:!1,cloud:!0},{feature:"Mobile push notifications",selfhost:!1,cloud:!0},{feature:"REST API & webhooks",selfhost:!1,cloud:!0},{feature:"Team collaboration",selfhost:!1,cloud:!0},{feature:"Multi-machine (Burrows)",selfhost:!1,cloud:!0},{feature:"SSO / RBAC / Audit logs",selfhost:!1,cloud:!0}],Vu={ides:["VS Code","Cursor","Antigravity","Windsurf","Trae","PearAI","Kiro","VSCodium","VS Code Insiders"],agents:["GitHub Copilot","Cline","Roo Code"],cli:["Gemini CLI","Claude Code","Codex CLI"]};function gI(){return u.jsxs("div",{className:"py-8 px-6 max-w-[860px] mx-auto text-text-primary",children:[u.jsxs("div",{className:"text-center mb-10",children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-14 h-14 mb-3 mx-auto"}),u.jsx("h1",{className:"text-[26px] font-extrabold mb-1.5 text-text-primary",children:"ADHDev"}),u.jsx("p",{className:"text-[13px] text-text-muted",children:"Agent Dashboard Hub for Dev — Self-hosted Edition"}),u.jsxs("div",{className:"inline-block mt-3 px-3 py-1 text-[11px] font-semibold tracking-wide rounded-full bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:["SELFHOST v","0.5.26"]})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"✅"})," What's included"]}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-3",children:fI.map(e=>u.jsxs("div",{className:"bg-bg-glass border border-border-subtle rounded-xl px-4 py-4 transition-colors hover:border-border-default",children:[u.jsx("div",{className:"text-xl mb-1.5",children:e.icon}),u.jsx("div",{className:"font-semibold text-[13px] mb-1",children:e.title}),u.jsx("div",{className:"text-[12px] text-text-muted leading-relaxed",children:e.desc})]},e.title))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsx("h2",{className:"text-lg font-bold mb-4",children:"Compatible with"}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-5",children:[{label:"IDEs",items:Vu.ides},{label:"Extension agents",items:Vu.agents},{label:"CLI agents",items:Vu.cli}].map(e=>u.jsxs("div",{children:[u.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-2 uppercase",children:e.label}),u.jsx("div",{className:"flex flex-col gap-1",children:e.items.map(t=>u.jsx("div",{className:"text-[12px] px-2.5 py-1.5 bg-bg-glass rounded-md border border-border-subtle",children:t},t))})]},e.label))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"⚖️"})," Self-hosted vs Cloud"]}),u.jsx("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:u.jsxs("table",{className:"w-full text-[13px]",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"bg-bg-secondary",children:[u.jsx("th",{className:"text-left px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[100px]",children:"Selfhost"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-[11px] uppercase tracking-wider w-[100px] text-violet-500",children:"Cloud"})]})}),u.jsx("tbody",{children:mI.map((e,t)=>u.jsxs("tr",{className:t%2===0?"bg-bg-glass":"",children:[u.jsx("td",{className:"px-4 py-2 text-text-secondary",children:e.feature}),u.jsx("td",{className:"text-center px-4 py-2",children:e.selfhost?u.jsx("span",{className:"text-emerald-500",children:"✓"}):u.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),u.jsx("td",{className:"text-center px-4 py-2",children:u.jsx("span",{className:"text-emerald-500",children:"✓"})})]},e.feature))})]})})]}),u.jsx("section",{className:"mb-10",children:u.jsx("div",{className:"rounded-2xl border border-violet-500/20 bg-violet-500/[0.04] px-6 py-6",children:u.jsxs("div",{className:"flex items-start gap-4",children:[u.jsx("div",{className:"text-3xl shrink-0",children:"🚀"}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h3",{className:"font-bold text-[15px] mb-1.5",children:"Unlock more with ADHDev Cloud"}),u.jsx("p",{className:"text-[13px] text-text-muted leading-relaxed mb-4",children:"Access your agents from anywhere — your phone, another laptop, or a coffee shop. Cloud adds WebRTC P2P streaming, mobile push notifications, REST API, team collaboration, and multi-machine support. Your local setup stays exactly the same."}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2.5 mb-5",children:pI.map(e=>u.jsxs("div",{className:"flex gap-2.5 items-start",children:[u.jsx("span",{className:"text-base shrink-0 mt-0.5",children:e.icon}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[12px]",children:e.title}),u.jsx("div",{className:"text-[11px] text-text-muted leading-snug",children:e.desc})]})]},e.title))}),u.jsxs("div",{className:"flex gap-3 flex-wrap",children:[u.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Try ADHDev Cloud →"}),u.jsx("a",{href:"https://github.com/vilmire/adhdev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"GitHub"}),u.jsx("a",{href:"https://discord.gg/WJD3tCfBzk",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Discord"})]})]})]})})}),u.jsxs("div",{className:"text-center text-xs text-text-muted pt-4 border-t border-border-subtle",children:[u.jsx("p",{children:"© 2026 ADHDev · Your AI sidekick otter 🦦"}),u.jsx("p",{className:"mt-1 opacity-60",children:"Self-hosted edition — all data stays on your machine"})]})]})}function _I(){const{ides:e}=Zo(),t=e.find(h=>h.type==="adhdev-daemon"),r=(t==null?void 0:t.detectedIdes)||[],{sendCommand:n}=gi(),{userName:i}=Zo(),[s,o]=b.useState(i||"");b.useEffect(()=>{i!==void 0&&o(i)},[i]);const l=h=>{const f=h.target.value.trim();t!=null&&t.id&&f!==i&&n(t.id,"set_user_name",{userName:f}).catch(console.error)},[a,c]=b.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),d=h=>{c(h);try{localStorage.setItem("adhdev_sound",h?"1":"0")}catch{}};return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(NM,{icon:"⚙️",title:"Settings",subtitle:"Local daemon configuration & preferences"}),u.jsxs("div",{className:"page-content",children:[u.jsx(ao,{title:"Daemon",className:"mb-4",children:u.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-x-4 gap-y-2.5 text-sm",children:[u.jsx("span",{className:"text-text-muted",children:"Version"}),u.jsxs("span",{className:"font-mono text-xs",children:["v","0.5.26"]}),u.jsx("span",{className:"text-text-muted",children:"Status"}),u.jsx("span",{className:t?"text-green-400":"text-yellow-400",children:t?"● Running":"○ Not connected"}),u.jsx("span",{className:"text-text-muted",children:"WebSocket"}),u.jsx("span",{className:"font-mono text-xs",children:"ws://localhost:19222"}),u.jsx("span",{className:"text-text-muted",children:"HTTP"}),u.jsx("span",{className:"font-mono text-xs",children:"http://localhost:19280"})]})}),u.jsx(ao,{title:"Detected IDEs",className:"mb-4",children:r.length===0?u.jsx("p",{className:"text-sm text-text-muted",children:"No IDEs detected. Start an IDE to see it here."}):u.jsx("div",{className:"flex flex-col gap-1.5",children:r.map(h=>u.jsxs("div",{className:"flex justify-between items-center bg-bg-glass rounded-lg px-3.5 py-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:`w-2 h-2 rounded-full ${h.running?"bg-green-400":"bg-text-muted/30"}`}),u.jsx("span",{className:"text-sm font-medium",children:h.name})]}),u.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:h.type})]},h.type))})}),u.jsx(ao,{title:"Machine",className:"mb-4",children:u.jsx(FM,{ides:e,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),u.jsx(ao,{title:"Notifications",className:"mb-4",children:u.jsx($M,{})}),u.jsx(ao,{title:"Preferences",className:"mb-4",children:u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsxs("div",{className:"flex items-center justify-between px-3.5 py-4 bg-bg-glass rounded-xl border border-border-subtle hover:border-border-hover transition-colors",children:[u.jsxs("div",{className:"flex flex-col gap-1 pr-4 max-w-[500px]",children:[u.jsx("span",{className:"text-sm font-semibold flex items-center gap-2",children:"👤 Display Name"}),u.jsx("span",{className:"text-[12px] text-text-muted leading-relaxed",children:"Your name shown in chat threads and on the team dashboard."})]}),u.jsx("input",{type:"text",className:"bg-bg-primary border border-border-strong rounded-lg px-3 py-1.5 text-sm w-48 text-right focus:border-accent-primary focus:outline-none transition-colors",placeholder:"Anonymous",value:s,onChange:h=>o(h.target.value),onBlur:l,onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur()}})]}),u.jsx(is,{label:"🔊 Sound Effects",description:"Play a sound when agent completes or needs approval",checked:a,onChange:d})]})})]})]})}function iv(){const{ides:e}=Zo(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?u.jsx(aa,{to:`/machines/${t.id}`,replace:!0}):e.length>0?u.jsx(aa,{to:`/machines/${e[0].id}`,replace:!0}):u.jsx(aa,{to:"/dashboard",replace:!0})}function vI(){return u.jsx(Bk,{children:u.jsx(uI,{children:u.jsx(Hk,{value:{sendCommand:xa,sendData:()=>!1},children:u.jsx(dI,{children:u.jsxs(Ik,{children:[u.jsx(yn,{path:"/dashboard",element:u.jsx(ZM,{})}),u.jsx(yn,{path:"/ide/:id",element:u.jsx(tI,{})}),u.jsx(yn,{path:"/machine",element:u.jsx(iv,{})}),u.jsx(yn,{path:"/machines/:id",element:u.jsx(nI,{})}),u.jsx(yn,{path:"/machines",element:u.jsx(iv,{})}),u.jsx(yn,{path:"/about",element:u.jsx(gI,{})}),u.jsx(yn,{path:"/settings",element:u.jsx(_I,{})}),u.jsx(yn,{path:"*",element:u.jsx(aa,{to:"/dashboard",replace:!0})})]})})})})})}w0(document.getElementById("root")).render(u.jsx(b.StrictMode,{children:u.jsx(vI,{})}));
|
|
214
|
+
This will disconnect CDP and optionally kill the process.`))try{const B=await r(v.daemonId,"stop_ide",{ideType:v.type,killProcess:!0});B!=null&&B.success?le("info",`${Ar(v.type)} stopped`):le("error",`Stop failed: ${(B==null?void 0:B.error)||"Unknown error"}`)}catch(B){le("error",`Stop failed: ${B.message}`)}},Zt=async()=>{if(e)try{const v=await r(e,"detect_ides",{});le("info",`Found ${((v==null?void 0:v.result)||[]).length} IDE(s)`)}catch(v){le("error",`Detection failed: ${v.message}`)}},xr=async()=>{if(e){C(!0);try{const v=await r(e,"get_recent_workspaces",{});v!=null&&v.success&&Array.isArray(v==null?void 0:v.result)&&N(v.result)}catch(v){le("error",`Failed: ${v.message}`)}finally{C(!1)}}},Ji=async()=>{if(!(!e||!We.trim())){Te(!0);try{const v=await r(e,"workspace_add",{path:We.trim()});v!=null&&v.success?(le("info",`Workspace added: ${We.trim()}`),Ne("")):le("error",(v==null?void 0:v.error)||"workspace_add failed")}catch(v){le("error",v.message)}finally{Te(!1)}}},Mc=async v=>{if(!(!e||!window.confirm("Remove this workspace from the list?"))){Te(!0);try{const B=await r(e,"workspace_remove",{id:v});B!=null&&B.success?le("info","Workspace removed"):le("error",(B==null?void 0:B.error)||"workspace_remove failed")}catch(B){le("error",B.message)}finally{Te(!1)}}},Ic=async v=>{if(e){Te(!0);try{const B=await r(e,"workspace_set_default",v===null?{clear:!0}:{id:v});if(B!=null&&B.success){le("info",v?"Default workspace updated":"Default workspace cleared");const ie=typeof B.defaultWorkspacePath=="string"?B.defaultWorkspacePath:"";ie&&(P(ie),D(ie))}else le("error",(B==null?void 0:B.error)||"workspace_set_default failed")}catch(B){le("error",B.message)}finally{Te(!1)}}},Dc=async v=>{if(!e||!v.trim())return;const B=v.trim();Te(!0);try{const ie=await r(e,"workspace_set_default",{path:B});ie!=null&&ie.success?(le("info","Default workspace set from history"),P(B),D(B)):le("error",(ie==null?void 0:ie.error)||"Could not set default (path missing on disk?)")}catch(ie){le("error",ie.message)}finally{Te(!1)}},On=b.useCallback(async()=>{var v;if(e){Y(!0);try{let B=await r(e,"get_cli_history",{});B!=null&&B.success||(B=await n(e,"get_cli_history"));const ie=(B==null?void 0:B.history)??((v=B==null?void 0:B.result)==null?void 0:v.history);B!=null&&B.success&&Array.isArray(ie)&&we(ie)}catch{}Y(!1)}},[e,r,n]);b.useEffect(()=>{J==="overview"&&e&&On()},[J,e,On]);const pp=async()=>{if(e)try{await n(e,"set_machine_nickname",{nickname:de}),le("info",`Nickname set to "${de||"(cleared)"}"`),fe(!1)}catch(v){le("error",`Failed: ${v.message}`)}};if(!O)return o?u.jsxs("div",{className:"p-10 text-center text-text-muted",children:[u.jsx("h2",{className:"text-text-primary",children:"Machine not found"}),u.jsx("p",{className:"mt-3",children:"The machine may be offline or not yet connected."}),u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back",children:"← Back to Burrows"})]}):u.jsx("div",{className:"p-10 text-center text-text-muted",children:u.jsx("p",{children:"⏳ Loading machine..."})});const mp=O.availableMem??O.freeMem,cb=O.totalMem>0?Math.min(100,Math.max(0,Math.round((O.totalMem-mp)/O.totalMem*100))):0,gp=O.loadavg[0]||0,ub=O.machineNickname||O.hostname,hb=(v,B,ie)=>{const ke=ue.find(yr=>yr.type===v),Ge=(ie||[]).join(" ");(ke==null?void 0:ke.category)==="acp"?($(v),D(B),y(Ge),ae("acps")):(R(v),P(B),E(Ge),ae("clis"))},db=[{id:"overview",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(YP,{size:14})," Overview"]})},{id:"ides",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Ro,{size:14})," IDEs"]}),count:he.length},{id:"clis",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Yy,{size:14})," CLIs"]}),count:ce.length},{id:"acps",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(QP,{size:14})," ACP Agents"]}),count:ve.length},{id:"providers",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(Ky,{size:14})," Providers"]}),count:Ve.length>0?Ve.length:void 0},{id:"logs",label:u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx(WP,{size:14})," Logs"]}),count:l.length>0?l.length:void 0}];return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsxs("div",{className:"dashboard-header !flex-col !items-stretch",children:[u.jsx("div",{className:"flex items-center justify-between w-full",children:u.jsxs("div",{className:"flex items-center gap-2 md:gap-3.5 w-full min-w-0",children:[u.jsx("button",{onClick:()=>t("/machines"),className:"machine-btn-back flex shrink-0",children:"←"}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[te?u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsx("input",{autoFocus:!0,value:de,onChange:v=>Oe(v.target.value),onKeyDown:v=>{v.key==="Enter"&&pp(),v.key==="Escape"&&fe(!1)},placeholder:"Machine nickname...",className:"px-2.5 py-1 rounded-md border border-violet-500/30 bg-bg-secondary text-text-primary text-sm font-semibold w-[140px] md:w-[200px]"}),u.jsx("button",{onClick:pp,className:"machine-btn text-green-500 border-green-500/30 shrink-0",children:"✓"}),u.jsx("button",{onClick:()=>fe(!1),className:"machine-btn shrink-0",children:"✕"})]}):u.jsx("h1",{className:"header-title cursor-pointer truncate",onClick:()=>{fe(!0),Oe(O.machineNickname||"")},title:"Click to set nickname",children:ub}),u.jsx("span",{className:"status-dot-md online shrink-0"})]}),u.jsxs("div",{className:"header-subtitle mt-1 flex-wrap gap-1 md:gap-2 items-center display-none-mobile",children:[u.jsxs("span",{children:[O.platform," · ",O.arch," · ",O.cpus," cores"]}),O.p2p.available&&u.jsxs("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:O.p2p.state==="connected"?"rgba(34,197,94,0.08)":"rgba(234,179,8,0.08)",color:O.p2p.state==="connected"?"#22c55e":"#eab308"},children:["P2P ",O.p2p.state==="connected"?`● ${O.p2p.peers}`:"○"]}),O.cdpConnected&&u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold bg-green-500/[0.08] text-green-500 shrink-0",children:"CDP ●"}),O.machineNickname&&u.jsxs("span",{className:"text-text-muted opacity-80 shrink-0",children:["(",O.hostname,")"]})]})]})]})}),u.jsx("div",{className:"machine-tabs w-full overflow-x-auto overflow-y-hidden pb-1 -mb-1 mt-2",children:db.map(v=>u.jsxs("button",{onClick:()=>ae(v.id),className:`machine-tab shrink-0${J===v.id?" active":""}`,children:[v.label,v.count!==void 0&&u.jsx("span",{className:"tab-count",children:v.count})]},v.id))})]}),u.jsxs("div",{className:"page-content",children:[J==="overview"&&u.jsxs("div",{children:[u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] gap-2.5 mb-5",children:[u.jsx($_,{icon:u.jsx(Ug,{size:16}),label:"Uptime",value:TR(O.uptime)}),u.jsx($_,{icon:u.jsx(Ro,{size:16}),label:"IDEs",value:`${he.length}`,sub:`${ce.length} CLIs`})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-3",children:"Resource Usage"}),u.jsxs("div",{className:"flex gap-6",children:[u.jsx(F_,{value:Math.min(Math.round(gp/O.cpus*100),100),max:100,label:"CPU Load",color:"#8b5cf6",detail:`${gp.toFixed(2)} avg / ${O.cpus} cores`}),u.jsx(F_,{value:cb,max:100,label:"Memory",color:"#3b82f6",detail:`${W_(O.totalMem-mp)} / ${W_(O.totalMem)}${O.platform==="darwin"?" (approx.)":""}`})]})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-3",children:u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider flex items-center gap-1.5",children:[u.jsx(Mo,{size:14})," Workspaces"]})}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:["One list for IDE, CLI, and ACP: saved paths below, and a single ",u.jsx("strong",{className:"text-text-secondary font-medium",children:"default"}),'. The default opens in the IDE when you launch it, pre-fills CLI/ACP directories, and is what "Default" launch uses.']}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-center mb-3",children:[u.jsx("span",{className:"text-[10px] text-text-muted",children:"Default:"}),u.jsxs("select",{className:"text-xs bg-bg-primary border border-border-subtle rounded-lg px-2 py-1 max-w-[min(100%,420px)]",disabled:ze,value:O.defaultWorkspaceId||"",onChange:v=>{const B=v.target.value;Ic(B===""?null:B)},children:[u.jsx("option",{value:"",children:"(none — set a default to align IDE folder + CLI/ACP fields)"}),(O.workspaces||[]).map(v=>u.jsx("option",{value:v.id,children:v.label||v.path},v.id))]}),O.defaultWorkspacePath&&u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate max-w-[min(100%,360px)]",title:O.defaultWorkspacePath,children:O.defaultWorkspacePath})]}),u.jsxs("div",{className:"flex flex-wrap gap-2 items-end",children:[u.jsx("input",{className:"flex-1 min-w-[200px] text-xs bg-bg-primary border border-border-subtle rounded-lg px-2.5 py-1.5",placeholder:"Absolute workspace path to add…",value:We,disabled:ze,onChange:v=>Ne(v.target.value),onKeyDown:v=>v.key==="Enter"&&void Ji()}),u.jsx("button",{type:"button",className:"machine-btn text-xs px-3 py-1.5",disabled:ze,onClick:()=>void Ji(),children:"Add"})]}),(O.workspaces||[]).length>0&&u.jsx("ul",{className:"mt-3 space-y-1 max-h-32 overflow-y-auto",children:(O.workspaces||[]).map(v=>u.jsxs("li",{className:"flex items-center gap-2 text-[11px] text-text-muted",children:[u.jsx("span",{className:"font-mono truncate flex-1",title:v.path,children:v.path}),u.jsx("button",{type:"button",className:"text-[10px] text-red-400/90 hover:underline",disabled:ze,onClick:()=>void Mc(v.id),children:"Remove"})]},v.id))})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-border-subtle border-violet-500/15",children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1 flex items-center gap-1.5",children:[u.jsx(Ug,{size:14})," Pick up where you left off"]}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-3",children:"Same workspaces as above. Re-run CLI/ACP, or open CLIs/ACP tab with a path filled; IDE launch uses the default automatically when set."}),u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent CLI / ACP launches"}),k.length>0?u.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:k.slice(0,10).map((v,B)=>{const ie=v.label||`${v.cliType} · ${(v.dir||"").split("/").filter(Boolean).pop()||v.dir||"?"}`;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsxs("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,240px)]",title:v.dir,children:[j(v.cliType)," ",ie]}),u.jsx("span",{className:"text-[9px] text-text-muted font-mono truncate max-w-[min(100%,200px)]",title:v.dir,children:v.dir}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void _e({cliType:v.cliType,dir:v.dir,argsStr:(v.cliArgs||[]).join(" ")}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>hb(v.cliType,v.dir,v.cliArgs),children:"Open tab…"})]})]},`${v.cliType}-${v.dir}-${v.timestamp}-${B}`)})}):u.jsx("p",{className:"text-[11px] text-text-muted mb-4",children:"No launch history yet — start a CLI or ACP from the tabs below, then return here."}),(O.workspaceActivity||[]).length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"text-[10px] font-semibold text-text-muted uppercase tracking-wide mb-2",children:"Recent workspace paths"}),u.jsx("div",{className:"flex flex-col gap-1.5",children:(O.workspaceActivity||[]).slice(0,12).map(v=>{const B=v.path.split("/").filter(Boolean).pop()||v.path,ie=v.kind==="ide"?"IDE":v.kind==="cli"?"CLI":v.kind==="acp"?"ACP":v.kind==="default"||v.kind==="active"?"●":"",ke=(v.kind==="cli"||v.kind==="acp")&&!!v.agentType;return u.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] rounded-lg px-2.5 py-1.5 bg-bg-primary/80 border border-border-subtle",children:[u.jsx("span",{className:"font-medium text-text-primary truncate max-w-[min(100%,200px)]",title:v.path,children:B}),ie&&u.jsx("span",{className:"text-[9px] px-1.5 py-px rounded bg-violet-500/15 text-violet-400",children:ie}),v.agentType&&u.jsx("span",{className:"text-[9px] text-text-muted font-mono",children:v.agentType}),u.jsx("span",{className:"text-[9px] text-text-muted",children:rI(v.lastUsedAt)}),u.jsxs("span",{className:"flex flex-wrap gap-1.5 ml-auto",children:[ke&&u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>void _e({cliType:v.agentType,dir:v.path}),children:"Run again"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{P(v.path),D(v.path),ae("clis")},children:"CLIs tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",onClick:()=>{P(v.path),D(v.path),ae("acps")},children:"ACP tab"}),u.jsx("button",{type:"button",className:"machine-btn text-[10px] px-2 py-0.5",disabled:ze,onClick:()=>void Dc(v.path),children:"Set default"})]})]},`${v.path}-${v.lastUsedAt}`)})})]})]}),u.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3",children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"IDEs"}),u.jsx("button",{onClick:()=>ae("ides"),className:"machine-btn text-[10px]",children:"View All →"})]}),he.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No IDEs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:he.map(v=>{var ie;const B=(v.agentStreams||[]).some(ke=>ke.status==="generating"||ke.status==="streaming")||((ie=v.activeChat)==null?void 0:ie.status)==="generating";return u.jsxs("div",{onClick:()=>t(`/ide/${v.id}`),className:`flex items-center gap-2 px-2.5 py-1.5 rounded-lg cursor-pointer transition-[background] duration-150 ${B?"bg-orange-500/[0.04] border border-orange-500/10":"bg-bg-glass border border-transparent"}`,children:[u.jsx("span",{children:j(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:Ar(v.type)}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace||""}),B&&u.jsx("span",{className:"text-[10px] text-orange-400 font-semibold ml-auto",children:"⚡ Working"}),u.jsx("span",{className:`${B?"ml-1.5":"ml-auto"} w-1.5 h-1.5 rounded-full`,style:{background:B?"#fb923c":"#22c55e",boxShadow:B?"0 0 8px rgba(249,115,22,0.4)":"none",animation:B?"pulse-dot 1.5s infinite":"none"}})]},v.id)})})]}),u.jsxs("div",{className:"px-5 py-4 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"CLIs"}),u.jsx("button",{onClick:()=>ae("clis"),className:"machine-btn text-[10px]",children:"View All →"})]}),ce.length===0?u.jsx("div",{className:"text-xs text-text-muted italic",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-1.5",children:ce.map(v=>u.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg bg-bg-glass",children:[u.jsx("span",{children:j(v.type)}),u.jsx("span",{className:"text-xs text-text-primary font-medium",children:v.cliName}),u.jsx("span",{className:"text-[10px] text-text-muted overflow-hidden text-ellipsis whitespace-nowrap",children:v.workspace.split("/").pop()}),u.jsx("span",{className:"ml-auto w-1.5 h-1.5 rounded-full",style:{background:v.status==="stopped"?"#ef4444":"#22c55e"}})]},v.id))})]})]}),O.detectedIdes.length>0&&u.jsxs("div",{className:"mt-4 px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2",children:"Detected on this machine"}),u.jsx("div",{className:"flex flex-wrap gap-1.5",children:O.detectedIdes.map(v=>u.jsxs("div",{className:`px-2.5 py-1 rounded-md text-[11px] flex items-center gap-1 ${v.running?"bg-green-500/[0.06] border border-green-500/[0.12] text-green-300":"bg-bg-glass border border-border-subtle text-text-muted"}`,children:[u.jsx("span",{children:j(v.type)}),v.name||v.type,u.jsx("span",{className:"w-1 h-1 rounded-full",style:{background:v.running?"#22c55e":"#475569"}})]},v.type))})]})]}),J==="ides"&&u.jsxs("div",{children:[u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",he.length,")"]}),he.length===0?u.jsx("div",{className:"py-10 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No IDEs currently running. Launch one below."}):u.jsx("div",{className:"flex flex-col gap-2.5 mb-5",children:he.map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex justify-between items-center mb-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsx("span",{className:"font-semibold text-sm text-text-primary",children:Ar(v.type)}),v.version&&u.jsxs("span",{className:"text-[10px] text-text-muted",children:["v",v.version]}),u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_6px_rgba(34,197,94,0.3)]"})]}),u.jsxs("div",{className:"flex gap-1.5",children:[u.jsxs("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn flex items-center gap-1",children:[u.jsx(Ro,{size:13})," Control"]}),u.jsx("button",{onClick:()=>Ct(v),className:"machine-btn text-amber-500 border-amber-500/30",children:"↻ Restart"}),u.jsx("button",{onClick:()=>ar(v),className:"machine-btn text-red-400 border-red-500/30",children:"■ Stop"})]})]}),u.jsxs("div",{className:"text-xs text-text-secondary mb-2",children:[u.jsx("span",{className:"text-text-muted",children:"Workspace:"})," ",v.workspace||"—"]}),v.aiAgents.length>0&&u.jsx("div",{className:"flex gap-1 mb-2 flex-wrap",children:v.aiAgents.map(B=>u.jsxs("span",{className:`px-2 py-0.5 rounded-md text-[10px] ${B.status==="generating"||B.status==="streaming"?"bg-orange-500/[0.08] text-orange-400":"bg-indigo-500/[0.06] text-indigo-400"}`,children:[B.name," · ",B.status]},B.id))}),(qe[v.type]||[]).length>0&&u.jsxs("div",{className:"mt-2 pt-2 border-t border-border-subtle",children:[u.jsx("div",{className:"text-[10px] text-text-muted font-semibold uppercase tracking-wider mb-1.5",children:"Extensions"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:(qe[v.type]||[]).map(B=>u.jsxs("button",{disabled:Mr===`${v.type}.${B.type}`,onClick:async()=>{const ie=`${v.type}.${B.type}`;K(ie);try{await r(e,"set_ide_extension",{ideType:v.type,extensionType:B.type,enabled:!B.enabled}),Mt(ke=>({...ke,[v.type]:(ke[v.type]||[]).map(Ge=>Ge.type===B.type?{...Ge,enabled:!Ge.enabled}:Ge)}))}catch(ke){console.error("Extension toggle failed:",ke)}finally{K(null)}},className:`flex items-center gap-1.5 px-2.5 py-1 rounded-lg text-[11px] font-medium border transition-colors duration-150 cursor-pointer ${B.enabled?"bg-violet-500/[0.08] border-violet-500/20 text-violet-400":"bg-bg-glass border-border-subtle text-text-muted"}`,children:[u.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${B.enabled?"bg-violet-400 shadow-[0_0_4px_rgba(139,92,246,0.4)]":"bg-zinc-600"}`}),B.name,u.jsx("span",{className:"text-[9px] font-normal",children:B.enabled?"ON":"OFF"})]},B.type))})]})]},v.id))}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:["Available to Launch (",pe.length,")"]}),u.jsxs("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:[O.defaultWorkspacePath?`Opens in default workspace: ${O.defaultWorkspacePath.split("/").filter(Boolean).pop()||O.defaultWorkspacePath}`:"No default workspace — IDE opens without a project folder from ADHDev (set one on Overview)."," ","Multi-window supported — running IDEs can be launched again as a new window."]}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[pe.map(v=>{const B=v.running||he.some(ie=>(ie.type||"").toLowerCase()===(v.type||"").toLowerCase());return u.jsxs("button",{onClick:()=>Pe(v.type||v.id||""),disabled:!!_,className:`machine-btn-primary flex items-center gap-1.5 ${B?"!border-green-500/30":""}`,style:{opacity:_&&_!==v.type?.4:1},children:[u.jsx("span",{children:j(v.type)}),B&&u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shadow-[0_0_4px_rgba(34,197,94,0.4)]"}),_===v.type?"⏳ Launching...":`▶ ${v.name||Ar(v.type)}`,B&&u.jsx("span",{className:"text-[9px] text-green-400 font-normal",children:"+ window"})]},v.type)}),pe.length===0&&u.jsxs("div",{className:"text-xs text-text-muted italic",children:["No IDEs detected.",u.jsxs("button",{onClick:Zt,className:"machine-btn ml-2 flex items-center gap-1",children:[u.jsx(VP,{size:12})," Scan"]})]})]})]}),J==="clis"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-violet-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch New CLI"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:A,onChange:v=>R(v.target.value),className:"machine-input",children:V.length>0?V.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No CLI providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or use Launch picker / Default / Home)",value:F,onChange:v=>P(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:q,onChange:v=>E(v.target.value),className:"machine-input min-w-[150px]"}),u.jsx("button",{onClick:()=>Ye(A,F,q||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(O!=null&&O.defaultWorkspacePath),title:O!=null&&O.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void _e({cliType:A,useDefaultWorkspace:!0,argsStr:q||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void _e({cliType:A,useHome:!0,argsStr:q||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ce.length,")"]}),ce.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No CLIs running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:ce.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.cliName}),u.jsx("div",{className:"text-[11px] text-text-muted",children:v.workspace})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),v.status==="stopped"?u.jsx("button",{onClick:()=>Ye(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"History"}),u.jsx("button",{onClick:On,disabled:U,className:"machine-btn",children:U?"⏳":"↻ Load"})]}),k.length>0&&u.jsx("div",{className:"flex flex-col gap-1 max-h-[200px] overflow-y-auto",children:k.map((v,B)=>{var ie,ke;return u.jsxs("div",{onClick:()=>{R(v.cliType),P(v.dir),E((v.cliArgs||[]).join(" "))},className:"flex justify-between items-center px-2.5 py-1.5 rounded-md cursor-pointer bg-bg-glass border border-border-subtle text-xs transition-[background] duration-150",onMouseEnter:Ge=>Ge.currentTarget.style.background="var(--bg-glass-hover)",onMouseLeave:Ge=>Ge.currentTarget.style.background="var(--bg-glass)",children:[u.jsxs("div",{className:"flex gap-1.5 items-center text-text-secondary",children:[u.jsx("span",{children:j(v.cliType)}),u.jsx("span",{children:((ie=v.dir)==null?void 0:ie.split("/").filter(Boolean).pop())||"root"}),((ke=v.cliArgs)==null?void 0:ke.length)>0&&u.jsx("span",{className:"text-text-muted text-[10px]",children:v.cliArgs.join(" ")})]}),u.jsx("span",{className:"text-text-muted text-[10px]",children:v.timestamp?new Date(v.timestamp).toLocaleDateString():""})]},B)})}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:L,className:"machine-btn",children:L?"⏳":"↻ Load"})]}),w.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((v,B)=>u.jsx("button",{onClick:()=>P(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Mo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),J==="acps"&&u.jsxs("div",{children:[u.jsxs("div",{className:"px-5 py-4 rounded-xl mb-5 bg-bg-secondary border border-emerald-500/[0.12]",children:[u.jsx("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-1",children:"Launch ACP Agent"}),u.jsx("p",{className:"text-[10px] text-text-muted m-0 mb-2.5",children:"Same workspaces and default as Overview — use path, Default, or Home explicitly."}),u.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[u.jsx("select",{value:T,onChange:v=>$(v.target.value),className:"machine-input",children:X.length>0?X.map(v=>u.jsxs("option",{value:v.type,children:[v.icon," ",v.displayName]},v.type)):u.jsx("option",{value:"",disabled:!0,children:"No ACP providers available"})}),u.jsx("input",{type:"text",placeholder:"Working directory (or picker / Default / Home)",value:z,onChange:v=>D(v.target.value),className:"machine-input flex-1 min-w-[200px]"}),u.jsx("input",{type:"text",placeholder:"Model (default)",value:H,onChange:v=>I(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("input",{type:"text",placeholder:"Args (optional)",value:W,onChange:v=>y(v.target.value),className:"machine-input min-w-[120px]"}),u.jsx("button",{onClick:()=>Ye(T,z,W||void 0,H||void 0),className:"machine-btn-primary",children:"▶ Launch"}),u.jsx("button",{type:"button",disabled:!(O!=null&&O.defaultWorkspacePath),title:O!=null&&O.defaultWorkspacePath?void 0:"Set a default workspace in Overview first",onClick:()=>void _e({cliType:T,useDefaultWorkspace:!0,argsStr:W||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Default"}),u.jsx("button",{type:"button",onClick:()=>void _e({cliType:T,useHome:!0,argsStr:W||void 0,model:H||void 0}),className:"machine-btn text-[10px]",children:"Home"})]})]}),u.jsxs("div",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mb-2.5",children:["Running (",ve.length,")"]}),ve.length===0?u.jsx("div",{className:"py-7.5 px-5 text-center rounded-xl bg-bg-secondary border border-dashed border-border-subtle text-text-muted text-[13px] mb-5",children:"No ACP agents running"}):u.jsx("div",{className:"flex flex-col gap-2 mb-5",children:ve.map(v=>u.jsxs("div",{className:"px-4 py-3 rounded-[10px] bg-bg-secondary border border-border-subtle flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:"text-lg",children:j(v.type)}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[13px] text-text-primary",children:v.acpName}),u.jsxs("div",{className:"text-[11px] text-text-muted flex gap-2",children:[u.jsx("span",{children:v.workspace}),v.currentModel&&u.jsxs("span",{className:"text-cyan-500",children:["🤖 ",v.currentModel]}),v.currentPlan&&u.jsxs("span",{className:"text-amber-500",children:["📋 ",v.currentPlan]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:`px-2 py-0.5 rounded-md text-[10px] font-semibold ${v.status==="stopped"?"bg-red-500/[0.08] text-red-500":v.status==="generating"?"bg-orange-500/[0.08] text-orange-400":"bg-green-500/[0.08] text-green-500"}`,children:v.status}),u.jsx("button",{onClick:()=>t(`/ide/${v.id}`),className:"machine-btn",title:"View chat",children:u.jsx(Xa,{size:14})}),v.status==="stopped"?u.jsx("button",{onClick:()=>Ye(v.type,v.workspace),className:"machine-btn text-green-500 border-green-500/30",children:"▶"}):u.jsx("button",{onClick:()=>pt(v.type,v.workspace,v.id),className:"machine-btn text-red-500 border-red-500/30",children:"■"})]})]},v.id))}),u.jsxs("div",{className:"mt-5",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider",children:"Recent Workspaces"}),u.jsx("button",{onClick:xr,disabled:L,className:"machine-btn",children:L?"⏳":"↻ Load"})]}),w.length>0&&u.jsx("div",{className:"flex flex-wrap gap-1.5",children:w.map((v,B)=>u.jsx("button",{onClick:()=>D(v),className:"machine-btn max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap",title:v,children:u.jsxs("span",{className:"flex items-center gap-1",children:[u.jsx(Mo,{size:12})," ",v.split("/").filter(Boolean).pop()||v]})},B))})]})]}),J==="providers"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-4",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Filter"}),["all","acp","cli","ide","extension"].map(v=>u.jsx("button",{onClick:()=>Fe(v),className:`machine-btn text-[10px] px-2 py-0.5 ${oe===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsx("button",{onClick:ft,disabled:G,className:"machine-btn",children:G?"⏳ Loading...":"↻ Refresh"})]}),G&&Ve.length===0?u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading provider settings..."}):u.jsx("div",{className:"flex flex-col gap-2",children:Ve.filter(v=>oe==="all"||v.category===oe).map(v=>u.jsxs("div",{className:"px-4.5 py-3.5 rounded-xl bg-bg-secondary border border-border-subtle",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[u.jsx("span",{className:"text-lg",children:v.icon}),u.jsx("span",{className:"font-semibold text-[13px] text-text-primary",children:v.displayName}),u.jsx("span",{className:"px-1.5 py-px rounded text-[9px] font-semibold",style:{background:v.category==="acp"?"rgba(139,92,246,0.08)":v.category==="cli"?"rgba(59,130,246,0.08)":v.category==="ide"?"rgba(34,197,94,0.08)":"rgba(245,158,11,0.08)",color:v.category==="acp"?"#a78bfa":v.category==="cli"?"#60a5fa":v.category==="ide"?"#86efac":"#fbbf24"},children:v.category})]}),u.jsx("div",{className:"flex flex-col gap-2",children:v.schema.map(B=>u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"text-xs font-medium text-text-primary",children:[B.label||B.key,Re===`${v.type}.${B.key}`&&u.jsx("span",{className:"ml-1.5 text-[9px] text-violet-500",children:"saving..."})]}),B.description&&u.jsx("div",{className:"text-[10px] text-text-muted mt-px",children:B.description})]}),u.jsx("div",{className:"shrink-0",children:B.type==="boolean"?u.jsx("button",{onClick:()=>It(v.type,B.key,!(v.values[B.key]??B.default)),className:"w-10 h-[22px] rounded-[11px] border-none relative cursor-pointer transition-colors duration-200",style:{background:v.values[B.key]??B.default?"#8b5cf6":"var(--border-subtle)"},children:u.jsx("div",{className:"w-4 h-4 rounded-full bg-white absolute top-[3px] transition-[left] duration-200 shadow-[0_1px_3px_rgba(0,0,0,0.3)]",style:{left:v.values[B.key]??B.default?21:3}})}):B.type==="number"?u.jsx("input",{type:"number",value:v.values[B.key]??B.default??0,min:B.min,max:B.max,onChange:ie=>{const ke=parseInt(ie.target.value)||0;B.min!==void 0&&ke<B.min||B.max!==void 0&&ke>B.max||It(v.type,B.key,ke)},className:"machine-input w-20 text-center text-[11px]"}):B.type==="select"&&B.options?u.jsx("select",{value:v.values[B.key]??B.default??"",onChange:ie=>It(v.type,B.key,ie.target.value),className:"machine-input text-[11px]",children:B.options.map(ie=>u.jsx("option",{value:ie,children:ie},ie))}):u.jsx("input",{type:"text",value:v.values[B.key]??B.default??"",onBlur:ie=>It(v.type,B.key,ie.target.value),className:"machine-input w-[120px] text-[11px]"})})]},B.key))})]},v.type))})]}),J==="logs"&&u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-center mb-3",children:[u.jsxs("div",{className:"flex gap-1 items-center",children:[u.jsx("span",{className:"text-[11px] text-text-muted font-semibold uppercase tracking-wider mr-2",children:"Level"}),["debug","info","warn","error"].map(v=>u.jsx("button",{onClick:()=>{S(v),d([]),f(0)},className:`machine-btn text-[10px] px-2 py-0.5 ${g===v?"bg-violet-500/15 border-violet-500/40 text-violet-400":""}`,children:v.toUpperCase()},v))]}),u.jsxs("div",{className:"flex gap-1.5 items-center",children:[u.jsxs("span",{className:"text-[10px] text-text-muted",children:[c.length," entries"]}),u.jsx("button",{onClick:()=>m(!p),className:`machine-btn ${p?"text-green-500 border-green-500/30":""}`,children:p?"⏸ Pause":"▶ Resume"}),u.jsx("button",{onClick:()=>{d([]),f(0)},className:"machine-btn",children:"Clear"})]})]}),u.jsxs("div",{className:"bg-bg-secondary border border-border-subtle rounded-xl p-3 min-h-[200px] max-h-[500px] overflow-y-auto font-mono text-[11px] leading-relaxed",children:[c.length===0&&u.jsx("div",{className:"p-10 text-center text-text-muted",children:"Loading daemon logs..."}),c.map((v,B)=>u.jsxs("div",{className:"flex gap-2 py-px",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#64748b":"#94a3b8"},children:[u.jsx("span",{className:"text-text-muted min-w-[75px] shrink-0",children:new Date(v.timestamp).toLocaleTimeString()}),u.jsx("span",{className:"font-semibold min-w-[32px] shrink-0 text-[9px]",style:{color:v.level==="error"?"#ef4444":v.level==="warn"?"#f59e0b":v.level==="debug"?"#475569":"#8b5cf6"},children:v.level==="error"?"ERR":v.level==="warn"?"WRN":v.level==="debug"?"DBG":"INF"}),u.jsx("span",{children:v.message})]},B)),u.jsx("div",{ref:Me})]})]})]}),ne&&O&&u.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4 bg-black/55 backdrop-blur-[2px]",role:"dialog","aria-modal":"true","aria-labelledby":"launch-pick-title",children:u.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border-subtle bg-bg-secondary shadow-xl p-5",children:[u.jsx("h2",{id:"launch-pick-title",className:"text-sm font-semibold text-text-primary m-0 mb-1",children:"Where should this run?"}),u.jsx("p",{className:"text-[11px] text-text-muted m-0 mb-4",children:"Nothing is assumed. Pick a saved workspace, your default workspace, or home — or cancel and type a path."}),u.jsx("div",{className:"flex flex-col gap-2 mb-4 max-h-48 overflow-y-auto",children:(O.workspaces||[]).length===0?u.jsx("span",{className:"text-[11px] text-text-muted",children:"No saved workspaces yet. Add one in Overview or type a path above."}):(O.workspaces||[]).map(v=>u.jsxs("button",{type:"button",className:"text-left text-xs px-3 py-2 rounded-lg border border-border-subtle bg-bg-primary hover:bg-violet-500/[0.08] transition-colors",onClick:()=>{const B=ne;Se(null),_e({cliType:B.cliType,workspaceId:v.id,argsStr:B.argsStr,model:B.model})},children:[u.jsx("span",{className:"font-medium text-text-primary block truncate",children:v.label||v.path}),u.jsx("span",{className:"text-[10px] text-text-muted font-mono truncate block",children:v.path})]},v.id))}),u.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",disabled:!O.defaultWorkspacePath,onClick:()=>{const v=ne;Se(null),_e({cliType:v.cliType,useDefaultWorkspace:!0,argsStr:v.argsStr,model:v.model})},children:"Default workspace"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[120px]",onClick:()=>{const v=ne;Se(null),_e({cliType:v.cliType,useHome:!0,argsStr:v.argsStr,model:v.model})},children:"Home directory"}),u.jsx("button",{type:"button",className:"machine-btn text-[11px] flex-1 min-w-[80px]",onClick:()=>Se(null),children:"Cancel"})]})]})})]})}function iI(){if(typeof window>"u")return"ws://localhost:3847/ws";const t=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/ws`,n=new URLSearchParams(window.location.search).get("token");return n?`${t}?token=${encodeURIComponent(n)}`:t}const rv=iI(),nv=3e3,sI=3e4;let Sn=null,oI=0;const nc=new Map,Od=new Set;let ki=null;async function xa(e,t,r){const n=Sn;if(n&&n.readyState===WebSocket.OPEN){const s=`req_${++oI}_${Date.now()}`;return new Promise((o,l)=>{const a=setTimeout(()=>{nc.delete(s),l(new Error(`WS command timeout: ${t}`))},3e4);nc.set(s,{resolve:c=>{clearTimeout(a),o(c)},reject:c=>{clearTimeout(a),l(c)}}),n.send(JSON.stringify({type:"command",requestId:s,data:{type:t,payload:r||{},target:e}}))})}const i=await fetch("/api/v1/command",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:t,payload:r||{},target:e})});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()}class lI{constructor(t){Hs(this,"daemonId");Hs(this,"screenshotIdeType",null);this.daemonId=t}get hasCommandChannel(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN}get connectionState(){return(Sn==null?void 0:Sn.readyState)===WebSocket.OPEN?"connected":"disconnected"}async sendCommand(t,r){return xa(this.daemonId,t,r)}async sendInput(t,r){const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId;return xa(n,"cdp_remote_action",{action:t,params:r})}startScreenshots(t){this.screenshotIdeType=t||null,ki&&(clearInterval(ki),ki=null);const r=async()=>{if(this.hasCommandChannel)try{const n=this.screenshotIdeType?`${this.daemonId}:ide:${this.screenshotIdeType}`:this.daemonId,i=await xa(n,"screenshot",{width:1280});if(i!=null&&i.success&&(i!=null&&i.base64)){const s=await fetch(`data:image/jpeg;base64,${i.base64}`).then(o=>o.blob());Od.forEach(o=>o(this.daemonId,s))}}catch{}};r(),ki=setInterval(r,2e3)}stopScreenshots(t){ki&&(clearInterval(ki),ki=null)}}let Ci=null;function aI(e){(!Ci||Ci.daemonId!==e)&&(Ci=new lI(e));const t=dr._originalGet||dr.get.bind(dr);dr._originalGet=t,dr.get=r=>r===e||r.startsWith("standalone")?Ci:t(r),dr.getState=r=>(r===e||r.startsWith("standalone"))&&(Ci==null?void 0:Ci.connectionState)||"disconnected",dr.onScreenshot=(r,n)=>(Od.add(n),()=>{Od.delete(n)})}function cI({children:e}){const t=b.useRef(Km()),r=Km();t.current=r;const{setUserName:n}=Zo(),i=b.useRef(n);i.current=n;const[,s]=b.useState("disconnected"),o=b.useRef(null),l=b.useRef(),a=b.useRef(nv),c=b.useRef(!0);return b.useEffect(()=>{c.current=!0;function d(){var p,m;if(!c.current||((p=o.current)==null?void 0:p.readyState)===WebSocket.OPEN||((m=o.current)==null?void 0:m.readyState)===WebSocket.CONNECTING)return;s("connecting"),console.log(`[Standalone WS] Connecting to ${rv}...`);let f;try{f=new WebSocket(rv)}catch(g){console.error("[Standalone WS] Failed to create WebSocket:",g),h();return}o.current=f,f.onopen=()=>{if(!c.current){f.close();return}s("connected"),a.current=nv,console.log("[Standalone WS] Connected")},Sn=f,f.onmessage=g=>{var S;try{const _=JSON.parse(g.data);if((_.type==="command_result"||_.type==="error")&&_.requestId){const x=nc.get(_.requestId);x&&(nc.delete(_.requestId),_.type==="error"?x.reject(new Error(((S=_.data)==null?void 0:S.message)||"Command failed")):x.resolve(_.data));return}if(_.type==="status"||_.type==="initial_state"){const x=_.data;if(!x)return;const{injectEntries:w,markLoaded:N}=t.current,L=x.id||"standalone";aI(L);const C=AR(x,{daemonId:L});C.length>0&&w(C),N(),x.userName&&i.current&&i.current(x.userName)}}catch(_){console.error("[Standalone WS] Parse error:",_)}},f.onclose=()=>{c.current&&(s("disconnected"),o.current=null,h())},f.onerror=g=>{console.warn("[Standalone WS] Error, will reconnect:",g)}}function h(){if(!c.current)return;clearTimeout(l.current);const f=a.current;console.log(`[Standalone WS] Reconnecting in ${f}ms...`),l.current=setTimeout(()=>{a.current=Math.min(a.current*1.5,sI),d()},f)}return d(),()=>{c.current=!1,clearTimeout(l.current),o.current&&(o.current.onclose=null,o.current.close(),o.current=null,Sn=null)}},[]),u.jsx(u.Fragment,{children:e})}function uI({children:e}){return u.jsx(zk,{children:u.jsx(cI,{children:e})})}const hI=[{id:"dashboard",path:"/dashboard",icon:u.jsx($P,{}),label:"Dashboard"},{id:"machine",path:"/machines",icon:u.jsx(FP,{}),label:"Burrow"},{id:"settings",path:"/settings",icon:u.jsx(Ky,{}),label:"Settings"}];function dI({children:e}){const t=Os(),r=fl(),[n,i]=b.useState(!1),[s,o]=b.useState(()=>{try{return localStorage.getItem("sidebar-collapsed")==="1"}catch{return!1}}),l=d=>{t(d),i(!1)},a=()=>{o(d=>{const h=!d;try{localStorage.setItem("sidebar-collapsed",h?"1":"0")}catch{}return h})},c=d=>`nav-item${r.pathname.startsWith(d)?" active":""} cursor-pointer ${s?"justify-center py-2.5 px-0":""}`;return u.jsxs("div",{className:`app-layout${n?" mobile-menu-open":""}${s?" sidebar-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"mobile-menu-btn","aria-label":"Open menu",onClick:()=>i(!0),children:[u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"}),u.jsx("span",{className:"mobile-menu-icon"})]}),n&&u.jsx("div",{className:"sidebar-overlay",role:"button",tabIndex:0,"aria-label":"Close menu",onClick:()=>i(!1),onKeyDown:d=>d.key==="Escape"&&i(!1)}),u.jsxs("aside",{className:`sidebar ${n?"sidebar-open":""}`,children:[u.jsxs("div",{className:"sidebar-header",children:[u.jsxs("div",{className:`sidebar-logo ${s?"justify-center gap-0":""}`,children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-7 h-7"}),!s&&u.jsx("span",{children:"ADHDev"})]}),u.jsx("button",{type:"button",className:"sidebar-close-btn","aria-label":"Close menu",onClick:()=>i(!1),children:"✕"})]}),u.jsx("nav",{className:"sidebar-nav",children:hI.map(d=>u.jsxs("div",{className:c(d.path),id:`nav-${d.id}`,onClick:()=>l(d.path),title:s?d.label:void 0,children:[u.jsx("span",{className:"nav-icon",children:d.icon}),!s&&d.label]},d.id))}),u.jsxs("div",{className:"border-t border-border-subtle pt-4 mt-2",children:[u.jsxs("div",{className:`nav-item cursor-pointer${r.pathname==="/about"?" active":""} ${s?"justify-center py-2.5 px-0":""}`,id:"nav-about",onClick:()=>t("/about"),title:s?"About":void 0,children:[u.jsx("span",{className:"nav-icon",children:u.jsx(HP,{})}),!s&&"About"]}),!s&&u.jsxs("div",{className:"px-3 py-2 text-xs text-text-muted",children:["Selfhost v","0.5.27"]}),u.jsx(DM,{collapsed:s}),u.jsxs("div",{className:`nav-item cursor-pointer ${s?"justify-center py-2.5 px-0":"mt-1"}`,onClick:a,title:s?"Expand sidebar":"Collapse sidebar",children:[u.jsx("span",{className:"nav-icon text-base",children:s?"›":"‹"}),!s&&u.jsx("span",{className:"text-xs",children:"Collapse"})]})]})]}),u.jsx("main",{className:"main-content relative",children:u.jsx("div",{className:"main-content-inner",children:e})})]})}const fI=[{icon:"🏠",title:"Local-first",desc:"Everything runs on your machine. No data leaves your network. Full privacy by design."},{icon:"💬",title:"Agent chat relay",desc:"Read and respond to AI conversations in real-time across all connected IDEs."},{icon:"📸",title:"Live screenshots",desc:"View your IDE screens directly in the browser via local WebSocket streaming."},{icon:"🎛️",title:"Remote control",desc:"Click, type, and interact with your IDE from the dashboard — no window switching."},{icon:"🔌",title:"Multi-IDE support",desc:"Monitor and control multiple IDEs simultaneously — VS Code, Cursor, Windsurf, and more."},{icon:"⚡",title:"Extension agents",desc:"Manage extension-based agents like Cline and Roo Code alongside native IDE agents."}],pI=[{icon:"🌍",title:"Access from anywhere",desc:"Control your agents from any device, any network. No VPN or port forwarding needed."},{icon:"🔗",title:"WebRTC P2P streaming",desc:"End-to-end encrypted peer-to-peer connection for zero-latency remote screenshots and control."},{icon:"📱",title:"Mobile notifications",desc:"Get push notifications when agents need approval. Quick approve/reject from your phone."},{icon:"📡",title:"REST API access",desc:"Integrate with Slack, CI/CD pipelines, or custom tools. Scoped API keys with granular permissions."},{icon:"👥",title:"Team dashboard",desc:"Share a unified view across your team. See who's running what, where, in real time."},{icon:"🔐",title:"Enterprise security",desc:"SSO, RBAC, audit logs, and SLA guarantees for production teams."}],mI=[{feature:"Agent chat relay",selfhost:!0,cloud:!0},{feature:"Live IDE screenshots",selfhost:!0,cloud:!0},{feature:"Remote IDE control",selfhost:!0,cloud:!0},{feature:"Multi-IDE monitoring",selfhost:!0,cloud:!0},{feature:"Extension agent support",selfhost:!0,cloud:!0},{feature:"CLI agent support",selfhost:!0,cloud:!0},{feature:"Access from any network",selfhost:!1,cloud:!0},{feature:"WebRTC P2P streaming",selfhost:!1,cloud:!0},{feature:"Mobile push notifications",selfhost:!1,cloud:!0},{feature:"REST API & webhooks",selfhost:!1,cloud:!0},{feature:"Team collaboration",selfhost:!1,cloud:!0},{feature:"Multi-machine (Burrows)",selfhost:!1,cloud:!0},{feature:"SSO / RBAC / Audit logs",selfhost:!1,cloud:!0}],Vu={ides:["VS Code","Cursor","Antigravity","Windsurf","Trae","PearAI","Kiro","VSCodium","VS Code Insiders"],agents:["GitHub Copilot","Cline","Roo Code"],cli:["Gemini CLI","Claude Code","Codex CLI"]};function gI(){return u.jsxs("div",{className:"py-8 px-6 max-w-[860px] mx-auto text-text-primary",children:[u.jsxs("div",{className:"text-center mb-10",children:[u.jsx("img",{src:"/otter-logo.png",alt:"ADHDev",className:"w-14 h-14 mb-3 mx-auto"}),u.jsx("h1",{className:"text-[26px] font-extrabold mb-1.5 text-text-primary",children:"ADHDev"}),u.jsx("p",{className:"text-[13px] text-text-muted",children:"Agent Dashboard Hub for Dev — Self-hosted Edition"}),u.jsxs("div",{className:"inline-block mt-3 px-3 py-1 text-[11px] font-semibold tracking-wide rounded-full bg-emerald-500/10 text-emerald-500 border border-emerald-500/20",children:["SELFHOST v","0.5.27"]})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"✅"})," What's included"]}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))] gap-3",children:fI.map(e=>u.jsxs("div",{className:"bg-bg-glass border border-border-subtle rounded-xl px-4 py-4 transition-colors hover:border-border-default",children:[u.jsx("div",{className:"text-xl mb-1.5",children:e.icon}),u.jsx("div",{className:"font-semibold text-[13px] mb-1",children:e.title}),u.jsx("div",{className:"text-[12px] text-text-muted leading-relaxed",children:e.desc})]},e.title))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsx("h2",{className:"text-lg font-bold mb-4",children:"Compatible with"}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(180px,1fr))] gap-5",children:[{label:"IDEs",items:Vu.ides},{label:"Extension agents",items:Vu.agents},{label:"CLI agents",items:Vu.cli}].map(e=>u.jsxs("div",{children:[u.jsx("div",{className:"text-[10px] font-bold tracking-wider text-text-muted mb-2 uppercase",children:e.label}),u.jsx("div",{className:"flex flex-col gap-1",children:e.items.map(t=>u.jsx("div",{className:"text-[12px] px-2.5 py-1.5 bg-bg-glass rounded-md border border-border-subtle",children:t},t))})]},e.label))})]}),u.jsxs("section",{className:"mb-10",children:[u.jsxs("h2",{className:"text-lg font-bold mb-4 flex items-center gap-2",children:[u.jsx("span",{className:"text-base",children:"⚖️"})," Self-hosted vs Cloud"]}),u.jsx("div",{className:"rounded-xl border border-border-subtle overflow-hidden",children:u.jsxs("table",{className:"w-full text-[13px]",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"bg-bg-secondary",children:[u.jsx("th",{className:"text-left px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider",children:"Feature"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-text-muted text-[11px] uppercase tracking-wider w-[100px]",children:"Selfhost"}),u.jsx("th",{className:"text-center px-4 py-2.5 font-semibold text-[11px] uppercase tracking-wider w-[100px] text-violet-500",children:"Cloud"})]})}),u.jsx("tbody",{children:mI.map((e,t)=>u.jsxs("tr",{className:t%2===0?"bg-bg-glass":"",children:[u.jsx("td",{className:"px-4 py-2 text-text-secondary",children:e.feature}),u.jsx("td",{className:"text-center px-4 py-2",children:e.selfhost?u.jsx("span",{className:"text-emerald-500",children:"✓"}):u.jsx("span",{className:"text-text-muted opacity-40",children:"—"})}),u.jsx("td",{className:"text-center px-4 py-2",children:u.jsx("span",{className:"text-emerald-500",children:"✓"})})]},e.feature))})]})})]}),u.jsx("section",{className:"mb-10",children:u.jsx("div",{className:"rounded-2xl border border-violet-500/20 bg-violet-500/[0.04] px-6 py-6",children:u.jsxs("div",{className:"flex items-start gap-4",children:[u.jsx("div",{className:"text-3xl shrink-0",children:"🚀"}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h3",{className:"font-bold text-[15px] mb-1.5",children:"Unlock more with ADHDev Cloud"}),u.jsx("p",{className:"text-[13px] text-text-muted leading-relaxed mb-4",children:"Access your agents from anywhere — your phone, another laptop, or a coffee shop. Cloud adds WebRTC P2P streaming, mobile push notifications, REST API, team collaboration, and multi-machine support. Your local setup stays exactly the same."}),u.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2.5 mb-5",children:pI.map(e=>u.jsxs("div",{className:"flex gap-2.5 items-start",children:[u.jsx("span",{className:"text-base shrink-0 mt-0.5",children:e.icon}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold text-[12px]",children:e.title}),u.jsx("div",{className:"text-[11px] text-text-muted leading-snug",children:e.desc})]})]},e.title))}),u.jsxs("div",{className:"flex gap-3 flex-wrap",children:[u.jsx("a",{href:"https://adhf.dev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-primary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Try ADHDev Cloud →"}),u.jsx("a",{href:"https://github.com/vilmire/adhdev",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"GitHub"}),u.jsx("a",{href:"https://discord.gg/WJD3tCfBzk",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm inline-flex items-center gap-1.5 no-underline",children:"Discord"})]})]})]})})}),u.jsxs("div",{className:"text-center text-xs text-text-muted pt-4 border-t border-border-subtle",children:[u.jsx("p",{children:"© 2026 ADHDev · Your AI sidekick otter 🦦"}),u.jsx("p",{className:"mt-1 opacity-60",children:"Self-hosted edition — all data stays on your machine"})]})]})}function _I(){const{ides:e}=Zo(),t=e.find(h=>h.type==="adhdev-daemon"),r=(t==null?void 0:t.detectedIdes)||[],{sendCommand:n}=gi(),{userName:i}=Zo(),[s,o]=b.useState(i||"");b.useEffect(()=>{i!==void 0&&o(i)},[i]);const l=h=>{const f=h.target.value.trim();t!=null&&t.id&&f!==i&&n(t.id,"set_user_name",{userName:f}).catch(console.error)},[a,c]=b.useState(()=>{try{return localStorage.getItem("adhdev_sound")!=="0"}catch{return!0}}),d=h=>{c(h);try{localStorage.setItem("adhdev_sound",h?"1":"0")}catch{}};return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(NM,{icon:"⚙️",title:"Settings",subtitle:"Local daemon configuration & preferences"}),u.jsxs("div",{className:"page-content",children:[u.jsx(ao,{title:"Daemon",className:"mb-4",children:u.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-x-4 gap-y-2.5 text-sm",children:[u.jsx("span",{className:"text-text-muted",children:"Version"}),u.jsxs("span",{className:"font-mono text-xs",children:["v","0.5.27"]}),u.jsx("span",{className:"text-text-muted",children:"Status"}),u.jsx("span",{className:t?"text-green-400":"text-yellow-400",children:t?"● Running":"○ Not connected"}),u.jsx("span",{className:"text-text-muted",children:"WebSocket"}),u.jsx("span",{className:"font-mono text-xs",children:"ws://localhost:19222"}),u.jsx("span",{className:"text-text-muted",children:"HTTP"}),u.jsx("span",{className:"font-mono text-xs",children:"http://localhost:19280"})]})}),u.jsx(ao,{title:"Detected IDEs",className:"mb-4",children:r.length===0?u.jsx("p",{className:"text-sm text-text-muted",children:"No IDEs detected. Start an IDE to see it here."}):u.jsx("div",{className:"flex flex-col gap-1.5",children:r.map(h=>u.jsxs("div",{className:"flex justify-between items-center bg-bg-glass rounded-lg px-3.5 py-2.5",children:[u.jsxs("div",{className:"flex items-center gap-2.5",children:[u.jsx("span",{className:`w-2 h-2 rounded-full ${h.running?"bg-green-400":"bg-text-muted/30"}`}),u.jsx("span",{className:"text-sm font-medium",children:h.name})]}),u.jsx("span",{className:"text-[11px] text-text-muted font-mono",children:h.type})]},h.type))})}),u.jsx(ao,{title:"Machine",className:"mb-4",children:u.jsx(FM,{ides:e,emptyMessage:"Daemon not connected. Run 'adhdev-standalone' to start."})}),u.jsx(ao,{title:"Notifications",className:"mb-4",children:u.jsx($M,{})}),u.jsx(ao,{title:"Preferences",className:"mb-4",children:u.jsxs("div",{className:"flex flex-col gap-3",children:[u.jsxs("div",{className:"flex items-center justify-between px-3.5 py-4 bg-bg-glass rounded-xl border border-border-subtle hover:border-border-hover transition-colors",children:[u.jsxs("div",{className:"flex flex-col gap-1 pr-4 max-w-[500px]",children:[u.jsx("span",{className:"text-sm font-semibold flex items-center gap-2",children:"👤 Display Name"}),u.jsx("span",{className:"text-[12px] text-text-muted leading-relaxed",children:"Your name shown in chat threads and on the team dashboard."})]}),u.jsx("input",{type:"text",className:"bg-bg-primary border border-border-strong rounded-lg px-3 py-1.5 text-sm w-48 text-right focus:border-accent-primary focus:outline-none transition-colors",placeholder:"Anonymous",value:s,onChange:h=>o(h.target.value),onBlur:l,onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur()}})]}),u.jsx(is,{label:"🔊 Sound Effects",description:"Play a sound when agent completes or needs approval",checked:a,onChange:d})]})})]})]})}function iv(){const{ides:e}=Zo(),t=e.find(r=>{var n;return r.daemonMode||((n=r.id)==null?void 0:n.startsWith("standalone"))});return t?u.jsx(aa,{to:`/machines/${t.id}`,replace:!0}):e.length>0?u.jsx(aa,{to:`/machines/${e[0].id}`,replace:!0}):u.jsx(aa,{to:"/dashboard",replace:!0})}function vI(){return u.jsx(Bk,{children:u.jsx(uI,{children:u.jsx(Hk,{value:{sendCommand:xa,sendData:()=>!1},children:u.jsx(dI,{children:u.jsxs(Ik,{children:[u.jsx(yn,{path:"/dashboard",element:u.jsx(ZM,{})}),u.jsx(yn,{path:"/ide/:id",element:u.jsx(tI,{})}),u.jsx(yn,{path:"/machine",element:u.jsx(iv,{})}),u.jsx(yn,{path:"/machines/:id",element:u.jsx(nI,{})}),u.jsx(yn,{path:"/machines",element:u.jsx(iv,{})}),u.jsx(yn,{path:"/about",element:u.jsx(gI,{})}),u.jsx(yn,{path:"/settings",element:u.jsx(_I,{})}),u.jsx(yn,{path:"*",element:u.jsx(aa,{to:"/dashboard",replace:!0})})]})})})})})}w0(document.getElementById("root")).render(u.jsx(b.StrictMode,{children:u.jsx(vI,{})}));
|
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-CBC3cOPM.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-z1jDrhsp.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|