@seqyuan/annovibe 0.8.141 → 0.8.142

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +13 -13
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/react-loadable-manifest.json +11 -11
  6. package/.next/required-server-files.js +1 -1
  7. package/.next/required-server-files.json +1 -1
  8. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  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/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  20. package/.next/server/app/api/agent/runtime/route.js +1 -1
  21. package/.next/server/app/api/internal/runtime/route.js +1 -1
  22. package/.next/server/app/api/version/route.js +1 -1
  23. package/.next/server/app/index.html +1 -1
  24. package/.next/server/app/index.rsc +5 -5
  25. package/.next/server/app/index.segments/__PAGE__.segment.rsc +5 -5
  26. package/.next/server/app/index.segments/_full.segment.rsc +5 -5
  27. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  28. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  29. package/.next/server/app/login.html +1 -1
  30. package/.next/server/app/login.rsc +1 -1
  31. package/.next/server/app/login.segments/_full.segment.rsc +1 -1
  32. package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  33. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  34. package/.next/server/app/page.js +13 -13
  35. package/.next/server/app/page_client-reference-manifest.js +1 -1
  36. package/.next/server/app/smoke/page_client-reference-manifest.js +1 -1
  37. package/.next/server/app/smoke/session-stream/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/smoke/session-stream.html +1 -1
  39. package/.next/server/app/smoke/session-stream.rsc +2 -2
  40. package/.next/server/app/smoke/session-stream.segments/_full.segment.rsc +2 -2
  41. package/.next/server/app/smoke/session-stream.segments/_tree.segment.rsc +1 -1
  42. package/.next/server/app/smoke/session-stream.segments/smoke/session-stream/__PAGE__.segment.rsc +2 -2
  43. package/.next/server/app/smoke.html +2 -2
  44. package/.next/server/app/smoke.rsc +2 -2
  45. package/.next/server/app/smoke.segments/_full.segment.rsc +2 -2
  46. package/.next/server/app/smoke.segments/_tree.segment.rsc +1 -1
  47. package/.next/server/app/smoke.segments/smoke/__PAGE__.segment.rsc +2 -2
  48. package/.next/server/app-paths-manifest.json +13 -13
  49. package/.next/server/chunks/1649.js +1 -0
  50. package/.next/server/chunks/658.js +1 -1
  51. package/.next/server/chunks/8305.js +2 -2
  52. package/.next/server/middleware-build-manifest.js +1 -1
  53. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  54. package/.next/server/middleware.js +4 -4
  55. package/.next/server/next-font-manifest.js +1 -1
  56. package/.next/server/next-font-manifest.json +1 -1
  57. package/.next/server/pages/404.html +1 -1
  58. package/.next/server/pages/500.html +1 -1
  59. package/.next/server/preview-props.json +3 -3
  60. package/.next/server/server-reference-manifest.json +1 -1
  61. package/.next/static/chunks/2708.6503b5c105cc1420.js +1 -0
  62. package/.next/static/chunks/{3824-2ecb57e47009f9c4.js → 3824-6bb3afa7d2fc5f09.js} +5 -5
  63. package/.next/static/chunks/{5618-8aecfc54df369be5.js → 5618-db41ee0c172d3add.js} +1 -1
  64. package/.next/static/chunks/app/page-2e0bf200ed41d4f6.js +22 -0
  65. package/.next/static/chunks/c66d966b.4add33ed4e764123.js +1 -0
  66. package/.next/static/chunks/{webpack-36fa69ae1e15e7ce.js → webpack-19f3f7824a602f3b.js} +1 -1
  67. package/package.json +3 -3
  68. package/.next/server/chunks/7765.js +0 -1
  69. package/.next/static/chunks/2170a4aa.4301f7c49f3f0a6e.js +0 -1
  70. package/.next/static/chunks/8436.cab94b59cca0a8ff.js +0 -1
  71. package/.next/static/chunks/app/page-b56ed167d2c7978b.js +0 -22
  72. /package/.next/static/{rPVMly3awjAYAgBD6W0mU → ZpLecbnV0af9eeGcGwT88}/_buildManifest.js +0 -0
  73. /package/.next/static/{rPVMly3awjAYAgBD6W0mU → ZpLecbnV0af9eeGcGwT88}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- self.__NEXT_FONT_MANIFEST='{"pages":{},"app":{"/home/runner/work/annovibe/annovibe/app/layout":["static/media/7deddc85b7ffd1dc-s.p.woff2","static/media/ec14413c594b3356-s.p.woff2"]},"appUsingSizeAdjust":true,"pagesUsingSizeAdjust":false}';
1
+ self.__NEXT_FONT_MANIFEST='{"pages":{},"app":{"/home/runner/work/annovibe/annovibe/app/layout":["static/media/ec14413c594b3356-s.p.woff2","static/media/7deddc85b7ffd1dc-s.p.woff2"]},"appUsingSizeAdjust":true,"pagesUsingSizeAdjust":false}';
@@ -1 +1 @@
1
- {"pages":{},"app":{"/home/runner/work/annovibe/annovibe/app/layout":["static/media/7deddc85b7ffd1dc-s.p.woff2","static/media/ec14413c594b3356-s.p.woff2"]},"appUsingSizeAdjust":true,"pagesUsingSizeAdjust":false}
1
+ {"pages":{},"app":{"/home/runner/work/annovibe/annovibe/app/layout":["static/media/ec14413c594b3356-s.p.woff2","static/media/7deddc85b7ffd1dc-s.p.woff2"]},"appUsingSizeAdjust":true,"pagesUsingSizeAdjust":false}
@@ -1 +1 @@
1
- <!DOCTYPE html><html lang="en" class="__variable_9e44ca"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/7deddc85b7ffd1dc-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/_next/static/media/ec14413c594b3356-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/9bcd6051db4f8890.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/d68ecb6695873888.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-36fa69ae1e15e7ce.js"/><script src="/_next/static/chunks/4bd1b696-8cd12253b448cc13.js" async=""></script><script src="/_next/static/chunks/3794-fba3f76785a3c234.js" async=""></script><script src="/_next/static/chunks/main-app-a8a207cb34d209aa.js" async=""></script><script src="/_next/static/chunks/app/layout-31265427e43f6876.js" async=""></script><script src="/_next/static/chunks/app/error-6309e3e4cdf79d40.js" async=""></script><script src="/_next/static/chunks/app/global-error-7595c826cec2c048.js" async=""></script><meta name="robots" content="noindex"/><title>AnnoVibe</title><meta name="description" content="AI-native bioinformatics workspace by Annoroad"/><link rel="shortcut icon" href="/icon.svg" type="image/svg+xml"/><link rel="icon" href="/icon.svg" type="image/svg+xml"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><script>(self.__next_s=self.__next_s||[]).push([0,{"children":"(function(){try{var t=localStorage.getItem(\"pi-theme\");if(t===\"dark\")document.documentElement.classList.add(\"dark\")}catch(e){}})();","id":"theme-init"}])</script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body style="height:100dvh;display:flex;flex-direction:column"><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;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-36fa69ae1e15e7ce.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:\"static/chunks/app/layout-31265427e43f6876.js\"\n3:I[42593,[\"7177\",\"$2\"],\"\"]\n4:I[57121,[],\"\"]\n5:\"static/chunks/app/error-6309e3e4cdf79d40.js\"\n6:I[87460,[\"8039\",\"$5\"],\"default\"]\n7:I[74581,[],\"\"]\nb:I[90484,[],\"OutletBoundary\"]\nc:\"$Sreact.suspense\"\ne:\"ViewportBoundary\"\nf:I[90484,[],\"$e\"]\n11:\"MetadataBoundary\"\n12:I[90484,[],\"$11\"]\n14:\"static/chunks/app/global-error-7595c826cec2c048.js\"\n15:I[54690,[\"4219\",\"$14\"],\"default\"]\n:HL[\"/_next/static/media/7deddc85b7ffd1dc-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/media/ec14413c594b3356-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/css/9bcd6051db4f8890.css\",\"style\"]\n:HL[\"/_next/static/css/d68ecb6695873888.css\",\"style\"]\n9:X\na:[[\"children\",{\"s\":\"__PAGE__\",\"h\":512,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$Lb\",null,{\"children\":[\"$\",\"$c\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@d\"}]}]]}],\"p\":false,\"v\":null}}]]\n8:[[\"children\",{\"s\":\"_not-found\",\"h\":512,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L4\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],\"p\":false,\"v\":\"$9\"},\"c\":\"$Qa\"}]]\n0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"t\":{\"t\":{\"s\":\"\",\"h\":528,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/9bcd6051db4f8890.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/d68ecb6695873888.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"className\":\"__variable_9e44ca\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"$L3\",null,{\"id\":\"theme-init\",\"strategy\":\"beforeInteractive\",\"children\":\"(function(){try{var t=localStorage.getItem(\\\"pi-theme\\\");if(t===\\\"dark\\\")document.documentElement.classList.add(\\\"dark\\\")}catch(e){}})();\"}]}],[\"$\",\"body\",null,{\"style\":{\"height\":\"100dvh\",\"display\":\"flex\",\"flexDirection\":\"column\"},\"children\":[\"$\",\"$L4\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$6\",\"errorStyles\":[],\"errorScripts\":null,\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}],\"p\":false,\"v\":null},\"c\":\"$Q8\"},\"h\":{\"r\":[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$Lf\",null,{\"children\":\"$L10\"}],[\"$\",\"$L12\",null,{\"children\":[[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$c\",null,{\"name\":\"Next.Metadata\",\"children\":\"$L13\"}]}],null]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],\"p\":false,\"v\":null}},\"m\":\"$undefined\",\"G\":[\"$15\",[]],\"S\":true,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"rPVMly3awjAYAgBD6W0mU\"}\n9:C\n10:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n16:I[86869,[],\"IconMark\"]\nd:null\n13:[[\"$\",\"title\",\"0\",{\"children\":\"AnnoVibe\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"AI-native bioinformatics workspace by Annoroad\"}],[\"$\",\"link\",\"2\",{\"rel\":\"shortcut icon\",\"href\":\"/icon.svg\",\"type\":\"image/svg+xml\"}],[\"$\",\"link\",\"3\",{\"rel\":\"icon\",\"href\":\"/icon.svg\",\"type\":\"image/svg+xml\"}],[\"$\",\"$L16\",\"4\",{}]]\n"])</script></body></html>
1
+ <!DOCTYPE html><html lang="en" class="__variable_9e44ca"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/7deddc85b7ffd1dc-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/_next/static/media/ec14413c594b3356-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/9bcd6051db4f8890.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/d68ecb6695873888.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-19f3f7824a602f3b.js"/><script src="/_next/static/chunks/4bd1b696-8cd12253b448cc13.js" async=""></script><script src="/_next/static/chunks/3794-fba3f76785a3c234.js" async=""></script><script src="/_next/static/chunks/main-app-a8a207cb34d209aa.js" async=""></script><script src="/_next/static/chunks/app/layout-31265427e43f6876.js" async=""></script><script src="/_next/static/chunks/app/error-6309e3e4cdf79d40.js" async=""></script><script src="/_next/static/chunks/app/global-error-7595c826cec2c048.js" async=""></script><meta name="robots" content="noindex"/><title>AnnoVibe</title><meta name="description" content="AI-native bioinformatics workspace by Annoroad"/><link rel="shortcut icon" href="/icon.svg" type="image/svg+xml"/><link rel="icon" href="/icon.svg" type="image/svg+xml"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><script>(self.__next_s=self.__next_s||[]).push([0,{"children":"(function(){try{var t=localStorage.getItem(\"pi-theme\");if(t===\"dark\")document.documentElement.classList.add(\"dark\")}catch(e){}})();","id":"theme-init"}])</script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body style="height:100dvh;display:flex;flex-direction:column"><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;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-19f3f7824a602f3b.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:\"static/chunks/app/layout-31265427e43f6876.js\"\n3:I[42593,[\"7177\",\"$2\"],\"\"]\n4:I[57121,[],\"\"]\n5:\"static/chunks/app/error-6309e3e4cdf79d40.js\"\n6:I[87460,[\"8039\",\"$5\"],\"default\"]\n7:I[74581,[],\"\"]\nb:I[90484,[],\"OutletBoundary\"]\nc:\"$Sreact.suspense\"\ne:\"ViewportBoundary\"\nf:I[90484,[],\"$e\"]\n11:\"MetadataBoundary\"\n12:I[90484,[],\"$11\"]\n14:\"static/chunks/app/global-error-7595c826cec2c048.js\"\n15:I[54690,[\"4219\",\"$14\"],\"default\"]\n:HL[\"/_next/static/media/7deddc85b7ffd1dc-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/media/ec14413c594b3356-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/css/9bcd6051db4f8890.css\",\"style\"]\n:HL[\"/_next/static/css/d68ecb6695873888.css\",\"style\"]\n9:X\na:[[\"children\",{\"s\":\"__PAGE__\",\"h\":512,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$Lb\",null,{\"children\":[\"$\",\"$c\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@d\"}]}]]}],\"p\":false,\"v\":null}}]]\n8:[[\"children\",{\"s\":\"_not-found\",\"h\":512,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L4\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],\"p\":false,\"v\":\"$9\"},\"c\":\"$Qa\"}]]\n0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"t\":{\"t\":{\"s\":\"\",\"h\":528,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/9bcd6051db4f8890.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/d68ecb6695873888.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"className\":\"__variable_9e44ca\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"$L3\",null,{\"id\":\"theme-init\",\"strategy\":\"beforeInteractive\",\"children\":\"(function(){try{var t=localStorage.getItem(\\\"pi-theme\\\");if(t===\\\"dark\\\")document.documentElement.classList.add(\\\"dark\\\")}catch(e){}})();\"}]}],[\"$\",\"body\",null,{\"style\":{\"height\":\"100dvh\",\"display\":\"flex\",\"flexDirection\":\"column\"},\"children\":[\"$\",\"$L4\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$6\",\"errorStyles\":[],\"errorScripts\":null,\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]]}]]}],\"p\":false,\"v\":null},\"c\":\"$Q8\"},\"h\":{\"r\":[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$Lf\",null,{\"children\":\"$L10\"}],[\"$\",\"$L12\",null,{\"children\":[[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$c\",null,{\"name\":\"Next.Metadata\",\"children\":\"$L13\"}]}],null]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],\"p\":false,\"v\":null}},\"m\":\"$undefined\",\"G\":[\"$15\",[]],\"S\":true,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"ZpLecbnV0af9eeGcGwT88\"}\n9:C\n10:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n16:I[86869,[],\"IconMark\"]\nd:null\n13:[[\"$\",\"title\",\"0\",{\"children\":\"AnnoVibe\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"AI-native bioinformatics workspace by Annoroad\"}],[\"$\",\"link\",\"2\",{\"rel\":\"shortcut icon\",\"href\":\"/icon.svg\",\"type\":\"image/svg+xml\"}],[\"$\",\"link\",\"3\",{\"rel\":\"icon\",\"href\":\"/icon.svg\",\"type\":\"image/svg+xml\"}],[\"$\",\"$L16\",\"4\",{}]]\n"])</script></body></html>
@@ -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/webpack-36fa69ae1e15e7ce.js"/><script src="/_next/static/chunks/4bd1b696-8cd12253b448cc13.js" async=""></script><script src="/_next/static/chunks/3794-fba3f76785a3c234.js" async=""></script><script src="/_next/static/chunks/main-app-a8a207cb34d209aa.js" async=""></script><script src="/_next/static/chunks/app/error-6309e3e4cdf79d40.js" async=""></script><script src="/_next/static/chunks/app/global-error-7595c826cec2c048.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/polyfills-42372ed130431b0a.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/webpack-36fa69ae1e15e7ce.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[57121,[],\"\"]\n3:\"static/chunks/app/error-6309e3e4cdf79d40.js\"\n4:I[87460,[\"8039\",\"$3\"],\"default\"]\n5:I[74581,[],\"\"]\n9:I[90484,[],\"OutletBoundary\"]\na:\"$Sreact.suspense\"\nc:\"ViewportBoundary\"\nd:I[90484,[],\"$c\"]\nf:\"MetadataBoundary\"\n10:I[90484,[],\"$f\"]\n12:\"static/chunks/app/global-error-7595c826cec2c048.js\"\n13:I[54690,[\"4219\",\"$12\"],\"default\"]\n6:X\n8:[[\"children\",{\"s\":\"__PAGE__\",\"h\":528,\"d\":{\"r\":[\"$\",\"$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,[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$a\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@b\"}]}]]}],\"p\":false,\"v\":null}}]]\n7:[[\"children\",{\"s\":\"_global-error\",\"h\":528,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L5\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],\"p\":false,\"v\":\"$6\"},\"c\":\"$Q8\"}]]\n0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"t\":{\"t\":{\"s\":\"\",\"h\":528,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$4\",\"errorStyles\":[],\"errorScripts\":null,\"template\":[\"$\",\"$L5\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],\"p\":false,\"v\":\"$6\"},\"c\":\"$Q7\"},\"h\":{\"r\":[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$Ld\",null,{\"children\":\"$Le\"}],[\"$\",\"$L10\",null,{\"children\":[[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$a\",null,{\"name\":\"Next.Metadata\",\"children\":\"$L11\"}]}],null]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],\"p\":false,\"v\":null}},\"m\":\"$undefined\",\"G\":[\"$13\",[]],\"S\":true,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"rPVMly3awjAYAgBD6W0mU\"}\n6:C\ne:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\nb:null\n11:[]\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/webpack-19f3f7824a602f3b.js"/><script src="/_next/static/chunks/4bd1b696-8cd12253b448cc13.js" async=""></script><script src="/_next/static/chunks/3794-fba3f76785a3c234.js" async=""></script><script src="/_next/static/chunks/main-app-a8a207cb34d209aa.js" async=""></script><script src="/_next/static/chunks/app/error-6309e3e4cdf79d40.js" async=""></script><script src="/_next/static/chunks/app/global-error-7595c826cec2c048.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/polyfills-42372ed130431b0a.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/webpack-19f3f7824a602f3b.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[57121,[],\"\"]\n3:\"static/chunks/app/error-6309e3e4cdf79d40.js\"\n4:I[87460,[\"8039\",\"$3\"],\"default\"]\n5:I[74581,[],\"\"]\n9:I[90484,[],\"OutletBoundary\"]\na:\"$Sreact.suspense\"\nc:\"ViewportBoundary\"\nd:I[90484,[],\"$c\"]\nf:\"MetadataBoundary\"\n10:I[90484,[],\"$f\"]\n12:\"static/chunks/app/global-error-7595c826cec2c048.js\"\n13:I[54690,[\"4219\",\"$12\"],\"default\"]\n6:X\n8:[[\"children\",{\"s\":\"__PAGE__\",\"h\":528,\"d\":{\"r\":[\"$\",\"$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,[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$a\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@b\"}]}]]}],\"p\":false,\"v\":null}}]]\n7:[[\"children\",{\"s\":\"_global-error\",\"h\":528,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L5\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],\"p\":false,\"v\":\"$6\"},\"c\":\"$Q8\"}]]\n0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"t\":{\"t\":{\"s\":\"\",\"h\":528,\"d\":{\"r\":[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$4\",\"errorStyles\":[],\"errorScripts\":null,\"template\":[\"$\",\"$L5\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],\"p\":false,\"v\":\"$6\"},\"c\":\"$Q7\"},\"h\":{\"r\":[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$Ld\",null,{\"children\":\"$Le\"}],[\"$\",\"$L10\",null,{\"children\":[[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$a\",null,{\"name\":\"Next.Metadata\",\"children\":\"$L11\"}]}],null]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],\"p\":false,\"v\":null}},\"m\":\"$undefined\",\"G\":[\"$13\",[]],\"S\":true,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"ZpLecbnV0af9eeGcGwT88\"}\n6:C\ne:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\nb:null\n11:[]\n"])</script></body></html>
@@ -1,5 +1,5 @@
1
1
  {
2
- "previewModeId": "6b3585a6b2aea07766440a277857f643",
3
- "previewModeSigningKey": "ac2092a92d550ab174a02c7af4c0c58f22149f8530dc6d16c0695549b8256266",
4
- "previewModeEncryptionKey": "f4c38779122b75d73d1ea10cc47c472ee6133406538664def50e5eb643e03ffc"
2
+ "previewModeId": "144e4f7c842988b5acc4c60bfeabff05",
3
+ "previewModeSigningKey": "6407801f3396fbf8a7668c982ba7070716ae852dcc302012c750bf827b6031c4",
4
+ "previewModeEncryptionKey": "28a6ab798eee185ce6a26d5d7c38cacd950d583436b76740df0fb2ccc6bcd383"
5
5
  }
@@ -1 +1 @@
1
- {"node":{},"edge":{},"encryptionKey":"5nFMzULZOxFYA5AKW+rWtNeGvxQSnsSSaKa6lfA/lqE="}
1
+ {"node":{},"edge":{},"encryptionKey":"tJtVx2RczOhZrTprwK9e+rxu7f4Zc1UCDyQmp6TpYm4="}
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2708],{70619:()=>{},71194:()=>{}}]);
@@ -1,22 +1,22 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3824],{14755:(e,t,n)=>{n.d(t,{ES:()=>d,IB:()=>p,SN:()=>a,tE:()=>f});let r="subagent",a=["retain","recall","reflect"],o=[],s=["read","bash","edit","write"],l=["bash","read","edit","write","grep","find","ls"],i=[...l,"kernel_plot_run","kernel_plot_render","kernel_plot_inspect","kernel_plot_stop","kernel_plot_artifacts"],u=[...l,r];function c(e){return[...e].sort().join(",")}function d(e){let t=e.filter(e=>e.active).map(e=>e.name),n=t.filter(e=>!a.includes(e)),o=c(t),d=c(n);return""===o?"none":o===c(s)?"default":o===c(l)?"full":o===c(i)?"workbench":o===c(u)?"agent":""===d?"none":d===c(s)?"default":d===c(l)?"full":d===c(i)?"workbench":d===c(u)||t.includes(r)?"agent":"default"}function p(e){return a.filter(t=>e.some(e=>e.active&&e.name===t))}function f(e,t){return[...new Set([...function(e){switch(e){case"none":return o;case"default":return s;case"workbench":return i;case"agent":return u;default:return l}}(e),...t])]}},16865:(e,t,n)=>{n.d(t,{O:()=>w});let r=new Set,a=null,o=null,s=null,l=null,i=null,u=!1,c=!1;function d(e){for(let t of(a=[...new Set(e.filter(e=>"string"==typeof e))],r))try{t(a)}catch{}}async function p(){try{let e=await fetch("/api/agent/running",{cache:"no-store"});if(!e.ok)return;let t=await e.json();Array.isArray(t.runningSessionIds)&&d(t.runningSessionIds)}catch{}}function f(){s||0===r.size||(p(),s=setInterval(()=>{p()},5e3))}function m(){s&&(clearInterval(s),s=null)}function g(){if(!u){if(u=!0,window.__annovibeRunningSessionSubscribe){i=window.__annovibeRunningSessionSubscribe(d);return}if("u"<typeof SharedWorker)return void f();try{(o=new SharedWorker("/running-session-worker.js?v=1",{name:"annovibe-running-sessions-v1",type:"classic"})).port.onmessage=e=>{let t=e.data;"transport"===t.type?f():"running"===t.type&&Array.isArray(t.runningSessionIds)&&(l&&clearTimeout(l),l=null,m(),d(t.runningSessionIds.filter(e=>"string"==typeof e)))},o.onerror=()=>f(),o.port.start(),o.port.postMessage({type:"subscribe"}),l=setTimeout(()=>f(),3e3)}catch{o=null,f()}}}function h(){if(u){if(u=!1,l&&clearTimeout(l),l=null,m(),i?.(),i=null,o){try{o.port.postMessage({type:"disconnect"})}catch{}try{o.port.close()}catch{}}o=null,a=null}}function y(){r.size>0&&g()}function w(e){return r.add(e),a&&e(a),c||(c=!0,window.addEventListener("pagehide",h),window.addEventListener("pageshow",y)),g(),()=>{r.delete(e),0===r.size&&(h(),c&&(c=!1,window.removeEventListener("pagehide",h),window.removeEventListener("pageshow",y)))}}},63824:(e,t,n)=>{n.d(t,{T:()=>Q});var r=n(12115);function a(e){return e?.phase==="running_tools"?{kind:"running_tools",tools:(e.activeTools??[]).map(e=>({id:e.id,name:e.name}))}:e?.phase==="streaming"||e?.phase==="compacting"||e?.phase==="idle"?null:{kind:"waiting_model"}}function o(e){if("assistant"!==e.role)return e;let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>("object"!=typeof e||null===e||Array.isArray(e)||"toolCall"!==e.type?null:{type:"toolCall",toolCallId:"string"==typeof e.toolCallId?e.toolCallId:"string"==typeof e.id?e.id:"",toolName:"string"==typeof e.toolName?e.toolName:"string"==typeof e.name?e.name:"",input:"object"!=typeof e.input||null===e.input||Array.isArray(e.input)?"object"!=typeof e.arguments||null===e.arguments||Array.isArray(e.arguments)?{}:e.arguments:e.input})??e);return{...e,content:n}}let s={isStreaming:!1,streamingMessage:null};function l(){return{role:"assistant",content:[],model:"",provider:"",timestamp:Date.now()}}function i(e,t,n){if(!Number.isInteger(t)||void 0===t||t<0)return e;let r=e.streamingMessage??l(),a=[...r.content],o=n(a[t]);return o?(a[t]=o,{isStreaming:!0,streamingMessage:{...r,content:a}}):e}function u(e){if(e.id||e.toolName)return{...e.id?{id:e.id}:{},...e.toolName?{toolName:e.toolName}:{}};let t=e.partial,n=e.contentIndex;if(!t||!Array.isArray(t.content)||void 0===n)return{};let r=t.content[n];return r&&"toolCall"===r.type?{..."string"==typeof r.id?{id:r.id}:"string"==typeof r.toolCallId?{id:r.toolCallId}:{},..."string"==typeof r.name?{toolName:r.name}:"string"==typeof r.toolName?{toolName:r.toolName}:{}}:{}}function c(e,t){switch(t.type){case"start":return{isStreaming:!0,streamingMessage:null};case"snapshot":return"assistant"===t.message.role?{isStreaming:!0,streamingMessage:t.message}:e;case"delta":var n=t.event;switch(n.type){case"start":return{isStreaming:!0,streamingMessage:e.streamingMessage??l()};case"text_start":return i(e,n.contentIndex,e=>e?.type==="text"?e:{type:"text",text:""});case"text_delta":return i(e,n.contentIndex,e=>({type:"text",text:(e?.type==="text"?e.text:"")+(n.delta??"")}));case"text_end":return i(e,n.contentIndex,e=>({type:"text",text:n.content??(e?.type==="text"?e.text:"")}));case"thinking_start":return i(e,n.contentIndex,e=>e?.type==="thinking"?e:{type:"thinking",thinking:""});case"thinking_delta":return i(e,n.contentIndex,e=>({type:"thinking",thinking:(e?.type==="thinking"?e.thinking:"")+(n.delta??"")}));case"thinking_end":return i(e,n.contentIndex,e=>({type:"thinking",thinking:n.content??(e?.type==="thinking"?e.thinking:"")}));case"toolcall_start":return i(e,n.contentIndex,e=>{let t=u(n);return e?.type==="toolCall"?{...e,...t.id?{toolCallId:t.id}:{},...t.toolName?{toolName:t.toolName}:{},rawInput:e.rawInput??""}:{type:"toolCall",toolCallId:t.id??"",toolName:t.toolName??"tool",input:{},rawInput:""}});case"toolcall_delta":return i(e,n.contentIndex,e=>{let t=u(n),r=e?.type==="toolCall"?e:{type:"toolCall",toolCallId:t.id??"",toolName:t.toolName??"tool",input:{}};return{...r,...t.id?{toolCallId:t.id}:{},...t.toolName?{toolName:t.toolName}:{},rawInput:(r.rawInput??"")+(n.delta??"")}});case"toolcall_end":return i(e,n.contentIndex,()=>({type:"toolCall",toolCallId:n.toolCall?.id??"",toolName:n.toolCall?.name??"tool",input:n.toolCall?.arguments??{}}));default:return e}case"end":case"reset":return s;default:return e}}function d(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function p(e){if("assistant"!==e.role)return null;let t=e.timestamp;return"number"!=typeof t?null:`assistant:${t}`}class f extends Error{constructor(e,t,n){super(e),this.status=t,this.code=n,this.name="AgentCommandError"}}async function m(e,t){let n=await fetch(`/api/agent/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok||r.error)throw new f(r.error??`HTTP ${n.status}`,n.status,r.code);return r.data}var g=n(28999);async function h(e,t){if(!t.length)return[];let n=await fetch("/api/images/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,images:t.map(e=>({data:e.data,mimeType:e.mimeType,name:e.name}))})}),r=await n.json().catch(()=>({}));if(!n.ok||r.error)throw Error(r.error??`Upload failed (HTTP ${n.status})`);return(r.uploaded??[]).map((e,n)=>({...e,previewUrl:t[n]?.previewUrl}))}async function y(e,t,n){let r,a=new TextDecoder,o="",s=e=>{if(e.startsWith("id: ")){r=e.slice(4);return}if(!e.startsWith("data: "))return;let n=e.slice(6);if("[DONE]"!==n)try{t(n,r)}catch{}finally{r=void 0}},l=new Promise(e=>{n?.aborted?e():n?.addEventListener("abort",()=>e(),{once:!0})});for(;;){let t=await Promise.race([e.read(),l.then(()=>({done:!0,value:void 0}))]);if(t.done)break;let n=(o+=a.decode(t.value,{stream:!0})).split("\n");for(let e of(o=n.pop()||"",n))s(e)}if(o.trim())for(let e of o.split("\n"))s(e)}var w=n(16865);let k="__annovibeStreamSessions__",v="__annovibeStreamListeners__",b="__annovibeStreamErrorCallbacks__";function C(){let e=globalThis;return e[k]||(e[k]=new Map),e[k]}function x(){let e=globalThis;return e[b]||(e[b]=new Map),e[b]}function _(e){return{sessionId:e,phase:"idle",startedAt:null,lastEventAt:null,lastHeartbeatAt:null,reconnectCount:0,lastSyncReason:null,accumulatedText:"",toolCalls:[],toolResults:[],statusText:null,streamingMessage:null,isStreaming:!1,error:null}}function I(e,t){let n;for(let r of(!(n=globalThis)[v]&&(n[v]=new Map),n[v]).get(e)??[])try{r(t)}catch{}}function T(e){e.textThrottleTimer&&(clearTimeout(e.textThrottleTimer),e.textThrottleTimer=null),e.textDirty&&(e.textDirty=!1,M(e))}function S(e,t=!1){let n=Date.now();if(e.snapshot.lastEventAt=n,!t){e.textDirty=!0,e.textThrottleTimer||(e.textThrottleTimer=setTimeout(()=>{e.textThrottleTimer=null,e.textDirty&&(e.textDirty=!1,M(e))},100));return}T(e),M(e)}function M(e,t){let n=Date.now(),r=function(e){let t=[];for(let n of e.toolCalls.values())t.push({type:"toolCall",toolCallId:n.toolCallId,toolName:n.toolName,input:n.input??{}});let n=e.accumulatedText.trim();return n&&t.push({type:"text",text:n}),t}(e),a=(t??e.snapshot.phase)==="active";e.snapshot={...e.snapshot,phase:t??e.snapshot.phase,lastEventAt:n,accumulatedText:e.accumulatedText,toolCalls:[...e.toolCalls.values()],toolResults:[...e.toolResults.values()],statusText:a?function(e){if(e.activeToolId){let t=e.toolCalls.get(e.activeToolId);if(t){let e=Math.max(0,Math.floor((Date.now()-t.startedAt)/1e3));return`Running ${t.toolName||"tool"}… (${e}s)`}}return e.accumulatedText.trim()?"Generating response…":e.toolCalls.size>0?"Finishing tool results…":null}(e):e.snapshot.statusText,streamingMessage:a&&r.length>0?{role:"assistant",content:r}:null,isStreaming:a},I(e.snapshot.sessionId,{type:"snapshot-updated",snapshot:e.snapshot})}function E(e){A(e),e.idleCheckTimer=setInterval(()=>{if("connected"!==e.connectionState)return;let t=Math.max(e.snapshot.lastEventAt??0,e.snapshot.lastHeartbeatAt??0);if(Date.now()-t>=18e4){R(e),T(e);let t="Stream idle timeout — no activity for 180s.";e.snapshot={...e.snapshot,phase:"error",isStreaming:!1,streamingMessage:null,statusText:null,error:t},A(e),I(e.snapshot.sessionId,{type:"error",snapshot:e.snapshot});let n=x().get(e.snapshot.sessionId);if(n)try{n(e.snapshot.sessionId,t)}catch{}}},1e4)}function A(e){e.idleCheckTimer&&(clearInterval(e.idleCheckTimer),e.idleCheckTimer=null)}function R(e){e.toolProgressTimer&&(clearInterval(e.toolProgressTimer),e.toolProgressTimer=null)}function $(e){let t=C(),n=t.get(e);return n||(n={snapshot:_(e),accumulatedText:"",toolCalls:new Map,toolResults:new Map,toolProgressTimer:null,activeToolId:null,textThrottleTimer:null,textDirty:!1,connectionState:"idle",idleCheckTimer:null},t.set(e,n)),n}function N(e,t){let n=x();return n.set(e,t),()=>{n.get(e)===t&&n.delete(e)}}function D(e){let t=C(),n=t.get(e);n&&(R(n),A(n),T(n)),t.delete(e)}function L(e){let t=C().get(e);t&&(t.snapshot={...t.snapshot,reconnectCount:t.snapshot.reconnectCount+1,lastSyncReason:"sse-reconnect",lastEventAt:Date.now()},S(t,!0))}let U="__annovibeSessionMessageCache__";function P(){let e=globalThis;if(!e[U]){var t;let n={entries:new Map,cleanupTimer:null};e[U]=n,(t=n).cleanupTimer||(t.cleanupTimer=setInterval(()=>{let e=Date.now();for(let[n,r]of t.entries)e-r.loadedAt>72e5&&t.entries.delete(n)},6e4))}return e[U]}function j(e){let t=P(),n=t.entries.get(e);return n?Date.now()-n.loadedAt>72e5?(t.entries.delete(e),null):(n.loadedAt=Date.now(),{...n,messages:[...n.messages],entryIds:[...n.entryIds]}):null}function O(e,t,n,r,a){let o=P(),s=o.entries.get(e);if(!s)return;let l=new Set(s.entryIds),i=[],u=[];for(let e=0;e<t.length;e++){let r=n[e];r&&!l.has(r)&&(i.push(t[e]),u.push(r))}0!==i.length&&o.entries.set(e,{...s,messages:[...i,...s.messages],entryIds:[...u,...s.entryIds],hasMore:r,loadedMessagesCount:a,loadedAt:Date.now()})}function F(e){P().entries.delete(e)}var q=n(14755);function H(e){return{steering:e?.steering??[],followUp:e?.followUp??[]}}let B=[500,1500,3e3];function W(e,t){return new DOMException(e,t)}function J(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}-${Math.random().toString(36).slice(2,11)}`}function K(e,t){return e.trim()||0!==t?`text:${e}|images:${t}`:null}function z(e){return"string"==typeof e?K(e,0):Array.isArray(e)?K(e.filter(e=>!!e&&"object"==typeof e&&"text"===e.type&&"string"==typeof e.text).map(e=>e.text).join("\n"),e.filter(e=>!!e&&"object"==typeof e&&"image"===e.type).length):null}function G(e){let t=new Map;for(let n of e){let e="user"!==n.role?null:z(n.content);e&&t.set(e,(t.get(e)??0)+1)}return t}function V(e,t,n){return e.sessionId===t&&(!e.leafId||n.includes(e.leafId))}function Y(e,t){let n=e.timestamp,r=t.timestamp;if("number"!=typeof n||"number"!=typeof r||n!==r||e.role!==t.role)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function Q(e){let{session:t,newSessionCwd:n,onAgentEnd:l,onSessionCreated:i,onSessionForked:u,modelsRefreshKey:k,onBranchDataChange:v,chatInputRef:b}=e,x=null===t&&null!==n,[M,U]=(0,r.useState)(null),[Q,X]=(0,r.useState)(!x),[Z,ee]=(0,r.useState)(null),[et,en]=(0,r.useState)(null),[er,ea]=(0,r.useState)([]),[eo,es]=(0,r.useState)([]),[el,ei]=(0,r.useState)(0),[eu,ec]=(0,r.useState)(!1),[ed,ep]=(0,r.useState)(0),[ef,em]=(0,r.useReducer)(c,s),[eg,eh]=(0,r.useState)(!1),[ey,ew]=(0,r.useState)({}),[ek,ev]=(0,r.useState)([]),[eb,eC]=(0,r.useState)({}),[ex,e_]=(0,r.useState)({}),[eI,eT]=(0,r.useState)(null),[eS,eM]=(0,r.useState)("full"),[eE,eA]=(0,r.useState)([...q.SN]),[eR,e$]=(0,r.useState)([]),[eN,eD]=(0,r.useState)("auto"),[eL,eU]=(0,r.useState)(null),[eP,ej]=(0,r.useState)(null),[eO,eF]=(0,r.useState)(null),[eq,eH]=(0,r.useState)(null),[eB,eW]=(0,r.useState)(null),[eJ,eK]=(0,r.useState)(null),[ez,eG]=(0,r.useState)(!1),[eV,eY]=(0,r.useState)(null),[eQ,eX]=(0,r.useState)(null),[eZ,e0]=(0,r.useState)(null),[e1,e3]=(0,r.useState)({steering:[],followUp:[]}),[e4,e5]=(0,r.useState)(null),e6=(0,r.useRef)(null),e2=(0,r.useRef)(t?.id??null),{statuses:e8,widgets:e7,dialog:e9,notices:te,applyFromState:tt,handleEvent:tn,respond:tr,dismissNotice:ta}=function({chatInputRef:e,sessionIdRef:t,onError:n,noticeTtlMs:a=8e3}){let[o,s]=(0,r.useState)([]),[l,i]=(0,r.useState)([]),[u,c]=(0,r.useState)(null),[d,p]=(0,r.useState)([]),f=(0,r.useRef)(new Set),g=(0,r.useCallback)(()=>{for(let e of f.current)clearTimeout(e);f.current.clear()},[]);(0,r.useEffect)(()=>g,[g]);let h=(0,r.useCallback)((e,t)=>{let n={id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,message:e,type:t};p(e=>[...e,n].slice(-4));let r=setTimeout(()=>{f.current.delete(r),p(e=>e.filter(e=>e.id!==n.id))},a);f.current.add(r)},[a]),y=(0,r.useCallback)(e=>{e&&(Array.isArray(e.extensionStatuses)&&s(e.extensionStatuses),Array.isArray(e.extensionWidgets)&&i(e.extensionWidgets))},[]),w=(0,r.useCallback)(t=>{if("extension_error"===t.type)return h("string"==typeof t.error?t.error:"Extension command failed","error"),!0;if("extension_ui_request"!==t.type)return!1;let n="string"==typeof t.method?t.method:"";if("select"===n||"confirm"===n||"input"===n||"editor"===n)return c({id:String(t.id??""),method:n,title:"string"==typeof t.title?t.title:"",...Array.isArray(t.options)?{options:t.options}:{},..."string"==typeof t.message?{message:t.message}:{},..."string"==typeof t.placeholder?{placeholder:t.placeholder}:{},..."string"==typeof t.prefill?{prefill:t.prefill}:{}}),!0;if("notify"===n){let e="warning"===t.notifyType||"error"===t.notifyType?t.notifyType:"info";return h(String(t.message??""),e),!0}if("setStatus"===n){let e=String(t.statusKey??"");if(!e)return!0;let n="string"==typeof t.statusText?t.statusText:null;return s(t=>{let r=t.filter(t=>t.key!==e);return n?[...r,{key:e,text:n}]:r}),!0}if("setWidget"===n){let e=String(t.widgetKey??"");if(!e)return!0;let n=Array.isArray(t.widgetLines)?t.widgetLines.filter(e=>"string"==typeof e):null;return i(r=>{let a=r.filter(t=>t.key!==e);return n&&n.length>0?[...a,{key:e,lines:n,placement:"string"==typeof t.widgetPlacement?t.widgetPlacement:"aboveEditor"}]:a}),!0}return"dismiss"===n?c(e=>e?.id===t.id?null:e):"set_editor_text"===n&&"string"==typeof t.text?e?.current?.setText?.(t.text):"setTitle"===n&&"string"==typeof t.title&&(document.title=t.title),!0},[e,h]),k=(0,r.useCallback)(async(e,r)=>{let a=t.current;if(c(t=>t?.id===e?null:t),a)try{await m(a,{type:"extension_ui_response",id:e,...r})}catch(e){n(e instanceof Error?e.message:String(e))}},[n,t]);return{statuses:o,widgets:l,dialog:u,notices:d,applyFromState:y,handleEvent:w,respond:k,dismissNotice:(0,r.useCallback)(e=>{p(t=>t.filter(t=>t.id!==e))},[]),reset:(0,r.useCallback)(()=>{g(),s([]),i([]),c(null),p([])},[g])}}({chatInputRef:b,sessionIdRef:e2,onError:e5}),to=(0,r.useRef)(!1),{live:ts,running:tl,isRunning:ti,begin:tu,finish:tc,handleEvent:td}=function({onRunningChange:e,onDone:t,flushMs:n=60}={}){let[a,o]=(0,r.useState)(null),[s,l]=(0,r.useState)(!1),i=(0,r.useRef)(!1),u=(0,r.useRef)(""),c=(0,r.useRef)(null),d=(0,r.useCallback)(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]);(0,r.useEffect)(()=>d,[d]);let p=(0,r.useCallback)(t=>{d(),u.current="",i.current=!0,l(!0),o({command:t,output:""}),e?.(!0,t)},[d,e]),f=(0,r.useCallback)(()=>{d(),u.current="",i.current=!1,l(!1),o(null),e?.(!1)},[d,e]);return{live:a,running:s,isRunning:(0,r.useCallback)(()=>i.current,[]),begin:p,finish:f,handleEvent:(0,r.useCallback)(r=>{if("bash_execution_start"===r.type){let t=String(r.command??"");return d(),u.current="",i.current=!0,l(!0),o({command:t,output:""}),e?.(!0,t),!0}if("bash_execution_update"===r.type){let e="string"==typeof r.chunk?r.chunk:"";return!e||(u.current+=e,c.current||(c.current=setTimeout(()=>{c.current=null;let e=u.current;u.current="",e&&o(t=>t?{...t,output:t.output+e}:t)},n)),!0)}return"bash_done"===r.type&&(d(),u.current="",i.current=!1,l(!1),o(null),e?.(!1),t?.(),!0)},[d,n,t,e])}}({onRunningChange:(e,t)=>{to.current=e,eh(e),e0(e?{kind:"running_tools",tools:[{id:"bash",name:"bash",args:t}]}:null)}}),tp=(0,r.useRef)(null),tf=(0,r.useRef)(null),tm=(0,r.useRef)(null),tg=(0,r.useRef)(!1),th=(0,r.useRef)(null),ty=(0,r.useRef)(!1),tw=(0,r.useRef)(null),tk=(0,r.useRef)(null),tv=(0,r.useRef)(new Map),tb=(0,r.useRef)(new Map),tC=(0,r.useRef)(new Map),tx=(0,r.useRef)(new Map),t_=(0,r.useRef)(null),tI=(0,r.useRef)([]),tT=(0,r.useRef)(null),tS=(0,r.useRef)(0),tM=(0,r.useRef)(!1),tE=(0,r.useRef)(0),tA=(0,r.useRef)(!1),tR=(0,r.useRef)(!1),t$=(0,r.useRef)(0),tN=(0,r.useRef)(null),tD=(0,r.useRef)(null),tL=(0,r.useRef)(0),tU=(0,r.useRef)(!1);(0,r.useEffect)(()=>{t_.current=et},[et]),(0,r.useEffect)(()=>{tU.current=ef.isStreaming},[ef.isStreaming]),(0,r.useEffect)(()=>{tx.current.clear()},[t?.id]);let tP=e.setNewSessionModel??eT,tj=e.setToolPreset??eM,tO=e.setMemoryTools??eA,tF=eB??M?.context.model??eJ??null,tq=x?eI:tF,tH=(0,r.useCallback)(()=>(0,q.tE)(eS,eE),[eE,eS]),tB=(0,r.useCallback)(e=>e?.length?e.map((e,t)=>{let n=`Attachment ${t+1}: ${e.fileName} (${e.mimeType||"application/octet-stream"}, ${e.size} bytes)`;if(e.extractedText){let t=e.truncated?"\n[The extracted text was truncated before sending.]":"";return`${n}
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3824],{14755:(e,t,n)=>{n.d(t,{ES:()=>d,IB:()=>p,SN:()=>a,tE:()=>f});let r="subagent",a=["retain","recall","reflect"],o=[],s=["read","bash","edit","write"],l=["bash","read","edit","write","grep","find","ls"],i=[...l,"kernel_plot_run","kernel_plot_render","kernel_plot_inspect","kernel_plot_stop","kernel_plot_artifacts"],u=[...l,r];function c(e){return[...e].sort().join(",")}function d(e){let t=e.filter(e=>e.active).map(e=>e.name),n=t.filter(e=>!a.includes(e)),o=c(t),d=c(n);return""===o?"none":o===c(s)?"default":o===c(l)?"full":o===c(i)?"workbench":o===c(u)?"agent":""===d?"none":d===c(s)?"default":d===c(l)?"full":d===c(i)?"workbench":d===c(u)||t.includes(r)?"agent":"default"}function p(e){return a.filter(t=>e.some(e=>e.active&&e.name===t))}function f(e,t){return[...new Set([...function(e){switch(e){case"none":return o;case"default":return s;case"workbench":return i;case"agent":return u;default:return l}}(e),...t])]}},16865:(e,t,n)=>{n.d(t,{O:()=>w});let r=new Set,a=null,o=null,s=null,l=null,i=null,u=!1,c=!1;function d(e){for(let t of(a=[...new Set(e.filter(e=>"string"==typeof e))],r))try{t(a)}catch{}}async function p(){try{let e=await fetch("/api/agent/running",{cache:"no-store"});if(!e.ok)return;let t=await e.json();Array.isArray(t.runningSessionIds)&&d(t.runningSessionIds)}catch{}}function f(){s||0===r.size||(p(),s=setInterval(()=>{p()},5e3))}function m(){s&&(clearInterval(s),s=null)}function g(){if(!u){if(u=!0,window.__annovibeRunningSessionSubscribe){i=window.__annovibeRunningSessionSubscribe(d);return}if("u"<typeof SharedWorker)return void f();try{(o=new SharedWorker("/running-session-worker.js?v=1",{name:"annovibe-running-sessions-v1",type:"classic"})).port.onmessage=e=>{let t=e.data;"transport"===t.type?f():"running"===t.type&&Array.isArray(t.runningSessionIds)&&(l&&clearTimeout(l),l=null,m(),d(t.runningSessionIds.filter(e=>"string"==typeof e)))},o.onerror=()=>f(),o.port.start(),o.port.postMessage({type:"subscribe"}),l=setTimeout(()=>f(),3e3)}catch{o=null,f()}}}function h(){if(u){if(u=!1,l&&clearTimeout(l),l=null,m(),i?.(),i=null,o){try{o.port.postMessage({type:"disconnect"})}catch{}try{o.port.close()}catch{}}o=null,a=null}}function y(){r.size>0&&g()}function w(e){return r.add(e),a&&e(a),c||(c=!0,window.addEventListener("pagehide",h),window.addEventListener("pageshow",y)),g(),()=>{r.delete(e),0===r.size&&(h(),c&&(c=!1,window.removeEventListener("pagehide",h),window.removeEventListener("pageshow",y)))}}},63824:(e,t,n)=>{n.d(t,{T:()=>Q});var r=n(12115);function a(e){return e?.phase==="running_tools"?{kind:"running_tools",tools:(e.activeTools??[]).map(e=>({id:e.id,name:e.name}))}:e?.phase==="streaming"||e?.phase==="compacting"||e?.phase==="idle"?null:{kind:"waiting_model"}}function o(e){if("assistant"!==e.role)return e;let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>("object"!=typeof e||null===e||Array.isArray(e)||"toolCall"!==e.type?null:{type:"toolCall",toolCallId:"string"==typeof e.toolCallId?e.toolCallId:"string"==typeof e.id?e.id:"",toolName:"string"==typeof e.toolName?e.toolName:"string"==typeof e.name?e.name:"",input:"object"!=typeof e.input||null===e.input||Array.isArray(e.input)?"object"!=typeof e.arguments||null===e.arguments||Array.isArray(e.arguments)?{}:e.arguments:e.input})??e);return{...e,content:n}}let s={isStreaming:!1,streamingMessage:null};function l(){return{role:"assistant",content:[],model:"",provider:"",timestamp:Date.now()}}function i(e,t,n){if(!Number.isInteger(t)||void 0===t||t<0)return e;let r=e.streamingMessage??l(),a=[...r.content],o=n(a[t]);return o?(a[t]=o,{isStreaming:!0,streamingMessage:{...r,content:a}}):e}function u(e){if(e.id||e.toolName)return{...e.id?{id:e.id}:{},...e.toolName?{toolName:e.toolName}:{}};let t=e.partial,n=e.contentIndex;if(!t||!Array.isArray(t.content)||void 0===n)return{};let r=t.content[n];return r&&"toolCall"===r.type?{..."string"==typeof r.id?{id:r.id}:"string"==typeof r.toolCallId?{id:r.toolCallId}:{},..."string"==typeof r.name?{toolName:r.name}:"string"==typeof r.toolName?{toolName:r.toolName}:{}}:{}}function c(e,t){switch(t.type){case"start":return{isStreaming:!0,streamingMessage:null};case"snapshot":return"assistant"===t.message.role?{isStreaming:!0,streamingMessage:t.message}:e;case"delta":var n=t.event;switch(n.type){case"start":return{isStreaming:!0,streamingMessage:e.streamingMessage??l()};case"text_start":return i(e,n.contentIndex,e=>e?.type==="text"?e:{type:"text",text:""});case"text_delta":return i(e,n.contentIndex,e=>({type:"text",text:(e?.type==="text"?e.text:"")+(n.delta??"")}));case"text_end":return i(e,n.contentIndex,e=>({type:"text",text:n.content??(e?.type==="text"?e.text:"")}));case"thinking_start":return i(e,n.contentIndex,e=>e?.type==="thinking"?e:{type:"thinking",thinking:""});case"thinking_delta":return i(e,n.contentIndex,e=>({type:"thinking",thinking:(e?.type==="thinking"?e.thinking:"")+(n.delta??"")}));case"thinking_end":return i(e,n.contentIndex,e=>({type:"thinking",thinking:n.content??(e?.type==="thinking"?e.thinking:"")}));case"toolcall_start":return i(e,n.contentIndex,e=>{let t=u(n);return e?.type==="toolCall"?{...e,...t.id?{toolCallId:t.id}:{},...t.toolName?{toolName:t.toolName}:{},rawInput:e.rawInput??""}:{type:"toolCall",toolCallId:t.id??"",toolName:t.toolName??"tool",input:{},rawInput:""}});case"toolcall_delta":return i(e,n.contentIndex,e=>{let t=u(n),r=e?.type==="toolCall"?e:{type:"toolCall",toolCallId:t.id??"",toolName:t.toolName??"tool",input:{}};return{...r,...t.id?{toolCallId:t.id}:{},...t.toolName?{toolName:t.toolName}:{},rawInput:(r.rawInput??"")+(n.delta??"")}});case"toolcall_end":return i(e,n.contentIndex,()=>({type:"toolCall",toolCallId:n.toolCall?.id??"",toolName:n.toolCall?.name??"tool",input:n.toolCall?.arguments??{}}));default:return e}case"end":case"reset":return s;default:return e}}function d(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function p(e){if("assistant"!==e.role)return null;let t=e.timestamp;return"number"!=typeof t?null:`assistant:${t}`}class f extends Error{constructor(e,t,n){super(e),this.status=t,this.code=n,this.name="AgentCommandError"}}async function m(e,t){let n=await fetch(`/api/agent/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok||r.error)throw new f(r.error??`HTTP ${n.status}`,n.status,r.code);return r.data}var g=n(28999);async function h(e,t){if(!t.length)return[];let n=await fetch("/api/images/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,images:t.map(e=>({data:e.data,mimeType:e.mimeType,name:e.name}))})}),r=await n.json().catch(()=>({}));if(!n.ok||r.error)throw Error(r.error??`Upload failed (HTTP ${n.status})`);return(r.uploaded??[]).map((e,n)=>({...e,previewUrl:t[n]?.previewUrl}))}async function y(e,t,n){let r,a=new TextDecoder,o="",s=e=>{if(e.startsWith("id: ")){r=e.slice(4);return}if(!e.startsWith("data: "))return;let n=e.slice(6);if("[DONE]"!==n)try{t(n,r)}catch{}finally{r=void 0}},l=new Promise(e=>{n?.aborted?e():n?.addEventListener("abort",()=>e(),{once:!0})});for(;;){let t=await Promise.race([e.read(),l.then(()=>({done:!0,value:void 0}))]);if(t.done)break;let n=(o+=a.decode(t.value,{stream:!0})).split("\n");for(let e of(o=n.pop()||"",n))s(e)}if(o.trim())for(let e of o.split("\n"))s(e)}var w=n(16865);let k="__annovibeStreamSessions__",v="__annovibeStreamListeners__",C="__annovibeStreamErrorCallbacks__";function b(){let e=globalThis;return e[k]||(e[k]=new Map),e[k]}function x(){let e=globalThis;return e[C]||(e[C]=new Map),e[C]}function _(e){return{sessionId:e,phase:"idle",startedAt:null,lastEventAt:null,lastHeartbeatAt:null,reconnectCount:0,lastSyncReason:null,accumulatedText:"",toolCalls:[],toolResults:[],statusText:null,streamingMessage:null,isStreaming:!1,error:null}}function I(e,t){let n;for(let r of(!(n=globalThis)[v]&&(n[v]=new Map),n[v]).get(e)??[])try{r(t)}catch{}}function T(e){e.textThrottleTimer&&(clearTimeout(e.textThrottleTimer),e.textThrottleTimer=null),e.textDirty&&(e.textDirty=!1,M(e))}function S(e,t=!1){let n=Date.now();if(e.snapshot.lastEventAt=n,!t){e.textDirty=!0,e.textThrottleTimer||(e.textThrottleTimer=setTimeout(()=>{e.textThrottleTimer=null,e.textDirty&&(e.textDirty=!1,M(e))},100));return}T(e),M(e)}function M(e,t){let n=Date.now(),r=function(e){let t=[];for(let n of e.toolCalls.values())t.push({type:"toolCall",toolCallId:n.toolCallId,toolName:n.toolName,input:n.input??{}});let n=e.accumulatedText.trim();return n&&t.push({type:"text",text:n}),t}(e),a=(t??e.snapshot.phase)==="active";e.snapshot={...e.snapshot,phase:t??e.snapshot.phase,lastEventAt:n,accumulatedText:e.accumulatedText,toolCalls:[...e.toolCalls.values()],toolResults:[...e.toolResults.values()],statusText:a?function(e){if(e.activeToolId){let t=e.toolCalls.get(e.activeToolId);if(t){let e=Math.max(0,Math.floor((Date.now()-t.startedAt)/1e3));return`Running ${t.toolName||"tool"}… (${e}s)`}}return e.accumulatedText.trim()?"Generating response…":e.toolCalls.size>0?"Finishing tool results…":null}(e):e.snapshot.statusText,streamingMessage:a&&r.length>0?{role:"assistant",content:r}:null,isStreaming:a},I(e.snapshot.sessionId,{type:"snapshot-updated",snapshot:e.snapshot})}function E(e){A(e),e.idleCheckTimer=setInterval(()=>{if("connected"!==e.connectionState)return;let t=Math.max(e.snapshot.lastEventAt??0,e.snapshot.lastHeartbeatAt??0);if(Date.now()-t>=18e4){R(e),T(e);let t="Stream idle timeout — no activity for 180s.";e.snapshot={...e.snapshot,phase:"error",isStreaming:!1,streamingMessage:null,statusText:null,error:t},A(e),I(e.snapshot.sessionId,{type:"error",snapshot:e.snapshot});let n=x().get(e.snapshot.sessionId);if(n)try{n(e.snapshot.sessionId,t)}catch{}}},1e4)}function A(e){e.idleCheckTimer&&(clearInterval(e.idleCheckTimer),e.idleCheckTimer=null)}function R(e){e.toolProgressTimer&&(clearInterval(e.toolProgressTimer),e.toolProgressTimer=null)}function $(e){let t=b(),n=t.get(e);return n||(n={snapshot:_(e),accumulatedText:"",toolCalls:new Map,toolResults:new Map,toolProgressTimer:null,activeToolId:null,textThrottleTimer:null,textDirty:!1,connectionState:"idle",idleCheckTimer:null},t.set(e,n)),n}function N(e,t){let n=x();return n.set(e,t),()=>{n.get(e)===t&&n.delete(e)}}function D(e){let t=b(),n=t.get(e);n&&(R(n),A(n),T(n)),t.delete(e)}function L(e){let t=b().get(e);t&&(t.snapshot={...t.snapshot,reconnectCount:t.snapshot.reconnectCount+1,lastSyncReason:"sse-reconnect",lastEventAt:Date.now()},S(t,!0))}let U="__annovibeSessionMessageCache__";function P(){let e=globalThis;if(!e[U]){var t;let n={entries:new Map,cleanupTimer:null};e[U]=n,(t=n).cleanupTimer||(t.cleanupTimer=setInterval(()=>{let e=Date.now();for(let[n,r]of t.entries)e-r.loadedAt>72e5&&t.entries.delete(n)},6e4))}return e[U]}function j(e){let t=P(),n=t.entries.get(e);return n?Date.now()-n.loadedAt>72e5?(t.entries.delete(e),null):(n.loadedAt=Date.now(),{...n,messages:[...n.messages],entryIds:[...n.entryIds]}):null}function O(e,t,n,r,a){let o=P(),s=o.entries.get(e);if(!s)return;let l=new Set(s.entryIds),i=[],u=[];for(let e=0;e<t.length;e++){let r=n[e];r&&!l.has(r)&&(i.push(t[e]),u.push(r))}0!==i.length&&o.entries.set(e,{...s,messages:[...i,...s.messages],entryIds:[...u,...s.entryIds],hasMore:r,loadedMessagesCount:a,loadedAt:Date.now()})}function F(e){P().entries.delete(e)}var q=n(14755);function H(e){return{steering:e?.steering??[],followUp:e?.followUp??[]}}let B=[500,1500,3e3];function W(e,t){return new DOMException(e,t)}function J(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}-${Math.random().toString(36).slice(2,11)}`}function K(e,t){return e.trim()||0!==t?`text:${e}|images:${t}`:null}function z(e){return"string"==typeof e?K(e,0):Array.isArray(e)?K(e.filter(e=>!!e&&"object"==typeof e&&"text"===e.type&&"string"==typeof e.text).map(e=>e.text).join("\n"),e.filter(e=>!!e&&"object"==typeof e&&"image"===e.type).length):null}function G(e){let t=new Map;for(let n of e){let e="user"!==n.role?null:z(n.content);e&&t.set(e,(t.get(e)??0)+1)}return t}function V(e,t,n){return e.sessionId===t&&(!e.leafId||n.includes(e.leafId))}function Y(e,t){let n=e.timestamp,r=t.timestamp;if("number"!=typeof n||"number"!=typeof r||n!==r||e.role!==t.role)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function Q(e){let{session:t,newSessionCwd:n,onAgentEnd:l,onSessionCreated:i,onSessionForked:u,modelsRefreshKey:k,onBranchDataChange:v,chatInputRef:C}=e,x=null===t&&null!==n,[M,U]=(0,r.useState)(null),[Q,X]=(0,r.useState)(!x),[Z,ee]=(0,r.useState)(null),[et,en]=(0,r.useState)(null),[er,ea]=(0,r.useState)([]),[eo,es]=(0,r.useState)([]),[el,ei]=(0,r.useState)(0),[eu,ec]=(0,r.useState)(!1),[ed,ep]=(0,r.useState)(0),[ef,em]=(0,r.useReducer)(c,s),[eg,eh]=(0,r.useState)(!1),[ey,ew]=(0,r.useState)({}),[ek,ev]=(0,r.useState)([]),[eC,eb]=(0,r.useState)({}),[ex,e_]=(0,r.useState)({}),[eI,eT]=(0,r.useState)(null),[eS,eM]=(0,r.useState)("full"),[eE,eA]=(0,r.useState)([...q.SN]),[eR,e$]=(0,r.useState)([]),[eN,eD]=(0,r.useState)("auto"),[eL,eU]=(0,r.useState)(null),[eP,ej]=(0,r.useState)(null),[eO,eF]=(0,r.useState)(null),[eq,eH]=(0,r.useState)(null),[eB,eW]=(0,r.useState)(null),[eJ,eK]=(0,r.useState)(null),[ez,eG]=(0,r.useState)(!1),[eV,eY]=(0,r.useState)(null),[eQ,eX]=(0,r.useState)(null),[eZ,e0]=(0,r.useState)(null),[e1,e3]=(0,r.useState)({steering:[],followUp:[]}),[e4,e5]=(0,r.useState)(null),e6=(0,r.useRef)(null),e2=(0,r.useRef)(t?.id??null),{statuses:e8,widgets:e7,dialog:e9,notices:te,applyFromState:tt,handleEvent:tn,respond:tr,dismissNotice:ta}=function({chatInputRef:e,sessionIdRef:t,onError:n,noticeTtlMs:a=8e3}){let[o,s]=(0,r.useState)([]),[l,i]=(0,r.useState)([]),[u,c]=(0,r.useState)(null),[d,p]=(0,r.useState)([]),f=(0,r.useRef)(new Set),g=(0,r.useCallback)(()=>{for(let e of f.current)clearTimeout(e);f.current.clear()},[]);(0,r.useEffect)(()=>g,[g]);let h=(0,r.useCallback)((e,t)=>{let n={id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,message:e,type:t};p(e=>[...e,n].slice(-4));let r=setTimeout(()=>{f.current.delete(r),p(e=>e.filter(e=>e.id!==n.id))},a);f.current.add(r)},[a]),y=(0,r.useCallback)(e=>{e&&(Array.isArray(e.extensionStatuses)&&s(e.extensionStatuses),Array.isArray(e.extensionWidgets)&&i(e.extensionWidgets))},[]),w=(0,r.useCallback)(t=>{if("extension_error"===t.type)return h("string"==typeof t.error?t.error:"Extension command failed","error"),!0;if("extension_ui_request"!==t.type)return!1;let n="string"==typeof t.method?t.method:"";if("select"===n||"confirm"===n||"input"===n||"editor"===n)return c({id:String(t.id??""),method:n,title:"string"==typeof t.title?t.title:"",...Array.isArray(t.options)?{options:t.options}:{},..."string"==typeof t.message?{message:t.message}:{},..."string"==typeof t.placeholder?{placeholder:t.placeholder}:{},..."string"==typeof t.prefill?{prefill:t.prefill}:{}}),!0;if("notify"===n){let e="warning"===t.notifyType||"error"===t.notifyType?t.notifyType:"info";return h(String(t.message??""),e),!0}if("setStatus"===n){let e=String(t.statusKey??"");if(!e)return!0;let n="string"==typeof t.statusText?t.statusText:null;return s(t=>{let r=t.filter(t=>t.key!==e);return n?[...r,{key:e,text:n}]:r}),!0}if("setWidget"===n){let e=String(t.widgetKey??"");if(!e)return!0;let n=Array.isArray(t.widgetLines)?t.widgetLines.filter(e=>"string"==typeof e):null;return i(r=>{let a=r.filter(t=>t.key!==e);return n&&n.length>0?[...a,{key:e,lines:n,placement:"string"==typeof t.widgetPlacement?t.widgetPlacement:"aboveEditor"}]:a}),!0}return"dismiss"===n?c(e=>e?.id===t.id?null:e):"set_editor_text"===n&&"string"==typeof t.text?e?.current?.setText?.(t.text):"setTitle"===n&&"string"==typeof t.title&&(document.title=t.title),!0},[e,h]),k=(0,r.useCallback)(async(e,r)=>{let a=t.current;if(c(t=>t?.id===e?null:t),a)try{await m(a,{type:"extension_ui_response",id:e,...r})}catch(e){n(e instanceof Error?e.message:String(e))}},[n,t]);return{statuses:o,widgets:l,dialog:u,notices:d,applyFromState:y,handleEvent:w,respond:k,dismissNotice:(0,r.useCallback)(e=>{p(t=>t.filter(t=>t.id!==e))},[]),reset:(0,r.useCallback)(()=>{g(),s([]),i([]),c(null),p([])},[g])}}({chatInputRef:C,sessionIdRef:e2,onError:e5}),to=(0,r.useRef)(!1),{live:ts,running:tl,isRunning:ti,begin:tu,finish:tc,handleEvent:td}=function({onRunningChange:e,onDone:t,flushMs:n=60}={}){let[a,o]=(0,r.useState)(null),[s,l]=(0,r.useState)(!1),i=(0,r.useRef)(!1),u=(0,r.useRef)(""),c=(0,r.useRef)(null),d=(0,r.useRef)({onRunningChange:e,onDone:t});d.current={onRunningChange:e,onDone:t};let p=(0,r.useCallback)(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]);(0,r.useEffect)(()=>p,[p]);let f=(0,r.useCallback)(e=>{p(),u.current="",i.current=!0,l(!0),o({command:e,output:""}),d.current.onRunningChange?.(!0,e)},[p]),m=(0,r.useCallback)(()=>{p(),u.current="",i.current=!1,l(!1),o(null),d.current.onRunningChange?.(!1)},[p]);return{live:a,running:s,isRunning:(0,r.useCallback)(()=>i.current,[]),begin:f,finish:m,handleEvent:(0,r.useCallback)(e=>{if("bash_execution_start"===e.type){let t=String(e.command??"");return p(),u.current="",i.current=!0,l(!0),o({command:t,output:""}),d.current.onRunningChange?.(!0,t),!0}if("bash_execution_update"===e.type){let t="string"==typeof e.chunk?e.chunk:"";return!t||(u.current+=t,c.current||(c.current=setTimeout(()=>{c.current=null;let e=u.current;u.current="",e&&o(t=>t?{...t,output:t.output+e}:t)},n)),!0)}return"bash_done"===e.type&&(p(),u.current="",i.current=!1,l(!1),o(null),d.current.onRunningChange?.(!1),d.current.onDone?.(),!0)},[p,n])}}({onRunningChange:(e,t)=>{to.current=e,eh(e),e0(e?{kind:"running_tools",tools:[{id:"bash",name:"bash",args:t}]}:null)}}),tp=(0,r.useRef)(null),tf=(0,r.useRef)(null),tm=(0,r.useRef)(null),tg=(0,r.useRef)(!1),th=(0,r.useRef)(null),ty=(0,r.useRef)(!1),tw=(0,r.useRef)(null),tk=(0,r.useRef)(null),tv=(0,r.useRef)(new Map),tC=(0,r.useRef)(new Map),tb=(0,r.useRef)(new Map),tx=(0,r.useRef)(new Map),t_=(0,r.useRef)(null),tI=(0,r.useRef)([]),tT=(0,r.useRef)(null),tS=(0,r.useRef)(0),tM=(0,r.useRef)(!1),tE=(0,r.useRef)(0),tA=(0,r.useRef)(!1),tR=(0,r.useRef)(!1),t$=(0,r.useRef)(0),tN=(0,r.useRef)(null),tD=(0,r.useRef)(null),tL=(0,r.useRef)(0),tU=(0,r.useRef)(!1);(0,r.useEffect)(()=>{t_.current=et},[et]),(0,r.useEffect)(()=>{tU.current=ef.isStreaming},[ef.isStreaming]),(0,r.useEffect)(()=>{tx.current.clear()},[t?.id]);let tP=e.setNewSessionModel??eT,tj=e.setToolPreset??eM,tO=e.setMemoryTools??eA,tF=eB??M?.context.model??eJ??null,tq=x?eI:tF,tH=(0,r.useCallback)(()=>(0,q.tE)(eS,eE),[eE,eS]),tB=(0,r.useCallback)(e=>e?.length?e.map((e,t)=>{let n=`Attachment ${t+1}: ${e.fileName} (${e.mimeType||"application/octet-stream"}, ${e.size} bytes)`;if(e.extractedText){let t=e.truncated?"\n[The extracted text was truncated before sending.]":"";return`${n}
2
2
  ${t}
3
3
  ${e.extractedText}`.trim()}return`${n}
4
- [Text extraction unavailable: ${e.extractionError??"unsupported file type"}]`}).join("\n\n---\n\n"):"",[]),tW=(0,r.useCallback)(async e=>{let t=await fetch(`/api/agent/${encodeURIComponent(e)}/prepare`,{method:"POST"});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error??`Failed to prepare session (HTTP ${t.status})`)},[]),tJ=(()=>{let e={input:0,output:0,cacheRead:0,cacheWrite:0};for(let t of er){if("assistant"!==t.role)continue;let n=t.usage;n&&(e.input+=n.input??0,e.output+=n.output??0,e.cacheRead+=n.cacheRead??0,e.cacheWrite+=n.cacheWrite??0)}return e.input+e.output+e.cacheRead+e.cacheWrite>0?{tokens:e}:null})(),tK=(0,r.useRef)(!1),tz=(0,r.useCallback)(async()=>{let e=e2.current;if(!e||tK.current||tA.current)return;tK.current=!0,tM.current=!0;let t=0,n=j(e);t=n?n.loadedMessagesCount:50;try{for(;;)try{let n=await fetch(`/api/sessions/${encodeURIComponent(e)}?limit=100&offset=${t}&deferThinking=1&deferMedia=1`);if(!n.ok)break;let r=await n.json();if(e2.current!==e)break;let a=r.context.messages,o=r.context.entryIds??[];if(0===a.length)break;ea(e=>[...a,...e]),es(e=>{let t=[...o,...e];return tI.current=t,t});let s=t+a.length;if(ep(s),tE.current=s,ec(r.hasMore??!1),O(e,a,o,r.hasMore??!1,s),t=s,!r.hasMore)break;await new Promise(e=>setTimeout(e,800))}catch{break}}finally{tK.current=!1,tA.current=!0,tM.current=!1}},[]),tG=(0,r.useCallback)(async(e,t=!1,n=!1,r=!1)=>{var a;let o=null;try{if(t&&X(!0),!n&&!to.current&&!r){let n=j(e);if(n)return ei(n.totalMessages),ec(n.hasMore),ep(n.loadedMessagesCount),ea(n.messages),tI.current=n.entryIds,es(n.entryIds),t_.current=n.leafId,en(n.leafId),tE.current=n.loadedMessagesCount,t&&X(!1),n.hasMore&&!tA.current&&setTimeout(()=>{tz()},1500),null}let s=n?`/api/sessions/${encodeURIComponent(e)}?includeState&deferThinking=1&deferMedia=1`:`/api/sessions/${encodeURIComponent(e)}?limit=50&offset=0&deferThinking=1&deferMedia=1`,l=tD.current;if(l?.sid===e&&!t)return null;l?.controller.abort(W("Session load superseded","AbortError"));let i=new AbortController;o=i,tD.current={sid:e,controller:i};let u=setTimeout(()=>{i.abort(W("Session load timed out after 30 seconds","TimeoutError"))},3e4),c=await fetch(s,{signal:i.signal}).finally(()=>clearTimeout(u));if(e2.current&&e2.current!==e)return null;if(404===c.status)return t&&(U(null),t_.current=null,en(null),ea([]),ee(null)),null;if(!c.ok)throw Error(`HTTP ${c.status}`);let d=await c.json();n?(ei(d.totalMessages??d.context.messages.length),ec(!1)):(ei(d.totalMessages??d.context.messages.length),ec(d.hasMore??!1)),ep(d.context.messages.length),U(d),t_.current=d.leafId,en(d.leafId);let f=d.context.messages,m=G(f),g=new Map,h=Date.now();for(let[t,n]of tv.current)if(n.sessionId===e){if(h-n.createdAt>12e4){tv.current.delete(t);continue}if(n.confirmKey){let e=m.get(n.confirmKey)??0,r=g.get(n.confirmKey)??0;e-r>n.confirmCountAtCreate&&(tv.current.delete(t),g.set(n.confirmKey,r+1))}}tb.current=m;let y=d.context.entryIds??[],w=[...tv.current.values()].filter(t=>V(t,e,y)).map(e=>e.message),k=w.length>0?[...f,...w]:f,v=function(e,t,n){if(0===t.size)return e;let r=!1,a=e.map(e=>{let a=p(e);if(!a)return e;let o=t.get(a);return o?n-o.observedAt>5e3||function(e,t){let n=e.timestamp,r=t.timestamp;if("number"!=typeof n||"number"!=typeof r||n!==r||e.role!==t.role)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(o.message,e)?(t.delete(a),e):(r=!0,o.message):e});return r?a:e}(k,tx.current,Date.now()),b=tC.current.get(e);if(b){for(let[e,t]of b)h-t>12e4&&b.delete(e);0===b.size&&tC.current.delete(e)}let C=b?.size?b:null,x=C?new Set(y):null,_=!!C&&!!x&&[...C.keys()].some(e=>!x.has(e));C&&x&&!_&&tC.current.delete(e);let I=v.length;return!n&&(tE.current>I||_)?(ei(d.totalMessages??d.context.messages.length),ec(d.hasMore??!1)):(ea(e=>(function(e,t){if(e.length!==t.length)return t;let n=!1,r=t.map((t,r)=>Y(e[r],t)?e[r]:(n=!0,t));return n?r:e})(e,v)),tI.current=y,es(y),n?tE.current=I:tE.current=Math.max(tE.current,I),a={sessionId:e,leafId:d.leafId,messages:v,entryIds:y,totalMessages:d.totalMessages??d.context.messages.length,hasMore:!n&&(d.hasMore??!1),loadedMessagesCount:d.context.messages.length},P().entries.set(e,{...a,loadedAt:Date.now()})),eW(e=>{if(!e)return null;let t=d.context.model;return t?.provider===e.provider&&t.modelId===e.modelId?null:e}),ee(null),!d.agentState?.state?.thinkingLevel&&d.context.thinkingLevel&&"off"!==d.context.thinkingLevel&&eD(d.context.thinkingLevel),d.agentState??null}catch(e){if(e instanceof DOMException&&("AbortError"===e.name||"TimeoutError"===e.name)||e instanceof Error&&/aborted without reason|AbortError|Session load (?:timed out|superseded)/i.test(e.message))return null;return ee(String(e)),null}finally{o&&tD.current?.controller===o&&(tD.current=null),t&&X(!1)}},[tz]),tV=(0,r.useRef)(!1),tY=(0,r.useCallback)(async()=>{if(tV.current)return;tV.current=!0;let e=e2.current;if(!e){tV.current=!1;return}try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}?limit=50&offset=${ed}&deferThinking=1&deferMedia=1`);if(!t.ok)return;let n=await t.json(),r=n.context.messages,a=n.context.entryIds??[];ea(e=>[...r,...e]),es(e=>{let t=[...a,...e];return tI.current=t,t}),ep(e=>e+r.length),ec(n.hasMore??!1),O(e,r,a,n.hasMore??!1,ed+r.length)}catch{}finally{tV.current=!1}},[ed]),tQ=(0,r.useCallback)(async e=>{let t=e2.current;if(!t)return[];let n=t_.current,r=n?`?leafId=${encodeURIComponent(n)}`:"";try{let n=await fetch(`/api/sessions/${encodeURIComponent(t)}/shadowed${r}`);if(!n.ok)return[];let a=await n.json(),o=a.groups?.find(t=>t.compactionEntryId===e);return o?.messages??[]}catch{return[]}},[]),tX=(0,r.useCallback)(async(e,t)=>{try{let n=t?`/api/sessions/${encodeURIComponent(e)}/context?leafId=${encodeURIComponent(t)}&deferThinking=1&deferMedia=1`:`/api/sessions/${encodeURIComponent(e)}/context?deferThinking=1&deferMedia=1`,r=await fetch(n);if(!r.ok)throw Error(`HTTP ${r.status}`);let a=await r.json(),o=a.context.messages,s=a.context.entryIds??[],l=G(o),i=new Map,u=Date.now();for(let[t,n]of tv.current)if(n.sessionId===e){if(u-n.createdAt>12e4){tv.current.delete(t);continue}if(n.confirmKey){let e=l.get(n.confirmKey)??0,r=i.get(n.confirmKey)??0;e-r>n.confirmCountAtCreate&&(tv.current.delete(t),i.set(n.confirmKey,r+1))}}tb.current=l;let c=[...tv.current.values()].filter(t=>V(t,e,s)).map(e=>e.message);ea(c.length>0?[...o,...c]:o),tI.current=s,es(s)}catch(e){console.error("Failed to load context:",e)}},[]),tZ=(0,r.useCallback)(async e=>{try{let t=await m(e,{type:"get_tools"});t&&(tj((0,q.ES)(t)),tO((0,q.IB)(t)))}catch(e){console.error("Failed to load tools:",e)}},[tO,tj]),t0=(0,r.useCallback)(async e=>{try{let t=await m(e,{type:"get_commands"});e$(Array.isArray(t?.commands)?t.commands:[])}catch{e$([])}},[]),t1=(0,r.useCallback)((e,t={})=>{e6.current?.close(),e6.current=null;let n=`/api/agent/${encodeURIComponent(e)}/events${t.replay?"?replay=1":""}`;return!function(e){let t=$(e);if("active"===t.snapshot.phase)return S(t,!0),E(t),t.snapshot;let n=Date.now();t.snapshot={..._(e),phase:"active",startedAt:n,lastEventAt:n,isStreaming:!0,streamingMessage:{role:"assistant",content:[]}},E(t),S(t,!0),t.snapshot}(e),new Promise((r,a)=>{let o=!1,s=!1,l=null,i=e=>{if(!o){if(o=!0,clearTimeout(u),e){l?.close(),e6.current===l&&(e6.current=null),a(e);return}r()}},u=setTimeout(()=>{t.requireConnected?i(Error("Timed out waiting for event stream connection")):i()},t.timeoutMs??3e4);e6.current=l=function(e){let{url:t,onEvent:n,onStateChange:r,onFatalError:a,maxReconnectAttempts:o=1/0,reconnectBaseMs:s=1e3,reconnectMaxMs:l=3e4,autoReconnect:i=!0}=e,u="idle",c=new AbortController,d=0,p=null,f=null,m=!1,g=(e,t)=>{t&&(f=t),n(e,t)},h=e=>{u!==e&&(u=e,r?.(e))},w=()=>{null!==p&&(clearTimeout(p),p=null)},k=()=>{if(m)return;if(!i)return void h("error");if(d>=o){h("error"),a?.(Error(`Max reconnect attempts (${o}) reached`));return}let e=Math.min(l,s*2**d);d+=1,h("connecting"),p=setTimeout(()=>{p=null,v()},e)},v=async()=>{if(!m){w(),c=new AbortController,h("connecting");try{let e=await fetch(t,{signal:c.signal,headers:{Accept:"text/event-stream","Cache-Control":"no-cache",...f?{"Last-Event-ID":f}:{}}});if(!e.ok)throw Error(`HTTP ${e.status}: ${e.statusText}`);let n=e.body;if(!n)throw Error("Response has no readable body");let r=n.getReader();if(h("connected"),d=0,await y(r,g,c.signal),c.signal.aborted)try{await r.cancel()}catch{}r.releaseLock(),h("closed"),!m&&i&&k()}catch(e){if(m||e instanceof DOMException&&"AbortError"===e.name)return void h("closed");h("error"),i&&k()}}};return{get state(){return u},connect:()=>{m=!1,d=0,w(),v()},close:()=>{m=!0,w(),c.abort(),h("closed")},get abortController(){return c}}}({url:n,onEvent:t=>{try{let n=JSON.parse(t);if("connected"===n.type&&i(),e2.current!==e)return;tp.current?.(n)}catch{}},onStateChange:t=>{!function(e,t){let n=C().get(e);if(!n)return;let r=n.connectionState;n.connectionState=t,"connected"===t&&"connected"!==r&&(n.snapshot={...n.snapshot,lastEventAt:Date.now(),lastHeartbeatAt:Date.now()},E(n)),"connected"!==t&&"connected"===r&&A(n)}(e,t),"connected"===t&&(s&&(L(e),tf.current?.(e,"sse_reconnected")),s=!0)},reconnectBaseMs:1e3,reconnectMaxMs:3e4}),l.connect()})},[]),t3=(0,r.useCallback)(async(e,t="manual")=>{if(!e||e2.current!==e)return;let n=tS.current;try{let t=await fetch(`/api/agent/${encodeURIComponent(e)}`),r=await t.json().catch(()=>({}));if(e2.current!==e||tS.current!==n)return;r.running?(to.current=!0,eh(!0),e0(a(r.state)),e6.current&&"closed"!==e6.current.state&&"error"!==e6.current.state||(L(e),t1(e,{replay:!0}))):(to.current=!1,e6.current?.close(),e6.current=null,D(e),eh(!1),e0(null),eU(null),em({type:"end"}),F(e),await tG(e,!1,!1,!0)),r.state?.contextUsage!==void 0&&ej(r.state.contextUsage??null),r.state?.systemPrompt!==void 0&&eF(r.state.systemPrompt??null),r.state?.isCompacting!==void 0&&eG(r.state.isCompacting),r.state?.thinkingLevel!==void 0&&eD(r.state.thinkingLevel??"auto"),r.state?.queuedMessages!==void 0&&e3(H(r.state.queuedMessages)),tt(r.state),r.state?.isBashRunning&&tu("")}catch{}},[t1,tG,tt,tu]);(0,r.useEffect)(()=>{tf.current=t3},[t3]),(0,r.useEffect)(()=>{to.current=eg},[eg]),tp.current=(0,r.useCallback)(e=>{let t=e2.current;switch(t&&function(e,t){let n=$(e),r=Date.now();switch(t.type){case"agent_start":if("active"===n.snapshot.phase)return S(n,!0),n.snapshot;return R(n),n.accumulatedText="",n.toolCalls.clear(),n.toolResults.clear(),n.activeToolId=null,n.snapshot={..._(e),phase:"active",startedAt:r,lastEventAt:r,isStreaming:!0,streamingMessage:{role:"assistant",content:[]}},E(n),S(n,!0),n.snapshot;case"message_update":{let e=t.message;if(e?.role==="assistant"){let t=e.content;for(let e of Array.isArray(t)?t:[])"object"==typeof e&&null!==e&&"type"in e&&("text"===e.type?n.accumulatedText=e.text??"":"toolCall"===e.type&&e.toolCallId&&!n.toolCalls.has(e.toolCallId)&&n.toolCalls.set(e.toolCallId,{...e,startedAt:r}))}else{let e=t.assistantMessageEvent;e?.type==="text_delta"?n.accumulatedText+=e.delta??"":e?.type==="text_end"?n.accumulatedText=e.content??n.accumulatedText:(e?.type==="toolcall_start"||e?.type==="toolcall_delta")&&e.id&&!n.toolCalls.has(e.id)&&n.toolCalls.set(e.id,{type:"toolCall",toolCallId:e.id,toolName:e.toolName??"tool",input:{},startedAt:r})}return S(n,!1),n.snapshot}case"tool_execution_start":{let e="string"==typeof t.toolCallId?t.toolCallId:"",a="string"==typeof t.toolName?t.toolName:"tool",o=t.input??{};if(!e)return n.snapshot;let s=n.toolCalls.get(e);return n.toolCalls.set(e,{type:"toolCall",toolCallId:e,toolName:a,input:s&&Object.keys(s.input).length>0?s.input:o,startedAt:s?.startedAt??r}),n.activeToolId=e,R(n),n.activeToolId&&(n.toolProgressTimer=setInterval(()=>S(n,!0),1e3)),S(n,!0),n.snapshot}case"tool_execution_end":{let e="string"==typeof t.toolCallId?t.toolCallId:"",a="string"==typeof t.toolName?t.toolName:"tool",o="string"==typeof t.result?t.result:JSON.stringify(t.result??"");if(e){let s=n.toolCalls.get(e);s&&n.toolCalls.set(e,{...s,endedAt:r}),n.toolResults.set(e,{role:"toolResult",toolCallId:e,toolName:a,content:[{type:"text",text:o}],isError:!!t.isError,timestamp:r}),n.activeToolId===e&&(n.activeToolId=null,R(n))}return S(n,!0),n.snapshot}case"message_end":return T(n),S(n,!0),n.snapshot;case"agent_end":{if(T(n),R(n),n.activeToolId=null,!0===t.willRetry)return n.accumulatedText="",n.toolCalls.clear(),n.toolResults.clear(),n.snapshot={...n.snapshot,phase:"active",lastEventAt:r,accumulatedText:"",toolCalls:[],toolResults:[],statusText:null,streamingMessage:null,isStreaming:!0,error:null},E(n),I(e,{type:"snapshot-updated",snapshot:n.snapshot}),n.snapshot;A(n);let a="string"==typeof t.error?t.error:null;return n.snapshot={...n.snapshot,phase:a?"error":"completed",isStreaming:!1,streamingMessage:null,statusText:null,error:a},I(e,a?{type:"error",snapshot:n.snapshot}:{type:"completed",snapshot:n.snapshot}),n.snapshot}case"heartbeat":return n.snapshot={...n.snapshot,lastHeartbeatAt:r},n.snapshot;default:return n.snapshot}}(t,e),"heartbeat"!==e.type&&(tL.current=Date.now()),e.type){case"prompt_admitted":case"agent_start":e5(null),to.current=!0,eh(!0),e0({kind:"waiting_model"}),em({type:"start"});break;case"agent_end":if(!0===e.willRetry){to.current=!0,eh(!0),e0({kind:"waiting_model"});break}if(to.current=!1,eh(!1),e0(null),eU(null),em({type:"end"}),t){tN.current&&clearTimeout(tN.current);let e=tS.current,n=0,r=async()=>{if(e2.current!==t||to.current||tS.current!==e)return;F(t),await tG(t,!1,!1,!0);let a=B[n++];void 0===a||e2.current!==t||to.current||tS.current!==e||(tN.current=setTimeout(()=>{tN.current=null,r()},a))};r(),fetch(`/api/agent/${encodeURIComponent(t)}`).then(e=>e.json()).then(e=>{e.state?.contextUsage!==void 0&&ej(e.state.contextUsage??null),e.state?.systemPrompt!==void 0&&eF(e.state.systemPrompt??null),e.state?.isCompacting!==void 0&&eG(e.state.isCompacting)}).catch(()=>{})}l?.();break;case"agent_settled":e0(null),eU(null),to.current&&(to.current=!1,eh(!1),em({type:"end"}));break;case"message_start":case"message_update":{let t=e.message;if(t?.role==="user")break;to.current||(to.current=!0,eh(!0),e0({kind:"waiting_model"}));let n=e.assistantMessageEvent;t?.role==="assistant"?em({type:"snapshot",message:o(t)}):n&&em({type:"delta",event:n}),e0(null);break}case"message_end":{let n=e.message,r="string"==typeof e.__entryId?e.__entryId:null,a=to.current;if(n&&"user"!==n.role){"assistant"===n.role&&"error"===n.stopReason&&n.errorMessage?.trim()&&e5(`Model response failed: ${n.errorMessage.trim()}`);let e=o(n),a=p(e);if(a&&tx.current.set(a,{observedAt:Date.now(),message:e}),!(r&&tI.current.includes(r))){if(t&&r){let e=tC.current.get(t)??new Map;e.set(r,Date.now()),tC.current.set(t,e)}ea(t=>t.some(t=>Y(t,e))?t:[...t,e]),r&&es(e=>{if(e.includes(r))return e;let t=[...e,r];return tI.current=t,t})}}a&&(em({type:"reset"}),e0({kind:"waiting_model"}));break}case"replay_gap":t&&(F(t),tG(t,!1,!1,!0));break;case"prompt_done":if(!to.current)break;t3(e2.current??"","prompt_done");break;case"prompt_error":{let n="string"==typeof e.error&&e.error.trim()?e.error.trim():"The model request failed before producing a response.";if(to.current=!1,eh(!1),e0(null),eU(null),em({type:"end"}),e6.current?.close(),e6.current=null,t){for(let[e,n]of(D(t),tv.current))n.sessionId===t&&"prompt"===n.kind&&tv.current.delete(e);F(t),tG(t,!1,!1,!0)}e5(`Model request failed: ${n}`),l?.();break}case"tool_execution_start":{let t=e.toolCallId,n=e.toolName,r=e.args,a="bash"===n&&"string"==typeof r?.command?r.command:void 0;e0(e=>{let r=e?.kind==="running_tools"?[...e.tools]:[];return r.some(e=>e.id===t)||r.push({id:t,name:n,args:a}),{kind:"running_tools",tools:r}});break}case"tool_execution_update":{let t=e.toolCallId,n=e.toolName,r=function(e){if(!d(e))return null;let t=e.content;if(!Array.isArray(t))return null;let n=t.filter(e=>d(e)&&"text"===e.type&&"string"==typeof e.text).map(e=>e.text).join("\n").split(/\r?\n/),r="";for(let e=n.length-1;e>=0&&!(r=n[e].trim());e-=1);if(!r)return null;let a=r.replace(/\s+/g," ");return a.length<=500?a:`...${a.slice(-497)}`}(e.partialResult);if(!t)break;e0(e=>{let a=e?.kind==="running_tools"?[...e.tools]:[],o=a.find(e=>e.id===t),s={id:t,name:n||o?.name||"tool",args:o?.args,progress:r??o?.progress};return{kind:"running_tools",tools:[...a.filter(e=>e.id!==t),s]}});break}case"tool_execution_end":{let t=e.toolCallId;e0(e=>{if(e?.kind!=="running_tools")return e;let n=e.tools.filter(e=>e.id!==t);return 0===n.length?{kind:"waiting_model"}:{kind:"running_tools",tools:n}});break}case"extension_ui_request":case"extension_error":tn(e);break;case"bash_execution_start":case"bash_execution_update":td(e);break;case"bash_done":{td(e);let t=e2.current;t&&(F(t),tG(t,!1,!1,!0));break}case"queue_update":e3(H({steering:Array.isArray(e.steering)?e.steering:[],followUp:Array.isArray(e.followUp)?e.followUp:[]}));break;case"auto_retry_start":e5(null),to.current=!0,eh(!0),e0({kind:"waiting_model"}),eU({attempt:e.attempt,maxAttempts:e.maxAttempts,errorMessage:e.errorMessage});break;case"auto_retry_end":eU(null),!1===e.success&&"string"==typeof e.finalError&&e.finalError.trim()?e5(`Model response failed after retries: ${e.finalError.trim()}`):!0===e.success&&e5(null);break;case"auto_compaction_start":case"compaction_start":eG(!0),eY(null);break;case"auto_compaction_end":case"compaction_end":eG(!1),e.errorMessage?eY(e.errorMessage):!e.aborted&&e2.current&&tG(e2.current)}},[tG,l,t3,tn,td]);let t4=(0,r.useCallback)(async(e,r,a,o)=>{if(!e.trim()&&!r?.length&&!a?.length||eg)return;tS.current+=1;let s=tB(a),l=e.trim()?s?`${e}
4
+ [Text extraction unavailable: ${e.extractionError??"unsupported file type"}]`}).join("\n\n---\n\n"):"",[]),tW=(0,r.useCallback)(async e=>{let t=await fetch(`/api/agent/${encodeURIComponent(e)}/prepare`,{method:"POST"});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error??`Failed to prepare session (HTTP ${t.status})`)},[]),tJ=(()=>{let e={input:0,output:0,cacheRead:0,cacheWrite:0};for(let t of er){if("assistant"!==t.role)continue;let n=t.usage;n&&(e.input+=n.input??0,e.output+=n.output??0,e.cacheRead+=n.cacheRead??0,e.cacheWrite+=n.cacheWrite??0)}return e.input+e.output+e.cacheRead+e.cacheWrite>0?{tokens:e}:null})(),tK=(0,r.useRef)(!1),tz=(0,r.useCallback)(async()=>{let e=e2.current;if(!e||tK.current||tA.current)return;tK.current=!0,tM.current=!0;let t=0,n=j(e);t=n?n.loadedMessagesCount:50;try{for(;;)try{let n=await fetch(`/api/sessions/${encodeURIComponent(e)}?limit=100&offset=${t}&deferThinking=1&deferMedia=1`);if(!n.ok)break;let r=await n.json();if(e2.current!==e)break;let a=r.context.messages,o=r.context.entryIds??[];if(0===a.length)break;ea(e=>[...a,...e]),es(e=>{let t=[...o,...e];return tI.current=t,t});let s=t+a.length;if(ep(s),tE.current=s,ec(r.hasMore??!1),O(e,a,o,r.hasMore??!1,s),t=s,!r.hasMore)break;await new Promise(e=>setTimeout(e,800))}catch{break}}finally{tK.current=!1,tA.current=!0,tM.current=!1}},[]),tG=(0,r.useCallback)(async(e,t=!1,n=!1,r=!1)=>{var a;let o=null;try{if(t&&X(!0),!n&&!to.current&&!r){let n=j(e);if(n)return ei(n.totalMessages),ec(n.hasMore),ep(n.loadedMessagesCount),ea(n.messages),tI.current=n.entryIds,es(n.entryIds),t_.current=n.leafId,en(n.leafId),tE.current=n.loadedMessagesCount,t&&X(!1),n.hasMore&&!tA.current&&setTimeout(()=>{tz()},1500),null}let s=n?`/api/sessions/${encodeURIComponent(e)}?includeState&deferThinking=1&deferMedia=1`:`/api/sessions/${encodeURIComponent(e)}?limit=50&offset=0&deferThinking=1&deferMedia=1`,l=tD.current;if(l?.sid===e&&!t)return null;l?.controller.abort(W("Session load superseded","AbortError"));let i=new AbortController;o=i,tD.current={sid:e,controller:i};let u=setTimeout(()=>{i.abort(W("Session load timed out after 30 seconds","TimeoutError"))},3e4),c=await fetch(s,{signal:i.signal}).finally(()=>clearTimeout(u));if(e2.current&&e2.current!==e)return null;if(404===c.status)return t&&(U(null),t_.current=null,en(null),ea([]),ee(null)),null;if(!c.ok)throw Error(`HTTP ${c.status}`);let d=await c.json();n?(ei(d.totalMessages??d.context.messages.length),ec(!1)):(ei(d.totalMessages??d.context.messages.length),ec(d.hasMore??!1)),ep(d.context.messages.length),U(d),t_.current=d.leafId,en(d.leafId);let f=d.context.messages,m=G(f),g=new Map,h=Date.now();for(let[t,n]of tv.current)if(n.sessionId===e){if(h-n.createdAt>12e4){tv.current.delete(t);continue}if(n.confirmKey){let e=m.get(n.confirmKey)??0,r=g.get(n.confirmKey)??0;e-r>n.confirmCountAtCreate&&(tv.current.delete(t),g.set(n.confirmKey,r+1))}}tC.current=m;let y=d.context.entryIds??[],w=[...tv.current.values()].filter(t=>V(t,e,y)).map(e=>e.message),k=w.length>0?[...f,...w]:f,v=function(e,t,n){if(0===t.size)return e;let r=!1,a=e.map(e=>{let a=p(e);if(!a)return e;let o=t.get(a);return o?n-o.observedAt>5e3||function(e,t){let n=e.timestamp,r=t.timestamp;if("number"!=typeof n||"number"!=typeof r||n!==r||e.role!==t.role)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(o.message,e)?(t.delete(a),e):(r=!0,o.message):e});return r?a:e}(k,tx.current,Date.now()),C=tb.current.get(e);if(C){for(let[e,t]of C)h-t>12e4&&C.delete(e);0===C.size&&tb.current.delete(e)}let b=C?.size?C:null,x=b?new Set(y):null,_=!!b&&!!x&&[...b.keys()].some(e=>!x.has(e));b&&x&&!_&&tb.current.delete(e);let I=v.length;return!n&&(tE.current>I||_)?(ei(d.totalMessages??d.context.messages.length),ec(d.hasMore??!1)):(ea(e=>(function(e,t){if(e.length!==t.length)return t;let n=!1,r=t.map((t,r)=>Y(e[r],t)?e[r]:(n=!0,t));return n?r:e})(e,v)),tI.current=y,es(y),n?tE.current=I:tE.current=Math.max(tE.current,I),a={sessionId:e,leafId:d.leafId,messages:v,entryIds:y,totalMessages:d.totalMessages??d.context.messages.length,hasMore:!n&&(d.hasMore??!1),loadedMessagesCount:d.context.messages.length},P().entries.set(e,{...a,loadedAt:Date.now()})),eW(e=>{if(!e)return null;let t=d.context.model;return t?.provider===e.provider&&t.modelId===e.modelId?null:e}),ee(null),!d.agentState?.state?.thinkingLevel&&d.context.thinkingLevel&&"off"!==d.context.thinkingLevel&&eD(d.context.thinkingLevel),d.agentState??null}catch(e){if(e instanceof DOMException&&("AbortError"===e.name||"TimeoutError"===e.name)||e instanceof Error&&/aborted without reason|AbortError|Session load (?:timed out|superseded)/i.test(e.message))return null;return ee(String(e)),null}finally{o&&tD.current?.controller===o&&(tD.current=null),t&&X(!1)}},[tz]),tV=(0,r.useRef)(!1),tY=(0,r.useCallback)(async()=>{if(tV.current)return;tV.current=!0;let e=e2.current;if(!e){tV.current=!1;return}try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}?limit=50&offset=${ed}&deferThinking=1&deferMedia=1`);if(!t.ok)return;let n=await t.json(),r=n.context.messages,a=n.context.entryIds??[];ea(e=>[...r,...e]),es(e=>{let t=[...a,...e];return tI.current=t,t}),ep(e=>e+r.length),ec(n.hasMore??!1),O(e,r,a,n.hasMore??!1,ed+r.length)}catch{}finally{tV.current=!1}},[ed]),tQ=(0,r.useCallback)(async e=>{let t=e2.current;if(!t)return[];let n=t_.current,r=n?`?leafId=${encodeURIComponent(n)}`:"";try{let n=await fetch(`/api/sessions/${encodeURIComponent(t)}/shadowed${r}`);if(!n.ok)return[];let a=await n.json(),o=a.groups?.find(t=>t.compactionEntryId===e);return o?.messages??[]}catch{return[]}},[]),tX=(0,r.useCallback)(async(e,t)=>{try{let n=t?`/api/sessions/${encodeURIComponent(e)}/context?leafId=${encodeURIComponent(t)}&deferThinking=1&deferMedia=1`:`/api/sessions/${encodeURIComponent(e)}/context?deferThinking=1&deferMedia=1`,r=await fetch(n);if(!r.ok)throw Error(`HTTP ${r.status}`);let a=await r.json(),o=a.context.messages,s=a.context.entryIds??[],l=G(o),i=new Map,u=Date.now();for(let[t,n]of tv.current)if(n.sessionId===e){if(u-n.createdAt>12e4){tv.current.delete(t);continue}if(n.confirmKey){let e=l.get(n.confirmKey)??0,r=i.get(n.confirmKey)??0;e-r>n.confirmCountAtCreate&&(tv.current.delete(t),i.set(n.confirmKey,r+1))}}tC.current=l;let c=[...tv.current.values()].filter(t=>V(t,e,s)).map(e=>e.message);ea(c.length>0?[...o,...c]:o),tI.current=s,es(s)}catch(e){console.error("Failed to load context:",e)}},[]),tZ=(0,r.useCallback)(async e=>{try{let t=await m(e,{type:"get_tools"});t&&(tj((0,q.ES)(t)),tO((0,q.IB)(t)))}catch(e){console.error("Failed to load tools:",e)}},[tO,tj]),t0=(0,r.useCallback)(async e=>{try{let t=await m(e,{type:"get_commands"});e$(Array.isArray(t?.commands)?t.commands:[])}catch{e$([])}},[]),t1=(0,r.useCallback)((e,t={})=>{e6.current?.close(),e6.current=null;let n=`/api/agent/${encodeURIComponent(e)}/events${t.replay?"?replay=1":""}`;return!function(e){let t=$(e);if("active"===t.snapshot.phase)return S(t,!0),E(t),t.snapshot;let n=Date.now();t.snapshot={..._(e),phase:"active",startedAt:n,lastEventAt:n,isStreaming:!0,streamingMessage:{role:"assistant",content:[]}},E(t),S(t,!0),t.snapshot}(e),new Promise((r,a)=>{let o=!1,s=!1,l=null,i=e=>{if(!o){if(o=!0,clearTimeout(u),e){l?.close(),e6.current===l&&(e6.current=null),a(e);return}r()}},u=setTimeout(()=>{t.requireConnected?i(Error("Timed out waiting for event stream connection")):i()},t.timeoutMs??3e4);e6.current=l=function(e){let{url:t,onEvent:n,onStateChange:r,onFatalError:a,maxReconnectAttempts:o=1/0,reconnectBaseMs:s=1e3,reconnectMaxMs:l=3e4,autoReconnect:i=!0}=e,u="idle",c=new AbortController,d=0,p=null,f=null,m=!1,g=(e,t)=>{t&&(f=t),n(e,t)},h=e=>{u!==e&&(u=e,r?.(e))},w=()=>{null!==p&&(clearTimeout(p),p=null)},k=()=>{if(m)return;if(!i)return void h("error");if(d>=o){h("error"),a?.(Error(`Max reconnect attempts (${o}) reached`));return}let e=Math.min(l,s*2**d);d+=1,h("connecting"),p=setTimeout(()=>{p=null,v()},e)},v=async()=>{if(!m){w(),c=new AbortController,h("connecting");try{let e=await fetch(t,{signal:c.signal,headers:{Accept:"text/event-stream","Cache-Control":"no-cache",...f?{"Last-Event-ID":f}:{}}});if(!e.ok)throw Error(`HTTP ${e.status}: ${e.statusText}`);let n=e.body;if(!n)throw Error("Response has no readable body");let r=n.getReader();if(h("connected"),d=0,await y(r,g,c.signal),c.signal.aborted)try{await r.cancel()}catch{}r.releaseLock(),h("closed"),!m&&i&&k()}catch(e){if(m||e instanceof DOMException&&"AbortError"===e.name)return void h("closed");h("error"),i&&k()}}};return{get state(){return u},connect:()=>{m=!1,d=0,w(),v()},close:()=>{m=!0,w(),c.abort(),h("closed")},get abortController(){return c}}}({url:n,onEvent:t=>{try{let n=JSON.parse(t);if("connected"===n.type&&i(),e2.current!==e)return;tp.current?.(n)}catch{}},onStateChange:t=>{!function(e,t){let n=b().get(e);if(!n)return;let r=n.connectionState;n.connectionState=t,"connected"===t&&"connected"!==r&&(n.snapshot={...n.snapshot,lastEventAt:Date.now(),lastHeartbeatAt:Date.now()},E(n)),"connected"!==t&&"connected"===r&&A(n)}(e,t),"connected"===t&&(s&&(L(e),tf.current?.(e,"sse_reconnected")),s=!0)},reconnectBaseMs:1e3,reconnectMaxMs:3e4}),l.connect()})},[]),t3=(0,r.useCallback)(async(e,t="manual")=>{if(!e||e2.current!==e)return;let n=tS.current;try{let t=await fetch(`/api/agent/${encodeURIComponent(e)}`),r=await t.json().catch(()=>({}));if(e2.current!==e||tS.current!==n)return;r.running?(to.current=!0,eh(!0),e0(a(r.state)),e6.current&&"closed"!==e6.current.state&&"error"!==e6.current.state||(L(e),t1(e,{replay:!0}))):(to.current=!1,e6.current?.close(),e6.current=null,D(e),eh(!1),e0(null),eU(null),em({type:"end"}),F(e),await tG(e,!1,!1,!0)),r.state?.contextUsage!==void 0&&ej(r.state.contextUsage??null),r.state?.systemPrompt!==void 0&&eF(r.state.systemPrompt??null),r.state?.isCompacting!==void 0&&eG(r.state.isCompacting),r.state?.thinkingLevel!==void 0&&eD(r.state.thinkingLevel??"auto"),r.state?.queuedMessages!==void 0&&e3(H(r.state.queuedMessages)),tt(r.state),r.state?.isBashRunning&&tu("")}catch{}},[t1,tG,tt,tu]);(0,r.useEffect)(()=>{tf.current=t3},[t3]),(0,r.useEffect)(()=>{to.current=eg},[eg]),tp.current=(0,r.useCallback)(e=>{let t=e2.current;switch(t&&function(e,t){let n=$(e),r=Date.now();switch(t.type){case"agent_start":if("active"===n.snapshot.phase)return S(n,!0),n.snapshot;return R(n),n.accumulatedText="",n.toolCalls.clear(),n.toolResults.clear(),n.activeToolId=null,n.snapshot={..._(e),phase:"active",startedAt:r,lastEventAt:r,isStreaming:!0,streamingMessage:{role:"assistant",content:[]}},E(n),S(n,!0),n.snapshot;case"message_update":{let e=t.message;if(e?.role==="assistant"){let t=e.content;for(let e of Array.isArray(t)?t:[])"object"==typeof e&&null!==e&&"type"in e&&("text"===e.type?n.accumulatedText=e.text??"":"toolCall"===e.type&&e.toolCallId&&!n.toolCalls.has(e.toolCallId)&&n.toolCalls.set(e.toolCallId,{...e,startedAt:r}))}else{let e=t.assistantMessageEvent;e?.type==="text_delta"?n.accumulatedText+=e.delta??"":e?.type==="text_end"?n.accumulatedText=e.content??n.accumulatedText:(e?.type==="toolcall_start"||e?.type==="toolcall_delta")&&e.id&&!n.toolCalls.has(e.id)&&n.toolCalls.set(e.id,{type:"toolCall",toolCallId:e.id,toolName:e.toolName??"tool",input:{},startedAt:r})}return S(n,!1),n.snapshot}case"tool_execution_start":{let e="string"==typeof t.toolCallId?t.toolCallId:"",a="string"==typeof t.toolName?t.toolName:"tool",o=t.input??{};if(!e)return n.snapshot;let s=n.toolCalls.get(e);return n.toolCalls.set(e,{type:"toolCall",toolCallId:e,toolName:a,input:s&&Object.keys(s.input).length>0?s.input:o,startedAt:s?.startedAt??r}),n.activeToolId=e,R(n),n.activeToolId&&(n.toolProgressTimer=setInterval(()=>S(n,!0),1e3)),S(n,!0),n.snapshot}case"tool_execution_end":{let e="string"==typeof t.toolCallId?t.toolCallId:"",a="string"==typeof t.toolName?t.toolName:"tool",o="string"==typeof t.result?t.result:JSON.stringify(t.result??"");if(e){let s=n.toolCalls.get(e);s&&n.toolCalls.set(e,{...s,endedAt:r}),n.toolResults.set(e,{role:"toolResult",toolCallId:e,toolName:a,content:[{type:"text",text:o}],isError:!!t.isError,timestamp:r}),n.activeToolId===e&&(n.activeToolId=null,R(n))}return S(n,!0),n.snapshot}case"message_end":return T(n),S(n,!0),n.snapshot;case"agent_end":{if(T(n),R(n),n.activeToolId=null,!0===t.willRetry)return n.accumulatedText="",n.toolCalls.clear(),n.toolResults.clear(),n.snapshot={...n.snapshot,phase:"active",lastEventAt:r,accumulatedText:"",toolCalls:[],toolResults:[],statusText:null,streamingMessage:null,isStreaming:!0,error:null},E(n),I(e,{type:"snapshot-updated",snapshot:n.snapshot}),n.snapshot;A(n);let a="string"==typeof t.error?t.error:null;return n.snapshot={...n.snapshot,phase:a?"error":"completed",isStreaming:!1,streamingMessage:null,statusText:null,error:a},I(e,a?{type:"error",snapshot:n.snapshot}:{type:"completed",snapshot:n.snapshot}),n.snapshot}case"heartbeat":return n.snapshot={...n.snapshot,lastHeartbeatAt:r},n.snapshot;default:return n.snapshot}}(t,e),"heartbeat"!==e.type&&(tL.current=Date.now()),e.type){case"prompt_admitted":case"agent_start":e5(null),to.current=!0,eh(!0),e0({kind:"waiting_model"}),em({type:"start"});break;case"agent_end":if(!0===e.willRetry){to.current=!0,eh(!0),e0({kind:"waiting_model"});break}if(to.current=!1,eh(!1),e0(null),eU(null),em({type:"end"}),t){tN.current&&clearTimeout(tN.current);let e=tS.current,n=0,r=async()=>{if(e2.current!==t||to.current||tS.current!==e)return;F(t),await tG(t,!1,!1,!0);let a=B[n++];void 0===a||e2.current!==t||to.current||tS.current!==e||(tN.current=setTimeout(()=>{tN.current=null,r()},a))};r(),fetch(`/api/agent/${encodeURIComponent(t)}`).then(e=>e.json()).then(e=>{e.state?.contextUsage!==void 0&&ej(e.state.contextUsage??null),e.state?.systemPrompt!==void 0&&eF(e.state.systemPrompt??null),e.state?.isCompacting!==void 0&&eG(e.state.isCompacting)}).catch(()=>{})}l?.();break;case"agent_settled":e0(null),eU(null),to.current&&(to.current=!1,eh(!1),em({type:"end"}));break;case"message_start":case"message_update":{let t=e.message;if(t?.role==="user")break;to.current||(to.current=!0,eh(!0),e0({kind:"waiting_model"}));let n=e.assistantMessageEvent;t?.role==="assistant"?em({type:"snapshot",message:o(t)}):n&&em({type:"delta",event:n}),e0(null);break}case"message_end":{let n=e.message,r="string"==typeof e.__entryId?e.__entryId:null,a=to.current;if(n&&"user"!==n.role){"assistant"===n.role&&"error"===n.stopReason&&n.errorMessage?.trim()&&e5(`Model response failed: ${n.errorMessage.trim()}`);let e=o(n),a=p(e);if(a&&tx.current.set(a,{observedAt:Date.now(),message:e}),!(r&&tI.current.includes(r))){if(t&&r){let e=tb.current.get(t)??new Map;e.set(r,Date.now()),tb.current.set(t,e)}ea(t=>t.some(t=>Y(t,e))?t:[...t,e]),r&&es(e=>{if(e.includes(r))return e;let t=[...e,r];return tI.current=t,t})}}a&&(em({type:"reset"}),e0({kind:"waiting_model"}));break}case"replay_gap":t&&(F(t),tG(t,!1,!1,!0));break;case"prompt_done":if(!to.current)break;t3(e2.current??"","prompt_done");break;case"prompt_error":{let n="string"==typeof e.error&&e.error.trim()?e.error.trim():"The model request failed before producing a response.";if(to.current=!1,eh(!1),e0(null),eU(null),em({type:"end"}),e6.current?.close(),e6.current=null,t){for(let[e,n]of(D(t),tv.current))n.sessionId===t&&"prompt"===n.kind&&tv.current.delete(e);F(t),tG(t,!1,!1,!0)}e5(`Model request failed: ${n}`),l?.();break}case"tool_execution_start":{let t=e.toolCallId,n=e.toolName,r=e.args,a="bash"===n&&"string"==typeof r?.command?r.command:void 0;e0(e=>{let r=e?.kind==="running_tools"?[...e.tools]:[];return r.some(e=>e.id===t)||r.push({id:t,name:n,args:a}),{kind:"running_tools",tools:r}});break}case"tool_execution_update":{let t=e.toolCallId,n=e.toolName,r=function(e){if(!d(e))return null;let t=e.content;if(!Array.isArray(t))return null;let n=t.filter(e=>d(e)&&"text"===e.type&&"string"==typeof e.text).map(e=>e.text).join("\n").split(/\r?\n/),r="";for(let e=n.length-1;e>=0&&!(r=n[e].trim());e-=1);if(!r)return null;let a=r.replace(/\s+/g," ");return a.length<=500?a:`...${a.slice(-497)}`}(e.partialResult);if(!t)break;e0(e=>{let a=e?.kind==="running_tools"?[...e.tools]:[],o=a.find(e=>e.id===t),s={id:t,name:n||o?.name||"tool",args:o?.args,progress:r??o?.progress};return{kind:"running_tools",tools:[...a.filter(e=>e.id!==t),s]}});break}case"tool_execution_end":{let t=e.toolCallId;e0(e=>{if(e?.kind!=="running_tools")return e;let n=e.tools.filter(e=>e.id!==t);return 0===n.length?{kind:"waiting_model"}:{kind:"running_tools",tools:n}});break}case"extension_ui_request":case"extension_error":tn(e);break;case"bash_execution_start":case"bash_execution_update":td(e);break;case"bash_done":{td(e);let t=e2.current;t&&(F(t),tG(t,!1,!1,!0));break}case"queue_update":e3(H({steering:Array.isArray(e.steering)?e.steering:[],followUp:Array.isArray(e.followUp)?e.followUp:[]}));break;case"auto_retry_start":e5(null),to.current=!0,eh(!0),e0({kind:"waiting_model"}),eU({attempt:e.attempt,maxAttempts:e.maxAttempts,errorMessage:e.errorMessage});break;case"auto_retry_end":eU(null),!1===e.success&&"string"==typeof e.finalError&&e.finalError.trim()?e5(`Model response failed after retries: ${e.finalError.trim()}`):!0===e.success&&e5(null);break;case"auto_compaction_start":case"compaction_start":eG(!0),eY(null);break;case"auto_compaction_end":case"compaction_end":eG(!1),e.errorMessage?eY(e.errorMessage):!e.aborted&&e2.current&&tG(e2.current)}},[tG,l,t3,tn,td]);let t4=(0,r.useCallback)(async(e,r,a,o)=>{if(!e.trim()&&!r?.length&&!a?.length||eg)return;tS.current+=1;let s=tB(a),l=e.trim()?s?`${e}
5
5
 
6
6
  Attached document text:
7
7
 
8
8
  ${s}`:e:s?`Attached document text:
9
9
 
10
- ${s}`:"",u=[],c=x?n:t?.cwd??M?.info?.cwd;if(r?.length&&c)try{u=await h(c,r)}catch(e){e5(e instanceof Error?e.message:String(e));return}let d=u.length?u.map(e=>{var t;return{type:"image",path:e.path,mimeType:e.mimeType,name:e.name,source:{type:"url",url:(t=e.path,`/api/files/${(0,g.HG)(t)}?type=read`),media_type:e.mimeType}}}):r?.map(e=>({type:"image",source:{type:"base64",media_type:e.mimeType,data:e.data}})),p={role:"user",content:d?.length?[...l.trim()?[{type:"text",text:l}]:[],...d]:l,timestamp:Date.now()},y=J(),w=x?null:t?.id??null;w&&F(w);let k=t_.current,v=z(p.content);tv.current.set(y,{localId:y,sessionId:w??"__new__",leafId:k,message:p,createdAt:Date.now(),kind:"prompt",confirmKey:v,confirmCountAtCreate:x?0:v?tb.current.get(v)??0:0}),ea(e=>[...e,p]),e5(null),to.current=!0,eh(!0),e0({kind:"waiting_model"}),em({type:"start"}),ty.current=!0;let C=ek.find(e=>e.provider===tF?.provider&&e.id===tF?.modelId)?.input,_=!C||0===C.length||C.includes("image")?r?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})):void 0;try{if(x&&n){eI&&eK(eI);let t=o??tH(),r=await fetch("/api/agent/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:n,type:"prompt",message:l,toolNames:t,deferPrompt:!0,..._?.length?{images:_}:{},...eI?{provider:eI.provider,modelId:eI.modelId}:{},..."auto"!==eN?{thinkingLevel:eN}:{}})}),a=await r.json().catch(()=>({}));if(!r.ok||a.error||!a.sessionId)throw Error(a.error??`HTTP ${r.status}`);let s=a.sessionId;e2.current=s;let u=tv.current.get(y);u&&(u.sessionId=s),tm.current?.(),tm.current=N(s,()=>{e2.current===s&&(eh(!1),e0(null))}),tT.current=s,await t1(s,{requireConnected:!0,timeoutMs:1e4}),await m(s,{type:"prompt",message:l,toolNames:t,..._?.length?{images:_}:{}}),i?.({id:s,path:"",cwd:n,name:void 0,created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:1,firstMessage:e})}else if(t){let e=o??tH();await tW(t.id),tm.current?.(),tm.current=N(t.id,()=>{e2.current===t.id&&(eh(!1),e0(null))}),await t1(t.id,{requireConnected:!0,timeoutMs:1e4}),await m(t.id,{type:"prompt",message:l,toolNames:e,leafId:k,...tF?{provider:tF.provider,modelId:tF.modelId}:{},..."auto"!==eN?{thinkingLevel:eN}:{},..._?.length?{images:_}:{}})}}catch(n){let t=e2.current;if(tv.current.delete(y),ea(e=>e.filter(e=>e!==p)),n instanceof f&&(409===n.status||"SESSION_BUSY"===n.code)){e5("This session is already running in another tab. Showing that active run instead."),to.current=!0,eh(!0),e0({kind:"waiting_model"}),em({type:"start"}),t&&(e6.current?.close(),e6.current=null,L(t),t1(t,{replay:!0}),tf.current?.(t,"prompt_conflict"));return}if(console.error("Failed to send message:",n),x&&e2.current){let e=e2.current;e2.current=null,tT.current=null,fetch(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{})}b?.current&&e.trim()&&b.current.insertIfEmpty(e),b?.current&&r?.length&&b.current.addBase64Images?.(r.map(({data:e,mimeType:t})=>({data:e,mimeType:t}))),e5(n instanceof Error?n.message:String(n)),e6.current?.close(),e6.current=null,t&&D(t),to.current=!1,eh(!1),e0(null),em({type:"end"})}},[x,n,eI,tH,eN,t,M?.info?.cwd,eg,t1,i,tB,ek,tF,tW,b]),t5=(0,r.useCallback)(async()=>{let e=e2.current;if(!e)return;let t=ti();to.current=!1,tc(),e5(null),eh(!1),e0(null),em({type:"end"}),e6.current?.close(),e6.current=null,D(e),F(e);try{await m(e,{type:t?"abort_bash":"abort"}),await tG(e,!1,!1,!0)}catch(t){console.error("Failed to abort:",t),await tG(e,!1,!1,!0)}finally{t&&tc()}},[tc,ti,tG]),t6=(0,r.useCallback)(async(e,t)=>{let n=e2.current,r=e.trim();if(n&&r){e5(null),tu(r);try{await m(n,{type:"bash",command:r,excludeFromContext:t})}catch(e){e5(e instanceof Error?e.message:String(e))}finally{tc(),F(n),await tG(n,!1,!1,!0)}}},[tu,tc,tG]),t2=(0,r.useCallback)(async e=>{let t=e2.current;if(t){eH(e);try{let{cancelled:n,newSessionId:r}=await m(t,{type:"fork",entryId:e})??{};!n&&r&&u?.(r)}catch(e){console.error("Fork failed:",e)}finally{eH(null)}}},[u]),t8=(0,r.useCallback)(async e=>{let r=e2.current,a=M?.info?.cwd??t?.cwd??n??null;if(!r||!a)return{ok:!1,error:"No active session to fork"};if(to.current)return{ok:!1,error:"Agent is still running"};try{let t=tH(),n=await fetch("/api/agent/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,type:"prompt",parentSessionId:r,deferPrompt:!0,toolNames:t,...tF?{provider:tF.provider,modelId:tF.modelId}:{},..."auto"!==eN?{thinkingLevel:eN}:{}})}),o=await n.json().catch(()=>({}));if(!n.ok||o.error||!o.sessionId)return{ok:!1,error:o.error??`HTTP ${n.status}`};let s=o.sessionId;try{await m(s,{type:"append_message",message:e,customType:"fork_handoff",display:!0})}catch{}return i?.({id:s,path:"",cwd:a,created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:1,firstMessage:e.slice(0,120),parentSessionId:r}),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},[M?.info?.cwd,t?.cwd,n,tF,eN,tH,i]),t7=(0,r.useCallback)(async e=>{let t=e2.current;t&&(tC.current.delete(t),F(t),t_.current=e,en(e),await tX(t,e))},[tX]),t9=(0,r.useCallback)(async e=>{t_.current=e,en(e);let t=e2.current;t&&(tC.current.delete(t),F(t),await tX(t,e))},[tX]),ne=(0,r.useCallback)(async(e,t)=>{if(x)return void tP({provider:e,modelId:t});let n=e2.current;if(n)try{var r;e5(null);let a=await m(n,{type:"set_model",provider:e,modelId:t}),o={provider:a.provider,modelId:a.id};a.thinkingLevel&&(r=a.thinkingLevel,"auto"===r||"off"===r||"minimal"===r||"low"===r||"medium"===r||"high"===r||"xhigh"===r)&&eD(a.thinkingLevel),eW(o),U(e=>e?{...e,context:{...e.context,model:o}}:e)}catch(t){let e=t instanceof Error?t.message:String(t);console.error("Failed to set model:",t),e5(e)}},[x,tP]),nt=(0,r.useCallback)(async()=>{let e=e2.current;if(e&&!ez){eG(!0),eY(null),eX(null);try{let t=await m(e,{type:"compact"});t?.reducedBy!=null&&eX(`Compacted ~${t.tokensBefore??"?"} → ~${t.tokensAfter??"?"} tokens (−${t.reducedBy})`),await tG(e,!0)}catch(e){eY(e instanceof Error?e.message:String(e))}finally{eG(!1)}}},[ez,tG]),nn=(0,r.useCallback)(async(e,t,n)=>{let r=e2.current;if(!r)return;F(r);let a=tB(n),o=e.trim()?a?`${e}
10
+ ${s}`:"",u=[],c=x?n:t?.cwd??M?.info?.cwd;if(r?.length&&c)try{u=await h(c,r)}catch(e){e5(e instanceof Error?e.message:String(e));return}let d=u.length?u.map(e=>{var t;return{type:"image",path:e.path,mimeType:e.mimeType,name:e.name,source:{type:"url",url:(t=e.path,`/api/files/${(0,g.HG)(t)}?type=read`),media_type:e.mimeType}}}):r?.map(e=>({type:"image",source:{type:"base64",media_type:e.mimeType,data:e.data}})),p={role:"user",content:d?.length?[...l.trim()?[{type:"text",text:l}]:[],...d]:l,timestamp:Date.now()},y=J(),w=x?null:t?.id??null;w&&F(w);let k=t_.current,v=z(p.content);tv.current.set(y,{localId:y,sessionId:w??"__new__",leafId:k,message:p,createdAt:Date.now(),kind:"prompt",confirmKey:v,confirmCountAtCreate:x?0:v?tC.current.get(v)??0:0}),ea(e=>[...e,p]),e5(null),to.current=!0,eh(!0),e0({kind:"waiting_model"}),em({type:"start"}),ty.current=!0;let b=ek.find(e=>e.provider===tF?.provider&&e.id===tF?.modelId)?.input,_=!b||0===b.length||b.includes("image")?r?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})):void 0;try{if(x&&n){eI&&eK(eI);let t=o??tH(),r=await fetch("/api/agent/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:n,type:"prompt",message:l,toolNames:t,deferPrompt:!0,..._?.length?{images:_}:{},...eI?{provider:eI.provider,modelId:eI.modelId}:{},..."auto"!==eN?{thinkingLevel:eN}:{}})}),a=await r.json().catch(()=>({}));if(!r.ok||a.error||!a.sessionId)throw Error(a.error??`HTTP ${r.status}`);let s=a.sessionId;e2.current=s;let u=tv.current.get(y);u&&(u.sessionId=s),tm.current?.(),tm.current=N(s,()=>{e2.current===s&&(eh(!1),e0(null))}),tT.current=s,await t1(s,{requireConnected:!0,timeoutMs:1e4}),await m(s,{type:"prompt",message:l,toolNames:t,..._?.length?{images:_}:{}}),i?.({id:s,path:"",cwd:n,name:void 0,created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:1,firstMessage:e})}else if(t){let e=o??tH();await tW(t.id),tm.current?.(),tm.current=N(t.id,()=>{e2.current===t.id&&(eh(!1),e0(null))}),await t1(t.id,{requireConnected:!0,timeoutMs:1e4}),await m(t.id,{type:"prompt",message:l,toolNames:e,leafId:k,...tF?{provider:tF.provider,modelId:tF.modelId}:{},..."auto"!==eN?{thinkingLevel:eN}:{},..._?.length?{images:_}:{}})}}catch(n){let t=e2.current;if(tv.current.delete(y),ea(e=>e.filter(e=>e!==p)),n instanceof f&&(409===n.status||"SESSION_BUSY"===n.code)){e5("This session is already running in another tab. Showing that active run instead."),to.current=!0,eh(!0),e0({kind:"waiting_model"}),em({type:"start"}),t&&(e6.current?.close(),e6.current=null,L(t),t1(t,{replay:!0}),tf.current?.(t,"prompt_conflict"));return}if(console.error("Failed to send message:",n),x&&e2.current){let e=e2.current;e2.current=null,tT.current=null,fetch(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{})}C?.current&&e.trim()&&C.current.insertIfEmpty(e),C?.current&&r?.length&&C.current.addBase64Images?.(r.map(({data:e,mimeType:t})=>({data:e,mimeType:t}))),e5(n instanceof Error?n.message:String(n)),e6.current?.close(),e6.current=null,t&&D(t),to.current=!1,eh(!1),e0(null),em({type:"end"})}},[x,n,eI,tH,eN,t,M?.info?.cwd,eg,t1,i,tB,ek,tF,tW,C]),t5=(0,r.useCallback)(async()=>{let e=e2.current;if(!e)return;let t=ti();to.current=!1,tc(),e5(null),eh(!1),e0(null),em({type:"end"}),e6.current?.close(),e6.current=null,D(e),F(e);try{await m(e,{type:t?"abort_bash":"abort"}),await tG(e,!1,!1,!0)}catch(t){console.error("Failed to abort:",t),await tG(e,!1,!1,!0)}finally{t&&tc()}},[tc,ti,tG]),t6=(0,r.useCallback)(async(e,t)=>{let n=e2.current,r=e.trim();if(n&&r){e5(null),tu(r);try{await m(n,{type:"bash",command:r,excludeFromContext:t})}catch(e){e5(e instanceof Error?e.message:String(e))}finally{tc(),F(n),await tG(n,!1,!1,!0)}}},[tu,tc,tG]),t2=(0,r.useCallback)(async e=>{let t=e2.current;if(t){eH(e);try{let{cancelled:n,newSessionId:r}=await m(t,{type:"fork",entryId:e})??{};!n&&r&&u?.(r)}catch(e){console.error("Fork failed:",e)}finally{eH(null)}}},[u]),t8=(0,r.useCallback)(async e=>{let r=e2.current,a=M?.info?.cwd??t?.cwd??n??null;if(!r||!a)return{ok:!1,error:"No active session to fork"};if(to.current)return{ok:!1,error:"Agent is still running"};try{let t=tH(),n=await fetch("/api/agent/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,type:"prompt",parentSessionId:r,deferPrompt:!0,toolNames:t,...tF?{provider:tF.provider,modelId:tF.modelId}:{},..."auto"!==eN?{thinkingLevel:eN}:{}})}),o=await n.json().catch(()=>({}));if(!n.ok||o.error||!o.sessionId)return{ok:!1,error:o.error??`HTTP ${n.status}`};let s=o.sessionId;try{await m(s,{type:"append_message",message:e,customType:"fork_handoff",display:!0})}catch{}return i?.({id:s,path:"",cwd:a,created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:1,firstMessage:e.slice(0,120),parentSessionId:r}),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},[M?.info?.cwd,t?.cwd,n,tF,eN,tH,i]),t7=(0,r.useCallback)(async e=>{let t=e2.current;t&&(tb.current.delete(t),F(t),t_.current=e,en(e),await tX(t,e))},[tX]),t9=(0,r.useCallback)(async e=>{t_.current=e,en(e);let t=e2.current;t&&(tb.current.delete(t),F(t),await tX(t,e))},[tX]),ne=(0,r.useCallback)(async(e,t)=>{if(x)return void tP({provider:e,modelId:t});let n=e2.current;if(n)try{var r;e5(null);let a=await m(n,{type:"set_model",provider:e,modelId:t}),o={provider:a.provider,modelId:a.id};a.thinkingLevel&&(r=a.thinkingLevel,"auto"===r||"off"===r||"minimal"===r||"low"===r||"medium"===r||"high"===r||"xhigh"===r)&&eD(a.thinkingLevel),eW(o),U(e=>e?{...e,context:{...e.context,model:o}}:e)}catch(t){let e=t instanceof Error?t.message:String(t);console.error("Failed to set model:",t),e5(e)}},[x,tP]),nt=(0,r.useCallback)(async()=>{let e=e2.current;if(e&&!ez){eG(!0),eY(null),eX(null);try{let t=await m(e,{type:"compact"});t?.reducedBy!=null&&eX(`Compacted ~${t.tokensBefore??"?"} → ~${t.tokensAfter??"?"} tokens (−${t.reducedBy})`),await tG(e,!0)}catch(e){eY(e instanceof Error?e.message:String(e))}finally{eG(!1)}}},[ez,tG]),nn=(0,r.useCallback)(async(e,t,n)=>{let r=e2.current;if(!r)return;F(r);let a=tB(n),o=e.trim()?a?`${e}
11
11
 
12
12
  Attached document text:
13
13
 
14
14
  ${a}`:e:a?`Attached document text:
15
15
 
16
- ${a}`:"",s=ek.find(e=>e.provider===tF?.provider&&e.id===tF?.modelId)?.input,l=!s||0===s.length||s.includes("image")?t?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})):void 0,i={role:"user",content:`[steer] ${o}`,timestamp:Date.now()},u=J(),c=K(o,l?.length??0);tv.current.set(u,{localId:u,sessionId:r,leafId:t_.current,message:i,createdAt:Date.now(),kind:"steer",confirmKey:c,confirmCountAtCreate:c?tb.current.get(c)??0:0}),ea(e=>[...e,i]);try{await m(r,{type:"steer",message:o,...l?.length?{images:l}:{}})}catch(e){tv.current.delete(u),console.error("Failed to steer:",e)}},[tB,ek,tF]),nr=(0,r.useCallback)(async(e,t,n)=>{let r=e2.current;if(!r)return;F(r);let a=tB(n),o=e.trim()?a?`${e}
16
+ ${a}`:"",s=ek.find(e=>e.provider===tF?.provider&&e.id===tF?.modelId)?.input,l=!s||0===s.length||s.includes("image")?t?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})):void 0,i={role:"user",content:`[steer] ${o}`,timestamp:Date.now()},u=J(),c=K(o,l?.length??0);tv.current.set(u,{localId:u,sessionId:r,leafId:t_.current,message:i,createdAt:Date.now(),kind:"steer",confirmKey:c,confirmCountAtCreate:c?tC.current.get(c)??0:0}),ea(e=>[...e,i]);try{await m(r,{type:"steer",message:o,...l?.length?{images:l}:{}})}catch(e){tv.current.delete(u),console.error("Failed to steer:",e)}},[tB,ek,tF]),nr=(0,r.useCallback)(async(e,t,n)=>{let r=e2.current;if(!r)return;F(r);let a=tB(n),o=e.trim()?a?`${e}
17
17
 
18
18
  Attached document text:
19
19
 
20
20
  ${a}`:e:a?`Attached document text:
21
21
 
22
- ${a}`:"",s=ek.find(e=>e.provider===tF?.provider&&e.id===tF?.modelId)?.input,l=!s||0===s.length||s.includes("image")?t?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})):void 0,i={role:"user",content:o,timestamp:Date.now()},u=J(),c=K(o,l?.length??0);tv.current.set(u,{localId:u,sessionId:r,leafId:t_.current,message:i,createdAt:Date.now(),kind:"follow_up",confirmKey:c,confirmCountAtCreate:c?tb.current.get(c)??0:0}),ea(e=>[...e,i]);try{await m(r,{type:"follow_up",message:o,...l?.length?{images:l}:{}})}catch(e){tv.current.delete(u),console.error("Failed to follow up:",e)}},[tB,ek,tF]),na=(0,r.useCallback)(async()=>{let e=e2.current;if(e)try{await m(e,{type:"abort_compaction"})}catch(e){console.error("Failed to abort compaction:",e)}},[]),no=(0,r.useCallback)(async e=>{if(eD(e),"auto"===e)return;let t=e2.current;if(t)try{await m(t,{type:"set_thinking_level",level:e})}catch(e){console.error("Failed to set thinking level:",e)}},[]),ns=(0,r.useCallback)(async e=>{tj(e);let t=(0,q.tE)(e,eE),n=e2.current;if(n)try{await m(n,{type:"set_tools",toolNames:t})}catch(e){console.error("Failed to set tools:",e)}},[eE,tj]),nl=(0,r.useCallback)(async e=>{tO(e);let t=(0,q.tE)(eS,e),n=e2.current;if(n)try{await m(n,{type:"set_tools",toolNames:t})}catch(e){console.error("Failed to set memory tools:",e)}},[tO,eS]),ni=(0,r.useCallback)((e="smooth")=>{tw.current?.scrollIntoView({behavior:e})},[]),nu=(0,r.useCallback)(()=>{let e=tk.current,t=th.current;if(!e||!t)return;let n=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;e.scrollTo({top:n-16,behavior:"smooth"})},[]);(0,r.useEffect)(()=>{if(t){var e;let n;if(e2.current=t.id,t.id===tT.current)return tT.current=null,()=>{tN.current&&clearTimeout(tN.current),tN.current=null,e6.current?.close(),e6.current=null,tm.current?.(),tm.current=null};tA.current=!1,tE.current=0;let r=(e=t.id,(n=C().get(e))&&"idle"!==n.snapshot.phase?n.snapshot:null);r?.phase==="active"&&(to.current=!0,eh(!0),e0({kind:"waiting_model"}),em({type:"start"})),(async()=>{let e=await tG(t.id,!0,!0,!0);e2.current===t.id&&(await tZ(t.id),t0(t.id),e?.running?(to.current=!0,eh(!0),e0(a(e.state)),em({type:"start"}),t1(t.id,{replay:!0}),tm.current?.(),tm.current=N(t.id,()=>{e2.current===t.id&&tf.current?.(t.id,"stream_watchdog")})):e&&r?.phase==="active"?(to.current=!1,eh(!1),e0(null),em({type:"end"}),D(t.id)):e||r?.phase!=="active"||tf.current?.(t.id,"mount_state_load_failed"),e?.state&&(void 0!==e.state.isCompacting&&eG(e.state.isCompacting),void 0!==e.state.contextUsage&&ej(e.state.contextUsage??null),void 0!==e.state.systemPrompt&&eF(e.state.systemPrompt??null),void 0!==e.state.queuedMessages&&e3(H(e.state.queuedMessages)),tt(e.state),e.state.isBashRunning&&tu(""),void 0!==e.state.thinkingLevel&&eD(e.state.thinkingLevel??"auto")),e&&!to.current&&e.state?.contextUsage===void 0&&tf.current?.(t.id,"mount_context_usage"))})()}return()=>{tT.current&&e2.current===tT.current||(tN.current&&clearTimeout(tN.current),tN.current=null,tD.current?.controller.abort(W("Session changed","AbortError")),tD.current=null,e6.current?.close(),e6.current=null,tm.current?.(),tm.current=null)}},[t1,tG,tZ,t0,v,t,tt,tu]),(0,r.useEffect)(()=>{let e=()=>{let e=e2.current;e&&t3(e,"foreground")},t=()=>{"visible"===document.visibilityState&&e()};return document.addEventListener("visibilitychange",t),window.addEventListener("focus",e),window.addEventListener("online",e),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",e),window.removeEventListener("online",e)}},[t3]),(0,r.useEffect)(()=>{let e=e2.current;if(e)return tR.current=!1,(0,w.O)(t=>{let n=t.includes(e),r=tR.current;tR.current=n,n&&!to.current?(F(e),t3(e,"running_feed_start")):!n&&r&&(F(e),to.current?t3(e,"running_feed_stop"):tG(e,!1,!1,!0))})},[tG,t3,t?.id]),(0,r.useEffect)(()=>{let e=window.setInterval(()=>{let e=e2.current;e&&(to.current?(t3(e,"interval"),tU.current&&Date.now()-tL.current>25e3&&(tL.current=Date.now(),F(e),tG(e,!1,!1,!0))):Date.now()-t$.current>=3e4?(t$.current=Date.now(),F(e),tG(e,!1,!1,!0)):tG(e))},15e3);return()=>window.clearInterval(e)},[tG,t3]),(0,r.useEffect)(()=>{v&&v(M?.tree??[],et,t9)},[M?.tree,et,t9,v]),(0,r.useEffect)(()=>{er.length>0&&!tM.current&&(ty.current?(ty.current=!1,tg.current=!0,nu()):tg.current?to.current||ni("smooth"):(tg.current=!0,ni("instant")))},[er.length,eg,ni,nu]),(0,r.useEffect)(()=>{fetch("/api/models").then(e=>e.json()).then(e=>{if(ew(e.models),e.thinkingLevels&&eC(e.thinkingLevels),e.thinkingLevelMaps&&e_(e.thinkingLevelMaps),e.modelList&&(ev(e.modelList),x&&e.modelList.length>0)){let t=e.defaultModel,n=t&&e.modelList.find(e=>e.id===t.modelId&&e.provider===t.provider);tP(n?{provider:n.provider,modelId:n.id}:{provider:e.modelList[0].provider,modelId:e.modelList[0].id})}}).catch(()=>{})},[x,k,tP]),(0,r.useEffect)(()=>{if(!eV)return;let e=setTimeout(()=>eY(null),3e3);return()=>clearTimeout(e)},[eV]),(0,r.useEffect)(()=>{if(!eQ)return;let e=setTimeout(()=>eX(null),6e3);return()=>clearTimeout(e)},[eQ]);let nc=(0,r.useCallback)(async()=>{let e=e2.current;if(e)try{await m(e,{type:"clear_queue"}),e3({steering:[],followUp:[]})}catch(e){e5(e instanceof Error?e.message:String(e))}},[]);return{data:M,loading:Q,error:Z,activeLeafId:et,messages:er,entryIds:eo,streamState:ef,agentRunning:eg,modelNames:ey,modelList:ek,modelThinkingLevels:eb,modelThinkingLevelMaps:ex,newSessionModel:eI,toolPreset:eS,memoryTools:eE,thinkingLevel:eN,retryInfo:eL,queuedMessages:e1,extensionStatuses:e8,extensionWidgets:e7,extensionDialog:e9,extensionNotices:te,bashLive:ts,bashRunning:tl,contextUsage:eP,systemPrompt:eO,forkingEntryId:eq,isCompacting:ez,compactError:eV,compactInfo:eQ,currentModel:tF,displayModel:tq,sessionStats:tJ,agentPhase:eZ,agentError:e4,isNew:x,sessionIdRef:e2,sseReaderRef:e6,messagesEndRef:tw,scrollContainerRef:tk,lastUserMsgRef:th,pendingScrollToUserRef:ty,initialScrollDoneRef:tg,handleSend:t4,handleAbort:t5,handleFork:t2,handleNavigate:t7,handleModelChange:ne,handleCompact:nt,handleSteer:nn,handleFollowUp:nr,handleAbortCompaction:na,handleToolPresetChange:ns,handleMemoryToolsChange:nl,handleThinkingLevelChange:no,handleClearQueue:nc,handleBash:t6,respondToExtensionUi:tr,dismissExtensionNotice:ta,loadTools:tZ,loadSlashCommands:t0,slashCommands:eR,setActiveLeafId:en,setData:U,setMessages:ea,dispatch:em,setAgentRunning:eh,setForkingEntryId:eH,forkToNewSession:t8,loadMoreMessages:tY,hasMoreMessages:eu,totalMessages:el,loadedMessagesCount:ed,loadShadowedMessages:tQ,handleAgentEventRef:tp}}}}]);
22
+ ${a}`:"",s=ek.find(e=>e.provider===tF?.provider&&e.id===tF?.modelId)?.input,l=!s||0===s.length||s.includes("image")?t?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})):void 0,i={role:"user",content:o,timestamp:Date.now()},u=J(),c=K(o,l?.length??0);tv.current.set(u,{localId:u,sessionId:r,leafId:t_.current,message:i,createdAt:Date.now(),kind:"follow_up",confirmKey:c,confirmCountAtCreate:c?tC.current.get(c)??0:0}),ea(e=>[...e,i]);try{await m(r,{type:"follow_up",message:o,...l?.length?{images:l}:{}})}catch(e){tv.current.delete(u),console.error("Failed to follow up:",e)}},[tB,ek,tF]),na=(0,r.useCallback)(async()=>{let e=e2.current;if(e)try{await m(e,{type:"abort_compaction"})}catch(e){console.error("Failed to abort compaction:",e)}},[]),no=(0,r.useCallback)(async e=>{if(eD(e),"auto"===e)return;let t=e2.current;if(t)try{await m(t,{type:"set_thinking_level",level:e})}catch(e){console.error("Failed to set thinking level:",e)}},[]),ns=(0,r.useCallback)(async e=>{tj(e);let t=(0,q.tE)(e,eE),n=e2.current;if(n)try{await m(n,{type:"set_tools",toolNames:t})}catch(e){console.error("Failed to set tools:",e)}},[eE,tj]),nl=(0,r.useCallback)(async e=>{tO(e);let t=(0,q.tE)(eS,e),n=e2.current;if(n)try{await m(n,{type:"set_tools",toolNames:t})}catch(e){console.error("Failed to set memory tools:",e)}},[tO,eS]),ni=(0,r.useCallback)((e="smooth")=>{tw.current?.scrollIntoView({behavior:e})},[]),nu=(0,r.useCallback)(()=>{let e=tk.current,t=th.current;if(!e||!t)return;let n=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;e.scrollTo({top:n-16,behavior:"smooth"})},[]);(0,r.useEffect)(()=>{if(t){var e;let n;if(e2.current=t.id,t.id===tT.current)return tT.current=null,()=>{tN.current&&clearTimeout(tN.current),tN.current=null,e6.current?.close(),e6.current=null,tm.current?.(),tm.current=null};tA.current=!1,tE.current=0;let r=(e=t.id,(n=b().get(e))&&"idle"!==n.snapshot.phase?n.snapshot:null);r?.phase==="active"&&(to.current=!0,eh(!0),e0({kind:"waiting_model"}),em({type:"start"})),(async()=>{let e=await tG(t.id,!0,!0,!0);e2.current===t.id&&(await tZ(t.id),t0(t.id),e?.running?(to.current=!0,eh(!0),e0(a(e.state)),em({type:"start"}),t1(t.id,{replay:!0}),tm.current?.(),tm.current=N(t.id,()=>{e2.current===t.id&&tf.current?.(t.id,"stream_watchdog")})):e&&r?.phase==="active"?(to.current=!1,eh(!1),e0(null),em({type:"end"}),D(t.id)):e||r?.phase!=="active"||tf.current?.(t.id,"mount_state_load_failed"),e?.state&&(void 0!==e.state.isCompacting&&eG(e.state.isCompacting),void 0!==e.state.contextUsage&&ej(e.state.contextUsage??null),void 0!==e.state.systemPrompt&&eF(e.state.systemPrompt??null),void 0!==e.state.queuedMessages&&e3(H(e.state.queuedMessages)),tt(e.state),e.state.isBashRunning&&tu(""),void 0!==e.state.thinkingLevel&&eD(e.state.thinkingLevel??"auto")),e&&!to.current&&e.state?.contextUsage===void 0&&tf.current?.(t.id,"mount_context_usage"))})()}return()=>{tT.current&&e2.current===tT.current||(tN.current&&clearTimeout(tN.current),tN.current=null,tD.current?.controller.abort(W("Session changed","AbortError")),tD.current=null,e6.current?.close(),e6.current=null,tm.current?.(),tm.current=null)}},[t1,tG,tZ,t0,v,t,tt,tu]),(0,r.useEffect)(()=>{let e=()=>{let e=e2.current;e&&t3(e,"foreground")},t=()=>{"visible"===document.visibilityState&&e()};return document.addEventListener("visibilitychange",t),window.addEventListener("focus",e),window.addEventListener("online",e),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",e),window.removeEventListener("online",e)}},[t3]),(0,r.useEffect)(()=>{let e=e2.current;if(e)return tR.current=!1,(0,w.O)(t=>{let n=t.includes(e),r=tR.current;tR.current=n,n&&!to.current?(F(e),t3(e,"running_feed_start")):!n&&r&&(F(e),to.current?t3(e,"running_feed_stop"):tG(e,!1,!1,!0))})},[tG,t3,t?.id]),(0,r.useEffect)(()=>{let e=window.setInterval(()=>{let e=e2.current;e&&(to.current?(t3(e,"interval"),tU.current&&Date.now()-tL.current>25e3&&(tL.current=Date.now(),F(e),tG(e,!1,!1,!0))):Date.now()-t$.current>=3e4?(t$.current=Date.now(),F(e),tG(e,!1,!1,!0)):tG(e))},15e3);return()=>window.clearInterval(e)},[tG,t3]),(0,r.useEffect)(()=>{v&&v(M?.tree??[],et,t9)},[M?.tree,et,t9,v]),(0,r.useEffect)(()=>{er.length>0&&!tM.current&&(ty.current?(ty.current=!1,tg.current=!0,nu()):tg.current?to.current||ni("smooth"):(tg.current=!0,ni("instant")))},[er.length,eg,ni,nu]),(0,r.useEffect)(()=>{fetch("/api/models").then(e=>e.json()).then(e=>{if(ew(e.models),e.thinkingLevels&&eb(e.thinkingLevels),e.thinkingLevelMaps&&e_(e.thinkingLevelMaps),e.modelList&&(ev(e.modelList),x&&e.modelList.length>0)){let t=e.defaultModel,n=t&&e.modelList.find(e=>e.id===t.modelId&&e.provider===t.provider);tP(n?{provider:n.provider,modelId:n.id}:{provider:e.modelList[0].provider,modelId:e.modelList[0].id})}}).catch(()=>{})},[x,k,tP]),(0,r.useEffect)(()=>{if(!eV)return;let e=setTimeout(()=>eY(null),3e3);return()=>clearTimeout(e)},[eV]),(0,r.useEffect)(()=>{if(!eQ)return;let e=setTimeout(()=>eX(null),6e3);return()=>clearTimeout(e)},[eQ]);let nc=(0,r.useCallback)(async()=>{let e=e2.current;if(e)try{await m(e,{type:"clear_queue"}),e3({steering:[],followUp:[]})}catch(e){e5(e instanceof Error?e.message:String(e))}},[]);return{data:M,loading:Q,error:Z,activeLeafId:et,messages:er,entryIds:eo,streamState:ef,agentRunning:eg,modelNames:ey,modelList:ek,modelThinkingLevels:eC,modelThinkingLevelMaps:ex,newSessionModel:eI,toolPreset:eS,memoryTools:eE,thinkingLevel:eN,retryInfo:eL,queuedMessages:e1,extensionStatuses:e8,extensionWidgets:e7,extensionDialog:e9,extensionNotices:te,bashLive:ts,bashRunning:tl,contextUsage:eP,systemPrompt:eO,forkingEntryId:eq,isCompacting:ez,compactError:eV,compactInfo:eQ,currentModel:tF,displayModel:tq,sessionStats:tJ,agentPhase:eZ,agentError:e4,isNew:x,sessionIdRef:e2,sseReaderRef:e6,messagesEndRef:tw,scrollContainerRef:tk,lastUserMsgRef:th,pendingScrollToUserRef:ty,initialScrollDoneRef:tg,handleSend:t4,handleAbort:t5,handleFork:t2,handleNavigate:t7,handleModelChange:ne,handleCompact:nt,handleSteer:nn,handleFollowUp:nr,handleAbortCompaction:na,handleToolPresetChange:ns,handleMemoryToolsChange:nl,handleThinkingLevelChange:no,handleClearQueue:nc,handleBash:t6,respondToExtensionUi:tr,dismissExtensionNotice:ta,loadTools:tZ,loadSlashCommands:t0,slashCommands:eR,setActiveLeafId:en,setData:U,setMessages:ea,dispatch:em,setAgentRunning:eh,setForkingEntryId:eH,forkToNewSession:t8,loadMoreMessages:tY,hasMoreMessages:eu,totalMessages:el,loadedMessagesCount:ed,loadShadowedMessages:tQ,handleAgentEventRef:tp}}}}]);
@@ -19,4 +19,4 @@
19
19
  td,th{border:1px solid #d1d5db;padding:4px 6px;vertical-align:top}
20
20
  th{background:#f3f4f6;font-weight:600}
21
21
  img{max-width:100%;height:auto}
22
- </style></head><body><div class="xlsx-preview">${e}</div></body></html>`},[p,u]);return(0,l.useEffect)(()=>{let t=!1;return async function(){s(!0),c(null);try{let n=await Promise.all([r.e(3524),r.e(8436)]).then(r.bind(r,15967)),l=n.read(e,{type:"array"}),i=l.SheetNames.map(e=>{let t=l.Sheets[e];return{name:e,html:n.utils.sheet_to_html(t,{editable:!1}).replace(H,"").replace(R,"").replace(T,"")}});t||(h(i),x(0),s(!1))}catch(e){t||(console.error("XLSX parse error:",e),c(String(e)),s(!1))}}(),()=>{t=!0}},[e]),(0,n.jsx)(L.B,{fileName:t,loading:o,loadingLabel:"Loading spreadsheet...",error:d,bodyStyle:{background:"var(--bg-panel)"},extra:(0,n.jsxs)(n.Fragment,{children:[a,u.length>1&&(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",maxWidth:"min(520px, 48vw)"},children:(0,n.jsx)(i.Tg,{options:u.map((e,t)=>({key:e.name,label:(0,n.jsx)("span",{title:e.name,style:{display:"block",maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),active:t===p,onClick:()=>x(t)}))})})]}),children:!o&&!d&&u.length>0&&(0,n.jsx)("iframe",{title:t?`${t} preview`:"Spreadsheet preview",sandbox:"",srcDoc:f,style:{width:"100%",height:"100%",minHeight:320,border:"none",background:"white"}})})}var z=r(53308);function M({arrayBuffer:e,fileName:t,toolbarExtra:a}){let[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)([]),[p,x]=(0,l.useState)(0);(0,l.useEffect)(()=>{let t=!1;return async function(){s(!0),c(null);try{let n=(await Promise.all([r.e(2619),r.e(4453)]).then(r.t.bind(r,54453,23))).default,l=await n.loadAsync(e),i=[];l.forEach(e=>{let t=/^ppt\/slides\/slide(\d+)\.xml$/i.exec(e);t&&i.push({name:e,index:parseInt(t[1],10)})}),i.sort((e,t)=>e.index-t.index);let a=[];for(let e of i){let r;if(t)return;let n=await l.file(e.name).async("string"),i=/<a:t[^>]*>([^<]*)<\/a:t>/g,o=[];for(;null!==(r=i.exec(n));){let e=r[1].trim();e&&o.push(e)}a.push({index:e.index,texts:o})}t||(h(a),s(!1))}catch(e){t||(console.error("PPTX parse error:",e),c(String(e)),s(!1))}}(),()=>{t=!0}},[e]);let f=u[p],g=u.length;return(0,n.jsx)(L.B,{fileName:t,pageInfo:g>0?`Slide ${p+1} / ${g}`:void 0,loading:o,loadingLabel:"Loading presentation...",error:d,bodyStyle:{background:"var(--bg-panel)",display:"flex",justifyContent:"center",alignItems:"flex-start",padding:24},extra:(0,n.jsxs)(n.Fragment,{children:[a,g>1&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,n.jsx)(i.ml,{onClick:()=>x(e=>Math.max(e-1,0)),title:"Previous slide",disabled:p<=0,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"6 2 3 5 6 8"})})}),(0,n.jsxs)("span",{style:{fontSize:11,color:"var(--text-dim)",minWidth:28,textAlign:"center"},children:[p+1,"/",g]}),(0,n.jsx)(i.ml,{onClick:()=>x(e=>Math.min(e+1,g-1)),title:"Next slide",disabled:p>=g-1,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"4 2 7 5 4 8"})})})]})]}),children:!o&&!d&&f&&(0,n.jsx)(C.QG,{children:(0,n.jsxs)("div",{style:{width:"100%",maxWidth:800},children:[(0,n.jsxs)(C.ok,{children:[(0,n.jsxs)(C.PH,{children:["Slide ",f.index]}),(0,n.jsx)(C.OI,{style:{minHeight:200},children:0===f.texts.length?(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontStyle:"italic",fontSize:13},children:"(No text content)"}):(0,n.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:f.texts.map((e,t)=>(0,n.jsx)("li",{style:{padding:"4px 0",fontSize:14,lineHeight:1.6,color:"var(--text)",borderBottom:t<f.texts.length-1?"1px solid var(--bg-panel)":"none"},children:e},t))})})]}),g>1&&(0,n.jsx)(z._t,{title:"All slides",children:(0,n.jsx)(z.S7,{children:u.map((e,t)=>(0,n.jsx)(z.HF,{title:`Slide ${e.index}`,summary:e.texts[0]||"(empty)",active:t===p,onClick:()=>x(t)},e.index))})})]})})})}function N(e){return Array.isArray(e)?e.join(""):e}function F({filePath:e,cwd:t}){let[r,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),u=(0,l.useRef)(null);return((0,l.useEffect)(()=>{let t=(0,g.HG)(e);fetch(`/api/files/${t}?type=read`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(t.error)throw Error(t.error);if(!t.content)throw Error("Empty file");let r=JSON.parse(t.content);if(!r.cells||!Array.isArray(r.cells))throw Error("Invalid notebook format");a(r.cells)}).catch(e=>c(e.message)).finally(()=>s(!1));let r=new EventSource(`/api/files/${t}?type=watch`);return u.current=r,()=>{r.close(),u.current=null}},[e]),o)?(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e}),(0,n.jsx)(i.nG,{children:"Loading notebook..."})]}):d||!r?(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e}),(0,n.jsx)(i.nG,{children:d??"Failed to load notebook"})]}):(0,n.jsxs)(i.fj,{style:{background:"var(--bg)",overflowY:"auto"},children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:`${(0,g.WP)(e)} \xb7 ${r.length} cells`,style:{padding:"9px 12px",fontSize:12,color:"var(--text-muted)"}}),(0,n.jsx)(i.Ph,{style:{padding:0},children:(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:r.map((e,t)=>(0,n.jsx)(B,{cell:e},t))})})]})}function B({cell:e}){if("markdown"===e.cell_type){let t=N(e.source).trim();return t?(0,n.jsx)("div",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg)"},children:(0,n.jsx)(f.T,{content:t})}):null}if("code"===e.cell_type){let t=N(e.source),r=e.execution_count,l=e.outputs&&e.outputs.length>0;return(0,n.jsxs)("div",{style:{borderBottom:"1px solid var(--border)"},children:[(0,n.jsxs)("div",{style:{display:"flex",background:"var(--bg-panel)"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0,padding:"6px 0",textAlign:"center",fontSize:10,fontFamily:"var(--font-mono)",color:"var(--text-dim)",userSelect:"none"},children:null!=r?`[${r}]`:"[ ]"}),(0,n.jsx)("div",{style:{flex:1,minWidth:0,padding:"6px 12px 6px 0",overflow:"auto"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.6,color:"var(--text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,n.jsx)("code",{children:t})})})]}),l&&e.outputs.map((e,t)=>{let r=function(e){let t=[];if(!e.data)return t;for(let r of["image/png","image/jpeg","image/svg+xml","image/webp"])if(e.data[r]){let n=N(e.data[r]);t.push({data:n,mimeType:r})}return t}(e),l=function(e){if("stream"===e.output_type)return N(e.text??"").trim()||null;if(("execute_result"===e.output_type||"display_data"===e.output_type)&&e.data?.["text/plain"])return N(e.data["text/plain"]).trim()||null;if("error"===e.output_type){let t=e.ename??"Error",r=e.evalue??"";return`${t}: ${r}`}return null}(e);return"error"===e.output_type?(0,n.jsxs)("div",{style:{display:"flex",background:"rgba(248,113,113,0.04)",borderTop:"1px solid rgba(248,113,113,0.15)"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"6px 12px 6px 0"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:11,lineHeight:1.5,color:"#f87171",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:l})})]},t):(0,n.jsxs)("div",{style:{borderTop:"1px solid rgba(34,197,94,0.08)",background:"var(--bg-subtle)"},children:[r.length>0&&(0,n.jsxs)("div",{style:{display:"flex"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"6px 0"},children:r.map((e,r)=>(0,n.jsx)("img",{src:`data:${e.mimeType};base64,${e.data}`,alt:`output ${t}`,style:{maxWidth:"100%",display:"block"}},r))})]}),l&&(0,n.jsxs)("div",{style:{display:"flex"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"4px 12px 4px 0"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:11,lineHeight:1.5,color:"var(--text-muted)",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:300,overflow:"auto"},children:l})})]})]},t)})]})}return(0,n.jsx)("div",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-dim)",whiteSpace:"pre-wrap"},children:N(e.source)})})}let G=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),O=new Set(["mp3","wav","ogg","oga","opus","m4a","aac","flac","weba","webm"]),I=new Set(["pdf","docx","xlsx","pptx","doc","xls","ppt"]);function D({filePath:e,cwd:t}){let[r,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)(null),[p,x]=(0,l.useState)(null),[f,m]=(0,l.useState)(100),y=(0,l.useRef)(null),v=(0,g.WP)(e).toLowerCase().split(".").pop()??"";(0,l.useEffect)(()=>{s(0),c(null),h(null),x(null),a(!1),m(100),y.current&&(y.current.close(),y.current=null);let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return y.current=r,r.addEventListener("connected",()=>a(!0)),r.addEventListener("change",e=>{try{let t=JSON.parse(e.data);"number"==typeof t.size&&c(t.size)}catch{}s(e=>e+1)}),r.addEventListener("error",()=>a(!1)),r.onerror=()=>a(!1),()=>{r.close(),y.current=null}},[e]);let j=(0,g.HG)(e),w=`/api/files/${j}?type=read${o?`&v=${o}`:""}`,k=null!=d?(0,i.v7)(d):null,S=e=>m(Math.max(10,Math.min(500,e)));return(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,trailing:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0},children:[(0,n.jsx)(i.ml,{onClick:()=>S(f-25),title:"Zoom out",style:{width:24,height:22,fontSize:13,lineHeight:1,padding:0},children:"-"}),(0,n.jsx)("select",{value:f,onChange:e=>S(Number(e.target.value)),title:"Image zoom",style:{height:22,border:"1px solid var(--border)",borderRadius:5,background:"var(--bg-panel)",color:"var(--text)",fontSize:11,fontFamily:"var(--font-mono)",outline:"none",cursor:"pointer"},children:[25,50,75,100,125,150,200,300].map(e=>(0,n.jsxs)("option",{value:e,children:[e,"%"]},e))}),(0,n.jsx)(i.ml,{onClick:()=>S(f+25),title:"Zoom in",style:{width:24,height:22,fontSize:13,lineHeight:1,padding:0},children:"+"})]}),(0,n.jsx)("span",{style:{flexShrink:0},children:v||"image"}),u&&(0,n.jsxs)("span",{children:[u.w," \xd7 ",u.h]}),k&&(0,n.jsx)("span",{children:k}),(0,n.jsx)(b,{filePath:e}),(0,n.jsx)(i.mK,{watching:r})]})}),(0,n.jsx)(i.Ph,{style:{background:"var(--bg-panel)",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",backgroundImage:"linear-gradient(45deg, var(--bg) 25%, transparent 25%), linear-gradient(-45deg, var(--bg) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--bg) 75%), linear-gradient(-45deg, transparent 75%, var(--bg) 75%)",backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px"},children:p?(0,n.jsx)(i.nG,{tone:"error",style:{minWidth:"100%",minHeight:"100%"},children:p}):(0,n.jsx)("div",{style:{minWidth:"100%",minHeight:"100%",width:"max-content",height:"max-content",boxSizing:"border-box",display:"flex",alignItems:"flex-start",justifyContent:"flex-start",padding:16},children:(0,n.jsx)("img",{src:w,alt:e,onLoad:e=>{let t=e.currentTarget;h({w:t.naturalWidth,h:t.naturalHeight})},onError:()=>x("Failed to load image"),style:{width:u?Math.max(1,Math.round(u.w*f/100)):"auto",height:u?Math.max(1,Math.round(u.h*f/100)):"auto",maxWidth:"none",maxHeight:"none",objectFit:"contain",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"}})})})]})}function _({filePath:e,cwd:t}){let[r,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)(null),[p,x]=(0,l.useState)(null),f=(0,l.useRef)(null),m=(0,g.WP)(e).toLowerCase().split(".").pop()??"";(0,l.useEffect)(()=>{s(0),c(null),h(null),x(null),a(!1),f.current&&(f.current.close(),f.current=null);let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return f.current=r,r.addEventListener("connected",()=>a(!0)),r.addEventListener("change",e=>{try{let t=JSON.parse(e.data);"number"==typeof t.size&&c(t.size)}catch{}h(null),x(null),s(e=>e+1)}),r.addEventListener("error",()=>a(!1)),r.onerror=()=>a(!1),()=>{r.close(),f.current=null}},[e]);let y=(0,g.HG)(e),v=`/api/files/${y}?type=read${o?`&v=${o}`:""}`;return(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,trailing:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:m||"audio"}),null!=u&&(0,n.jsx)("span",{children:function(e){if(!Number.isFinite(e))return"";let t=Math.round(e),r=Math.floor(t/60);return`${r}:${String(t%60).padStart(2,"0")}`}(u)}),null!=d&&(0,n.jsx)("span",{children:(0,i.v7)(d)}),(0,n.jsx)(b,{filePath:e}),(0,n.jsx)(i.mK,{watching:r})]})}),(0,n.jsx)(i.Ph,{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"var(--bg-panel)"},children:(0,n.jsxs)("div",{style:{width:"min(680px, 100%)"},children:[p&&(0,n.jsx)("div",{style:{color:"#f87171",fontSize:13,marginBottom:12,textAlign:"center"},children:p}),(0,n.jsx)("audio",{controls:!0,preload:"metadata",src:v,onLoadedMetadata:e=>h(e.currentTarget.duration),onError:()=>x("Failed to load audio"),style:{width:"100%"}},v)]})})]})}function A({filePath:e,cwd:t,onOpenFile:r,scrollToLine:l,viewerState:i,onViewerStateChange:a}){let o,s,d;return(0,g.WP)(e).toLowerCase().endsWith(".h5ad")?(0,n.jsx)(q,{filePath:e,cwd:t}):(0,g.WP)(e).toLowerCase().endsWith(".ipynb")?(0,n.jsx)(F,{filePath:e,cwd:t}):(o=(0,g.WP)(e).toLowerCase().split(".").pop()??"",G.has(o))?(0,n.jsx)(D,{filePath:e,cwd:t}):(s=(0,g.WP)(e).toLowerCase().split(".").pop()??"",O.has(s))?(0,n.jsx)(_,{filePath:e,cwd:t}):(d=(0,g.WP)(e).toLowerCase().split(".").pop()??"",I.has(d))?(0,n.jsx)(K,{filePath:e,cwd:t}):(0,n.jsx)(S,{filePath:e,cwd:t,onOpenFile:r,scrollToLine:l,viewerState:i,onViewerStateChange:a})}function q({filePath:e,cwd:t}){return(0,n.jsxs)(i.fj,{style:{background:"var(--bg)"},children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,style:{padding:"9px 12px",fontSize:12,color:"var(--text-muted)"}}),(0,n.jsx)(i.nG,{children:"H5AD is a binary dataset. Use @explore from the file tree to open the interactive explorer."})]})}function K({filePath:e,cwd:t}){let r,[a,o]=(0,l.useState)(null),[s,d]=(0,l.useState)(!0),[c,u]=(0,l.useState)(null),h=(0,l.useRef)(null),p=(0,l.useRef)(0),x="pdf"===(r=(0,g.WP)(e).toLowerCase().split(".").pop()??"")?"pdf":"docx"===r||"doc"===r?"docx":"xlsx"===r||"xls"===r?"xlsx":"pptx"===r||"ppt"===r?"pptx":"other",f=(0,g.WP)(e).toLowerCase().split(".").pop()??"",m=(0,l.useCallback)(async e=>{try{let t=(0,g.HG)(e),r=p.current?`&v=${p.current}`:"",n=await fetch(`/api/files/${t}?type=read${r}`);if(!n.ok){let e=await n.json().catch(()=>({error:String(n.status)}));u(e.error??`HTTP ${n.status}`);return}let l=await n.arrayBuffer();o(l),u(null)}catch(e){u(String(e))}},[]);if((0,l.useEffect)(()=>{d(!0),u(null),o(null),p.current=0,h.current&&(h.current.close(),h.current=null),m(e).finally(()=>d(!1));let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return h.current=r,r.addEventListener("connected",()=>{}),r.addEventListener("change",()=>{p.current+=1,m(e)}),r.addEventListener("error",()=>{}),r.onerror=()=>{},()=>{r.close(),h.current=null}},[e,m]),s&&!a)return(0,n.jsx)(i.nG,{children:"Loading..."});if(c&&!a)return(0,n.jsx)(i.nG,{tone:"error",children:c});if(!a)return null;let y=(0,g.qP)(e,t),v=(0,n.jsx)(b,{filePath:e});return(0,n.jsxs)(i.fj,{children:["pdf"===x&&(0,n.jsx)($,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"docx"===x&&(0,n.jsx)(E,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"xlsx"===x&&(0,n.jsx)(W,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"pptx"===x&&(0,n.jsx)(M,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"other"===x&&(0,n.jsxs)(i.nG,{children:["Unsupported document format: .",f]})]})}},27568:(e,t,r)=>{r.d(t,{g:()=>f});var n=r(95155),l=r(12115),i=r(27071),a=r(89561),o=r(82228),s=r(46732),d=r(74059),c=r(4238),u=r(44542);let h={javascript:()=>Promise.all([r.e(2320),r.e(3307)]).then(r.bind(r,13307)).then(e=>e.javascript()),typescript:()=>Promise.all([r.e(2320),r.e(3307)]).then(r.bind(r,13307)).then(e=>e.javascript({typescript:!0})),python:()=>Promise.all([r.e(2320),r.e(3689)]).then(r.bind(r,53689)).then(e=>e.python()),sql:()=>Promise.all([r.e(2320),r.e(4097)]).then(r.bind(r,14097)).then(e=>e.sql()),json:()=>Promise.all([r.e(2320),r.e(5460)]).then(r.bind(r,25460)).then(e=>e.json()),html:()=>Promise.all([r.e(2320),r.e(3307),r.e(2774),r.e(144)]).then(r.bind(r,20144)).then(e=>e.html()),css:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),scss:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),less:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),markdown:()=>Promise.all([r.e(2320),r.e(3307),r.e(2774),r.e(144),r.e(2733)]).then(r.bind(r,62733)).then(e=>e.markdown()),xml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),yaml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),toml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),rust:()=>Promise.all([r.e(2320),r.e(5135)]).then(r.bind(r,55135)).then(e=>e.rust()),go:()=>Promise.all([r.e(2320),r.e(1209)]).then(r.bind(r,11209)).then(e=>e.go()),java:()=>Promise.all([r.e(2320),r.e(8198)]).then(r.bind(r,88198)).then(e=>e.java())},p=new Map;async function x(e){let t=h[e];if(!t)return null;let r=p.get(e);if(r)return r;let n=await t();return p.set(e,n),n}function f({initialContent:e,language:t,isDark:r,onChange:h,onSave:p,scrollToLine:g}){let m=(0,l.useRef)(null),y=(0,l.useRef)(null),b=(0,l.useRef)(h),v=(0,l.useRef)(p);return b.current=h,v.current=p,(0,l.useEffect)(()=>{let n=m.current;if(!n)return;let l=!1,h=y.current;return h&&(h.destroy(),y.current=null),(async()=>{let h=await x(t);if(l||!n)return;let p=v.current?a.w4.of([{key:"Mod-s",run:()=>(v.current?.(),!0),preventDefault:!0}]):[],f=i.$t.create({doc:e,extensions:[(0,a.$K)(),(0,a.dz)(),(0,o.b6)(),(0,s.y9)(s.Zt),a.w4.of([...o.pw,...o.cL,...u.OO,...c.Eo]),p,(0,u.yU)(),...r?[d.bM]:[],...h?[h]:[],a.Lz.updateListener.of(e=>{e.docChanged&&b.current?.(e.state.doc.toString())}),a.Lz.theme({"&":{height:"100%",fontSize:"13px"},".cm-scroller":{overflow:"auto",fontFamily:"var(--font-mono)"},".cm-content":{padding:"8px 0"},".cm-gutters":{borderRight:"1px solid var(--border)",background:"var(--bg)",color:"var(--text-dim)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{background:r?"#3a3d4e":"#b4d5fe"}})]});l||!n||(y.current&&y.current.destroy(),y.current=new a.Lz({state:f,parent:n}))})(),()=>{l=!0,y.current?.destroy(),y.current=null}},[t,r]),(0,l.useEffect)(()=>{let t=y.current;t&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]),(0,l.useEffect)(()=>{let e=y.current;if(!e||null==g||g<1)return;let t=e.state.doc.line(Math.min(g,e.state.doc.lines));e.dispatch({effects:a.Lz.scrollIntoView(t.from,{y:"center"})})},[g]),(0,n.jsx)("div",{ref:m,style:{height:"100%",overflow:"hidden"}})}},53308:(e,t,r)=>{r.d(t,{HF:()=>a,S7:()=>i,_t:()=>l});var n=r(95155);function l({title:e,children:t,style:r}){return(0,n.jsxs)("div",{"data-document-surface":"outline",style:{marginTop:24,...r},children:[e&&(0,n.jsx)("div",{"data-document-surface":"outline-title",style:{fontSize:12,color:"var(--text-dim)",marginBottom:8},children:e}),t]})}function i({children:e,minItemWidth:t=140,style:r}){return(0,n.jsx)("div",{"data-document-surface":"outline-grid",style:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, 1fr))`,gap:8,...r},children:e})}function a({title:e,summary:t,active:r=!1,onClick:l}){return(0,n.jsxs)("button",{"data-document-surface":"outline-item","data-document-active":r?"true":"false",onClick:l,style:{padding:"10px 12px",background:r?"var(--bg-selected)":"var(--bg)",border:r?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:6,cursor:"pointer",textAlign:"left",fontSize:11,color:"var(--text-muted)",transition:"border-color 0.12s, background 0.12s"},onMouseEnter:e=>{r||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="var(--bg)")},children:[(0,n.jsx)("div",{style:{fontWeight:600,marginBottom:2*!!t,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t&&(0,n.jsx)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t})]})}},63161:(e,t,r)=>{r.d(t,{B:()=>a});var n=r(95155),l=r(76577);function i({fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:a,zoom:o,extra:s}){let d=(0,n.jsxs)(n.Fragment,{children:[t&&(0,n.jsx)("span",{children:t}),void 0!==o&&a&&r&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,n.jsx)(l.ml,{onClick:a,title:"Zoom out",style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("line",{x1:"2",y1:"5",x2:"8",y2:"5"})})}),(0,n.jsxs)("span",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:[Math.round(100*o),"%"]}),(0,n.jsx)(l.ml,{onClick:r,title:"Zoom in",style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:[(0,n.jsx)("line",{x1:"5",y1:"2",x2:"5",y2:"8"}),(0,n.jsx)("line",{x1:"2",y1:"5",x2:"8",y2:"5"})]})})]}),s]});return(0,n.jsx)(l.K$,{pathLabel:e??"document",title:e,trailing:d,style:{minHeight:32}})}function a({fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:o,zoom:s,extra:d,bodyStyle:c,loading:u=!1,loadingLabel:h="Loading document...",error:p=null,children:x}){return(0,n.jsxs)(l.fj,{children:[(0,n.jsx)(i,{fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:o,zoom:s,extra:d}),(0,n.jsx)(l.Ph,{style:c,children:u?(0,n.jsx)(l.nG,{children:h}):p?(0,n.jsx)(l.nG,{tone:"error",children:p}):x})]})}r(12115)}}]);
22
+ </style></head><body><div class="xlsx-preview">${e}</div></body></html>`},[p,u]);return(0,l.useEffect)(()=>{let t=!1;return async function(){s(!0),c(null);try{let n=await Promise.all([r.e(4279),r.e(2708)]).then(r.bind(r,26083)),l=n.read(e,{type:"array"}),i=l.SheetNames.map(e=>{let t=l.Sheets[e];return{name:e,html:n.utils.sheet_to_html(t,{editable:!1}).replace(H,"").replace(R,"").replace(T,"")}});t||(h(i),x(0),s(!1))}catch(e){t||(console.error("XLSX parse error:",e),c(String(e)),s(!1))}}(),()=>{t=!0}},[e]),(0,n.jsx)(L.B,{fileName:t,loading:o,loadingLabel:"Loading spreadsheet...",error:d,bodyStyle:{background:"var(--bg-panel)"},extra:(0,n.jsxs)(n.Fragment,{children:[a,u.length>1&&(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",maxWidth:"min(520px, 48vw)"},children:(0,n.jsx)(i.Tg,{options:u.map((e,t)=>({key:e.name,label:(0,n.jsx)("span",{title:e.name,style:{display:"block",maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),active:t===p,onClick:()=>x(t)}))})})]}),children:!o&&!d&&u.length>0&&(0,n.jsx)("iframe",{title:t?`${t} preview`:"Spreadsheet preview",sandbox:"",srcDoc:f,style:{width:"100%",height:"100%",minHeight:320,border:"none",background:"white"}})})}var z=r(53308);function M({arrayBuffer:e,fileName:t,toolbarExtra:a}){let[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)([]),[p,x]=(0,l.useState)(0);(0,l.useEffect)(()=>{let t=!1;return async function(){s(!0),c(null);try{let n=(await Promise.all([r.e(2619),r.e(4453)]).then(r.t.bind(r,54453,23))).default,l=await n.loadAsync(e),i=[];l.forEach(e=>{let t=/^ppt\/slides\/slide(\d+)\.xml$/i.exec(e);t&&i.push({name:e,index:parseInt(t[1],10)})}),i.sort((e,t)=>e.index-t.index);let a=[];for(let e of i){let r;if(t)return;let n=await l.file(e.name).async("string"),i=/<a:t[^>]*>([^<]*)<\/a:t>/g,o=[];for(;null!==(r=i.exec(n));){let e=r[1].trim();e&&o.push(e)}a.push({index:e.index,texts:o})}t||(h(a),s(!1))}catch(e){t||(console.error("PPTX parse error:",e),c(String(e)),s(!1))}}(),()=>{t=!0}},[e]);let f=u[p],g=u.length;return(0,n.jsx)(L.B,{fileName:t,pageInfo:g>0?`Slide ${p+1} / ${g}`:void 0,loading:o,loadingLabel:"Loading presentation...",error:d,bodyStyle:{background:"var(--bg-panel)",display:"flex",justifyContent:"center",alignItems:"flex-start",padding:24},extra:(0,n.jsxs)(n.Fragment,{children:[a,g>1&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,n.jsx)(i.ml,{onClick:()=>x(e=>Math.max(e-1,0)),title:"Previous slide",disabled:p<=0,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"6 2 3 5 6 8"})})}),(0,n.jsxs)("span",{style:{fontSize:11,color:"var(--text-dim)",minWidth:28,textAlign:"center"},children:[p+1,"/",g]}),(0,n.jsx)(i.ml,{onClick:()=>x(e=>Math.min(e+1,g-1)),title:"Next slide",disabled:p>=g-1,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"4 2 7 5 4 8"})})})]})]}),children:!o&&!d&&f&&(0,n.jsx)(C.QG,{children:(0,n.jsxs)("div",{style:{width:"100%",maxWidth:800},children:[(0,n.jsxs)(C.ok,{children:[(0,n.jsxs)(C.PH,{children:["Slide ",f.index]}),(0,n.jsx)(C.OI,{style:{minHeight:200},children:0===f.texts.length?(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontStyle:"italic",fontSize:13},children:"(No text content)"}):(0,n.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:f.texts.map((e,t)=>(0,n.jsx)("li",{style:{padding:"4px 0",fontSize:14,lineHeight:1.6,color:"var(--text)",borderBottom:t<f.texts.length-1?"1px solid var(--bg-panel)":"none"},children:e},t))})})]}),g>1&&(0,n.jsx)(z._t,{title:"All slides",children:(0,n.jsx)(z.S7,{children:u.map((e,t)=>(0,n.jsx)(z.HF,{title:`Slide ${e.index}`,summary:e.texts[0]||"(empty)",active:t===p,onClick:()=>x(t)},e.index))})})]})})})}function N(e){return Array.isArray(e)?e.join(""):e}function F({filePath:e,cwd:t}){let[r,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),u=(0,l.useRef)(null);return((0,l.useEffect)(()=>{let t=(0,g.HG)(e);fetch(`/api/files/${t}?type=read`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(t.error)throw Error(t.error);if(!t.content)throw Error("Empty file");let r=JSON.parse(t.content);if(!r.cells||!Array.isArray(r.cells))throw Error("Invalid notebook format");a(r.cells)}).catch(e=>c(e.message)).finally(()=>s(!1));let r=new EventSource(`/api/files/${t}?type=watch`);return u.current=r,()=>{r.close(),u.current=null}},[e]),o)?(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e}),(0,n.jsx)(i.nG,{children:"Loading notebook..."})]}):d||!r?(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e}),(0,n.jsx)(i.nG,{children:d??"Failed to load notebook"})]}):(0,n.jsxs)(i.fj,{style:{background:"var(--bg)",overflowY:"auto"},children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:`${(0,g.WP)(e)} \xb7 ${r.length} cells`,style:{padding:"9px 12px",fontSize:12,color:"var(--text-muted)"}}),(0,n.jsx)(i.Ph,{style:{padding:0},children:(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:r.map((e,t)=>(0,n.jsx)(B,{cell:e},t))})})]})}function B({cell:e}){if("markdown"===e.cell_type){let t=N(e.source).trim();return t?(0,n.jsx)("div",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg)"},children:(0,n.jsx)(f.T,{content:t})}):null}if("code"===e.cell_type){let t=N(e.source),r=e.execution_count,l=e.outputs&&e.outputs.length>0;return(0,n.jsxs)("div",{style:{borderBottom:"1px solid var(--border)"},children:[(0,n.jsxs)("div",{style:{display:"flex",background:"var(--bg-panel)"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0,padding:"6px 0",textAlign:"center",fontSize:10,fontFamily:"var(--font-mono)",color:"var(--text-dim)",userSelect:"none"},children:null!=r?`[${r}]`:"[ ]"}),(0,n.jsx)("div",{style:{flex:1,minWidth:0,padding:"6px 12px 6px 0",overflow:"auto"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.6,color:"var(--text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,n.jsx)("code",{children:t})})})]}),l&&e.outputs.map((e,t)=>{let r=function(e){let t=[];if(!e.data)return t;for(let r of["image/png","image/jpeg","image/svg+xml","image/webp"])if(e.data[r]){let n=N(e.data[r]);t.push({data:n,mimeType:r})}return t}(e),l=function(e){if("stream"===e.output_type)return N(e.text??"").trim()||null;if(("execute_result"===e.output_type||"display_data"===e.output_type)&&e.data?.["text/plain"])return N(e.data["text/plain"]).trim()||null;if("error"===e.output_type){let t=e.ename??"Error",r=e.evalue??"";return`${t}: ${r}`}return null}(e);return"error"===e.output_type?(0,n.jsxs)("div",{style:{display:"flex",background:"rgba(248,113,113,0.04)",borderTop:"1px solid rgba(248,113,113,0.15)"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"6px 12px 6px 0"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:11,lineHeight:1.5,color:"#f87171",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:l})})]},t):(0,n.jsxs)("div",{style:{borderTop:"1px solid rgba(34,197,94,0.08)",background:"var(--bg-subtle)"},children:[r.length>0&&(0,n.jsxs)("div",{style:{display:"flex"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"6px 0"},children:r.map((e,r)=>(0,n.jsx)("img",{src:`data:${e.mimeType};base64,${e.data}`,alt:`output ${t}`,style:{maxWidth:"100%",display:"block"}},r))})]}),l&&(0,n.jsxs)("div",{style:{display:"flex"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"4px 12px 4px 0"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:11,lineHeight:1.5,color:"var(--text-muted)",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:300,overflow:"auto"},children:l})})]})]},t)})]})}return(0,n.jsx)("div",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-dim)",whiteSpace:"pre-wrap"},children:N(e.source)})})}let G=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),O=new Set(["mp3","wav","ogg","oga","opus","m4a","aac","flac","weba","webm"]),I=new Set(["pdf","docx","xlsx","pptx","doc","xls","ppt"]);function D({filePath:e,cwd:t}){let[r,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)(null),[p,x]=(0,l.useState)(null),[f,m]=(0,l.useState)(100),y=(0,l.useRef)(null),v=(0,g.WP)(e).toLowerCase().split(".").pop()??"";(0,l.useEffect)(()=>{s(0),c(null),h(null),x(null),a(!1),m(100),y.current&&(y.current.close(),y.current=null);let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return y.current=r,r.addEventListener("connected",()=>a(!0)),r.addEventListener("change",e=>{try{let t=JSON.parse(e.data);"number"==typeof t.size&&c(t.size)}catch{}s(e=>e+1)}),r.addEventListener("error",()=>a(!1)),r.onerror=()=>a(!1),()=>{r.close(),y.current=null}},[e]);let j=(0,g.HG)(e),w=`/api/files/${j}?type=read${o?`&v=${o}`:""}`,k=null!=d?(0,i.v7)(d):null,S=e=>m(Math.max(10,Math.min(500,e)));return(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,trailing:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0},children:[(0,n.jsx)(i.ml,{onClick:()=>S(f-25),title:"Zoom out",style:{width:24,height:22,fontSize:13,lineHeight:1,padding:0},children:"-"}),(0,n.jsx)("select",{value:f,onChange:e=>S(Number(e.target.value)),title:"Image zoom",style:{height:22,border:"1px solid var(--border)",borderRadius:5,background:"var(--bg-panel)",color:"var(--text)",fontSize:11,fontFamily:"var(--font-mono)",outline:"none",cursor:"pointer"},children:[25,50,75,100,125,150,200,300].map(e=>(0,n.jsxs)("option",{value:e,children:[e,"%"]},e))}),(0,n.jsx)(i.ml,{onClick:()=>S(f+25),title:"Zoom in",style:{width:24,height:22,fontSize:13,lineHeight:1,padding:0},children:"+"})]}),(0,n.jsx)("span",{style:{flexShrink:0},children:v||"image"}),u&&(0,n.jsxs)("span",{children:[u.w," \xd7 ",u.h]}),k&&(0,n.jsx)("span",{children:k}),(0,n.jsx)(b,{filePath:e}),(0,n.jsx)(i.mK,{watching:r})]})}),(0,n.jsx)(i.Ph,{style:{background:"var(--bg-panel)",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",backgroundImage:"linear-gradient(45deg, var(--bg) 25%, transparent 25%), linear-gradient(-45deg, var(--bg) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--bg) 75%), linear-gradient(-45deg, transparent 75%, var(--bg) 75%)",backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px"},children:p?(0,n.jsx)(i.nG,{tone:"error",style:{minWidth:"100%",minHeight:"100%"},children:p}):(0,n.jsx)("div",{style:{minWidth:"100%",minHeight:"100%",width:"max-content",height:"max-content",boxSizing:"border-box",display:"flex",alignItems:"flex-start",justifyContent:"flex-start",padding:16},children:(0,n.jsx)("img",{src:w,alt:e,onLoad:e=>{let t=e.currentTarget;h({w:t.naturalWidth,h:t.naturalHeight})},onError:()=>x("Failed to load image"),style:{width:u?Math.max(1,Math.round(u.w*f/100)):"auto",height:u?Math.max(1,Math.round(u.h*f/100)):"auto",maxWidth:"none",maxHeight:"none",objectFit:"contain",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"}})})})]})}function _({filePath:e,cwd:t}){let[r,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)(null),[p,x]=(0,l.useState)(null),f=(0,l.useRef)(null),m=(0,g.WP)(e).toLowerCase().split(".").pop()??"";(0,l.useEffect)(()=>{s(0),c(null),h(null),x(null),a(!1),f.current&&(f.current.close(),f.current=null);let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return f.current=r,r.addEventListener("connected",()=>a(!0)),r.addEventListener("change",e=>{try{let t=JSON.parse(e.data);"number"==typeof t.size&&c(t.size)}catch{}h(null),x(null),s(e=>e+1)}),r.addEventListener("error",()=>a(!1)),r.onerror=()=>a(!1),()=>{r.close(),f.current=null}},[e]);let y=(0,g.HG)(e),v=`/api/files/${y}?type=read${o?`&v=${o}`:""}`;return(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,trailing:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:m||"audio"}),null!=u&&(0,n.jsx)("span",{children:function(e){if(!Number.isFinite(e))return"";let t=Math.round(e),r=Math.floor(t/60);return`${r}:${String(t%60).padStart(2,"0")}`}(u)}),null!=d&&(0,n.jsx)("span",{children:(0,i.v7)(d)}),(0,n.jsx)(b,{filePath:e}),(0,n.jsx)(i.mK,{watching:r})]})}),(0,n.jsx)(i.Ph,{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"var(--bg-panel)"},children:(0,n.jsxs)("div",{style:{width:"min(680px, 100%)"},children:[p&&(0,n.jsx)("div",{style:{color:"#f87171",fontSize:13,marginBottom:12,textAlign:"center"},children:p}),(0,n.jsx)("audio",{controls:!0,preload:"metadata",src:v,onLoadedMetadata:e=>h(e.currentTarget.duration),onError:()=>x("Failed to load audio"),style:{width:"100%"}},v)]})})]})}function A({filePath:e,cwd:t,onOpenFile:r,scrollToLine:l,viewerState:i,onViewerStateChange:a}){let o,s,d;return(0,g.WP)(e).toLowerCase().endsWith(".h5ad")?(0,n.jsx)(q,{filePath:e,cwd:t}):(0,g.WP)(e).toLowerCase().endsWith(".ipynb")?(0,n.jsx)(F,{filePath:e,cwd:t}):(o=(0,g.WP)(e).toLowerCase().split(".").pop()??"",G.has(o))?(0,n.jsx)(D,{filePath:e,cwd:t}):(s=(0,g.WP)(e).toLowerCase().split(".").pop()??"",O.has(s))?(0,n.jsx)(_,{filePath:e,cwd:t}):(d=(0,g.WP)(e).toLowerCase().split(".").pop()??"",I.has(d))?(0,n.jsx)(K,{filePath:e,cwd:t}):(0,n.jsx)(S,{filePath:e,cwd:t,onOpenFile:r,scrollToLine:l,viewerState:i,onViewerStateChange:a})}function q({filePath:e,cwd:t}){return(0,n.jsxs)(i.fj,{style:{background:"var(--bg)"},children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,style:{padding:"9px 12px",fontSize:12,color:"var(--text-muted)"}}),(0,n.jsx)(i.nG,{children:"H5AD is a binary dataset. Use @explore from the file tree to open the interactive explorer."})]})}function K({filePath:e,cwd:t}){let r,[a,o]=(0,l.useState)(null),[s,d]=(0,l.useState)(!0),[c,u]=(0,l.useState)(null),h=(0,l.useRef)(null),p=(0,l.useRef)(0),x="pdf"===(r=(0,g.WP)(e).toLowerCase().split(".").pop()??"")?"pdf":"docx"===r||"doc"===r?"docx":"xlsx"===r||"xls"===r?"xlsx":"pptx"===r||"ppt"===r?"pptx":"other",f=(0,g.WP)(e).toLowerCase().split(".").pop()??"",m=(0,l.useCallback)(async e=>{try{let t=(0,g.HG)(e),r=p.current?`&v=${p.current}`:"",n=await fetch(`/api/files/${t}?type=read${r}`);if(!n.ok){let e=await n.json().catch(()=>({error:String(n.status)}));u(e.error??`HTTP ${n.status}`);return}let l=await n.arrayBuffer();o(l),u(null)}catch(e){u(String(e))}},[]);if((0,l.useEffect)(()=>{d(!0),u(null),o(null),p.current=0,h.current&&(h.current.close(),h.current=null),m(e).finally(()=>d(!1));let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return h.current=r,r.addEventListener("connected",()=>{}),r.addEventListener("change",()=>{p.current+=1,m(e)}),r.addEventListener("error",()=>{}),r.onerror=()=>{},()=>{r.close(),h.current=null}},[e,m]),s&&!a)return(0,n.jsx)(i.nG,{children:"Loading..."});if(c&&!a)return(0,n.jsx)(i.nG,{tone:"error",children:c});if(!a)return null;let y=(0,g.qP)(e,t),v=(0,n.jsx)(b,{filePath:e});return(0,n.jsxs)(i.fj,{children:["pdf"===x&&(0,n.jsx)($,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"docx"===x&&(0,n.jsx)(E,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"xlsx"===x&&(0,n.jsx)(W,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"pptx"===x&&(0,n.jsx)(M,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"other"===x&&(0,n.jsxs)(i.nG,{children:["Unsupported document format: .",f]})]})}},27568:(e,t,r)=>{r.d(t,{g:()=>f});var n=r(95155),l=r(12115),i=r(27071),a=r(89561),o=r(82228),s=r(46732),d=r(74059),c=r(4238),u=r(44542);let h={javascript:()=>Promise.all([r.e(2320),r.e(3307)]).then(r.bind(r,13307)).then(e=>e.javascript()),typescript:()=>Promise.all([r.e(2320),r.e(3307)]).then(r.bind(r,13307)).then(e=>e.javascript({typescript:!0})),python:()=>Promise.all([r.e(2320),r.e(3689)]).then(r.bind(r,53689)).then(e=>e.python()),sql:()=>Promise.all([r.e(2320),r.e(4097)]).then(r.bind(r,14097)).then(e=>e.sql()),json:()=>Promise.all([r.e(2320),r.e(5460)]).then(r.bind(r,25460)).then(e=>e.json()),html:()=>Promise.all([r.e(2320),r.e(3307),r.e(2774),r.e(144)]).then(r.bind(r,20144)).then(e=>e.html()),css:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),scss:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),less:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),markdown:()=>Promise.all([r.e(2320),r.e(3307),r.e(2774),r.e(144),r.e(2733)]).then(r.bind(r,62733)).then(e=>e.markdown()),xml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),yaml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),toml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),rust:()=>Promise.all([r.e(2320),r.e(5135)]).then(r.bind(r,55135)).then(e=>e.rust()),go:()=>Promise.all([r.e(2320),r.e(1209)]).then(r.bind(r,11209)).then(e=>e.go()),java:()=>Promise.all([r.e(2320),r.e(8198)]).then(r.bind(r,88198)).then(e=>e.java())},p=new Map;async function x(e){let t=h[e];if(!t)return null;let r=p.get(e);if(r)return r;let n=await t();return p.set(e,n),n}function f({initialContent:e,language:t,isDark:r,onChange:h,onSave:p,scrollToLine:g}){let m=(0,l.useRef)(null),y=(0,l.useRef)(null),b=(0,l.useRef)(h),v=(0,l.useRef)(p);return b.current=h,v.current=p,(0,l.useEffect)(()=>{let n=m.current;if(!n)return;let l=!1,h=y.current;return h&&(h.destroy(),y.current=null),(async()=>{let h=await x(t);if(l||!n)return;let p=v.current?a.w4.of([{key:"Mod-s",run:()=>(v.current?.(),!0),preventDefault:!0}]):[],f=i.$t.create({doc:e,extensions:[(0,a.$K)(),(0,a.dz)(),(0,o.b6)(),(0,s.y9)(s.Zt),a.w4.of([...o.pw,...o.cL,...u.OO,...c.Eo]),p,(0,u.yU)(),...r?[d.bM]:[],...h?[h]:[],a.Lz.updateListener.of(e=>{e.docChanged&&b.current?.(e.state.doc.toString())}),a.Lz.theme({"&":{height:"100%",fontSize:"13px"},".cm-scroller":{overflow:"auto",fontFamily:"var(--font-mono)"},".cm-content":{padding:"8px 0"},".cm-gutters":{borderRight:"1px solid var(--border)",background:"var(--bg)",color:"var(--text-dim)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{background:r?"#3a3d4e":"#b4d5fe"}})]});l||!n||(y.current&&y.current.destroy(),y.current=new a.Lz({state:f,parent:n}))})(),()=>{l=!0,y.current?.destroy(),y.current=null}},[t,r]),(0,l.useEffect)(()=>{let t=y.current;t&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]),(0,l.useEffect)(()=>{let e=y.current;if(!e||null==g||g<1)return;let t=e.state.doc.line(Math.min(g,e.state.doc.lines));e.dispatch({effects:a.Lz.scrollIntoView(t.from,{y:"center"})})},[g]),(0,n.jsx)("div",{ref:m,style:{height:"100%",overflow:"hidden"}})}},53308:(e,t,r)=>{r.d(t,{HF:()=>a,S7:()=>i,_t:()=>l});var n=r(95155);function l({title:e,children:t,style:r}){return(0,n.jsxs)("div",{"data-document-surface":"outline",style:{marginTop:24,...r},children:[e&&(0,n.jsx)("div",{"data-document-surface":"outline-title",style:{fontSize:12,color:"var(--text-dim)",marginBottom:8},children:e}),t]})}function i({children:e,minItemWidth:t=140,style:r}){return(0,n.jsx)("div",{"data-document-surface":"outline-grid",style:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, 1fr))`,gap:8,...r},children:e})}function a({title:e,summary:t,active:r=!1,onClick:l}){return(0,n.jsxs)("button",{"data-document-surface":"outline-item","data-document-active":r?"true":"false",onClick:l,style:{padding:"10px 12px",background:r?"var(--bg-selected)":"var(--bg)",border:r?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:6,cursor:"pointer",textAlign:"left",fontSize:11,color:"var(--text-muted)",transition:"border-color 0.12s, background 0.12s"},onMouseEnter:e=>{r||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="var(--bg)")},children:[(0,n.jsx)("div",{style:{fontWeight:600,marginBottom:2*!!t,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t&&(0,n.jsx)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t})]})}},63161:(e,t,r)=>{r.d(t,{B:()=>a});var n=r(95155),l=r(76577);function i({fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:a,zoom:o,extra:s}){let d=(0,n.jsxs)(n.Fragment,{children:[t&&(0,n.jsx)("span",{children:t}),void 0!==o&&a&&r&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,n.jsx)(l.ml,{onClick:a,title:"Zoom out",style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("line",{x1:"2",y1:"5",x2:"8",y2:"5"})})}),(0,n.jsxs)("span",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:[Math.round(100*o),"%"]}),(0,n.jsx)(l.ml,{onClick:r,title:"Zoom in",style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:[(0,n.jsx)("line",{x1:"5",y1:"2",x2:"5",y2:"8"}),(0,n.jsx)("line",{x1:"2",y1:"5",x2:"8",y2:"5"})]})})]}),s]});return(0,n.jsx)(l.K$,{pathLabel:e??"document",title:e,trailing:d,style:{minHeight:32}})}function a({fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:o,zoom:s,extra:d,bodyStyle:c,loading:u=!1,loadingLabel:h="Loading document...",error:p=null,children:x}){return(0,n.jsxs)(l.fj,{children:[(0,n.jsx)(i,{fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:o,zoom:s,extra:d}),(0,n.jsx)(l.Ph,{style:c,children:u?(0,n.jsx)(l.nG,{children:h}):p?(0,n.jsx)(l.nG,{tone:"error",children:p}):x})]})}r(12115)}}]);