neural-loom 0.2.67 → 0.2.68

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 (69) 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/middleware-build-manifest.js +3 -3
  53. package/.next/server/pages/404.html +1 -1
  54. package/.next/server/pages/500.html +1 -1
  55. package/.next/server/server-reference-manifest.js +1 -1
  56. package/.next/server/server-reference-manifest.json +1 -1
  57. package/.next/static/chunks/09at8yg03trv8.js +4 -0
  58. package/.next/static/chunks/{15_baizhaiq8c.js → 0cbr3_t9j1ilb.js} +2 -2
  59. package/.next/static/chunks/{16rky3981raz5.js → 0fdyrz6c97v4y.js} +3 -3
  60. package/.next/trace +1 -1
  61. package/.next/trace-build +1 -1
  62. package/package.json +1 -1
  63. package/public/feature-guide.html +1443 -0
  64. package/src/app/components/MarkdownPreview.tsx +28 -1
  65. package/src/app/components/TerminalConsole.tsx +51 -1
  66. package/.next/static/chunks/0sr3d9iqny2rf.js +0 -4
  67. /package/.next/static/{oWEeFdgDSIDLRom42Fn3s → 7qXcDZENU2sMQ6EyGkMNq}/_buildManifest.js +0 -0
  68. /package/.next/static/{oWEeFdgDSIDLRom42Fn3s → 7qXcDZENU2sMQ6EyGkMNq}/_clientMiddlewareManifest.js +0 -0
  69. /package/.next/static/{oWEeFdgDSIDLRom42Fn3s → 7qXcDZENU2sMQ6EyGkMNq}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- <!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/08o_~ynkkb9ph.js"/><script src="/_next/static/chunks/140ovxvjat1ch.js" async=""></script><script src="/_next/static/chunks/07lhk_q6pmm3r.js" async=""></script><script src="/_next/static/chunks/turbopack-06zh3hgrjcphg.js" async=""></script><script src="/_next/static/chunks/0dbhjjzl8qfwv.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/08o_~ynkkb9ph.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[39756,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"default\"]\n3:I[37457,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"default\"]\n4:I[97367,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[97367,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"ViewportBoundary\"]\na:I[97367,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"MetadataBoundary\"]\nc:I[68027,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"oWEeFdgDSIDLRom42Fn3s\"}\n"])</script><script>self.__next_f.push([1,"d:[]\n7:\"$Wd\"\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\nb:[]\n"])</script></body></html>
1
+ <!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/08o_~ynkkb9ph.js"/><script src="/_next/static/chunks/140ovxvjat1ch.js" async=""></script><script src="/_next/static/chunks/07lhk_q6pmm3r.js" async=""></script><script src="/_next/static/chunks/turbopack-06zh3hgrjcphg.js" async=""></script><script src="/_next/static/chunks/0dbhjjzl8qfwv.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/08o_~ynkkb9ph.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[39756,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"default\"]\n3:I[37457,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"default\"]\n4:I[97367,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[97367,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"ViewportBoundary\"]\na:I[97367,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"MetadataBoundary\"]\nc:I[68027,[\"/_next/static/chunks/0dbhjjzl8qfwv.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"7qXcDZENU2sMQ6EyGkMNq\"}\n"])</script><script>self.__next_f.push([1,"d:[]\n7:\"$Wd\"\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\nb:[]\n"])</script></body></html>
@@ -1 +1 @@
1
- self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"ihiZo3/0FcaEoOIvY6PAh/6S62a7ZGPbH/di53fH/Rs=\"\n}"
1
+ self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"eGlivP6IKcpNNSuO/eIAxGQ3SYWcAVoUAEo3EDHg+kA=\"\n}"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "node": {},
3
3
  "edge": {},
4
- "encryptionKey": "ihiZo3/0FcaEoOIvY6PAh/6S62a7ZGPbH/di53fH/Rs="
4
+ "encryptionKey": "eGlivP6IKcpNNSuO/eIAxGQ3SYWcAVoUAEo3EDHg+kA="
5
5
  }
@@ -0,0 +1,4 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,3839,e=>{"use strict";var t=e.i(43476),r=e.i(71645),o=e.i(70703),n=e.i(5991),i=e.i(54370);function l({content:e}){let o=(0,r.useMemo)(()=>{if(!e)return[];let t=e.split("\n"),r=[],o=null;for(let e=0;e<t.length;e++){let n=t[e];if(o&&"code"===o.type){n.trim().startsWith("```")?(r.push(o),o=null):o.content.push(n);continue}if(o&&"table"===o.type)if(n.trim().startsWith("|")){o.content.push(n);continue}else r.push(o),o=null;let i=n.trim();if(i.startsWith("```")){o&&r.push(o),o={type:"code",language:i.substring(3).trim(),content:[]};continue}if(/^(\s*[-*_]\s*){3,}$/.test(i)){o&&r.push(o),r.push({type:"hr"}),o=null;continue}let l=n.match(/^(#{1,6})\s+(.*)$/);if(l){o&&r.push(o),r.push({type:"h",level:l[1].length,content:l[2]}),o=null;continue}let a=n.match(/^>\s*(.*)$/);if(a){if(o)if("blockquote"===o.type){o.content.push(a[1]);continue}else r.push(o);o={type:"blockquote",content:[a[1]]};continue}let s=n.match(/^([-*+])\s+(.*)$/);if(s){if(o)if("ul"===o.type){o.content.push(s[2]);continue}else r.push(o);o={type:"ul",content:[s[2]]};continue}let d=n.match(/^(\d+)\.\s+(.*)$/);if(d){if(o)if("ol"===o.type){o.content.push(d[2]);continue}else r.push(o);o={type:"ol",content:[d[2]]};continue}if(i.startsWith("|")){o&&r.push(o),o={type:"table",content:[n]};continue}if(""===i){o&&(r.push(o),o=null);continue}o?"p"===o.type?o.content=o.content+" "+i:(r.push(o),o={type:"p",content:i}):o={type:"p",content:i}}return o&&r.push(o),r},[e]),n=0;function i(e){return function e(r){if(!r)return[];let o=r.match(/`(.*?)`/),i=r.match(/\*\*(.*?)\*\*/),l=r.match(/\*(.*?)\*/),a=r.match(/\[(.*?)\]\((.*?)\)/),s=[o?{index:o.index,type:"code",match:o}:null,i?{index:i.index,type:"bold",match:i}:null,l?{index:l.index,type:"italic",match:l}:null,a?{index:a.index,type:"link",match:a}:null].filter(Boolean);if(0===s.length)return[r];s.sort((e,t)=>e.index-t.index);let d=s[0],c=r.substring(0,d.index),p=d.match[0],u=r.substring(d.index+p.length),m=[];c&&m.push(c);let h=`inline-${d.type}-${n++}`;return"code"===d.type?m.push((0,t.jsx)("code",{style:y,children:d.match[1]},h)):"bold"===d.type?m.push((0,t.jsx)("strong",{style:{fontWeight:700,color:"var(--foreground)"},children:e(d.match[1])},h)):"italic"===d.type?m.push((0,t.jsx)("em",{style:{fontStyle:"italic"},children:e(d.match[1])},h)):"link"===d.type&&m.push((0,t.jsx)("a",{href:d.match[2],target:"_blank",rel:"noopener noreferrer",style:b,children:e(d.match[1])},h)),[...m,...e(u)]}(e)}return(0,t.jsx)("div",{style:s,children:o.map((e,r)=>{let o=`block-${e.type}-${r}`;switch(e.type){case"h":{let r=i(e.content);switch(e.level){case 1:return(0,t.jsx)("h1",{style:c,children:r},o);case 2:return(0,t.jsx)("h2",{style:p,children:r},o);case 3:return(0,t.jsx)("h3",{style:u,children:r},o);default:return(0,t.jsx)("h4",{style:m,children:r},o)}}case"code":{let r=e.content.join("\n");return(0,t.jsx)(a,{code:r,language:e.language||""},o)}case"blockquote":return(0,t.jsx)("blockquote",{style:T,children:e.content&&e.content.map((e,r)=>(0,t.jsx)("p",{style:{margin:"0.25rem 0"},children:i(e)},r))},o);case"ul":return(0,t.jsx)("ul",{style:h,children:e.content&&e.content.map((e,r)=>(0,t.jsxs)("li",{style:f,children:[(0,t.jsx)("span",{style:{marginRight:"0.5rem",color:"var(--accent)"},children:"•"}),(0,t.jsx)("div",{style:{flex:1},children:i(e)})]},r))},o);case"ol":return(0,t.jsx)("ol",{style:g,children:e.content&&e.content.map((e,r)=>(0,t.jsxs)("li",{style:f,children:[(0,t.jsxs)("span",{style:{marginRight:"0.5rem",color:"var(--accent)",fontWeight:600},children:[r+1,"."]}),(0,t.jsx)("div",{style:{flex:1},children:i(e)})]},r))},o);case"table":return function(e,r){let o=e.map(e=>e.split("|").map(e=>e.trim()).filter((e,t,r)=>t>0&&t<r.length-1));if(0===o.length)return null;let n=o[0],l=o.slice(1).filter(e=>!e.every(e=>e.startsWith("-")||""===e));return(0,t.jsx)("div",{style:v,children:(0,t.jsxs)("table",{style:j,children:[(0,t.jsx)("thead",{children:(0,t.jsx)("tr",{children:n.map((e,r)=>(0,t.jsx)("th",{style:w,children:i(e)},r))})}),(0,t.jsx)("tbody",{children:l.map((e,r)=>(0,t.jsx)("tr",{style:r%2==0?k:C,children:e.map((e,r)=>(0,t.jsx)("td",{style:S,children:i(e)},r))},r))})]})},r)}(e.content,o);case"hr":return(0,t.jsx)("hr",{style:x},o);case"p":return(0,t.jsx)("p",{style:d,children:i(e.content)},o);default:return null}})})}function a({code:e,language:o}){let[n,i]=(0,r.useState)(!1);return(0,t.jsxs)("div",{style:z,children:[(0,t.jsxs)("div",{style:R,children:[(0,t.jsx)("span",{children:o||"code"}),(0,t.jsx)("button",{onClick:()=>{!function(e){if(navigator.clipboard&&navigator.clipboard.writeText)return navigator.clipboard.writeText(e).catch(e=>{console.error("Failed to copy using clipboard API:",e)});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(),document.execCommand("copy"),document.body.removeChild(t)}catch(e){return console.error("Fallback copy failed:",e),!1}}(e),i(!0),setTimeout(()=>i(!1),2e3)},style:W,children:n?"Copied! ✓":"Copy"})]}),(0,t.jsx)("pre",{style:I,children:(0,t.jsx)("code",{children:e})})]})}let s={fontFamily:"var(--font-sans), sans-serif",color:"var(--foreground)",lineHeight:1.6,padding:"1.5rem",overflowY:"auto",height:"100%",backgroundColor:"#080c14",borderLeft:"1px solid var(--border)"},d={fontSize:"0.875rem",marginBottom:"1rem",color:"var(--foreground-muted, #94a3b8)"},c={fontSize:"1.5rem",fontWeight:700,margin:"1.5rem 0 1rem 0",paddingBottom:"0.3rem",borderBottom:"1px solid var(--border)",color:"var(--foreground)",background:"linear-gradient(135deg, #fff 0%, #a855f7 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"},p={fontSize:"1.25rem",fontWeight:650,margin:"1.25rem 0 0.85rem 0",paddingBottom:"0.25rem",borderBottom:"1px solid var(--border)",color:"var(--foreground)"},u={fontSize:"1.05rem",fontWeight:600,margin:"1rem 0 0.75rem 0",color:"var(--foreground)"},m={fontSize:"0.925rem",fontWeight:600,margin:"0.85rem 0 0.5rem 0",color:"var(--foreground)"},h={listStyleType:"none",padding:0,margin:"0 0 1rem 0"},g={listStyleType:"none",padding:0,margin:"0 0 1rem 0"},f={display:"flex",alignItems:"flex-start",fontSize:"0.875rem",marginBottom:"0.375rem",color:"var(--foreground-muted, #94a3b8)"},x={border:"none",height:"1px",background:"linear-gradient(90deg, var(--border) 0%, rgba(255,255,255,0.05) 100%)",margin:"1.5rem 0"},y={fontFamily:"var(--font-mono), monospace",fontSize:"0.85em",backgroundColor:"rgba(255, 255, 255, 0.06)",border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"4px",padding:"0.1rem 0.3rem",color:"#f87171"},b={color:"#60a5fa",textDecoration:"underline",fontWeight:500},v={width:"100%",overflowX:"auto",margin:"1rem 0",borderRadius:"8px",border:"1px solid var(--border)",backgroundColor:"rgba(255, 255, 255, 0.01)"},j={width:"100%",borderCollapse:"collapse",fontSize:"0.85rem"},w={backgroundColor:"rgba(255, 255, 255, 0.03)",borderBottom:"2px solid var(--border)",padding:"0.5rem 0.75rem",fontWeight:700,textAlign:"left",color:"var(--foreground)"},S={borderBottom:"1px solid var(--border)",padding:"0.5rem 0.75rem",color:"var(--foreground-muted, #94a3b8)"},k={backgroundColor:"rgba(255, 255, 255, 0.01)"},C={backgroundColor:"transparent"},T={borderLeft:"4px solid #a855f7",backgroundColor:"rgba(168, 85, 247, 0.03)",padding:"0.5rem 1rem",margin:"1rem 0",borderRadius:"4px",fontStyle:"italic",color:"var(--muted)"},z={margin:"1rem 0",borderRadius:"8px",border:"1px solid var(--border)",backgroundColor:"#05070a",overflow:"hidden"},R={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.35rem 0.75rem",backgroundColor:"rgba(255, 255, 255, 0.02)",borderBottom:"1px solid var(--border)",fontSize:"0.7rem",color:"var(--muted)",textTransform:"uppercase",fontFamily:"var(--font-mono), monospace"},I={margin:0,padding:"1rem",overflowX:"auto",fontSize:"0.8rem",fontFamily:"var(--font-mono), monospace",lineHeight:1.5,color:"#e2e8f0"},W={background:"none",border:"1px solid var(--border)",borderRadius:"4px",padding:"2px 6px",color:"var(--muted)",cursor:"pointer",fontSize:"0.65rem",transition:"all 0.1s ease"};var P=e.i(66381);let L=(0,o.default)(()=>e.A(53096),{loadableGenerated:{modules:[67211]},ssr:!1}),F=e=>{let t;if(!e)return[];let r=/<<<<<<<[^]*?\r?\n([^]*?)\r?\n=======\r?\n([^]*?)\r?\n>>>>>>>.*/g,o=[],n=0;for(;null!==(t=r.exec(e));)o.push({index:n++,startIndex:t.index,endIndex:t.index+t[0].length,current:t[1],incoming:t[2],rawText:t[0]});return o},O=e=>{e.editor.defineTheme("neural-loom-dark",{base:"vs-dark",inherit:!0,rules:[{token:"",foreground:"d4d4d4"},{token:"comment",foreground:"6a9955"},{token:"keyword",foreground:"c586c0"},{token:"string",foreground:"ce9178"},{token:"number",foreground:"b5cea8"},{token:"regexp",foreground:"d16969"},{token:"type",foreground:"4ec9b0"},{token:"class",foreground:"4ec9b0"},{token:"function",foreground:"dcdcaa"}],colors:{"editor.background":"#05070a","editor.foreground":"#d4d4d4","editorLineNumber.foreground":"#5a5a5a","editorLineNumber.activeForeground":"#c084fc","editor.lineHighlightBackground":"#0f131a","editor.selectionBackground":"#264f78","editorCursor.foreground":"#c084fc"}})},B={minimap:{enabled:!0},fontSize:13,lineNumbers:"on",wordWrap:"on",automaticLayout:!0,scrollBeyondLastLine:!1,tabSize:2},D=e=>"mock"===e?"🧪":e.includes("-docker")?"🐳":e.includes("-ssh")?"🌐":"💻",E={display:"flex",width:"100%",height:"100%",flex:1,minHeight:0,backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"12px",overflow:"hidden",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.6)"},N={width:"50px",backgroundColor:"#030406",borderRight:"1px solid var(--border)",display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0"},$={display:"flex",flexDirection:"column",width:"100%",gap:"0.5rem"},M={width:"100%",height:"45px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",fontSize:"1.25rem",transition:"all 0.15s ease"},A={width:"300px",backgroundColor:"#080c14",borderRight:"1px solid var(--border)",display:"flex",flexDirection:"column",overflow:"hidden"},U={padding:"0.75rem 1rem",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(255,255,255,0.02)"},J={flex:1,overflowY:"auto",padding:"0.75rem 0"},H={padding:"0.25rem 1rem",fontSize:"0.75rem",fontWeight:700,color:"var(--muted)",display:"flex",alignItems:"center",justifyContent:"space-between",textTransform:"uppercase",letterSpacing:"0.05em"},V={fontSize:"0.6rem",backgroundColor:"rgba(59, 130, 246, 0.1)",color:"#3b82f6",padding:"0.1rem 0.3rem",borderRadius:"3px",textTransform:"none",letterSpacing:"normal"},G={fontSize:"0.75rem",fontWeight:600,color:"var(--foreground)"},K={flex:1,display:"flex",flexDirection:"column",overflow:"hidden",backgroundColor:"#0b101b"},Y={flex:1,display:"flex",flexDirection:"column",borderBottom:"1px solid var(--border)",overflow:"hidden"},_={height:"35px",backgroundColor:"#05070a",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",paddingRight:"0.75rem"},X={display:"flex",height:"100%",overflowX:"auto"},q={padding:"0 1rem",height:"100%",display:"flex",alignItems:"center",gap:"0.75rem",fontSize:"0.75rem",borderRight:"1px solid var(--border)",borderBottom:"2px solid transparent",cursor:"pointer",transition:"all 0.15s ease",maxWidth:"150px",flexShrink:0,whiteSpace:"nowrap"},Q={fontSize:"0.65rem",color:"var(--muted)",cursor:"pointer",padding:"2px"},Z={color:"var(--primary)",fontSize:"0.65rem",marginLeft:"2px"},ee={padding:"0.25rem 0.5rem",borderRadius:"4px",border:"1px solid var(--border-focus)",backgroundColor:"rgba(16, 185, 129, 0.15)",color:"var(--success)",fontSize:"0.7rem",fontWeight:600},et={flex:1,position:"relative",overflow:"hidden"},er={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--muted)",textAlign:"center",padding:"2rem"},eo={flex:1.4,backgroundColor:"#05070a",display:"flex",flexDirection:"column",overflow:"hidden"},en={padding:"0.5rem 1rem",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"rgba(255,255,255,0.01)"},ei={padding:"0.3rem 0.6rem",borderRadius:"4px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.7rem",fontWeight:600,cursor:"pointer"},el={padding:"0.3rem 0.6rem",borderRadius:"4px",border:"1px solid var(--success)",backgroundColor:"transparent",color:"var(--success)",fontSize:"0.7rem",fontWeight:600,cursor:"pointer"},ea={flex:1,overflow:"hidden"};function es({node:e,onSelect:o,onCreate:n,onRename:i,onDelete:l,isReadOnly:a=!1}){let[s,d]=(0,r.useState)(!1),[c,p]=(0,r.useState)(!1),u="directory"===e.type,m={padding:"0.25rem 0.5rem",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"0.8rem",fontFamily:"var(--font-mono), monospace",cursor:"pointer",color:"var(--foreground)",borderRadius:"4px",transition:"background 0.1s ease",userSelect:"none",backgroundColor:c?"rgba(255, 255, 255, 0.05)":"transparent",minWidth:0,width:"100%"},h={display:"flex",alignItems:"center",gap:"0.375rem",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},g={display:c?"flex":"none",alignItems:"center",gap:"0.25rem",paddingLeft:"0.5rem",flexShrink:0},f={background:"none",border:"none",padding:"2px 4px",cursor:"pointer",fontSize:"0.75rem",color:"var(--muted)",borderRadius:"3px",transition:"all 0.1s ease"},x=(e,t)=>{e.stopPropagation(),t()};return u?(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{onClick:()=>d(!s),style:m,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[(0,t.jsxs)("div",{style:h,children:[(0,t.jsx)("span",{style:{color:"#eab308"},children:s?"📂":"📁"}),(0,t.jsx)("span",{style:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name})]}),!a&&(0,t.jsxs)("div",{style:g,children:[(0,t.jsx)("button",{onClick:t=>x(t,()=>n(e.path,"file")),style:f,title:"New File inside...",onMouseEnter:e=>e.currentTarget.style.color="var(--success)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:"📄+"}),(0,t.jsx)("button",{onClick:t=>x(t,()=>n(e.path,"directory")),style:f,title:"New Folder inside...",onMouseEnter:e=>e.currentTarget.style.color="var(--success)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:"📁+"}),(0,t.jsx)("button",{onClick:t=>x(t,()=>i(e.path)),style:f,title:"Rename...",onMouseEnter:e=>e.currentTarget.style.color="var(--primary)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:"✏️"}),(0,t.jsx)("button",{onClick:t=>x(t,()=>l(e.path)),style:f,title:"Delete Folder",onMouseEnter:e=>e.currentTarget.style.color="var(--danger)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:"🗑️"})]})]}),s&&e.children&&(0,t.jsx)("div",{style:{paddingLeft:"10px",borderLeft:"1px solid rgba(255, 255, 255, 0.05)",marginLeft:"8px"},children:e.children.map(e=>(0,t.jsx)(es,{node:e,onSelect:o,onCreate:n,onRename:i,onDelete:l,isReadOnly:a},e.path))})]}):(0,t.jsxs)("div",{onClick:()=>o(e.path),style:m,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[(0,t.jsxs)("div",{style:h,children:[(0,t.jsx)("span",{style:{color:"#3b82f6"},children:"📄"}),(0,t.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name})]}),!a&&(0,t.jsxs)("div",{style:g,children:[(0,t.jsx)("button",{onClick:t=>x(t,()=>i(e.path)),style:f,title:"Rename...",onMouseEnter:e=>e.currentTarget.style.color="var(--primary)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:"✏️"}),(0,t.jsx)("button",{onClick:t=>x(t,()=>l(e.path)),style:f,title:"Delete File",onMouseEnter:e=>e.currentTarget.style.color="var(--danger)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:"🗑️"})]})]})}let ed={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,backdropFilter:"blur(4px)"},ec={width:"420px",backgroundColor:"#080c14",border:"1px solid var(--border)",borderRadius:"12px",padding:"1.5rem",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.8)"},ep={width:"100%",backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"6px",padding:"0.5rem 0.75rem",color:"#e2e8f0",fontSize:"0.85rem",outline:"none",marginBottom:"1.5rem",fontFamily:"var(--font-mono), monospace"},eu={display:"flex",justifyContent:"flex-end",gap:"0.75rem"},em={backgroundColor:"transparent",border:"1px solid var(--border)",color:"var(--foreground)",padding:"0.5rem 1rem",borderRadius:"6px",fontSize:"0.8rem",fontWeight:600,cursor:"pointer"},eh={backgroundColor:"var(--primary)",border:"none",color:"#ffffff",padding:"0.5rem 1rem",borderRadius:"6px",fontSize:"0.8rem",fontWeight:600,cursor:"pointer"},eg={background:"none",border:"none",color:"var(--muted)",cursor:"pointer",fontSize:"0.8rem",padding:"4px",borderRadius:"3px",transition:"all 0.1s ease"},ef={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0,0,0,0.5)",display:"flex",alignItems:"flex-start",justifyContent:"center",zIndex:1100,paddingTop:"5vh",backdropFilter:"blur(2px)"},ex={width:"600px",backgroundColor:"#080c14",border:"1px solid var(--border)",borderRadius:"8px",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.8)",display:"flex",flexDirection:"column",overflow:"hidden"},ey={width:"100%",backgroundColor:"#05070a",border:"none",borderBottom:"1px solid var(--border)",padding:"0.75rem 1rem",color:"#e2e8f0",fontSize:"0.9rem",outline:"none",fontFamily:"var(--font-mono), monospace"},eb={maxHeight:"300px",overflowY:"auto",padding:"0.25rem 0"},ev={display:"flex",alignItems:"center",padding:"0.5rem 1rem",cursor:"pointer",transition:"all 0.1s ease",justifyContent:"space-between"},ej={backgroundColor:"rgba(255,255,255,0.02)",border:"1px solid var(--border)",borderRadius:"6px",padding:"0.5rem 0.75rem",display:"flex",flexDirection:"column",gap:"0.25rem"},ew={fontSize:"0.6rem",color:"var(--muted)",textTransform:"uppercase"},eS={fontSize:"1.1rem",fontWeight:700,fontFamily:"var(--font-mono)"},ek={width:"100%",height:"6px",backgroundColor:"rgba(255,255,255,0.05)",borderRadius:"3px",overflow:"hidden"},eC={height:"100%",borderRadius:"3px",transition:"width 0.5s ease-out"},eT={padding:"0.35rem 1rem",borderBottom:"1px solid var(--border)",backgroundColor:"#030406",display:"flex",alignItems:"center",gap:"0.75rem",flexWrap:"nowrap",overflowX:"auto"},ez={padding:"0.15rem 0.45rem",borderRadius:"4px",border:"1px solid var(--border)",backgroundColor:"rgba(255,255,255,0.02)",color:"var(--muted)",fontSize:"0.7rem",fontFamily:"var(--font-mono)",fontWeight:600,cursor:"pointer",transition:"all 0.1s ease"},eR={backgroundColor:"#05070a",borderBottom:"1px solid var(--border)",padding:"0.25rem 0.75rem 0 0.75rem",display:"flex",alignItems:"center",justifyContent:"space-between"},eI={padding:"0.35rem 0.75rem",borderRadius:"6px 6px 0 0",border:"1px solid var(--border)",borderBottom:"none",display:"flex",alignItems:"center",gap:"0.5rem",cursor:"pointer",transition:"all 0.15s ease",flexShrink:0,whiteSpace:"nowrap"},eW={display:"flex",alignItems:"center",backgroundColor:"rgba(0, 0, 0, 0.3)",border:"1px solid var(--border)",borderRadius:"6px",padding:"2px",marginRight:"0.5rem"},eP={padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid transparent",fontSize:"0.65rem",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease",display:"flex",alignItems:"center",gap:"3px"};function eL({file:e,isStaged:o,onAction:n,onSelect:i,onIgnore:l,onDiscard:a}){let[s,d]=(0,r.useState)(!1),c="#eab308",p=o?e.indexStatus||"M":e.worktreeStatus||"M";return("??"===p||"?"===p)&&(c="#10b981"),"A"===p&&(c="#10b981"),"D"===p&&(c="#ef4444"),(0,t.jsxs)("div",{onClick:()=>i(e),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0.35rem 0.5rem",borderRadius:"4px",backgroundColor:"rgba(255,255,255,0.02)",cursor:"pointer",fontSize:"0.75rem",fontFamily:"var(--font-mono)",position:"relative"},children:[(0,t.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,marginRight:"0.5rem"},title:e.relativePath,children:e.name}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.35rem"},children:[s&&(0,t.jsxs)("div",{style:{display:"flex",gap:"0.25rem"},children:[!o&&l&&(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),l(e.relativePath)},title:"Add to .gitignore",style:{background:"none",border:"none",cursor:"pointer",fontSize:"0.65rem",color:"var(--muted)",padding:"1px 4px",borderRadius:"3px",backgroundColor:"rgba(255,255,255,0.05)"},onMouseEnter:e=>e.currentTarget.style.color="var(--danger)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:"🚫"}),!o&&a&&(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),a(e.relativePath)},title:"Discard changes",style:{background:"none",border:"none",cursor:"pointer",fontSize:"0.65rem",color:"var(--muted)",padding:"1px 4px",borderRadius:"3px",backgroundColor:"rgba(255,255,255,0.05)"},onMouseEnter:e=>e.currentTarget.style.color="var(--danger)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:"🗑️"}),(0,t.jsx)("button",{onClick:t=>{t.stopPropagation(),n(e.relativePath)},title:o?"Unstage Change":"Stage Change",style:{background:"none",border:"none",cursor:"pointer",fontSize:"0.65rem",color:"var(--muted)",padding:"1px 4px",borderRadius:"3px",backgroundColor:"rgba(255,255,255,0.05)"},onMouseEnter:e=>e.currentTarget.style.color="var(--foreground)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:o?"➖":"➕"})]}),(0,t.jsx)("span",{style:{fontSize:"0.6rem",padding:"0.1rem 0.3rem",borderRadius:"3px",backgroundColor:c+"22",color:c,fontWeight:700,width:"1.2rem",display:"inline-block",textAlign:"center"},children:p.substring(0,1)})]})]})}function eF({url:e}){let[o,n]=(0,r.useState)(e),[i,l]=(0,r.useState)(e),[a,s]=(0,r.useState)(0);(0,r.useEffect)(()=>{n(e),l(e)},[e]);let d=()=>{let e=o.trim();e&&!/^https?:\/\//i.test(e)&&(e="http://"+e),n(e),l(e)};return(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",backgroundColor:"#0b101b"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",padding:"0.5rem",backgroundColor:"#05070a",borderBottom:"1px solid var(--border)"},children:[(0,t.jsx)("button",{onClick:()=>{s(e=>e+1)},title:"Hard Reload Frame",style:{background:"none",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--muted)",cursor:"pointer",fontSize:"0.85rem",padding:"0.25rem 0.5rem",display:"flex",alignItems:"center",backgroundColor:"rgba(255,255,255,0.02)"},onMouseEnter:e=>e.currentTarget.style.color="var(--foreground)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:"🔄"}),(0,t.jsx)("input",{type:"text",value:o,onChange:e=>n(e.target.value),onKeyDown:e=>{"Enter"===e.key&&d()},style:{flex:1,backgroundColor:"#080c14",border:"1px solid var(--border)",borderRadius:"4px",padding:"0.25rem 0.75rem",color:"#ffffff",fontSize:"0.8rem",outline:"none",fontFamily:"var(--font-mono), monospace"}}),(0,t.jsx)("button",{onClick:d,title:"Go to URL",style:{background:"none",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--primary)",cursor:"pointer",fontSize:"0.8rem",padding:"0.25rem 0.5rem",display:"flex",alignItems:"center",backgroundColor:"rgba(255,255,255,0.02)"},children:"➔"}),(0,t.jsx)("button",{onClick:()=>{window.open(i,"_blank")},title:"Open in External Browser",style:{background:"none",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--muted)",cursor:"pointer",fontSize:"0.85rem",padding:"0.25rem 0.5rem",display:"flex",alignItems:"center",backgroundColor:"rgba(255,255,255,0.02)"},onMouseEnter:e=>e.currentTarget.style.color="var(--foreground)",onMouseLeave:e=>e.currentTarget.style.color="var(--muted)",children:"🌐"})]}),(0,t.jsx)("div",{style:{flex:1,position:"relative",width:"100%",height:"100%",backgroundColor:"#ffffff"},children:(0,t.jsx)("iframe",{src:i,style:{width:"100%",height:"100%",border:"none",backgroundColor:"#ffffff"},sandbox:"allow-scripts allow-same-origin allow-popups allow-forms"},a)})]})}function eO({content:e,filePath:o}){let n=e.split(/\r?\n/),{parsedLines:i,additions:l,deletions:a}=(0,r.useMemo)(()=>{let e,t,r,o;return e=0,t=0,r=0,o=0,{parsedLines:n.map(n=>{let i="normal",l=n,a=null,s=null;if(n.startsWith("diff --git")||n.startsWith("index ")||n.startsWith("--- ")||n.startsWith("+++ "))i="header";else if(n.startsWith("@@")){i="hunk";let r=n.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);r&&(e=parseInt(r[1],10),t=parseInt(r[2],10))}else n.startsWith("+")?(i="addition",l=n.substring(1),s=t++,r++):n.startsWith("-")?(i="deletion",l=n.substring(1),a=e++,o++):(i="normal",n.startsWith(" ")&&(l=n.substring(1)),e>0&&(a=e++),t>0&&(s=t++));return{type:i,content:l,oldNum:a,newNum:s,raw:n}}),additions:r,deletions:o}},[n]);return(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",backgroundColor:"#0b101b"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0.5rem 1rem",backgroundColor:"#05070a",borderBottom:"1px solid var(--border)"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,t.jsx)("span",{style:{fontSize:"1rem"},children:"📄"}),(0,t.jsx)("span",{style:{fontWeight:600,fontSize:"0.85rem",color:"var(--foreground)",fontFamily:"var(--font-mono)"},children:o})]}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",fontSize:"0.75rem"},children:[l>0&&(0,t.jsxs)("span",{style:{color:"#4ade80",backgroundColor:"rgba(74, 222, 128, 0.1)",padding:"0.15rem 0.4rem",borderRadius:"4px",fontWeight:600},children:["+",l," lines"]}),a>0&&(0,t.jsxs)("span",{style:{color:"#f87171",backgroundColor:"rgba(248, 113, 113, 0.1)",padding:"0.15rem 0.4rem",borderRadius:"4px",fontWeight:600},children:["-",a," lines"]}),(0,t.jsxs)("span",{style:{color:"var(--muted)"},children:[i.length," lines in diff"]})]})]}),(0,t.jsx)("div",{style:{flex:1,overflow:"auto",padding:"0.5rem 0"},children:(0,t.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontFamily:"var(--font-mono), monospace",fontSize:"0.8rem",lineHeight:1.5},children:(0,t.jsx)("tbody",{children:i.map((e,r)=>{if("header"===e.type)return(0,t.jsx)("tr",{style:{backgroundColor:"rgba(255,255,255,0.02)"},children:(0,t.jsx)("td",{colSpan:4,style:{color:"var(--muted)",padding:"0.25rem 1rem",fontSize:"0.75rem",borderBottom:"1px solid rgba(255,255,255,0.03)"},children:e.raw})},r);if("hunk"===e.type)return(0,t.jsxs)("tr",{style:{backgroundColor:"rgba(96, 165, 250, 0.05)"},children:[(0,t.jsx)("td",{colSpan:2,style:{width:"80px",textAlign:"center",color:"rgba(96, 165, 250, 0.6)",borderRight:"1px solid rgba(96, 165, 250, 0.15)",userSelect:"none",padding:"0.25rem 0",fontSize:"0.7rem"},children:"@@"}),(0,t.jsx)("td",{style:{width:"25px",borderRight:"1px solid rgba(255, 255, 255, 0.05)"}}),(0,t.jsx)("td",{style:{color:"#60a5fa",padding:"0.25rem 1rem",fontStyle:"italic",fontSize:"0.75rem"},children:e.raw})]},r);let o="transparent",n="var(--foreground)",i=" ",l="transparent";return"addition"===e.type?(o="rgba(74, 222, 128, 0.08)",n="#4ade80",i="+",l="rgba(74, 222, 128, 0.4)"):"deletion"===e.type&&(o="rgba(248, 113, 113, 0.08)",n="#f87171",i="-",l="rgba(248, 113, 113, 0.4)"),(0,t.jsxs)("tr",{style:{backgroundColor:o},children:[(0,t.jsx)("td",{style:{width:"40px",textAlign:"right",paddingRight:"0.75rem",color:"var(--muted)",opacity:e.oldNum?.6:.2,userSelect:"none",borderRight:"1px solid rgba(255, 255, 255, 0.05)",fontSize:"0.75rem"},children:e.oldNum||""}),(0,t.jsx)("td",{style:{width:"40px",textAlign:"right",paddingRight:"0.75rem",color:"var(--muted)",opacity:e.newNum?.6:.2,userSelect:"none",borderRight:"1px solid rgba(255, 255, 255, 0.05)",fontSize:"0.75rem"},children:e.newNum||""}),(0,t.jsx)("td",{style:{width:"25px",textAlign:"center",color:l,userSelect:"none",fontWeight:"bold",fontSize:"0.85rem",borderRight:"1px solid rgba(255, 255, 255, 0.05)"},children:i}),(0,t.jsx)("td",{style:{paddingLeft:"0.75rem",color:n,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:e.content})]},r)})})})})]})}let eB={width:"100%",minHeight:"60px",backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"6px",padding:"0.5rem",color:"#e2e8f0",fontSize:"0.75rem",resize:"vertical",outline:"none",fontFamily:"var(--font-sans), sans-serif"},eD={width:"100%",padding:"0.35rem",backgroundColor:"var(--primary)",border:"none",color:"#ffffff",borderRadius:"6px",fontSize:"0.75rem",fontWeight:600,cursor:"pointer",transition:"opacity 0.1s ease"},eE={background:"none",border:"1px solid var(--border)",borderRadius:"4px",padding:"2px 5px",cursor:"pointer",fontSize:"0.7rem",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.02)"},eN={background:"none",border:"none",cursor:"pointer",fontSize:"0.65rem",color:"var(--muted)",padding:"2px 4px",borderRadius:"3px",display:"flex",alignItems:"center",justifyContent:"center"};e.s(["default",0,function({sessionId:e,workspaceRoot:o,scopedDirs:a,onClose:s,sessions:d,onSwitchSession:c,onRefreshSessions:p,wsPort:u=3001}){let m,h,g=JSON.stringify(a),f=d.find(t=>t.id===e),[x,y]=(0,r.useState)(null),[b,v]=(0,r.useState)([]),[j,w]=(0,r.useState)(!1),S=async t=>{try{let r=await fetch("/api/sessions/scope",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,path:t,action:"add"})});if(r.ok)p&&p();else{let e=await r.json();alert(e.error||"Failed to add scoped folder.")}}catch(e){console.error(e),alert("Network error: failed to add scoped folder.")}},k=async t=>{try{let r=await fetch("/api/sessions/scope",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,path:t,action:"remove"})});if(r.ok)p&&p();else{let e=await r.json();alert(e.error||"Failed to remove scoped folder.")}}catch(e){console.error(e),alert("Network error: failed to remove scoped folder.")}},[C,T]=(0,r.useState)({}),[z,R]=(0,r.useState)({}),I=C[e]||[],W=z[e]||null,e$=(0,r.useCallback)(t=>{T(r=>{let o=r[e]||[],n="function"==typeof t?t(o):t;return{...r,[e]:n}})},[e]),eM=(0,r.useCallback)(t=>{R(r=>({...r,[e]:t}))},[e]),[eA,eU]=(0,r.useState)("edit"),[eJ,eH]=(0,r.useState)(!0),[eV,eG]=(0,r.useState)("explorer"),[eK,eY]=(0,r.useState)(window.location.origin),[e_,eX]=(0,r.useState)(!1),[eq,eQ]=(0,r.useState)(e);(0,r.useEffect)(()=>{eQ(e)},[e]);let eZ=d.filter(t=>"shell"===t.type&&t.id.startsWith(`shell-${e}-`)),e0=async()=>{try{let t=await fetch("/api/sessions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"shell",name:`Shell ${eZ.length+1}`,workspaceRoot:o,parentSessionId:e})});if(t.ok){let e=await t.json();e.success&&e.session&&(p&&p(),eQ(e.session.id))}}catch(e){console.error("Failed to launch shell terminal:",e)}},e5=async(t,r)=>{r.stopPropagation(),eq===t&&eQ(e);try{await fetch("/api/sessions/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t,delete:!0})}),p&&p()}catch(e){console.error("Failed to delete shell:",e)}},[e1,e2]=(0,r.useState)(300),[e7,e8]=(0,r.useState)(!1),[e4,e3]=(0,r.useState)(380),[e6,e9]=(0,r.useState)(!1);(0,r.useEffect)(()=>{{let e=localStorage.getItem("neural-loom:sidebar-width");if(e){let t=parseInt(e,10);!isNaN(t)&&t>150&&t<600&&e2(t)}let t=localStorage.getItem("neural-loom:terminal-height");if(t){let e=parseInt(t,10);!isNaN(e)&&e>100&&e<window.innerHeight-150&&e3(e)}}},[]),(0,r.useEffect)(()=>{300!==e1&&localStorage.setItem("neural-loom:sidebar-width",e1.toString())},[e1]),(0,r.useEffect)(()=>{380!==e4&&localStorage.setItem("neural-loom:terminal-height",e4.toString())},[e4]);let te=(0,r.useCallback)(e=>{e.preventDefault(),e8(!0)},[]),tt=(0,r.useCallback)(e=>{e.preventDefault(),e9(!0)},[]);(0,r.useEffect)(()=>{let e=e=>{if(e7){let t=document.getElementById("loom-ide-container");if(t){let r=t.getBoundingClientRect(),o=e.clientX-r.left-50;o>150&&o<600&&e2(o)}}if(e6){let t=document.getElementById("loom-ide-container");if(t){let r=t.getBoundingClientRect(),o=r.bottom-e.clientY;o>100&&o<r.height-150&&e3(o)}}},t=()=>{e8(!1),e9(!1)};return(e7||e6)&&(window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),document.body.style.cursor=e7?"col-resize":"row-resize",document.body.style.userSelect="none"),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t),document.body.style.cursor="",document.body.style.userSelect=""}},[e7,e6]);let[tr,to]=(0,r.useState)([]),[tn,ti]=(0,r.useState)(!1),[tl,ta]=(0,r.useState)(!1),[ts,td]=(0,r.useState)(""),[tc,tp]=(0,r.useState)({ahead:0,behind:0}),[tu,tm]=(0,r.useState)(""),[th,tg]=(0,r.useState)([]),[tf,tx]=(0,r.useState)([]),[ty,tb]=(0,r.useState)(!1),[tv,tj]=(0,r.useState)(!1),[tw,tS]=(0,r.useState)(""),[tk,tC]=(0,r.useState)(!1),[tT,tz]=(0,r.useState)(null),[tR,tI]=(0,r.useState)(null),[tW,tP]=(0,r.useState)(""),[tL,tF]=(0,r.useState)([]),tO=async()=>{try{let e=await fetch("/api/telemetry");if(e.ok){let t=await e.json();t.success&&t.history&&tF(t.history)}}catch(e){console.error("Failed to fetch telemetry history:",e)}};(0,r.useEffect)(()=>{"analytics"===eV&&tO()},[eV]);let[tB,tD]=(0,r.useState)([]),[tE,tN]=(0,r.useState)(""),[t$,tM]=(0,r.useState)(""),[tA,tU]=(0,r.useState)(null),tJ=(0,r.useCallback)(async()=>{await new Promise(e=>setTimeout(e,0)),ta(!0);try{let e=await fetch(`/api/git?action=status&root=${encodeURIComponent(o)}`);if(e.ok){let t=await e.json();if(t.success&&(ti(t.isGit),to(t.files||[]),td(t.branch||""),tp({ahead:t.ahead||0,behind:t.behind||0}),t.isGit)){try{let e=await fetch(`/api/git?action=branches&root=${encodeURIComponent(o)}`);if(e.ok){let t=await e.json();t.success&&tg(t.branches||[])}}catch(e){console.error("Failed to load git branches:",e)}try{let e=await fetch(`/api/git?action=log&root=${encodeURIComponent(o)}`);if(e.ok){let t=await e.json();t.success&&tx(t.log||[])}}catch(e){console.error("Failed to load git log:",e)}}}}catch(e){console.error("Failed to load git status:",e)}finally{ta(!1)}},[o]);(0,r.useEffect)(()=>{setTimeout(()=>{tJ()},0);let e=setInterval(tJ,5e3);return()=>clearInterval(e)},[tJ]);let tH=async e=>{try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"stage",file:e,rootPath:o})})).ok&&await tJ()}catch(e){console.error(e)}},tV=async e=>{try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"ignore",file:e,rootPath:o})})).ok&&await tJ()}catch(e){console.error(e)}},tG=async e=>{if(confirm(`Are you sure you want to discard changes in "${e}"? This action cannot be undone.`))try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"discard",file:e,rootPath:o})})).ok&&await tJ()}catch(e){console.error(e)}},tK=async()=>{try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"stage",rootPath:o})})).ok&&await tJ()}catch(e){console.error(e)}},tY=async e=>{try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"unstage",file:e,rootPath:o})})).ok&&await tJ()}catch(e){console.error(e)}},t_=async()=>{try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"unstage",rootPath:o})})).ok&&await tJ()}catch(e){console.error(e)}},tX=async()=>{if(tu.trim())try{let e=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"commit",message:tu,rootPath:o})});if(e.ok)tm(""),await tJ();else{let t=await e.json();alert(t.error||"Git commit failed")}}catch(e){console.error(e)}},tq=async()=>{try{let e=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"pull",rootPath:o})});if(e.ok){let t=await e.json();alert(t.output||"Git pull completed successfully."),await tJ()}else{let t=await e.json();alert(t.error||"Git pull failed")}}catch(e){console.error(e)}},tQ=async()=>{try{let e=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"push",rootPath:o})});if(e.ok){let t=await e.json();alert(t.output||"Git push completed successfully."),await tJ()}else{let t=await e.json();alert(t.error||"Git push failed")}}catch(e){console.error(e)}},tZ=async e=>{tC(!0);try{let t=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"checkout",branchName:e,rootPath:o})}),r=await t.json();t.ok&&r.success?await tJ():alert(r.error||`Failed to checkout branch ${e}`)}catch(e){console.error(e),alert("Failed to checkout branch due to a network error.")}finally{tC(!1)}},t0=async e=>{if(e&&e.preventDefault(),tw.trim()){tC(!0);try{let e=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create_branch",branchName:tw.trim(),rootPath:o})}),t=await e.json();e.ok&&t.success?(tS(""),await tJ()):alert(t.error||`Failed to create branch ${tw}`)}catch(e){console.error(e),alert("Failed to create branch due to a network error.")}finally{tC(!1)}}},t5=async(e,t=!1)=>{if(e===ts)return void alert("Cannot delete the currently active branch.");if(confirm(t?`Are you sure you want to FORCE delete the branch "${e}"? All unmerged changes will be lost.`:`Are you sure you want to delete the branch "${e}"?`)){tC(!0);try{let r=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete_branch",branchName:e,force:t,rootPath:o})}),n=await r.json();r.ok&&n.success?await tJ():!t&&n.error&&(n.error.includes("not fully merged")||n.error.includes("not merged"))?t5(e,!0):alert(n.error||`Failed to delete branch ${e}`)}catch(e){console.error(e),alert("Failed to delete branch due to a network error.")}finally{tC(!1)}}},t1=async e=>{try{let t=await fetch(`/api/git?action=diff&file=${encodeURIComponent(e.relativePath)}&root=${encodeURIComponent(o)}`);if(t.ok){let r=await t.json();if(r.success){let t=`diff:${e.relativePath}`;I.some(e=>e.path===t)||e$(o=>[...o,{name:`Diff: ${e.name}`,path:t,content:r.diff,isModified:!1}]),eM(t)}}}catch(e){console.error(e)}};(0,r.useEffect)(()=>{let t=async()=>{try{let t=await fetch(`/api/sessions?id=${e}`);if(t.ok){let e=await t.json();tz(e)}}catch(e){console.error("Failed to fetch session status:",e)}};t();let r=setInterval(t,3e3);return()=>clearInterval(r)},[e]),(0,r.useEffect)(()=>{let t=async()=>{try{let t=await fetch(`/api/sessions/stats?id=${e}`);if(t.ok){let e=await t.json();tI(e)}}catch(e){console.error("Failed to fetch container/process stats:",e)}};t();let r=setInterval(t,3e3);return()=>clearInterval(r)},[e]),(0,r.useEffect)(()=>{let e=localStorage.getItem("neural_loom_custom_commands");if(e)try{let t=JSON.parse(e);setTimeout(()=>{tD(t)},0)}catch{}},[]);let t2=e=>{tD(e),localStorage.setItem("neural_loom_custom_commands",JSON.stringify(e))},t7=async t=>{try{await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,command:t})})}catch(e){console.error("Failed to inject command:",e)}},t8=tT?.type?.includes("aider"),[t4,t3]=(0,r.useState)({type:null,targetPath:null,inputValue:"",error:null}),[t6,t9]=(0,r.useState)(!1),[re,rt]=(0,r.useState)(""),[rr,ro]=(0,r.useState)([]),[rn,ri]=(0,r.useState)(0),rl=(0,r.useCallback)(async()=>{await new Promise(e=>setTimeout(e,0)),eX(!0);try{let e=a&&a.length>0?`&scoped=${encodeURIComponent(a.join(","))}`:"",t=await fetch(`/api/files?action=list&root=${encodeURIComponent(o)}${e}`);if(t.ok){let e=await t.json();e.success&&(y(e.workspace),v(e.scoped||[]))}}catch(e){console.error("Failed to load file explorer:",e)}finally{eX(!1)}},[o,g]);(0,r.useEffect)(()=>{rl();let e=setInterval(()=>{rl()},3e3);return()=>clearInterval(e)},[rl]);let ra=(e,t)=>{t3({type:"file"===t?"create-file":"create-folder",targetPath:e,inputValue:"",error:null})},rs=e=>{let t=e.split(/[/\\]/).pop()||"";t3({type:"rename",targetPath:e,inputValue:t,error:null})},rd=e=>{t3({type:"delete",targetPath:e,inputValue:"",error:null})},rc=async e=>{if(e&&e.preventDefault(),t4.type&&t4.targetPath){t3(e=>({...e,error:null}));try{if("create-file"===t4.type||"create-folder"===t4.type){if(!t4.inputValue.trim())return void t3(e=>({...e,error:"Name cannot be empty"}));let e=`${t4.targetPath}/${t4.inputValue.trim()}`,t="create-file"===t4.type?"file":"directory",r=await fetch("/api/files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create",path:e,type:t})});if(r.ok){let o=await r.json();o.success?(t3({type:null,targetPath:null,inputValue:"",error:null}),await rl(),"file"===t&&await ru(e)):t3(e=>({...e,error:o.error||"Failed to create item"}))}else{let e=await r.json();t3(t=>({...t,error:e.error||"Failed to create item"}))}}if("rename"===t4.type){if(!t4.inputValue.trim())return void t3(e=>({...e,error:"Name cannot be empty"}));let e=t4.targetPath.replace(/\\/g,"/"),t=e.substring(0,e.lastIndexOf("/")),r=t?`${t}/${t4.inputValue.trim()}`:t4.inputValue.trim(),o=await fetch("/api/files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",oldPath:t4.targetPath,newPath:r})});if(o.ok){let e=await o.json();e.success?(e$(e=>e.map(e=>e.path===t4.targetPath?{...e,path:r,name:t4.inputValue.trim()}:e)),W===t4.targetPath&&eM(r),t3({type:null,targetPath:null,inputValue:"",error:null}),await rl()):t3(t=>({...t,error:e.error||"Failed to rename item"}))}else{let e=await o.json();t3(t=>({...t,error:e.error||"Failed to rename item"}))}}if("delete"===t4.type){let e=await fetch("/api/files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",path:t4.targetPath})});if(e.ok){let t=await e.json();t.success?(rm(t4.targetPath),t3({type:null,targetPath:null,inputValue:"",error:null}),await rl()):t3(e=>({...e,error:t.error||"Failed to delete item"}))}else{let t=await e.json();t3(e=>({...e,error:t.error||"Failed to delete item"}))}}}catch(e){console.error("File operation failed:",e),t3(e=>({...e,error:"An unexpected error occurred"}))}}},rp=(0,r.useCallback)(async()=>{try{let e=a&&a.length>0?`&scoped=${encodeURIComponent(a.join(","))}`:"",t=await fetch(`/api/files?action=flat_list&root=${encodeURIComponent(o)}${e}`);if(t.ok){let e=await t.json();e.success&&e.files&&ro(e.files)}}catch(e){console.error("Failed to load flat files list:",e)}},[o,g]);(0,r.useEffect)(()=>{t6&&setTimeout(()=>{rt(""),ri(0),rp()},0)},[t6,rp]);let ru=async e=>{if(I.find(t=>t.path===e))return void eM(e);try{let t=await fetch(`/api/files?action=read&path=${encodeURIComponent(e)}`);if(t.ok){let r=await t.json();if(r.success){let t={name:e.split(/[/\\]/).pop()||"Untitled",path:e,content:r.content,isModified:!1};e$([...I,t]),eM(e)}}}catch(t){console.error(`Failed to read file ${e}:`,t)}},rm=e=>{let t=I.filter(t=>t.path!==e);e$(t),W===e&&eM(t.length>0?t[t.length-1].path:null)},rh=e=>{let t=e.trim();if(!t)return;let r=`browser:${t}`;I.find(e=>e.path===r)||e$(e=>[...e,{name:`Browser: ${t.replace(/^https?:\/\//,"")}`,path:r,content:t,isModified:!1}]),eM(r)},rg=I.find(e=>e.path===W),rf=!!rg&&rg.path.toLowerCase().endsWith(".md"),rx=rf?eA:"edit",ry=tr.filter(e=>e.indexStatus&&" "!==e.indexStatus&&"?"!==e.indexStatus),rb=tr.filter(e=>e.worktreeStatus&&" "!==e.worktreeStatus||"??"===e.status),rv=e=>{W&&e$(I.map(t=>t.path===W?{...t,content:e,isModified:!0}:t))},rj=(0,r.useCallback)(async()=>{if(!(!rg||rg.path.startsWith("diff:")||rg.path.startsWith("browser:")))try{(await fetch("/api/files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"write",path:rg.path,content:rg.content})})).ok&&e$(e=>e.map(e=>e.path===W?{...e,isModified:!1}:e))}catch(e){console.error(`Failed to save file ${rg.path}:`,e)}},[rg,W,e$]);(0,r.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key&&(e.preventDefault(),rj()),(e.ctrlKey||e.metaKey)&&"p"===e.key&&(e.preventDefault(),t9(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[rj]);let rw=rr.filter(e=>e.name.toLowerCase().includes(re.toLowerCase())||e.relativePath.toLowerCase().includes(re.toLowerCase())).slice(0,10);return(0,t.jsxs)("div",{id:"loom-ide-container",style:E,children:[(0,t.jsxs)("div",{style:N,children:[(0,t.jsxs)("div",{style:$,children:[(0,t.jsx)("div",{onClick:()=>{"explorer"===eV?eH(!eJ):(eG("explorer"),eH(!0))},style:{...M,backgroundColor:"explorer"===eV&&eJ?"rgba(255,255,255,0.08)":"transparent",borderLeft:"explorer"===eV&&eJ?"2px solid var(--primary)":"2px solid transparent"},title:"File Explorer (Ctrl+P to search files)",children:"📁"}),(0,t.jsx)("div",{onClick:()=>{"git"===eV?eH(!eJ):(eG("git"),eH(!0))},style:{...M,backgroundColor:"git"===eV&&eJ?"rgba(255,255,255,0.08)":"transparent",borderLeft:"git"===eV&&eJ?"2px solid var(--primary)":"2px solid transparent"},title:"Source Control (Git Changes)",children:"🌿"}),(0,t.jsx)("div",{onClick:()=>{"analytics"===eV?eH(!eJ):(eG("analytics"),eH(!0))},style:{...M,backgroundColor:"analytics"===eV&&eJ?"rgba(255,255,255,0.08)":"transparent",borderLeft:"analytics"===eV&&eJ?"2px solid var(--primary)":"2px solid transparent"},title:"Token Usage & Cost Analytics",children:"📊"}),(0,t.jsx)("div",{onClick:()=>{"auditor"===eV?eH(!eJ):(eG("auditor"),eH(!0))},style:{...M,backgroundColor:"auditor"===eV&&eJ?"rgba(255,255,255,0.08)":"transparent",borderLeft:"auditor"===eV&&eJ?"2px solid var(--primary)":"2px solid transparent"},title:"Session Log Auditor & Search",children:"🔍"}),(0,t.jsx)("div",{onClick:()=>{"browser"===eV?eH(!eJ):(eG("browser"),eH(!0))},style:{...M,backgroundColor:"browser"===eV&&eJ?"rgba(255,255,255,0.08)":"transparent",borderLeft:"browser"===eV&&eJ?"2px solid var(--primary)":"2px solid transparent"},title:"Local Web Browser Test Preview",children:"🌐"}),(0,t.jsx)("div",{onClick:()=>{"database"===eV?eH(!eJ):(eG("database"),eH(!0))},style:{...M,backgroundColor:"database"===eV&&eJ?"rgba(255,255,255,0.08)":"transparent",borderLeft:"database"===eV&&eJ?"2px solid var(--primary)":"2px solid transparent"},title:"Database Explorer & SQL Client",children:"🗄️"})]}),(0,t.jsx)("div",{onClick:s,style:{...M,color:"var(--danger)",fontSize:"1rem"},title:"Exit Session Layout",children:"✖"})]}),eJ&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{style:{...A,width:`${e1}px`,borderRight:"none"},children:[(0,t.jsxs)("div",{style:U,children:[(0,t.jsxs)("span",{style:{fontWeight:700,fontSize:"0.75rem",textTransform:"uppercase",letterSpacing:"0.05em"},children:["explorer"===eV&&"Workspace Explorer","git"===eV&&"Source Control","analytics"===eV&&"Telemetry & Cost","auditor"===eV&&"Session Auditor","browser"===eV&&"Browser Preview","database"===eV&&"Database Explorer"]}),"explorer"===eV&&(0,t.jsxs)("div",{style:{display:"flex",gap:"0.25rem"},children:[x&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>ra(x.path,"file"),style:eg,title:"New File at Root...",children:"📄+"}),(0,t.jsx)("button",{onClick:()=>ra(x.path,"directory"),style:eg,title:"New Folder at Root...",children:"📁+"})]}),(0,t.jsx)("button",{onClick:rl,disabled:e_,style:eg,title:"Refresh tree",children:"🔄"})]}),"git"===eV&&(0,t.jsx)("button",{onClick:tJ,disabled:tl,style:eg,title:"Refresh git status",children:"🔄"})]}),(0,t.jsxs)("div",{style:J,children:["explorer"===eV&&(0,t.jsxs)(t.Fragment,{children:[x?(0,t.jsxs)("div",{style:{marginBottom:"1.5rem"},children:[(0,t.jsxs)("div",{style:H,children:["💼 ",x.name," ",(0,t.jsx)("span",{style:V,title:x.path,children:"root"})]}),(0,t.jsx)("div",{style:{padding:"0.25rem 0.5rem"},children:x.tree.map(e=>(0,t.jsx)(es,{node:e,onSelect:ru,onCreate:ra,onRename:rs,onDelete:rd,isReadOnly:!1},e.path))})]}):(0,t.jsx)("div",{style:{padding:"1rem",color:"var(--muted)",fontSize:"0.8rem"},children:"Scanning Workspace directory..."}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{...H,borderTop:"1px solid var(--border)",paddingTop:"1rem"},children:[(0,t.jsxs)("span",{children:["🔍 Scoped Folders (",b.length,")"]}),(0,t.jsx)("button",{onClick:()=>w(!0),style:eg,title:"Add Scoped Folder...",children:"➕"})]}),b.length>0?b.map(e=>(0,t.jsxs)("div",{style:{marginTop:"0.75rem",padding:"0 0.5rem"},children:[(0,t.jsxs)("div",{style:{...G,display:"flex",gap:"0.25rem",color:"#a855f7",fontSize:"0.75rem",fontWeight:700,padding:"0.25rem",justifyContent:"space-between",alignItems:"center"},title:e.path,children:[(0,t.jsxs)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:["🔗 ",e.name,"/"]}),(0,t.jsx)("button",{onClick:()=>k(e.path),style:{background:"none",border:"none",color:"var(--danger)",cursor:"pointer",fontSize:"0.75rem",padding:"0 0.25rem"},title:"Remove Scoped Folder",children:"✖"})]}),(0,t.jsx)("div",{style:{paddingLeft:"0.25rem"},children:e.tree.map(e=>(0,t.jsx)(es,{node:e,onSelect:ru,onCreate:ra,onRename:rs,onDelete:rd,isReadOnly:!0},e.path))})]},e.path)):(0,t.jsx)("div",{style:{padding:"0.5rem 1rem",color:"var(--muted)",fontSize:"0.75rem",fontStyle:"italic"},children:"No extra scoped folders. Click [+] to mount a folder."})]})]}),"git"===eV&&(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[(0,t.jsxs)("div",{style:{padding:"0.5rem 1rem",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"rgba(255,255,255,0.01)",flexShrink:0},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",fontSize:"0.75rem",fontWeight:600,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1},children:[(0,t.jsx)("span",{style:{color:"var(--primary)",flexShrink:0},children:"🌿"}),(0,t.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:ts,children:tn?ts||"HEAD detached":"No Repository"})]}),tn&&(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.35rem",flexShrink:0},children:[tc.ahead>0&&(0,t.jsxs)("span",{style:{fontSize:"0.65rem",color:"#10b981",fontWeight:700},title:"Commits ahead of remote",children:["↑",tc.ahead]}),tc.behind>0&&(0,t.jsxs)("span",{style:{fontSize:"0.65rem",color:"#ef4444",fontWeight:700},title:"Commits behind remote",children:["↓",tc.behind]}),(0,t.jsx)("button",{onClick:tq,title:"Pull changes",style:eE,onMouseEnter:e=>e.currentTarget.style.backgroundColor="rgba(255,255,255,0.08)",onMouseLeave:e=>e.currentTarget.style.backgroundColor="rgba(255,255,255,0.02)",children:"📥"}),(0,t.jsx)("button",{onClick:tQ,title:"Push commits",style:eE,onMouseEnter:e=>e.currentTarget.style.backgroundColor="rgba(255,255,255,0.08)",onMouseLeave:e=>e.currentTarget.style.backgroundColor="rgba(255,255,255,0.02)",children:"📤"})]})]}),tn?(0,t.jsxs)("div",{style:{flex:1,overflowY:"auto",padding:"0.5rem 1rem",display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem"},children:[(0,t.jsx)("textarea",{value:tu,onChange:e=>tm(e.target.value),placeholder:"Commit message (Ctrl+Enter to commit)...",style:eB,onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),tX())}}),(0,t.jsx)("button",{onClick:tX,disabled:0===tr.length,style:{...eD,opacity:tr.length>0?1:.5,cursor:tr.length>0?"pointer":"not-allowed"},children:"✓ Commit"})]}),ry.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.35rem"},children:[(0,t.jsxs)("span",{style:{fontSize:"0.7rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)"},children:["Staged Changes (",ry.length,")"]}),(0,t.jsx)("button",{onClick:()=>t_(),title:"Unstage All",style:eN,children:"➖"})]}),(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:ry.map(e=>(0,t.jsx)(eL,{file:e,isStaged:!0,onAction:tY,onSelect:t1},e.relativePath))})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.35rem"},children:[(0,t.jsxs)("span",{style:{fontSize:"0.7rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)"},children:["Changes (",rb.length,")"]}),rb.length>0&&(0,t.jsx)("button",{onClick:()=>tK(),title:"Stage All",style:eN,children:"➕"})]}),0===rb.length&&0===ry.length?(0,t.jsx)("div",{style:{color:"var(--success)",fontSize:"0.75rem",padding:"0.5rem 0"},children:"✔ Workspace clean."}):0===rb.length?(0,t.jsx)("div",{style:{color:"var(--muted)",fontSize:"0.7rem",fontStyle:"italic",padding:"0.25rem 0"},children:"No unstaged changes."}):(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:rb.map(e=>(0,t.jsx)(eL,{file:e,isStaged:!1,onAction:tH,onSelect:t1,onIgnore:tV,onDiscard:tG},e.relativePath))})]}),(0,t.jsxs)("div",{style:{borderTop:"1px solid var(--border)",paddingTop:"0.75rem"},children:[(0,t.jsx)("div",{onClick:()=>tb(!ty),style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",marginBottom:"0.5rem",userSelect:"none"},children:(0,t.jsxs)("span",{style:{fontSize:"0.7rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)",display:"flex",alignItems:"center",gap:"0.25rem"},children:[ty?"▼":"▶"," Branches (",th.length,")"]})}),ty&&(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,t.jsxs)("form",{onSubmit:t0,style:{display:"flex",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"text",placeholder:"New branch name...",value:tw,onChange:e=>tS(e.target.value),disabled:tk,style:{flex:1,backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"4px",padding:"0.25rem 0.5rem",color:"#ffffff",fontSize:"0.7rem",outline:"none"}}),(0,t.jsx)("button",{type:"submit",disabled:tk||!tw.trim(),style:{backgroundColor:"rgba(59, 130, 246, 0.15)",border:"1px solid #3b82f6",color:"#3b82f6",padding:"0.25rem 0.5rem",borderRadius:"4px",fontSize:"0.7rem",fontWeight:600,cursor:"pointer",opacity:!tw.trim()||tk?.5:1},children:"+ Create"})]}),(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem",maxHeight:"150px",overflowY:"auto"},children:th.map(e=>(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0.35rem 0.5rem",borderRadius:"4px",backgroundColor:e.isActive?"rgba(59, 130, 246, 0.08)":"transparent",border:e.isActive?"1px solid rgba(59, 130, 246, 0.2)":"1px solid transparent",fontSize:"0.75rem",transition:"all 0.15s ease"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.35rem",fontWeight:e.isActive?700:500,color:e.isActive?"var(--primary)":"#cbd5e1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:[(0,t.jsx)("span",{style:{fontSize:"0.7rem"},children:e.isActive?"●":"○"}),(0,t.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.name,children:e.name})]}),(0,t.jsx)("div",{style:{display:"flex",gap:"0.25rem"},children:!e.isActive&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:()=>tZ(e.name),disabled:tk,title:`Switch to ${e.name}`,style:{background:"none",border:"none",cursor:"pointer",fontSize:"0.7rem",padding:"2px 4px",color:"var(--muted)"},children:"➔"}),(0,t.jsx)("button",{type:"button",onClick:()=>t5(e.name),disabled:tk,title:`Delete ${e.name}`,style:{background:"none",border:"none",cursor:"pointer",fontSize:"0.7rem",padding:"2px 4px",color:"var(--muted)"},children:"✖"})]})})]},e.name))})]})]}),(0,t.jsxs)("div",{style:{borderTop:"1px solid var(--border)",paddingTop:"0.75rem"},children:[(0,t.jsx)("div",{onClick:()=>tj(!tv),style:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",marginBottom:"0.5rem",userSelect:"none"},children:(0,t.jsxs)("span",{style:{fontSize:"0.7rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)",display:"flex",alignItems:"center",gap:"0.25rem"},children:[tv?"▼":"▶"," Commit History"]})}),tv&&(0,t.jsx)("div",{style:{backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"6px",padding:"0.5rem",maxHeight:"220px",overflowY:"auto",overflowX:"auto"},children:0===tf.length?(0,t.jsx)("div",{style:{color:"var(--muted)",fontStyle:"italic",fontSize:"0.7rem",textAlign:"center",padding:"0.5rem"},children:"No commit history found."}):(0,t.jsx)("div",{style:{fontFamily:"var(--font-mono)",fontSize:"0.65rem",lineHeight:"1.4",whiteSpace:"pre"},children:tf.map((e,r)=>(0,t.jsxs)("div",{style:{display:"flex",padding:"2px 0",borderBottom:"1px solid rgba(255,255,255,0.01)",alignItems:"center"},children:[(0,t.jsx)("span",{style:{color:"#3b82f6",flexShrink:0,fontWeight:700},children:e.graph}),e.isCommit&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{style:{color:"#eab308",marginRight:"6px",flexShrink:0},title:"Commit Hash",children:e.hash}),(0,t.jsx)("span",{style:{flex:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:"#cbd5e1"},title:e.subject,children:e.subject}),(0,t.jsx)("span",{style:{color:"var(--muted)",fontSize:"0.55rem",marginLeft:"6px",flexShrink:0},title:`${e.author} (${e.date})`,children:e.date})]})]},r))})})]})]}):(0,t.jsx)("div",{style:{padding:"1rem",color:"var(--muted)",fontSize:"0.75rem",fontStyle:"italic"},children:"Not a git repository."})]}),"browser"===eV&&(0,t.jsxs)("div",{style:{padding:"1rem",display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{style:{fontSize:"0.7rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)",display:"block",marginBottom:"0.4rem"},children:"Url Address"}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"text",value:eK,onChange:e=>eY(e.target.value),placeholder:window.location.origin,style:{flex:1,backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"4px",padding:"0.35rem 0.5rem",color:"#ffffff",fontSize:"0.75rem",outline:"none"},onKeyDown:e=>{"Enter"===e.key&&rh(eK)}}),(0,t.jsx)("button",{onClick:()=>rh(eK),style:{backgroundColor:"var(--primary)",border:"none",color:"#ffffff",padding:"0.35rem 0.75rem",borderRadius:"4px",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},children:"Go"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{style:{fontSize:"0.7rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)",display:"block",marginBottom:"0.5rem"},children:"Quick Launch Ports"}),(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.35rem"},children:[{label:`Next.js App (${window.location.port})`,url:window.location.origin},{label:`WebSocket Gateway (${u})`,url:`http://localhost:${u}`},{label:"Vite Server (5173)",url:"http://localhost:5173"}].map((e,r)=>(0,t.jsxs)("div",{onClick:()=>{eY(e.url),rh(e.url)},style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0.5rem 0.75rem",borderRadius:"4px",backgroundColor:"rgba(255,255,255,0.02)",border:"1px solid var(--border)",cursor:"pointer",fontSize:"0.75rem",transition:"all 0.15s ease"},onMouseEnter:e=>e.currentTarget.style.backgroundColor="rgba(255,255,255,0.06)",onMouseLeave:e=>e.currentTarget.style.backgroundColor="rgba(255,255,255,0.02)",children:[(0,t.jsx)("span",{style:{color:"var(--foreground)"},children:e.label}),(0,t.jsx)("span",{style:{color:"var(--primary)",fontSize:"0.8rem"},children:"🌐➔"})]},r))})]}),(0,t.jsxs)("div",{style:{marginTop:"auto",padding:"0.5rem",borderRadius:"6px",backgroundColor:"rgba(234, 179, 8, 0.05)",border:"1px solid rgba(234, 179, 8, 0.15)",fontSize:"0.65rem",color:"var(--muted)",lineHeight:"1.4"},children:[(0,t.jsx)("span",{style:{color:"#eab308",fontWeight:700},children:"⚠️ Iframe CSP Note"}),": Some public websites (e.g. Google, GitHub) block loading inside frames via security headers. Use this tab primarily to preview and debug local development webservers."]})]}),"analytics"===eV&&(0,t.jsxs)("div",{style:{padding:"0.5rem 1rem",display:"flex",flexDirection:"column",gap:"1.25rem",maxHeight:"100%",overflowY:"auto"},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{fontSize:"0.75rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)",marginBottom:"0.5rem"},children:"Active Session Token Usage"}),(0,t.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0.5rem"},children:[(0,t.jsxs)("div",{style:ej,children:[(0,t.jsx)("div",{style:ew,children:"Input"}),(0,t.jsx)("div",{style:eS,children:(tT?.tokenUsage?.input??0).toLocaleString()})]}),(0,t.jsxs)("div",{style:ej,children:[(0,t.jsx)("div",{style:ew,children:"Output"}),(0,t.jsx)("div",{style:eS,children:(tT?.tokenUsage?.output??0).toLocaleString()})]}),(0,t.jsxs)("div",{style:{...ej,gridColumn:"span 2"},children:[(0,t.jsx)("div",{style:ew,children:"Cost"}),(0,t.jsxs)("div",{style:{...eS,color:"#10b981",fontSize:"1.25rem"},children:["$",(tT?.tokenUsage?.cost??0).toFixed(4)]})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{fontSize:"0.75rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)",marginBottom:"0.5rem"},children:"All-time Cumulative Totals"}),(0,t.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0.5rem"},children:[(0,t.jsxs)("div",{style:ej,children:[(0,t.jsx)("div",{style:ew,children:"Total Input"}),(0,t.jsx)("div",{style:eS,children:tL.reduce((e,t)=>e+(t.inputTokens||0),0).toLocaleString()})]}),(0,t.jsxs)("div",{style:ej,children:[(0,t.jsx)("div",{style:ew,children:"Total Output"}),(0,t.jsx)("div",{style:eS,children:tL.reduce((e,t)=>e+(t.outputTokens||0),0).toLocaleString()})]}),(0,t.jsxs)("div",{style:{...ej,gridColumn:"span 2"},children:[(0,t.jsx)("div",{style:ew,children:"Total Cost"}),(0,t.jsxs)("div",{style:{...eS,color:"#10b981",fontSize:"1.25rem"},children:["$",tL.reduce((e,t)=>e+(t.cost||0),0).toFixed(4)]})]})]})]}),tL.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{fontSize:"0.75rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)",marginBottom:"0.5rem"},children:"Cost & Token History Trend (Last 10 Actions)"}),(0,t.jsxs)("div",{className:"card",style:{padding:"1rem",backgroundColor:"#05070a",border:"1px solid var(--border)",display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,t.jsxs)("svg",{width:"240",height:"110",style:{overflow:"visible"},children:[(h=Math.max(...(m=tL.slice(-10)).map(e=>(e.inputTokens||0)+(e.outputTokens||0)),100),m.map((e,r)=>{let o=e.inputTokens||0,n=e.outputTokens||0,i=o/h*80,l=n/h*80,a=21*r+15,s=90-i;return(0,t.jsxs)("g",{children:[(0,t.jsx)("rect",{x:a,y:s,width:14,height:i,fill:"#a855f7",opacity:"0.85",rx:"1.5"}),(0,t.jsx)("rect",{x:a,y:s-l,width:14,height:l,fill:"#eab308",opacity:"0.9",rx:"1.5"}),(0,t.jsx)("title",{children:`${e.sessionName||e.type}
2
+ Cost: $${(e.cost||0).toFixed(4)}
3
+ Input: ${o.toLocaleString()}
4
+ Output: ${n.toLocaleString()}`})]},r)})),(0,t.jsx)("line",{x1:"10",y1:"90",x2:"230",y2:"90",stroke:"var(--border)",strokeWidth:"1"})]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"1rem",marginTop:"0.5rem",fontSize:"0.65rem"},children:[(0,t.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,t.jsx)("span",{style:{width:"8px",height:"8px",backgroundColor:"#a855f7",borderRadius:"2px"}})," Input"]}),(0,t.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,t.jsx)("span",{style:{width:"8px",height:"8px",backgroundColor:"#eab308",borderRadius:"2px"}})," Output"]})]})]})]}),tL.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{fontSize:"0.75rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)",marginBottom:"0.5rem"},children:"Cumulative Log"}),(0,t.jsx)("div",{style:{overflowX:"auto",border:"1px solid var(--border)",borderRadius:"6px",backgroundColor:"#05070a"},children:(0,t.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.7rem",textAlign:"left"},children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{style:{borderBottom:"1px solid var(--border)",backgroundColor:"rgba(255,255,255,0.02)"},children:[(0,t.jsx)("th",{style:{padding:"0.4rem 0.5rem",color:"var(--muted)"},children:"Agent"}),(0,t.jsx)("th",{style:{padding:"0.4rem 0.5rem",color:"var(--muted)"},children:"Tokens"}),(0,t.jsx)("th",{style:{padding:"0.4rem 0.5rem",color:"var(--muted)"},children:"Cost"}),(0,t.jsx)("th",{style:{padding:"0.4rem 0.5rem",color:"var(--muted)"},children:"Time"})]})}),(0,t.jsx)("tbody",{children:tL.slice(-8).reverse().map((e,r)=>(0,t.jsxs)("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.03)"},children:[(0,t.jsx)("td",{style:{padding:"0.4rem 0.5rem",fontWeight:600},children:e.sessionName?.substring(0,12)||e.type}),(0,t.jsx)("td",{style:{padding:"0.4rem 0.5rem"},children:((e.inputTokens||0)+(e.outputTokens||0)).toLocaleString()}),(0,t.jsxs)("td",{style:{padding:"0.4rem 0.5rem",color:"#10b981"},children:["$",(e.cost||0).toFixed(4)]}),(0,t.jsx)("td",{style:{padding:"0.4rem 0.5rem",color:"var(--muted)"},children:new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]},r))})]})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{fontSize:"0.75rem",fontWeight:700,textTransform:"uppercase",color:"var(--muted)",marginBottom:"0.5rem"},children:"Resource Telemetry"}),(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.7rem",marginBottom:"0.25rem"},children:[(0,t.jsx)("span",{children:"CPU Usage"}),(0,t.jsx)("span",{style:{fontWeight:600,color:"var(--primary)"},children:tR?.cpu??"0.0%"})]}),(0,t.jsx)("div",{style:ek,children:(0,t.jsx)("div",{style:{...eC,width:tR?.cpu||"0%",backgroundColor:"var(--primary)"}})})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"0.7rem",marginBottom:"0.25rem"},children:[(0,t.jsx)("span",{children:"Memory Usage"}),(0,t.jsx)("span",{style:{fontWeight:600,color:"#eab308"},children:tR?.memory??"0.0MiB"})]}),(0,t.jsx)("div",{style:ek,children:(0,t.jsx)("div",{style:{...eC,width:tR?.memoryPercent||"0%",backgroundColor:"#eab308"}})})]}),(0,t.jsx)("div",{style:{fontSize:"0.6rem",color:"var(--muted)",marginTop:"0.25rem",fontStyle:"italic"},children:tR?.type?.includes("docker")?"🐳 Docker container statistics":"💻 Local process statistics"})]})]})]}),"auditor"===eV&&(0,t.jsxs)("div",{style:{padding:"0.5rem 1rem",display:"flex",flexDirection:"column",gap:"1rem",height:"100%"},children:[(0,t.jsxs)("div",{style:{display:"flex",gap:"0.25rem"},children:[(0,t.jsx)("input",{type:"text",placeholder:"Search logs...",value:tW,onChange:e=>tP(e.target.value),style:{flex:1,backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"4px",padding:"0.25rem 0.5rem",color:"#ffffff",fontSize:"0.75rem",outline:"none"}}),(0,t.jsx)("button",{onClick:()=>{if(!tT?.logs)return;let t=new Blob([tT.logs.join("").replace(/\x1b\[[0-9;]*m/g,"")],{type:"text/plain;charset=utf-8"}),r=URL.createObjectURL(t),o=document.createElement("a");o.href=r,o.download=`session-${e}-logs.txt`,o.click(),URL.revokeObjectURL(r)},style:{backgroundColor:"rgba(59, 130, 246, 0.15)",border:"1px solid #3b82f6",color:"#3b82f6",padding:"0.25rem 0.5rem",borderRadius:"4px",fontSize:"0.7rem",fontWeight:600,cursor:"pointer"},children:"Export"})]}),(0,t.jsx)("div",{style:{height:"220px",overflowY:"auto",backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"6px",padding:"0.5rem",fontFamily:"var(--font-mono)",fontSize:"0.7rem",lineHeight:"1.4",whiteSpace:"pre-wrap",color:"#cbd5e1"},children:(()=>{if(!tT?.logs||0===tT.logs.length)return(0,t.jsx)("div",{style:{color:"var(--muted)",fontStyle:"italic",textAlign:"center"},children:"No logs captured."});let e=tT.logs.join("").replace(/\x1b\[[0-9;]*m/g,"").split(/\r?\n/),r=tW.trim()?e.filter(e=>e.toLowerCase().includes(tW.toLowerCase())):e;return 0===r.length?(0,t.jsx)("div",{style:{color:"var(--muted)",fontStyle:"italic",textAlign:"center"},children:"No matches."}):r.map((e,r)=>{if(!tW.trim())return(0,t.jsx)("div",{children:e},r);let o=e.split(RegExp(`(${tW})`,"gi"));return(0,t.jsx)("div",{children:o.map((e,r)=>e.toLowerCase()===tW.toLowerCase()?(0,t.jsx)("span",{style:{backgroundColor:"#eab308",color:"#000000",fontWeight:600},children:e},r):e)},r)})})()}),(0,t.jsxs)("div",{style:{borderTop:"1px solid var(--border)",paddingTop:"0.75rem"},children:[(0,t.jsx)("div",{style:{fontSize:"0.75rem",fontWeight:700,color:"var(--muted)",marginBottom:"0.5rem"},children:"Custom Buttons"}),(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.35rem"},children:[(0,t.jsx)("input",{type:"text",placeholder:"Button Name (e.g. /undo)",value:tE,onChange:e=>tN(e.target.value),style:{backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"4px",padding:"0.25rem 0.5rem",color:"#ffffff",fontSize:"0.7rem",outline:"none"}}),(0,t.jsx)("input",{type:"text",placeholder:"Injection Command",value:t$,onChange:e=>tM(e.target.value),style:{backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"4px",padding:"0.25rem 0.5rem",color:"#ffffff",fontSize:"0.7rem",outline:"none"}}),(0,t.jsx)("button",{onClick:()=>{tE.trim()&&t$.trim()&&(t2([...tB,{name:tE.trim(),command:t$.trim()}]),tN(""),tM(""))},style:{backgroundColor:"rgba(168, 85, 247, 0.15)",border:"1px solid #a855f7",color:"#c084fc",padding:"0.3rem",borderRadius:"4px",fontSize:"0.7rem",fontWeight:600,cursor:"pointer"},children:"+ Add Button"}),tB.length>0&&(0,t.jsx)("div",{style:{marginTop:"0.25rem",maxHeight:"60px",overflowY:"auto"},children:tB.map((e,r)=>(0,t.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.65rem",backgroundColor:"rgba(255,255,255,0.02)",padding:"0.1rem 0.25rem",borderRadius:"3px",marginTop:"0.15rem"},children:[(0,t.jsx)("span",{style:{color:"#c084fc"},children:e.name}),(0,t.jsx)("span",{onClick:()=>{t2(tB.filter((e,t)=>t!==r))},style:{color:"var(--danger)",cursor:"pointer"},children:"✖"})]},r))})]})]})]}),"database"===eV&&(0,t.jsx)(P.default,{workspaceRoot:o})]})]}),(0,t.jsx)("div",{onMouseDown:te,style:{width:"4px",cursor:"col-resize",backgroundColor:e7?"var(--primary)":"var(--border)",transition:"background-color 0.15s ease",zIndex:10,alignSelf:"stretch"},onMouseEnter:e=>{e7||(e.currentTarget.style.backgroundColor="var(--border-focus)")},onMouseLeave:e=>{e7||(e.currentTarget.style.backgroundColor="var(--border)")},title:"Drag to resize sidebar"})]}),(0,t.jsxs)("div",{style:K,children:[(0,t.jsx)("div",{style:eR,children:(0,t.jsx)("div",{style:{display:"flex",gap:"0.25rem",overflowX:"auto",minWidth:0,flex:1},children:d.map(r=>{let o=r.id===e,n="running"===r.status?"#10b981":"rgba(255,255,255,0.2)";return(0,t.jsxs)("div",{onClick:()=>{tA===r.id&&tU(null),c(r.id)},style:{...eI,backgroundColor:o?"#0b101b":"rgba(8,12,20,0.6)",borderColor:o?"var(--border-focus)":"var(--border)",color:o?"var(--foreground)":"var(--muted)"},children:[(0,t.jsx)("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:n,display:"inline-block"}}),(0,t.jsx)("span",{style:{fontSize:"0.75rem",fontWeight:o?600:500},children:r.name}),(0,t.jsx)("span",{style:{fontSize:"0.6rem",color:"var(--muted)",backgroundColor:"rgba(255,255,255,0.05)",padding:"1px 4px",borderRadius:"3px"},children:r.type.replace("claude-","").replace("aider-","")}),"running"===r.status&&r.agentState&&"shell"!==r.type&&(0,t.jsxs)("span",{style:{fontSize:"0.6rem",padding:"1px 4px",borderRadius:"3px",fontWeight:600,backgroundColor:"thinking"===r.agentState?"rgba(168, 85, 247, 0.2)":"needs-input"===r.agentState?"rgba(217, 119, 82, 0.2)":"complete"===r.agentState?"rgba(16, 185, 129, 0.2)":"rgba(255,255,255,0.05)",color:"thinking"===r.agentState?"#c084fc":"needs-input"===r.agentState?"#e0825f":"complete"===r.agentState?"#34d399":"var(--muted)",border:"thinking"===r.agentState?"1px solid rgba(168, 85, 247, 0.3)":"needs-input"===r.agentState?"1px solid rgba(217, 119, 82, 0.3)":"complete"===r.agentState?"1px solid rgba(16, 185, 129, 0.3)":"1px solid rgba(255,255,255,0.1)"},title:`Agent state: ${r.agentState}`,children:["thinking"===r.agentState&&`${D(r.type)} 💭 thinking`,"needs-input"===r.agentState&&`${D(r.type)} ⚠️ needs input`,"complete"===r.agentState&&`${D(r.type)} ✅ complete`,"idle"===r.agentState&&`${D(r.type)} 💤 idle`]})]},r.id)})})}),(0,t.jsxs)("div",{style:{...Y,borderBottom:"none"},children:[(0,t.jsxs)("div",{style:_,children:[(0,t.jsx)("div",{style:X,children:I.map(e=>(0,t.jsxs)("div",{style:{...q,backgroundColor:W===e.path?"#0b101b":"rgba(8,12,20,0.4)",borderColor:W===e.path?"var(--border-focus)":"transparent",color:W===e.path?"var(--foreground)":"var(--muted)"},onClick:()=>eM(e.path),children:[(0,t.jsxs)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.name," ",e.isModified&&(0,t.jsx)("span",{style:Z,children:"●"})]}),(0,t.jsx)("span",{onClick:t=>{t.stopPropagation(),rm(e.path)},style:Q,children:"✖"})]},e.path))}),rg&&!rg.path.startsWith("diff:")&&!rg.path.startsWith("browser:")&&(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[rf&&(0,t.jsxs)("div",{style:eW,children:[(0,t.jsx)("button",{onClick:()=>eU("edit"),style:{...eP,backgroundColor:"edit"===rx?"rgba(255,255,255,0.08)":"transparent",color:"edit"===rx?"var(--foreground)":"var(--muted)",borderColor:"edit"===rx?"var(--border-focus)":"transparent"},title:"Edit file",children:"✏️ Edit"}),(0,t.jsx)("button",{onClick:()=>eU("split"),style:{...eP,backgroundColor:"split"===rx?"rgba(255,255,255,0.08)":"transparent",color:"split"===rx?"var(--foreground)":"var(--muted)",borderColor:"split"===rx?"var(--border-focus)":"transparent"},title:"Split editor & preview",children:"🥞 Split"}),(0,t.jsx)("button",{onClick:()=>eU("preview"),style:{...eP,backgroundColor:"preview"===rx?"rgba(255,255,255,0.08)":"transparent",color:"preview"===rx?"var(--foreground)":"var(--muted)",borderColor:"preview"===rx?"var(--border-focus)":"transparent"},title:"Preview rendered document",children:"👁️ Preview"})]}),(0,t.jsx)("button",{onClick:rj,disabled:!rg.isModified,style:{...ee,opacity:rg.isModified?1:.5,cursor:rg.isModified?"pointer":"not-allowed"},children:"💾 Save (Ctrl+S)"})]})]}),(0,t.jsx)("div",{style:et,children:(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",width:"100%"},children:[rg&&F(rg.content).length>0&&(0,t.jsxs)("div",{style:{padding:"0.5rem 1rem",backgroundColor:"rgba(220, 38, 38, 0.15)",borderBottom:"1px solid var(--danger)",color:"var(--foreground)",fontSize:"0.8rem",display:"flex",flexDirection:"column",gap:"0.5rem",flexShrink:0,zIndex:20},children:[(0,t.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,t.jsxs)("span",{style:{fontWeight:600,color:"#f87171"},children:["⚠️ ",F(rg.content).length," Git Merge Conflict(s) Detected in this file!"]})}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[F(rg.content).slice(0,3).map((e,r)=>(0,t.jsxs)("div",{style:{backgroundColor:"#05070a",border:"1px solid var(--border)",borderRadius:"4px",padding:"0.4rem 0.6rem",display:"flex",flexDirection:"column",gap:"0.35rem",flex:"1 1 200px",maxWidth:"350px"},children:[(0,t.jsxs)("div",{style:{fontSize:"0.7rem",color:"var(--muted)",fontWeight:600},children:["Conflict Block #",r+1]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.25rem"},children:[(0,t.jsx)("button",{onClick:()=>{rv(rg.content.replace(e.rawText,e.current))},style:{padding:"0.2rem 0.4rem",borderRadius:"3px",backgroundColor:"var(--primary)",color:"#fff",border:"none",fontSize:"0.7rem",cursor:"pointer"},children:"Accept Current"}),(0,t.jsx)("button",{onClick:()=>{rv(rg.content.replace(e.rawText,e.incoming))},style:{padding:"0.2rem 0.4rem",borderRadius:"3px",backgroundColor:"#10b981",color:"#fff",border:"none",fontSize:"0.7rem",cursor:"pointer"},children:"Accept Incoming"}),(0,t.jsx)("button",{onClick:()=>{rv(rg.content.replace(e.rawText,e.current+"\n"+e.incoming))},style:{padding:"0.2rem 0.4rem",borderRadius:"3px",backgroundColor:"transparent",color:"var(--foreground)",border:"1px solid var(--border)",fontSize:"0.7rem",cursor:"pointer"},children:"Accept Both"})]})]},r)),F(rg.content).length>3&&(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",fontSize:"0.75rem",color:"var(--muted)"},children:["+ ",F(rg.content).length-3," more conflict blocks..."]})]})]}),(0,t.jsx)("div",{style:{flex:1,minHeight:0,position:"relative",width:"100%",height:"100%"},children:rg?rg.path.startsWith("browser:")?(0,t.jsx)(eF,{url:rg.content}):rg.path.startsWith("diff:")?(0,t.jsx)(eO,{content:rg.content,filePath:rg.path.substring(5)}):rf?"preview"===rx?(0,t.jsx)("div",{style:{height:"100%",overflow:"hidden"},children:(0,t.jsx)(l,{content:rg.content})}):"split"===rx?(0,t.jsxs)("div",{style:{display:"flex",width:"100%",height:"100%",overflow:"hidden"},children:[(0,t.jsx)("div",{style:{flex:1,height:"100%"},children:(0,t.jsx)(L,{height:"100%",language:"markdown",theme:"neural-loom-dark",value:rg.content,onChange:e=>rv(e||""),beforeMount:O,options:B,loading:(0,t.jsx)("div",{style:{padding:"1rem",color:"var(--muted)"},children:"Loading Editor..."})})}),(0,t.jsx)("div",{style:{flex:1,height:"100%",overflow:"hidden"},children:(0,t.jsx)(l,{content:rg.content})})]}):(0,t.jsx)(L,{height:"100%",language:"markdown",theme:"neural-loom-dark",value:rg.content,onChange:e=>rv(e||""),beforeMount:O,options:B,loading:(0,t.jsx)("div",{style:{padding:"1rem",color:"var(--muted)"},children:"Loading Editor..."})}):(0,t.jsx)(L,{height:"100%",language:(e=>{if(!e)return"plaintext";switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":return"javascript";case"json":return"json";case"css":return"css";case"md":return"markdown";case"html":return"html";case"sql":return"sql";case"py":return"python";case"sh":case"bash":return"shell";case"yaml":case"yml":return"yaml";default:return"plaintext"}})(rg.path),theme:"neural-loom-dark",value:rg.content,onChange:e=>rv(e||""),beforeMount:O,options:B,loading:(0,t.jsx)("div",{style:{padding:"1rem",color:"var(--muted)"},children:"Loading Editor..."})}):(0,t.jsxs)("div",{style:er,children:[(0,t.jsx)("div",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"💻"}),(0,t.jsx)("h4",{style:{margin:0,fontWeight:600},children:"NeuralLoom Workspace Editor"}),(0,t.jsx)("p",{style:{margin:"0.5rem 0 0 0",color:"var(--muted)",fontSize:"0.8rem"},children:"Select files from the left explorer panel to view and edit. Use Ctrl+S to save changes."}),(0,t.jsxs)("p",{style:{margin:"0.5rem 0 0 0",color:"var(--muted)",fontSize:"0.75rem",fontStyle:"italic"},children:["Press ",(0,t.jsx)("kbd",{style:{background:"rgba(255,255,255,0.1)",padding:"2px 4px",borderRadius:"3px"},children:"Ctrl+P"})," to search files."]})]})})]})})]}),(0,t.jsx)("div",{onMouseDown:tt,style:{height:"4px",cursor:"row-resize",backgroundColor:e6?"var(--primary)":"var(--border)",transition:"background-color 0.15s ease",zIndex:10,width:"100%"},onMouseEnter:e=>{e6||(e.currentTarget.style.backgroundColor="var(--border-focus)")},onMouseLeave:e=>{e6||(e.currentTarget.style.backgroundColor="var(--border)")},title:"Drag to resize console"}),(0,t.jsxs)("div",{style:{...eo,flex:"none",height:`${e4}px`},children:[(0,t.jsxs)("div",{style:en,children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"flex-end",gap:"0.25rem",height:"100%",overflowX:"auto",minWidth:0},children:[(0,t.jsxs)("div",{style:{padding:"0.25rem 0.75rem",backgroundColor:eq===e?"#0f131a":"transparent",border:"1px solid "+(eq===e?"var(--border-focus)":"transparent"),borderBottom:eq===e?"1px solid #0f131a":"none",borderRadius:"4px 4px 0 0",color:eq===e?"var(--foreground)":"var(--muted)",fontSize:"0.75rem",fontWeight:eq===e?600:500,cursor:"pointer",display:"flex",alignItems:"center",gap:"0.5rem",height:"100%",position:"relative",top:"1px",flexShrink:0,whiteSpace:"nowrap"},onClick:()=>eQ(e),children:["🤖 ",f?.name||"Agent PTY"]}),eZ.map(e=>(0,t.jsxs)("div",{style:{padding:"0.25rem 0.75rem",backgroundColor:eq===e.id?"#0f131a":"transparent",border:"1px solid "+(eq===e.id?"var(--border-focus)":"transparent"),borderBottom:eq===e.id?"1px solid #0f131a":"none",borderRadius:"4px 4px 0 0",color:eq===e.id?"var(--foreground)":"var(--muted)",fontSize:"0.75rem",fontWeight:eq===e.id?600:500,cursor:"pointer",display:"flex",alignItems:"center",gap:"0.5rem",height:"100%",position:"relative",top:"1px",flexShrink:0,whiteSpace:"nowrap"},onClick:()=>eQ(e.id),children:["🐚 ",e.name,(0,t.jsx)("button",{onClick:t=>e5(e.id,t),style:{background:"none",border:"none",color:"var(--danger)",fontSize:"0.7rem",cursor:"pointer",padding:"0 0.15rem",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"3px"},title:"Close terminal tab",children:"✖"})]},e.id)),(0,t.jsx)("button",{onClick:e0,style:{background:"rgba(255,255,255,0.03)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--muted)",fontSize:"0.8rem",padding:"0.1rem 0.4rem",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",marginLeft:"0.5rem",height:"20px",alignSelf:"center"},title:"Open new terminal tab",children:"+"})]}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",flexShrink:0},children:[f?.status==="stopped"&&(0,t.jsx)("button",{onClick:async()=>{try{let t=await fetch("/api/sessions/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})});if(t.ok)p&&p();else{let e=await t.json();alert(e.error||"Failed to restart session.")}}catch(e){console.error("Failed to restart session:",e),alert("Network error: failed to restart session.")}},style:{padding:"0.3rem 0.6rem",borderRadius:"4px",border:"1px solid #eab308",backgroundColor:"rgba(234, 179, 8, 0.15)",color:"#eab308",fontSize:"0.7rem",fontWeight:600,cursor:"pointer",boxShadow:"0 0 8px rgba(234, 179, 8, 0.2)"},title:"Restart the stopped session process runner",children:"⚡ Restart Session"}),(0,t.jsxs)("select",{onChange:e=>{tU(e.target.value||null)},value:tA||"",style:{backgroundColor:"#080c14",border:"1px solid var(--border)",borderRadius:"4px",padding:"0.2rem 0.5rem",color:"var(--foreground)",fontSize:"0.7rem",outline:"none",cursor:"pointer",flexShrink:0},children:[(0,t.jsx)("option",{value:"",children:"🖥️ Single Terminal"}),d.filter(t=>t.id!==e&&"running"===t.status).map(e=>(0,t.jsxs)("option",{value:e.id,children:["🖥️|🖥️ Split: ",e.name," (",e.agentState||"idle",")"]},e.id))]}),(0,t.jsx)("button",{onClick:async()=>{await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,command:"/ccc"})})},style:ei,children:"🚀 Mount Context (/ccc)"}),(0,t.jsx)("button",{onClick:async()=>{await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,command:"/ccp"})})},style:el,children:"⚡ Trigger Prompt (/ccp)"})]})]}),(0,t.jsxs)("div",{style:eT,children:[(0,t.jsx)("span",{style:{fontSize:"0.7rem",color:"var(--muted)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:700},children:"Quick Commands:"}),(0,t.jsxs)("div",{style:{display:"flex",gap:"0.35rem",flexWrap:"wrap",alignItems:"center"},children:[t8?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>t7("/undo"),style:ez,title:"Aider: undo last commit",children:"/undo"}),(0,t.jsx)("button",{onClick:()=>t7("/diff"),style:ez,title:"Aider: show git diff",children:"/diff"}),(0,t.jsx)("button",{onClick:()=>t7("/commit"),style:ez,title:"Aider: commit edits",children:"/commit"}),(0,t.jsx)("button",{onClick:()=>t7("/test"),style:ez,title:"Aider: run tests",children:"/test"}),(0,t.jsx)("button",{onClick:()=>t7("/clear"),style:ez,title:"Clear terminal screen",children:"/clear"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:()=>t7("/compact"),style:ez,title:"Claude Code: compact history",children:"/compact"}),(0,t.jsx)("button",{onClick:()=>t7("/history"),style:ez,title:"Claude Code: view history",children:"/history"}),(0,t.jsx)("button",{onClick:()=>t7("/reset"),style:ez,title:"Claude Code: reset conversation",children:"/reset"}),(0,t.jsx)("button",{onClick:()=>t7("/help"),style:ez,title:"Claude Code: show help",children:"/help"})]}),tB.map((e,r)=>(0,t.jsx)("button",{onClick:()=>t7(e.command),style:{...ez,borderColor:"rgba(168, 85, 247, 0.4)",color:"#c084fc"},title:`Inject command: ${e.command}`,children:e.name},r))]})]}),(0,t.jsxs)("div",{style:{...ea,display:"flex",width:"100%"},children:[(0,t.jsx)("div",{style:{flex:1,height:"100%",borderRight:tA?"1px solid var(--border)":"none",overflow:"hidden"},children:(0,t.jsx)(n.default,{sessionId:eq,height:"100%",wsPort:u})}),tA&&(0,t.jsxs)("div",{style:{flex:1,height:"100%",overflow:"hidden",display:"flex",flexDirection:"column"},children:[(0,t.jsxs)("div",{style:{padding:"0.25rem 0.5rem",backgroundColor:"#030406",fontSize:"0.7rem",borderBottom:"1px solid var(--border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,t.jsxs)("span",{style:{color:"#a855f7",fontWeight:600},children:["🔗 Focused PTY Connection: ",d.find(e=>e.id===tA)?.name]}),(0,t.jsx)("button",{onClick:()=>tU(null),style:{background:"none",border:"none",color:"var(--danger)",cursor:"pointer",fontSize:"0.7rem"},children:"Close Split ✖"})]}),(0,t.jsx)("div",{style:{flex:1,overflow:"hidden"},children:(0,t.jsx)(n.default,{sessionId:tA,height:"100%",wsPort:u})})]})]})]})]}),t4.type&&(0,t.jsx)("div",{style:ed,children:(0,t.jsxs)("div",{style:ec,children:[(0,t.jsxs)("h3",{style:{margin:"0 0 1rem 0",fontSize:"1rem",fontWeight:600},children:["create-file"===t4.type&&"Create New File","create-folder"===t4.type&&"Create New Folder","rename"===t4.type&&"Rename Item","delete"===t4.type&&"Confirm Deletion"]}),t4.error&&(0,t.jsxs)("div",{style:{color:"var(--danger)",fontSize:"0.8rem",marginBottom:"1rem"},children:["⚠️ ",t4.error]}),"delete"!==t4.type?(0,t.jsxs)("form",{onSubmit:rc,children:[(0,t.jsxs)("div",{style:{marginBottom:"0.5rem",fontSize:"0.75rem",color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t4.targetPath||"",children:["Target: ",t4.targetPath]}),(0,t.jsx)("input",{type:"text",value:t4.inputValue,onChange:e=>t3({...t4,inputValue:e.target.value}),style:ep,autoFocus:!0,placeholder:"rename"===t4.type?"Enter new name":"Enter name"}),(0,t.jsxs)("div",{style:eu,children:[(0,t.jsx)("button",{type:"button",onClick:()=>t3({type:null,targetPath:null,inputValue:"",error:null}),style:em,children:"Cancel"}),(0,t.jsx)("button",{type:"submit",style:eh,children:"Submit"})]})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{style:{fontSize:"0.85rem",marginBottom:"1.5rem",color:"var(--muted)",overflowWrap:"break-word"},children:["Are you sure you want to delete this item? This action is permanent.",(0,t.jsx)("div",{style:{marginTop:"0.5rem",color:"#e2e8f0",fontFamily:"var(--font-mono)",fontSize:"0.75rem",background:"rgba(255,255,255,0.05)",padding:"0.5rem",borderRadius:"4px"},children:t4.targetPath})]}),(0,t.jsxs)("div",{style:eu,children:[(0,t.jsx)("button",{type:"button",onClick:()=>t3({type:null,targetPath:null,inputValue:"",error:null}),style:em,children:"Cancel"}),(0,t.jsx)("button",{onClick:()=>rc(),style:{...eh,backgroundColor:"var(--danger)"},children:"Delete Permanently"})]})]})]})}),t6&&(0,t.jsx)("div",{style:ef,onClick:()=>t9(!1),children:(0,t.jsxs)("div",{style:ex,onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("input",{type:"text",value:re,onChange:e=>{rt(e.target.value),ri(0)},onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),ri(e=>(e+1)%Math.max(1,rw.length))):"ArrowUp"===e.key?(e.preventDefault(),ri(e=>(e-1+rw.length)%Math.max(1,rw.length))):"Enter"===e.key?(e.preventDefault(),rw[rn]&&(ru(rw[rn].path),t9(!1))):"Escape"===e.key&&(e.preventDefault(),t9(!1))},placeholder:"Search files by name or path...",style:ey,autoFocus:!0}),(0,t.jsx)("div",{style:eb,children:rw.length>0?rw.map((e,r)=>(0,t.jsxs)("div",{onClick:()=>{ru(e.path),t9(!1)},style:{...ev,backgroundColor:r===rn?"rgba(168, 85, 247, 0.15)":"transparent",borderLeft:r===rn?"3px solid var(--primary)":"3px solid transparent"},children:[(0,t.jsx)("span",{style:{fontSize:"0.85rem",fontWeight:600},children:e.name}),(0,t.jsx)("span",{style:{fontSize:"0.7rem",color:"var(--muted)",marginLeft:"0.5rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.relativePath})]},e.path)):(0,t.jsx)("div",{style:{padding:"0.75rem 1rem",color:"var(--muted)",fontSize:"0.8rem",textAlign:"center"},children:"No matching files found"})}),(0,t.jsx)("div",{style:{padding:"0.5rem 1rem",borderTop:"1px solid var(--border)",fontSize:"0.65rem",color:"var(--muted)",textAlign:"right"},children:"Use ↑↓ to navigate, Enter to select, Esc to close"})]})}),j&&(0,t.jsx)(i.default,{title:"Add Scoped Directory",initialPath:o,onClose:()=>w(!1),onSelect:e=>{S(e),w(!1)}})]})}],3839)},97722,e=>{e.n(e.i(3839))}]);
@@ -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=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();let d=r.current,u=e=>{s.hasSelection()&&(e.preventDefault(),ec(s.getSelection()))};d&&d.addEventListener("contextmenu",u),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 g=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 S="https:"===window.location.protocol?"wss:":"ws:",b=new WebSocket(`${S}//${window.location.hostname}:${i}`);l.current=b,b.onopen=()=>{t||(s.write("\r\n\x1b[1;36m[System] Console bridge connected to gateway WebSocket...\x1b[0m\r\n"),b.send(JSON.stringify({type:"handshake",sessionId:e})),b.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})),s.focus())},b.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)}},b.onclose=()=>{t||s.write("\r\n\x1b[1;31m[System] Connection closed. Terminal session ended.\x1b[0m\r\n")},s.onData(e=>{t||b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"input",data:e}))}),s.onResize(({cols:e,rows:i})=>{t||b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"resize",cols:e,rows:i}))});let y=new ResizeObserver(()=>{if(!t)try{r.current&&r.current.isConnected&&r.current.clientWidth>0&&r.current.clientHeight>0&&n.fit()}catch{}});return y.observe(r.current),()=>{t=!0,clearTimeout(g),y.disconnect(),b.close(),d&&d.removeEventListener("contextmenu",u);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