neural-loom 0.2.67 → 0.2.69

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.
Files changed (73) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/diagnostics/route-bundle-stats.json +1 -1
  7. package/.next/fallback-build-manifest.json +3 -3
  8. package/.next/prerender-manifest.json +3 -3
  9. package/.next/server/app/_global-error.html +1 -1
  10. package/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found.html +1 -1
  17. package/.next/server/app/_not-found.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  24. package/.next/server/app/api/configs/route.js.nft.json +1 -1
  25. package/.next/server/app/api/context/aider/route.js.nft.json +1 -1
  26. package/.next/server/app/api/context/claude/route.js.nft.json +1 -1
  27. package/.next/server/app/api/context/route.js.nft.json +1 -1
  28. package/.next/server/app/api/context/ssh/route.js.nft.json +1 -1
  29. package/.next/server/app/api/recents/route.js.nft.json +1 -1
  30. package/.next/server/app/api/sessions/inject/route.js.nft.json +1 -1
  31. package/.next/server/app/api/sessions/input/route.js.nft.json +1 -1
  32. package/.next/server/app/api/sessions/launch/route.js.nft.json +1 -1
  33. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  34. package/.next/server/app/api/sessions/scope/route.js.nft.json +1 -1
  35. package/.next/server/app/api/sessions/start/route.js.nft.json +1 -1
  36. package/.next/server/app/api/sessions/stats/route.js.nft.json +1 -1
  37. package/.next/server/app/api/sessions/stop/route.js.nft.json +1 -1
  38. package/.next/server/app/api/sessions/upload-image/route.js.nft.json +1 -1
  39. package/.next/server/app/api/sql/connections/route.js.nft.json +1 -1
  40. package/.next/server/app/api/sql/mcp/route.js.nft.json +1 -1
  41. package/.next/server/app/api/sql/query/route.js.nft.json +1 -1
  42. package/.next/server/app/api/sql/schema/route.js.nft.json +1 -1
  43. package/.next/server/app/index.html +1 -1
  44. package/.next/server/app/index.rsc +2 -2
  45. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  46. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  47. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  48. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  49. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  50. package/.next/server/app/page/react-loadable-manifest.json +3 -3
  51. package/.next/server/app/page_client-reference-manifest.js +1 -1
  52. package/.next/server/chunks/[root-of-the-server]__0tq0maq._.js +1 -1
  53. package/.next/server/chunks/[root-of-the-server]__0tq0maq._.js.map +1 -1
  54. package/.next/server/middleware-build-manifest.js +3 -3
  55. package/.next/server/pages/404.html +1 -1
  56. package/.next/server/pages/500.html +1 -1
  57. package/.next/server/server-reference-manifest.js +1 -1
  58. package/.next/server/server-reference-manifest.json +1 -1
  59. package/.next/static/chunks/{16rky3981raz5.js → 008bf~h8rh5_3.js} +3 -3
  60. package/.next/static/chunks/{15_baizhaiq8c.js → 00pgauqedvo01.js} +2 -2
  61. package/.next/static/chunks/0ii_nb0g40rmj.js +4 -0
  62. package/.next/trace +1 -1
  63. package/.next/trace-build +1 -1
  64. package/README.md +5 -5
  65. package/package.json +1 -1
  66. package/public/feature-guide.html +1443 -0
  67. package/src/app/components/IdeLayout.tsx +1 -1
  68. package/src/app/components/MarkdownPreview.tsx +28 -1
  69. package/src/app/components/TerminalConsole.tsx +67 -2
  70. package/.next/static/chunks/0sr3d9iqny2rf.js +0 -4
  71. /package/.next/static/{oWEeFdgDSIDLRom42Fn3s → EglcK14vXeSWIjxjJCP9A}/_buildManifest.js +0 -0
  72. /package/.next/static/{oWEeFdgDSIDLRom42Fn3s → EglcK14vXeSWIjxjJCP9A}/_clientMiddlewareManifest.js +0 -0
  73. /package/.next/static/{oWEeFdgDSIDLRom42Fn3s → EglcK14vXeSWIjxjJCP9A}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,67585,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSR",{enumerable:!0,get:function(){return s}});let a=e.r(32061);function s({reason:e,children:t}){if("u"<typeof window)throw Object.defineProperty(new a.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t}},9885,(e,t,r)=>{"use strict";function a(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"encodeURIPath",{enumerable:!0,get:function(){return a}})},52157,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return i}});let a=e.r(43476),s=e.r(74080),n=e.r(63599),l=e.r(9885),o=e.r(43369);function i({moduleIds:e}){if("u">typeof window)return null;let t=n.workAsyncStorage.getStore();if(void 0===t)return null;let r=[];if(t.reactLoadableManifest&&e){let a=t.reactLoadableManifest;for(let t of e){if(!a[t])continue;let e=a[t].files;r.push(...e)}}if(0===r.length)return null;let d=(0,o.getAssetTokenQuery)();return(0,a.jsx)(a.Fragment,{children:r.map(e=>{let r=`${t.assetPrefix}/_next/${(0,l.encodeURIPath)(e)}${d}`;return e.endsWith(".css")?(0,a.jsx)("link",{precedence:"dynamic",href:r,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,s.preload)(r,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},69093,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return d}});let a=e.r(43476),s=e.r(71645),n=e.r(67585),l=e.r(52157);function o(e){return{default:e&&"default"in e?e.default:e}}let i={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},d=function(e){let t={...i,...e},r=(0,s.lazy)(()=>t.loader().then(o)),d=t.loading;function c(e){let o=d?(0,a.jsx)(d,{isLoading:!0,pastDelay:!0,error:null}):null,i=!t.ssr||!!t.loading,c=i?s.Suspense:s.Fragment,u=t.ssr?(0,a.jsxs)(a.Fragment,{children:["u"<typeof window?(0,a.jsx)(l.PreloadChunks,{moduleIds:t.modules}):null,(0,a.jsx)(r,{...e})]}):(0,a.jsx)(n.BailoutToCSR,{reason:"next/dynamic",children:(0,a.jsx)(r,{...e})});return(0,a.jsx)(c,{...i?{fallback:o}:{},children:u})}return c.displayName="LoadableComponent",c}},70703,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return s}});let a=e.r(55682)._(e.r(69093));function s(e,t){let r={};"function"==typeof e&&(r.loader=e);let s={...r,...t};return(0,a.default)({...s,modules:s.loadableGenerated?.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},66381,e=>{"use strict";var t=e.i(43476),r=e.i(71645),a=e.i(74080);let s={display:"flex",height:"100%",width:"100%",backgroundColor:"#05070a",color:"#cbd5e1",fontSize:"0.875rem",minHeight:0},n={width:"220px",borderRight:"1px solid var(--border)",display:"flex",flexDirection:"column",minHeight:0,backgroundColor:"rgba(10, 15, 24, 0.4)",flexShrink:0},l={display:"flex",flexDirection:"column",padding:"1rem",minHeight:0},o={display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.75rem"},i={fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",fontSize:"0.75rem",color:"var(--muted)"},d={padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.7rem",fontWeight:600,cursor:"pointer"},c={display:"flex",flexDirection:"column",gap:"0.4rem",overflowY:"auto",maxHeight:"220px"},u={fontSize:"0.65rem",fontWeight:600,color:"var(--muted)",marginTop:"0.5rem",marginBottom:"0.2rem",letterSpacing:"0.05em"},p={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.5rem 0.6rem",borderRadius:"6px",backgroundColor:"rgba(255, 255, 255, 0.02)",border:"1px solid var(--border)",cursor:"pointer",transition:"all 0.2s ease"},m={backgroundColor:"rgba(109, 40, 217, 0.08)",border:"1px solid var(--border-focus)",boxShadow:"0 0 10px rgba(109, 40, 217, 0.1)"},f={display:"flex",flexDirection:"column",gap:"0.15rem",flex:1,minWidth:0},h={fontWeight:600,fontSize:"0.8rem",color:"#fff",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},g={fontSize:"0.7rem",color:"var(--muted)",textTransform:"uppercase"},x={background:"none",border:"none",color:"rgba(239, 68, 68, 0.4)",cursor:"pointer",fontSize:"0.75rem",padding:"0.25rem"},y={display:"flex",flexDirection:"column",gap:"0.25rem",overflowY:"auto",flex:1,minHeight:0},b={fontSize:"0.75rem",color:"var(--muted)",textAlign:"center",padding:"1rem 0"},j={display:"flex",flexDirection:"column"},v={display:"flex",alignItems:"center",padding:"0.35rem 0.5rem",borderRadius:"4px",cursor:"pointer",userSelect:"none",transition:"background 0.2s ease"},_={marginRight:"0.4rem",fontSize:"0.9rem"},w={flex:1,fontSize:"0.8rem",color:"#e2e8f0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},S={fontSize:"0.6rem",color:"var(--muted)",marginLeft:"0.25rem"},k={display:"flex",flexDirection:"column",gap:"0.2rem",paddingLeft:"1.5rem",marginTop:"0.15rem",borderLeft:"1px dashed rgba(255,255,255,0.06)",marginLeft:"0.8rem",marginBottom:"0.25rem"},C={display:"flex",alignItems:"center",padding:"0.15rem 0.25rem",fontSize:"0.75rem"},N={marginRight:"0.3rem",fontSize:"0.7rem"},R={flex:1,color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis"},E={fontSize:"0.65rem",color:"rgba(109, 40, 217, 0.75)",fontFamily:"monospace",paddingLeft:"0.5rem"},L={flex:1,display:"flex",flexDirection:"column",minHeight:0,backgroundColor:"#05070a"},W={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 1rem",borderBottom:"1px solid var(--border)",backgroundColor:"rgba(15, 23, 42, 0.3)",flexShrink:0},O={fontSize:"0.75rem",color:"var(--muted)"},T={fontSize:"0.8rem",fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:"0.4rem"},I={padding:"0.1rem 0.4rem",borderRadius:"4px",backgroundColor:"rgba(234, 179, 8, 0.12)",color:"#eab308",fontSize:"0.65rem",fontWeight:700,border:"1px solid rgba(234, 179, 8, 0.2)"},D={padding:"0.4rem 0.9rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.8rem",fontWeight:600,transition:"all 0.2s ease"},P={height:"180px",borderBottom:"1px solid var(--border)",position:"relative",flexShrink:0},z={width:"100%",height:"100%",backgroundColor:"#080c14",border:"none",resize:"none",color:"#e2e8f0",fontFamily:"monospace",fontSize:"0.85rem",padding:"1rem",outline:"none",lineHeight:"1.4"},q={flex:1,display:"flex",flexDirection:"column",minHeight:0,padding:"1rem"},A={padding:"1rem",borderRadius:"8px",backgroundColor:"rgba(239, 68, 68, 0.08)",border:"1px solid rgba(239, 68, 68, 0.2)",overflowY:"auto"},B={margin:0,fontFamily:"monospace",fontSize:"0.8rem",color:"#f87171",whiteSpace:"pre-wrap"},$={marginTop:"1rem",padding:"0.75rem",borderRadius:"6px",backgroundColor:"rgba(0, 0, 0, 0.3)",border:"1px solid var(--border)"},F={display:"block",padding:"0.5rem",backgroundColor:"#090d16",borderRadius:"4px",fontFamily:"monospace",fontSize:"0.8rem",color:"var(--primary)",border:"1px solid var(--border)"},M={display:"flex",flexDirection:"column",height:"100%",minHeight:0},U={display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.75rem",color:"var(--muted)",marginBottom:"0.5rem"},H={flex:1,overflow:"auto",border:"1px solid var(--border)",borderRadius:"6px"},G={width:"100%",borderCollapse:"collapse",fontFamily:"monospace",fontSize:"0.8rem"},J={padding:"0.5rem 0.75rem",textAlign:"left",backgroundColor:"#0f172a",borderBottom:"1px solid var(--border)",color:"#94a3b8",fontWeight:600,position:"sticky",top:0,zIndex:1},Q={padding:"0.4rem 0.75rem",borderBottom:"1px solid rgba(255, 255, 255, 0.03)",color:"#cbd5e1",whiteSpace:"nowrap"},K={padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid var(--border)",backgroundColor:"rgba(255, 255, 255, 0.02)",color:"var(--muted)",fontSize:"0.7rem",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease"},Y={width:"100%",backgroundColor:"#070a12",border:"1px solid var(--border-focus)",borderRadius:"3px",color:"#fff",padding:"0.1rem 0.3rem",fontSize:"0.8rem",fontFamily:"monospace",outline:"none"},V={cursor:"pointer",transition:"all 0.15s ease"},X={backgroundColor:"transparent"},Z={backgroundColor:"rgba(255, 255, 255, 0.01)"},ee={flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--muted)",fontSize:"0.8rem",textAlign:"center"},et={flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"1rem"},er={width:"24px",height:"24px",border:"3px solid rgba(109, 40, 217, 0.15)",borderTop:"3px solid var(--primary)",borderRadius:"50%",animation:"spin 1s linear infinite"},ea={width:"12px",height:"12px",border:"2px solid rgba(255, 255, 255, 0.1)",borderTop:"2px solid var(--muted)",borderRadius:"50%",animation:"spin 1s linear infinite"},es={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999},en={width:"480px",backgroundColor:"#0d131f",borderRadius:"12px",border:"1px solid var(--border-focus)",padding:"1.5rem",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.5)"},el={display:"flex",flexDirection:"column",gap:"0.35rem",marginBottom:"1rem"},eo={fontSize:"0.75rem",fontWeight:600,color:"var(--muted)"},ei={padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"#070a12",color:"#fff",outline:"none",fontSize:"0.8rem"},ed={padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"#070a12",color:"#fff",outline:"none",fontSize:"0.8rem"},ec={padding:"0.5rem",borderRadius:"6px",fontSize:"0.75rem",marginBottom:"1rem"},eu={display:"flex",justifyContent:"space-between",marginTop:"1.5rem"},ep={padding:"0.4rem 0.75rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"transparent",color:"var(--muted)",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},em={padding:"0.4rem 0.75rem",borderRadius:"6px",border:"none",backgroundColor:"transparent",color:"var(--muted)",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},ef={padding:"0.4rem 0.75rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"};if("u">typeof document){let e=document.createElement("style");e.innerHTML=`
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,67585,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSR",{enumerable:!0,get:function(){return a}});let s=e.r(32061);function a({reason:e,children:t}){if("u"<typeof window)throw Object.defineProperty(new s.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t}},9885,(e,t,r)=>{"use strict";function s(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"encodeURIPath",{enumerable:!0,get:function(){return s}})},52157,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return i}});let s=e.r(43476),a=e.r(74080),n=e.r(63599),l=e.r(9885),o=e.r(43369);function i({moduleIds:e}){if("u">typeof window)return null;let t=n.workAsyncStorage.getStore();if(void 0===t)return null;let r=[];if(t.reactLoadableManifest&&e){let s=t.reactLoadableManifest;for(let t of e){if(!s[t])continue;let e=s[t].files;r.push(...e)}}if(0===r.length)return null;let d=(0,o.getAssetTokenQuery)();return(0,s.jsx)(s.Fragment,{children:r.map(e=>{let r=`${t.assetPrefix}/_next/${(0,l.encodeURIPath)(e)}${d}`;return e.endsWith(".css")?(0,s.jsx)("link",{precedence:"dynamic",href:r,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,a.preload)(r,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},69093,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return d}});let s=e.r(43476),a=e.r(71645),n=e.r(67585),l=e.r(52157);function o(e){return{default:e&&"default"in e?e.default:e}}let i={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},d=function(e){let t={...i,...e},r=(0,a.lazy)(()=>t.loader().then(o)),d=t.loading;function c(e){let o=d?(0,s.jsx)(d,{isLoading:!0,pastDelay:!0,error:null}):null,i=!t.ssr||!!t.loading,c=i?a.Suspense:a.Fragment,u=t.ssr?(0,s.jsxs)(s.Fragment,{children:["u"<typeof window?(0,s.jsx)(l.PreloadChunks,{moduleIds:t.modules}):null,(0,s.jsx)(r,{...e})]}):(0,s.jsx)(n.BailoutToCSR,{reason:"next/dynamic",children:(0,s.jsx)(r,{...e})});return(0,s.jsx)(c,{...i?{fallback:o}:{},children:u})}return c.displayName="LoadableComponent",c}},70703,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return a}});let s=e.r(55682)._(e.r(69093));function a(e,t){let r={};"function"==typeof e&&(r.loader=e);let a={...r,...t};return(0,s.default)({...a,modules:a.loadableGenerated?.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},66381,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(74080);let a={display:"flex",height:"100%",width:"100%",backgroundColor:"#05070a",color:"#cbd5e1",fontSize:"0.875rem",minHeight:0},n={width:"220px",borderRight:"1px solid var(--border)",display:"flex",flexDirection:"column",minHeight:0,backgroundColor:"rgba(10, 15, 24, 0.4)",flexShrink:0},l={display:"flex",flexDirection:"column",padding:"1rem",minHeight:0},o={display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.75rem"},i={fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",fontSize:"0.75rem",color:"var(--muted)"},d={padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.7rem",fontWeight:600,cursor:"pointer"},c={display:"flex",flexDirection:"column",gap:"0.4rem",overflowY:"auto",maxHeight:"220px"},u={fontSize:"0.65rem",fontWeight:600,color:"var(--muted)",marginTop:"0.5rem",marginBottom:"0.2rem",letterSpacing:"0.05em"},p={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.5rem 0.6rem",borderRadius:"6px",backgroundColor:"rgba(255, 255, 255, 0.02)",border:"1px solid var(--border)",cursor:"pointer",transition:"all 0.2s ease"},m={backgroundColor:"rgba(109, 40, 217, 0.08)",border:"1px solid var(--border-focus)",boxShadow:"0 0 10px rgba(109, 40, 217, 0.1)"},f={display:"flex",flexDirection:"column",gap:"0.15rem",flex:1,minWidth:0},h={fontWeight:600,fontSize:"0.8rem",color:"#fff",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},g={fontSize:"0.7rem",color:"var(--muted)",textTransform:"uppercase"},x={background:"none",border:"none",color:"rgba(239, 68, 68, 0.4)",cursor:"pointer",fontSize:"0.75rem",padding:"0.25rem"},y={display:"flex",flexDirection:"column",gap:"0.25rem",overflowY:"auto",flex:1,minHeight:0},b={fontSize:"0.75rem",color:"var(--muted)",textAlign:"center",padding:"1rem 0"},j={display:"flex",flexDirection:"column"},v={display:"flex",alignItems:"center",padding:"0.35rem 0.5rem",borderRadius:"4px",cursor:"pointer",userSelect:"none",transition:"background 0.2s ease"},_={marginRight:"0.4rem",fontSize:"0.9rem"},w={flex:1,fontSize:"0.8rem",color:"#e2e8f0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},S={fontSize:"0.6rem",color:"var(--muted)",marginLeft:"0.25rem"},k={display:"flex",flexDirection:"column",gap:"0.2rem",paddingLeft:"1.5rem",marginTop:"0.15rem",borderLeft:"1px dashed rgba(255,255,255,0.06)",marginLeft:"0.8rem",marginBottom:"0.25rem"},C={display:"flex",alignItems:"center",padding:"0.15rem 0.25rem",fontSize:"0.75rem"},N={marginRight:"0.3rem",fontSize:"0.7rem"},R={flex:1,color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis"},E={fontSize:"0.65rem",color:"rgba(109, 40, 217, 0.75)",fontFamily:"monospace",paddingLeft:"0.5rem"},L={flex:1,display:"flex",flexDirection:"column",minHeight:0,backgroundColor:"#05070a"},W={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 1rem",borderBottom:"1px solid var(--border)",backgroundColor:"rgba(15, 23, 42, 0.3)",flexShrink:0},O={fontSize:"0.75rem",color:"var(--muted)"},T={fontSize:"0.8rem",fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:"0.4rem"},I={padding:"0.1rem 0.4rem",borderRadius:"4px",backgroundColor:"rgba(234, 179, 8, 0.12)",color:"#eab308",fontSize:"0.65rem",fontWeight:700,border:"1px solid rgba(234, 179, 8, 0.2)"},D={padding:"0.4rem 0.9rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.8rem",fontWeight:600,transition:"all 0.2s ease"},P={height:"180px",borderBottom:"1px solid var(--border)",position:"relative",flexShrink:0},z={width:"100%",height:"100%",backgroundColor:"#080c14",border:"none",resize:"none",color:"#e2e8f0",fontFamily:"monospace",fontSize:"0.85rem",padding:"1rem",outline:"none",lineHeight:"1.4"},q={flex:1,display:"flex",flexDirection:"column",minHeight:0,padding:"1rem"},A={padding:"1rem",borderRadius:"8px",backgroundColor:"rgba(239, 68, 68, 0.08)",border:"1px solid rgba(239, 68, 68, 0.2)",overflowY:"auto"},B={margin:0,fontFamily:"monospace",fontSize:"0.8rem",color:"#f87171",whiteSpace:"pre-wrap"},$={marginTop:"1rem",padding:"0.75rem",borderRadius:"6px",backgroundColor:"rgba(0, 0, 0, 0.3)",border:"1px solid var(--border)"},F={display:"block",padding:"0.5rem",backgroundColor:"#090d16",borderRadius:"4px",fontFamily:"monospace",fontSize:"0.8rem",color:"var(--primary)",border:"1px solid var(--border)"},M={display:"flex",flexDirection:"column",height:"100%",minHeight:0},U={display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.75rem",color:"var(--muted)",marginBottom:"0.5rem"},H={flex:1,overflow:"auto",border:"1px solid var(--border)",borderRadius:"6px"},G={width:"100%",borderCollapse:"collapse",fontFamily:"monospace",fontSize:"0.8rem"},J={padding:"0.5rem 0.75rem",textAlign:"left",backgroundColor:"#0f172a",borderBottom:"1px solid var(--border)",color:"#94a3b8",fontWeight:600,position:"sticky",top:0,zIndex:1},Q={padding:"0.4rem 0.75rem",borderBottom:"1px solid rgba(255, 255, 255, 0.03)",color:"#cbd5e1",whiteSpace:"nowrap"},K={padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid var(--border)",backgroundColor:"rgba(255, 255, 255, 0.02)",color:"var(--muted)",fontSize:"0.7rem",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease"},Y={width:"100%",backgroundColor:"#070a12",border:"1px solid var(--border-focus)",borderRadius:"3px",color:"#fff",padding:"0.1rem 0.3rem",fontSize:"0.8rem",fontFamily:"monospace",outline:"none"},V={cursor:"pointer",transition:"all 0.15s ease"},X={backgroundColor:"transparent"},Z={backgroundColor:"rgba(255, 255, 255, 0.01)"},ee={flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--muted)",fontSize:"0.8rem",textAlign:"center"},et={flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"1rem"},er={width:"24px",height:"24px",border:"3px solid rgba(109, 40, 217, 0.15)",borderTop:"3px solid var(--primary)",borderRadius:"50%",animation:"spin 1s linear infinite"},es={width:"12px",height:"12px",border:"2px solid rgba(255, 255, 255, 0.1)",borderTop:"2px solid var(--muted)",borderRadius:"50%",animation:"spin 1s linear infinite"},ea={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999},en={width:"480px",backgroundColor:"#0d131f",borderRadius:"12px",border:"1px solid var(--border-focus)",padding:"1.5rem",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.5)"},el={display:"flex",flexDirection:"column",gap:"0.35rem",marginBottom:"1rem"},eo={fontSize:"0.75rem",fontWeight:600,color:"var(--muted)"},ei={padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"#070a12",color:"#fff",outline:"none",fontSize:"0.8rem"},ed={padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"#070a12",color:"#fff",outline:"none",fontSize:"0.8rem"},ec={padding:"0.5rem",borderRadius:"6px",fontSize:"0.75rem",marginBottom:"1rem"},eu={display:"flex",justifyContent:"space-between",marginTop:"1.5rem"},ep={padding:"0.4rem 0.75rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"transparent",color:"var(--muted)",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},em={padding:"0.4rem 0.75rem",borderRadius:"6px",border:"none",backgroundColor:"transparent",color:"var(--muted)",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},ef={padding:"0.4rem 0.75rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"};if("u">typeof document){let e=document.createElement("style");e.innerHTML=`
2
2
  @keyframes spin {
3
3
  0% { transform: rotate(0deg); }
4
4
  100% { transform: rotate(360deg); }
@@ -7,5 +7,5 @@
7
7
  background-color: rgba(255, 255, 255, 0.03) !important;
8
8
  outline: 1px dashed rgba(255, 255, 255, 0.2);
9
9
  }
10
- `,document.head.appendChild(e)}e.s(["default",0,function({workspaceRoot:e}){let[eh,eg]=(0,r.useState)({global:[],workspace:[]}),[ex,ey]=(0,r.useState)(null),[eb,ej]=(0,r.useState)(!0),[ev,e_]=(0,r.useState)(!0),[ew,eS]=(0,r.useState)([]),[ek,eC]=(0,r.useState)(null),[eN,eR]=(0,r.useState)({}),[eE,eL]=(0,r.useState)(!1),[eW,eO]=(0,r.useState)("SELECT * FROM sqlite_master;"),[eT,eI]=(0,r.useState)(!1),[eD,eP]=(0,r.useState)(null),[ez,eq]=(0,r.useState)(null),[eA,eB]=(0,r.useState)(null),[e$,eF]=(0,r.useState)(null),[eM,eU]=(0,r.useState)(!1),[eH,eG]=(0,r.useState)(!1),[eJ,eQ]=(0,r.useState)({id:"",name:"",type:"sqlite",filepath:"./dev.db",host:"localhost",port:5432,database:"postgres",username:"postgres",password:"",ssl:!1,readOnly:!0}),[eK,eY]=(0,r.useState)(!1),[eV,eX]=(0,r.useState)(null),eZ=async()=>{try{let t=await fetch(`/api/sql/connections?root=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();e.success&&(eg({global:e.global||[],workspace:e.workspace||[]}),ey(e.activeId),ej(e.isActiveGlobal))}}catch(e){console.error("Failed to load connection profiles:",e)}},e0=async()=>{if(!ex)return void eS([]);eL(!0);try{let t=await fetch(`/api/sql/schema?action=list_tables&root=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();e.success?(eS(e.tables||[]),eP(null)):eP(e.error||"Failed to load database schema.")}else{let e=await t.json();eP(e.error||"Failed to load database schema.")}}catch(e){console.error("Failed to load schema:",e)}finally{eL(!1)}},e1=async t=>{if(eN[t])return void eC(ek===t?null:t);try{let r=await fetch(`/api/sql/schema?action=describe_table&table=${encodeURIComponent(t)}&root=${encodeURIComponent(e)}`);if(r.ok){let e=await r.json();e.success&&(eR(r=>({...r,[t]:e.columns})),eC(t))}}catch(e){console.error(`Failed to load columns for table ${t}:`,e)}};(0,r.useEffect)(()=>{eZ()},[e]),(0,r.useEffect)(()=>{e0(),eq(null),eC(null),eR({});let e=eb?eh.global.find(e=>e.id===ex):eh.workspace.find(e=>e.id===ex);e&&("sqlite"===e.type?eO("SELECT name, type FROM sqlite_master WHERE type='table';"):"mssql"===e.type?eO("SELECT * FROM sys.tables;"):eO("SELECT * FROM information_schema.tables LIMIT 10;"))},[ex,eb,eh.global.length,eh.workspace.length]);let e5=async(t,r)=>{try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"set_active",profileId:t,isGlobal:r,root:e})})).ok&&(ey(t),ej(r))}catch(e){console.error("Failed to set active profile:",e)}},e2=async()=>{eX(null);try{let t=await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"test",profile:eJ,root:e})}),r=await t.json();r.success?eX({success:!0,message:"Connection test successful!"}):eX({success:!1,message:r.error||"Connection test failed."})}catch(e){eX({success:!1,message:e.message||"Failed to make test query."})}},e8=async t=>{if(t.preventDefault(),!eJ.name||!eJ.type)return;eY(!0);let r=eJ.id||`profile_${Math.random().toString(36).substring(7)}`,a={...eJ,id:r,name:eJ.name,type:eJ.type};try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"save",profile:a,isGlobal:eH,root:e})})).ok&&(await eZ(),eU(!1),ex||e5(r,eH))}catch(e){console.error("Failed to save profile:",e)}finally{eY(!1)}},e6=async(t,r)=>{if(confirm("Are you sure you want to delete this connection profile?"))try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",profileId:t,isGlobal:r,root:e})})).ok&&(await eZ(),ex===t&&ey(null))}catch(e){console.error("Failed to delete connection profile:",e)}},e7=async(t,r,a,s)=>{if(e4?.readOnly)return void alert("Database connection is Read-Only. Updates are disabled.");let n=(e=>{let t=e.match(/from\s+([a-zA-Z0-9_\`"\[\]\.]+)/i);if(!t)return null;let r=t[1].trim(),a=(r=r.replace(/[\`"\[\]]/g,"")).split(".");return a[a.length-1]})(eW);if(!n)return void alert("Could not extract table name from query for inline edit. Please ensure your query includes 'FROM tableName'.");eF({rowIndex:t,field:r,status:"saving"});try{let s=eN[n];if(!s){let t=await fetch(`/api/sql/schema?action=describe_table&table=${encodeURIComponent(n)}&root=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();e.success&&e.columns&&(s=e.columns,eR(t=>({...t,[n]:e.columns})))}}if(!s)throw Error(`Could not load schema columns for table "${n}".`);let l=s.find(e=>e.isPrimaryKey);if(!l)throw Error(`Table "${n}" does not have a primary key. Inline editing requires a primary key.`);let o=ez?.rows[t];if(!o||!(l.name in o))throw Error(`Primary key column "${l.name}" was not returned in the query results. Please include it in your SELECT statement.`);let i=o[l.name],d=s.find(e=>e.name===r);if(!d)throw Error(`Column "${r}" was not found in schema columns.`);let c=e=>{let t=e.toLowerCase();return t.includes("int")||t.includes("decimal")||t.includes("numeric")||t.includes("float")||t.includes("double")||t.includes("real")},u="";if("NULL"===a.toUpperCase())u=`${r} = NULL`;else if(c(d.type)){if(""===a||isNaN(Number(a)))throw Error(`Value "${a}" is not a valid number for column "${r}".`);u=`${r} = ${a}`}else u=`${r} = '${a.replace(/'/g,"''")}'`;let p="";p=c(l.type)?`${l.name} = ${i}`:`${l.name} = '${String(i).replace(/'/g,"''")}'`;let m=`UPDATE ${n} SET ${u} WHERE ${p};`,f=await fetch("/api/sql/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:m,root:e})}),h=await f.json();if(f.ok&&h.success){if(ez){let e=[...ez.rows],s=a;"NULL"===a.toUpperCase()?s=null:c(d.type)&&(s=Number(a)),e[t]={...e[t],[r]:s},eq({...ez,rows:e})}eF({rowIndex:t,field:r,status:"success"}),setTimeout(()=>eF(null),1500)}else throw Error(h.error||"Update database query failed.")}catch(e){eF({rowIndex:t,field:r,status:"error",message:e.message}),alert(`Inline Update Failed:
11
- ${e.message}`)}},e3=async()=>{if(eW.trim()&&ex){eI(!0),eP(null),eq(null);try{let t=await fetch("/api/sql/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:eW.trim(),root:e})}),r=await t.json();t.ok&&r.success?(eq({rows:r.rows||[],fields:r.fields||[],durationMs:r.durationMs||0,affectedRows:r.affectedRows}),(eW.toLowerCase().includes("create table")||eW.toLowerCase().includes("drop table")||eW.toLowerCase().includes("alter table"))&&e0()):eP(r.error||"Failed to execute query.")}catch(e){eP(e.message||"An unexpected error occurred during execution.")}finally{eI(!1)}}},e4=eb?eh.global.find(e=>e.id===ex):eh.workspace.find(e=>e.id===ex);return(0,t.jsxs)("div",{style:s,children:[(0,t.jsx)("div",{style:{...n,width:ev?"220px":"0px",borderRight:ev?"1px solid var(--border)":"none",overflow:"hidden",transition:"all 0.25s cubic-bezier(0.4, 0, 0.2, 1)"},children:ev&&(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minWidth:"220px",minHeight:0},children:[(0,t.jsxs)("div",{style:l,children:[(0,t.jsxs)("div",{style:o,children:[(0,t.jsx)("span",{style:i,children:"Connections"}),(0,t.jsx)("button",{style:d,onClick:()=>{eX(null),eQ({id:"",name:"",type:"sqlite",filepath:"./dev.db",host:"localhost",port:5432,database:"postgres",username:"postgres",password:"",ssl:!1,readOnly:!0}),eG(!1),eU(!0)},title:"Add Database Connection Profile",children:"➕ Add"})]}),(0,t.jsxs)("div",{style:c,children:[0===eh.global.length&&0===eh.workspace.length&&(0,t.jsx)("div",{style:b,children:"No connections configured. Add one to start."}),eh.workspace.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:u,children:"WORKSPACE CONNECTIONS"}),eh.workspace.map(e=>(0,t.jsxs)("div",{style:{...p,...ex===e.id&&!eb?m:{}},onClick:()=>e5(e.id,!1),children:[(0,t.jsxs)("div",{style:f,children:[(0,t.jsxs)("span",{style:h,children:["📁 ",e.name]}),(0,t.jsx)("span",{style:g,children:e.type})]}),(0,t.jsx)("button",{style:x,onClick:t=>{t.stopPropagation(),e6(e.id,!1)},children:"✖"})]},e.id))]}),eh.global.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:u,children:"GLOBAL CONNECTIONS"}),eh.global.map(e=>(0,t.jsxs)("div",{style:{...p,...ex===e.id&&eb?m:{}},onClick:()=>e5(e.id,!0),children:[(0,t.jsxs)("div",{style:f,children:[(0,t.jsxs)("span",{style:h,children:["🌐 ",e.name]}),(0,t.jsx)("span",{style:g,children:e.type})]}),(0,t.jsx)("button",{style:x,onClick:t=>{t.stopPropagation(),e6(e.id,!0)},children:"✖"})]},e.id))]})]})]}),(0,t.jsxs)("div",{style:{...l,flex:1,borderTop:"1px solid var(--border)"},children:[(0,t.jsxs)("div",{style:o,children:[(0,t.jsx)("span",{style:i,children:"Schema Tables"}),eE&&(0,t.jsx)("span",{style:ea})]}),(0,t.jsxs)("div",{style:y,children:[!ex&&(0,t.jsx)("div",{style:b,children:"Select an active connection to view tables."}),ex&&0===ew.length&&!eE&&(0,t.jsx)("div",{style:b,children:"No tables found in database schema."}),ew.map(e=>(0,t.jsxs)("div",{style:j,children:[(0,t.jsxs)("div",{style:v,onClick:()=>e1(e.name),children:[(0,t.jsx)("span",{style:_,children:"view"===e.type?"👁️":"📊"}),(0,t.jsx)("span",{style:w,children:e.name}),(0,t.jsx)("span",{style:S,children:ek===e.name?"▼":"▶"})]}),ek===e.name&&eN[e.name]&&(0,t.jsx)("div",{style:k,children:eN[e.name].map(e=>(0,t.jsxs)("div",{style:C,children:[(0,t.jsx)("span",{style:N,children:e.isPrimaryKey?"🔑":e.isForeignKey?"🔗":"▫"}),(0,t.jsx)("span",{style:R,title:e.type,children:e.name}),(0,t.jsx)("span",{style:E,children:e.type.toLowerCase().substring(0,12)})]},e.name))})]},e.name))]})]})]})}),(0,t.jsxs)("div",{style:L,children:[(0,t.jsxs)("div",{style:W,children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>e_(!ev),style:{background:"rgba(255, 255, 255, 0.05)",border:"1px solid var(--border)",borderRadius:"6px",color:"var(--muted)",cursor:"pointer",padding:"0.25rem 0.5rem",fontSize:"0.75rem",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s ease"},title:ev?"Collapse Connections List":"Expand Connections List",children:ev?"◀ Collapse":"📂 Schema Connections"}),(0,t.jsx)("span",{style:O,children:"Active Connection:"}),e4?(0,t.jsxs)("span",{style:T,children:[eb?"🌐":"📁"," ",e4.name," (",e4.type,")",e4.readOnly&&(0,t.jsx)("span",{style:I,children:"Read-Only"})]}):(0,t.jsx)("span",{style:{...T,color:"var(--danger)"},children:"No Connection Selected"})]}),(0,t.jsx)("button",{style:{...D,opacity:!ex||eT?.6:1,cursor:!ex||eT?"not-allowed":"pointer"},onClick:e3,disabled:!ex||eT,children:eT?"⌛ Running...":"⚡ Execute Query (F5)"})]}),(0,t.jsx)("div",{style:P,children:(0,t.jsx)("textarea",{style:z,value:eW,onChange:e=>eO(e.target.value),placeholder:"Write your SQL query script here...",onKeyDown:e=>{("F5"===e.key||e.ctrlKey&&"Enter"===e.key)&&(e.preventDefault(),e3())}})}),(0,t.jsxs)("div",{style:q,children:[eD&&(0,t.jsxs)("div",{style:A,children:[(0,t.jsx)("h4",{style:{margin:"0 0 0.5rem 0",color:"var(--danger)"},children:"⚠️ Execution Error"}),(0,t.jsx)("pre",{style:B,children:eD}),eD.includes("not installed")&&(0,t.jsxs)("div",{style:$,children:[(0,t.jsx)("p",{style:{margin:"0 0 0.5rem 0"},children:"To resolve this, run this installer command in your workspace terminal:"}),(0,t.jsx)("code",{style:F,children:e4?.type==="sqlite"?"npm install better-sqlite3":e4?.type==="postgres"?"npm install pg":e4?.type==="mysql"?"npm install mysql2":"npm install mssql"})]})]}),ez&&(0,t.jsxs)("div",{style:M,children:[(0,t.jsxs)("div",{style:U,children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,t.jsxs)("span",{children:["Query completed."," ",void 0!==ez.affectedRows?`Affected rows: ${ez.affectedRows}`:`Returned ${ez.rows.length} rows`]}),(0,t.jsxs)("span",{children:["Duration: ",ez.durationMs,"ms"]})]}),ez.rows.length>0&&(0,t.jsxs)("div",{style:{display:"flex",gap:"0.4rem"},children:[(0,t.jsx)("button",{onClick:()=>{if(ez&&0!==ez.rows.length)try{let e=ez.fields.join(","),t=ez.rows.map(e=>ez.fields.map(t=>{let r=e[t];if(null===r)return"NULL";let a=String(r);return a.includes(",")||a.includes('"')||a.includes("\n")||a.includes("\r")?`"${a.replace(/"/g,'""')}"`:a}).join(",")),r=[e,...t].join("\r\n"),a=new Blob([r],{type:"text/csv;charset=utf-8;"}),s=URL.createObjectURL(a),n=document.createElement("a");n.setAttribute("href",s),n.setAttribute("download",`query-results-${Date.now()}.csv`),document.body.appendChild(n),n.click(),document.body.removeChild(n)}catch(e){console.error("Export CSV failed:",e),alert("Failed to export as CSV")}},style:K,children:"📥 Export CSV"}),(0,t.jsx)("button",{onClick:()=>{if(ez&&0!==ez.rows.length)try{let e=JSON.stringify(ez.rows,null,2),t=new Blob([e],{type:"application/json;charset=utf-8;"}),r=URL.createObjectURL(t),a=document.createElement("a");a.setAttribute("href",r),a.setAttribute("download",`query-results-${Date.now()}.json`),document.body.appendChild(a),a.click(),document.body.removeChild(a)}catch(e){console.error("Export JSON failed:",e),alert("Failed to export as JSON")}},style:K,children:"📥 Export JSON"})]})]}),ez.rows.length>0?(0,t.jsx)("div",{style:H,children:(0,t.jsxs)("table",{style:G,children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:ez.fields.map(e=>(0,t.jsx)("th",{style:J,children:e},e))})}),(0,t.jsx)("tbody",{children:ez.rows.map((e,r)=>(0,t.jsx)("tr",{style:r%2==0?X:Z,children:ez.fields.map(a=>{let s=eA&&eA.rowIndex===r&&eA.field===a,n=e$&&e$.rowIndex===r&&e$.field===a&&"saving"===e$.status,l=e$&&e$.rowIndex===r&&e$.field===a&&"success"===e$.status,o=e$&&e$.rowIndex===r&&e$.field===a&&"error"===e$.status,i={...Q,...V};return n?i={...i,backgroundColor:"rgba(168, 85, 247, 0.15)"}:l?i={...i,backgroundColor:"rgba(16, 185, 129, 0.25)"}:o&&(i={...i,backgroundColor:"rgba(239, 68, 68, 0.25)"}),(0,t.jsx)("td",{style:i,onDoubleClick:()=>{e4?.readOnly?alert("Database connection is Read-Only. Editing is disabled."):eB({rowIndex:r,field:a,value:null===e[a]?"NULL":String(e[a])})},className:"db-cell",title:"Double click to edit cell",children:s?(0,t.jsx)("input",{style:Y,value:eA.value,autoFocus:!0,onChange:e=>eB({...eA,value:e.target.value}),onKeyDown:async t=>{if("Enter"===t.key){t.preventDefault();let s=eA.value;eB(null),s!==(null===e[a]?"NULL":String(e[a]))&&await e7(r,a,s,e[a])}else"Escape"===t.key&&eB(null)},onBlur:async()=>{let t=eA.value;eB(null),t!==(null===e[a]?"NULL":String(e[a]))&&await e7(r,a,t,e[a])}}):null===e[a]?"NULL":"object"==typeof e[a]?JSON.stringify(e[a]):String(e[a])},a)})},r))})]})}):void 0===ez.affectedRows&&(0,t.jsx)("div",{style:ee,children:"Query executed successfully, but returned 0 results."})]}),!eD&&!ez&&!eT&&(0,t.jsx)("div",{style:ee,children:"Write a query script and click Execute to view table records."}),eT&&(0,t.jsxs)("div",{style:et,children:[(0,t.jsx)("span",{style:er}),(0,t.jsx)("span",{style:{color:"var(--muted)"},children:"Running database statement..."})]})]})]}),eM&&"u">typeof document&&(0,a.createPortal)((0,t.jsx)("div",{style:es,children:(0,t.jsxs)("div",{style:en,children:[(0,t.jsxs)("h3",{style:{margin:"0 0 1rem 0",display:"flex",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:"🔌 Add Database Profile"}),(0,t.jsx)("span",{style:{cursor:"pointer"},onClick:()=>eU(!1),children:"✖"})]}),(0,t.jsxs)("form",{onSubmit:e8,children:[(0,t.jsxs)("div",{style:el,children:[(0,t.jsx)("label",{style:eo,children:"Profile Name"}),(0,t.jsx)("input",{style:ei,type:"text",required:!0,value:eJ.name,onChange:e=>eQ(t=>({...t,name:e.target.value})),placeholder:"e.g. Local Postgres, Dev SQLite"})]}),(0,t.jsxs)("div",{style:el,children:[(0,t.jsx)("label",{style:eo,children:"Scope Level"}),(0,t.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,t.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"radio",checked:!eH,onChange:()=>eG(!1)}),"Workspace Local"]}),(0,t.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"radio",checked:eH,onChange:()=>eG(!0)}),"Global User Profile"]})]})]}),(0,t.jsxs)("div",{style:el,children:[(0,t.jsx)("label",{style:eo,children:"Database Type"}),(0,t.jsxs)("select",{style:ed,value:eJ.type,onChange:e=>{let t=e.target.value,r=5432;"mysql"===t&&(r=3306),"mssql"===t&&(r=1433),eQ(e=>({...e,type:t,filepath:"sqlite"===t?"./dev.db":void 0,port:"sqlite"!==t?r:void 0,database:"sqlite"===t?void 0:"mssql"===t?"master":"postgres"===t?"postgres":"",username:"sqlite"===t?void 0:"mssql"===t?"sa":"postgres"===t?"postgres":"root"}))},children:[(0,t.jsx)("option",{value:"sqlite",children:"SQLite (Local File)"}),(0,t.jsx)("option",{value:"postgres",children:"PostgreSQL"}),(0,t.jsx)("option",{value:"mysql",children:"MySQL"}),(0,t.jsx)("option",{value:"mssql",children:"Microsoft SQL Server"})]})]}),"sqlite"===eJ.type?(0,t.jsxs)("div",{style:el,children:[(0,t.jsx)("label",{style:eo,children:"Database File Path"}),(0,t.jsx)("input",{style:ei,type:"text",required:!0,value:eJ.filepath||"",onChange:e=>eQ(t=>({...t,filepath:e.target.value})),placeholder:"Relative (e.g. ./data/dev.db) or Absolute path"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,t.jsxs)("div",{style:{...el,flex:3},children:[(0,t.jsx)("label",{style:eo,children:"Host IP Address"}),(0,t.jsx)("input",{style:ei,type:"text",required:!0,value:eJ.host||"",onChange:e=>eQ(t=>({...t,host:e.target.value})),placeholder:"localhost or IP"})]}),(0,t.jsxs)("div",{style:{...el,flex:1},children:[(0,t.jsx)("label",{style:eo,children:"Port"}),(0,t.jsx)("input",{style:ei,type:"number",required:!0,value:eJ.port||0,onChange:e=>eQ(t=>({...t,port:parseInt(e.target.value)}))})]})]}),(0,t.jsxs)("div",{style:el,children:[(0,t.jsx)("label",{style:eo,children:"Database Name"}),(0,t.jsx)("input",{style:ei,type:"text",required:!0,value:eJ.database||"",onChange:e=>eQ(t=>({...t,database:e.target.value}))})]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,t.jsxs)("div",{style:{...el,flex:1},children:[(0,t.jsx)("label",{style:eo,children:"Username"}),(0,t.jsx)("input",{style:ei,type:"text",required:!0,value:eJ.username||"",onChange:e=>eQ(t=>({...t,username:e.target.value}))})]}),(0,t.jsxs)("div",{style:{...el,flex:1},children:[(0,t.jsx)("label",{style:eo,children:"Password"}),(0,t.jsx)("input",{style:ei,type:"password",value:eJ.password||"",onChange:e=>eQ(t=>({...t,password:e.target.value}))})]})]}),("postgres"===eJ.type||"mssql"===eJ.type)&&(0,t.jsx)("div",{style:el,children:(0,t.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"checkbox",checked:!!eJ.ssl,onChange:e=>eQ(t=>({...t,ssl:e.target.checked}))}),"Require SSL Secure Connection"]})})]}),(0,t.jsx)("div",{style:el,children:(0,t.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"checkbox",checked:!!eJ.readOnly,onChange:e=>eQ(t=>({...t,readOnly:e.target.checked}))}),"Enforce Read-Only Connection (Disable mutations)"]})}),eV&&(0,t.jsx)("div",{style:{...ec,backgroundColor:eV.success?"rgba(16, 185, 129, 0.12)":"rgba(239, 68, 68, 0.12)",border:eV.success?"1px solid var(--success)":"1px solid var(--danger)",color:eV.success?"var(--success)":"var(--danger)"},children:eV.message}),(0,t.jsxs)("div",{style:eu,children:[(0,t.jsx)("button",{type:"button",style:ep,onClick:e2,children:"🔍 Test Connection"}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,t.jsx)("button",{type:"button",style:em,onClick:()=>eU(!1),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",style:ef,disabled:eK,children:eK?"Saving...":"Save Profile"})]})]})]})]})}),document.body)]})}])},20897,e=>{e.v({activeBorder:"page-module___8aEwW__activeBorder",agentBadge:"page-module___8aEwW__agentBadge",agentCard:"page-module___8aEwW__agentCard",agentGrid:"page-module___8aEwW__agentGrid",agentHeader:"page-module___8aEwW__agentHeader",agentName:"page-module___8aEwW__agentName",agentStateBadge:"page-module___8aEwW__agentStateBadge",ansiCyan:"page-module___8aEwW__ansiCyan",ansiGreen:"page-module___8aEwW__ansiGreen",ansiMagenta:"page-module___8aEwW__ansiMagenta",ansiRed:"page-module___8aEwW__ansiRed",ansiYellow:"page-module___8aEwW__ansiYellow",cardBody:"page-module___8aEwW__cardBody",container:"page-module___8aEwW__container",containerActive:"page-module___8aEwW__containerActive",contextDetails:"page-module___8aEwW__contextDetails",contextItem:"page-module___8aEwW__contextItem",contextList:"page-module___8aEwW__contextList",contextMeta:"page-module___8aEwW__contextMeta",contextTitle:"page-module___8aEwW__contextTitle",dashboardGrid:"page-module___8aEwW__dashboardGrid",envGrid:"page-module___8aEwW__envGrid",envName:"page-module___8aEwW__envName",envRow:"page-module___8aEwW__envRow",envStatus:"page-module___8aEwW__envStatus",footer:"page-module___8aEwW__footer",header:"page-module___8aEwW__header",logoArea:"page-module___8aEwW__logoArea",mainPanel:"page-module___8aEwW__mainPanel",pulse:"page-module___8aEwW__pulse","pulse-attention":"page-module___8aEwW__pulse-attention","pulse-thinking":"page-module___8aEwW__pulse-thinking",pulseDot:"page-module___8aEwW__pulseDot",quickLaunchBtn:"page-module___8aEwW__quickLaunchBtn",sectionTitle:"page-module___8aEwW__sectionTitle",sidePanel:"page-module___8aEwW__sidePanel","state-complete":"page-module___8aEwW__state-complete","state-idle":"page-module___8aEwW__state-idle","state-needs-input":"page-module___8aEwW__state-needs-input","state-thinking":"page-module___8aEwW__state-thinking",statusIndicator:"page-module___8aEwW__statusIndicator",stoppedBadge:"page-module___8aEwW__stoppedBadge",subtitle:"page-module___8aEwW__subtitle",terminalContainer:"page-module___8aEwW__terminalContainer",terminalInput:"page-module___8aEwW__terminalInput",terminalInputArea:"page-module___8aEwW__terminalInputArea",terminalLine:"page-module___8aEwW__terminalLine",terminalSendBtn:"page-module___8aEwW__terminalSendBtn",title:"page-module___8aEwW__title"})},52683,e=>{"use strict";var t=e.i(43476),r=e.i(71645),a=e.i(70703),s=e.i(20897),n=e.i(66381);let l=e=>"mock"===e?"🧪":e.includes("-docker")?"🐳":e.includes("-ssh")?"🌐":"💻",o=(0,a.default)(()=>e.A(33779),{loadableGenerated:{modules:[37314]},ssr:!1,loading:()=>(0,t.jsx)("div",{style:{height:"400px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#05070a",color:"var(--muted)",border:"1px solid var(--border)",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px"},children:(0,t.jsx)("span",{children:"Initializing terminal emulator..."})})}),i=(0,a.default)(()=>e.A(39429),{loadableGenerated:{modules:[1985]},ssr:!1,loading:()=>(0,t.jsx)("div",{style:{height:"280px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--card)",border:"1px solid var(--border)",borderRadius:"12px",marginTop:"1.5rem"},children:(0,t.jsx)("span",{style:{color:"var(--muted)"},children:"Initializing prompt editor..."})})}),d=(0,a.default)(()=>e.A(56915),{loadableGenerated:{modules:[99026]},ssr:!1}),c=(0,a.default)(()=>e.A(78716),{loadableGenerated:{modules:[9949]},ssr:!1}),u=(0,a.default)(()=>e.A(33789),{loadableGenerated:{modules:[20032]},ssr:!1}),p=(0,a.default)(()=>e.A(78003),{loadableGenerated:{modules:[97722]},ssr:!1});e.s(["default",0,function(){let[e,a]=(0,r.useState)([]),[m,f]=(0,r.useState)(null),[h,g]=(0,r.useState)(!1),[x,y]=(0,r.useState)(!1),[b,j]=(0,r.useState)(!1),[v,_]=(0,r.useState)(!1),[w,S]=(0,r.useState)(!1),[k,C]=(0,r.useState)(!1),[N,R]=(0,r.useState)(""),[E,L]=(0,r.useState)(9601),[W,O]=(0,r.useState)("0.2.19"),[T,I]=(0,r.useState)(null),[D,P]=(0,r.useState)([]),z=e.filter(e=>"workspace-terminal"!==e.id),q=e.find(e=>e.id===m),A=z.some(e=>("claude-docker"===e.type||"aider-docker"===e.type)&&"running"===e.status),B=z.some(e=>"claude-ssh"===e.type&&"running"===e.status),$=async()=>{try{let e=await fetch("/api/sessions"),t=await e.json();t.sessions&&a(t.sessions),t.wsPort&&L(t.wsPort),t.originalCwd&&R(t.originalCwd),t.version&&O(t.version)}catch(e){console.error("Failed to fetch sessions:",e)}},F=async()=>{try{let e=await fetch("/api/recents");if(e.ok){let t=await e.json();t.success&&t.recents&&t.recents.lastSession&&I(t.recents.lastSession)}}catch(e){console.error("Failed to fetch recents:",e)}},M=async()=>{try{let e=await fetch("/api/configs");if(e.ok){let t=await e.json();t.configs&&P(t.configs)}}catch(e){console.error("Failed to fetch configs:",e)}};(0,r.useEffect)(()=>{(async()=>{await $(),await F(),await M()})(),"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(e=>console.log("Service Worker registered:",e.scope)).catch(e=>console.error("Service Worker registration failed:",e));let e=setInterval($,4e3);return()=>clearInterval(e)},[]);let U=async(e,t,r,a)=>{g(!0);try{let s=t;s||("claude"===e?s="Claude Local":"claude-docker"===e?s="Claude Docker":"claude-ssh"===e?s="Claude SSH":"aider"===e?s="Aider Local":"aider-docker"===e?s="Aider Docker":"mock"===e&&(s="Mock Session"));let n={type:e,name:s,workspaceRoot:r,scopedDirs:a};if(("aider"===e||"aider-docker"===e)&&!r)try{let e=await fetch("/api/context/aider");if(e.ok){let t=await e.json();t.success&&t.config&&(n.workspaceRoot=t.config.workspaceRoot,n.scopedDirs=t.config.scopedDirs)}}catch(e){console.error("Failed to load aider configuration before launch:",e)}let l=await fetch("/api/sessions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),o=await l.json();o.success&&(await $(),await M(),f(o.session.id),I({type:e,name:s,workspaceRoot:r,scopedDirs:a}))}catch(e){console.error("Failed to launch session:",e)}finally{g(!1)}},H=async e=>{g(!0);try{let t=await fetch("/api/sessions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:e.type,name:e.name,workspaceRoot:e.workspaceRoot,scopedDirs:e.scopedDirs})}),r=await t.json();r.success?(await $(),f(r.session.id)):alert(r.error||"Failed to launch configuration.")}catch(e){console.error(e),alert("Network error: failed to launch configuration.")}finally{g(!1)}},G=async e=>{if(window.confirm("Are you sure you want to delete this configuration template?"))try{(await fetch("/api/configs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",id:e})})).ok?await M():alert("Failed to delete configuration template.")}catch(e){console.error(e),alert("Network error: failed to delete configuration template.")}},J=async(e,t=!1)=>{try{let r=await fetch("/api/sessions/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,delete:t})});(await r.json()).success&&(t&&m===e&&f(null),await $())}catch(e){console.error("Failed to stop session:",e)}};return(0,t.jsxs)("div",{className:`${s.default.container} ${q?s.default.containerActive:""}`,children:[(0,t.jsxs)("header",{className:s.default.header,children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1.5rem"},children:[(0,t.jsx)("img",{src:"/logo.png",alt:"NeuralLoom Logo",style:{width:"160px",height:"160px",borderRadius:"16px",objectFit:"contain"}}),(0,t.jsxs)("div",{className:s.default.logoArea,children:[(0,t.jsx)("h1",{className:s.default.title,style:{margin:0,lineHeight:1.1},children:"NeuralLoom"}),(0,t.jsx)("span",{className:s.default.subtitle,children:"Unified AI Orchestrator & Context Bridge"})]})]}),(0,t.jsxs)("div",{className:s.default.statusIndicator,children:[(0,t.jsx)("span",{className:s.default.pulseDot}),(0,t.jsx)("span",{children:"Orchestrator Online"})]})]}),q?(0,t.jsx)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:(0,t.jsx)(p,{sessionId:q.id,workspaceRoot:q.workspaceRoot||"",scopedDirs:q.scopedDirs||[],onClose:()=>f(null),sessions:e,onSwitchSession:e=>f(e),onRefreshSessions:$,wsPort:E})}):(0,t.jsxs)("div",{className:s.default.dashboardGrid,children:[(0,t.jsxs)("div",{className:s.default.mainPanel,children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:s.default.sectionTitle,children:"Built-in Database Explorer & SQL Client"}),(0,t.jsx)("div",{className:"card",style:{padding:0,overflow:"hidden",height:"450px",border:"1px solid var(--border)"},children:(0,t.jsx)(n.default,{workspaceRoot:N||""})})]}),(0,t.jsxs)("section",{style:{marginTop:"1.5rem"},children:[(0,t.jsx)("h2",{className:s.default.sectionTitle,children:"Shared Context Hub & Slash Commands"}),(0,t.jsxs)("div",{className:s.default.contextList,children:[(0,t.jsxs)("div",{className:`${s.default.contextItem} card`,children:[(0,t.jsxs)("div",{className:s.default.contextMeta,children:[(0,t.jsx)("span",{className:s.default.contextTitle,children:"Staged Context & System Rules (/ccc)"}),(0,t.jsx)("span",{className:s.default.contextDetails,children:"Compiles AGENTS.md guidelines and files map."})]}),(0,t.jsx)("button",{onClick:async()=>{m&&await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:m,command:"/ccc"})})},disabled:!m,style:{padding:"0.4rem 0.8rem",borderRadius:"6px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.75rem",fontWeight:600,opacity:m?1:.5,cursor:m?"pointer":"not-allowed"},children:"🚀 Mount (/ccc)"})]}),(0,t.jsxs)("div",{className:`${s.default.contextItem} card`,children:[(0,t.jsxs)("div",{className:s.default.contextMeta,children:[(0,t.jsx)("span",{className:s.default.contextTitle,children:"Staged Developer Prompt (/ccp)"}),(0,t.jsx)("span",{className:s.default.contextDetails,children:"Executes prompt in .ai/neural-loom/cprompt.md."})]}),(0,t.jsx)("button",{onClick:async()=>{m&&await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:m,command:"/ccp"})})},disabled:!m,style:{padding:"0.4rem 0.8rem",borderRadius:"6px",border:"1px solid var(--success)",backgroundColor:"transparent",color:"var(--success)",fontSize:"0.75rem",fontWeight:600,opacity:m?1:.5,cursor:m?"pointer":"not-allowed"},children:"⚡ Run (/ccp)"})]})]}),(0,t.jsx)(i,{})]})]}),(0,t.jsxs)("div",{className:s.default.mainPanel,children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:s.default.sectionTitle,children:"Active AI Agents"}),0===z.length?(0,t.jsxs)("div",{className:"card",style:{padding:"3rem 1.5rem",textAlign:"center"},children:[(0,t.jsx)("p",{style:{color:"var(--muted)",marginBottom:"1.5rem"},children:"No active agent sessions. Launch a Claude or Aider agent session to begin."}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.75rem",flexDirection:"column"},children:[T&&(0,t.jsx)("button",{className:s.default.quickLaunchBtn,onClick:()=>{U(T.type,T.name,T.workspaceRoot,T.scopedDirs)},disabled:h,style:{background:"linear-gradient(135deg, hsl(38, 92%, 50%) 0%, hsl(0, 84%, 60%) 100%)",border:"none"},title:`Re-launch: ${T.name||T.type}`,children:"⚡ Re-launch Last Session"}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,t.jsx)("button",{className:s.default.quickLaunchBtn,onClick:()=>{C(!1),S(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(262, 83%, 60%) 0%, hsl(195, 100%, 45%) 100%)",border:"none",flex:1},children:"Launch Claude"}),(0,t.jsx)("button",{className:s.default.quickLaunchBtn,onClick:()=>{_(!1),j(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(210, 80%, 45%) 0%, hsl(262, 80%, 55%) 100%)",border:"none",flex:1},children:"Launch Aider"})]})]}),(0,t.jsxs)("div",{style:{marginTop:"1.5rem",fontSize:"0.75rem",color:"var(--muted)"},children:["Need a simulator?"," ",(0,t.jsx)("span",{onClick:()=>U("mock"),style:{color:"var(--primary)",cursor:"pointer",textDecoration:"underline"},children:"Start mock playground"})]})]}):(0,t.jsx)("div",{className:s.default.agentGrid,children:z.map(e=>(0,t.jsxs)("div",{className:`${s.default.agentCard} card ${m===e.id?s.default.activeBorder:""}`,children:[(0,t.jsxs)("div",{className:s.default.agentHeader,children:[(0,t.jsx)("span",{className:s.default.agentName,children:e.name}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.35rem",alignItems:"center"},children:["running"===e.status&&e.agentState&&(0,t.jsxs)("span",{className:`${s.default.agentStateBadge} ${s.default["state-"+e.agentState]}`,children:["thinking"===e.agentState&&`${l(e.type)} 💭`,"needs-input"===e.agentState&&`${l(e.type)} ⚠️`,"complete"===e.agentState&&`${l(e.type)} ✅`,"idle"===e.agentState&&`${l(e.type)} 💤`]}),(0,t.jsx)("span",{className:`${s.default.agentBadge} ${"stopped"===e.status?s.default.stoppedBadge:""}`,children:e.status})]})]}),(0,t.jsxs)("div",{className:s.default.cardBody,style:{padding:"1rem"},children:[(0,t.jsxs)("p",{style:{fontSize:"0.8rem",color:"var(--muted)",margin:0},children:["ID: ",(0,t.jsx)("code",{style:{fontSize:"0.72rem"},children:e.id.substring(0,8)})," | Type: ",e.type,(0,t.jsx)("br",{}),"Logs: ",e.logsCount," lines"]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.75rem"},children:["running"===e.status?(0,t.jsx)("button",{onClick:()=>J(e.id,!1),style:{flex:1,padding:"0.35rem",borderRadius:"6px",border:"1px solid var(--danger)",backgroundColor:"transparent",fontSize:"0.75rem",color:"var(--danger)",cursor:"pointer"},children:"Stop"}):(0,t.jsx)("button",{onClick:()=>J(e.id,!0),style:{flex:1,padding:"0.35rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"transparent",fontSize:"0.75rem",color:"var(--muted)",cursor:"pointer"},children:"Delete"}),(0,t.jsx)("button",{onClick:()=>f(e.id),style:{flex:2,padding:"0.35rem",borderRadius:"6px",border:"none",backgroundColor:m===e.id?"var(--border-focus)":"var(--primary)",fontSize:"0.75rem",fontWeight:600,color:"#fff",cursor:"pointer"},children:m===e.id?"Connected":"Open Console"})]})]})]},e.id))})]}),m&&"workspace-terminal"!==m&&(0,t.jsxs)("section",{className:"card",style:{display:"flex",flexDirection:"column",border:"1px solid var(--border-focus)",marginTop:"1rem"},children:[(0,t.jsxs)("div",{className:s.default.agentHeader,style:{justifyContent:"space-between",background:"rgba(109, 40, 217, 0.08)",padding:"0.5rem 1rem"},children:[(0,t.jsxs)("span",{style:{fontWeight:600,fontSize:"0.85rem",display:"flex",alignItems:"center",gap:"0.5rem"},children:["🖥️ Console — ",e.find(e=>e.id===m)?.name]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[e.find(e=>e.id===m)?.status==="stopped"&&(0,t.jsx)("button",{onClick:async()=>{try{let t=e.find(e=>e.id===m),r=t&&("claude"===t.type||"claude-docker"===t.type||"claude-ssh"===t.type),a=!1;r&&(a=window.confirm("Would you like to resume your previous Claude session?"));let s=await fetch("/api/sessions/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:m,resume:a})});if(s.ok)await $();else{let e=await s.json();alert(e.error||"Failed to restart session.")}}catch(e){console.error("Failed to restart session:",e)}},style:{padding:"0.15rem 0.4rem",borderRadius:"4px",border:"1px solid #eab308",backgroundColor:"rgba(234, 179, 8, 0.15)",color:"#eab308",fontSize:"0.65rem",fontWeight:600,cursor:"pointer"},children:"⚡ Restart"}),(0,t.jsx)("button",{onClick:()=>f(null),style:{border:"none",background:"none",color:"var(--muted)",cursor:"pointer",fontSize:"0.75rem"},children:"✖"})]})]}),(0,t.jsx)(o,{sessionId:m,wsPort:E})]})]}),(0,t.jsxs)("div",{className:s.default.sidePanel,children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:s.default.sectionTitle,children:"Execution Environments"}),(0,t.jsxs)("div",{className:s.default.envGrid,children:[(0,t.jsxs)("div",{className:s.default.envRow,style:{padding:"0.5rem 0.75rem"},children:[(0,t.jsx)("span",{className:s.default.envName,children:"💻 Local Host"}),(0,t.jsx)("span",{className:s.default.envStatus,style:{color:"var(--success)"},children:"Active"})]}),(0,t.jsxs)("div",{className:s.default.envRow,style:{opacity:A?1:.6,padding:"0.5rem 0.75rem"},children:[(0,t.jsx)("span",{className:s.default.envName,children:"🐳 Docker Sandbox"}),(0,t.jsx)("span",{className:s.default.envStatus,style:{color:A?"var(--success)":"var(--muted)"},children:A?"Active":"Not Mounted"})]}),(0,t.jsxs)("div",{className:s.default.envRow,style:{opacity:B?1:.6,padding:"0.5rem 0.75rem"},children:[(0,t.jsx)("span",{className:s.default.envName,children:"🌐 Remote VM (SSH)"}),(0,t.jsx)("span",{className:s.default.envStatus,style:{color:B?"var(--success)":"var(--muted)"},children:B?"Active":"Offline"})]})]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:s.default.sectionTitle,children:"Saved Configurations"}),(0,t.jsx)("div",{className:"card",style:{padding:"1rem",display:"flex",flexDirection:"column",gap:"0.75rem"},children:0===D.length?(0,t.jsx)("p",{style:{color:"var(--muted)",fontSize:"0.8rem",textAlign:"center",margin:"1rem 0"},children:"No configuration templates saved yet. Save a template from the Claude/Aider launch wizards."}):(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",maxHeight:"200px",overflowY:"auto"},children:D.map(e=>(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(255, 255, 255, 0.02)",padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)"},children:[(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.15rem",minWidth:0},children:[(0,t.jsx)("span",{style:{fontSize:"0.8rem",fontWeight:600,color:"var(--foreground)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),(0,t.jsx)("span",{style:{fontSize:"0.65rem",color:"var(--muted)",textTransform:"uppercase"},children:e.type})]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.25rem"},children:[(0,t.jsx)("button",{onClick:()=>H(e),disabled:h,style:{padding:"0.2rem 0.4rem",borderRadius:"4px",backgroundColor:"var(--primary)",color:"#fff",border:"none",fontSize:"0.7rem",cursor:"pointer"},children:"Launch"}),(0,t.jsx)("button",{onClick:()=>G(e.id),style:{padding:"0.2rem 0.4rem",borderRadius:"4px",backgroundColor:"transparent",color:"var(--danger)",border:"1px solid var(--danger)",fontSize:"0.7rem",cursor:"pointer"},children:"Delete"})]})]},e.id))})})]}),(0,t.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,t.jsx)("button",{className:s.default.quickLaunchBtn,onClick:()=>{C(!1),S(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(262, 83%, 60%) 0%, hsl(195, 100%, 45%) 100%)",border:"none",padding:"0.6rem",fontSize:"0.8rem",flex:1},children:"🤖 Claude Local"}),(0,t.jsx)("button",{className:s.default.quickLaunchBtn,onClick:()=>{C(!0),S(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(170, 72%, 40%) 0%, hsl(195, 100%, 40%) 100%)",border:"none",padding:"0.6rem",fontSize:"0.8rem",flex:1},children:"🐳 Claude Docker"})]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,t.jsx)("button",{className:s.default.quickLaunchBtn,onClick:()=>{_(!1),j(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(210, 80%, 45%) 0%, hsl(262, 80%, 55%) 100%)",border:"none",padding:"0.6rem",fontSize:"0.8rem",flex:1},children:"🐍 Aider Local"}),(0,t.jsx)("button",{className:s.default.quickLaunchBtn,onClick:()=>{_(!0),j(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(195, 100%, 40%) 0%, hsl(262, 80%, 55%) 100%)",border:"none",padding:"0.6rem",fontSize:"0.8rem",flex:1},children:"🐳 Aider Docker"})]}),(0,t.jsx)("button",{className:s.default.quickLaunchBtn,onClick:()=>y(!0),disabled:h,style:{background:"linear-gradient(135deg, hsl(38, 92%, 50%) 0%, hsl(0, 84%, 60%) 100%)",border:"none",padding:"0.6rem",fontSize:"0.8rem"},children:"🌐 Connect Remote SSH"})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:s.default.sectionTitle,children:"Workspace Terminal"}),(0,t.jsxs)("div",{className:"card",style:{display:"flex",flexDirection:"column",border:"1px solid var(--border)",padding:0},children:[(0,t.jsx)("div",{className:s.default.agentHeader,style:{justifyContent:"space-between",background:"rgba(255, 255, 255, 0.02)",padding:"0.4rem 0.75rem"},children:(0,t.jsxs)("span",{style:{fontWeight:600,fontSize:"0.75rem"},children:["💻 Local Shell (CWD: ",N.split(/[/\\]/).pop()||"root",")"]})}),(0,t.jsx)(o,{sessionId:"workspace-terminal",height:"180px",wsPort:E})]})]}),(0,t.jsxs)("section",{className:"card",style:{padding:"1rem",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,t.jsx)("h3",{style:{fontSize:"0.9rem",fontWeight:700,margin:0},children:"Quick Actions"}),(0,t.jsxs)("ul",{style:{listStyle:"none",fontSize:"0.75rem",display:"flex",flexDirection:"column",gap:"0.35rem",color:"var(--muted)",padding:0,margin:0},children:[(0,t.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:"Configure API Keys"}),(0,t.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]}),(0,t.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:"Edit rules templates"}),(0,t.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]}),(0,t.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:"Inspect process locks"}),(0,t.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]})]})]})]})]}),(0,t.jsxs)("footer",{className:s.default.footer,children:[(0,t.jsxs)("span",{children:["NeuralLoom v",W," — Experimental AI Orchestrator Bridge"]}),(0,t.jsxs)("span",{children:["Directory: ",N||"Loading..."]})]}),x&&(0,t.jsx)(d,{onClose:()=>y(!1),onConfirmLaunch:()=>{y(!1),U("claude-ssh")}}),b&&(0,t.jsx)(c,{onClose:()=>j(!1),isDocker:v,onConfirmLaunch:(e,t,r)=>{j(!1),U(v?"aider-docker":"aider",e,t,r)}}),w&&(0,t.jsx)(u,{onClose:()=>S(!1),isDocker:k,onConfirmLaunch:(e,t,r)=>{S(!1),U(k?"claude-docker":"claude",e,t,r)}})]})}])},33779,e=>{e.v(t=>Promise.all(["static/chunks/03g6xpslyid3~.js","static/chunks/15_baizhaiq8c.js","static/chunks/0ga14ztvrhau2.css"].map(t=>e.l(t))).then(()=>t(37314)))},39429,e=>{e.v(t=>Promise.all(["static/chunks/16w4~t4h7gk13.js"].map(t=>e.l(t))).then(()=>t(1985)))},56915,e=>{e.v(t=>Promise.all(["static/chunks/0lnobx4eh3~-_.js"].map(t=>e.l(t))).then(()=>t(99026)))},78716,e=>{e.v(t=>Promise.all(["static/chunks/0xhaghhxllgzs.js"].map(t=>e.l(t))).then(()=>t(9949)))},33789,e=>{e.v(t=>Promise.all(["static/chunks/15sigqif_v.mu.js"].map(t=>e.l(t))).then(()=>t(20032)))},78003,e=>{e.v(t=>Promise.all(["static/chunks/0gy2rolwxzjl8.js","static/chunks/15_baizhaiq8c.js","static/chunks/0sr3d9iqny2rf.js","static/chunks/0ga14ztvrhau2.css"].map(t=>e.l(t))).then(()=>t(97722)))}]);
10
+ `,document.head.appendChild(e)}e.s(["default",0,function({workspaceRoot:e}){let[eh,eg]=(0,r.useState)({global:[],workspace:[]}),[ex,ey]=(0,r.useState)(null),[eb,ej]=(0,r.useState)(!0),[ev,e_]=(0,r.useState)(!0),[ew,eS]=(0,r.useState)([]),[ek,eC]=(0,r.useState)(null),[eN,eR]=(0,r.useState)({}),[eE,eL]=(0,r.useState)(!1),[eW,eO]=(0,r.useState)("SELECT * FROM sqlite_master;"),[eT,eI]=(0,r.useState)(!1),[eD,eP]=(0,r.useState)(null),[ez,eq]=(0,r.useState)(null),[eA,eB]=(0,r.useState)(null),[e$,eF]=(0,r.useState)(null),[eM,eU]=(0,r.useState)(!1),[eH,eG]=(0,r.useState)(!1),[eJ,eQ]=(0,r.useState)({id:"",name:"",type:"sqlite",filepath:"./dev.db",host:"localhost",port:5432,database:"postgres",username:"postgres",password:"",ssl:!1,readOnly:!0}),[eK,eY]=(0,r.useState)(!1),[eV,eX]=(0,r.useState)(null),eZ=async()=>{try{let t=await fetch(`/api/sql/connections?root=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();e.success&&(eg({global:e.global||[],workspace:e.workspace||[]}),ey(e.activeId),ej(e.isActiveGlobal))}}catch(e){console.error("Failed to load connection profiles:",e)}},e0=async()=>{if(!ex)return void eS([]);eL(!0);try{let t=await fetch(`/api/sql/schema?action=list_tables&root=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();e.success?(eS(e.tables||[]),eP(null)):eP(e.error||"Failed to load database schema.")}else{let e=await t.json();eP(e.error||"Failed to load database schema.")}}catch(e){console.error("Failed to load schema:",e)}finally{eL(!1)}},e1=async t=>{if(eN[t])return void eC(ek===t?null:t);try{let r=await fetch(`/api/sql/schema?action=describe_table&table=${encodeURIComponent(t)}&root=${encodeURIComponent(e)}`);if(r.ok){let e=await r.json();e.success&&(eR(r=>({...r,[t]:e.columns})),eC(t))}}catch(e){console.error(`Failed to load columns for table ${t}:`,e)}};(0,r.useEffect)(()=>{eZ()},[e]),(0,r.useEffect)(()=>{e0(),eq(null),eC(null),eR({});let e=eb?eh.global.find(e=>e.id===ex):eh.workspace.find(e=>e.id===ex);e&&("sqlite"===e.type?eO("SELECT name, type FROM sqlite_master WHERE type='table';"):"mssql"===e.type?eO("SELECT * FROM sys.tables;"):eO("SELECT * FROM information_schema.tables LIMIT 10;"))},[ex,eb,eh.global.length,eh.workspace.length]);let e5=async(t,r)=>{try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"set_active",profileId:t,isGlobal:r,root:e})})).ok&&(ey(t),ej(r))}catch(e){console.error("Failed to set active profile:",e)}},e2=async()=>{eX(null);try{let t=await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"test",profile:eJ,root:e})}),r=await t.json();r.success?eX({success:!0,message:"Connection test successful!"}):eX({success:!1,message:r.error||"Connection test failed."})}catch(e){eX({success:!1,message:e.message||"Failed to make test query."})}},e8=async t=>{if(t.preventDefault(),!eJ.name||!eJ.type)return;eY(!0);let r=eJ.id||`profile_${Math.random().toString(36).substring(7)}`,s={...eJ,id:r,name:eJ.name,type:eJ.type};try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"save",profile:s,isGlobal:eH,root:e})})).ok&&(await eZ(),eU(!1),ex||e5(r,eH))}catch(e){console.error("Failed to save profile:",e)}finally{eY(!1)}},e6=async(t,r)=>{if(confirm("Are you sure you want to delete this connection profile?"))try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",profileId:t,isGlobal:r,root:e})})).ok&&(await eZ(),ex===t&&ey(null))}catch(e){console.error("Failed to delete connection profile:",e)}},e7=async(t,r,s,a)=>{if(e4?.readOnly)return void alert("Database connection is Read-Only. Updates are disabled.");let n=(e=>{let t=e.match(/from\s+([a-zA-Z0-9_\`"\[\]\.]+)/i);if(!t)return null;let r=t[1].trim(),s=(r=r.replace(/[\`"\[\]]/g,"")).split(".");return s[s.length-1]})(eW);if(!n)return void alert("Could not extract table name from query for inline edit. Please ensure your query includes 'FROM tableName'.");eF({rowIndex:t,field:r,status:"saving"});try{let a=eN[n];if(!a){let t=await fetch(`/api/sql/schema?action=describe_table&table=${encodeURIComponent(n)}&root=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();e.success&&e.columns&&(a=e.columns,eR(t=>({...t,[n]:e.columns})))}}if(!a)throw Error(`Could not load schema columns for table "${n}".`);let l=a.find(e=>e.isPrimaryKey);if(!l)throw Error(`Table "${n}" does not have a primary key. Inline editing requires a primary key.`);let o=ez?.rows[t];if(!o||!(l.name in o))throw Error(`Primary key column "${l.name}" was not returned in the query results. Please include it in your SELECT statement.`);let i=o[l.name],d=a.find(e=>e.name===r);if(!d)throw Error(`Column "${r}" was not found in schema columns.`);let c=e=>{let t=e.toLowerCase();return t.includes("int")||t.includes("decimal")||t.includes("numeric")||t.includes("float")||t.includes("double")||t.includes("real")},u="";if("NULL"===s.toUpperCase())u=`${r} = NULL`;else if(c(d.type)){if(""===s||isNaN(Number(s)))throw Error(`Value "${s}" is not a valid number for column "${r}".`);u=`${r} = ${s}`}else u=`${r} = '${s.replace(/'/g,"''")}'`;let p="";p=c(l.type)?`${l.name} = ${i}`:`${l.name} = '${String(i).replace(/'/g,"''")}'`;let m=`UPDATE ${n} SET ${u} WHERE ${p};`,f=await fetch("/api/sql/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:m,root:e})}),h=await f.json();if(f.ok&&h.success){if(ez){let e=[...ez.rows],a=s;"NULL"===s.toUpperCase()?a=null:c(d.type)&&(a=Number(s)),e[t]={...e[t],[r]:a},eq({...ez,rows:e})}eF({rowIndex:t,field:r,status:"success"}),setTimeout(()=>eF(null),1500)}else throw Error(h.error||"Update database query failed.")}catch(e){eF({rowIndex:t,field:r,status:"error",message:e.message}),alert(`Inline Update Failed:
11
+ ${e.message}`)}},e3=async()=>{if(eW.trim()&&ex){eI(!0),eP(null),eq(null);try{let t=await fetch("/api/sql/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:eW.trim(),root:e})}),r=await t.json();t.ok&&r.success?(eq({rows:r.rows||[],fields:r.fields||[],durationMs:r.durationMs||0,affectedRows:r.affectedRows}),(eW.toLowerCase().includes("create table")||eW.toLowerCase().includes("drop table")||eW.toLowerCase().includes("alter table"))&&e0()):eP(r.error||"Failed to execute query.")}catch(e){eP(e.message||"An unexpected error occurred during execution.")}finally{eI(!1)}}},e4=eb?eh.global.find(e=>e.id===ex):eh.workspace.find(e=>e.id===ex);return(0,t.jsxs)("div",{style:a,children:[(0,t.jsx)("div",{style:{...n,width:ev?"220px":"0px",borderRight:ev?"1px solid var(--border)":"none",overflow:"hidden",transition:"all 0.25s cubic-bezier(0.4, 0, 0.2, 1)"},children:ev&&(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",minWidth:"220px",minHeight:0},children:[(0,t.jsxs)("div",{style:l,children:[(0,t.jsxs)("div",{style:o,children:[(0,t.jsx)("span",{style:i,children:"Connections"}),(0,t.jsx)("button",{style:d,onClick:()=>{eX(null),eQ({id:"",name:"",type:"sqlite",filepath:"./dev.db",host:"localhost",port:5432,database:"postgres",username:"postgres",password:"",ssl:!1,readOnly:!0}),eG(!1),eU(!0)},title:"Add Database Connection Profile",children:"➕ Add"})]}),(0,t.jsxs)("div",{style:c,children:[0===eh.global.length&&0===eh.workspace.length&&(0,t.jsx)("div",{style:b,children:"No connections configured. Add one to start."}),eh.workspace.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:u,children:"WORKSPACE CONNECTIONS"}),eh.workspace.map(e=>(0,t.jsxs)("div",{style:{...p,...ex===e.id&&!eb?m:{}},onClick:()=>e5(e.id,!1),children:[(0,t.jsxs)("div",{style:f,children:[(0,t.jsxs)("span",{style:h,children:["📁 ",e.name]}),(0,t.jsx)("span",{style:g,children:e.type})]}),(0,t.jsx)("button",{style:x,onClick:t=>{t.stopPropagation(),e6(e.id,!1)},children:"✖"})]},e.id))]}),eh.global.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{style:u,children:"GLOBAL CONNECTIONS"}),eh.global.map(e=>(0,t.jsxs)("div",{style:{...p,...ex===e.id&&eb?m:{}},onClick:()=>e5(e.id,!0),children:[(0,t.jsxs)("div",{style:f,children:[(0,t.jsxs)("span",{style:h,children:["🌐 ",e.name]}),(0,t.jsx)("span",{style:g,children:e.type})]}),(0,t.jsx)("button",{style:x,onClick:t=>{t.stopPropagation(),e6(e.id,!0)},children:"✖"})]},e.id))]})]})]}),(0,t.jsxs)("div",{style:{...l,flex:1,borderTop:"1px solid var(--border)"},children:[(0,t.jsxs)("div",{style:o,children:[(0,t.jsx)("span",{style:i,children:"Schema Tables"}),eE&&(0,t.jsx)("span",{style:es})]}),(0,t.jsxs)("div",{style:y,children:[!ex&&(0,t.jsx)("div",{style:b,children:"Select an active connection to view tables."}),ex&&0===ew.length&&!eE&&(0,t.jsx)("div",{style:b,children:"No tables found in database schema."}),ew.map(e=>(0,t.jsxs)("div",{style:j,children:[(0,t.jsxs)("div",{style:v,onClick:()=>e1(e.name),children:[(0,t.jsx)("span",{style:_,children:"view"===e.type?"👁️":"📊"}),(0,t.jsx)("span",{style:w,children:e.name}),(0,t.jsx)("span",{style:S,children:ek===e.name?"▼":"▶"})]}),ek===e.name&&eN[e.name]&&(0,t.jsx)("div",{style:k,children:eN[e.name].map(e=>(0,t.jsxs)("div",{style:C,children:[(0,t.jsx)("span",{style:N,children:e.isPrimaryKey?"🔑":e.isForeignKey?"🔗":"▫"}),(0,t.jsx)("span",{style:R,title:e.type,children:e.name}),(0,t.jsx)("span",{style:E,children:e.type.toLowerCase().substring(0,12)})]},e.name))})]},e.name))]})]})]})}),(0,t.jsxs)("div",{style:L,children:[(0,t.jsxs)("div",{style:W,children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>e_(!ev),style:{background:"rgba(255, 255, 255, 0.05)",border:"1px solid var(--border)",borderRadius:"6px",color:"var(--muted)",cursor:"pointer",padding:"0.25rem 0.5rem",fontSize:"0.75rem",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.15s ease"},title:ev?"Collapse Connections List":"Expand Connections List",children:ev?"◀ Collapse":"📂 Schema Connections"}),(0,t.jsx)("span",{style:O,children:"Active Connection:"}),e4?(0,t.jsxs)("span",{style:T,children:[eb?"🌐":"📁"," ",e4.name," (",e4.type,")",e4.readOnly&&(0,t.jsx)("span",{style:I,children:"Read-Only"})]}):(0,t.jsx)("span",{style:{...T,color:"var(--danger)"},children:"No Connection Selected"})]}),(0,t.jsx)("button",{style:{...D,opacity:!ex||eT?.6:1,cursor:!ex||eT?"not-allowed":"pointer"},onClick:e3,disabled:!ex||eT,children:eT?"⌛ Running...":"⚡ Execute Query (F5)"})]}),(0,t.jsx)("div",{style:P,children:(0,t.jsx)("textarea",{style:z,value:eW,onChange:e=>eO(e.target.value),placeholder:"Write your SQL query script here...",onKeyDown:e=>{("F5"===e.key||e.ctrlKey&&"Enter"===e.key)&&(e.preventDefault(),e3())}})}),(0,t.jsxs)("div",{style:q,children:[eD&&(0,t.jsxs)("div",{style:A,children:[(0,t.jsx)("h4",{style:{margin:"0 0 0.5rem 0",color:"var(--danger)"},children:"⚠️ Execution Error"}),(0,t.jsx)("pre",{style:B,children:eD}),eD.includes("not installed")&&(0,t.jsxs)("div",{style:$,children:[(0,t.jsx)("p",{style:{margin:"0 0 0.5rem 0"},children:"To resolve this, run this installer command in your workspace terminal:"}),(0,t.jsx)("code",{style:F,children:e4?.type==="sqlite"?"npm install better-sqlite3":e4?.type==="postgres"?"npm install pg":e4?.type==="mysql"?"npm install mysql2":"npm install mssql"})]})]}),ez&&(0,t.jsxs)("div",{style:M,children:[(0,t.jsxs)("div",{style:U,children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,t.jsxs)("span",{children:["Query completed."," ",void 0!==ez.affectedRows?`Affected rows: ${ez.affectedRows}`:`Returned ${ez.rows.length} rows`]}),(0,t.jsxs)("span",{children:["Duration: ",ez.durationMs,"ms"]})]}),ez.rows.length>0&&(0,t.jsxs)("div",{style:{display:"flex",gap:"0.4rem"},children:[(0,t.jsx)("button",{onClick:()=>{if(ez&&0!==ez.rows.length)try{let e=ez.fields.join(","),t=ez.rows.map(e=>ez.fields.map(t=>{let r=e[t];if(null===r)return"NULL";let s=String(r);return s.includes(",")||s.includes('"')||s.includes("\n")||s.includes("\r")?`"${s.replace(/"/g,'""')}"`:s}).join(",")),r=[e,...t].join("\r\n"),s=new Blob([r],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(s),n=document.createElement("a");n.setAttribute("href",a),n.setAttribute("download",`query-results-${Date.now()}.csv`),document.body.appendChild(n),n.click(),document.body.removeChild(n)}catch(e){console.error("Export CSV failed:",e),alert("Failed to export as CSV")}},style:K,children:"📥 Export CSV"}),(0,t.jsx)("button",{onClick:()=>{if(ez&&0!==ez.rows.length)try{let e=JSON.stringify(ez.rows,null,2),t=new Blob([e],{type:"application/json;charset=utf-8;"}),r=URL.createObjectURL(t),s=document.createElement("a");s.setAttribute("href",r),s.setAttribute("download",`query-results-${Date.now()}.json`),document.body.appendChild(s),s.click(),document.body.removeChild(s)}catch(e){console.error("Export JSON failed:",e),alert("Failed to export as JSON")}},style:K,children:"📥 Export JSON"})]})]}),ez.rows.length>0?(0,t.jsx)("div",{style:H,children:(0,t.jsxs)("table",{style:G,children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:ez.fields.map(e=>(0,t.jsx)("th",{style:J,children:e},e))})}),(0,t.jsx)("tbody",{children:ez.rows.map((e,r)=>(0,t.jsx)("tr",{style:r%2==0?X:Z,children:ez.fields.map(s=>{let a=eA&&eA.rowIndex===r&&eA.field===s,n=e$&&e$.rowIndex===r&&e$.field===s&&"saving"===e$.status,l=e$&&e$.rowIndex===r&&e$.field===s&&"success"===e$.status,o=e$&&e$.rowIndex===r&&e$.field===s&&"error"===e$.status,i={...Q,...V};return n?i={...i,backgroundColor:"rgba(168, 85, 247, 0.15)"}:l?i={...i,backgroundColor:"rgba(16, 185, 129, 0.25)"}:o&&(i={...i,backgroundColor:"rgba(239, 68, 68, 0.25)"}),(0,t.jsx)("td",{style:i,onDoubleClick:()=>{e4?.readOnly?alert("Database connection is Read-Only. Editing is disabled."):eB({rowIndex:r,field:s,value:null===e[s]?"NULL":String(e[s])})},className:"db-cell",title:"Double click to edit cell",children:a?(0,t.jsx)("input",{style:Y,value:eA.value,autoFocus:!0,onChange:e=>eB({...eA,value:e.target.value}),onKeyDown:async t=>{if("Enter"===t.key){t.preventDefault();let a=eA.value;eB(null),a!==(null===e[s]?"NULL":String(e[s]))&&await e7(r,s,a,e[s])}else"Escape"===t.key&&eB(null)},onBlur:async()=>{let t=eA.value;eB(null),t!==(null===e[s]?"NULL":String(e[s]))&&await e7(r,s,t,e[s])}}):null===e[s]?"NULL":"object"==typeof e[s]?JSON.stringify(e[s]):String(e[s])},s)})},r))})]})}):void 0===ez.affectedRows&&(0,t.jsx)("div",{style:ee,children:"Query executed successfully, but returned 0 results."})]}),!eD&&!ez&&!eT&&(0,t.jsx)("div",{style:ee,children:"Write a query script and click Execute to view table records."}),eT&&(0,t.jsxs)("div",{style:et,children:[(0,t.jsx)("span",{style:er}),(0,t.jsx)("span",{style:{color:"var(--muted)"},children:"Running database statement..."})]})]})]}),eM&&"u">typeof document&&(0,s.createPortal)((0,t.jsx)("div",{style:ea,children:(0,t.jsxs)("div",{style:en,children:[(0,t.jsxs)("h3",{style:{margin:"0 0 1rem 0",display:"flex",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:"🔌 Add Database Profile"}),(0,t.jsx)("span",{style:{cursor:"pointer"},onClick:()=>eU(!1),children:"✖"})]}),(0,t.jsxs)("form",{onSubmit:e8,children:[(0,t.jsxs)("div",{style:el,children:[(0,t.jsx)("label",{style:eo,children:"Profile Name"}),(0,t.jsx)("input",{style:ei,type:"text",required:!0,value:eJ.name,onChange:e=>eQ(t=>({...t,name:e.target.value})),placeholder:"e.g. Local Postgres, Dev SQLite"})]}),(0,t.jsxs)("div",{style:el,children:[(0,t.jsx)("label",{style:eo,children:"Scope Level"}),(0,t.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,t.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"radio",checked:!eH,onChange:()=>eG(!1)}),"Workspace Local"]}),(0,t.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"radio",checked:eH,onChange:()=>eG(!0)}),"Global User Profile"]})]})]}),(0,t.jsxs)("div",{style:el,children:[(0,t.jsx)("label",{style:eo,children:"Database Type"}),(0,t.jsxs)("select",{style:ed,value:eJ.type,onChange:e=>{let t=e.target.value,r=5432;"mysql"===t&&(r=3306),"mssql"===t&&(r=1433),eQ(e=>({...e,type:t,filepath:"sqlite"===t?"./dev.db":void 0,port:"sqlite"!==t?r:void 0,database:"sqlite"===t?void 0:"mssql"===t?"master":"postgres"===t?"postgres":"",username:"sqlite"===t?void 0:"mssql"===t?"sa":"postgres"===t?"postgres":"root"}))},children:[(0,t.jsx)("option",{value:"sqlite",children:"SQLite (Local File)"}),(0,t.jsx)("option",{value:"postgres",children:"PostgreSQL"}),(0,t.jsx)("option",{value:"mysql",children:"MySQL"}),(0,t.jsx)("option",{value:"mssql",children:"Microsoft SQL Server"})]})]}),"sqlite"===eJ.type?(0,t.jsxs)("div",{style:el,children:[(0,t.jsx)("label",{style:eo,children:"Database File Path"}),(0,t.jsx)("input",{style:ei,type:"text",required:!0,value:eJ.filepath||"",onChange:e=>eQ(t=>({...t,filepath:e.target.value})),placeholder:"Relative (e.g. ./data/dev.db) or Absolute path"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,t.jsxs)("div",{style:{...el,flex:3},children:[(0,t.jsx)("label",{style:eo,children:"Host IP Address"}),(0,t.jsx)("input",{style:ei,type:"text",required:!0,value:eJ.host||"",onChange:e=>eQ(t=>({...t,host:e.target.value})),placeholder:"localhost or IP"})]}),(0,t.jsxs)("div",{style:{...el,flex:1},children:[(0,t.jsx)("label",{style:eo,children:"Port"}),(0,t.jsx)("input",{style:ei,type:"number",required:!0,value:eJ.port||0,onChange:e=>eQ(t=>({...t,port:parseInt(e.target.value)}))})]})]}),(0,t.jsxs)("div",{style:el,children:[(0,t.jsx)("label",{style:eo,children:"Database Name"}),(0,t.jsx)("input",{style:ei,type:"text",required:!0,value:eJ.database||"",onChange:e=>eQ(t=>({...t,database:e.target.value}))})]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,t.jsxs)("div",{style:{...el,flex:1},children:[(0,t.jsx)("label",{style:eo,children:"Username"}),(0,t.jsx)("input",{style:ei,type:"text",required:!0,value:eJ.username||"",onChange:e=>eQ(t=>({...t,username:e.target.value}))})]}),(0,t.jsxs)("div",{style:{...el,flex:1},children:[(0,t.jsx)("label",{style:eo,children:"Password"}),(0,t.jsx)("input",{style:ei,type:"password",value:eJ.password||"",onChange:e=>eQ(t=>({...t,password:e.target.value}))})]})]}),("postgres"===eJ.type||"mssql"===eJ.type)&&(0,t.jsx)("div",{style:el,children:(0,t.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"checkbox",checked:!!eJ.ssl,onChange:e=>eQ(t=>({...t,ssl:e.target.checked}))}),"Require SSL Secure Connection"]})})]}),(0,t.jsx)("div",{style:el,children:(0,t.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"checkbox",checked:!!eJ.readOnly,onChange:e=>eQ(t=>({...t,readOnly:e.target.checked}))}),"Enforce Read-Only Connection (Disable mutations)"]})}),eV&&(0,t.jsx)("div",{style:{...ec,backgroundColor:eV.success?"rgba(16, 185, 129, 0.12)":"rgba(239, 68, 68, 0.12)",border:eV.success?"1px solid var(--success)":"1px solid var(--danger)",color:eV.success?"var(--success)":"var(--danger)"},children:eV.message}),(0,t.jsxs)("div",{style:eu,children:[(0,t.jsx)("button",{type:"button",style:ep,onClick:e2,children:"🔍 Test Connection"}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,t.jsx)("button",{type:"button",style:em,onClick:()=>eU(!1),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",style:ef,disabled:eK,children:eK?"Saving...":"Save Profile"})]})]})]})]})}),document.body)]})}])},20897,e=>{e.v({activeBorder:"page-module___8aEwW__activeBorder",agentBadge:"page-module___8aEwW__agentBadge",agentCard:"page-module___8aEwW__agentCard",agentGrid:"page-module___8aEwW__agentGrid",agentHeader:"page-module___8aEwW__agentHeader",agentName:"page-module___8aEwW__agentName",agentStateBadge:"page-module___8aEwW__agentStateBadge",ansiCyan:"page-module___8aEwW__ansiCyan",ansiGreen:"page-module___8aEwW__ansiGreen",ansiMagenta:"page-module___8aEwW__ansiMagenta",ansiRed:"page-module___8aEwW__ansiRed",ansiYellow:"page-module___8aEwW__ansiYellow",cardBody:"page-module___8aEwW__cardBody",container:"page-module___8aEwW__container",containerActive:"page-module___8aEwW__containerActive",contextDetails:"page-module___8aEwW__contextDetails",contextItem:"page-module___8aEwW__contextItem",contextList:"page-module___8aEwW__contextList",contextMeta:"page-module___8aEwW__contextMeta",contextTitle:"page-module___8aEwW__contextTitle",dashboardGrid:"page-module___8aEwW__dashboardGrid",envGrid:"page-module___8aEwW__envGrid",envName:"page-module___8aEwW__envName",envRow:"page-module___8aEwW__envRow",envStatus:"page-module___8aEwW__envStatus",footer:"page-module___8aEwW__footer",header:"page-module___8aEwW__header",logoArea:"page-module___8aEwW__logoArea",mainPanel:"page-module___8aEwW__mainPanel",pulse:"page-module___8aEwW__pulse","pulse-attention":"page-module___8aEwW__pulse-attention","pulse-thinking":"page-module___8aEwW__pulse-thinking",pulseDot:"page-module___8aEwW__pulseDot",quickLaunchBtn:"page-module___8aEwW__quickLaunchBtn",sectionTitle:"page-module___8aEwW__sectionTitle",sidePanel:"page-module___8aEwW__sidePanel","state-complete":"page-module___8aEwW__state-complete","state-idle":"page-module___8aEwW__state-idle","state-needs-input":"page-module___8aEwW__state-needs-input","state-thinking":"page-module___8aEwW__state-thinking",statusIndicator:"page-module___8aEwW__statusIndicator",stoppedBadge:"page-module___8aEwW__stoppedBadge",subtitle:"page-module___8aEwW__subtitle",terminalContainer:"page-module___8aEwW__terminalContainer",terminalInput:"page-module___8aEwW__terminalInput",terminalInputArea:"page-module___8aEwW__terminalInputArea",terminalLine:"page-module___8aEwW__terminalLine",terminalSendBtn:"page-module___8aEwW__terminalSendBtn",title:"page-module___8aEwW__title"})},52683,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(70703),a=e.i(20897),n=e.i(66381);let l=e=>"mock"===e?"🧪":e.includes("-docker")?"🐳":e.includes("-ssh")?"🌐":"💻",o=(0,s.default)(()=>e.A(33779),{loadableGenerated:{modules:[37314]},ssr:!1,loading:()=>(0,t.jsx)("div",{style:{height:"400px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#05070a",color:"var(--muted)",border:"1px solid var(--border)",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px"},children:(0,t.jsx)("span",{children:"Initializing terminal emulator..."})})}),i=(0,s.default)(()=>e.A(39429),{loadableGenerated:{modules:[1985]},ssr:!1,loading:()=>(0,t.jsx)("div",{style:{height:"280px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--card)",border:"1px solid var(--border)",borderRadius:"12px",marginTop:"1.5rem"},children:(0,t.jsx)("span",{style:{color:"var(--muted)"},children:"Initializing prompt editor..."})})}),d=(0,s.default)(()=>e.A(56915),{loadableGenerated:{modules:[99026]},ssr:!1}),c=(0,s.default)(()=>e.A(78716),{loadableGenerated:{modules:[9949]},ssr:!1}),u=(0,s.default)(()=>e.A(33789),{loadableGenerated:{modules:[20032]},ssr:!1}),p=(0,s.default)(()=>e.A(78003),{loadableGenerated:{modules:[97722]},ssr:!1});e.s(["default",0,function(){let[e,s]=(0,r.useState)([]),[m,f]=(0,r.useState)(null),[h,g]=(0,r.useState)(!1),[x,y]=(0,r.useState)(!1),[b,j]=(0,r.useState)(!1),[v,_]=(0,r.useState)(!1),[w,S]=(0,r.useState)(!1),[k,C]=(0,r.useState)(!1),[N,R]=(0,r.useState)(""),[E,L]=(0,r.useState)(9601),[W,O]=(0,r.useState)("0.2.19"),[T,I]=(0,r.useState)(null),[D,P]=(0,r.useState)([]),z=e.filter(e=>"workspace-terminal"!==e.id),q=e.find(e=>e.id===m),A=z.some(e=>("claude-docker"===e.type||"aider-docker"===e.type)&&"running"===e.status),B=z.some(e=>"claude-ssh"===e.type&&"running"===e.status),$=async()=>{try{let e=await fetch("/api/sessions"),t=await e.json();t.sessions&&s(t.sessions),t.wsPort&&L(t.wsPort),t.originalCwd&&R(t.originalCwd),t.version&&O(t.version)}catch(e){console.error("Failed to fetch sessions:",e)}},F=async()=>{try{let e=await fetch("/api/recents");if(e.ok){let t=await e.json();t.success&&t.recents&&t.recents.lastSession&&I(t.recents.lastSession)}}catch(e){console.error("Failed to fetch recents:",e)}},M=async()=>{try{let e=await fetch("/api/configs");if(e.ok){let t=await e.json();t.configs&&P(t.configs)}}catch(e){console.error("Failed to fetch configs:",e)}};(0,r.useEffect)(()=>{(async()=>{await $(),await F(),await M()})(),"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(e=>console.log("Service Worker registered:",e.scope)).catch(e=>console.error("Service Worker registration failed:",e));let e=setInterval($,4e3);return()=>clearInterval(e)},[]);let U=async(e,t,r,s)=>{g(!0);try{let a=t;a||("claude"===e?a="Claude Local":"claude-docker"===e?a="Claude Docker":"claude-ssh"===e?a="Claude SSH":"aider"===e?a="Aider Local":"aider-docker"===e?a="Aider Docker":"mock"===e&&(a="Mock Session"));let n={type:e,name:a,workspaceRoot:r,scopedDirs:s};if(("aider"===e||"aider-docker"===e)&&!r)try{let e=await fetch("/api/context/aider");if(e.ok){let t=await e.json();t.success&&t.config&&(n.workspaceRoot=t.config.workspaceRoot,n.scopedDirs=t.config.scopedDirs)}}catch(e){console.error("Failed to load aider configuration before launch:",e)}let l=await fetch("/api/sessions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),o=await l.json();o.success&&(await $(),await M(),f(o.session.id),I({type:e,name:a,workspaceRoot:r,scopedDirs:s}))}catch(e){console.error("Failed to launch session:",e)}finally{g(!1)}},H=async e=>{g(!0);try{let t=await fetch("/api/sessions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:e.type,name:e.name,workspaceRoot:e.workspaceRoot,scopedDirs:e.scopedDirs})}),r=await t.json();r.success?(await $(),f(r.session.id)):alert(r.error||"Failed to launch configuration.")}catch(e){console.error(e),alert("Network error: failed to launch configuration.")}finally{g(!1)}},G=async e=>{if(window.confirm("Are you sure you want to delete this configuration template?"))try{(await fetch("/api/configs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",id:e})})).ok?await M():alert("Failed to delete configuration template.")}catch(e){console.error(e),alert("Network error: failed to delete configuration template.")}},J=async(e,t=!1)=>{try{let r=await fetch("/api/sessions/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,delete:t})});(await r.json()).success&&(t&&m===e&&f(null),await $())}catch(e){console.error("Failed to stop session:",e)}};return(0,t.jsxs)("div",{className:`${a.default.container} ${q?a.default.containerActive:""}`,children:[(0,t.jsxs)("header",{className:a.default.header,children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1.5rem"},children:[(0,t.jsx)("img",{src:"/logo.png",alt:"NeuralLoom Logo",style:{width:"160px",height:"160px",borderRadius:"16px",objectFit:"contain"}}),(0,t.jsxs)("div",{className:a.default.logoArea,children:[(0,t.jsx)("h1",{className:a.default.title,style:{margin:0,lineHeight:1.1},children:"NeuralLoom"}),(0,t.jsx)("span",{className:a.default.subtitle,children:"Unified AI Orchestrator & Context Bridge"})]})]}),(0,t.jsxs)("div",{className:a.default.statusIndicator,children:[(0,t.jsx)("span",{className:a.default.pulseDot}),(0,t.jsx)("span",{children:"Orchestrator Online"})]})]}),q?(0,t.jsx)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:(0,t.jsx)(p,{sessionId:q.id,workspaceRoot:q.workspaceRoot||"",scopedDirs:q.scopedDirs||[],onClose:()=>f(null),sessions:e,onSwitchSession:e=>f(e),onRefreshSessions:$,wsPort:E})}):(0,t.jsxs)("div",{className:a.default.dashboardGrid,children:[(0,t.jsxs)("div",{className:a.default.mainPanel,children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:a.default.sectionTitle,children:"Built-in Database Explorer & SQL Client"}),(0,t.jsx)("div",{className:"card",style:{padding:0,overflow:"hidden",height:"450px",border:"1px solid var(--border)"},children:(0,t.jsx)(n.default,{workspaceRoot:N||""})})]}),(0,t.jsxs)("section",{style:{marginTop:"1.5rem"},children:[(0,t.jsx)("h2",{className:a.default.sectionTitle,children:"Shared Context Hub & Slash Commands"}),(0,t.jsxs)("div",{className:a.default.contextList,children:[(0,t.jsxs)("div",{className:`${a.default.contextItem} card`,children:[(0,t.jsxs)("div",{className:a.default.contextMeta,children:[(0,t.jsx)("span",{className:a.default.contextTitle,children:"Staged Context & System Rules (/ccc)"}),(0,t.jsx)("span",{className:a.default.contextDetails,children:"Compiles AGENTS.md guidelines and files map."})]}),(0,t.jsx)("button",{onClick:async()=>{m&&await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:m,command:"/ccc"})})},disabled:!m,style:{padding:"0.4rem 0.8rem",borderRadius:"6px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.75rem",fontWeight:600,opacity:m?1:.5,cursor:m?"pointer":"not-allowed"},children:"🚀 Mount (/ccc)"})]}),(0,t.jsxs)("div",{className:`${a.default.contextItem} card`,children:[(0,t.jsxs)("div",{className:a.default.contextMeta,children:[(0,t.jsx)("span",{className:a.default.contextTitle,children:"Staged Developer Prompt (/ccp)"}),(0,t.jsx)("span",{className:a.default.contextDetails,children:"Executes prompt in .ai/neural-loom/cprompt.md."})]}),(0,t.jsx)("button",{onClick:async()=>{m&&await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:m,command:"/ccp"})})},disabled:!m,style:{padding:"0.4rem 0.8rem",borderRadius:"6px",border:"1px solid var(--success)",backgroundColor:"transparent",color:"var(--success)",fontSize:"0.75rem",fontWeight:600,opacity:m?1:.5,cursor:m?"pointer":"not-allowed"},children:"⚡ Run (/ccp)"})]})]}),(0,t.jsx)(i,{})]})]}),(0,t.jsxs)("div",{className:a.default.mainPanel,children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:a.default.sectionTitle,children:"Active AI Agents"}),0===z.length?(0,t.jsxs)("div",{className:"card",style:{padding:"3rem 1.5rem",textAlign:"center"},children:[(0,t.jsx)("p",{style:{color:"var(--muted)",marginBottom:"1.5rem"},children:"No active agent sessions. Launch a Claude or Aider agent session to begin."}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.75rem",flexDirection:"column"},children:[T&&(0,t.jsx)("button",{className:a.default.quickLaunchBtn,onClick:()=>{U(T.type,T.name,T.workspaceRoot,T.scopedDirs)},disabled:h,style:{background:"linear-gradient(135deg, hsl(38, 92%, 50%) 0%, hsl(0, 84%, 60%) 100%)",border:"none"},title:`Re-launch: ${T.name||T.type}`,children:"⚡ Re-launch Last Session"}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,t.jsx)("button",{className:a.default.quickLaunchBtn,onClick:()=>{C(!1),S(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(262, 83%, 60%) 0%, hsl(195, 100%, 45%) 100%)",border:"none",flex:1},children:"Launch Claude"}),(0,t.jsx)("button",{className:a.default.quickLaunchBtn,onClick:()=>{_(!1),j(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(210, 80%, 45%) 0%, hsl(262, 80%, 55%) 100%)",border:"none",flex:1},children:"Launch Aider"})]})]}),(0,t.jsxs)("div",{style:{marginTop:"1.5rem",fontSize:"0.75rem",color:"var(--muted)"},children:["Need a simulator?"," ",(0,t.jsx)("span",{onClick:()=>U("mock"),style:{color:"var(--primary)",cursor:"pointer",textDecoration:"underline"},children:"Start mock playground"})]})]}):(0,t.jsx)("div",{className:a.default.agentGrid,children:z.map(e=>(0,t.jsxs)("div",{className:`${a.default.agentCard} card ${m===e.id?a.default.activeBorder:""}`,children:[(0,t.jsxs)("div",{className:a.default.agentHeader,children:[(0,t.jsx)("span",{className:a.default.agentName,children:e.name}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.35rem",alignItems:"center"},children:["running"===e.status&&e.agentState&&(0,t.jsxs)("span",{className:`${a.default.agentStateBadge} ${a.default["state-"+e.agentState]}`,children:["thinking"===e.agentState&&`${l(e.type)} 💭`,"needs-input"===e.agentState&&`${l(e.type)} ⚠️`,"complete"===e.agentState&&`${l(e.type)} ✅`,"idle"===e.agentState&&`${l(e.type)} 💤`]}),(0,t.jsx)("span",{className:`${a.default.agentBadge} ${"stopped"===e.status?a.default.stoppedBadge:""}`,children:e.status})]})]}),(0,t.jsxs)("div",{className:a.default.cardBody,style:{padding:"1rem"},children:[(0,t.jsxs)("p",{style:{fontSize:"0.8rem",color:"var(--muted)",margin:0},children:["ID: ",(0,t.jsx)("code",{style:{fontSize:"0.72rem"},children:e.id.substring(0,8)})," | Type: ",e.type,(0,t.jsx)("br",{}),"Logs: ",e.logsCount," lines"]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.75rem"},children:["running"===e.status?(0,t.jsx)("button",{onClick:()=>J(e.id,!1),style:{flex:1,padding:"0.35rem",borderRadius:"6px",border:"1px solid var(--danger)",backgroundColor:"transparent",fontSize:"0.75rem",color:"var(--danger)",cursor:"pointer"},children:"Stop"}):(0,t.jsx)("button",{onClick:()=>J(e.id,!0),style:{flex:1,padding:"0.35rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"transparent",fontSize:"0.75rem",color:"var(--muted)",cursor:"pointer"},children:"Delete"}),(0,t.jsx)("button",{onClick:()=>f(e.id),style:{flex:2,padding:"0.35rem",borderRadius:"6px",border:"none",backgroundColor:m===e.id?"var(--border-focus)":"var(--primary)",fontSize:"0.75rem",fontWeight:600,color:"#fff",cursor:"pointer"},children:m===e.id?"Connected":"Open Console"})]})]})]},e.id))})]}),m&&"workspace-terminal"!==m&&(0,t.jsxs)("section",{className:"card",style:{display:"flex",flexDirection:"column",border:"1px solid var(--border-focus)",marginTop:"1rem"},children:[(0,t.jsxs)("div",{className:a.default.agentHeader,style:{justifyContent:"space-between",background:"rgba(109, 40, 217, 0.08)",padding:"0.5rem 1rem"},children:[(0,t.jsxs)("span",{style:{fontWeight:600,fontSize:"0.85rem",display:"flex",alignItems:"center",gap:"0.5rem"},children:["🖥️ Console — ",e.find(e=>e.id===m)?.name]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[e.find(e=>e.id===m)?.status==="stopped"&&(0,t.jsx)("button",{onClick:async()=>{try{let t=e.find(e=>e.id===m),r=t&&("claude"===t.type||"claude-docker"===t.type||"claude-ssh"===t.type),s=!1;r&&(s=window.confirm("Would you like to resume your previous Claude session?"));let a=await fetch("/api/sessions/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:m,resume:s})});if(a.ok)await $();else{let e=await a.json();alert(e.error||"Failed to restart session.")}}catch(e){console.error("Failed to restart session:",e)}},style:{padding:"0.15rem 0.4rem",borderRadius:"4px",border:"1px solid #eab308",backgroundColor:"rgba(234, 179, 8, 0.15)",color:"#eab308",fontSize:"0.65rem",fontWeight:600,cursor:"pointer"},children:"⚡ Restart"}),(0,t.jsx)("button",{onClick:()=>f(null),style:{border:"none",background:"none",color:"var(--muted)",cursor:"pointer",fontSize:"0.75rem"},children:"✖"})]})]}),(0,t.jsx)(o,{sessionId:m,wsPort:E})]})]}),(0,t.jsxs)("div",{className:a.default.sidePanel,children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:a.default.sectionTitle,children:"Execution Environments"}),(0,t.jsxs)("div",{className:a.default.envGrid,children:[(0,t.jsxs)("div",{className:a.default.envRow,style:{padding:"0.5rem 0.75rem"},children:[(0,t.jsx)("span",{className:a.default.envName,children:"💻 Local Host"}),(0,t.jsx)("span",{className:a.default.envStatus,style:{color:"var(--success)"},children:"Active"})]}),(0,t.jsxs)("div",{className:a.default.envRow,style:{opacity:A?1:.6,padding:"0.5rem 0.75rem"},children:[(0,t.jsx)("span",{className:a.default.envName,children:"🐳 Docker Sandbox"}),(0,t.jsx)("span",{className:a.default.envStatus,style:{color:A?"var(--success)":"var(--muted)"},children:A?"Active":"Not Mounted"})]}),(0,t.jsxs)("div",{className:a.default.envRow,style:{opacity:B?1:.6,padding:"0.5rem 0.75rem"},children:[(0,t.jsx)("span",{className:a.default.envName,children:"🌐 Remote VM (SSH)"}),(0,t.jsx)("span",{className:a.default.envStatus,style:{color:B?"var(--success)":"var(--muted)"},children:B?"Active":"Offline"})]})]})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:a.default.sectionTitle,children:"Saved Configurations"}),(0,t.jsx)("div",{className:"card",style:{padding:"1rem",display:"flex",flexDirection:"column",gap:"0.75rem"},children:0===D.length?(0,t.jsx)("p",{style:{color:"var(--muted)",fontSize:"0.8rem",textAlign:"center",margin:"1rem 0"},children:"No configuration templates saved yet. Save a template from the Claude/Aider launch wizards."}):(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",maxHeight:"200px",overflowY:"auto"},children:D.map(e=>(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(255, 255, 255, 0.02)",padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)"},children:[(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.15rem",minWidth:0},children:[(0,t.jsx)("span",{style:{fontSize:"0.8rem",fontWeight:600,color:"var(--foreground)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),(0,t.jsx)("span",{style:{fontSize:"0.65rem",color:"var(--muted)",textTransform:"uppercase"},children:e.type})]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.25rem"},children:[(0,t.jsx)("button",{onClick:()=>H(e),disabled:h,style:{padding:"0.2rem 0.4rem",borderRadius:"4px",backgroundColor:"var(--primary)",color:"#fff",border:"none",fontSize:"0.7rem",cursor:"pointer"},children:"Launch"}),(0,t.jsx)("button",{onClick:()=>G(e.id),style:{padding:"0.2rem 0.4rem",borderRadius:"4px",backgroundColor:"transparent",color:"var(--danger)",border:"1px solid var(--danger)",fontSize:"0.7rem",cursor:"pointer"},children:"Delete"})]})]},e.id))})})]}),(0,t.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,t.jsx)("button",{className:a.default.quickLaunchBtn,onClick:()=>{C(!1),S(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(262, 83%, 60%) 0%, hsl(195, 100%, 45%) 100%)",border:"none",padding:"0.6rem",fontSize:"0.8rem",flex:1},children:"🤖 Claude Local"}),(0,t.jsx)("button",{className:a.default.quickLaunchBtn,onClick:()=>{C(!0),S(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(170, 72%, 40%) 0%, hsl(195, 100%, 40%) 100%)",border:"none",padding:"0.6rem",fontSize:"0.8rem",flex:1},children:"🐳 Claude Docker"})]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,t.jsx)("button",{className:a.default.quickLaunchBtn,onClick:()=>{_(!1),j(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(210, 80%, 45%) 0%, hsl(262, 80%, 55%) 100%)",border:"none",padding:"0.6rem",fontSize:"0.8rem",flex:1},children:"🐍 Aider Local"}),(0,t.jsx)("button",{className:a.default.quickLaunchBtn,onClick:()=>{_(!0),j(!0)},disabled:h,style:{background:"linear-gradient(135deg, hsl(195, 100%, 40%) 0%, hsl(262, 80%, 55%) 100%)",border:"none",padding:"0.6rem",fontSize:"0.8rem",flex:1},children:"🐳 Aider Docker"})]}),(0,t.jsx)("button",{className:a.default.quickLaunchBtn,onClick:()=>y(!0),disabled:h,style:{background:"linear-gradient(135deg, hsl(38, 92%, 50%) 0%, hsl(0, 84%, 60%) 100%)",border:"none",padding:"0.6rem",fontSize:"0.8rem"},children:"🌐 Connect Remote SSH"})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h2",{className:a.default.sectionTitle,children:"Workspace Terminal"}),(0,t.jsxs)("div",{className:"card",style:{display:"flex",flexDirection:"column",border:"1px solid var(--border)",padding:0},children:[(0,t.jsx)("div",{className:a.default.agentHeader,style:{justifyContent:"space-between",background:"rgba(255, 255, 255, 0.02)",padding:"0.4rem 0.75rem"},children:(0,t.jsxs)("span",{style:{fontWeight:600,fontSize:"0.75rem"},children:["💻 Local Shell (CWD: ",N.split(/[/\\]/).pop()||"root",")"]})}),(0,t.jsx)(o,{sessionId:"workspace-terminal",height:"180px",wsPort:E})]})]}),(0,t.jsxs)("section",{className:"card",style:{padding:"1rem",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,t.jsx)("h3",{style:{fontSize:"0.9rem",fontWeight:700,margin:0},children:"Quick Actions"}),(0,t.jsxs)("ul",{style:{listStyle:"none",fontSize:"0.75rem",display:"flex",flexDirection:"column",gap:"0.35rem",color:"var(--muted)",padding:0,margin:0},children:[(0,t.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:"Configure API Keys"}),(0,t.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]}),(0,t.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:"Edit rules templates"}),(0,t.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]}),(0,t.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:"Inspect process locks"}),(0,t.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]})]})]})]})]}),(0,t.jsxs)("footer",{className:a.default.footer,children:[(0,t.jsxs)("span",{children:["NeuralLoom v",W," — Experimental AI Orchestrator Bridge"]}),(0,t.jsxs)("span",{children:["Directory: ",N||"Loading..."]})]}),x&&(0,t.jsx)(d,{onClose:()=>y(!1),onConfirmLaunch:()=>{y(!1),U("claude-ssh")}}),b&&(0,t.jsx)(c,{onClose:()=>j(!1),isDocker:v,onConfirmLaunch:(e,t,r)=>{j(!1),U(v?"aider-docker":"aider",e,t,r)}}),w&&(0,t.jsx)(u,{onClose:()=>S(!1),isDocker:k,onConfirmLaunch:(e,t,r)=>{S(!1),U(k?"claude-docker":"claude",e,t,r)}})]})}])},33779,e=>{e.v(t=>Promise.all(["static/chunks/03g6xpslyid3~.js","static/chunks/00pgauqedvo01.js","static/chunks/0ga14ztvrhau2.css"].map(t=>e.l(t))).then(()=>t(37314)))},39429,e=>{e.v(t=>Promise.all(["static/chunks/16w4~t4h7gk13.js"].map(t=>e.l(t))).then(()=>t(1985)))},56915,e=>{e.v(t=>Promise.all(["static/chunks/0lnobx4eh3~-_.js"].map(t=>e.l(t))).then(()=>t(99026)))},78716,e=>{e.v(t=>Promise.all(["static/chunks/0xhaghhxllgzs.js"].map(t=>e.l(t))).then(()=>t(9949)))},33789,e=>{e.v(t=>Promise.all(["static/chunks/15sigqif_v.mu.js"].map(t=>e.l(t))).then(()=>t(20032)))},78003,e=>{e.v(t=>Promise.all(["static/chunks/0gy2rolwxzjl8.js","static/chunks/00pgauqedvo01.js","static/chunks/0ii_nb0g40rmj.js","static/chunks/0ga14ztvrhau2.css"].map(t=>e.l(t))).then(()=>t(97722)))}]);
@@ -8,9 +8,9 @@ WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){t
8
8
  `).slice(2).join(`
9
9
  `))}},P=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},I=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},H=0,F=class{constructor(e){this.value=e,this.id=H++}},W=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new L(e?.onListenerError??c,this._options?.leakWarningThreshold??-1):void 0,this._perfMon=this._options?._profName?new k(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],i=new I(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||c)(i),b.None}if(this._disposed)return b.None;t&&(e=e.bind(t));let r=new F(e),s;this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(r.stack=O.create(),s=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof F?(this._deliveryQueue??=new N,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=S(()=>{B?.unregister(n),s?.(),this._removeListener(r)});if(i instanceof C?i.add(n):Array.isArray(i)&&i.push(n),B){let e=Error().stack.split(`
10
10
  `).slice(2,3).join(`
11
- `).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);B.register(n,t?.[2]??e,n)}return n},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(-1===i)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let r=this._deliveryQueue.current===this;if(2*this._size<=t.length){let e=0;for(let i=0;i<t.length;i++)t[i]?t[e++]=t[i]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||c;try{e.value(t)}catch(e){i(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof F)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},N=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},U=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});(j=M||={}).isCancellationToken=function(e){return e===j.None||e===j.Cancelled||e instanceof K||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},j.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:T.None}),j.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:U});var j,$,z,K=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?U:(this._emitter||(this._emitter=new W),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},q=!1,V="en",G=globalThis;"u">typeof G.vscode&&"u">typeof G.vscode.process?z=G.vscode.process:"u">typeof h.default&&"string"==typeof h.default?.versions?.node&&(z=h.default);var X="string"==typeof z?.versions?.electron&&z?.type==="renderer";if("object"==typeof z){z.platform,z.platform,"linux"===z.platform&&z.env.SNAP&&z.env.SNAP_REVISION,z.env.CI||z.env.BUILD_ARTIFACTSTAGINGDIRECTORY,V="en";let e=z.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,V=t.resolvedLanguage||"en",t.languagePack?.translationsConfigFile}catch{}}else"object"!=typeof navigator||X?console.error("Unable to resolve platform."):(($=navigator.userAgent).indexOf("Windows"),$.indexOf("Macintosh"),($.indexOf("Macintosh")>=0||$.indexOf("iPad")>=0||$.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,$.indexOf("Linux"),$?.indexOf("Mobi"),q=!0,V=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());q&&"function"==typeof G.importScripts&&G.origin;var Y,J=$,Z=V;(t=Y||={}).value=function(){return Z},t.isDefaultVariant=function(){return 2===Z.length?"en"===Z:Z.length>=3&&"e"===Z[0]&&"n"===Z[1]&&"-"===Z[2]},t.isDefault=function(){return"en"===Z};var Q="function"==typeof G.postMessage&&!G.importScripts,ee=(()=>{if(Q){let e=[];G.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let r=e[i];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(i,1),r.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),G.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})(),et=!!(J&&J.indexOf("Chrome")>=0);function ei(e,t=0,i){let r=setTimeout(()=>{e(),i&&s.dispose()},t),s=S(()=>{clearTimeout(r),i?.deleteAndLeak(s)});return i?.add(s),s}J&&J.indexOf("Firefox"),!et&&J&&J.indexOf("Safari"),J&&J.indexOf("Edg/"),J&&J.indexOf("Android"),Symbol("MicrotaskDelay"),(i=r||={}).settled=async function(e){let t,i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if("u">typeof t)throw t;return i},i.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(e){i(e)}})};var er=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let i of t)e.emitOne(i)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new W,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await T.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new e(async e=>{for await(let r of t)e.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async e=>{for await(let r of t)i(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};er.EMPTY=er.fromArray([]);var es=class extends b{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new y),this._linesCacheDisposables=this._register(new y),this._register(S(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=m(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=ei(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let i=[],r=[0],s=this._terminal.buffer.active.getLine(e);for(;s;){let n=this._terminal.buffer.active.getLine(e+1),o=!!n&&n.isWrapped,a=s.translateToString(!o&&t);if(o&&n){let e=s.getCell(s.length-1);e&&0===e.getCode()&&1===e.getWidth()&&n.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(i.push(a),o)r.push(r[r.length-1]+a.length);else break;e++,s=n}return[i.join(""),r]}},en=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return!this._lastSearchOptions||!!e&&(this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord)}shouldUpdateHighlighting(e,t){return!!t?.decorations&&(void 0===this._cachedSearchTerm||e!==this._cachedSearchTerm||this.didOptionsChange(t))}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},eo=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,r){if(!e||0===e.length)return void this._terminal.clearSelection();if(i>this._terminal.cols)throw Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let s={startRow:t,startCol:i},n=this._findInLine(e,s,r);if(!n)for(let i=t+1;i<this._terminal.buffer.active.baseY+this._terminal.rows&&(s.startRow=i,s.startCol=0,!(n=this._findInLine(e,s,r)));i++);return n}findNextWithSelection(e,t,i){if(!e||0===e.length)return void this._terminal.clearSelection();let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=0,n=0;r&&(i===e?(s=r.end.x,n=r.end.y):(s=r.start.x,n=r.start.y)),this._lineCache.initLinesCache();let o={startRow:n,startCol:s},a=this._findInLine(e,o,t);if(!a)for(let i=n+1;i<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=i,o.startCol=0,!(a=this._findInLine(e,o,t)));i++);if(!a&&0!==n)for(let i=0;i<n&&(o.startRow=i,o.startCol=0,!(a=this._findInLine(e,o,t)));i++);return!a&&r&&(o.startRow=r.start.y,o.startCol=0,a=this._findInLine(e,o,t)),a}findPreviousWithSelection(e,t,i){if(!e||0===e.length)return void this._terminal.clearSelection();let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=this._terminal.buffer.active.baseY+this._terminal.rows-1,n=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:s,startCol:n},a;if(r&&(o.startRow=s=r.start.y,o.startCol=n=r.start.x,i!==e&&((a=this._findInLine(e,o,t,!1))||(o.startRow=s=r.end.y,o.startCol=n=r.end.x))),a||(a=this._findInLine(e,o,t,!0)),!a){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let i=s-1;i>=0&&(o.startRow=i,!(a=this._findInLine(e,o,t,!0)));i--);}if(!a&&s!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let i=this._terminal.buffer.active.baseY+this._terminal.rows-1;i>=s&&(o.startRow=i,!(a=this._findInLine(e,o,t,!0)));i--);return a}_isWholeWord(e,t,i){return(0===e||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},r=!1){let s=t.startRow,n=t.startCol;if(this._terminal.buffer.active.getLine(s)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let o=this._lineCache.getLineFromCache(s);o||(o=this._lineCache.translateBufferLineToStringWithWrap(s,!0),this._lineCache.setLineInCache(s,o));let[a,h]=o,l=this._bufferColsToStringOffset(s,n),c=e,d=a;i.regex||(c=i.caseSensitive?e:e.toLowerCase(),d=i.caseSensitive?a:a.toLowerCase());let _=-1;if(i.regex){let t=RegExp(c,i.caseSensitive?"g":"gi"),s;if(r)for(;s=t.exec(d.slice(0,l));)_=t.lastIndex-s[0].length,e=s[0],t.lastIndex-=e.length-1;else(s=t.exec(d.slice(l)))&&s[0].length>0&&(_=l+(t.lastIndex-s[0].length),e=s[0])}else r?l-c.length>=0&&(_=d.lastIndexOf(c,l-c.length)):_=d.indexOf(c,l);if(_>=0){if(i.wholeWord&&!this._isWholeWord(_,d,e))return;let t=0;for(;t<h.length-1&&_>=h[t+1];)t++;let r=t;for(;r<h.length-1&&_+e.length>=h[r+1];)r++;let n=_-h[t],o=_+e.length-h[r],a=this._stringLengthToBufferSize(s+t,n),l=this._stringLengthToBufferSize(s+r,o)-a+this._terminal.cols*(r-t);return{term:e,col:a,row:s+t,size:l}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let e=0;e<t;e++){let r=i.getCell(e);if(!r)break;let s=r.getChars();s.length>1&&(t-=s.length-1);let n=i.getCell(e+1);n&&0===n.getWidth()&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,r=0,s=this._terminal.buffer.active.getLine(i);for(;t>0&&s;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=s.getCell(e);if(!t)break;t.getWidth()&&(r+=0===t.getCode()?1:t.getChars().length)}if(i++,(s=this._terminal.buffer.active.getLine(i))&&!s.isWrapped)break;t-=this._terminal.cols}return r}},ea=class extends b{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(S(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){for(let i of(this.clearHighlightDecorations(),e)){let e=this._createResultDecorations(i,t,!1);if(e)for(let t of e)this._storeDecoration(t,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){g(i)}}}clearHighlightDecorations(){g(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let r=[],s=e.col,n=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;n>0;){let e=Math.min(this._terminal.cols-s,n);r.push([o,s,e]),s=0,n-=e,o++}let a=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),s=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(s){let e=[];e.push(r),e.push(s.onRender(e=>this._applyStyles(e,i?t.activeMatchBorder:t.matchBorder,!1))),e.push(s.onDispose(()=>g(e))),a.push(s)}}return 0===a.length?void 0:a}},eh=class extends b{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new W)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.size===e.size)return t}return -1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},el=class extends b{constructor(e){super(),this._highlightTimeout=this._register(new y),this._lineCache=this._register(new y),this._state=new en,this._resultTracker=this._register(new eh),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new es(e),this._engine=new eo(e,this._lineCache.value),this._decorationManager=new ea(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(S(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=ei(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,i){if(!this._terminal||!this._engine)throw Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e))return void this.clearDecorations();this.clearDecorations(!0);let i=[],r,s=this._engine.find(e,0,0,t);for(;s&&(r?.row!==s.row||r?.col!==s.col)&&!(i.length>=this._highlightLimit);)r=s,i.push(r),s=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(i,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(i,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,i?.noScroll)}findPrevious(e,t,i){if(!this._terminal||!this._engine)throw Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,i?.noScroll)}_selectResult(e,t,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let i=this._decorationManager.createActiveDecoration(e,t);i&&(this._resultTracker.selectedDecoration=i)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}};e.s(["default",0,function({sessionId:e,height:t="400px",wsPort:i=3001}){let r=(0,n.useRef)(null),h=(0,n.useRef)(null),l=(0,n.useRef)(null),c=(0,n.useRef)(null),[d,_]=(0,n.useState)(!1),[u,f]=(0,n.useState)(0),v=(0,n.useRef)(!1),p=(0,n.useRef)([]),[g,m]=(0,n.useState)(!1),[S,C]=(0,n.useState)(""),[b,y]=(0,n.useState)(!1),w=(0,n.useRef)(null);(0,n.useEffect)(()=>{g&&c.current&&(c.current.focus(),c.current.select())},[g]);let E=()=>{w.current&&S&&w.current.findNext(S,{caseSensitive:b,incremental:!1})},x=()=>{w.current&&S&&w.current.findPrevious(S,{caseSensitive:b,incremental:!1})};(0,n.useEffect)(()=>{w.current&&S&&w.current.findNext(S,{caseSensitive:b,incremental:!0})},[S,b]);(0,n.useEffect)(()=>{if(_(!1),v.current=!1,p.current=[],f(0),m(!1),C(""),!r.current)return;let t=!1,s=new o.Terminal({cursorBlink:!0,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,lineHeight:1.2,scrollback:5e3,theme:{background:"#05070a",foreground:"#c9d1d9",cursor:"#a855f7",black:"#000000",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#ffffff"}}),n=new a.FitAddon;s.loadAddon(n);let c=new el;s.loadAddon(c),w.current=c,s.open(r.current),s.focus(),s.attachCustomKeyEventHandler(e=>!e.ctrlKey||"f"!==e.key||"keydown"!==e.type||(e.preventDefault(),m(!0),!1));try{let e=s._core;if(e){for(let t of[e.viewport,e._viewport,s.viewport,s._viewport].filter(Boolean)){let e=t._innerRefresh;if(e&&!t._innerRefresh.__patched){let i=function(...t){try{return e.apply(this,t)}catch(e){console.warn("Suppressed xterm viewport refresh error during unmount:",e)}};i.__patched=!0,t._innerRefresh=i}}for(let t of[e._renderService,e.renderService,s._renderService,s.renderService].filter(Boolean))t&&!t.__dimensionsPatched&&(t.__dimensionsPatched=!0,Object.defineProperty(t,"dimensions",{get(){try{if(this._renderer&&this._renderer.value)return this._renderer.value.dimensions}catch{}return{device:{cell:{width:0,height:0},canvas:{width:0,height:0}},css:{cell:{width:0,height:0},canvas:{width:0,height:0}}}},configurable:!0}))}}catch(e){console.warn("Failed to apply xterm monkeypatch:",e)}let d=setTimeout(()=>{if(!t)try{r.current&&r.current.clientWidth>0&&r.current.clientHeight>0&&n.fit()}catch(e){console.warn("Failed to fit terminal on mount",e)}},100);h.current=s;let u="https:"===window.location.protocol?"wss:":"ws:",g=new WebSocket(`${u}//${window.location.hostname}:${i}`);l.current=g,g.onopen=()=>{t||(s.write("\r\n\x1b[1;36m[System] Console bridge connected to gateway WebSocket...\x1b[0m\r\n"),g.send(JSON.stringify({type:"handshake",sessionId:e})),g.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})),s.focus())},g.onmessage=e=>{if(!t)try{let t=JSON.parse(e.data);"handshake-ack"===t.type?(s.clear(),t.history&&s.write(t.history),s.focus()):"output"===t.type?v.current?(p.current.push({type:"output",data:t.data}),f(p.current.length)):s.write(t.data):"error"===t.type&&(v.current?(p.current.push({type:"error",message:t.message}),f(p.current.length)):s.write(`\r
11
+ `).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);B.register(n,t?.[2]??e,n)}return n},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(-1===i)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let r=this._deliveryQueue.current===this;if(2*this._size<=t.length){let e=0;for(let i=0;i<t.length;i++)t[i]?t[e++]=t[i]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||c;try{e.value(t)}catch(e){i(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof F)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},N=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},U=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});(j=M||={}).isCancellationToken=function(e){return e===j.None||e===j.Cancelled||e instanceof K||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},j.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:T.None}),j.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:U});var j,$,z,K=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?U:(this._emitter||(this._emitter=new W),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},q=!1,V="en",G=globalThis;"u">typeof G.vscode&&"u">typeof G.vscode.process?z=G.vscode.process:"u">typeof h.default&&"string"==typeof h.default?.versions?.node&&(z=h.default);var X="string"==typeof z?.versions?.electron&&z?.type==="renderer";if("object"==typeof z){z.platform,z.platform,"linux"===z.platform&&z.env.SNAP&&z.env.SNAP_REVISION,z.env.CI||z.env.BUILD_ARTIFACTSTAGINGDIRECTORY,V="en";let e=z.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,V=t.resolvedLanguage||"en",t.languagePack?.translationsConfigFile}catch{}}else"object"!=typeof navigator||X?console.error("Unable to resolve platform."):(($=navigator.userAgent).indexOf("Windows"),$.indexOf("Macintosh"),($.indexOf("Macintosh")>=0||$.indexOf("iPad")>=0||$.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,$.indexOf("Linux"),$?.indexOf("Mobi"),q=!0,V=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());q&&"function"==typeof G.importScripts&&G.origin;var Y,J=$,Z=V;(t=Y||={}).value=function(){return Z},t.isDefaultVariant=function(){return 2===Z.length?"en"===Z:Z.length>=3&&"e"===Z[0]&&"n"===Z[1]&&"-"===Z[2]},t.isDefault=function(){return"en"===Z};var Q="function"==typeof G.postMessage&&!G.importScripts,ee=(()=>{if(Q){let e=[];G.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,r=e.length;i<r;i++){let r=e[i];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(i,1),r.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),G.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})(),et=!!(J&&J.indexOf("Chrome")>=0);function ei(e,t=0,i){let r=setTimeout(()=>{e(),i&&s.dispose()},t),s=S(()=>{clearTimeout(r),i?.deleteAndLeak(s)});return i?.add(s),s}J&&J.indexOf("Firefox"),!et&&J&&J.indexOf("Safari"),J&&J.indexOf("Edg/"),J&&J.indexOf("Android"),Symbol("MicrotaskDelay"),(i=r||={}).settled=async function(e){let t,i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if("u">typeof t)throw t;return i},i.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(e){i(e)}})};var er=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let i of t)e.emitOne(i)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new W,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await T.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new e(async e=>{for await(let r of t)e.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async e=>{for await(let r of t)i(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};er.EMPTY=er.fromArray([]);var es=class extends b{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new y),this._linesCacheDisposables=this._register(new y),this._register(S(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=m(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=ei(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let i=[],r=[0],s=this._terminal.buffer.active.getLine(e);for(;s;){let n=this._terminal.buffer.active.getLine(e+1),o=!!n&&n.isWrapped,a=s.translateToString(!o&&t);if(o&&n){let e=s.getCell(s.length-1);e&&0===e.getCode()&&1===e.getWidth()&&n.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(i.push(a),o)r.push(r[r.length-1]+a.length);else break;e++,s=n}return[i.join(""),r]}},en=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return!this._lastSearchOptions||!!e&&(this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord)}shouldUpdateHighlighting(e,t){return!!t?.decorations&&(void 0===this._cachedSearchTerm||e!==this._cachedSearchTerm||this.didOptionsChange(t))}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},eo=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,r){if(!e||0===e.length)return void this._terminal.clearSelection();if(i>this._terminal.cols)throw Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let s={startRow:t,startCol:i},n=this._findInLine(e,s,r);if(!n)for(let i=t+1;i<this._terminal.buffer.active.baseY+this._terminal.rows&&(s.startRow=i,s.startCol=0,!(n=this._findInLine(e,s,r)));i++);return n}findNextWithSelection(e,t,i){if(!e||0===e.length)return void this._terminal.clearSelection();let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=0,n=0;r&&(i===e?(s=r.end.x,n=r.end.y):(s=r.start.x,n=r.start.y)),this._lineCache.initLinesCache();let o={startRow:n,startCol:s},a=this._findInLine(e,o,t);if(!a)for(let i=n+1;i<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=i,o.startCol=0,!(a=this._findInLine(e,o,t)));i++);if(!a&&0!==n)for(let i=0;i<n&&(o.startRow=i,o.startCol=0,!(a=this._findInLine(e,o,t)));i++);return!a&&r&&(o.startRow=r.start.y,o.startCol=0,a=this._findInLine(e,o,t)),a}findPreviousWithSelection(e,t,i){if(!e||0===e.length)return void this._terminal.clearSelection();let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let s=this._terminal.buffer.active.baseY+this._terminal.rows-1,n=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:s,startCol:n},a;if(r&&(o.startRow=s=r.start.y,o.startCol=n=r.start.x,i!==e&&((a=this._findInLine(e,o,t,!1))||(o.startRow=s=r.end.y,o.startCol=n=r.end.x))),a||(a=this._findInLine(e,o,t,!0)),!a){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let i=s-1;i>=0&&(o.startRow=i,!(a=this._findInLine(e,o,t,!0)));i--);}if(!a&&s!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let i=this._terminal.buffer.active.baseY+this._terminal.rows-1;i>=s&&(o.startRow=i,!(a=this._findInLine(e,o,t,!0)));i--);return a}_isWholeWord(e,t,i){return(0===e||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},r=!1){let s=t.startRow,n=t.startCol;if(this._terminal.buffer.active.getLine(s)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let o=this._lineCache.getLineFromCache(s);o||(o=this._lineCache.translateBufferLineToStringWithWrap(s,!0),this._lineCache.setLineInCache(s,o));let[a,h]=o,l=this._bufferColsToStringOffset(s,n),c=e,d=a;i.regex||(c=i.caseSensitive?e:e.toLowerCase(),d=i.caseSensitive?a:a.toLowerCase());let _=-1;if(i.regex){let t=RegExp(c,i.caseSensitive?"g":"gi"),s;if(r)for(;s=t.exec(d.slice(0,l));)_=t.lastIndex-s[0].length,e=s[0],t.lastIndex-=e.length-1;else(s=t.exec(d.slice(l)))&&s[0].length>0&&(_=l+(t.lastIndex-s[0].length),e=s[0])}else r?l-c.length>=0&&(_=d.lastIndexOf(c,l-c.length)):_=d.indexOf(c,l);if(_>=0){if(i.wholeWord&&!this._isWholeWord(_,d,e))return;let t=0;for(;t<h.length-1&&_>=h[t+1];)t++;let r=t;for(;r<h.length-1&&_+e.length>=h[r+1];)r++;let n=_-h[t],o=_+e.length-h[r],a=this._stringLengthToBufferSize(s+t,n),l=this._stringLengthToBufferSize(s+r,o)-a+this._terminal.cols*(r-t);return{term:e,col:a,row:s+t,size:l}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let e=0;e<t;e++){let r=i.getCell(e);if(!r)break;let s=r.getChars();s.length>1&&(t-=s.length-1);let n=i.getCell(e+1);n&&0===n.getWidth()&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,r=0,s=this._terminal.buffer.active.getLine(i);for(;t>0&&s;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=s.getCell(e);if(!t)break;t.getWidth()&&(r+=0===t.getCode()?1:t.getChars().length)}if(i++,(s=this._terminal.buffer.active.getLine(i))&&!s.isWrapped)break;t-=this._terminal.cols}return r}},ea=class extends b{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(S(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){for(let i of(this.clearHighlightDecorations(),e)){let e=this._createResultDecorations(i,t,!1);if(e)for(let t of e)this._storeDecoration(t,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){g(i)}}}clearHighlightDecorations(){g(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let r=[],s=e.col,n=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;n>0;){let e=Math.min(this._terminal.cols-s,n);r.push([o,s,e]),s=0,n-=e,o++}let a=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),s=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(s){let e=[];e.push(r),e.push(s.onRender(e=>this._applyStyles(e,i?t.activeMatchBorder:t.matchBorder,!1))),e.push(s.onDispose(()=>g(e))),a.push(s)}}return 0===a.length?void 0:a}},eh=class extends b{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new W)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.size===e.size)return t}return -1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},el=class extends b{constructor(e){super(),this._highlightTimeout=this._register(new y),this._lineCache=this._register(new y),this._state=new en,this._resultTracker=this._register(new eh),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new es(e),this._engine=new eo(e,this._lineCache.value),this._decorationManager=new ea(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(S(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=ei(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,i){if(!this._terminal||!this._engine)throw Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e))return void this.clearDecorations();this.clearDecorations(!0);let i=[],r,s=this._engine.find(e,0,0,t);for(;s&&(r?.row!==s.row||r?.col!==s.col)&&!(i.length>=this._highlightLimit);)r=s,i.push(r),s=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(i,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(i,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,i?.noScroll)}findPrevious(e,t,i){if(!this._terminal||!this._engine)throw Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,i?.noScroll)}_selectResult(e,t,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let i=this._decorationManager.createActiveDecoration(e,t);i&&(this._resultTracker.selectedDecoration=i)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}};function ec(e){if(navigator.clipboard&&navigator.clipboard.writeText)return navigator.clipboard.writeText(e).catch(e=>{console.error("Failed to copy using clipboard API:",e)}),!0;try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();let i=document.execCommand("copy");return document.body.removeChild(t),i}catch(e){return console.error("Fallback copy failed:",e),!1}}e.s(["default",0,function({sessionId:e,height:t="400px",wsPort:i=9601}){let r=(0,n.useRef)(null),h=(0,n.useRef)(null),l=(0,n.useRef)(null),c=(0,n.useRef)(null),[d,_]=(0,n.useState)(!1),[u,f]=(0,n.useState)(0),v=(0,n.useRef)(!1),p=(0,n.useRef)([]),[g,m]=(0,n.useState)(!1),[S,C]=(0,n.useState)(""),[b,y]=(0,n.useState)(!1),w=(0,n.useRef)(null);(0,n.useEffect)(()=>{g&&c.current&&(c.current.focus(),c.current.select())},[g]);let E=()=>{w.current&&S&&w.current.findNext(S,{caseSensitive:b,incremental:!1})},x=()=>{w.current&&S&&w.current.findPrevious(S,{caseSensitive:b,incremental:!1})};(0,n.useEffect)(()=>{w.current&&S&&w.current.findNext(S,{caseSensitive:b,incremental:!0})},[S,b]);(0,n.useEffect)(()=>{if(_(!1),v.current=!1,p.current=[],f(0),m(!1),C(""),!r.current)return;let t=!1,s=new o.Terminal({cursorBlink:!0,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:13,lineHeight:1.2,scrollback:5e3,theme:{background:"#05070a",foreground:"#c9d1d9",cursor:"#a855f7",black:"#000000",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#ffffff"}}),n=new a.FitAddon;s.loadAddon(n);let c=new el;s.loadAddon(c),w.current=c,s.open(r.current),s.focus();let d=r.current,u=e=>{2===e.button&&s.hasSelection()&&e.stopPropagation()},g=e=>{2===e.button&&s.hasSelection()&&e.stopPropagation()},S=e=>{s.hasSelection()&&(e.preventDefault(),ec(s.getSelection()),s.clearSelection())};d&&(d.addEventListener("mousedown",u,!0),d.addEventListener("mouseup",g,!0),d.addEventListener("contextmenu",S)),s.attachCustomKeyEventHandler(e=>e.ctrlKey&&"f"===e.key&&"keydown"===e.type?(e.preventDefault(),m(!0),!1):!((e.ctrlKey||e.metaKey)&&"c"===e.key&&"keydown"===e.type&&s.hasSelection())||(ec(s.getSelection()),!1));try{let e=s._core;if(e){for(let t of[e.viewport,e._viewport,s.viewport,s._viewport].filter(Boolean)){let e=t._innerRefresh;if(e&&!t._innerRefresh.__patched){let i=function(...t){try{return e.apply(this,t)}catch(e){console.warn("Suppressed xterm viewport refresh error during unmount:",e)}};i.__patched=!0,t._innerRefresh=i}}for(let t of[e._renderService,e.renderService,s._renderService,s.renderService].filter(Boolean))t&&!t.__dimensionsPatched&&(t.__dimensionsPatched=!0,Object.defineProperty(t,"dimensions",{get(){try{if(this._renderer&&this._renderer.value)return this._renderer.value.dimensions}catch{}return{device:{cell:{width:0,height:0},canvas:{width:0,height:0}},css:{cell:{width:0,height:0},canvas:{width:0,height:0}}}},configurable:!0}))}}catch(e){console.warn("Failed to apply xterm monkeypatch:",e)}let b=setTimeout(()=>{if(!t)try{r.current&&r.current.clientWidth>0&&r.current.clientHeight>0&&n.fit()}catch(e){console.warn("Failed to fit terminal on mount",e)}},100);h.current=s;let y="https:"===window.location.protocol?"wss:":"ws:",E=new WebSocket(`${y}//${window.location.hostname}:${i}`);l.current=E,E.onopen=()=>{t||(s.write("\r\n\x1b[1;36m[System] Console bridge connected to gateway WebSocket...\x1b[0m\r\n"),E.send(JSON.stringify({type:"handshake",sessionId:e})),E.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})),s.focus())},E.onmessage=e=>{if(!t)try{let t=JSON.parse(e.data);"handshake-ack"===t.type?(s.clear(),t.history&&s.write(t.history),s.focus()):"output"===t.type?v.current?(p.current.push({type:"output",data:t.data}),f(p.current.length)):s.write(t.data):"error"===t.type&&(v.current?(p.current.push({type:"error",message:t.message}),f(p.current.length)):s.write(`\r
12
12
  \x1b[1;31m[System Error] ${t.message}\x1b[0m\r
13
- `))}catch{v.current?(p.current.push({type:"raw",data:e.data}),f(p.current.length)):s.write(e.data)}},g.onclose=()=>{t||s.write("\r\n\x1b[1;31m[System] Connection closed. Terminal session ended.\x1b[0m\r\n")},s.onData(e=>{t||g.readyState===WebSocket.OPEN&&g.send(JSON.stringify({type:"input",data:e}))}),s.onResize(({cols:e,rows:i})=>{t||g.readyState===WebSocket.OPEN&&g.send(JSON.stringify({type:"resize",cols:e,rows:i}))});let S=new ResizeObserver(()=>{if(!t)try{r.current&&r.current.isConnected&&r.current.clientWidth>0&&r.current.clientHeight>0&&n.fit()}catch{}});return S.observe(r.current),()=>{t=!0,clearTimeout(d),S.disconnect(),g.close();try{n.dispose(),s.dispose()}catch(e){console.warn("Error disposing terminal:",e)}}},[e,i]);let k=async t=>{let i=t.clipboardData?.items;if(i)for(let r=0;r<i.length;r++){let s=i[r];if(-1!==s.type.indexOf("image")){let i=s.getAsFile();if(!i)continue;t.preventDefault();let r=new FileReader;r.onload=async t=>{let i=t.target?.result;if(i)try{h.current?.write("\r\n\x1b[1;33m[System] Uploading pasted clipboard image to workspace...\x1b[0m\r\n");let t=await fetch("/api/sessions/upload-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,base64Data:i,fileName:`pasted_image_${Date.now()}.png`})});if(t.ok){let e=await t.json();e.success&&e.path?(h.current?.write(`\x1b[1;32m[System] Saved clipboard image to ${e.path}\x1b[0m\r
13
+ `))}catch{v.current?(p.current.push({type:"raw",data:e.data}),f(p.current.length)):s.write(e.data)}},E.onclose=()=>{t||s.write("\r\n\x1b[1;31m[System] Connection closed. Terminal session ended.\x1b[0m\r\n")},s.onData(e=>{t||E.readyState===WebSocket.OPEN&&E.send(JSON.stringify({type:"input",data:e}))}),s.onResize(({cols:e,rows:i})=>{t||E.readyState===WebSocket.OPEN&&E.send(JSON.stringify({type:"resize",cols:e,rows:i}))});let x=new ResizeObserver(()=>{if(!t)try{r.current&&r.current.isConnected&&r.current.clientWidth>0&&r.current.clientHeight>0&&n.fit()}catch{}});return x.observe(r.current),()=>{t=!0,clearTimeout(b),x.disconnect(),E.close(),d&&(d.removeEventListener("mousedown",u,!0),d.removeEventListener("mouseup",g,!0),d.removeEventListener("contextmenu",S));try{n.dispose(),s.dispose()}catch(e){console.warn("Error disposing terminal:",e)}}},[e,i]);let k=async t=>{let i=t.clipboardData?.items;if(i)for(let r=0;r<i.length;r++){let s=i[r];if(-1!==s.type.indexOf("image")){let i=s.getAsFile();if(!i)continue;t.preventDefault();let r=new FileReader;r.onload=async t=>{let i=t.target?.result;if(i)try{h.current?.write("\r\n\x1b[1;33m[System] Uploading pasted clipboard image to workspace...\x1b[0m\r\n");let t=await fetch("/api/sessions/upload-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,base64Data:i,fileName:`pasted_image_${Date.now()}.png`})});if(t.ok){let e=await t.json();e.success&&e.path?(h.current?.write(`\x1b[1;32m[System] Saved clipboard image to ${e.path}\x1b[0m\r
14
14
  `),l.current&&l.current.readyState===WebSocket.OPEN&&l.current.send(JSON.stringify({type:"input",data:e.path}))):h.current?.write(`\x1b[1;31m[System Error] Failed to save image: ${e.error||"unknown"}\x1b[0m\r
15
15
  `)}else h.current?.write("\x1b[1;31m[System Error] HTTP upload failed.\x1b[0m\r\n")}catch(t){let e=t instanceof Error?t.message:String(t);h.current?.write(`\x1b[1;31m[System Error] Upload failed: ${e}\x1b[0m\r
16
16
  `)}},r.readAsDataURL(i);break}}};return(0,s.jsxs)("div",{onPaste:k,style:{width:"100%",height:t,backgroundColor:"#05070a",border:"1px solid var(--border)",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",position:"relative"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",backgroundColor:"#030406",borderBottom:"1px solid var(--border)",fontSize:"0.7rem",color:"var(--muted)",userSelect:"none"},children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,s.jsxs)("span",{children:["Session ID: ",(0,s.jsx)("strong",{style:{color:"#cbd5e1",fontFamily:"var(--font-mono)"},children:e.substring(0,8)})]}),d&&(0,s.jsxs)("span",{style:{backgroundColor:"rgba(217, 119, 82, 0.15)",color:"#e0825f",padding:"1px 6px",borderRadius:"3px",fontWeight:600,fontSize:"0.6rem",border:"1px solid rgba(217, 119, 82, 0.25)"},children:["⏸️ Scroll Paused (",u," queued)"]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.35rem",alignItems:"center"},children:[(0,s.jsx)("button",{onClick:()=>{_(e=>{let t=!e;return v.current=t,t||(()=>{let e=p.current;p.current=[],f(0);let t=h.current;if(t)for(let i of e)"output"===i.type&&i.data?t.write(i.data):"error"===i.type&&i.message?t.write(`\r