ai-cli-online 2.5.1 → 2.6.0
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 +1 -1
- package/server/dist/db.d.ts +6 -0
- package/server/dist/db.js +35 -0
- package/server/dist/files.d.ts +2 -0
- package/server/dist/files.js +14 -0
- package/server/dist/index.js +150 -9
- package/server/dist/websocket.js +3 -11
- package/server/package.json +1 -1
- package/shared/dist/types.d.ts +9 -0
- package/shared/dist/types.js +9 -1
- package/web/dist/assets/index-CmWFgqt3.js +31 -0
- package/web/dist/assets/index-CtLiFTts.css +32 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-ClJzpPT-.css +0 -32
- package/web/dist/assets/index-zFa9lx6P.js +0 -33
- package/web/dist/assets/pdf-Tk4_4Bu3.js +0 -12
- package/web/dist/assets/pdf.worker-BA9kU3Pw.mjs +0 -61080
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var Zt=Object.defineProperty;var Qt=(n,e,t)=>e in n?Zt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var lt=(n,e,t)=>Qt(n,typeof e!="symbol"?e+"":e,t);import{r as a,a as en,g as tn,R as at}from"./react-vendor-BCIvbQoU.js";import{D as It,o as jt,L as nn,x as Rt}from"./terminal-DnNpv9tw.js";import{p as Nt,d as Dt}from"./markdown-BERZKN_L.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const i of c.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function t(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(o){if(o.ep)return;o.ep=!0;const c=t(o);fetch(o.href,c)}})();var Lt={exports:{}},Ke={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var rn=a,on=Symbol.for("react.element"),sn=Symbol.for("react.fragment"),an=Object.prototype.hasOwnProperty,ln=rn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,cn={key:!0,ref:!0,__self:!0,__source:!0};function Mt(n,e,t){var r,o={},c=null,i=null;t!==void 0&&(c=""+t),e.key!==void 0&&(c=""+e.key),e.ref!==void 0&&(i=e.ref);for(r in e)an.call(e,r)&&!cn.hasOwnProperty(r)&&(o[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{$$typeof:on,type:n,key:c,ref:i,props:o,_owner:ln.current}}Ke.Fragment=sn;Ke.jsx=Mt;Ke.jsxs=Mt;Lt.exports=Ke;var s=Lt.exports,tt={},ct=en;tt.createRoot=ct.createRoot,tt.hydrateRoot=ct.hydrateRoot;const dn={},dt=n=>{let e;const t=new Set,r=(p,m)=>{const h=typeof p=="function"?p(e):p;if(!Object.is(h,e)){const b=e;e=m??(typeof h!="object"||h===null)?h:Object.assign({},e,h),t.forEach(k=>k(e,b))}},o=()=>e,l={setState:r,getState:o,getInitialState:()=>f,subscribe:p=>(t.add(p),()=>t.delete(p)),destroy:()=>{t.clear()}},f=e=n(r,o,l);return l},un=n=>n?dt(n):dt;var zt={exports:{}},At={},$t={exports:{}},_t={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* use-sync-external-store-shim.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Le=a;function fn(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var pn=typeof Object.is=="function"?Object.is:fn,mn=Le.useState,hn=Le.useEffect,bn=Le.useLayoutEffect,gn=Le.useDebugValue;function xn(n,e){var t=e(),r=mn({inst:{value:t,getSnapshot:e}}),o=r[0].inst,c=r[1];return bn(function(){o.value=t,o.getSnapshot=e,Ye(o)&&c({inst:o})},[n,t,e]),hn(function(){return Ye(o)&&c({inst:o}),n(function(){Ye(o)&&c({inst:o})})},[n]),gn(t),t}function Ye(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!pn(n,t)}catch{return!0}}function yn(n,e){return e()}var vn=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?yn:xn;_t.useSyncExternalStore=Le.useSyncExternalStore!==void 0?Le.useSyncExternalStore:vn;$t.exports=_t;var wn=$t.exports;/**
|
|
18
|
+
* @license React
|
|
19
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var Je=a,Sn=wn;function kn(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Cn=typeof Object.is=="function"?Object.is:kn,Tn=Sn.useSyncExternalStore,En=Je.useRef,In=Je.useEffect,jn=Je.useMemo,Rn=Je.useDebugValue;At.useSyncExternalStoreWithSelector=function(n,e,t,r,o){var c=En(null);if(c.current===null){var i={hasValue:!1,value:null};c.current=i}else i=c.current;c=jn(function(){function l(b){if(!f){if(f=!0,p=b,b=r(b),o!==void 0&&i.hasValue){var k=i.value;if(o(k,b))return m=k}return m=b}if(k=m,Cn(p,b))return k;var M=r(b);return o!==void 0&&o(k,M)?(p=b,k):(p=b,m=M)}var f=!1,p,m,h=t===void 0?null:t;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,t,r,o]);var u=Tn(n,c[0],c[1]);return In(function(){i.hasValue=!0,i.value=u},[u]),Rn(u),u};zt.exports=At;var Nn=zt.exports;const Dn=tn(Nn),Ot={},{useDebugValue:Ln}=at,{useSyncExternalStoreWithSelector:Mn}=Dn;let ut=!1;const zn=n=>n;function An(n,e=zn,t){(Ot?"production":void 0)!=="production"&&t&&!ut&&(ut=!0);const r=Mn(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return Ln(r),r}const ft=n=>{const e=typeof n=="function"?un(n):n,t=(r,o)=>An(e,r,o);return Object.assign(t,e),t},$n=n=>n?ft(n):ft,te="";function ne(n){return{Authorization:`Bearer ${n}`}}async function _n(n){try{const e=await fetch(`${te}/api/settings/font-size`,{headers:ne(n)});return e.ok?(await e.json()).fontSize:14}catch{return 14}}async function On(n,e){try{await fetch(`${te}/api/settings/font-size`,{method:"PUT",headers:{...ne(n),"Content-Type":"application/json"},body:JSON.stringify({fontSize:e})})}catch{}}async function Fn(n){try{const e=await fetch(`${te}/api/settings/tabs-layout`,{headers:ne(n)});return e.ok?(await e.json()).layout:null}catch{return null}}async function Pn(n,e){try{await fetch(`${te}/api/settings/tabs-layout`,{method:"PUT",headers:{...ne(n),"Content-Type":"application/json"},body:JSON.stringify({layout:e})})}catch{}}function pt(n,e){try{const t=`${te}/api/settings/tabs-layout`,r=JSON.stringify({layout:e,token:n});navigator.sendBeacon(t,new Blob([r],{type:"application/json"}))}catch{}}const Be="ai-cli-online-tabs",mt="ai-cli-online-layout",ht="ai-cli-online-session-names";function Ue(n,e){if(n.type==="leaf")return n.terminalId===e?null:n;const t=[],r=[];for(let i=0;i<n.children.length;i++){const u=Ue(n.children[i],e);u!==null&&(t.push(u),r.push(n.sizes[i]))}if(t.length===0)return null;if(t.length===1)return t[0];const o=r.reduce((i,u)=>i+u,0),c=r.map(i=>i/o*100);return{...n,children:t,sizes:c}}function Ft(n,e,t,r,o){return n.type==="leaf"?n.terminalId===e?{id:o,type:"split",direction:t,children:[n,r],sizes:[50,50]}:n:{...n,children:n.children.map(c=>Ft(c,e,t,r,o))}}function Pt(n,e,t){return n.type==="leaf"?n:n.id===e?{...n,sizes:t}:{...n,children:n.children.map(r=>Pt(r,e,t))}}function Ge(n){return n.tabs.find(e=>e.id===n.activeTabId)}function Ce(n,e,t){return n.map(r=>r.id===e?t(r):r)}function le(n){const e={version:2,activeTabId:n.activeTabId,nextId:n.nextId,nextSplitId:n.nextSplitId,nextTabId:n.nextTabId,tabs:n.tabs};try{localStorage.setItem(Be,JSON.stringify(e))}catch{}Bn(e)}let Ae=null,$e=null,Re=null,ze=null;function Bn(n){ze=n,Re&&clearTimeout(Re),Re=setTimeout(()=>{Re=null,ze=null;const e=D.getState().token;e&&Pn(e,n)},2e3)}function Un(n){Ae&&clearTimeout(Ae),Ae=setTimeout(()=>{Ae=null,le(n)},500)}function Wn(){try{const n=localStorage.getItem(Be);if(n){const e=JSON.parse(n);if(e.version===2)return e}}catch{}try{const n=localStorage.getItem(mt);if(n){const e=JSON.parse(n);let t="Default";try{const c=localStorage.getItem(ht);if(c){const i=JSON.parse(c),u=Object.values(i)[0];u&&(t=u)}}catch{}const r={id:"tab1",name:t,status:"open",terminalIds:e.terminalIds,layout:e.layout,createdAt:Date.now()},o={version:2,activeTabId:"tab1",nextId:e.nextId,nextSplitId:e.nextSplitId,nextTabId:2,tabs:[r]};try{localStorage.setItem(Be,JSON.stringify(o))}catch{}return localStorage.removeItem(mt),localStorage.removeItem(ht),o}}catch{}return null}function ie(n){return{tabs:n.tabs,activeTabId:n.activeTabId,nextId:n.nextId,nextSplitId:n.nextSplitId,nextTabId:n.nextTabId}}function Hn(n,e){const t=new Set(e.map(i=>i.sessionId)),r=[];for(const i of n.tabs){if(i.status!=="open"){const f=i.terminalIds.filter(p=>t.has(p));if(f.length>0){let p=i.layout;for(const m of i.terminalIds)!t.has(m)&&p&&(p=Ue(p,m));r.push({...i,terminalIds:f,layout:p})}continue}const u=i.terminalIds.filter(f=>t.has(f));if(u.length===0)continue;let l=i.layout;for(const f of i.terminalIds)!t.has(f)&&l&&(l=Ue(l,f));r.push({...i,terminalIds:u,layout:l})}if(r.filter(i=>i.status==="open").length===0)return null;let o=n.activeTabId;if(!r.find(i=>i.id===o&&i.status==="open")){const i=r.find(u=>u.status==="open");o=(i==null?void 0:i.id)||""}return{...n,activeTabId:o,tabs:r}}typeof window<"u"&&window.addEventListener("beforeunload",()=>{var e,t;const n=(t=(e=D==null?void 0:D.getState)==null?void 0:e.call(D))==null?void 0:t.token;if(n)if(ze)Re&&(clearTimeout(Re),Re=null),pt(n,ze),ze=null;else{const r=D.getState();r.tabs.length>0&&pt(n,ie(r))}});function bt(n,e){const t=n.tabs.find(f=>f.terminalIds.includes(e));if(!t){const{[e]:f,...p}=n.terminalsMap;return{terminalsMap:p}}const r=t.terminalIds.filter(f=>f!==e),o=t.layout?Ue(t.layout,e):null,c=Ce(n.tabs,t.id,f=>({...f,terminalIds:r,layout:o})),{[e]:i,...u}=n.terminalsMap,l={terminalsMap:u,tabs:c};return t.id===n.activeTabId&&(l.terminalIds=r,l.layout=o),l}const D=$n((n,e)=>({token:null,tabsLoading:!1,setToken:t=>{var r;if(t){try{localStorage.setItem("ai-cli-online-token",t)}catch{}_n(t).then(c=>{e().token===t&&n({fontSize:c})});const o=Wn();if(o&&o.tabs.length>0){const c={};for(const l of o.tabs)if(l.status==="open")for(const f of l.terminalIds)c[f]={id:f,connected:!1,sessionResumed:!1,error:null,panels:((r=l.panelStates)==null?void 0:r[f])||{chatOpen:!1,planOpen:!1}};const i=o.tabs.find(l=>l.id===o.activeTabId&&l.status==="open")||o.tabs.find(l=>l.status==="open"),u=(i==null?void 0:i.id)||"";n({token:t,tabsLoading:!0,terminalsMap:c,tabs:o.tabs,activeTabId:u,nextId:o.nextId,nextSplitId:o.nextSplitId,nextTabId:o.nextTabId,terminalIds:(i==null?void 0:i.terminalIds)||[],layout:(i==null?void 0:i.layout)||null})}else n({token:t,tabsLoading:!0,terminalsMap:{},tabs:[],activeTabId:"",nextId:1,nextSplitId:1,nextTabId:1,terminalIds:[],layout:null});Kn(t,o);return}localStorage.removeItem("ai-cli-online-token"),localStorage.removeItem(Be),n({token:t,tabsLoading:!1,terminalsMap:{},tabs:[],activeTabId:"",nextId:1,nextSplitId:1,nextTabId:1,terminalIds:[],layout:null})},terminalsMap:{},terminalIds:[],layout:null,nextId:1,nextSplitId:1,tabs:[],activeTabId:"",nextTabId:1,addTab:t=>{const r=e(),o=`tab${r.nextTabId}`,c=`t${r.nextId}`,i={id:c,connected:!1,sessionResumed:!1,error:null,panels:{chatOpen:!1,planOpen:!1}},u={type:"leaf",terminalId:c},l={id:o,name:t||`Tab ${r.nextTabId}`,status:"open",terminalIds:[c],layout:u,createdAt:Date.now()};return n({tabs:[...r.tabs,l],activeTabId:o,nextTabId:r.nextTabId+1,nextId:r.nextId+1,terminalsMap:{...r.terminalsMap,[c]:i},terminalIds:l.terminalIds,layout:l.layout}),le(ie(e())),o},switchTab:t=>{const o=e().tabs.find(c=>c.id===t);!o||o.status!=="open"||(n({activeTabId:t,terminalIds:o.terminalIds,layout:o.layout}),le(ie(e())))},closeTab:t=>{const r=e(),o=r.tabs.find(m=>m.id===t);if(!o||o.status!=="open"||r.tabs.filter(m=>m.status==="open").length<=1)return;const i={...r.terminalsMap};for(const m of o.terminalIds)delete i[m];const u=Ce(r.tabs,t,m=>({...m,status:"closed"}));let l=r.activeTabId,f=r.terminalIds,p=r.layout;if(r.activeTabId===t){const m=r.tabs.findIndex(k=>k.id===t),h=u.filter(k=>k.status==="open"),b=h.find(k=>u.findIndex(C=>C.id===k.id)>m)||h[h.length-1];b&&(l=b.id,f=b.terminalIds,p=b.layout)}n({tabs:u,activeTabId:l,terminalsMap:i,terminalIds:f,layout:p}),le(ie(e()))},reopenTab:t=>{var u;const r=e(),o=r.tabs.find(l=>l.id===t);if(!o||o.status!=="closed")return;const c={...r.terminalsMap};for(const l of o.terminalIds)c[l]={id:l,connected:!1,sessionResumed:!1,error:null,panels:((u=o.panelStates)==null?void 0:u[l])||{chatOpen:!1,planOpen:!1}};const i=Ce(r.tabs,t,l=>({...l,status:"open"}));n({tabs:i,activeTabId:t,terminalsMap:c,terminalIds:o.terminalIds,layout:o.layout}),le(ie(e()))},deleteTab:async t=>{const r=e(),o=r.tabs.find(b=>b.id===t);if(!o)return;const c=r.token;c&&await Promise.all(o.terminalIds.map(b=>fetch(`${te}/api/sessions/${encodeURIComponent(b)}`,{method:"DELETE",headers:ne(c)}).catch(()=>{})));const i=e(),u=i.tabs.find(b=>b.id===t);if(!u)return;const l={...i.terminalsMap};for(const b of u.terminalIds)delete l[b];const f=i.tabs.filter(b=>b.id!==t);let p=i.activeTabId,m=i.terminalIds,h=i.layout;if(i.activeTabId===t){const b=f.find(k=>k.status==="open");b?(p=b.id,m=b.terminalIds,h=b.layout):(p="",m=[],h=null)}n({tabs:f,activeTabId:p,terminalsMap:l,terminalIds:m,layout:h}),le(ie(e())),setTimeout(()=>e().fetchSessions(),500)},renameTab:(t,r)=>{const o=Ce(e().tabs,t,c=>({...c,name:r}));n({tabs:o}),le(ie(e()))},addTerminal:(t,r)=>{const o=e();if(r&&o.terminalsMap[r])return r;const c=Ge(o);if(!c){const P=`tab${o.nextTabId}`,R=r||`t${o.nextId}`;let F=o.nextId;const W=R.match(/^t(\d+)$/);W&&(F=Math.max(F,parseInt(W[1],10)+1));const O=r?F:F+1,T={id:R,connected:!1,sessionResumed:!1,error:null,panels:{chatOpen:!1,planOpen:!1}},v={type:"leaf",terminalId:R},z={id:P,name:`Tab ${o.nextTabId}`,status:"open",terminalIds:[R],layout:v,createdAt:Date.now()};return n({tabs:[...o.tabs,z],activeTabId:P,nextTabId:o.nextTabId+1,nextId:O,terminalsMap:{...o.terminalsMap,[R]:T},terminalIds:[R],layout:v}),le(ie(e())),R}const{nextId:i,nextSplitId:u,terminalsMap:l}=o,{terminalIds:f,layout:p}=c,m=r||`t${i}`;let h=i;const b=m.match(/^t(\d+)$/);b&&(h=Math.max(h,parseInt(b[1],10)+1));const k={id:m,connected:!1,sessionResumed:!1,error:null,panels:{chatOpen:!1,planOpen:!1}},M={type:"leaf",terminalId:m};let C,j=u;if(!p)C=M;else if(p.type==="leaf"){const P=t||"horizontal";C={id:`s${j}`,type:"split",direction:P,children:[p,M],sizes:[50,50]},j++}else if(p.direction===(t||"horizontal")){const R=100/(p.children.length+1),F=(100-R)/100,W=[...p.sizes.map(O=>O*F),R];C={...p,children:[...p.children,M],sizes:W}}else{const P=t||"horizontal";C={id:`s${j}`,type:"split",direction:P,children:[p,M],sizes:[50,50]},j++}const x=[...f,m],$=r?h:h+1,E=Ce(o.tabs,c.id,P=>({...P,terminalIds:x,layout:C}));return n({terminalsMap:{...l,[m]:k},terminalIds:x,layout:C,tabs:E,nextId:$,nextSplitId:j}),le(ie(e())),m},splitTerminal:(t,r,o)=>{const c=e(),i=Ge(c);if(!i||!i.layout)return"";const{nextId:u,nextSplitId:l,terminalsMap:f}=c,p=`t${u}`,m={id:p,connected:!1,sessionResumed:!1,error:null,panels:{chatOpen:!1,planOpen:!1},...o?{startCwd:o}:{}},h={type:"leaf",terminalId:p},b=`s${l}`,k=Ft(i.layout,t,r,h,b),M=[...i.terminalIds,p],C=u+1,j=l+1,x=Ce(c.tabs,i.id,$=>({...$,terminalIds:M,layout:k}));return n({terminalsMap:{...f,[p]:m},terminalIds:M,layout:k,tabs:x,nextId:C,nextSplitId:j}),le(ie(e())),p},removeTerminal:t=>{const r=bt(e(),t);r&&(n(r),le(ie(e())))},setTerminalConnected:(t,r)=>{n(o=>{const c=o.terminalsMap[t];return!c||c.connected===r?o:{terminalsMap:{...o.terminalsMap,[t]:{...c,connected:r}}}})},setTerminalResumed:(t,r)=>{n(o=>{const c=o.terminalsMap[t];return!c||c.sessionResumed===r?o:{terminalsMap:{...o.terminalsMap,[t]:{...c,sessionResumed:r}}}})},setTerminalError:(t,r)=>{n(o=>{const c=o.terminalsMap[t];return!c||c.error===r?o:{terminalsMap:{...o.terminalsMap,[t]:{...c,error:r}}}})},toggleChat:t=>{const r=e(),o=r.terminalsMap[t];if(!o)return;const c={...o.panels,chatOpen:!o.panels.chatOpen},i={...r.terminalsMap,[t]:{...o,panels:c}},u=r.tabs.find(f=>f.terminalIds.includes(t));let l=r.tabs;if(u){const f={...u.panelStates,[t]:c};l=Ce(r.tabs,u.id,p=>({...p,panelStates:f}))}n({terminalsMap:i,tabs:l}),le(ie(e()))},togglePlan:t=>{const r=e(),o=r.terminalsMap[t];if(!o)return;const c={...o.panels,planOpen:!o.panels.planOpen},i={...r.terminalsMap,[t]:{...o,panels:c}},u=r.tabs.find(f=>f.terminalIds.includes(t));let l=r.tabs;if(u){const f={...u.panelStates,[t]:c};l=Ce(r.tabs,u.id,p=>({...p,panelStates:f}))}n({terminalsMap:i,tabs:l}),le(ie(e()))},setSplitSizes:(t,r)=>{const o=e(),c=Ge(o);if(!c||!c.layout)return;const i=Pt(c.layout,t,r),u=Ce(o.tabs,c.id,l=>({...l,layout:i}));n({layout:i,tabs:u}),Un(ie(e()))},fontSize:14,setFontSize:t=>{const r=Math.max(10,Math.min(24,t));n({fontSize:r}),$e&&clearTimeout($e),$e=setTimeout(()=>{$e=null;const o=e().token;o&&On(o,r)},500)},latency:null,setLatency:t=>n({latency:t}),theme:(()=>{try{const t=localStorage.getItem("ai-cli-online-theme");if(t==="light"||t==="dark")return t}catch{}return"dark"})(),setTheme:t=>{n({theme:t});try{localStorage.setItem("ai-cli-online-theme",t)}catch{}document.documentElement.setAttribute("data-theme",t)},toggleTheme:()=>{const t=e().theme==="dark"?"light":"dark";e().setTheme(t)},sidebarOpen:!1,toggleSidebar:()=>n(t=>({sidebarOpen:!t.sidebarOpen})),serverSessions:[],fetchSessions:async()=>{const t=e().token;if(t)try{const r=await fetch(`${te}/api/sessions`,{headers:ne(t)});if(!r.ok)return;const o=await r.json();n({serverSessions:o})}catch{}},killServerSession:async t=>{const r=e().token;if(!r)return;try{await fetch(`${te}/api/sessions/${encodeURIComponent(t)}`,{method:"DELETE",headers:ne(r)})}catch{}const o=bt(e(),t);o&&(n(o),le(ie(e()))),setTimeout(()=>e().fetchSessions(),500)}}));typeof document<"u"&&document.documentElement.setAttribute("data-theme",D.getState().theme);async function Kn(n,e){var o,c;const{setState:t,getState:r}=D;try{const[i,u]=await Promise.all([Fn(n),fetch(`${te}/api/sessions`,{headers:ne(n)}).then(k=>k.ok?k.json():[]).catch(()=>[])]);if(r().token!==n)return;const l=i&&((o=i.tabs)==null?void 0:o.length)>0?i:e;if(!l||l.tabs.length===0){t({tabsLoading:!1});return}const f=Hn(l,u);if(!f){t({tabsLoading:!1,terminalsMap:{},tabs:[],activeTabId:"",nextId:l.nextId,nextSplitId:l.nextSplitId,nextTabId:l.nextTabId,terminalIds:[],layout:null});return}const p=r().terminalsMap,m={};for(const k of f.tabs)if(k.status==="open")for(const M of k.terminalIds)m[M]=p[M]||{id:M,connected:!1,sessionResumed:!1,error:null,panels:((c=k.panelStates)==null?void 0:c[M])||{chatOpen:!1,planOpen:!1}};const h=f.tabs.find(k=>k.id===f.activeTabId&&k.status==="open")||f.tabs.find(k=>k.status==="open"),b=(h==null?void 0:h.id)||"";t({tabsLoading:!1,terminalsMap:m,tabs:f.tabs,activeTabId:b,nextId:f.nextId,nextSplitId:f.nextSplitId,nextTabId:f.nextTabId,terminalIds:(h==null?void 0:h.terminalIds)||[],layout:(h==null?void 0:h.layout)||null}),le(ie(r()))}catch{r().token===n&&t({tabsLoading:!1})}}function Jn(){const[n,e]=a.useState(""),t=D(o=>o.setToken),r=o=>{o.preventDefault(),n.trim()&&t(n.trim())};return s.jsx("div",{style:{minHeight:"100vh",backgroundColor:"var(--bg-primary)",display:"flex",alignItems:"center",justifyContent:"center",padding:"16px",background:"radial-gradient(ellipse at 50% 0%, rgba(122, 162, 247, 0.08) 0%, var(--bg-primary) 70%)"},children:s.jsxs("div",{className:"login-card",style:{backgroundColor:"var(--bg-tertiary)",borderRadius:"12px",padding:"40px 36px",width:"100%",maxWidth:"400px",border:"1px solid var(--border)"},children:[s.jsxs("div",{style:{textAlign:"center",marginBottom:"36px"},children:[s.jsx("div",{style:{width:"56px",height:"56px",margin:"0 auto 16px",borderRadius:"14px",background:"linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"24px",color:"var(--bg-primary)",fontWeight:"bold",boxShadow:"0 4px 16px rgba(122, 162, 247, 0.3)"},children:">_"}),s.jsx("h1",{style:{fontSize:"22px",fontWeight:"bold",color:"var(--text-bright)",marginBottom:"6px",letterSpacing:"0.5px"},children:"AI-Cli Online"}),s.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"13px"},children:"Terminal in your browser"})]}),s.jsxs("form",{onSubmit:r,children:[s.jsxs("div",{style:{marginBottom:"20px"},children:[s.jsx("label",{htmlFor:"token",style:{display:"block",fontSize:"12px",color:"var(--accent-blue)",marginBottom:"8px",fontWeight:500,textTransform:"uppercase",letterSpacing:"0.5px"},children:"Auth Token"}),s.jsx("input",{type:"password",id:"token",className:"login-input",value:n,onChange:o=>e(o.target.value),placeholder:"Enter your AUTH_TOKEN",autoFocus:!0,autoComplete:"current-password",style:{width:"100%",padding:"11px 14px",backgroundColor:"var(--bg-primary)",color:"var(--text-bright)",border:"1px solid var(--border)",borderRadius:"8px",fontSize:"14px",outline:"none"}})]}),s.jsx("button",{type:"submit",className:"login-submit",disabled:!n.trim(),style:{width:"100%",padding:"11px",background:n.trim()?"linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-cyan) 100%)":"var(--bg-hover)",color:n.trim()?"var(--bg-primary)":"var(--text-secondary)",border:"none",borderRadius:"8px",fontSize:"14px",fontWeight:600,cursor:n.trim()?"pointer":"not-allowed",letterSpacing:"0.3px"},children:"Connect"})]}),s.jsx("div",{style:{marginTop:"28px",textAlign:"center",color:"var(--scrollbar-thumb-hover)",fontSize:"11px"},children:s.jsxs("p",{children:["Token is configured in"," ",s.jsx("code",{style:{backgroundColor:"var(--bg-primary)",padding:"2px 6px",borderRadius:"4px",border:"1px solid var(--border)",fontSize:"11px"},children:"server/.env"})]})})]})})}const qe=new Map;function qn(n,e,t){qe.set(n,{onChunk:e,onControl:t})}function Vn(n){qe.delete(n)}function Yn(n,e){var t;(t=qe.get(n))==null||t.onChunk(e)}function Gn(n,e){var t;(t=qe.get(n))==null||t.onControl(e)}const Xn=1,gt=2,Zn=3,Qn=4,er=5,tr=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`,_e=500,nr=8e3,rr=1e4,xt=4e3,or=5e3,sr=10,ar=64*1024,ir=new TextDecoder,lr=new TextEncoder;function yt(n,e){const t=lr.encode(e),r=new Uint8Array(1+t.length);return r[0]=n,r.set(t,1),r.buffer}function cr(n,e,t){const r=a.useRef(null),o=a.useRef(_e),c=a.useRef(null),i=a.useRef(null),u=a.useRef(null),l=a.useRef(null),f=a.useRef(!1),p=a.useRef(t),m=a.useRef(!1),h=a.useRef(0),b=a.useRef(!0),k=a.useRef(!navigator.onLine),M=a.useRef(""),C=a.useRef(null),j=a.useRef("");p.current=t;const x=a.useCallback(()=>{i.current&&(clearInterval(i.current),i.current=null),u.current&&(clearTimeout(u.current),u.current=null),c.current&&(clearTimeout(c.current),c.current=null),l.current&&(clearTimeout(l.current),l.current=null),C.current&&(clearTimeout(C.current),C.current=null)},[]),$=a.useCallback(()=>{var J;const{token:O,setTerminalError:T}=D.getState();if(!O||f.current)return;if(r.current){const H=r.current.readyState;if(H===WebSocket.OPEN||H===WebSocket.CONNECTING)return}m.current=!1;const v=(J=D.getState().terminalsMap[e])==null?void 0:J.startCwd;let z=`${tr}?sessionId=${encodeURIComponent(e)}`;v&&(z+=`&cwd=${encodeURIComponent(v)}`);const w=new WebSocket(z);w.binaryType="arraybuffer",l.current=window.setTimeout(()=>{w.readyState===WebSocket.CONNECTING&&w.close()},or);const Y=()=>{w.readyState===WebSocket.OPEN&&(h.current=performance.now(),w.send(JSON.stringify({type:"ping"})),u.current=window.setTimeout(()=>{h.current>0&&(h.current=0,w.close())},xt))};w.onopen=()=>{l.current&&(clearTimeout(l.current),l.current=null),w.send(JSON.stringify({type:"auth",token:O})),T(e,null),o.current=_e,b.current=!0},w.onclose=H=>{const{setTerminalConnected:L,setTerminalError:N,setToken:V}=D.getState();if(L(e,!1),x(),m.current)return;if(H.code===4001){f.current=!0,N(e,"Authentication failed"),V(null),localStorage.removeItem("ai-cli-online-token");return}if(H.code===4002)return;if(H.code===4005){N(e,"Connection limit reached");return}if(!navigator.onLine){k.current=!0;return}if(b.current){b.current=!1,c.current=window.setTimeout(()=>$(),50);return}const K=o.current;o.current=Math.min(K*2,nr);const q=Math.round(K*(.5+Math.random()));c.current=window.setTimeout(()=>{$()},q)},w.onerror=()=>{},w.onmessage=H=>{var L;try{const N=n.current;if(H.data instanceof ArrayBuffer){const K=new Uint8Array(H.data);if(K.length<1)return;const q=K[0],Z=K.subarray(1);switch(q){case Xn:N==null||N.write(Z);break;case Zn:N==null||N.write(Z);break;case Qn:{(L=p.current)==null||L.call(p,ir.decode(Z));break}case er:{Yn(e,Z);break}}return}const V=JSON.parse(H.data);switch(V.type){case"connected":{const K=D.getState();K.setTerminalConnected(e,!0),K.setTerminalResumed(e,V.resumed);const q=n.current;q&&w.readyState===WebSocket.OPEN&&w.send(JSON.stringify({type:"resize",cols:q.cols,rows:q.rows})),j.current&&(w.send(yt(gt,j.current)),j.current=""),Y(),i.current=window.setInterval(Y,rr);break}case"error":D.getState().setTerminalError(e,V.error);break;case"pong":{if(u.current&&(clearTimeout(u.current),u.current=null),h.current>0){const K=Math.round(performance.now()-h.current),q=D.getState();(q.terminalIds.length===0||q.terminalIds[0]===e)&&q.setLatency(K),h.current=0}break}case"file-stream-start":case"file-stream-end":case"file-stream-error":Gn(e,V);break}}catch{}},r.current=w},[e,n,x]),E=a.useCallback(O=>{const T=r.current;if(!T||T.readyState!==WebSocket.OPEN){j.current.length<ar&&(j.current+=O);return}M.current+=O,C.current||(C.current=window.setTimeout(()=>{const v=M.current;M.current="",C.current=null,v&&T.readyState===WebSocket.OPEN&&T.send(yt(gt,v))},sr))},[]),P=a.useCallback((O,T)=>{var v;((v=r.current)==null?void 0:v.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({type:"resize",cols:O,rows:T}))},[]),R=a.useCallback(()=>{var O;((O=r.current)==null?void 0:O.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({type:"capture-scrollback"}))},[]),F=a.useCallback(O=>{var T;((T=r.current)==null?void 0:T.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({type:"stream-file",path:O}))},[]),W=a.useCallback(()=>{var O;((O=r.current)==null?void 0:O.readyState)===WebSocket.OPEN&&r.current.send(JSON.stringify({type:"cancel-stream"}))},[]);return a.useEffect(()=>{D.getState().token&&(f.current=!1,$());const T=()=>{k.current=!1,o.current=_e,b.current=!0;const w=r.current;(!w||w.readyState===WebSocket.CLOSED||w.readyState===WebSocket.CLOSING)&&$()},v=()=>{k.current=!0},z=()=>{if(document.visibilityState!=="visible")return;const w=r.current;if(!w||w.readyState!==WebSocket.OPEN){!k.current&&!m.current&&(o.current=_e,b.current=!0,$());return}h.current=performance.now(),w.send(JSON.stringify({type:"ping"})),u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{h.current>0&&(h.current=0,w.close())},xt)};return window.addEventListener("online",T),window.addEventListener("offline",v),document.addEventListener("visibilitychange",z),()=>{m.current=!0,x(),window.removeEventListener("online",T),window.removeEventListener("offline",v),document.removeEventListener("visibilitychange",z),r.current&&(r.current.close(),r.current=null)}},[$,x,e]),{sendInput:E,sendResize:P,requestScrollback:R,requestFileStream:F,cancelFileStream:W}}function dr(n){const e=a.useRef(null),t=a.useRef(null),r=a.useRef(n);r.current=n;const o=a.useCallback(()=>{t.current&&(clearTimeout(t.current),t.current=null),e.current&&(e.current.remove(),e.current=null)},[]),c=a.useCallback((i,u)=>{o();const l=document.createElement("div");l.style.cssText=`position:fixed;left:${i}px;top:${u}px;z-index:1000;display:flex;align-items:center;gap:4px;padding:4px 6px;background:var(--bg-tertiary);border:1px solid var(--border);border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,0.4);font-family:inherit;`;const f=document.createElement("textarea");f.style.cssText="width:90px;height:22px;resize:none;border:1px solid var(--border);border-radius:3px;background:var(--bg-primary);color:var(--text-primary);font-size:11px;font-family:inherit;padding:2px 4px;outline:none;",f.placeholder="Ctrl+V",f.addEventListener("paste",p=>{var h;p.preventDefault();const m=(h=p.clipboardData)==null?void 0:h.getData("text/plain");m&&r.current(m),o()}),f.addEventListener("keydown",p=>{p.key==="Escape"&&o()}),l.appendChild(f),document.body.appendChild(l),e.current=l,requestAnimationFrame(()=>{const p=l.getBoundingClientRect();p.right>window.innerWidth&&(l.style.left=`${window.innerWidth-p.width-8}px`),p.bottom>window.innerHeight&&(l.style.top=`${window.innerHeight-p.height-8}px`),f.focus()}),t.current=setTimeout(o,8e3)},[o]);return a.useEffect(()=>{const i=()=>{e.current&&o()};return document.addEventListener("click",i),()=>{document.removeEventListener("click",i),o()}},[o]),{showPasteFloat:c,removePasteFloat:o}}const We={background:"#000000",foreground:"#cccccc",cursor:"#aeafad",selectionBackground:"rgba(38, 79, 120, 0.5)",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#e5e5e5"},He={background:"#faf8f4",foreground:"#3b3b3b",cursor:"#1e1e1e",selectionBackground:"rgba(173, 214, 255, 0.5)",black:"#000000",red:"#cd3131",green:"#00bc00",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#14ce14",brightYellow:"#b5ba00",brightBlue:"#0451a5",brightMagenta:"#bc05bc",brightCyan:"#0598bc",brightWhite:"#a5a5a5"},Bt="'JetBrains Mono', Menlo, Monaco, 'Courier New', monospace",ur=a.forwardRef(function({sessionId:e},t){const r=a.useRef(null),o=a.useRef(null),c=a.useRef(null),[i,u]=a.useState(!1),[l,f]=a.useState(""),p=D(R=>R.fontSize),m=D(R=>R.theme),h=a.useCallback(R=>{f(R),u(!0)},[]),{sendInput:b,sendResize:k,requestScrollback:M,requestFileStream:C,cancelFileStream:j}=cr(o,e,h);a.useImperativeHandle(t,()=>({sendInput:b,requestFileStream:C,cancelFileStream:j}),[b,C,j]);const x=a.useRef(b),$=a.useRef(k);x.current=b,$.current=k;const{showPasteFloat:E,removePasteFloat:P}=dr(R=>x.current(R));return a.useEffect(()=>{if(!r.current)return;let R=!1,F=null,W=null,O=null,T=null;if(R||!r.current)return;const v=new It({cursorBlink:!0,scrollback:1e4,fontSize:D.getState().fontSize,fontFamily:Bt,theme:D.getState().theme==="dark"?We:He,allowProposedApi:!0}),z=new jt;v.loadAddon(z),v.loadAddon(new nn((N,V)=>{window.open(V,"_blank","noopener,noreferrer")})),v.open(r.current);try{const N=new Rt;N.onContextLoss(()=>{N.dispose()}),v.loadAddon(N)}catch{}o.current=v,c.current=z,v.onSelectionChange(()=>{const N=v.getSelection();N&&navigator.clipboard.writeText(N).catch(()=>{})});const w=v.element,Y=N=>{var V;if(N.preventDefault(),P(),!((V=navigator.clipboard)!=null&&V.readText)){E(N.clientX,N.clientY);return}navigator.clipboard.readText().then(K=>{K&&x.current(K)}).catch(()=>{E(N.clientX,N.clientY)})};w&&w.addEventListener("contextmenu",Y);const J=()=>{try{const N=r.current;if(N&&N.clientWidth>0&&N.clientHeight>0)return z.fit(),$.current(v.cols,v.rows),!0}catch{}return!1};requestAnimationFrame(()=>J());let H=0;F=setInterval(()=>{H++,(J()||H>=10)&&(clearInterval(F),F=null)},100),document.fonts.ready.then(()=>{if(!R)try{z.fit(),$.current(v.cols,v.rows)}catch{}}),v.onData(N=>{x.current(N)});let L=!1;return T=new ResizeObserver(()=>{if(document.body.classList.contains("resizing-panes")||document.body.classList.contains("resizing-panes-v")){if(!L){L=!0;const V=()=>{document.removeEventListener("mouseup",V),L=!1,requestAnimationFrame(()=>{try{z.fit(),$.current(v.cols,v.rows)}catch{}})};document.addEventListener("mouseup",V)}return}W||(W=requestAnimationFrame(()=>{W=null;try{z.fit(),O&&clearTimeout(O),O=setTimeout(()=>{O=null,$.current(v.cols,v.rows)},50)}catch{}}))}),T.observe(r.current),()=>{R=!0,F&&clearInterval(F),W&&cancelAnimationFrame(W),O&&clearTimeout(O),T&&T.disconnect(),P(),w&&w.removeEventListener("contextmenu",Y),o.current&&(o.current.dispose(),o.current=null),c.current=null}},[e]),a.useEffect(()=>{const R=o.current,F=c.current;if(!(!R||!F)&&R.options.fontSize!==p){R.options.fontSize=p;try{F.fit()}catch{}$.current(R.cols,R.rows)}},[p]),a.useEffect(()=>{o.current&&(o.current.options.theme=m==="dark"?We:He)},[m]),s.jsxs("div",{style:{width:"100%",height:"100%",position:"relative"},children:[s.jsx("div",{ref:r,style:{width:"100%",height:"100%",backgroundColor:"var(--bg-primary)",contain:"strict",willChange:"transform",isolation:"isolate"}}),s.jsx("button",{tabIndex:-1,onClick:R=>{R.currentTarget.blur(),i?(u(!1),f("")):M()},title:"Toggle scrollback history",style:{position:"absolute",top:4,right:4,zIndex:10,background:i?"var(--accent-blue)":"rgba(65, 72, 104, 0.7)",color:"var(--text-bright)",border:"none",borderRadius:4,padding:"2px 8px",fontSize:14,cursor:"pointer",opacity:.8,lineHeight:"20px"},onMouseEnter:R=>{R.currentTarget.style.opacity="1"},onMouseLeave:R=>{R.currentTarget.style.opacity="0.8"},children:i?"✕":s.jsx("span",{style:{fontSize:14},children:"👁"})}),i&&s.jsx(fr,{data:l,onClose:()=>{u(!1),f("")}})]})});function fr({data:n,onClose:e}){const t=a.useRef(null),r=a.useRef(e);r.current=e;const o=D(f=>f.fontSize),c=D(f=>f.theme),i=a.useRef(null),u=a.useRef(null);a.useEffect(()=>{if(!t.current)return;const f=new It({cursorBlink:!1,disableStdin:!0,scrollback:5e4,fontSize:o,fontFamily:Bt,theme:c==="dark"?We:He});i.current=f;const p=new jt;u.current=p,f.loadAddon(p),f.open(t.current);try{const C=new Rt;C.onContextLoss(()=>C.dispose()),f.loadAddon(C)}catch{}f.onSelectionChange(()=>{const C=f.getSelection();C&&navigator.clipboard.writeText(C).catch(()=>{})}),f.attachCustomKeyEventHandler(C=>(C.key==="Escape"&&r.current(),!1)),f.write(n);let m=null;const h=()=>{const C=t.current;if(!C||C.clientWidth<=0||C.clientHeight<=0)return!1;try{return p.fit(),f.scrollToBottom(),!0}catch{return!1}};requestAnimationFrame(()=>{if(!h()){let C=0;m=setInterval(()=>{C++,(h()||C>=30)&&(clearInterval(m),m=null)},50)}});let b=null;const k=new ResizeObserver(()=>{b||(b=requestAnimationFrame(()=>{b=null,h()}))});k.observe(t.current);const M=C=>{C.key==="Escape"&&r.current()};return document.addEventListener("keydown",M),()=>{m&&clearInterval(m),b&&cancelAnimationFrame(b),document.removeEventListener("keydown",M),k.disconnect(),f.dispose(),i.current=null,u.current=null}},[n]),a.useEffect(()=>{var f;if(i.current){i.current.options.fontSize=o;try{(f=u.current)==null||f.fit()}catch{}}},[o]),a.useEffect(()=>{i.current&&(i.current.options.theme=c==="dark"?We:He)},[c]);const l=28;return s.jsxs("div",{style:{position:"absolute",inset:0,zIndex:5,backgroundColor:"var(--bg-primary)"},children:[s.jsx("div",{style:{height:l,boxSizing:"border-box",padding:"0 12px",background:"var(--bg-tertiary)",color:"var(--accent-blue)",fontSize:12,borderBottom:"1px solid var(--scrollbar-thumb-hover)",display:"flex",alignItems:"center"},children:s.jsx("span",{children:"Scrollback History (mouse wheel to scroll, ESC to close)"})}),s.jsx("div",{ref:t,style:{position:"absolute",top:l,left:0,right:0,bottom:0,overflow:"hidden"}})]})}const pr=50;function nt(){const n=a.useRef([]),e=a.useCallback(o=>{n.current.push(o),n.current.length>pr&&n.current.shift()},[]),t=a.useCallback(()=>n.current.pop(),[]),r=a.useCallback(()=>{n.current=[]},[]);return a.useMemo(()=>({pushUndo:e,popUndo:t,clearUndo:r}),[e,t,r])}function rt(n,e,t){n.preventDefault();const r=n.currentTarget,o=r.selectionStart,c=r.selectionEnd,i=r.value;t==null||t(i);const u=i.slice(0,o)+" "+i.slice(c);e(u),requestAnimationFrame(()=>{r.selectionStart=r.selectionEnd=o+2})}function ot(n,e=10){var t;return Math.min(e,Math.max(1,(((t=n.match(/\n/g))==null?void 0:t.length)??0)+1))}let Me=null;const mr=["https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs","https://unpkg.com/mermaid@11/dist/mermaid.esm.min.mjs"];function hr(n){return n.initialize({startOnLoad:!1,theme:"dark",themeVariables:{primaryColor:"#7aa2f7",primaryTextColor:"#c0caf5",primaryBorderColor:"#414868",lineColor:"#565f89",secondaryColor:"#bb9af7",tertiaryColor:"#24283b",background:"#1a1b26",mainBkg:"#24283b",nodeBorder:"#414868",clusterBkg:"#1e2030",titleColor:"#c0caf5",edgeLabelBackground:"#1e2030",gridColor:"#292e42",doneTaskBkgColor:"#9ece6a",doneTaskBorderColor:"#73a942",activeTaskBkgColor:"#7aa2f7",activeTaskBorderColor:"#5d87d6",critBkgColor:"#f7768e",critBorderColor:"#d35d72",taskBkgColor:"#414868",taskBorderColor:"#565f89",taskTextColor:"#c0caf5",taskTextDarkColor:"#1a1b26",sectionBkgColor:"#1e2030",sectionBkgColor2:"#24283b",altSectionBkgColor:"#1e2030",todayLineColor:"#e0af68"},gantt:{titleTopMargin:15,barHeight:24,barGap:6,topPadding:40,numberSectionStyles:4,useWidth:800}}),n}function br(){return Me||(Me=(async()=>{for(const n of mr)try{const e=await import(n);return hr(e.default)}catch{}throw Me=null,new Error("All mermaid CDN sources failed")})(),Me)}let gr=0;function xr(n,e){a.useEffect(()=>{const t=n.current;if(!t)return;const r=t.querySelectorAll("code.language-mermaid, code.language-gantt");if(r.length===0)return;let o=!1;return(async()=>{let c;try{c=await br()}catch{if(o)return;for(const u of r){const l=u.parentElement;if(!l||l.tagName!=="PRE")continue;l.classList.add("mermaid-error");const f=document.createElement("div");f.className="mermaid-error__msg",f.textContent="Failed to load Mermaid library",l.appendChild(f)}return}if(!o)for(const i of r){if(o)break;const u=i.parentElement;if(!u||u.tagName!=="PRE")continue;const l=i.textContent||"";if(!l.trim())continue;const f=`mermaid-${++gr}`;try{const{svg:p}=await c.render(f,l);if(o)break;const m=document.createElement("div");m.className="mermaid-diagram",m.innerHTML=Nt.sanitize(p,{USE_PROFILES:{svg:!0,svgFilters:!0},ADD_TAGS:["foreignObject"]}),u.replaceWith(m)}catch{if(o)break;u.classList.add("mermaid-error");const p=document.createElement("div");p.className="mermaid-error__msg",p.textContent="Mermaid syntax error",u.appendChild(p)}}})(),()=>{o=!0}},[e])}async function yr(n,e,t){const r=await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/annotations?path=${encodeURIComponent(t)}`,{headers:ne(n)});if(!r.ok)throw new Error("Failed to fetch annotation");const o=await r.json();return o.content?{content:o.content,updatedAt:o.updatedAt}:null}async function vr(n,e,t,r,o){if(!(await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/annotations`,{method:"PUT",headers:{...ne(n),"Content-Type":"application/json"},body:JSON.stringify({path:t,content:r,updatedAt:o})})).ok)throw new Error("Failed to save annotation")}function Ut(n,e){let t=n.replace(/<[^>]*>/g,"").trim().toLowerCase().replace(/\s+/g,"-").replace(/[&<>"'`]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"");t||(t="heading");const r=e.get(t)||0;return r>0&&(t=`${t}-${r}`),e.set(t,r+1),t}function Wt(n){return n.replace(/\*\*(.+?)\*\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").replace(/`(.+?)`/g,"$1").replace(/\[(.+?)\]\(.*?\)/g,"$1").trim()}function wr(n){if(!n)return[];const e=[],t=new Map,r=n.split(`
|
|
26
|
+
`);let o=!1;for(const c of r){if(/^```/.test(c.trim())){o=!o;continue}if(o)continue;const i=c.match(/^(#{1,6})\s+(.+?)(?:\s+#+)?\s*$/);if(i){const u=i[1].length,l=Wt(i[2]),f=Ut(l,t);e.push({id:f,text:l,level:u})}}return e}const Sr=160,kr=22;function Cr({headings:n,scrollRef:e}){const[t,r]=a.useState(null),[o,c]=a.useState(()=>localStorage.getItem("md-toc-collapsed")==="true"),i=a.useRef(null),u=a.useRef(!1),l=a.useMemo(()=>Math.min(...n.map(m=>m.level)),[n]),f=a.useCallback(()=>{c(m=>{const h=!m;try{localStorage.setItem("md-toc-collapsed",String(h))}catch{}return h})},[]);a.useEffect(()=>{const m=e.current;if(!m||n.length===0)return;const h=()=>{u.current=!1;const k=m.scrollTop,M=50;let C=null;for(const j of n){const x=m.querySelector(`[id="${CSS.escape(j.id)}"]`);x&&x.offsetTop<=k+M&&(C=j.id)}r(C)},b=()=>{u.current||(u.current=!0,requestAnimationFrame(h))};return h(),m.addEventListener("scroll",b,{passive:!0}),()=>m.removeEventListener("scroll",b)},[n,e]);const p=a.useCallback(m=>{const h=e.current;if(!h)return;const b=h.querySelector(`[id="${CSS.escape(m)}"]`);b&&(b.scrollIntoView({behavior:"smooth",block:"start"}),r(m))},[e]);return a.useEffect(()=>{if(!t||o)return;const m=i.current;if(!m)return;const h=m.querySelector(`[data-toc-id="${CSS.escape(t)}"]`);if(h){const b=h.offsetTop-m.offsetTop,k=b+h.offsetHeight;(b<m.scrollTop||k>m.scrollTop+m.clientHeight)&&h.scrollIntoView({block:"nearest"})}},[t,o]),n.length<2?null:o?s.jsx("div",{style:{width:kr,flexShrink:0,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:4,borderLeft:"1px solid var(--border)",backgroundColor:"var(--bg-secondary)"},children:s.jsx("button",{onClick:f,title:"Show table of contents",style:{background:"none",border:"none",color:"var(--text-secondary)",fontSize:13,cursor:"pointer",padding:"2px",lineHeight:1},onMouseEnter:m=>{m.currentTarget.style.color="var(--accent-blue)"},onMouseLeave:m=>{m.currentTarget.style.color="var(--text-secondary)"},children:"☰"})}):s.jsxs("div",{ref:i,style:{width:Sr,flexShrink:0,borderLeft:"1px solid var(--border)",backgroundColor:"var(--bg-secondary)",overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 6px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[s.jsx("span",{style:{fontSize:10,color:"var(--border)",textTransform:"uppercase",letterSpacing:"0.5px"},children:"Contents"}),s.jsx("button",{onClick:f,title:"Hide table of contents",style:{background:"none",border:"none",color:"var(--text-secondary)",fontSize:12,cursor:"pointer",padding:"0 2px",lineHeight:1},onMouseEnter:m=>{m.currentTarget.style.color="var(--accent-blue)"},onMouseLeave:m=>{m.currentTarget.style.color="var(--text-secondary)"},children:"»"})]}),s.jsx("div",{style:{flex:1,overflowY:"auto",padding:"4px 0"},children:n.map((m,h)=>s.jsx("div",{"data-toc-id":m.id,onClick:()=>p(m.id),style:{padding:`2px 6px 2px ${(m.level-l)*10+6}px`,fontSize:11,lineHeight:1.5,color:t===m.id?"var(--accent-blue)":"var(--text-secondary)",cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderLeft:t===m.id?"2px solid var(--accent-blue)":"2px solid transparent",fontWeight:m.level<=2?500:400,transition:"color 0.1s"},title:m.text,onMouseEnter:b=>{t!==m.id&&(b.currentTarget.style.color="var(--text-primary)"),b.currentTarget.style.backgroundColor="var(--bg-tertiary)"},onMouseLeave:b=>{t!==m.id&&(b.currentTarget.style.color="var(--text-secondary)"),b.currentTarget.style.backgroundColor="transparent"},children:m.text},`${m.id}-${h}`))})]})}const Xe={additions:[],deletions:[]};let Tr=0;function Oe(){return`ann_${++Tr}_${Date.now()}`}function Fe(n,e){return`plan-annotations-${n}-${e}`}function vt(n,e){return`plan-scroll-${n}-${e}`}function Er(n){const e=Dt.parser([n],{async:!1});return Nt.sanitize(e,{ADD_TAGS:["img"],ADD_ATTR:["src","alt","title","width","height"]})}function Ze(n,e){let t=1;for(let r=0;r<e&&r<n.length;r++){const o=n[r].raw??"";for(const c of o)c===`
|
|
27
|
+
`&&t++}return t}function Pe(n){if(!n)return"";const e=n.trim();return e.length<=40?e:e.slice(0,20)+"..."+e.slice(-20)}function Ir(n,e){const t=[],r=[];for(const o of n.additions){const c=e[o.sourceLine-1]??"",i=e[o.sourceLine]??"";t.push([`${o.sourceLine}: ${Pe(c)}`,o.content,Pe(i)])}for(const o of n.deletions){const c=e[o.startLine-2]??"",i=e[o.endLine]??"";r.push([`${o.startLine}: ${Pe(c)}`,o.selectedText,Pe(i)])}return{"Insert Annotations":t,"Delete Annotations":r}}function Qe(n,e,t){if(e.additions.length===0&&e.deletions.length===0)return"";const r=JSON.stringify(Ir(e,t));return`/aicli-task-review ${n} ${r}`}const jr=a.forwardRef(function({markdown:e,filePath:t,sessionId:r,token:o,onExecute:c,onSend:i,onRefresh:u,onClose:l,expanded:f,readOnly:p},m){const h=D(g=>g.fontSize),b=a.useMemo(()=>e?Dt.lexer(e):[],[e]),k=a.useMemo(()=>e.split(`
|
|
28
|
+
`),[e]),M=a.useMemo(()=>wr(e),[e]),C=a.useMemo(()=>{const g=new Map,S=new Map;return b.forEach((A,B)=>{if(A.type==="heading"){const d=Wt(A.text||""),y=Ut(d,S);g.set(B,y)}}),g},[b]),j=a.useRef(new Set),[x,$]=a.useState(()=>{try{const g=localStorage.getItem(Fe(r,t)),S=g?JSON.parse(g):Xe,A=new Set;return S.additions.forEach(B=>A.add(B.id)),S.deletions.forEach(B=>A.add(B.id)),j.current=A,S}catch{return Xe}}),E=D(g=>g.latency),P=a.useRef(void 0),R=a.useRef(void 0),F=a.useRef(!1),W=a.useRef(!1);a.useEffect(()=>{if(!W.current)return;const g=Fe(r,t),S=JSON.stringify(x);P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{try{localStorage.setItem(g,S)}catch{}},50),R.current&&clearTimeout(R.current);const A=Math.max(200,(E??30)*3);return R.current=setTimeout(()=>{F.current||(F.current=!0,vr(o,r,t,S,Date.now()).catch(()=>{}).finally(()=>{F.current=!1}))},A),()=>{P.current&&clearTimeout(P.current),R.current&&clearTimeout(R.current)}},[x,r,t,o,E]),a.useEffect(()=>{W.current=!1;let g=Xe,S=0;try{const d=localStorage.getItem(Fe(r,t));d&&(g=JSON.parse(d),S=Date.now())}catch{}$(g);const A=new Set;g.additions.forEach(d=>A.add(d.id)),g.deletions.forEach(d=>A.add(d.id)),j.current=A;let B=!1;return yr(o,r,t).then(d=>{if(!B&&d&&d.updatedAt>S)try{const y=JSON.parse(d.content);$(y);try{localStorage.setItem(Fe(r,t),d.content)}catch{}const U=new Set;y.additions.forEach(G=>U.add(G.id)),y.deletions.forEach(G=>U.add(G.id)),j.current=U}catch{}}).catch(()=>{}).finally(()=>{W.current=!0}),W.current=!0,()=>{B=!0}},[r,t,o]);const[O,T]=a.useState(0),v=a.useMemo(()=>{const g=j.current,S=x.additions.length+x.deletions.length;let A=0;return x.additions.forEach(B=>{g.has(B.id)&&A++}),x.deletions.forEach(B=>{g.has(B.id)&&A++}),{total:S,sent:A,unsent:S-A}},[x,O]),[z,w]=a.useState(null),[Y,J]=a.useState(""),H=a.useRef(null),[L,N]=a.useState(null),[V,K]=a.useState(""),q=a.useRef(null),[Z,Q]=a.useState(null),ee=a.useRef(null);a.useEffect(()=>()=>{const g=ee.current;g&&g.scrollTop>0&&localStorage.setItem(vt(r,t),String(g.scrollTop))},[r,t]),a.useEffect(()=>{if(!b.length)return;const g=localStorage.getItem(vt(r,t));g&&requestAnimationFrame(()=>{const S=ee.current;S&&(S.scrollTop=Number(g))})},[r,t,b.length]),a.useEffect(()=>{z!=null&&requestAnimationFrame(()=>{var g;return(g=H.current)==null?void 0:g.focus()})},[z]);const be=a.useCallback(g=>{if(!Y.trim()){w(null),J("");return}const S=Ze(b,g+1);$(A=>({...A,additions:[...A.additions,{id:Oe(),afterTokenIndex:g,sourceLine:S,content:Y.trim()}]})),w(null),J("")},[Y,b]),ge=a.useCallback(g=>{$(S=>({...S,additions:S.additions.filter(A=>A.id!==g)}))},[]),Ie=a.useCallback((g,S)=>{$(A=>({...A,additions:A.additions.map(B=>B.id===g?{...B,id:Oe(),content:S}:B)}))},[]),je=a.useCallback(()=>{var g;Z&&($(S=>({...S,deletions:[...S.deletions,{id:Oe(),tokenIndices:Z.tokenIndices,startLine:Z.startLine,endLine:Z.endLine,selectedText:Z.text.slice(0,80)}]})),Q(null),(g=window.getSelection())==null||g.removeAllRanges())},[Z]),he=a.useCallback(g=>{$(S=>({...S,deletions:S.deletions.filter(A=>A.id!==g)}))},[]),Te=a.useCallback((g,S)=>{$(A=>({...A,deletions:A.deletions.map(B=>B.id===g?{...B,id:Oe(),selectedText:S}:B)}))},[]),ce=a.useCallback(g=>{let S=g instanceof Element?g:g.parentElement;for(;S&&S!==ee.current;){if(S.hasAttribute("data-token-index"))return S;S=S.parentElement}return null},[]),de=a.useCallback(()=>{const g=window.getSelection();if(!g||g.isCollapsed||!ee.current){Q(null);return}const S=g.toString().trim();if(!S){Q(null);return}const A=g.getRangeAt(0);if(!ee.current.contains(A.commonAncestorContainer)){Q(null);return}const B=ce(A.startContainer),d=ce(A.endContainer);if(!B||!d){Q(null);return}const y=parseInt(B.getAttribute("data-token-index")||"0",10),U=parseInt(d.getAttribute("data-token-index")||"0",10),G=[];for(let se=Math.min(y,U);se<=Math.max(y,U);se++)G.push(se);const re=Ze(b,Math.min(y,U)),xe=Ze(b,Math.max(y,U)+1),oe=A.getBoundingClientRect(),ae=ee.current,me=ae.getBoundingClientRect();navigator.clipboard.writeText(S).catch(()=>{}),Q({x:oe.right-me.left+ae.scrollLeft+6,y:oe.top-me.top+ae.scrollTop-2,tokenIndices:G,startLine:re,endLine:xe,text:S})},[b,ce]),ve=a.useRef(void 0);a.useEffect(()=>{const g=()=>{ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>{const S=window.getSelection();if(!S||S.isCollapsed||!ee.current){Q(null);return}const A=S.anchorNode;A&&ee.current.contains(A)&&de()},120)};return document.addEventListener("selectionchange",g),()=>{document.removeEventListener("selectionchange",g),ve.current&&clearTimeout(ve.current)}},[de]),xr(ee,b);const ue=a.useCallback(()=>{const g=j.current;return{additions:x.additions.filter(S=>!g.has(S.id)),deletions:x.deletions.filter(S=>!g.has(S.id))}},[x]),I=a.useCallback(()=>{const g=Qe(t,ue(),k);if(g){c(g);const S=new Set;x.additions.forEach(A=>S.add(A.id)),x.deletions.forEach(A=>S.add(A.id)),j.current=S,T(A=>A+1)}},[ue,x,k,c,t]);a.useImperativeHandle(m,()=>({getSummary:()=>Qe(t,ue(),k),handleEscape:()=>z!=null?(be(z),!0):!1,getScrollTop:()=>{var g;return((g=ee.current)==null?void 0:g.scrollTop)??0},setScrollTop:g=>{requestAnimationFrame(()=>{ee.current&&(ee.current.scrollTop=g)})}}),[ue,k,t,z,be]);const[_,X]=a.useState(!1),fe=a.useRef(null);a.useEffect(()=>{if(!_)return;const g=S=>{fe.current&&!fe.current.contains(S.target)&&X(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[_]);const pe=a.useCallback((g,S)=>{if(!i)return;const A={additions:[],deletions:[]};if(S==="add"){const d=x.additions.find(y=>y.id===g);if(!d)return;A.additions.push(d)}else{const d=x.deletions.find(y=>y.id===g);if(!d)return;A.deletions.push(d)}const B=Qe(t,A,k);B&&i(B),j.current.add(g),T(d=>d+1)},[i,t,x,k]),we=a.useCallback((g,S)=>{S==="add"?ge(g):he(g)},[ge,he]),Ee=a.useMemo(()=>{const g=new Set;return x.deletions.forEach(S=>S.tokenIndices.forEach(A=>g.add(A))),g},[x.deletions]),ke=a.useMemo(()=>{const g=new Map;return x.additions.forEach(S=>{const A=g.get(S.afterTokenIndex)||[];A.push(S),g.set(S.afterTokenIndex,A)}),g},[x.additions]),Se=x.additions.length>0||x.deletions.length>0;return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[s.jsxs("div",{className:"plan-anno-toolbar",children:[s.jsx("span",{style:{fontSize:"11px",color:"var(--text-secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:0},title:t,children:t.split("/").pop()||t}),u&&s.jsx("button",{className:"pane-btn",onClick:u,title:"Refresh current file",children:"↻"}),s.jsx("button",{className:"pane-btn",onClick:I,disabled:!Se,title:"Send all annotations to Chat editor",style:Se?{color:"var(--accent-green)"}:{opacity:.4},children:"Send"}),s.jsxs("div",{ref:fe,style:{position:"relative",flex:1,minWidth:0},children:[s.jsxs("div",{className:`plan-anno-dropdown-trigger${_?" plan-anno-dropdown-trigger--active":""}`,onClick:()=>X(g=>!g),title:v.total>0?`${v.total} annotations (${v.unsent} unsent)`:"No annotations",children:[s.jsx("span",{className:"plan-anno-dropdown-trigger__text",children:(()=>{const g=x.additions[0],S=x.deletions[0],A=g?g.content:S?S.selectedText:"";return A?A.slice(0,40)+(A.length>40?"...":""):""})()}),s.jsx("span",{className:"plan-anno-dropdown-trigger__arrow",children:"▼"})]}),_&&s.jsxs("div",{className:"plan-anno-dropdown",children:[v.unsent>0&&s.jsx("div",{className:"plan-anno-dropdown__header",children:s.jsxs("button",{className:"pane-btn",onClick:I,style:{color:"var(--accent-blue)",fontSize:11},children:["Send All Unsent (",v.unsent,")"]})}),s.jsxs("div",{className:"plan-anno-dropdown__list",children:[x.additions.map(g=>{const S=j.current.has(g.id);return s.jsxs("div",{className:"plan-anno-dropdown__item plan-anno-dropdown__item--add",children:[s.jsx("span",{className:"plan-anno-dropdown__type",style:{color:"var(--accent-yellow)"},children:"+"}),s.jsxs("span",{className:"plan-anno-dropdown__text",children:[g.content.slice(0,60),g.content.length>60?"...":""]}),s.jsx("button",{className:"pane-btn pane-btn--sm",onClick:()=>!S&&pe(g.id,"add"),disabled:S,title:S?"Already sent":"Send to terminal",style:S?{opacity:.3}:{color:"var(--accent-blue)"},children:"Send"}),s.jsx("button",{className:"pane-btn pane-btn--danger pane-btn--sm",onClick:()=>we(g.id,"add"),title:"Delete",children:"×"})]},g.id)}),x.deletions.map(g=>{const S=j.current.has(g.id);return s.jsxs("div",{className:"plan-anno-dropdown__item plan-anno-dropdown__item--del",children:[s.jsx("span",{className:"plan-anno-dropdown__type",style:{color:"var(--accent-red)"},children:"−"}),s.jsxs("span",{className:"plan-anno-dropdown__text",children:[g.selectedText.slice(0,60),g.selectedText.length>60?"...":""]}),s.jsx("button",{className:"pane-btn pane-btn--sm",onClick:()=>!S&&pe(g.id,"del"),disabled:S,title:S?"Already sent":"Send to terminal",style:S?{opacity:.3}:{color:"var(--accent-blue)"},children:"Send"}),s.jsx("button",{className:"pane-btn pane-btn--danger pane-btn--sm",onClick:()=>we(g.id,"del"),title:"Delete",children:"×"})]},g.id)}),v.total===0&&s.jsx("div",{className:"plan-anno-dropdown__empty",children:"No annotations"})]})]})]}),l&&s.jsx("button",{className:"pane-btn pane-btn--danger",onClick:()=>{I(),l()},title:"Send annotations & close file",children:"×"})]}),s.jsxs("div",{style:{display:"flex",flex:1,minHeight:0},children:[s.jsxs("div",{ref:ee,className:`plan-anno-content md-preview${z!=null?" plan-anno-content--editing":""}`,style:{flex:1,overflow:"auto",padding:"8px 12px",position:"relative",fontSize:`${h}px`,minWidth:0},onMouseUp:de,children:[!p&&s.jsx(wt,{index:-1,active:z===-1,additions:ke.get(-1),onOpen:()=>{w(-1),J("")},onSubmit:()=>be(-1),onRemoveAddition:ge,onEditAddition:Ie,onSendSingle:i?g=>pe(g,"add"):void 0,isSent:g=>j.current.has(g),insertText:Y,setInsertText:J,textareaRef:z===-1?H:void 0,expanded:f,alwaysShow:b.length===0,fontSize:h}),b.map((g,S)=>{const A=Er(g);return s.jsxs("div",{children:[s.jsx("div",{"data-token-index":S,id:C.get(S),className:Ee.has(S)?"plan-block--deleted":void 0,dangerouslySetInnerHTML:{__html:A}}),x.deletions.filter(B=>B.tokenIndices.includes(S)&&B.tokenIndices[0]===S).map(B=>s.jsx("div",{className:"plan-deletion-card",children:L===B.id?s.jsx("textarea",{ref:q,className:"plan-annotation-textarea",value:V,onChange:d=>K(d.target.value),onKeyDown:d=>{if(d.key==="Enter"&&(d.ctrlKey||d.metaKey)){d.preventDefault();const y=V.trim();y?Te(B.id,y):he(B.id),N(null)}d.key==="Escape"&&(d.preventDefault(),N(null))},onBlur:()=>{const d=V.trim();d?Te(B.id,d):he(B.id),N(null)},rows:ot(V),style:{fontSize:`${h}px`,flex:1}}):s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{flex:1,fontSize:`${h}px`,color:"var(--accent-red)",whiteSpace:"pre-wrap",cursor:"text"},onDoubleClick:()=>{N(B.id),K(B.selectedText),requestAnimationFrame(()=>{const d=q.current;d&&(d.focus(),d.selectionStart=d.selectionEnd=d.value.length)})},title:"Double-click to edit",children:B.selectedText}),i&&(()=>{const d=j.current.has(B.id);return s.jsx("button",{className:"pane-btn pane-btn--sm",onClick:()=>!d&&pe(B.id,"del"),disabled:d,title:d?"Already sent":"Send to terminal",style:d?{opacity:.3}:{color:"var(--accent-green)"},children:"Send"})})(),s.jsx("button",{className:"pane-btn pane-btn--sm",onClick:()=>{N(B.id),K(B.selectedText),requestAnimationFrame(()=>{const d=q.current;d&&(d.focus(),d.selectionStart=d.selectionEnd=d.value.length)})},style:{color:"var(--accent-blue)"},title:"Edit deletion annotation",children:"✎"}),s.jsx("button",{className:"pane-btn pane-btn--danger pane-btn--sm",onClick:()=>he(B.id),title:"Remove deletion",children:"×"})]})},B.id)),!p&&s.jsx(wt,{index:S,active:z===S,additions:ke.get(S),onOpen:()=>{w(S),J("")},onSubmit:()=>be(S),onRemoveAddition:ge,onEditAddition:Ie,onSendSingle:i?B=>pe(B,"add"):void 0,isSent:B=>j.current.has(B),insertText:Y,setInsertText:J,textareaRef:z===S?H:void 0,expanded:f,fontSize:h})]},S)}),!p&&Z&&s.jsx("button",{className:"plan-delete-float",style:{top:Z.y,left:Z.x},onMouseDown:g=>{g.preventDefault(),je()},children:"−"})]}),s.jsx(Cr,{headings:M,scrollRef:ee})]})]})});function wt({index:n,active:e,additions:t,onOpen:r,onSubmit:o,onRemoveAddition:c,onEditAddition:i,onSendSingle:u,isSent:l,insertText:f,setInsertText:p,textareaRef:m,expanded:h,alwaysShow:b,fontSize:k=14}){const[M,C]=a.useState(null),[j,x]=a.useState(""),$=a.useRef(null),E=nt(),P=nt();a.useEffect(()=>{M&&(E.clearUndo(),requestAnimationFrame(()=>{const v=$.current;v&&(v.focus(),v.selectionStart=v.selectionEnd=v.value.length)}))},[M]),a.useEffect(()=>{e&&P.clearUndo()},[e]);const R=a.useCallback(v=>{x(z=>(E.pushUndo(z),v))},[E]),F=a.useCallback(v=>{P.pushUndo(f),p(v)},[f,p,P]),W=a.useCallback(v=>{C(v.id),x(v.content)},[]),O=a.useCallback(()=>{if(!M)return;const v=j.trim();v?i(M,v):c(M),C(null),x("")},[M,j,i,c]),T=a.useCallback(()=>{C(null),x("")},[]);return s.jsxs("div",{className:`plan-insert-zone${b?" plan-insert-zone--empty":""}`,"data-zone-index":n,children:[t==null?void 0:t.map(v=>s.jsx("div",{className:"plan-annotation-card",children:M===v.id?s.jsx("textarea",{ref:$,className:"plan-annotation-textarea",value:j,onChange:z=>R(z.target.value),onKeyDown:z=>{if(z.key==="Enter"&&(z.ctrlKey||z.metaKey)){z.preventDefault(),O();return}if(z.key==="Escape"){z.preventDefault(),T();return}if(z.key==="Tab"){rt(z,R);return}},onBlur:O,rows:ot(j),style:{fontSize:`${k}px`,flex:1,...h?{minWidth:300}:void 0}}):s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{flex:1,fontSize:`${k}px`,color:"var(--accent-yellow)",whiteSpace:"pre-wrap",cursor:"text"},onDoubleClick:()=>W(v),title:"Double-click to edit",children:v.content}),u&&(()=>{const z=(l==null?void 0:l(v.id))??!1;return s.jsx("button",{className:"pane-btn pane-btn--sm",onClick:()=>!z&&u(v.id),disabled:z,title:z?"Already sent":"Send to terminal",style:z?{opacity:.3}:{color:"var(--accent-green)"},children:"Send"})})(),s.jsx("button",{className:"pane-btn pane-btn--sm",onClick:()=>W(v),style:{color:"var(--accent-blue)"},title:"Edit annotation",children:"✎"}),s.jsx("button",{className:"pane-btn pane-btn--danger pane-btn--sm",onClick:()=>c(v.id),children:"×"})]})},v.id)),e?s.jsx("div",{className:"plan-annotation-card plan-annotation-card--editing",children:s.jsx("textarea",{ref:m,className:"plan-annotation-textarea",value:f,onChange:v=>F(v.target.value),onKeyDown:v=>{if(v.key==="Enter"&&(v.ctrlKey||v.metaKey)){v.preventDefault(),o();return}if(v.key==="Escape"){v.preventDefault(),o();return}if(v.key==="Tab"){rt(v,F);return}},placeholder:"Add annotation... (Ctrl+Enter or Esc to save)",rows:ot(f),style:{fontSize:`${k}px`,...h?{minWidth:300}:void 0}})}):b&&!(t!=null&&t.length)?s.jsx("div",{className:"plan-empty-placeholder",onDoubleClick:r,title:"Double-click or Ctrl+Enter to edit",children:"Write down your plans here. Double-click or Ctrl+Enter to edit."}):s.jsx("button",{className:"plan-insert-btn",onClick:r,title:"Add annotation here",children:"+"})]})}async function ye(n,e,t){const r=t?`?path=${encodeURIComponent(t)}`:"",o=await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/files${r}`,{headers:ne(n)});if(!o.ok)throw new Error("Failed to list files");return o.json()}function Rr(n,e,t,r){return new Promise((o,c)=>{const i=new FormData;for(const l of t)i.append("files",l);const u=new XMLHttpRequest;u.open("POST",`${te}/api/sessions/${encodeURIComponent(e)}/upload`),u.setRequestHeader("Authorization",`Bearer ${n}`),u.upload.addEventListener("progress",l=>{l.lengthComputable&&r&&r(Math.round(l.loaded/l.total*100))}),u.addEventListener("load",()=>{u.status>=200&&u.status<300?o():c(new Error(`Upload failed: ${u.status}`))}),u.addEventListener("error",()=>c(new Error("Upload network error"))),u.addEventListener("abort",()=>c(new Error("Upload aborted"))),u.send(i)})}async function Nr(n,e){const t=await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/cwd`,{headers:ne(n)});if(!t.ok)throw new Error("Failed to fetch cwd");return(await t.json()).cwd}async function st(n,e,t){const r=await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/touch`,{method:"POST",headers:{...ne(n),"Content-Type":"application/json"},body:JSON.stringify({name:t})});if(!r.ok)throw new Error("Failed to create file");return r.json()}async function Ht(n,e,t){const r=await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/mkdir`,{method:"POST",headers:{...ne(n),"Content-Type":"application/json"},body:JSON.stringify({path:t})});if(!r.ok)throw new Error("Failed to create directory");return r.json()}async function Dr(n,e,t){if(!(await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/rm`,{method:"DELETE",headers:{...ne(n),"Content-Type":"application/json"},body:JSON.stringify({path:t})})).ok)throw new Error("Failed to delete")}async function Lr(n,e){const t=await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/download-cwd`,{headers:ne(n)});if(!t.ok)throw new Error("Download failed");const r=await t.blob(),o=URL.createObjectURL(r),c=document.createElement("a");c.href=o;const i=t.headers.get("Content-Disposition"),u=i==null?void 0:i.match(/filename="(.+)"/);c.download=u?decodeURIComponent(u[1]):"cwd.tar.gz",document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(o)}async function Mr(n,e,t){const r=await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/download?path=${encodeURIComponent(t)}`,{headers:ne(n)});if(!r.ok)throw new Error("Download failed");const o=await r.blob(),c=URL.createObjectURL(o),i=document.createElement("a");i.href=c,i.download=t.split("/").pop()||"download",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c)}function Kt(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:n<1024*1024*1024?`${(n/(1024*1024)).toFixed(1)} MB`:`${(n/(1024*1024*1024)).toFixed(1)} GB`}function zr(n,e){if(e==="directory")return"📁";const t=n.slice(n.lastIndexOf(".")).toLowerCase();return t===".pdf"?"📕":t===".html"||t===".htm"?"🌐":t===".md"?"📝":"📄"}function Jt(n){const e=new Date(n*1e3),t=r=>String(r).padStart(2,"0");return`${t(e.getMonth()+1)}-${t(e.getDate())} ${t(e.getHours())}:${t(e.getMinutes())}`}function Ar({sessionId:n,token:e,planDir:t,selectedFile:r,onSelectFile:o,onCreateFile:c,onDeleteFile:i}){const[u,l]=a.useState([]),[f,p]=a.useState(!0),[m,h]=a.useState(""),[b,k]=a.useState(!1),M=a.useRef(null),[C,j]=a.useState(t),x=a.useCallback(async()=>{if(!(!e||!C)){p(!0);try{const Y=(await ye(e,n,C)).files.filter(J=>J.type==="file"&&J.name.toLowerCase().endsWith(".md")||J.type==="directory").sort((J,H)=>{const L=J.type==="file"&&J.name===".index.md",N=H.type==="file"&&H.name===".index.md";return L&&!N?-1:!L&&N?1:J.type==="directory"&&H.type!=="directory"?-1:J.type!=="directory"&&H.type==="directory"?1:J.name.localeCompare(H.name)});l(Y)}catch{l([])}finally{p(!1)}}},[e,n,C]);a.useEffect(()=>{x()},[x]),a.useEffect(()=>{const w=setInterval(x,5e3);return()=>clearInterval(w)},[x]);const $=a.useCallback(()=>{const w=t.substring(0,t.lastIndexOf("/")+1);return C.startsWith(w)?C.substring(w.length):C},[t,C]),E=a.useCallback(async()=>{const w=m.trim();if(!w)return;const Y=w.endsWith(".md")?w:`${w}.md`;k(!0);try{const J=await st(e,n,`${$()}/${Y}`);J.ok&&(h(""),await x(),c(J.path))}catch{}finally{k(!1)}},[m,e,n,$,x,c]),P=a.useCallback(async()=>{const w=m.trim().replace(/\/+$/,"");if(w){k(!0);try{await Ht(e,n,`${$()}/${w}`),h(""),await x()}catch{}finally{k(!1)}}},[m,e,n,$,x]),R=a.useCallback(async w=>{const Y=`${C}/${w.name}`,J=w.type==="directory"?`folder "${w.name}" and all its contents`:`"${w.name}"`;if(window.confirm(`Delete ${J}?`))try{await Dr(e,n,Y),i==null||i(Y),await x()}catch{}},[e,n,C,x,i]),F=a.useCallback(w=>{j(Y=>`${Y}/${w}`)},[]),W=a.useCallback(()=>{C!==t&&j(w=>w.substring(0,w.lastIndexOf("/")))},[C,t]),O=t.split("/").pop()||"TASK",T=(()=>{const w=t.split("/");return w.length>=2?w[w.length-2]+"/":""})(),v=C===t?T+O+"/":T+O+"/"+C.substring(t.length+1)+"/",z=r?r.split("/").pop():null;return s.jsxs("div",{className:"plan-file-browser",children:[s.jsxs("div",{className:"plan-file-browser__header",children:[s.jsx("span",{className:"plan-file-browser__title",title:v,children:v}),s.jsx("button",{className:"pane-btn pane-btn--sm",onClick:x,title:"Refresh file list",style:{fontSize:12},children:"↻"})]}),s.jsxs("div",{className:"plan-file-browser__create",children:[s.jsx("input",{ref:M,className:"plan-file-browser__input",value:m,onChange:w=>h(w.target.value),onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),E())},placeholder:"name",disabled:b}),s.jsx("button",{className:"pane-btn pane-btn--sm",onClick:E,disabled:b||!m.trim(),title:"Create new .md file",style:m.trim()?{color:"var(--accent-green)",fontWeight:700,fontSize:14}:{opacity:.4,fontWeight:700,fontSize:14},children:"+"}),s.jsx("button",{className:"pane-btn pane-btn--sm",onClick:P,disabled:b||!m.trim(),title:"Create new folder",style:m.trim()?{color:"var(--accent-blue)"}:{opacity:.4},children:"📁"})]}),s.jsxs("div",{className:"plan-file-browser__list",children:[f&&u.length===0&&s.jsx("div",{className:"plan-file-browser__status",children:"Loading..."}),!f&&u.length===0&&s.jsx("div",{className:"plan-file-browser__status",children:"No .md files"}),C!==t&&s.jsxs("div",{className:"plan-file-browser__item",onClick:W,title:"Go up to parent directory",style:{cursor:"pointer"},children:[s.jsx("span",{className:"plan-file-browser__icon",style:{color:"var(--accent-blue)"},children:"←"}),s.jsx("span",{className:"plan-file-browser__name",style:{color:"var(--accent-blue)"},children:".."})]}),u.map(w=>{const Y=`${C}/${w.name}`,J=w.type==="file"&&w.name===z,H=w.type==="directory";return s.jsxs("div",{className:`plan-file-browser__item${J?" plan-file-browser__item--active":""}`,onClick:()=>H?F(w.name):o(Y),title:H?`Open folder ${w.name}`:w.name,style:{cursor:"pointer"},children:[s.jsx("span",{className:"plan-file-browser__icon",children:H?"📁":w.name===".index.md"?"🔒":"□"}),s.jsxs("span",{className:"plan-file-browser__name",children:[w.name,H?"/":""]}),!H&&s.jsx("span",{className:"plan-file-browser__size",children:Kt(w.size)}),w.name!==".index.md"&&s.jsx("button",{className:"pane-btn pane-btn--danger pane-btn--sm plan-file-browser__delete",onClick:L=>{L.stopPropagation(),R(w)},title:`Delete ${w.name}`,children:"×"})]},w.name)})]})]})}const et={status:"idle",mode:"lines",lines:[],content:"",buffer:null,totalSize:0,receivedBytes:0,mtime:0,error:null},$r=200;function _r(){const[n,e]=a.useState(et),t=a.useRef("lines"),r=a.useRef([]),o=a.useRef(""),c=a.useRef(""),i=a.useRef([]),u=a.useRef(0),l=a.useRef(0),f=a.useRef(null),p=a.useRef(null),m=a.useCallback(()=>{const j=t.current;e(x=>({...x,receivedBytes:u.current,...j==="lines"?{lines:[...r.current]}:{},...j==="content"?{content:c.current}:{}}))},[]),h=a.useCallback(()=>{f.current===null&&(f.current=window.setTimeout(()=>{f.current=null,m()},$r))},[m]),b=a.useCallback(j=>{t.current=j,r.current=[],o.current="",c.current="",i.current=[],u.current=0,l.current=0,p.current=new TextDecoder,f.current!==null&&(clearTimeout(f.current),f.current=null),e({...et,mode:j,status:"streaming"})},[]),k=a.useCallback(j=>{u.current+=j.length;const x=t.current;if(x==="lines"){const E=p.current.decode(j,{stream:!0}).split(`
|
|
29
|
+
`);E[0]=o.current+E[0],o.current=E.pop(),E.length>0&&r.current.push(...E)}else if(x==="content"){const $=p.current.decode(j,{stream:!0});c.current+=$}else i.current.push(new Uint8Array(j));h()},[h]),M=a.useCallback(j=>{switch(j.type){case"file-stream-start":l.current=j.size,e(x=>({...x,totalSize:j.size,mtime:j.mtime}));break;case"file-stream-end":{f.current!==null&&(clearTimeout(f.current),f.current=null);const x=t.current;let $=r.current,E=c.current,P=null;if(x==="lines"){const R=p.current.decode(),F=o.current+R;F&&($=[...$,F],r.current=$),o.current=""}else if(x==="content"){const R=p.current.decode();E=c.current+R,c.current=E}else{const R=i.current.reduce((W,O)=>W+O.length,0);P=new Uint8Array(R);let F=0;for(const W of i.current)P.set(W,F),F+=W.length;i.current=[]}e({status:"complete",mode:x,lines:x==="lines"?[...$]:[],content:x==="content"?E:"",buffer:x==="binary"?P:null,totalSize:l.current,receivedBytes:u.current,mtime:0,error:null});break}case"file-stream-error":f.current!==null&&(clearTimeout(f.current),f.current=null),e(x=>({...x,status:"error",error:j.error}));break}},[]),C=a.useCallback(()=>{f.current!==null&&(clearTimeout(f.current),f.current=null),r.current=[],o.current="",c.current="",i.current=[],u.current=0,l.current=0,p.current=null,e(et)},[]);return{state:n,startStream:b,handleChunk:k,handleControl:M,reset:C}}function St({label:n,percent:e}){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:8},children:[s.jsx("span",{style:{color:"var(--text-secondary)",fontSize:13},children:n}),e!=null&&s.jsxs("div",{style:{width:120,display:"flex",alignItems:"center",gap:6},children:[s.jsx("div",{style:{flex:1,height:4,backgroundColor:"var(--border)",borderRadius:2,overflow:"hidden"},children:s.jsx("div",{style:{height:"100%",width:`${e}%`,backgroundColor:"var(--accent-blue)",transition:"width 0.2s"}})}),s.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:[e,"%"]})]})]})}function Or({sessionId:n,token:e,connected:t,onRequestFileStream:r,onForwardToChat:o,onSendToTerminal:c}){const i=_r(),[u,l]=a.useState(!1),f=a.useRef(""),[p,m]=a.useState(null),[h,b]=a.useState(null),[k,M]=a.useState(""),[C,j]=a.useState(!1),x=a.useRef(new Map),$=a.useRef(null),E=a.useRef(null);a.useEffect(()=>{E.current=null;let L=!1;return j(!0),(async()=>{try{const N=await ye(e,n);if(L)return;if(N.files.find(K=>K.name==="TASK"&&K.type==="directory")){const K=N.cwd+"/TASK",q=await ye(e,n,K);if(L)return;const Z=q.files.find(Q=>Q.name===".index.md");if(Z)m(K),b(K+"/"+Z.name);else try{const Q=await st(e,n,"TASK/.index.md");if(L)return;m(K),Q.ok&&b(Q.path)}catch{m(K)}}else try{const K=await Ht(e,n,"TASK");if(L)return;m(K.path);const q=await st(e,n,"TASK/.index.md");if(L)return;q.ok&&b(q.path)}catch{m(null),b(null)}}catch{m(null)}finally{L||j(!1)}try{const N=await ye(e,n);if(L)return;const V=N.home||"";if(f.current=N.cwd,V){const K=`${V}/.claude/commands`;try{const q=await ye(e,n,K);if(L)return;q.files.some(Q=>Q.name==="aicli-task-review.md")||l(!0)}catch{L||l(!0)}}}catch{}})(),()=>{L=!0}},[n,e]),a.useEffect(()=>(qn(n,i.handleChunk,i.handleControl),()=>Vn(n)),[n,i.handleChunk,i.handleControl]),a.useEffect(()=>{!h||!t||E.current===h&&k||(E.current=h,i.reset(),i.startStream("content"),r==null||r(h))},[h,t]),a.useEffect(()=>{i.state.status==="complete"&&h&&(M(i.state.content),x.current.set(h,i.state.content))},[i.state.status,i.state.content,h]);const P=a.useRef(new Map),R=a.useCallback(()=>{var N,V;if(!h)return;const L=((V=(N=$.current)==null?void 0:N.getScrollTop)==null?void 0:V.call(N))??0;L>0&&P.current.set(h,L)},[h]);a.useEffect(()=>{if(!h||!k)return;const L=P.current.get(h);L!=null&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{var N,V;(V=(N=$.current)==null?void 0:N.setScrollTop)==null||V.call(N,L)})})},[h,k]);const F=a.useCallback(L=>{L!==h&&(R(),h&&k&&x.current.set(h,k),b(L),M(""),E.current=null)},[h,k,R]),W=a.useCallback(L=>{h&&(h===L||h.startsWith(L+"/"))&&(b(null),M(""),E.current=null),x.current.delete(L)},[h]),O=a.useCallback(L=>{b(L),M(""),E.current=null},[]),T=a.useCallback(L=>{L&&(o==null||o(L))},[o]),v=a.useCallback(()=>{R(),h&&k&&x.current.set(h,k),b(null),M(""),E.current=null},[h,k,R]),z=a.useCallback(()=>{!h||!t||(E.current=null,M(""),i.reset(),i.startStream("content"),r==null||r(h),E.current=h)},[h,t,i,r]),[w,Y]=a.useState(()=>{const L=localStorage.getItem(`plan-fb-width-${n}`);if(L){const N=Number(L);if(Number.isFinite(N)&&N>=60&&N<=300)return N}return 130}),J=a.useRef(w);if(w!==J.current){J.current=w;try{localStorage.setItem(`plan-fb-width-${n}`,String(Math.round(w)))}catch{}}const H=a.useCallback(L=>{L.preventDefault();const N=L.clientX,V=w;document.body.classList.add("resizing-panes");const K=Z=>{const Q=Z.clientX-N;Y(Math.min(300,Math.max(60,V+Q)))},q=()=>{document.body.classList.remove("resizing-panes"),document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",q)};document.addEventListener("mousemove",K),document.addEventListener("mouseup",q)},[w]);return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",backgroundColor:"var(--bg-primary)",overflow:"hidden"},children:[u&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",backgroundColor:"var(--bg-secondary)",borderBottom:"1px solid var(--border)",fontSize:12,flexShrink:0},children:[s.jsx("span",{style:{color:"var(--accent-yellow)",flex:1},children:"/aicli-task-review command not installed"}),s.jsx("button",{className:"pane-btn",style:{color:"var(--accent-green)",fontSize:11},onClick:()=>{const L=f.current;L&&c&&c(`mkdir -p ~/.claude/commands && cp ${L}/.commands/*.md ~/.claude/commands/`),l(!1)},children:"Install"}),s.jsx("button",{className:"pane-btn",style:{fontSize:11},onClick:()=>l(!1),children:"×"})]}),s.jsxs("div",{className:"plan-overlay-body",children:[p&&s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{width:w,flexShrink:0,overflow:"hidden"},children:s.jsx(Ar,{sessionId:n,token:e,planDir:p,selectedFile:h,onSelectFile:F,onCreateFile:O,onDeleteFile:W})}),s.jsx("div",{onMouseDown:H,style:{width:2,flexShrink:0,cursor:"col-resize",backgroundColor:"var(--border)",transition:"background-color 0.15s"},onMouseEnter:L=>{L.currentTarget.style.backgroundColor="var(--accent-blue)"},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="var(--border)"}})]}),s.jsx("div",{className:"plan-overlay-center",children:C?s.jsx(St,{label:"Loading TASK/..."}):h&&!k&&(i.state.status==="streaming"||i.state.status==="idle")?s.jsx(St,{label:`Loading ${h.split("/").pop()}...`,percent:i.state.totalSize>0?Math.round(i.state.receivedBytes/i.state.totalSize*100):void 0}):h?s.jsx(jr,{ref:$,markdown:k,filePath:h,sessionId:n,token:e,onExecute:T,onSend:c,onRefresh:z,onClose:v,readOnly:h.endsWith("/.index.md")}):s.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:8},children:s.jsx("span",{style:{color:"var(--text-secondary)",fontSize:13,fontStyle:"italic"},children:"Select a file from the left panel"})})})]})]})}async function Fr(n,e){const t=await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/draft`,{headers:ne(n)});return t.ok?(await t.json()).content??"":""}async function kt(n,e,t){await fetch(`${te}/api/sessions/${encodeURIComponent(e)}/draft`,{method:"PUT",headers:{...ne(n),"Content-Type":"application/json"},body:JSON.stringify({content:t})})}const it="chat-history",Ct=50;function qt(){try{const n=localStorage.getItem(it);return n?JSON.parse(n):[]}catch{return[]}}function Pr(n){const t=qt().filter(r=>r.text!==n);t.unshift({text:n,ts:Date.now()}),t.length>Ct&&(t.length=Ct),localStorage.setItem(it,JSON.stringify(t))}const Tt=[{cmd:"/history",desc:"Browse sent message history"},{cmd:"/plan",desc:"Enter plan mode"},{cmd:"/help",desc:"Get help"},{cmd:"/compact",desc:"Compact conversation"},{cmd:"/clear",desc:"Clear conversation"},{cmd:"/model",desc:"Switch model"},{cmd:"/cost",desc:"Show token usage"},{cmd:"/status",desc:"Show status"},{cmd:"/init",desc:"Initialize project CLAUDE.md"},{cmd:"/memory",desc:"Edit memory files"},{cmd:"/review",desc:"Review code"},{cmd:"/bug",desc:"Report a bug"},{cmd:"/login",desc:"Login to Anthropic"},{cmd:"/doctor",desc:"Run diagnostics"},{cmd:"/permissions",desc:"Manage permissions"},{cmd:"/mcp",desc:"MCP server management"},{cmd:"/terminal-setup",desc:"Configure terminal"},{cmd:"/vim",desc:"Toggle vim mode"},{cmd:"/oh-my-claudecode:autopilot",desc:"Full autonomous execution"},{cmd:"/oh-my-claudecode:ralph",desc:"Persistence loop until done"},{cmd:"/oh-my-claudecode:ultrawork",desc:"Max parallel execution"},{cmd:"/oh-my-claudecode:ecomode",desc:"Token-efficient execution"},{cmd:"/oh-my-claudecode:plan",desc:"Strategic planning session"},{cmd:"/oh-my-claudecode:ralplan",desc:"Iterative planning consensus"},{cmd:"/oh-my-claudecode:ultrapilot",desc:"Parallel autopilot (3-5x faster)"},{cmd:"/oh-my-claudecode:analyze",desc:"Deep analysis/investigation"},{cmd:"/oh-my-claudecode:deepsearch",desc:"Thorough codebase search"},{cmd:"/oh-my-claudecode:deepinit",desc:"Generate AGENTS.md hierarchy"},{cmd:"/oh-my-claudecode:ultraqa",desc:"QA cycling: test/fix/repeat"},{cmd:"/oh-my-claudecode:tdd",desc:"Test-driven development"},{cmd:"/oh-my-claudecode:code-review",desc:"Comprehensive code review"},{cmd:"/oh-my-claudecode:security-review",desc:"Security vulnerability review"},{cmd:"/oh-my-claudecode:build-fix",desc:"Fix build/TypeScript errors"},{cmd:"/oh-my-claudecode:research",desc:"Parallel research orchestration"},{cmd:"/oh-my-claudecode:swarm",desc:"N coordinated agents"},{cmd:"/oh-my-claudecode:pipeline",desc:"Sequential agent chaining"},{cmd:"/oh-my-claudecode:learner",desc:"Extract skill from session"},{cmd:"/oh-my-claudecode:note",desc:"Save notes to notepad"},{cmd:"/oh-my-claudecode:cancel",desc:"Cancel active OMC mode"},{cmd:"/oh-my-claudecode:help",desc:"OMC usage guide"},{cmd:"/oh-my-claudecode:doctor",desc:"Diagnose OMC issues"},{cmd:"/oh-my-claudecode:omc-setup",desc:"One-time OMC setup"},{cmd:"/oh-my-claudecode:hud",desc:"Configure HUD statusline"},{cmd:"/oh-my-claudecode:release",desc:"Automated release workflow"},{cmd:"/oh-my-claudecode:ralph-init",desc:"Initialize PRD for ralph"},{cmd:"/oh-my-claudecode:review",desc:"Review plan with Critic"},{cmd:"/oh-my-claudecode:git-master",desc:"Git expert for commits"},{cmd:"/oh-my-claudecode:mcp-setup",desc:"Configure MCP servers"},{cmd:"/oh-my-claudecode:skill",desc:"Manage local skills"},{cmd:"/oh-my-claudecode:writer-memory",desc:"Writer memory system"},{cmd:"/oh-my-claudecode:psm",desc:"Project session manager"},{cmd:"/oh-my-claudecode:trace",desc:"Agent flow trace timeline"},{cmd:"/plan-analyzer",desc:"Task complexity grading & token routing"}],Br=a.forwardRef(function({onSend:e,onContentChange:t,sessionId:r,token:o},c){const i=D(d=>d.fontSize),[u,l]=a.useState(""),f=a.useRef(null),p=a.useRef(void 0),m=a.useRef(!1),h=a.useRef(!1),{pushUndo:b,popUndo:k}=nt(),M=a.useRef(u);M.current=u;const C=a.useCallback(()=>b(M.current),[b]),[j,x]=a.useState(!1),[$,E]=a.useState(""),[P,R]=a.useState(0),[F,W]=a.useState(!1),[O,T]=a.useState([]),[v,z]=a.useState(0),[w,Y]=a.useState(""),J=a.useRef(null),H=a.useMemo(()=>{if(!w)return O;const d=w.toLowerCase();return O.filter(y=>y.text.toLowerCase().includes(d))},[O,w]),[L,N]=a.useState(!1),[V,K]=a.useState(""),[q,Z]=a.useState(""),[Q,ee]=a.useState(0),[be,ge]=a.useState([]),[Ie,je]=a.useState(!1),he=a.useRef(""),Te=a.useRef(null),ce=a.useMemo(()=>{if(!$)return Tt;const d=$.toLowerCase();return Tt.filter(y=>y.cmd.toLowerCase().includes(d)||y.desc.toLowerCase().includes(d))},[$]),de=a.useMemo(()=>{let d=be;if(V){const y=V.toLowerCase();d=d.filter(U=>U.name.toLowerCase().includes(y))}return[...d].sort((y,U)=>y.type==="directory"&&U.type!=="directory"?-1:y.type!=="directory"&&U.type==="directory"?1:y.name.localeCompare(U.name))},[be,V]),ve=D(d=>d.latency),ue=`chat-draft-${r}`,I=a.useRef(!1),_=a.useRef(void 0);a.useEffect(()=>{try{const y=localStorage.getItem(ue);y&&!h.current&&l(y)}catch{}let d=!1;return Fr(o,r).then(y=>{if(d||h.current){m.current=!0;return}if(y){l(y);try{localStorage.setItem(ue,y)}catch{}}m.current=!0}).catch(()=>{m.current=!0}),()=>{d=!0}},[o,r,ue]),a.useEffect(()=>{if(!m.current)return;p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{try{localStorage.setItem(ue,u)}catch{}},50),_.current&&clearTimeout(_.current);const d=Math.max(200,(ve??30)*3);return _.current=setTimeout(()=>{I.current||(I.current=!0,kt(o,r,u).catch(()=>{}).finally(()=>{I.current=!1}))},d),()=>{p.current&&clearTimeout(p.current),_.current&&clearTimeout(_.current)}},[u,o,r,ve,ue]),a.useEffect(()=>{var d;(d=f.current)==null||d.focus()},[]),a.useEffect(()=>{if(!L)return;let d=!1;return je(!0),(async()=>{try{if(q){if(!he.current){const G=await ye(o,r);if(d)return;he.current=G.cwd}const y=`${he.current}/${q.replace(/\/$/,"")}`,U=await ye(o,r,y);if(d)return;ge(U.files)}else{const y=await ye(o,r);if(d)return;he.current=y.cwd,ge(y.files)}je(!1)}catch{if(d)return;ge([]),je(!1)}})(),()=>{d=!0}},[L,q,o,r]),a.useEffect(()=>{if(!L||!Te.current)return;const d=Te.current.querySelector(".file-item--active");d==null||d.scrollIntoView({block:"nearest"})},[Q,L]);const X=a.useCallback(()=>{const d=M.current.trim();if(d){Pr(d),e(d),l("");try{localStorage.removeItem(ue)}catch{}kt(o,r,"").catch(()=>{})}},[e,o,r,ue]),fe=a.useCallback(d=>{C(),l(d),h.current=!0},[C]),pe=a.useCallback(d=>{const y=f.current;C();const U=M.current;if(y){const G=y.selectionStart,re=y.selectionEnd,xe=U.slice(0,G)+d+U.slice(re);l(xe);const oe=G+d.length;requestAnimationFrame(()=>{y.selectionStart=y.selectionEnd=oe,y.focus()})}else l(U+d)},[C]);a.useImperativeHandle(c,()=>({send:X,fillContent:fe,insertAtCursor:pe}),[X,fe,pe]),a.useEffect(()=>{t==null||t(u.trim().length>0)},[u,t]);const we=a.useCallback(()=>{const d=f.current;if(!d)return;const{selectionStart:y,selectionEnd:U}=d;if(y!==U){const G=d.value.substring(y,U);G&&navigator.clipboard.writeText(G).catch(()=>{})}},[]),Ee=a.useCallback(()=>{const d=qt();x(!1),E("");const y=f.current;if(y){const U=y.selectionStart,G=u.slice(0,U),re=u.slice(U),xe=G.match(/(?:^|\s)(\/history)\s*$/);if(xe){const oe=G.length-xe[1].length;l(u.slice(0,oe)+re)}}d.length!==0&&(T(d),z(0),Y(""),W(!0))},[u]),ke=a.useCallback(d=>{C(),l(d.text),W(!1),requestAnimationFrame(()=>{const y=f.current;y&&(y.selectionStart=y.selectionEnd=d.text.length,y.focus())})},[C]),Se=a.useCallback(d=>{const y=H[d];if(!y)return;const U=O.filter(re=>re.ts!==y.ts||re.text!==y.text);T(U),localStorage.setItem(it,JSON.stringify(U));const G=w?U.filter(re=>re.text.toLowerCase().includes(w.toLowerCase())):U;v>=G.length&&z(Math.max(0,G.length-1))},[H,O,v,w]);a.useEffect(()=>{if(!F||!J.current)return;const d=J.current.querySelector(".history-item--active");d==null||d.scrollIntoView({block:"nearest"})},[v,F]);const g=a.useCallback(d=>{if(d==="/history"){Ee();return}const y=f.current;if(!y)return;C();const U=y.selectionStart,G=u.slice(0,U),re=u.slice(U),oe=G.lastIndexOf(`
|
|
30
|
+
`)+1,me=G.slice(oe).match(/\/[a-zA-Z:-]*$/);if(me){const se=oe+(me.index??0),Ne=d+" ",Ve=u.slice(0,se)+Ne+re;l(Ve);const Xt=se+Ne.length;requestAnimationFrame(()=>{y.selectionStart=y.selectionEnd=Xt,y.focus()})}else{const se=G+d+re;l(se);const Ne=U+d.length;requestAnimationFrame(()=>{y.selectionStart=y.selectionEnd=Ne,y.focus()})}x(!1),E(""),R(0)},[u,C,Ee]),S=a.useCallback(d=>{const y=f.current;if(!y)return;C();const U=y.selectionStart,G=u.slice(0,U),re=u.slice(U),xe=G.match(/@([a-zA-Z0-9_.\-/]*)$/);if(!xe)return;const oe=G.length-xe[0].length;if(d.type==="directory"){const ae="@"+q+d.name+"/",me=u.slice(0,oe)+ae+re;l(me);const se=oe+ae.length;Z(q+d.name+"/"),K(""),ee(0),requestAnimationFrame(()=>{y.selectionStart=y.selectionEnd=se,y.focus()})}else{const ae=d.name+" ",me=u.slice(0,oe)+ae+re;l(me);const se=oe+ae.length;N(!1),K(""),Z(""),ee(0),ge([]),he.current="",requestAnimationFrame(()=>{y.selectionStart=y.selectionEnd=se,y.focus()})}},[u,q,C]),A=a.useCallback(d=>{const y=d.target.value;if(l(y),F){const ae=y.trim();ae?(Y(ae),z(0)):Y("");return}const U=d.target.selectionStart,G=y.slice(0,U),re=G.lastIndexOf(`
|
|
31
|
+
`),oe=G.slice(re+1).match(/(?:^|\s)\/([a-zA-Z:-]*)$/);if(oe)x(!0),E(oe[1]),R(0),N(!1);else{x(!1);const ae=G.match(/@([a-zA-Z0-9_.\-/]*)$/);if(ae){const me=ae[1],se=me.lastIndexOf("/"),Ne=se>=0?me.slice(0,se+1):"",Ve=se>=0?me.slice(se+1):me;K(Ve),ee(0),Z(Ne),N(!0)}else N(!1)}},[F]),B=a.useCallback(d=>{if(j&&ce.length>0){if(d.key==="ArrowDown"){d.preventDefault(),R(y=>(y+1)%ce.length);return}if(d.key==="ArrowUp"){d.preventDefault(),R(y=>(y-1+ce.length)%ce.length);return}if(d.key==="Enter"||d.key==="Tab"){d.preventDefault(),g(ce[P].cmd);return}if(d.key==="Escape"){d.preventDefault(),x(!1);return}}if(L&&de.length>0){if(d.key==="ArrowDown"){d.preventDefault(),ee(y=>(y+1)%de.length);return}if(d.key==="ArrowUp"){d.preventDefault(),ee(y=>(y-1+de.length)%de.length);return}if(d.key==="Tab"||d.key==="Enter"){d.preventDefault(),S(de[Q]);return}if(d.key==="Escape"){d.preventDefault(),N(!1);return}}if(F&&H.length>0){if(d.key==="ArrowDown"){d.preventDefault(),z(y=>(y+1)%H.length);return}if(d.key==="ArrowUp"){d.preventDefault(),z(y=>(y-1+H.length)%H.length);return}if(d.key==="Enter"){d.preventDefault(),ke(H[v]);return}if(d.key==="Delete"||d.key==="Backspace"&&(d.ctrlKey||d.metaKey)){d.preventDefault(),Se(v);return}if(d.key==="Escape"){d.preventDefault(),W(!1);return}}if(d.key==="Tab"){rt(d,l,b);return}d.key==="Enter"&&(d.ctrlKey||d.metaKey)&&(d.preventDefault(),X())},[X,j,ce,P,g,L,de,Q,S,b,k,F,H,v,ke,Se]);return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",backgroundColor:"var(--bg-primary)",overflow:"hidden"},children:[j&&ce.length>0&&s.jsx("div",{className:"slash-dropdown",children:ce.map((d,y)=>s.jsxs("div",{className:`slash-item${y===P?" slash-item--active":""}`,onMouseDown:U=>{U.preventDefault(),g(d.cmd)},onMouseEnter:()=>R(y),children:[s.jsx("span",{className:"slash-cmd",children:d.cmd}),s.jsx("span",{className:"slash-desc",children:d.desc})]},d.cmd))}),L&&(Ie||de.length>0)&&s.jsx("div",{className:"file-dropdown",ref:Te,children:Ie?s.jsx("div",{className:"file-item file-loading",children:"Loading..."}):de.map((d,y)=>s.jsxs("div",{className:`file-item${y===Q?" file-item--active":""}`,onMouseDown:U=>{U.preventDefault(),S(d)},onMouseEnter:()=>ee(y),children:[s.jsx("span",{className:"file-icon",children:d.type==="directory"?"📁":"📄"}),s.jsx("span",{className:"file-name",children:d.name})]},d.name))}),F&&s.jsx("div",{className:"history-dropdown",ref:J,children:H.length===0?s.jsx("div",{className:"history-item history-empty",children:"No history yet"}):H.map((d,y)=>s.jsxs("div",{className:`history-item${y===v?" history-item--active":""}`,onMouseDown:U=>{U.preventDefault(),ke(d)},onMouseEnter:()=>z(y),children:[s.jsx("span",{className:"history-text",children:d.text.length>120?d.text.slice(0,120)+"...":d.text}),s.jsx("span",{className:"history-time",children:new Date(d.ts).toLocaleString()}),s.jsx("button",{className:"history-delete",onMouseDown:U=>{U.preventDefault(),U.stopPropagation(),Se(y)},title:"Delete (Del key)",children:"×"})]},`${d.ts}-${y}`))}),s.jsx("textarea",{ref:f,className:"md-editor-textarea",value:u,onChange:A,onKeyDown:B,onMouseUp:we,placeholder:"Type / for commands, @ for files, Ctrl+Enter to send",spellCheck:!1,style:{flex:1,fontSize:`${i}px`}})]})}),Ur=600,De=typeof window<"u"?window.matchMedia(`(max-width: ${Ur-1}px)`):null;function Wr(){const[n,e]=a.useState(()=>(De==null?void 0:De.matches)??!1);return a.useEffect(()=>{if(!De)return;const t=r=>e(r.matches);return De.addEventListener("change",t),()=>De.removeEventListener("change",t)},[]),n}const Hr=a.memo(function({terminal:e}){const t=Wr(),r=D(I=>I.splitTerminal),o=D(I=>I.token),c=D(I=>I.toggleChat),i=D(I=>I.togglePlan),{chatOpen:u,planOpen:l}=e.panels,f=a.useCallback(async I=>{let _;if(o)try{_=await Nr(o,e.id)}catch{}r(e.id,I,_)},[o,e.id,r]),p=a.useRef(null),m=a.useRef(null),h=a.useRef(null),[b,k]=a.useState(!1),[M,C]=a.useState(0),[j,x]=a.useState(!1),[$,E]=a.useState(!1),[P,R]=a.useState(!1),[F,W]=a.useState([]),[O,T]=a.useState(""),[v,z]=a.useState([]),[w,Y]=a.useState(!1),J=a.useRef(null),H=a.useRef(null),L=a.useRef(null),[N,V]=a.useState(()=>{const I=localStorage.getItem(`plan-width-${e.id}`);if(I){const _=Number(I);if(Number.isFinite(_)&&_>=20&&_<=80)return _}return 50}),K=a.useRef(N);if(N!==K.current){K.current=N;try{localStorage.setItem(`plan-width-${e.id}`,String(Math.round(N)))}catch{}}const[q,Z]=a.useState(()=>{const I=localStorage.getItem(`doc-height-${e.id}`);if(I){const _=Number(I);if(Number.isFinite(_)&&_>=15&&_<=60)return _}return 35}),Q=a.useRef(q);if(q!==Q.current){Q.current=q;try{localStorage.setItem(`doc-height-${e.id}`,String(Math.round(q)))}catch{}}const ee=async I=>{const _=I.target.files;if(!(!_||_.length===0||!o)){k(!0),C(0);try{await Rr(o,e.id,_,X=>{C(X)})}catch(X){alert(`Upload failed: ${X instanceof Error?X.message:"Unknown error"}`)}finally{k(!1),C(0),p.current&&(p.current.value="")}}},be=a.useRef(void 0),ge=a.useCallback(I=>{if(m.current){const _=I.replace(/\r?\n/g," ").trimEnd();m.current.sendInput(_),be.current=window.setTimeout(()=>{var X;return(X=m.current)==null?void 0:X.sendInput("\r")},50)}},[]);a.useEffect(()=>()=>{be.current&&clearTimeout(be.current)},[]);const Ie=a.useCallback(async()=>{if(o){Y(!0),R(!0);try{const I=await ye(o,e.id);T(I.cwd),W(I.files),z([])}catch{R(!1)}finally{Y(!1)}}},[o,e.id]),je=a.useCallback(async I=>{if(o){Y(!0);try{const _=await ye(o,e.id,I);z(X=>[...X,O]),T(I),W(_.files)}catch{}finally{Y(!1)}}},[o,e.id,O]),he=a.useCallback(async()=>{if(!o||v.length===0)return;const I=v[v.length-1];Y(!0);try{const _=await ye(o,e.id,I);z(X=>X.slice(0,-1)),T(I),W(_.files)}catch{}finally{Y(!1)}},[o,e.id,v]),Te=a.useCallback(async I=>{if(o)try{await Mr(o,e.id,I)}catch(_){alert(`Download failed: ${_ instanceof Error?_.message:"Unknown error"}`)}},[o,e.id]);a.useEffect(()=>{if(!P)return;const I=fe=>{fe.key==="Escape"&&R(!1)},_=fe=>{J.current&&!J.current.contains(fe.target)&&R(!1)};document.addEventListener("keydown",I);const X=setTimeout(()=>document.addEventListener("mousedown",_),50);return()=>{document.removeEventListener("keydown",I),document.removeEventListener("mousedown",_),clearTimeout(X)}},[P]);const ce=a.useCallback(I=>{if(m.current){const _=I.replace(/\r?\n/g," ").trimEnd();m.current.sendInput(_),setTimeout(()=>{var X;return(X=m.current)==null?void 0:X.sendInput("\r")},50)}},[]),de=a.useCallback(I=>{I&&h.current&&h.current.fillContent(I)},[]),ve=a.useCallback(I=>{I.preventDefault();const _=H.current;if(!_)return;const X=_.getBoundingClientRect(),fe=X.height-24;document.body.classList.add("resizing-panes-v");const pe=Ee=>{const Se=(Ee.clientY-X.top-24)/fe*100,g=Math.min(85,Math.max(40,Se));Z(100-g)},we=()=>{document.body.classList.remove("resizing-panes-v"),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",we)};document.addEventListener("mousemove",pe),document.addEventListener("mouseup",we)},[]),ue=a.useCallback(I=>{I.preventDefault();const _=L.current;if(!_)return;const X=_.getBoundingClientRect(),fe=X.width;document.body.classList.add("resizing-panes");const pe=Ee=>{const ke=(Ee.clientX-X.left)/fe*100,Se=Math.min(80,Math.max(20,ke));V(Se)},we=()=>{document.body.classList.remove("resizing-panes"),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",we)};document.addEventListener("mousemove",pe),document.addEventListener("mouseup",we)},[]);return s.jsxs("div",{ref:H,style:{display:"flex",flexDirection:"column",height:"100%",minWidth:0,minHeight:0},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"3px 10px",backgroundColor:"var(--bg-secondary)",borderBottom:"1px solid var(--border)",flexShrink:0,height:"24px"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[s.jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:e.connected?"var(--accent-green)":"var(--accent-red)"}}),s.jsxs("span",{style:{fontSize:"12px",color:"var(--text-secondary)"},children:[e.id,e.connected?e.sessionResumed?" (resumed)":"":" (disconnected)"]})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[s.jsx("input",{ref:p,type:"file",multiple:!0,style:{display:"none"},onChange:ee}),s.jsx("button",{className:"pane-btn",onClick:()=>{var I;return(I=p.current)==null?void 0:I.click()},disabled:b,style:b?{color:"var(--accent-yellow)"}:void 0,title:b?`Uploading ${M}%`:"Upload files","aria-label":"Upload files",children:b?`${M}%`:"↑"}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx("button",{className:"pane-btn",onClick:Ie,disabled:j,style:j?{color:"var(--accent-yellow)"}:void 0,title:j?"Downloading...":"Download files","aria-label":"Download files",children:j?"...":"↓"}),P&&s.jsxs("div",{ref:J,style:{position:"absolute",top:"100%",right:0,marginTop:4,width:300,maxHeight:360,backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)",borderRadius:6,boxShadow:"0 4px 16px rgba(0,0,0,0.3)",zIndex:100,display:"flex",flexDirection:"column",overflow:"hidden"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"6px 8px",borderBottom:"1px solid var(--border)",backgroundColor:"var(--bg-secondary)",flexShrink:0},children:[v.length>0&&s.jsx("button",{className:"pane-btn",onClick:he,disabled:w,style:{fontSize:11,flexShrink:0},title:"Go back",children:".."}),s.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:"rtl",textAlign:"left",flex:1},children:O.split("/").slice(-2).join("/")||O}),s.jsx("button",{className:"pane-btn",onClick:()=>R(!1),style:{fontSize:11,flexShrink:0},title:"Close",children:"×"})]}),s.jsx("div",{style:{flex:1,overflowY:"auto",padding:"2px 0"},children:w?s.jsx("div",{style:{padding:"12px",textAlign:"center",color:"var(--text-secondary)",fontSize:12},children:"Loading..."}):F.length===0?s.jsx("div",{style:{padding:"12px",textAlign:"center",color:"var(--text-secondary)",fontSize:12,fontStyle:"italic"},children:"Empty directory"}):F.map(I=>s.jsxs("div",{onClick:()=>{const _=O+"/"+I.name;I.type==="directory"?je(_):Te(_)},style:{display:"flex",alignItems:"center",gap:6,padding:"4px 10px",cursor:"pointer",fontSize:12,color:"var(--text-primary)",transition:"background-color 0.1s"},onMouseEnter:_=>{_.currentTarget.style.backgroundColor="var(--bg-secondary)"},onMouseLeave:_=>{_.currentTarget.style.backgroundColor="transparent"},children:[s.jsx("span",{style:{flexShrink:0,fontSize:13},children:I.type==="directory"?"📁":zr(I.name,I.type)}),s.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:I.name}),I.type==="directory"?s.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",flexShrink:0},children:"›"}):I.size!=null?s.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",flexShrink:0},children:Kt(I.size)}):null]},I.name))}),s.jsx("div",{style:{borderTop:"1px solid var(--border)",padding:"6px 8px",flexShrink:0,backgroundColor:"var(--bg-secondary)"},children:s.jsx("button",{className:"pane-btn",onClick:async()=>{x(!0),R(!1);try{await Lr(o||"",e.id)}catch(I){alert(`Download failed: ${I instanceof Error?I.message:"Unknown error"}`)}finally{x(!1)}},style:{fontSize:11,color:"var(--accent-blue)",width:"100%",textAlign:"center"},title:"Download entire CWD as tar.gz",children:"Download All (tar.gz)"})})]})]}),s.jsx("button",{className:`pane-btn${u?" pane-btn--active":""}`,onClick:()=>c(e.id),title:"Toggle Chat panel","aria-label":"Toggle Chat panel",children:"Chat"}),s.jsx("button",{className:`pane-btn${l?" pane-btn--active":""}`,onClick:()=>i(e.id),title:"Toggle Task annotation panel","aria-label":"Toggle Task annotation panel",children:"Task"}),s.jsx("button",{className:"pane-btn",onClick:()=>f(t?"vertical":"horizontal"),title:t?"Split vertical (screen too narrow for horizontal)":"Split horizontal (left/right)","aria-label":"Split horizontal",children:"|"}),s.jsx("button",{className:"pane-btn",onClick:()=>f("vertical"),title:"Split vertical (top/bottom)","aria-label":"Split vertical",children:"─"})]})]}),s.jsxs("div",{ref:L,style:{flex:1,display:"flex",flexDirection:"row",overflow:"hidden",minHeight:0},children:[l&&s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{width:`${N}%`,minWidth:200,flexShrink:0,overflow:"hidden"},children:s.jsx(Or,{sessionId:e.id,token:o||"",connected:e.connected,onRequestFileStream:I=>{var _;return(_=m.current)==null?void 0:_.requestFileStream(I)},onCancelFileStream:()=>{var I;return(I=m.current)==null?void 0:I.cancelFileStream()},onForwardToChat:de,onSendToTerminal:ce})}),s.jsx("div",{className:"md-editor-divider-h",onMouseDown:ue,style:{width:"2px",flexShrink:0,cursor:"col-resize",backgroundColor:"var(--border)",transition:"background-color 0.15s"},onMouseEnter:I=>{I.currentTarget.style.backgroundColor="var(--accent-blue)"},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="var(--border)"}})]}),s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[s.jsxs("div",{style:{flex:1,overflow:"hidden",position:"relative",minWidth:80},children:[s.jsx(ur,{ref:m,sessionId:e.id}),!e.connected&&s.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--bg-secondary)",opacity:.85,zIndex:2,pointerEvents:"none"},children:s.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"13px",fontStyle:"italic"},children:"Connecting..."})})]}),u&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"md-editor-divider",onMouseDown:ve}),s.jsxs("div",{style:{height:`${q}%`,minHeight:80,flexShrink:0,overflow:"hidden",display:"flex",flexDirection:"column",backgroundColor:"var(--bg-primary)"},children:[s.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 8px",height:"22px",flexShrink:0,backgroundColor:"var(--bg-secondary)",borderBottom:"1px solid var(--border)"},children:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[s.jsx("span",{style:{fontSize:"11px",color:"var(--accent-blue)",fontWeight:500},children:"Chat"}),s.jsx("button",{className:"pane-btn",onClick:()=>{var I;return(I=h.current)==null?void 0:I.send()},disabled:!$,title:"Send to terminal (Ctrl+Enter)",style:$?{color:"var(--accent-green)"}:{opacity:.4,cursor:"default"},children:"Send"}),s.jsx("span",{style:{fontSize:"9px",color:"var(--text-secondary)"},children:"Ctrl+Enter"})]})}),s.jsx("div",{style:{flex:1,overflow:"hidden"},children:s.jsx(Br,{ref:h,onSend:ge,onContentChange:E,sessionId:e.id,token:o||""})})]})]})]})]}),e.error&&s.jsx("div",{style:{padding:"2px 8px",backgroundColor:"var(--bg-secondary)",borderTop:"1px solid var(--accent-red)",color:"var(--accent-red)",fontSize:"11px",flexShrink:0},children:e.error})]})});class Vt extends a.Component{constructor(){super(...arguments);lt(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){}render(){var t,r;return this.state.hasError?this.props.inline?s.jsxs("div",{style:{height:"100%",backgroundColor:"var(--bg-primary)",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"8px",color:"var(--text-bright)",fontFamily:"monospace",padding:"16px"},children:[s.jsx("div",{style:{fontSize:"14px",color:"var(--accent-red)"},children:"Pane crashed"}),s.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",textAlign:"center"},children:((t=this.state.error)==null?void 0:t.message)||"An unexpected error occurred"}),s.jsx("button",{onClick:()=>this.setState({hasError:!1,error:null}),style:{background:"var(--bg-hover)",border:"1px solid var(--border)",color:"var(--text-bright)",padding:"4px 12px",borderRadius:"4px",cursor:"pointer",fontSize:"12px"},children:"Retry"})]}):s.jsxs("div",{style:{minHeight:"100vh",backgroundColor:"var(--bg-primary)",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:"16px",color:"var(--text-bright)",fontFamily:"monospace"},children:[s.jsx("div",{style:{fontSize:"18px",color:"var(--accent-red)"},children:"Something went wrong"}),s.jsx("div",{style:{fontSize:"13px",color:"var(--text-secondary)",maxWidth:"500px",textAlign:"center"},children:((r=this.state.error)==null?void 0:r.message)||"An unexpected error occurred"}),s.jsx("button",{onClick:()=>window.location.reload(),style:{background:"linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%)",border:"none",color:"var(--bg-primary)",padding:"8px 24px",borderRadius:"6px",cursor:"pointer",fontSize:"14px",fontWeight:"bold"},children:"Reload"})]}):this.props.children}}const Kr=4,Et=10;function Jr(){const n=D(o=>o.layout),e=D(o=>o.terminalIds.length),t=D(o=>o.addTerminal);if(!n)return s.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",backgroundColor:"var(--bg-primary)"},children:s.jsx("button",{onClick:()=>t(),style:{background:"none",border:"1px dashed var(--border)",color:"var(--text-secondary)",padding:"16px 32px",borderRadius:"8px",cursor:"pointer",fontSize:"14px"},children:"+ Add Terminal"})});const r=e>1;return s.jsx("div",{style:{height:"100%",width:"100%",overflow:"hidden"},children:s.jsx(Yt,{node:n,canClose:r})})}const Yt=a.memo(function({node:e,canClose:t}){return e.type==="leaf"?s.jsx(qr,{terminalId:e.terminalId,canClose:t}):s.jsx(Vr,{node:e,canClose:t})}),qr=a.memo(function({terminalId:e,canClose:t}){const r=D(o=>o.terminalsMap[e]);return r?s.jsx(Vt,{inline:!0,children:s.jsx(Hr,{terminal:r,canClose:t})}):null}),Vr=a.memo(function({node:e,canClose:t}){const r=D(f=>f.setSplitSizes),o=a.useRef(null),c=e.direction==="horizontal",i=a.useRef(e.sizes);i.current=e.sizes;const u=a.useCallback((f,p)=>{p.preventDefault();const m=c?"resizing-panes":"resizing-panes-v";document.body.classList.add(m);const h=c?p.clientX:p.clientY,b=[...i.current],k=o.current,M=c?(k==null?void 0:k.clientWidth)||1:(k==null?void 0:k.clientHeight)||1;let C=null;const j=$=>{C||(C=requestAnimationFrame(()=>{C=null;const R=((c?$.clientX:$.clientY)-h)/M*100,F=b[f]+R,W=b[f+1]-R;if(F>=Et&&W>=Et){const O=[...b];O[f]=F,O[f+1]=W,r(e.id,O)}}))},x=()=>{C&&cancelAnimationFrame(C),document.body.classList.remove(m),document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",x)};document.addEventListener("mousemove",j),document.addEventListener("mouseup",x)},[c,e.id,r]),l=[];return e.children.forEach((f,p)=>{const m=f.type==="leaf"?f.terminalId:f.id;l.push(s.jsx("div",{style:{flex:`${e.sizes[p]} 0 0`,minWidth:0,minHeight:0,overflow:"hidden"},children:s.jsx(Yt,{node:f,canClose:t})},m)),p<e.children.length-1&&l.push(s.jsx("div",{onMouseDown:h=>u(p,h),style:{flex:`0 0 ${Kr}px`,cursor:c?"col-resize":"row-resize",backgroundColor:"var(--border)",transition:"background-color 0.15s"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--accent-blue)"},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="var(--border)"}},`divider-${e.id}-${p}`))}),s.jsx("div",{ref:o,style:{display:"flex",flexDirection:c?"row":"column",height:"100%",width:"100%",overflow:"hidden"},children:l})});function Yr({tabId:n}){const e=D(T=>T.tabs.find(v=>v.id===n)),t=D(T=>T.activeTabId),r=D(T=>T.switchTab),o=D(T=>T.closeTab),c=D(T=>T.reopenTab),i=D(T=>T.deleteTab),u=D(T=>T.renameTab),l=D(T=>e?e.terminalIds.map(v=>{const z=T.terminalsMap[v];return z?{id:v,connected:z.connected}:{id:v,connected:!1}}):[]),f=D(T=>T.killServerSession),[p,m]=a.useState(!1),[h,b]=a.useState(""),[k,M]=a.useState(!1),C=a.useRef(null);if(!e)return null;const j=t===n,x=e.status==="open",$=()=>{x&&r(n)},E=T=>{x&&(T.stopPropagation(),b(e.name),m(!0),setTimeout(()=>{var v;return(v=C.current)==null?void 0:v.focus()},0))},P=()=>{const T=h.trim();T&&u(n,T),m(!1)},R=T=>{T.stopPropagation(),c(n)},F=T=>{T.stopPropagation(),o(n)},W=async T=>{T.stopPropagation(),window.confirm(`Delete tab "${e.name}"? This will kill all tmux sessions in this tab.`)&&await i(n)},O=T=>{T.stopPropagation(),M(!k)};return s.jsxs("div",{children:[s.jsxs("div",{onClick:$,style:{padding:"8px 12px",cursor:x?"pointer":"default",borderLeft:j?"3px solid var(--accent-blue)":"3px solid transparent",backgroundColor:j?"rgba(122, 162, 247, 0.08)":"transparent",display:"flex",alignItems:"center",gap:"8px",borderBottom:"1px solid var(--border)",transition:"background-color 0.15s",opacity:x?1:.5},onMouseEnter:T=>{x&&!j&&(T.currentTarget.style.backgroundColor="rgba(122, 162, 247, 0.05)")},onMouseLeave:T=>{j||(T.currentTarget.style.backgroundColor="transparent")},children:[x&&e.terminalIds.length>0&&s.jsx("button",{onClick:O,style:{background:"none",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:"10px",padding:0,width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:k?"▼":"▶"}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[p?s.jsx("input",{ref:C,value:h,onChange:T=>b(T.target.value),onBlur:P,onKeyDown:T=>{T.key==="Enter"&&P(),T.key==="Escape"&&m(!1)},style:{width:"100%",background:"var(--bg-primary)",border:"1px solid var(--accent-blue)",color:"var(--text-bright)",borderRadius:"3px",padding:"1px 4px",fontSize:"14px",outline:"none"}}):s.jsx("div",{onDoubleClick:E,style:{color:"var(--text-bright)",fontSize:"14px",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:x?"Double-click to rename":e.name,children:e.name}),s.jsxs("div",{style:{color:"var(--text-secondary)",fontSize:"11px",marginTop:"2px"},children:[e.terminalIds.length," terminal",e.terminalIds.length!==1?"s":""," · ",Jt(Math.floor(e.createdAt/1e3))]})]}),x?s.jsx("button",{className:"pane-btn pane-btn--danger",onClick:F,style:{flexShrink:0},title:"Close tab",children:"×"}):s.jsxs("div",{style:{display:"flex",gap:"4px",flexShrink:0},children:[s.jsx("button",{className:"pane-btn",onClick:R,title:"Reopen tab",style:{fontSize:"11px",padding:"2px 6px"},children:"↻"}),s.jsx("button",{className:"pane-btn pane-btn--danger",onClick:W,title:"Delete tab",children:"×"})]})]}),x&&k&&l.length>0&&s.jsx("div",{style:{paddingLeft:"28px",backgroundColor:"rgba(0, 0, 0, 0.2)"},children:l.map(T=>s.jsxs("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--text-secondary)",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center"},title:`Connected: ${T.connected}`,children:[s.jsx("span",{style:{fontFamily:"monospace"},children:T.id}),s.jsx("span",{style:{marginLeft:"8px",color:T.connected?"var(--accent-green)":"var(--accent-red)"},children:T.connected?"●":"○"}),s.jsx("button",{className:"pane-btn pane-btn--danger",onClick:v=>{v.stopPropagation(),window.confirm(`Close terminal "${T.id}"?`)&&f(T.id)},style:{marginLeft:"auto",flexShrink:0},title:"Close terminal",children:"×"})]},T.id))})]})}function Gr({sessionId:n,active:e,createdAt:t}){const r=D(u=>u.addTerminal),o=D(u=>u.killServerSession),c=()=>{r("horizontal",n)},i=u=>{u.stopPropagation(),window.confirm(`Delete orphaned session "${n}"? This will kill the tmux session.`)&&o(n)};return s.jsxs("div",{onClick:c,style:{padding:"8px 12px",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",borderBottom:"1px solid var(--border)",transition:"background-color 0.15s"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="rgba(122, 162, 247, 0.05)"},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent"},children:[s.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e?"var(--accent-green)":"var(--text-secondary)",flexShrink:0}}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsx("div",{style:{color:"var(--text-bright)",fontSize:"14px",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),s.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"11px",marginTop:"2px"},children:Jt(t)})]}),s.jsx("button",{className:"pane-btn pane-btn--danger",onClick:i,style:{flexShrink:0},title:"Delete session",children:"×"})]})}function Xr(){const n=D(l=>l.sidebarOpen),e=D(l=>l.toggleSidebar),t=D(l=>l.fetchSessions),r=D(l=>n?l.serverSessions:[]),o=D(l=>n?l.tabs:[]),c=D(l=>l.terminalIds.length),i=new Set(o.flatMap(l=>l.terminalIds)),u=r.filter(l=>!i.has(l.sessionId));return a.useEffect(()=>{if(!n)return;t();let l=setInterval(t,5e3);const f=()=>{document.hidden?l&&(clearInterval(l),l=null):(t(),l||(l=setInterval(t,5e3)))};return document.addEventListener("visibilitychange",f),()=>{l&&clearInterval(l),document.removeEventListener("visibilitychange",f)}},[n,t]),a.useEffect(()=>{if(!n)return;const l=setTimeout(t,800);return()=>clearTimeout(l)},[c,n,t]),s.jsxs("div",{className:"session-sidebar",style:{width:n?280:0,height:"100%",backgroundColor:"var(--bg-secondary)",borderLeft:n?"1px solid var(--border)":"none",display:"flex",flexDirection:"column",flexShrink:0,overflow:"hidden",transition:"width 0.2s ease"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[s.jsx("span",{style:{color:"var(--accent-blue)",fontSize:"14px",fontWeight:"bold"},children:"Tabs & Sessions"}),s.jsx("button",{onClick:e,style:{background:"none",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:"16px",padding:"0 4px",lineHeight:1},title:"Close sidebar",children:"×"})]}),s.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[s.jsxs("div",{children:[s.jsx("div",{style:{padding:"8px 12px",color:"var(--accent-blue)",fontSize:"12px",fontWeight:"bold",backgroundColor:"rgba(122, 162, 247, 0.05)",borderBottom:"1px solid var(--border)"},children:"TABS"}),o.length===0?s.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"14px",textAlign:"center",padding:"12px"},children:"No tabs"}):o.map(l=>s.jsx(Yr,{tabId:l.id},l.id))]}),u.length>0&&s.jsxs("div",{style:{marginTop:"16px"},children:[s.jsx("div",{style:{padding:"8px 12px",color:"var(--accent-yellow)",fontSize:"12px",fontWeight:"bold",backgroundColor:"rgba(224, 175, 104, 0.05)",borderBottom:"1px solid var(--border)"},children:"ORPHANED SESSIONS"}),u.map(l=>s.jsx(Gr,{sessionId:l.sessionId,active:l.active,createdAt:l.createdAt},l.sessionId))]})]})]})}const Gt=at.memo(()=>{const n=D(E=>E.tabs),e=D(E=>E.activeTabId),t=D(E=>E.addTab),r=D(E=>E.switchTab),o=D(E=>E.closeTab),c=D(E=>E.renameTab),[i,u]=a.useState(null),[l,f]=a.useState(""),p=a.useRef(null),m=n.filter(E=>E.status==="open");a.useEffect(()=>{i&&p.current&&(p.current.focus(),p.current.select())},[i]);const h=E=>{u(E.id),f(E.name)},b=()=>{i&&l.trim()&&c(i,l.trim()),u(null),f("")},k=()=>{u(null),f("")},M=E=>{E.key==="Enter"?b():E.key==="Escape"&&k()},C=E=>{i||r(E)},j=(E,P)=>{E.stopPropagation(),o(P)},x=(E,P)=>{E.button===1&&(E.preventDefault(),o(P))},$=m.length>1;return s.jsxs("div",{className:"tab-bar",children:[m.map(E=>{const P=E.id===e,R=i===E.id,F=E.terminalIds.length;return s.jsx("div",{className:`tab-item ${P?"tab-item--active":""}`,onClick:()=>C(E.id),onDoubleClick:()=>h(E),onMouseDown:W=>x(W,E.id),children:R?s.jsx("input",{ref:p,type:"text",value:l,onChange:W=>f(W.target.value),onBlur:b,onKeyDown:M,className:"tab-item__rename-input"}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"tab-item__name",children:[E.name," ",F>0&&`(${F})`]}),$&&s.jsx("button",{className:"tab-item__close",onClick:W=>j(W,E.id),title:"Close tab","aria-label":"Close tab",children:"×"})]})},E.id)}),s.jsx("button",{className:"tab-bar-add",onClick:()=>t(),title:"New tab","aria-label":"Add new tab",children:"+"})]})});Gt.displayName="TabBar";function Zr(){return localStorage.getItem("ai-cli-online-token")}function Qr(){const n=D(p=>p.token),e=D(p=>p.setToken),t=D(p=>p.tabs),r=D(p=>p.addTab),o=D(p=>p.toggleSidebar),c=D(p=>p.fontSize),i=D(p=>p.setFontSize),u=D(p=>p.tabsLoading),l=D(p=>p.theme),f=D(p=>p.toggleTheme);return a.useEffect(()=>{const p=Zr();p&&!n&&e(p)},[]),a.useEffect(()=>{n&&!u&&t.filter(p=>p.status==="open").length===0&&r("Default")},[n,u]),n?s.jsxs("div",{style:{height:"100vh",display:"flex",flexDirection:"column",backgroundColor:"var(--bg-primary)"},children:[s.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 16px",backgroundColor:"var(--bg-secondary)",borderBottom:"1px solid var(--border)",flexShrink:0},children:[s.jsx("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:s.jsx("span",{style:{fontSize:"15px",fontWeight:"bold",color:"var(--accent-blue)",letterSpacing:"0.5px"},children:"AI-Cli Online"})}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[s.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",padding:"1px 4px",borderRadius:"6px",backgroundColor:"rgba(0,0,0,0.2)"},children:[s.jsx("button",{className:"header-btn",onClick:()=>i(c-1),disabled:c<=10,title:"Decrease font size",style:{fontSize:"11px",padding:"1px 5px",minWidth:0},children:"A−"}),s.jsx("span",{style:{fontSize:"11px",color:"var(--text-primary)",minWidth:"20px",textAlign:"center"},children:c}),s.jsx("button",{className:"header-btn",onClick:()=>i(c+1),disabled:c>=24,title:"Increase font size",style:{fontSize:"11px",padding:"1px 5px",minWidth:0},children:"A+"})]}),s.jsx(to,{}),s.jsx("button",{className:"header-btn",onClick:f,title:`Switch to ${l==="dark"?"light":"dark"} mode`,"aria-label":"Toggle theme",children:l==="dark"?"☀":"🌙"}),s.jsx("button",{className:"header-btn",onClick:o,title:"Toggle Tabs & Sessions Sidebar","aria-label":"Toggle sidebar",children:"☰"}),s.jsx("button",{className:"header-btn header-btn--muted",onClick:()=>{window.confirm("Logout will close all terminals. Continue?")&&e(null)},children:"Logout"})]})]}),s.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[s.jsx("main",{style:{flex:1,overflow:"hidden"},children:s.jsx(Jr,{})}),s.jsx(Xr,{})]}),s.jsx(Gt,{})]}):s.jsx(Jn,{})}const eo=[1,2,3,4];function to(){const n=D(r=>r.latency);if(n===null)return s.jsx("span",{style:{fontSize:"10px",color:"var(--scrollbar-thumb-hover)"},title:"Measuring latency...",children:"--ms"});let e,t;return n<50?(e="var(--accent-green)",t=4):n<150?(e="var(--accent-yellow)",t=3):n<300?(e="var(--accent-orange)",t=2):(e="var(--accent-red)",t=1),s.jsxs("span",{style:{display:"inline-flex",alignItems:"end",gap:"1.5px",padding:"2px 8px",borderRadius:"10px",backgroundColor:"rgba(0,0,0,0.2)"},title:`Latency: ${n}ms`,children:[eo.map(r=>s.jsx("span",{style:{display:"inline-block",width:"2.5px",height:`${3+r*2}px`,backgroundColor:r<=t?e:"var(--border)",borderRadius:"1px",transition:"background-color 0.3s ease"}},r)),s.jsxs("span",{style:{fontSize:"10px",color:e,marginLeft:"4px",fontWeight:500},children:[n,"ms"]})]})}tt.createRoot(document.getElementById("root")).render(s.jsx(at.StrictMode,{children:s.jsx(Vt,{children:s.jsx(Qr,{})})}));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
3
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
4
|
+
* https://github.com/chjj/term.js
|
|
5
|
+
* @license MIT
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
* Originally forked from (with the author's permission):
|
|
26
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
27
|
+
* http://bellard.org/jslinux/
|
|
28
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
29
|
+
* The original design remains. The terminal itself
|
|
30
|
+
* has been extended to include xterm CSI codes, among
|
|
31
|
+
* other features.
|
|
32
|
+
*/.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;-webkit-user-select:text;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}@font-face{font-family:JetBrains Mono;src:url(/fonts/JetBrainsMono-Regular.woff2) format("woff2");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:JetBrains Mono;src:url(/fonts/JetBrainsMono-Bold.woff2) format("woff2");font-weight:700;font-style:normal;font-display:swap}:root,[data-theme=dark]{--bg-primary: #000000;--bg-secondary: #0c0c0c;--bg-tertiary: #171717;--bg-hover: #1c1c1c;--border: #2d2d2d;--text-primary: #cccccc;--text-secondary: #858585;--text-bright: #e8e8e8;--accent-blue: #569cd6;--accent-purple: #c586c0;--accent-cyan: #4ec9b0;--accent-green: #89d185;--accent-yellow: #cca700;--accent-red: #f44747;--accent-orange: #ce9178;--scrollbar-thumb: rgba(121, 121, 121, .4);--scrollbar-thumb-hover: rgba(121, 121, 121, .7);--selection-bg: rgba(38, 79, 120, .5)}[data-theme=light]{--bg-primary: #faf8f4;--bg-secondary: #f0eee9;--bg-tertiary: #fdfcfa;--bg-hover: #e8e5e0;--border: #d8d4cd;--text-primary: #3b3b3b;--text-secondary: #848484;--text-bright: #1e1e1e;--accent-blue: #005fb8;--accent-purple: #af00db;--accent-cyan: #0e7490;--accent-green: #388a34;--accent-yellow: #bf8803;--accent-red: #cd3131;--accent-orange: #c27d2e;--scrollbar-thumb: rgba(100, 100, 100, .3);--scrollbar-thumb-hover: rgba(100, 100, 100, .5);--selection-bg: rgba(173, 214, 255, .5)}*{margin:0;padding:0;box-sizing:border-box}html,body,#root{width:100%;height:100%;overflow:hidden;background-color:var(--bg-primary);font-family:JetBrains Mono,Menlo,Monaco,Courier New,monospace;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}body.resizing-panes,body.resizing-panes *{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}.session-sidebar{transition:width .2s ease;overflow:hidden;flex-shrink:0;z-index:10;position:relative}body.resizing-panes-v,body.resizing-panes-v *{cursor:row-resize!important;-webkit-user-select:none!important;user-select:none!important}button{transition:all .15s ease;font-family:inherit}button:hover{filter:brightness(1.2)}button:active{transform:scale(.97)}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb);border-radius:3px}::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover)}::selection{background:var(--selection-bg);color:var(--text-bright)}input:focus-visible,button:focus-visible{outline:1px solid var(--accent-blue);outline-offset:1px}.header-btn{background:none;border:1px solid var(--border);color:var(--accent-blue);padding:3px 10px;border-radius:5px;cursor:pointer;font-size:13px;line-height:1.4;transition:all .15s ease}.header-btn:hover{background:#7aa2f71f;border-color:var(--accent-blue);box-shadow:0 0 8px #7aa2f726}.header-btn--muted{color:var(--text-secondary);font-size:12px}.header-btn--muted:hover{color:var(--text-primary);border-color:var(--text-secondary);background:#565f891a}.pane-btn{background:none;border:none;color:var(--text-secondary);cursor:pointer;font-size:12px;line-height:1;padding:2px 5px;border-radius:4px;transition:all .15s ease}.pane-btn:hover{color:var(--accent-blue);background:#7aa2f71f}.pane-btn--danger:hover{color:var(--accent-red);background:#f7768e1f}.login-input{transition:border-color .2s ease,box-shadow .2s ease}.login-input:focus{border-color:var(--accent-blue)!important;box-shadow:0 0 0 3px #7aa2f726}.login-card{box-shadow:0 8px 32px #0006,0 0 0 1px #7aa2f714;transition:box-shadow .3s ease}.login-submit{transition:all .2s ease}.login-submit:not(:disabled):hover{filter:brightness(1.1);box-shadow:0 4px 12px #7aa2f74d}.md-editor-textarea{flex:1;min-width:0;resize:none;border:none;outline:none;padding:8px 12px;font-family:JetBrains Mono,Menlo,Monaco,Courier New,monospace;font-size:13px;line-height:1.5;color:var(--text-primary);background-color:var(--bg-primary);-moz-tab-size:2;tab-size:2}.md-editor-textarea::placeholder{color:var(--scrollbar-thumb-hover);font-style:italic}.md-editor-divider{height:2px;background:var(--border);cursor:row-resize;flex-shrink:0;transition:background .15s ease,box-shadow .15s ease}.md-editor-divider:hover{background:var(--accent-blue);box-shadow:0 0 6px #7aa2f766}.pane-btn--active{color:var(--accent-blue)}.plan-panel-body{display:flex;flex-direction:row;flex:1;min-height:0;overflow:hidden}.plan-renderer{position:relative;overflow:hidden;padding:0;min-width:0;-webkit-user-select:text;user-select:text}.plan-divider-h{width:2px;background:var(--border);cursor:col-resize;flex-shrink:0;transition:background .15s ease,box-shadow .15s ease}.plan-divider-h:hover{background:var(--accent-blue);box-shadow:0 0 6px #7aa2f766}.plan-editor-wrap{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}.plan-filename-input{background:var(--bg-primary);border:1px solid var(--border);color:var(--text-primary);padding:2px 6px;border-radius:3px;font-family:inherit;font-size:11px;width:120px;outline:none;transition:border-color .15s ease}.plan-filename-input:focus{border-color:var(--accent-blue)}body.resizing-panes-h,body.resizing-panes-h *{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}.md-preview{color:var(--text-primary);font-size:13px;line-height:1.6;word-wrap:break-word}.md-preview h1{color:var(--accent-blue);font-size:1.4em;margin:.6em 0 .3em;padding-bottom:.2em;border-bottom:1px solid var(--border)}.md-preview h2{color:var(--accent-purple);font-size:1.2em;margin:.5em 0 .3em}.md-preview h3{color:var(--accent-cyan);font-size:1.05em;margin:.4em 0 .2em}.md-preview p{margin:.4em 0}.md-preview code{background:var(--bg-tertiary);color:var(--text-bright);padding:1px 4px;border-radius:3px;font-size:.9em;font-family:JetBrains Mono,monospace}.md-preview pre{background:var(--bg-tertiary);border:1px solid var(--border);border-radius:4px;padding:10px 12px;overflow-x:auto;margin:.5em 0}.md-preview pre code{background:none;padding:0;border-radius:0}.md-preview blockquote{border-left:3px solid var(--accent-blue);padding:2px 12px;margin:.4em 0;color:var(--text-secondary)}.md-preview ul,.md-preview ol{padding-left:1.5em;margin:.3em 0}.md-preview li{margin:.15em 0}.md-preview table{border-collapse:collapse;width:100%;margin:.5em 0;font-size:12px}.md-preview th,.md-preview td{border:1px solid var(--border);padding:4px 8px;text-align:left}.md-preview th{background:var(--bg-tertiary);color:var(--accent-blue);font-weight:600}.md-preview a{color:var(--accent-blue);text-decoration:none}.md-preview a:hover{text-decoration:underline}.md-preview hr{border:none;border-top:1px solid var(--border);margin:.6em 0}.slash-dropdown{flex-shrink:0;max-height:200px;overflow-y:auto;background:var(--bg-secondary);border-bottom:1px solid var(--border);z-index:10;font-size:13px}.slash-item{display:flex;align-items:center;gap:10px;padding:6px 12px;cursor:pointer;transition:background .12s ease}.slash-item:hover,.slash-item--active{background:var(--bg-hover)}.slash-cmd{color:var(--accent-blue);font-weight:600;min-width:120px;font-family:JetBrains Mono,monospace}.slash-desc{color:var(--accent-purple);font-size:11px}.file-dropdown{flex-shrink:0;max-height:180px;overflow-y:auto;background:var(--bg-secondary);border-bottom:1px solid var(--border);z-index:10;font-size:12px}.file-item{display:flex;align-items:center;gap:8px;padding:5px 10px;cursor:pointer;transition:background .1s ease}.file-item:hover,.file-item--active{background:var(--bg-hover)}.file-loading{color:var(--text-secondary);cursor:default}.file-icon{flex-shrink:0;width:16px;text-align:center;font-size:13px}.file-name{color:var(--text-bright);font-family:JetBrains Mono,monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.history-dropdown{flex-shrink:0;max-height:260px;overflow-y:auto;background:var(--bg-secondary);border-bottom:1px solid var(--border);z-index:10;font-size:12px}.history-item{display:flex;align-items:flex-start;gap:8px;padding:6px 10px;cursor:pointer;transition:background .1s ease;position:relative}.history-item:hover,.history-item--active{background:var(--bg-hover)}.history-empty{color:var(--text-secondary);cursor:default;justify-content:center;padding:12px}.history-text{flex:1;color:var(--text-bright);font-family:JetBrains Mono,monospace;white-space:pre-wrap;overflow-wrap:break-word;line-height:1.4}.history-time{flex-shrink:0;color:var(--text-secondary);font-size:10px;white-space:nowrap;margin-top:2px}.history-delete{flex-shrink:0;background:none;border:none;color:var(--text-secondary);cursor:pointer;font-size:14px;padding:0 2px;line-height:1;opacity:0;transition:opacity .1s ease,color .1s ease}.history-item:hover .history-delete,.history-item--active .history-delete{opacity:1}.history-delete:hover{color:var(--accent-red)}.tab-bar{display:flex;align-items:center;padding:0 10px;height:32px;background:var(--bg-secondary);border-top:1px solid var(--border);flex-shrink:0;overflow-x:auto;gap:3px}.tab-bar::-webkit-scrollbar{height:0}.tab-item{display:flex;align-items:center;gap:6px;padding:4px 12px;font-size:13px;color:var(--text-secondary);cursor:pointer;border-bottom:2px solid transparent;white-space:nowrap;transition:color .15s ease,border-color .15s ease,background .15s ease,box-shadow .15s ease;border-radius:5px 5px 0 0;-webkit-user-select:none;user-select:none;flex-shrink:0}.tab-item:hover{color:var(--text-primary);background:#7aa2f70f}.tab-item--active{color:var(--text-bright);border-bottom-color:var(--accent-blue);background:#7aa2f71a;box-shadow:inset 0 -1px 0 var(--accent-blue)}.tab-item__name{max-width:150px;overflow:hidden;text-overflow:ellipsis}.tab-item__count{font-size:10px;color:var(--scrollbar-thumb-hover)}.tab-item__close{font-size:14px;line-height:1;color:inherit;opacity:0;background:none;border:none;cursor:pointer;padding:0 2px;border-radius:3px;transition:opacity .1s ease}.tab-item:hover .tab-item__close{opacity:.5}.tab-item__close:hover{opacity:1!important;color:var(--accent-red);background:#f7768e1a}.tab-item__rename-input{background:transparent;border:1px solid var(--accent-blue);color:var(--text-bright);font-size:13px;font-family:inherit;padding:0 6px;border-radius:3px;outline:none;width:100px}.tab-bar-add{background:none;border:1px solid transparent;color:var(--text-secondary);font-size:18px;line-height:1;padding:2px 8px;border-radius:5px;cursor:pointer;margin-left:4px;flex-shrink:0}.tab-bar-add:hover{color:var(--accent-blue);border-color:var(--border);background:#7aa2f71a}.pdf-renderer{height:100%;overflow-y:auto;padding:12px;background:var(--bg-primary)}.pdf-renderer canvas{display:block;margin:0 auto 8px;max-width:100%}.doc-expanded-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:100;background:var(--bg-primary);display:flex;flex-direction:column}.doc-expanded-header{display:flex;align-items:center;justify-content:space-between;padding:0 14px;height:28px;flex-shrink:0;background:var(--bg-secondary);border-bottom:1px solid var(--border)}.md-editor-actions{display:flex;align-items:center;gap:8px;padding:4px 8px;flex-shrink:0;background:var(--bg-secondary);border-top:1px solid var(--border)}.plan-anno-toolbar{display:flex;align-items:center;gap:6px;padding:3px 10px;height:28px;flex-shrink:0;background:var(--bg-secondary);border-bottom:1px solid var(--border)}.plan-anno-content{-webkit-user-select:text;user-select:text}.plan-insert-zone{position:relative;min-height:12px}.plan-insert-btn{display:none;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:20px;height:20px;border-radius:50%;border:1px solid var(--scrollbar-thumb-hover);background:var(--bg-secondary);color:var(--accent-blue);font-size:15px;line-height:1;cursor:pointer;padding:0 0 1px;z-index:2;transition:background .12s ease,border-color .12s ease,transform .12s ease;align-items:center;justify-content:center}.plan-insert-zone:hover .plan-insert-btn{display:flex}.plan-anno-content--editing .plan-insert-zone:hover .plan-insert-btn{display:none}.plan-empty-placeholder{display:flex;align-items:center;justify-content:center;min-height:120px;color:var(--text-secondary);font-size:13px;font-style:italic;cursor:pointer;-webkit-user-select:none;user-select:none;text-align:center;padding:16px}.plan-empty-placeholder:hover{color:var(--accent-blue)}.plan-insert-btn:hover{background:var(--bg-hover);border-color:var(--accent-blue);transform:translate(-50%,-50%) scale(1.15)}.plan-annotation-card{display:flex;align-items:flex-start;gap:6px;padding:6px 10px;margin:4px 0;background:#e0af681f;border-left:3px solid var(--accent-yellow);border-radius:0 4px 4px 0}.plan-annotation-card--editing{border-left-color:var(--accent-blue);background:#7aa2f70f}.plan-annotation-textarea{flex:1;min-height:36px;resize:vertical;border:1px solid var(--border);border-radius:3px;background:var(--bg-primary);color:var(--text-primary);font-family:JetBrains Mono,monospace;font-size:12px;padding:4px 6px;outline:none;transition:border-color .15s ease}.plan-annotation-textarea:focus{border-color:var(--accent-blue)}.plan-annotation-textarea::placeholder{color:var(--scrollbar-thumb-hover);font-style:italic}.plan-deletion-card{display:flex;align-items:center;gap:6px;padding:2px 8px;margin:2px 0;background:#f7768e0f;border-left:3px solid var(--accent-red);border-radius:0 4px 4px 0;font-size:11px}.plan-delete-float{position:absolute;z-index:1000;width:24px;height:24px;border-radius:50%;border:1.5px solid var(--accent-red);background:#2a1520;color:var(--accent-red);font-size:16px;font-weight:700;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 10px #f7768e40,0 1px 4px #0006;transition:background .12s ease,transform .12s ease}.plan-delete-float:hover{background:#f7768e33;transform:scale(1.15)}.plan-block--deleted{border-left:3px solid rgba(247,118,142,.5);padding-left:8px;border-radius:2px;position:relative}.mermaid-diagram{margin:8px 0;padding:12px;background:var(--bg-secondary);border:1px solid var(--border);border-radius:6px;overflow-x:auto}.mermaid-diagram svg{display:block;margin:0 auto;max-width:100%;height:auto}.mermaid-error{border-left:3px solid var(--accent-red);padding-left:8px}.mermaid-error__msg{color:var(--accent-red);font-size:11px;margin-top:4px}.pane-btn--sm{font-size:11px;flex-shrink:0}.plan-file-browser{display:flex;flex-direction:column;height:100%;width:100%;background:var(--bg-secondary);overflow:hidden}.plan-file-browser__header{display:flex;align-items:center;justify-content:space-between;padding:4px 8px;height:28px;flex-shrink:0;border-bottom:1px solid var(--border)}.plan-file-browser__title{font-size:11px;color:var(--accent-blue);font-weight:600;letter-spacing:.3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;direction:rtl;text-align:left}.plan-file-browser__list{flex:1;overflow-y:auto;overflow-x:hidden;padding:2px 0}.plan-file-browser__status{padding:8px 10px;font-size:11px;color:var(--text-secondary);font-style:italic}.plan-file-browser__item{display:flex;align-items:center;padding:3px 8px;font-size:12px;cursor:pointer;gap:5px;transition:background .1s ease;border-left:2px solid transparent}.plan-file-browser__item:hover{background:var(--bg-tertiary)}.plan-file-browser__item--active{background:#7aa2f71a;border-left-color:var(--accent-blue)}.plan-file-browser__item--active .plan-file-browser__name{color:var(--text-bright)}.plan-file-browser__icon{flex-shrink:0;width:14px;font-size:10px;color:var(--text-secondary);text-align:center}.plan-file-browser__name{flex:1;color:var(--text-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.plan-file-browser__size{flex-shrink:0;font-size:9px;color:var(--scrollbar-thumb-hover);white-space:nowrap}.plan-file-browser__create{display:flex;align-items:center;gap:4px;padding:4px 6px;border-top:1px solid var(--border);flex-shrink:0}.plan-file-browser__input{flex:1;min-width:0;background:var(--bg-primary);border:1px solid var(--border);color:var(--text-primary);padding:2px 6px;border-radius:3px;font-family:inherit;font-size:11px;outline:none;transition:border-color .15s ease}.plan-file-browser__input:focus{border-color:var(--accent-blue)}.plan-file-browser__input::placeholder{color:var(--scrollbar-thumb-hover);font-style:italic}.plan-overlay-body{display:flex;flex:1;min-height:0;overflow:hidden}.plan-overlay-center{flex:1;min-width:0;overflow:hidden}.plan-anno-counts{display:inline-flex;align-items:center;gap:4px;font-size:10px;margin-left:4px}.plan-anno-counts__unsent{color:var(--accent-yellow)}.plan-anno-counts__sent{color:var(--accent-green)}.plan-anno-dropdown-trigger{display:flex;align-items:center;gap:4px;padding:2px 6px;border:1px solid var(--border);border-radius:3px;cursor:pointer;background:var(--bg-primary);transition:border-color .15s ease,background .15s ease;min-width:0}.plan-anno-dropdown-trigger:hover,.plan-anno-dropdown-trigger--active{border-color:var(--accent-blue);background:var(--bg-hover)}.plan-anno-dropdown-trigger__text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--text-secondary)}.plan-anno-dropdown-trigger__arrow{flex-shrink:0;font-size:9px;color:var(--text-secondary);transition:transform .15s ease}.plan-anno-dropdown-trigger--active .plan-anno-dropdown-trigger__arrow{transform:rotate(180deg)}.plan-anno-dropdown{position:absolute;top:100%;right:0;z-index:100;width:320px;max-height:300px;display:flex;flex-direction:column;background:var(--bg-secondary);border:1px solid var(--border);border-radius:4px;box-shadow:0 4px 12px #0000004d;overflow:hidden}.plan-anno-dropdown__header{display:flex;align-items:center;justify-content:center;padding:4px 6px;border-bottom:1px solid var(--border);flex-shrink:0}.plan-anno-dropdown__list{flex:1;overflow-y:auto;padding:2px 0}.plan-anno-dropdown__item{display:flex;align-items:center;gap:4px;padding:3px 6px;font-size:11px;border-bottom:1px solid var(--border-subtle, rgba(128,128,128,.1))}.plan-anno-dropdown__item:last-child{border-bottom:none}.plan-anno-dropdown__item--add{border-left:2px solid var(--accent-yellow)}.plan-anno-dropdown__item--del{border-left:2px solid var(--accent-red)}.plan-anno-dropdown__type{flex-shrink:0;width:14px;font-weight:700;text-align:center}.plan-anno-dropdown__text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-primary)}.plan-anno-dropdown__badge{flex-shrink:0;font-size:9px;padding:0 4px;border-radius:3px;background:var(--accent-green);color:var(--bg-primary)}.plan-anno-dropdown__empty{padding:8px;text-align:center;font-size:11px;color:var(--text-secondary);font-style:italic}
|
package/web/dist/index.html
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
<!-- Fonts loaded locally from /fonts/ -->
|
|
8
8
|
<title>AI-Cli Online</title>
|
|
9
9
|
<link rel="preload" href="/fonts/JetBrainsMono-Regular.woff2" as="font" type="font/woff2" crossorigin />
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-CmWFgqt3.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-BCIvbQoU.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/terminal-DnNpv9tw.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/markdown-BERZKN_L.js">
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CtLiFTts.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
3
|
-
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
4
|
-
* https://github.com/chjj/term.js
|
|
5
|
-
* @license MIT
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in
|
|
15
|
-
* all copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
-
* THE SOFTWARE.
|
|
24
|
-
*
|
|
25
|
-
* Originally forked from (with the author's permission):
|
|
26
|
-
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
27
|
-
* http://bellard.org/jslinux/
|
|
28
|
-
* Copyright (c) 2011 Fabrice Bellard
|
|
29
|
-
* The original design remains. The terminal itself
|
|
30
|
-
* has been extended to include xterm CSI codes, among
|
|
31
|
-
* other features.
|
|
32
|
-
*/.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;-webkit-user-select:text;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}@font-face{font-family:JetBrains Mono;src:url(/fonts/JetBrainsMono-Regular.woff2) format("woff2");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:JetBrains Mono;src:url(/fonts/JetBrainsMono-Bold.woff2) format("woff2");font-weight:700;font-style:normal;font-display:swap}*{margin:0;padding:0;box-sizing:border-box}html,body,#root{width:100%;height:100%;overflow:hidden;background-color:#1a1b26;font-family:JetBrains Mono,Menlo,Monaco,Courier New,monospace;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}body.resizing-panes,body.resizing-panes *{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}.session-sidebar{transition:width .2s ease;overflow:hidden;flex-shrink:0;z-index:10;position:relative}body.resizing-panes-v,body.resizing-panes-v *{cursor:row-resize!important;-webkit-user-select:none!important;user-select:none!important}button{transition:all .15s ease;font-family:inherit}button:hover{filter:brightness(1.2)}button:active{transform:scale(.97)}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#292e42;border-radius:3px}::-webkit-scrollbar-thumb:hover{background:#414868}::selection{background:#7aa2f74d;color:#c0caf5}input:focus-visible,button:focus-visible{outline:1px solid #7aa2f7;outline-offset:1px}.header-btn{background:none;border:1px solid #292e42;color:#7aa2f7;padding:3px 10px;border-radius:5px;cursor:pointer;font-size:13px;line-height:1.4;transition:all .15s ease}.header-btn:hover{background:#7aa2f71f;border-color:#7aa2f7;box-shadow:0 0 8px #7aa2f726}.header-btn--muted{color:#565f89;font-size:12px}.header-btn--muted:hover{color:#a9b1d6;border-color:#565f89;background:#565f891a}.pane-btn{background:none;border:none;color:#565f89;cursor:pointer;font-size:14px;line-height:1;padding:3px 6px;border-radius:4px;transition:all .15s ease}.pane-btn:hover{color:#7aa2f7;background:#7aa2f71f}.pane-btn--danger:hover{color:#f7768e;background:#f7768e1f}.login-input{transition:border-color .2s ease,box-shadow .2s ease}.login-input:focus{border-color:#7aa2f7!important;box-shadow:0 0 0 3px #7aa2f726}.login-card{box-shadow:0 8px 32px #0006,0 0 0 1px #7aa2f714;transition:box-shadow .3s ease}.login-submit{transition:all .2s ease}.login-submit:not(:disabled):hover{filter:brightness(1.1);box-shadow:0 4px 12px #7aa2f74d}.md-editor-textarea{flex:1;min-width:0;resize:none;border:none;outline:none;padding:8px 12px;font-family:JetBrains Mono,Menlo,Monaco,Courier New,monospace;font-size:13px;line-height:1.5;color:#a9b1d6;background-color:#1a1b26;-moz-tab-size:2;tab-size:2}.md-editor-textarea::placeholder{color:#414868;font-style:italic}.md-editor-divider{height:4px;background:#292e42;cursor:row-resize;flex-shrink:0;transition:background .15s ease,box-shadow .15s ease}.md-editor-divider:hover{background:#7aa2f7;box-shadow:0 0 6px #7aa2f766}.pane-btn--active{color:#7aa2f7}.plan-panel-body{display:flex;flex-direction:row;flex:1;min-height:0;overflow:hidden}.plan-renderer{position:relative;overflow:hidden;padding:0;min-width:0;-webkit-user-select:text;user-select:text}.plan-divider-h{width:4px;background:#292e42;cursor:col-resize;flex-shrink:0;transition:background .15s ease,box-shadow .15s ease}.plan-divider-h:hover{background:#7aa2f7;box-shadow:0 0 6px #7aa2f766}.plan-editor-wrap{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}.plan-filename-input{background:#1a1b26;border:1px solid #292e42;color:#a9b1d6;padding:2px 6px;border-radius:3px;font-family:inherit;font-size:11px;width:120px;outline:none;transition:border-color .15s ease}.plan-filename-input:focus{border-color:#7aa2f7}body.resizing-panes-h,body.resizing-panes-h *{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}.md-preview{color:#a9b1d6;font-size:13px;line-height:1.6;word-wrap:break-word}.md-preview h1{color:#7aa2f7;font-size:1.4em;margin:.6em 0 .3em;padding-bottom:.2em;border-bottom:1px solid #292e42}.md-preview h2{color:#bb9af7;font-size:1.2em;margin:.5em 0 .3em}.md-preview h3{color:#7dcfff;font-size:1.05em;margin:.4em 0 .2em}.md-preview p{margin:.4em 0}.md-preview code{background:#24283b;color:#c0caf5;padding:1px 4px;border-radius:3px;font-size:.9em;font-family:JetBrains Mono,monospace}.md-preview pre{background:#24283b;border:1px solid #292e42;border-radius:4px;padding:10px 12px;overflow-x:auto;margin:.5em 0}.md-preview pre code{background:none;padding:0;border-radius:0}.md-preview blockquote{border-left:3px solid #7aa2f7;padding:2px 12px;margin:.4em 0;color:#565f89}.md-preview ul,.md-preview ol{padding-left:1.5em;margin:.3em 0}.md-preview li{margin:.15em 0}.md-preview table{border-collapse:collapse;width:100%;margin:.5em 0;font-size:12px}.md-preview th,.md-preview td{border:1px solid #292e42;padding:4px 8px;text-align:left}.md-preview th{background:#24283b;color:#7aa2f7;font-weight:600}.md-preview a{color:#7aa2f7;text-decoration:none}.md-preview a:hover{text-decoration:underline}.md-preview hr{border:none;border-top:1px solid #292e42;margin:.6em 0}.slash-dropdown{flex-shrink:0;max-height:200px;overflow-y:auto;background:#1e2030;border-bottom:1px solid #292e42;z-index:10;font-size:13px}.slash-item{display:flex;align-items:center;gap:10px;padding:6px 12px;cursor:pointer;transition:background .12s ease}.slash-item:hover,.slash-item--active{background:#292e42}.slash-cmd{color:#7aa2f7;font-weight:600;min-width:120px;font-family:JetBrains Mono,monospace}.slash-desc{color:#bb9af7;font-size:11px}.file-dropdown{flex-shrink:0;max-height:180px;overflow-y:auto;background:#1e2030;border-bottom:1px solid #292e42;z-index:10;font-size:12px}.file-item{display:flex;align-items:center;gap:8px;padding:5px 10px;cursor:pointer;transition:background .1s ease}.file-item:hover,.file-item--active{background:#292e42}.file-loading{color:#565f89;cursor:default}.file-icon{flex-shrink:0;width:16px;text-align:center;font-size:13px}.file-name{color:#c0caf5;font-family:JetBrains Mono,monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.history-dropdown{flex-shrink:0;max-height:260px;overflow-y:auto;background:#1e2030;border-bottom:1px solid #292e42;z-index:10;font-size:12px}.history-item{display:flex;align-items:flex-start;gap:8px;padding:6px 10px;cursor:pointer;transition:background .1s ease;position:relative}.history-item:hover,.history-item--active{background:#292e42}.history-empty{color:#565f89;cursor:default;justify-content:center;padding:12px}.history-text{flex:1;color:#c0caf5;font-family:JetBrains Mono,monospace;white-space:pre-wrap;overflow-wrap:break-word;line-height:1.4}.history-time{flex-shrink:0;color:#565f89;font-size:10px;white-space:nowrap;margin-top:2px}.history-delete{flex-shrink:0;background:none;border:none;color:#565f89;cursor:pointer;font-size:14px;padding:0 2px;line-height:1;opacity:0;transition:opacity .1s ease,color .1s ease}.history-item:hover .history-delete,.history-item--active .history-delete{opacity:1}.history-delete:hover{color:#f7768e}.tab-bar{display:flex;align-items:center;padding:0 10px;height:32px;background:#16161e;border-top:1px solid #292e42;flex-shrink:0;overflow-x:auto;gap:3px}.tab-bar::-webkit-scrollbar{height:0}.tab-item{display:flex;align-items:center;gap:6px;padding:4px 12px;font-size:13px;color:#565f89;cursor:pointer;border-bottom:2px solid transparent;white-space:nowrap;transition:color .15s ease,border-color .15s ease,background .15s ease,box-shadow .15s ease;border-radius:5px 5px 0 0;-webkit-user-select:none;user-select:none;flex-shrink:0}.tab-item:hover{color:#a9b1d6;background:#7aa2f70f}.tab-item--active{color:#c0caf5;border-bottom-color:#7aa2f7;background:#7aa2f71a;box-shadow:inset 0 -1px #7aa2f7}.tab-item__name{max-width:150px;overflow:hidden;text-overflow:ellipsis}.tab-item__count{font-size:10px;color:#414868}.tab-item__close{font-size:14px;line-height:1;color:inherit;opacity:0;background:none;border:none;cursor:pointer;padding:0 2px;border-radius:3px;transition:opacity .1s ease}.tab-item:hover .tab-item__close{opacity:.5}.tab-item__close:hover{opacity:1!important;color:#f7768e;background:#f7768e1a}.tab-item__rename-input{background:transparent;border:1px solid #7aa2f7;color:#c0caf5;font-size:13px;font-family:inherit;padding:0 6px;border-radius:3px;outline:none;width:100px}.tab-bar-add{background:none;border:1px solid transparent;color:#565f89;font-size:18px;line-height:1;padding:2px 8px;border-radius:5px;cursor:pointer;margin-left:4px;flex-shrink:0}.tab-bar-add:hover{color:#7aa2f7;border-color:#292e42;background:#7aa2f71a}.pdf-renderer{height:100%;overflow-y:auto;padding:12px;background:#1a1b26}.pdf-renderer canvas{display:block;margin:0 auto 8px;max-width:100%}.doc-expanded-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:100;background:#1a1b26;display:flex;flex-direction:column}.doc-expanded-header{display:flex;align-items:center;justify-content:space-between;padding:0 14px;height:34px;flex-shrink:0;background:#16161e;border-bottom:1px solid #292e42}.md-editor-actions{display:flex;align-items:center;gap:8px;padding:4px 8px;flex-shrink:0;background:#16161e;border-top:1px solid #292e42}.plan-anno-toolbar{display:flex;align-items:center;gap:6px;padding:3px 10px;height:32px;flex-shrink:0;background:#16161e;border-bottom:1px solid #292e42}.plan-anno-content{-webkit-user-select:text;user-select:text}.plan-insert-zone{position:relative;min-height:12px}.plan-insert-btn{display:none;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:20px;height:20px;border-radius:50%;border:1px solid #414868;background:#1e2030;color:#7aa2f7;font-size:15px;cursor:pointer;padding:0;z-index:2;transition:background .12s ease,border-color .12s ease,transform .12s ease;align-items:center;justify-content:center}.plan-insert-zone:hover .plan-insert-btn,.plan-insert-zone--empty .plan-insert-btn{display:flex}.plan-insert-zone--empty{min-height:48px}.plan-insert-zone--empty .plan-insert-btn{width:24px;height:24px;font-size:16px;border-color:#565f89}.plan-insert-btn:hover{background:#292e42;border-color:#7aa2f7;transform:translate(-50%,-50%) scale(1.15)}.plan-annotation-card{display:flex;align-items:flex-start;gap:6px;padding:6px 10px;margin:4px 0;background:#e0af681f;border-left:3px solid #e0af68;border-radius:0 4px 4px 0}.plan-annotation-card--editing{border-left-color:#7aa2f7;background:#7aa2f70f}.plan-annotation-textarea{flex:1;min-height:36px;resize:vertical;border:1px solid #292e42;border-radius:3px;background:#1a1b26;color:#a9b1d6;font-family:JetBrains Mono,monospace;font-size:12px;padding:4px 6px;outline:none;transition:border-color .15s ease}.plan-annotation-textarea:focus{border-color:#7aa2f7}.plan-annotation-textarea::placeholder{color:#414868;font-style:italic}.plan-deletion-card{display:flex;align-items:center;gap:6px;padding:2px 8px;margin:2px 0;background:#f7768e0f;border-left:3px solid #f7768e;border-radius:0 4px 4px 0;font-size:11px}.plan-delete-float{position:absolute;z-index:1000;width:24px;height:24px;border-radius:50%;border:1.5px solid #f7768e;background:#2a1520;color:#f7768e;font-size:16px;font-weight:700;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 10px #f7768e40,0 1px 4px #0006;transition:background .12s ease,transform .12s ease}.plan-delete-float:hover{background:#f7768e33;transform:scale(1.15)}.plan-block--deleted{border-left:3px solid rgba(247,118,142,.5);padding-left:8px;border-radius:2px;position:relative}.mermaid-diagram{margin:8px 0;padding:12px;background:#1e2030;border:1px solid #292e42;border-radius:6px;overflow-x:auto}.mermaid-diagram svg{display:block;margin:0 auto;max-width:100%;height:auto}.mermaid-error{border-left:3px solid #f7768e;padding-left:8px}.mermaid-error__msg{color:#f7768e;font-size:11px;margin-top:4px}.pane-btn--sm{font-size:11px;flex-shrink:0}
|