@jetcrab/pi-desk 1.1.22-dev → 1.1.23-dev

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 (42) hide show
  1. package/package.json +1 -1
  2. package/src/client/l2_biz/project-preview/l2-project-preview-dialog.tsx +1 -1
  3. package/src/client/l2_biz/project-preview/l2-project-preview-page.tsx +1 -1
  4. package/src/client/l2_biz/project-preview/l2-project-preview.tsx +28 -34
  5. package/src/client/l3_modules/project-files/l3-project-document-view.tsx +162 -151
  6. package/src/client/l3_modules/project-files/l3-project-file-browser.module.css +30 -0
  7. package/src/client/l3_modules/project-files/l3-project-file-browser.tsx +137 -111
  8. package/src/client/l3_modules/project-files/l3-project-file-tabs.tsx +26 -6
  9. package/src/client/l3_modules/project-files/views/l3-project-search-controls.tsx +118 -123
  10. package/src/client/l3_modules/project-files/views/l3-project-search-results.tsx +29 -25
  11. package/temp/build/pi-desk/release/.next/BUILD_ID +1 -1
  12. package/temp/build/pi-desk/release/.next/build-manifest.json +3 -3
  13. package/temp/build/pi-desk/release/.next/required-server-files.js +2 -2
  14. package/temp/build/pi-desk/release/.next/required-server-files.json +2 -2
  15. package/temp/build/pi-desk/release/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  16. package/temp/build/pi-desk/release/.next/server/app/_global-error.html +1 -1
  17. package/temp/build/pi-desk/release/.next/server/app/_global-error.rsc +1 -1
  18. package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  19. package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  20. package/temp/build/pi-desk/release/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  21. package/temp/build/pi-desk/release/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/temp/build/pi-desk/release/.next/server/app/api/health/route.js +1 -1
  23. package/temp/build/pi-desk/release/.next/server/app/login/page_client-reference-manifest.js +1 -1
  24. package/temp/build/pi-desk/release/.next/server/app/page.js +2 -2
  25. package/temp/build/pi-desk/release/.next/server/app/page_client-reference-manifest.js +1 -1
  26. package/temp/build/pi-desk/release/.next/server/app/project-preview/page.js +1 -1
  27. package/temp/build/pi-desk/release/.next/server/app/project-preview/page_client-reference-manifest.js +1 -1
  28. package/temp/build/pi-desk/release/.next/server/chunks/20460.js +2 -2
  29. package/temp/build/pi-desk/release/.next/server/middleware-build-manifest.js +1 -1
  30. package/temp/build/pi-desk/release/.next/server/pages/500.html +1 -1
  31. package/temp/build/pi-desk/release/.next/static/chunks/9038-05fd2688407b39c1.js +15 -0
  32. package/temp/build/pi-desk/release/.next/static/chunks/app/{page-e8a5274c115f528d.js → page-54040b9fd54ee8b3.js} +2 -2
  33. package/temp/build/pi-desk/release/.next/static/chunks/app/project-preview/{page-d70ee4e9409b970a.js → page-bc18765121950e65.js} +1 -1
  34. package/temp/build/pi-desk/release/.next/static/chunks/{webpack-b60891a214e0925d.js → webpack-48eecbb66781c006.js} +1 -1
  35. package/temp/build/pi-desk/release/.next/static/css/10e063cfb3cda7bd.css +1 -0
  36. package/temp/build/pi-desk/release/.next/static/css/2c3b0c0ff1f49c68.css +1 -0
  37. package/temp/build/pi-desk/release/.next/trace-build +1 -1
  38. package/temp/build/pi-desk/release/.next/static/chunks/9038-03144ed96d613f75.js +0 -15
  39. package/temp/build/pi-desk/release/.next/static/css/6dbae2922f88ca31.css +0 -1
  40. package/temp/build/pi-desk/release/.next/static/css/f646ca6c07245c4c.css +0 -1
  41. /package/temp/build/pi-desk/release/.next/static/{MV6_lBt7Mzmi1rBNI-3dx → gAYTx4KJJR3vTtGYexj4J}/_buildManifest.js +0 -0
  42. /package/temp/build/pi-desk/release/.next/static/{MV6_lBt7Mzmi1rBNI-3dx → gAYTx4KJJR3vTtGYexj4J}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/MV6_lBt7Mzmi1rBNI-3dx/_buildManifest.js","static/MV6_lBt7Mzmi1rBNI-3dx/_ssgManifest.js"],rootMainFiles:["static/chunks/webpack-b60891a214e0925d.js","static/chunks/e388c842-1ca92f1ea0dfe8ee.js","static/chunks/64444-3e955f910569274d.js","static/chunks/main-app-6230945a5a062fce.js"],rootMainFilesTree:{},pages:{"/_app":[]}};
1
+ globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/gAYTx4KJJR3vTtGYexj4J/_buildManifest.js","static/gAYTx4KJJR3vTtGYexj4J/_ssgManifest.js"],rootMainFiles:["static/chunks/webpack-48eecbb66781c006.js","static/chunks/e388c842-1ca92f1ea0dfe8ee.js","static/chunks/64444-3e955f910569274d.js","static/chunks/main-app-6230945a5a062fce.js"],rootMainFilesTree:{},pages:{"/_app":[]}};
@@ -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-b60891a214e0925d.js"/><script src="/_next/static/chunks/e388c842-1ca92f1ea0dfe8ee.js" async=""></script><script src="/_next/static/chunks/64444-3e955f910569274d.js" async=""></script><script src="/_next/static/chunks/main-app-6230945a5a062fce.js" async=""></script><script src="/_next/static/chunks/57235-03ba1044f22b6c84.js" async=""></script><script src="/_next/static/chunks/22092-6d1bfbefa825ec03.js" async=""></script><script src="/_next/static/chunks/app/error-216b14b5da089ed3.js" async=""></script><script src="/_next/static/chunks/app/not-found-720cdf6a606b821a.js" async=""></script><script src="/_next/static/chunks/app/global-error-6f5fc4928fd1966c.js" async=""></script><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-b60891a214e0925d.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[90184,[],\"\"]\n3:I[84845,[\"57235\",\"static/chunks/57235-03ba1044f22b6c84.js\",\"22092\",\"static/chunks/22092-6d1bfbefa825ec03.js\",\"18039\",\"static/chunks/app/error-216b14b5da089ed3.js\"],\"default\"]\n4:I[44478,[],\"\"]\n5:I[66999,[\"57235\",\"static/chunks/57235-03ba1044f22b6c84.js\",\"22092\",\"static/chunks/22092-6d1bfbefa825ec03.js\",\"24345\",\"static/chunks/app/not-found-720cdf6a606b821a.js\"],\"L1ErrorPage\"]\n6:I[14405,[],\"OutletBoundary\"]\n7:\"$Sreact.suspense\"\na:I[14405,[],\"ViewportBoundary\"]\nc:I[14405,[],\"MetadataBoundary\"]\ne:I[71713,[\"34219\",\"static/chunks/app/global-error-6f5fc4928fd1966c.js\"],\"default\"]\n9:X\n0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_global-error\",{\"children\":[\"__PAGE__\",{},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$3\",\"errorStyles\":[],\"errorScripts\":null,\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"$L5\",null,{\"notFound\":true}],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@8\"}]}]]}],{},null,false,null]},null,false,\"$9\"]},null,false,\"$9\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Ld\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$e\",[]],\"S\":true,\"h\":null,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"MV6_lBt7Mzmi1rBNI-3dx\"}\n9:C\nb:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n8:null\nd:[]\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-48eecbb66781c006.js"/><script src="/_next/static/chunks/e388c842-1ca92f1ea0dfe8ee.js" async=""></script><script src="/_next/static/chunks/64444-3e955f910569274d.js" async=""></script><script src="/_next/static/chunks/main-app-6230945a5a062fce.js" async=""></script><script src="/_next/static/chunks/57235-03ba1044f22b6c84.js" async=""></script><script src="/_next/static/chunks/22092-6d1bfbefa825ec03.js" async=""></script><script src="/_next/static/chunks/app/error-216b14b5da089ed3.js" async=""></script><script src="/_next/static/chunks/app/not-found-720cdf6a606b821a.js" async=""></script><script src="/_next/static/chunks/app/global-error-6f5fc4928fd1966c.js" async=""></script><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-48eecbb66781c006.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[90184,[],\"\"]\n3:I[84845,[\"57235\",\"static/chunks/57235-03ba1044f22b6c84.js\",\"22092\",\"static/chunks/22092-6d1bfbefa825ec03.js\",\"18039\",\"static/chunks/app/error-216b14b5da089ed3.js\"],\"default\"]\n4:I[44478,[],\"\"]\n5:I[66999,[\"57235\",\"static/chunks/57235-03ba1044f22b6c84.js\",\"22092\",\"static/chunks/22092-6d1bfbefa825ec03.js\",\"24345\",\"static/chunks/app/not-found-720cdf6a606b821a.js\"],\"L1ErrorPage\"]\n6:I[14405,[],\"OutletBoundary\"]\n7:\"$Sreact.suspense\"\na:I[14405,[],\"ViewportBoundary\"]\nc:I[14405,[],\"MetadataBoundary\"]\ne:I[71713,[\"34219\",\"static/chunks/app/global-error-6f5fc4928fd1966c.js\"],\"default\"]\n9:X\n0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_global-error\",{\"children\":[\"__PAGE__\",{},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$3\",\"errorStyles\":[],\"errorScripts\":null,\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"$L5\",null,{\"notFound\":true}],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@8\"}]}]]}],{},null,false,null]},null,false,\"$9\"]},null,false,\"$9\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$La\",null,{\"children\":\"$Lb\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$7\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Ld\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$e\",[]],\"S\":true,\"h\":null,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"gAYTx4KJJR3vTtGYexj4J\"}\n9:C\nb:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n8:null\nd:[]\n"])</script></body></html>
@@ -0,0 +1,15 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9038],{1364:(e,t,s)=>{"use strict";s.d(t,{Ip:()=>g,JW:()=>m,K5:()=>v,Rc:()=>f,kt:()=>x,tz:()=>p});var i=s(7962);s(69266);var r=s(85137),a=s(79102),n=s(66467),o=s(60454),l=s(93750),c=s(39608),d=s(4947),u=s(49426),h=s(13464);function p({...e}){return(0,i.jsx)(r.D,{"data-slot":"context-menu",...e})}function m({...e}){return(0,i.jsx)(a.g,{"data-slot":"context-menu-portal",...e})}function f({className:e,...t}){return(0,i.jsx)(n.R,{"data-slot":"context-menu-trigger",className:(0,u.cn)("select-none",e),...t})}function g({className:e,align:t="start",alignOffset:s=4,side:r="right",sideOffset:n=0,finalFocus:c=!1,...d}){return(0,i.jsx)(a.g,{children:(0,i.jsx)(o.y,{className:"isolate z-50 outline-none",align:t,alignOffset:s,side:r,sideOffset:n,children:(0,i.jsx)(l._,{"data-slot":"context-menu-content",finalFocus:c,className:(0,u.cn)(h.hD,e),...d})})})}function x({className:e,inset:t,variant:s="default",...r}){return(0,i.jsx)(c.D,{"data-slot":"context-menu-item","data-inset":t,"data-variant":s,className:(0,u.cn)(h.S6,h.dQ,"group/context-menu-item",e),...r})}function v({className:e,...t}){return(0,i.jsx)(d.w,{"data-slot":"context-menu-separator",className:(0,u.cn)("-mx-1 my-1 h-px bg-border",e),...t})}},5464:(e,t,s)=>{"use strict";s.d(t,{Hl:()=>k,YM:()=>S,YV:()=>b,_Y:()=>N,hA:()=>w,uX:()=>R,vu:()=>C});var i=s(7962);s(69266);var r=s(76815),a=s(21702),n=s(60530),o=s(86023),l=s(57284),c=s(72512),d=s(49264),u=s(82611),h=s(40709),p=s(93061),m=s(87425),f=s(51173),g=s(49362),x=s(78121),v=s(49426);function b({onOpenChange:e,...t}){return(0,i.jsx)(r.D,{"data-slot":"app-dialog",...t,onOpenChange:(s,i)=>{s||!1===t.modal||"outside-press"!==i.reason||i.event.target instanceof Element&&"app-dialog-backdrop"===i.event.target.getAttribute("data-slot")?e?.(s,i):i.cancel()}})}function y({...e}){return(0,i.jsx)(a.Z,{"data-slot":"app-dialog-portal",...e})}function j({className:e,...t}){return(0,i.jsx)(n.X,{"data-slot":"app-dialog-backdrop",className:(0,v.cn)("fixed inset-0 z-[100] bg-black/35 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function w({className:e,children:t,showCloseButton:s=!0,finalFocus:r=!1,backdropClassName:a,...n}){let{t:c}=(0,x.Bd)("common");return(0,i.jsxs)(y,{children:[(0,i.jsx)(j,{className:a,forceRender:!!a}),(0,i.jsxs)(o.h,{"data-slot":"app-dialog-content",finalFocus:r,className:(0,v.cn)("fixed top-1/2 left-1/2 z-[110] flex max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-[27.5rem] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-border bg-popover text-sm text-popover-foreground shadow-lg outline-none duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n,children:[t,s?(0,i.jsxs)(l.H,{"data-slot":"app-dialog-close-button","aria-label":c("closeDialog"),title:c("closeDialog"),className:"absolute top-2 right-2 flex size-8 cursor-pointer items-center justify-center rounded-lg text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground active:bg-foreground/14 focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",children:[(0,i.jsx)(g.A,{className:"size-4"}),(0,i.jsx)("span",{className:"sr-only",children:c("closeDialog")})]}):null]})]})}function k({className:e,...t}){return(0,i.jsx)("div",{"data-slot":"app-dialog-header",className:(0,v.cn)("flex shrink-0 flex-col gap-1.5",e),...t})}function N({className:e,children:t,...s}){return(0,i.jsxs)(u.V,{"data-slot":"app-dialog-body",className:(0,v.cn)("relative min-h-0 flex-1 overflow-hidden",e),...s,children:[(0,i.jsx)(h.B,{"data-slot":"app-dialog-body-viewport",className:"h-full max-h-[inherit] w-full overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-ring",children:t}),(0,i.jsx)(p.V,{"data-slot":"app-dialog-body-scrollbar",orientation:"vertical",className:"flex h-full w-2.5 touch-none border-l border-l-transparent p-px select-none",children:(0,i.jsx)(m.l,{"data-slot":"app-dialog-body-thumb",className:"relative flex-1 rounded-full bg-muted-foreground/45 hover:bg-muted-foreground/70"})}),(0,i.jsx)(f.I,{})]})}function C({className:e,...t}){return(0,i.jsx)("div",{"data-slot":"app-dialog-footer",className:(0,v.cn)("flex shrink-0 flex-wrap justify-end gap-2 border-t bg-popover px-4 py-3",e),...t})}function S({className:e,...t}){return(0,i.jsx)(c.L,{"data-slot":"app-dialog-title",className:(0,v.cn)("text-lg leading-[1.4] font-semibold",e),...t})}function R({className:e,...t}){return(0,i.jsx)(d.r,{"data-slot":"app-dialog-description",className:(0,v.cn)("text-sm leading-5 text-muted-foreground",e),...t})}},7237:(e,t,s)=>{"use strict";function i(e){let t=atob(e.data),s=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)s[e]=t.charCodeAt(e);return new Blob([s],{type:e.mimeType})}s.d(t,{E:()=>i})},8001:(e,t,s)=>{"use strict";s.d(t,{IV:()=>m,om:()=>b,e6:()=>j,XC:()=>v});var i=s(7962),r=s(10672),a=s(69075),n=s(45216),o=s(94173),l=s(14510),c=s(3058),d=s(90458),u=s(78121),h=s(10508),p=s(49426);let m={input:["dataPiMarkdownProgress"],blockquote:["dataPiMarkdownAlert"]};function f(e){return{type:"paragraph",children:[],data:{hName:"input",hProperties:{type:"checkbox",disabled:!0,checked:"[x]"===e.toLowerCase(),..."[-]"===e?{dataPiMarkdownProgress:"true"}:{}}}}}var g=s(83029),x=s.n(g);let v=[...Object.values(h.U2),function(){return(e,t)=>{let s=String(t.value),i=(e,t)=>{let i=e.position?.start.offset;return void 0!==i&&s.slice(i,i+t.length)===t},r=e=>{let t=e.children?.[0];if("tableCell"===e.type&&e.children?.length===1&&t?.type==="text"){let s=t.value??"";/^\[[ xX-]\]$/.test(s)&&i(t,s)&&(e.children=[f(s)])}else if("listItem"===e.type&&t?.type==="paragraph"){let s=t.children?.[0];s?.type==="text"&&/^\[-\](?:\s|$)/.test(s.value??"")&&i(s,"[-]")&&(s.value=s.value.slice(3),t.children.unshift(f("[-]")),e.data={...e.data,hProperties:{className:["task-list-item"]}})}else if("blockquote"===e.type&&t?.type==="paragraph"){let s=t.children?.[0],r=s?.value?.match(/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\][ \t]*(?:\r?\n|$)/);s?.type==="text"&&r&&i(s,`[!${r[1]}]`)&&(r[0].endsWith("\n")||1===t.children.length||t.children[1]?.type==="break")&&(s.value=s.value.slice(r[0].length),s.value||(t.children.shift(),t.children[0]?.type==="break"&&t.children.shift()),0===t.children.length&&e.children.shift(),e.data={...e.data,hProperties:{dataPiMarkdownAlert:r[1].toLowerCase()}})}for(let t of e.children??[])r(t)};r(e)}}],b=x().markdown,y={note:{icon:r.A,label:"markdownNote"},tip:{icon:a.A,label:"markdownTip"},important:{icon:n.A,label:"markdownImportant"},warning:{icon:o.A,label:"markdownWarning"},caution:{icon:l.A,label:"markdownCaution"}},j={input:function({"data-pi-markdown-progress":e,...t}){let{t:s}=(0,u.Bd)("common");if(delete t.node,"checkbox"!==t.type)return(0,i.jsx)("input",{...t});let r=e?"progress":t.checked?"completed":"pending",a=e?"[-]":t.checked?"[x]":"[ ]",n=s(e?"markdownProgress":t.checked?"markdownCompleted":"markdownPending");return(0,i.jsxs)("span",{className:x().status,"data-state":r,role:"img","aria-label":n,title:n,children:[e?(0,i.jsx)(c.A,{"aria-hidden":"true"}):t.checked?(0,i.jsx)(d.A,{"aria-hidden":"true"}):null,(0,i.jsx)("span",{className:"sr-only","aria-hidden":"true",children:a})]})},blockquote:function({"data-pi-markdown-alert":e,className:t,children:s,...r}){let{t:a}=(0,u.Bd)("common");delete r.node;let n=Object.entries(y).find(([t])=>t===e)?.[1];if(!n)return(0,i.jsx)("blockquote",{...r,"data-streamdown":"blockquote",className:(0,p.cn)("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),children:s});let o=n.icon;return(0,i.jsxs)("aside",{className:x().alert,role:"note","aria-label":a(n.label),children:[(0,i.jsxs)("div",{className:x().alertTitle,children:[(0,i.jsx)(o,{"aria-hidden":"true"}),a(n.label)]}),(0,i.jsx)("div",{className:x().alertBody,children:s})]})}}},8596:e=>{e.exports={tree:"l3-project-file-browser_tree__KA1C9"}},13464:(e,t,s)=>{"use strict";s.d(t,{S6:()=>i,dQ:()=>r,hD:()=>a});let i="relative flex min-h-7 cursor-pointer items-center gap-2 rounded-md px-2 py-1 text-sm leading-5 outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",r="data-[variant=destructive]:text-destructive data-[variant=destructive]:data-highlighted:bg-destructive/10 data-[variant=destructive]:data-highlighted:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive",a="z-50 max-h-(--available-height) min-w-60 max-w-[calc(100vw-2rem)] origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-md outline-none transition-[opacity,transform] duration-100 ease-out data-starting-style:scale-[0.98] data-starting-style:opacity-0 data-ending-style:scale-[0.98] data-ending-style:opacity-0 motion-reduce:transition-none"},15265:(e,t,s)=>{"use strict";s.d(t,{fD:()=>a,qf:()=>r});var i=s(38979);let r=i.KC([i.Yj(),i.Ik({default:i.Yj(),translations:i.g1(i.Yj().min(1).max(35),i.Yj()).refine(e=>Object.keys(e).length<=16,"too many translations")}).strict()]);function a(e,t){return"string"==typeof e?e:e.translations[t]??e.translations[t.split("-")[0]]??e.default}},17511:(e,t,s)=>{"use strict";s.d(t,{Ik:()=>p,MG:()=>c,Sq:()=>u,iV:()=>m,oR:()=>f});var i=s(7962);s(69266);var r=s(73392),a=s(49426),n=s(86963),o=s(73429),l=s(68017);function c({className:e,...t}){return(0,i.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,a.cn)("group/input-group relative flex min-h-8 w-full min-w-0 items-center rounded-lg border border-input bg-card transition-colors duration-150 outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-muted has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:outline-2 has-[[data-slot=input-group-control]:focus-visible]:outline-solid has-[[data-slot=input-group-control]:focus-visible]:-outline-offset-2 has-[[data-slot=input-group-control]:focus-visible]:outline-ring has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",e),...t})}let d=(0,r.F)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function u({className:e,align:t="inline-start",...s}){return(0,i.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:(0,a.cn)(d({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...s})}let h=(0,r.F)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"min-h-7 gap-2 rounded-md px-2",sm:"","icon-xs":"size-7 rounded-md p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function p({className:e,type:t="button",variant:s="ghost",size:r="xs",...o}){return(0,i.jsx)(n.$,{type:t,"data-size":r,variant:s,className:(0,a.cn)(h({size:r}),e),...o})}function m({className:e,...t}){return(0,i.jsx)(o.p,{"data-slot":"input-group-control",className:(0,a.cn)("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:outline-none focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0",e),...t})}function f({className:e,...t}){return(0,i.jsx)(l.T,{"data-slot":"input-group-control",className:(0,a.cn)("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:outline-none focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0",e),...t})}},18302:(e,t,s)=>{"use strict";function i(e,t,s){e.addCommand(t,s,"editorTextFocus && !findWidgetVisible && !suggestWidgetVisible && !renameInputVisible && !parameterHintsVisible && !referenceSearchVisible && !editorHoverVisible && !editorHoverFocused")}s.d(t,{e:()=>i})},20476:(e,t,s)=>{"use strict";s.d(t,{Wq:()=>d,ku:()=>h,lU:()=>u});var i=s(67765);let r="pi-super:image-preview-mode",a="compressed",n=new Set,o=a,l=!1;function c(){if(!l){l=!0;try{let e=i.p$.safeParse(window.localStorage.getItem(r));o=e.success?e.data:a}catch{o=a}}}function d(){return c(),o}function u(e){if(c(),o!==e){o=e;try{window.localStorage.setItem(r,e)}catch{}for(let e of[...n])e()}}function h(e){return n.add(e),()=>n.delete(e)}},24985:(e,t,s)=>{"use strict";s.d(t,{FJ:()=>b,Ww:()=>o,cP:()=>l,gf:()=>x,u2:()=>f,y2:()=>n,yl:()=>m,zp:()=>h,zt:()=>g});var i=s(38979),r=s(15265),a=s(67765);let n=100,o=a.rh,l=i.Yj().trim().min(1).max(1024),c=i.gM("type",[i.Ik({type:i.eu("branch"),name:l}).strict(),i.Ik({type:i.eu("detached"),commit:i.Yj().regex(/^[0-9a-f]{40,64}$/)}).strict()]),d=i.k5(["added","modified","deleted","renamed","unmerged","untracked"]),u=i.Ik({path:a._g,oldPath:a._g.nullable(),indexStatus:d.nullable(),worktreeStatus:d.nullable()}).strict(),h=i.Ik({root:o,state:i.eu("ready"),head:c,changes:i.YO(u).max(5e4)}).strict(),p=i.Ik({root:o,state:i.eu("unavailable"),message:r.qf.refine(e=>("string"==typeof e?[e]:[e.default,...Object.values(e.translations)]).every(e=>e.length>0&&e.length<=2e3))}).strict(),m=i.gM("state",[h.omit({changes:!0}),p]),f=i.gM("state",[h,p]),g=i.gM("type",[i.Ik({type:i.eu("local"),name:l}).strict(),i.Ik({type:i.eu("remote"),name:l}).strict()]),x=i.Ik({head:c,recent:i.YO(l).max(5),local:i.YO(l).max(1e4),remote:i.YO(l).max(1e4)}).strict(),v=i.Ik({path:a._g,content:i.Yj()}).strict(),b=i.gM("kind",[i.Ik({kind:i.eu("text"),original:v,modified:v}).strict(),i.Ik({kind:i.eu("binary")}).strict(),i.Ik({kind:i.eu("too_large")}).strict()])},28460:(e,t,s)=>{"use strict";s.d(t,{Cp:()=>g,ph:()=>x,Tk:()=>f});var i=s(93119),r=s(93320),a=s(29029),n=s(56592);class o{constructor(e,t){this.cwd=e,this.reader=t,this.state={snapshot:{status:"idle",repositories:[],error:null},layout:"directory",changesOnly:!1,expandedRepositories:new Set},this.listeners=new Set,this.revision=0,this.request=null,this.disposed=!1,this.subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e)),this.getRevision=()=>this.revision}getWorkspace(e){return e===this.cwd?this.state:null}ensureSnapshot(e){return e!==this.cwd||"ready"===this.state.snapshot.status||this.request?Promise.resolve():this.load(!1)}refreshSnapshot(e){return e===this.cwd?this.load(!0):Promise.resolve()}setLayout(e,t){this.state.layout=t,this.publish()}setChangesOnly(e,t){this.state.changesOnly=t,this.publish()}toggleRepository(e,t){let s=new Set(this.state.expandedRepositories);s.has(t)?s.delete(t):s.add(t),this.state.expandedRepositories=s,this.publish()}dispose(){this.disposed=!0,this.request?.abort(),this.request=null,this.listeners.clear()}async load(e){if(this.disposed)return;this.request?.abort();let t=new AbortController;this.request=t,this.state.snapshot={...this.state.snapshot,status:"loading",error:null},this.publish();try{let s=await this.reader.snapshot(t.signal,e);if(this.request!==t)return;this.state.snapshot={status:"ready",repositories:s.repositories,error:null}}catch(e){if(this.request!==t)return;this.state.snapshot={...this.state.snapshot,status:"error",error:e instanceof Error?e.message:"读取 Git 状态失败"}}this.request===t&&(this.request=null,this.publish())}publish(){if(!this.disposed)for(let e of(this.revision+=1,this.listeners))e()}}var l=s(20476),c=s(42643),d=s(73230),u=s(82075);function h(e,t){return(0,d.B)({msg:c.p["zh-CN"][e],i18n:{key:`projectHistory:${e}`,...t?{params:t}:{}}})}function p(){return{status:"idle",data:null,error:null}}class m{constructor(e,t){this.reader=e,this.files=t,this.state={repositoryRoot:null,mode:"history",tip:"HEAD",base:"",target:"HEAD",strategy:"merge-base",query:"",author:"",authorSuggestions:[],selectedCommit:null,selectedChangePath:null,branches:p(),log:p(),changes:p()},this.scroll={log:0,changes:0},this.listeners=new Set,this.requests=new Map,this.revision=0,this.disposed=!1,this.logPage=1,this.changesPage=1,this.range=null,this.selection=null,this.restoredCommit=null,this.restoredChangePath=null,this.restoredChangesScroll=null,this.queryTimer=null,this.collapsedDirectories=new Set,this.changeTree=(0,u.OA)([]),this.changeRows=[],this.subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e)),this.getRevision=()=>this.revision}getChangeRows(){return this.changeRows}restoreBrowsing(e,t=!0){Object.assign(this.state,{repositoryRoot:e.repositoryRoot,mode:e.mode,tip:e.tip,base:e.base,target:e.target,strategy:e.strategy,query:e.query,author:e.author}),this.scroll.log=e.logScroll,this.restoredChangesScroll=e.changesScroll,this.restoredCommit=e.selectedCommit,this.restoredChangePath=e.selectedChangePath,t&&null!==e.repositoryRoot&&(this.loadBranches(),this.reload())}selectChange(e){this.state.changes.data?.items.some(t=>t.path===e)&&(this.state.selectedChangePath=e,this.publish())}toggleChangeDirectory(e){let t=this.changeRows.find(t=>t.directory?.path===e);if(t?.directory){if(t.expanded)this.collapsedDirectories.add(e);else for(let e of t.directory.paths)this.collapsedDirectories.delete(e);this.rebuildChangeRows(),this.publish()}}setScroll(e,t){this.scroll[e]=t}setRepository(e){if(e===this.state.repositoryRoot){"idle"===this.state.branches.status&&(this.loadBranches(),this.reload());return}this.cancel("branches"),this.state.repositoryRoot=e,this.state.tip=this.state.target="HEAD",this.state.base="",this.state.author="",this.state.authorSuggestions=[],this.state.branches=p(),this.resetSelection(),this.loadBranches(),this.reload()}setMode(e){this.state.mode!==e&&(this.state.mode=e,this.resetSelection(),this.reload())}setRevision(e,t){this.state[e]!==t&&(this.state[e]=t,this.resetSelection(),this.reload())}setStrategy(e){this.state.strategy!==e&&(this.state.strategy=e,this.resetSelection(),this.reload())}setQuery(e){this.setLogFilter("query",e)}setAuthor(e){this.setLogFilter("author",e)}setLogFilter(e,t){this.state[e]=t,this.resetSelection(),this.queryTimer=setTimeout(()=>{this.queryTimer=null,this.reload()},220)}refresh(){this.resetSelection(),this.loadBranches(),this.reload()}async reload(){if(!this.disposed&&null!==this.state.repositoryRoot){if("compare"===this.state.mode)return this.state.base?void await this.loadChanges({base:this.state.base,target:this.state.target,strategy:this.state.strategy},1,!0):void this.publish();await this.loadLog(1)}}selectCommit(e,t){let s="string"==typeof e?e:e.oid;this.state.selectedCommit=s,this.scroll.changes=0,this.clearHistoricalDiff(),this.loadChanges({commit:s,...t?{parent:t}:{}},1)}showAggregate(){this.range&&(this.state.selectedCommit=null,this.clearHistoricalDiff(),this.loadChanges(this.range,1))}loadMoreLog(){"ready"===this.state.log.status&&this.state.log.data?.hasMore&&!(this.state.log.data.items.length>=2e3)&&this.loadLog(this.logPage+1)}loadMoreChanges(){this.selection&&"ready"===this.state.changes.status&&this.state.changes.data?.hasMore&&this.loadChanges(this.selection,this.changesPage+1)}openChange(e){if(null===this.state.repositoryRoot)return;let t=this.state.changes.data,s=t?.items.find(t=>t.path===e);if(!t||!s)return;this.state.selectedChangePath=e,this.publish();let{original:i,target:r}=t.comparison,a=i?i.slice(0,8):h("emptyRevision"),n=h(this.state.selectedCommit||"merge-base"!==this.state.strategy?"historyDiffDirect":"historyDiffAncestor",{left:a,target:r.slice(0,8)});this.files.openDiff(this.state.repositoryRoot,e,{baseCommit:i,targetCommit:r,...s.oldPath?{oldPath:s.oldPath}:{}},n)}dispose(){for(let e of(this.disposed=!0,this.queryTimer&&clearTimeout(this.queryTimer),this.requests.values()))e.abort();this.requests.clear(),this.resetChangeTree(),this.listeners.clear()}async loadBranches(){let e=this.state.repositoryRoot;if(null===e||this.disposed)return;let t=this.begin("branches");this.state.branches={status:"loading",data:this.state.branches.data,error:null},this.publish();try{let s=await this.reader.branches(e,t.signal);if(!this.current("branches",t))return;this.state.branches={status:"ready",data:s,error:null}}catch(e){if(!this.current("branches",t))return;this.state.branches={status:"error",data:null,error:this.error(e)}}this.requests.delete("branches"),this.publish()}async loadLog(e){let t=this.state.repositoryRoot;if(this.disposed||null===t)return;let s=e>1?this.state.log.data:null,i=s?.tip??("compare"===this.state.mode?this.range?.target:this.state.tip),r=s?.exclude??("compare"===this.state.mode?this.range?.base:void 0);if(!i)return;let a=this.begin("log");this.state.log={status:"loading",data:s,error:null},this.publish();try{let n=await this.reader.log(t,{tip:i,...r?{exclude:r}:{},query:this.state.query,...this.state.author.trim()?{author:this.state.author.trim()}:{},page:{index:e,size:50}},a.signal);if(!this.current("log",a))return;for(let{author:t}of(this.logPage=e,n.items))t&&this.state.authorSuggestions.length<200&&!this.state.authorSuggestions.includes(t)&&this.state.authorSuggestions.push(t);if(this.state.log={status:"ready",data:{...n,items:[...s?.items??[],...n.items].slice(0,2e3)},error:null},1===e&&n.items[0]){let e=n.items.find(e=>e.oid===this.restoredCommit);this.restoredCommit=null,e?(this.state.selectedCommit=e.oid,this.loadChanges({commit:e.oid},1)):"history"===this.state.mode&&this.selectCommit(n.items[0])}}catch(e){if(!this.current("log",a))return;this.state.log={status:"error",data:s,error:this.error(e)}}this.requests.delete("log"),this.publish()}async loadChanges(e,t,s=!1){let i=this.state.repositoryRoot;if(this.disposed||null===i)return;let r=this.begin("changes"),a=t>1?this.state.changes.data:null;1===t&&this.resetChangeTree(),this.selection=e,this.state.changes={status:"loading",data:a,error:null},this.publish();try{let n=await this.reader.changes(i,{selection:e,page:{index:t,size:200}},r.signal);if(!this.current("changes",r))return;this.changesPage=t;let o=[...a?.items??[],...n.items];this.state.changes={status:"ready",data:{...n,items:o},error:null},this.changeTree=(0,u.OA)(o.map(e=>e.path)),null!==this.restoredChangesScroll&&(this.scroll.changes=this.restoredChangesScroll,this.restoredChangesScroll=null),this.rebuildChangeRows(),this.restoredChangePath&&o.some(e=>e.path===this.restoredChangePath)&&(this.state.selectedChangePath=this.restoredChangePath,this.restoredChangePath=null),this.selection="commit"in e?{commit:n.comparison.target,...n.commit?.selectedParent?{parent:n.commit.selectedParent}:{}}:{base:n.comparison.base,target:n.comparison.target,strategy:e.strategy},s&&"base"in this.selection&&(this.range=this.selection,this.loadLog(1))}catch(e){if(!this.current("changes",r))return;this.state.changes={status:"error",data:a,error:this.error(e)}}this.requests.delete("changes"),this.publish()}resetSelection(){this.restoredCommit=null,this.restoredChangePath=null,this.restoredChangesScroll=null,this.queryTimer&&clearTimeout(this.queryTimer),this.queryTimer=null,this.scroll.log=this.scroll.changes=0,this.cancel("log"),this.cancel("changes"),this.range=null,this.selection=null,this.state.selectedCommit=null,this.state.log=p(),this.state.changes=p(),this.resetChangeTree(),this.clearHistoricalDiff(),this.publish()}resetChangeTree(){this.collapsedDirectories.clear(),this.changeTree=(0,u.OA)([]),this.changeRows=[],this.state.selectedChangePath=null,this.scroll.changes=0}rebuildChangeRows(){let e=Math.floor(this.scroll.changes/36),t=this.changeRows[e],s=this.scroll.changes%36;this.changeRows=(0,u.qV)(this.changeTree,this.collapsedDirectories);let i=t?this.changeRows.findIndex(e=>e.key===t.key):-1;this.scroll.changes=i>=0?36*i+s:Math.min(this.scroll.changes,Math.max(0,(this.changeRows.length-1)*36))}clearHistoricalDiff(){this.files.state.activeDiff?.comparison&&this.files.closeDiff()}begin(e){this.cancel(e);let t=new AbortController;return this.requests.set(e,t),t}cancel(e){this.requests.get(e)?.abort(),this.requests.delete(e)}current(e,t){return!this.disposed&&this.requests.get(e)===t}error(e){return e instanceof Error?e.message:h("historyReadFailed")}publish(){if(!this.disposed)for(let e of(this.revision+=1,this.listeners))e()}}function f(e,t){return(0,r.QL)(e,{path:"/api/pi/directories/list",request:a.FH,response:a.N$},{forceRefresh:!1},t)}function g(e,t,s){return(0,r.QL)(e,{path:"/api/pi/directory-entries/list",request:a.rB,response:a.rn},{cwd:t},s)}function x(e,t,s,a,c,d={}){let u=(0,r.Y4)(e,{cwd:t},d.onUnauthorized),h=new n.h(t,u,{imagePreviewMode:l.Wq,onNotice:s,reveal:(s,r="file")=>(0,i.P)(e,{cwd:t},s,r),maxTabs:20}),p=new o(t,u),f=new m(u,h),g=!1;return{files:h,git:p,history:f,restore(){if(!g&&(g=!0,p.setLayout(t,c.treeLayout),a)){for(let e of(p.setChangesOnly(t,a.changesOnly),a.expandedRepositories))p.toggleRepository(t,e);h.restoreBrowsing(a),f.restoreBrowsing(a.history,!d.lazyHistory)}},dispose(){f.dispose(),p.dispose(),h.dispose()}}}},29029:(e,t,s)=>{"use strict";s.d(t,{FH:()=>o,N$:()=>l,rB:()=>d,rn:()=>u});var i=s(38979),r=s(66453),a=s(70698);let n=i.Ik({cwd:r.m4,sessionCount:i.ai().int().nonnegative(),updatedAt:a.k}).strict(),o=i.Ik({forceRefresh:i.zM().default(!1)}).strict(),l=i.Ik({directories:i.YO(n)}).strict();i.Ik({cwd:r.m4,ignored:i.zM()}).strict(),i.Ik({}).strict();let c=i.Ik({cwd:r.m4,name:i.Yj().trim().min(1)}).strict(),d=i.Ik({cwd:r.m4.nullable()}).strict(),u=i.Ik({cwd:r.m4.nullable(),parentCwd:r.m4.nullable(),directories:i.YO(c)}).strict(),h=i.k5(["title","user","assistant","sessionId"]),p=i.Ik({scope:h,count:i.ai().int().positive(),entryId:r.Rv.nullable(),timestampMs:a.k.nullable(),preview:i.Yj().min(1).max(160)}).strict(),m=i.Ik({sessionId:r.$E,cwd:r.m4,name:i.Yj().nullable(),createdAt:a.k,updatedAt:a.k,messageCount:i.ai().int().nonnegative(),userMessageCount:i.ai().int().nonnegative(),firstMessage:i.Yj().max(160),matches:i.YO(p).min(1).max(4).nullable()}).strict();i.Ik({cwd:r.m4,query:i.Yj().trim().max(120).default(""),forceRefresh:i.zM().default(!1),searchIn:i.YO(h).min(1).max(4).default(["title","user"])}).strict(),i.Ik({cwd:r.m4,sessions:i.YO(m)}).strict(),i.Ik({cwd:r.m4,sessionId:r.$E,query:i.Yj().trim().max(120).default(""),page:i.Ik({index:i.ai().int().positive(),size:i.ai().int().positive().max(50)}).strict()}).strict();let f=i.Ik({entryId:r.Rv,timestampMs:a.k,text:i.Yj()}).strict();i.Ik({page:i.Ik({index:i.ai().int().positive(),size:i.ai().int().positive(),total:i.ai().int().nonnegative()}).strict(),messages:i.YO(f)}).strict()},35800:(e,t,s)=>{"use strict";s.d(t,{F:()=>X});var i=s(7962),r=s(71057),a=s(14228),n=s(19932),o=s(49762),l=s(95526),c=s(14044),d=s(36670),u=s(65770),h=s(66584),p=s(31761),m=s(90213),f=s(41148),g=s(69266),x=s(78121),v=s(15265),b=s(5816),y=s(49426),j=s(81649),w=s(50479);let k=(0,g.createContext)({expandedPaths:new Set,togglePath:()=>{}}),N=({expanded:e,defaultExpanded:t=new Set,selectedPath:s,onSelect:r,onExpandedChange:a,className:n,children:o,...l})=>{let[c,d]=(0,g.useState)(t),u=e??c,h=(0,g.useCallback)(e=>{let t=new Set(u);t.has(e)?t.delete(e):t.add(e),d(t),a?.(t)},[u,a]),p=(0,g.useMemo)(()=>({expandedPaths:u,onSelect:r,selectedPath:s,togglePath:h}),[u,r,s,h]);return(0,i.jsx)(k.Provider,{value:p,children:(0,i.jsx)("div",{className:(0,y.cn)("rounded-lg border bg-background font-sans text-sm",n),role:"tree",...l,children:(0,i.jsx)("div",{className:"p-2",children:o})})})},C=({className:e,children:t,...s})=>(0,i.jsx)("span",{className:(0,y.cn)("shrink-0",e),...s,children:t}),S=({className:e,children:t,...s})=>(0,i.jsx)("span",{className:(0,y.cn)("truncate",e),...s,children:t}),R=(0,g.createContext)({isExpanded:!1,name:"",path:""}),z=({path:e,name:t,className:s,children:r,...a})=>{let{expandedPaths:n,togglePath:o,selectedPath:l,onSelect:c}=(0,g.useContext)(k),u=n.has(e),p=l===e,m=(0,g.useCallback)(()=>{o(e)},[o,e]),f=(0,g.useCallback)(()=>{c?.(e)},[c,e]),x=(0,g.useMemo)(()=>({isExpanded:u,name:t,path:e}),[u,t,e]);return(0,i.jsx)(R.Provider,{value:x,children:(0,i.jsx)(j.Nt,{onOpenChange:m,open:u,children:(0,i.jsxs)("div",{className:(0,y.cn)("",s),role:"treeitem","aria-expanded":u,"aria-selected":p,tabIndex:0,...a,children:[(0,i.jsxs)("div",{className:(0,y.cn)("flex min-h-9 w-full items-center gap-2 rounded-md px-2 py-1 text-left transition-colors hover:bg-foreground/8",p&&"bg-accent"),children:[(0,i.jsx)(j.R6,{render:(0,i.jsx)("button",{className:"flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md border-none bg-transparent p-0 outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`${u?"收起":"展开"} ${t}`,type:"button"}),children:(0,i.jsx)(d.A,{className:(0,y.cn)("size-4 shrink-0 text-muted-foreground transition-transform",u&&"rotate-90")})}),(0,i.jsxs)("button",{className:"flex min-h-7 min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md border-none bg-transparent p-0 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:f,type:"button",children:[(0,i.jsx)(C,{children:u?(0,i.jsx)(w.A,{className:"size-4 text-muted-foreground"}):(0,i.jsx)(h.A,{className:"size-4 text-muted-foreground"})}),(0,i.jsx)(S,{children:t})]})]}),(0,i.jsx)(j.Ke,{children:(0,i.jsx)("div",{className:"ml-4 border-l pl-2",children:r})})]})})})},D=(0,g.createContext)({name:"",path:""}),M=({path:e,name:t,icon:s,className:r,children:a,...n})=>{let{selectedPath:o,onSelect:c}=(0,g.useContext)(k),d=o===e,u=(0,g.useCallback)(()=>{c?.(e)},[c,e]),h=(0,g.useCallback)(t=>{("Enter"===t.key||" "===t.key)&&c?.(e)},[c,e]),p=(0,g.useMemo)(()=>({name:t,path:e}),[t,e]);return(0,i.jsx)(D.Provider,{value:p,children:(0,i.jsx)("div",{className:(0,y.cn)("flex min-h-9 cursor-pointer items-center gap-2 rounded-md px-2 py-1 outline-none transition-colors hover:bg-foreground/8 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",d&&"bg-accent",r),onClick:u,onKeyDown:h,role:"treeitem","aria-selected":d,tabIndex:0,...n,children:a??(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"size-6 shrink-0"}),(0,i.jsx)(C,{children:s??(0,i.jsx)(l.A,{className:"size-4 text-muted-foreground"})}),(0,i.jsx)(S,{children:t})]})})})};var P=s(74675),A=s(86963),T=s(49362),$=s(17511),I=s(32892);let E=["all","files","content"],O=[{key:"caseSensitive",label:"searchCaseSensitive",text:"Aa"},{key:"wholeWord",label:"searchWholeWord",text:"Ab"},{key:"regex",label:"searchRegex",text:".*"}];function q({input:e,inputRef:t,invalid:s,onQueryChange:r,onOptionsChange:a,onComposingChange:n,onClose:o,onOpenFirst:l,onFocusResults:c}){let{t:d}=(0,x.Bd)("projectFiles"),[u,h]=(0,g.useState)(null),p=(0,g.useRef)(!1);(0,g.useEffect)(()=>()=>n(!1),[n]);let m=d("files"===e.scope?"searchFiles":"content"===e.scope?"searchContent":"searchAll");return(0,i.jsxs)("div",{className:"shrink-0 px-1 pt-1",children:[(0,i.jsxs)($.MG,{className:"rounded-md",children:[(0,i.jsx)($.Sq,{className:"pl-1.5 py-0",children:(0,i.jsx)(f.A,{className:"size-3.5"})}),(0,i.jsx)($.iV,{ref:t,"data-testid":"project-file-search",className:"min-h-7 min-w-0 px-1.5 py-0.5 text-sm placeholder:text-xs",value:u??e.query,placeholder:m,"aria-label":m,"aria-invalid":s||void 0,autoComplete:"off",spellCheck:!1,onChange:e=>{p.current?h(e.target.value):r(e.target.value)},onCompositionStart:e=>{p.current=!0,h(e.currentTarget.value),n(!0)},onCompositionEnd:e=>{p.current=!1,h(null),r(e.currentTarget.value),n(!1)},onKeyDown:e=>{e.nativeEvent.isComposing||p.current||("Enter"===e.key?(e.preventDefault(),l()):"ArrowDown"===e.key&&(e.preventDefault(),c()))}}),(0,i.jsx)($.Sq,{align:"inline-end",className:"pr-0.5 py-0 has-[>button]:mr-0",children:(0,i.jsxs)(I.m_,{children:[(0,i.jsx)(I.k$,{render:(0,i.jsx)($.Ik,{size:"icon-xs",className:"min-h-7","aria-label":d("closeSearch"),onClick:o}),children:(0,i.jsx)(T.A,{className:"size-4"})}),(0,i.jsx)(I.ZI,{children:d("closeSearch")})]})})]}),(0,i.jsxs)("div",{className:"flex min-h-7 flex-wrap items-center justify-between gap-x-1",children:[(0,i.jsx)("div",{className:"flex min-w-0 items-center",role:"radiogroup","aria-label":d("searchScope"),children:E.map((t,s)=>(0,i.jsx)(A.$,{type:"button",role:"radio","aria-checked":e.scope===t,tabIndex:e.scope===t?0:-1,disabled:null!==u,variant:"ghost",size:"sm","data-testid":`project-search-scope-${t}`,className:(0,y.cn)("px-1 text-xs",e.scope===t&&"bg-accent text-accent-foreground"),onClick:()=>a({scope:t}),onKeyDown:e=>{let t="ArrowRight"===e.key||"ArrowDown"===e.key,i="ArrowLeft"===e.key||"ArrowUp"===e.key;if(!t&&!i&&"Home"!==e.key&&"End"!==e.key)return;e.preventDefault();let r="Home"===e.key?0:"End"===e.key?2:(s+(t?1:2))%3;a({scope:E[r]}),e.currentTarget.parentElement?.querySelectorAll('[role="radio"]')[r]?.focus()},children:d("all"===t?"searchScopeAll":"files"===t?"searchScopeFiles":"searchScopeContent")},t))}),(0,i.jsx)("div",{className:"ml-auto flex items-center",children:O.map(({key:t,label:s,text:r})=>(0,i.jsxs)(I.m_,{children:[(0,i.jsx)(I.k$,{render:(0,i.jsx)(A.$,{type:"button",variant:"ghost",size:"icon-sm",disabled:null!==u,"aria-label":d(s),"aria-pressed":e[t],"data-testid":`project-search-option-${t}`,className:(0,y.cn)("font-mono text-xs text-muted-foreground","wholeWord"===t&&"underline underline-offset-4"),onClick:()=>a({[t]:!e[t]})}),children:r}),(0,i.jsx)(I.ZI,{children:d(s)})]},t))})]})]})}function L(e,t,s=0){let r=[],a=0;for(let n of t){let t=Math.max(a,n.start-s,0),o=Math.min(n.end-s,e.length);o<=t||(r.push(e.slice(a,t)),r.push((0,i.jsx)("mark",{className:"rounded-sm bg-foreground/15 text-inherit",children:e.slice(t,o)},`${t}:${o}`)),a=o)}return r.push(e.slice(a)),r}function F({search:e,resultsRef:t,activePath:s,onOpen:r,wrapFile:a,renderFileIcon:n,fileDecoration:o}){let{t:u}=(0,x.Bd)("projectFiles"),h=(0,g.useId)(),[p,m]=(0,g.useState)(!1),[v,b]=(0,g.useState)(new Set),[j,w]=(0,g.useState)(null),k=new Map;for(let t of e.contentMatches){let e=k.get(t.path);e?e.push(t):k.set(t.path,[t])}let N=!!e.query.trim(),C=N&&"ready"===e.status,S=e.fileMatches.length,R=e.contentMatches.length,z="all"===e.scope&&S>3&&R>0&&!p,D=z?e.fileMatches.slice(0,3):e.fileMatches,M=u("searchCounts",{files:new Set([...e.fileMatches.map(e=>e.path),...k.keys()]).size,lines:R}),T=e=>{b(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};return(0,i.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,i.jsxs)("div",{className:"flex min-h-6 flex-wrap items-center justify-between gap-x-2 px-2 text-xs text-muted-foreground",role:"status","aria-live":"polite",children:[(0,i.jsx)("span",{children:u("searchResults")}),C?(0,i.jsx)("span",{className:"tabular-nums",children:e.truncated?u("searchShownCounts",{counts:M}):M}):null]}),(0,i.jsx)(P.V,{className:"min-h-0 flex-1",viewportClassName:"pb-2",children:(0,i.jsx)("div",{ref:t,role:"region","aria-label":u("searchResults"),"aria-busy":N&&"loading"===e.status,onKeyDown:e=>{if("ArrowDown"!==e.key&&"ArrowUp"!==e.key&&"Home"!==e.key&&"End"!==e.key)return;let t=[...e.currentTarget.querySelectorAll("button")].filter(e=>!e.disabled&&!e.closest("[hidden]")),s=t.indexOf(document.activeElement);if(s<0)return;e.preventDefault();let i="Home"===e.key?0:"End"===e.key?t.length-1:Math.max(0,Math.min(t.length-1,s+("ArrowDown"===e.key?1:-1)));t[i]?.focus()},children:N?"loading"===e.status?(0,i.jsxs)("div",{className:"flex min-h-10 items-center gap-2 px-3 text-xs text-muted-foreground",children:[(0,i.jsx)(c.A,{className:"size-3.5 animate-spin"}),u("searching")]}):"error"===e.status?(0,i.jsx)("p",{role:"alert",className:"mx-3 my-2 break-words rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:e.error||u("searchFailed")}):C&&0===S&&0===R?(0,i.jsxs)("div",{className:"px-5 py-9 text-center text-sm text-muted-foreground",children:[(0,i.jsx)(f.A,{className:"mx-auto mb-3 size-6"}),(0,i.jsx)("p",{children:u(e.truncated?"resultLimit":"noMatches")}),(0,i.jsx)("p",{className:"mt-2 text-xs",children:u("searchTryOptions")})]}):C?(0,i.jsxs)(i.Fragment,{children:[S>0?(0,i.jsxs)("section",{children:["all"===e.scope?(0,i.jsxs)("h3",{className:"flex min-h-6 items-center gap-2 px-2 text-xs text-muted-foreground",children:[u("searchFileHeading"),(0,i.jsx)("span",{className:"tabular-nums",children:S})]}):null,D.map(({path:e,ranges:t})=>{let l=e.lastIndexOf("/"),c=o(e);return a(e,void 0,(0,i.jsxs)(A.$,{type:"button",variant:"ghost","data-testid":`project-search-result-${e}`,"data-search-result":"true",className:(0,y.cn)("mx-1 flex min-h-6 w-[calc(100%-0.5rem)] justify-start gap-1 px-1 py-0 text-left font-normal [@media(pointer:coarse)]:min-h-9",s===e&&"bg-accent"),title:e,onClick:()=>r(e),children:[(0,i.jsx)("span",{className:"shrink-0",children:n(e)}),(0,i.jsxs)("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[(0,i.jsx)("span",{className:(0,y.cn)("truncate text-sm",c.className),children:L(e.slice(l+1),t,l+1)}),l>=0?(0,i.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:L(e.slice(0,l),t)}):null]}),c.badge?(0,i.jsx)("span",{className:(0,y.cn)("text-xs",c.className),"aria-label":u("gitStatus",{status:c.badge}),children:c.badge}):null]},e))}),z?(0,i.jsx)(A.$,{type:"button",variant:"ghost",size:"sm",className:"ml-5 min-h-6 py-0 text-xs text-muted-foreground [@media(pointer:coarse)]:min-h-9",onClick:()=>m(!0),children:u("searchExpandFiles",{count:S-3})}):null]}):null,R>0?(0,i.jsxs)("section",{className:(0,y.cn)(S>0&&"mt-1"),children:["all"===e.scope?(0,i.jsxs)("h3",{className:"flex min-h-6 flex-wrap items-center gap-x-2 px-2 text-xs text-muted-foreground",children:[u("searchContentHeading"),(0,i.jsx)("span",{children:u("searchContentCounts",{lines:R,files:k.size})})]}):null,[...k].map(([e,t],s)=>{let n=e.lastIndexOf("/"),o=!v.has(e),c=`${h}-${s}`;return(0,i.jsxs)("section",{className:"mb-1",children:[(0,i.jsxs)(A.$,{type:"button",variant:"ghost",className:"min-h-6 w-full justify-start gap-1 rounded-none px-2 py-0 text-left font-normal [@media(pointer:coarse)]:min-h-9",title:e,"aria-expanded":o,"aria-controls":c,onClick:()=>T(e),onKeyDown:t=>{("ArrowLeft"===t.key&&o||"ArrowRight"===t.key&&!o)&&(t.preventDefault(),T(e))},children:[(0,i.jsx)(d.A,{className:(0,y.cn)("size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none",o&&"rotate-90")}),(0,i.jsx)(l.A,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,i.jsxs)("span",{className:"min-w-0 truncate text-sm",children:[e.slice(n+1),(0,i.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground",children:e.slice(0,Math.max(0,n))})]}),(0,i.jsx)("span",{className:"ml-auto shrink-0 rounded bg-muted px-1 text-xs text-muted-foreground tabular-nums",children:t.length})]}),(0,i.jsx)("div",{id:c,hidden:!o,children:t.map(({line:t,text:s,ranges:n})=>a(e,t,(0,i.jsxs)(A.$,{type:"button",variant:"ghost","data-testid":`project-search-line-${e}-${t}`,"data-search-result":"true",className:(0,y.cn)("min-h-6 w-full justify-start gap-1 rounded-none border-l-2 border-transparent py-0 pr-2 pl-5 text-left font-mono font-normal [@media(pointer:coarse)]:min-h-9",j?.path===e&&j.line===t&&"border-l-foreground/50 bg-accent"),title:s,"aria-label":u("searchOpenLine",{path:e,line:t}),onClick:()=>{w({path:e,line:t}),r(e,t)},children:[(0,i.jsx)("span",{className:"min-w-5 shrink-0 text-right text-xs text-muted-foreground tabular-nums",children:t}),(0,i.jsx)("span",{className:"min-w-0 truncate whitespace-pre text-sm",children:L(s,n)})]},`${e}:${t}`)))})]},e)})]}):null,e.truncated?(0,i.jsx)("p",{className:"px-3 py-2 text-xs leading-5 text-muted-foreground",children:u("resultLimit")}):null]}):null:(0,i.jsxs)("div",{className:"px-5 py-9 text-center text-sm text-muted-foreground",children:[(0,i.jsx)(f.A,{className:"mx-auto mb-3 size-6"}),(0,i.jsx)("p",{children:u("searchStart")}),(0,i.jsx)("p",{className:"mt-2 text-xs",children:u("files"===e.scope?"searchFiles":"content"===e.scope?"searchContent":"searchAll")})]})})}),"files"!==e.scope?(0,i.jsx)("p",{className:"shrink-0 px-2 py-1 text-xs leading-5 text-muted-foreground",children:u("searchTextLimit")}):null]})}var B=s(35989),_=s(60682),W=s(8596),Y=s.n(W),V=s(82075);let H=[],K=new WeakMap;function U(e){let t=e.split("/").at(-1)?.toLocaleLowerCase()??"",s=t.includes(".")?t.split(".").at(-1)??"":"";return["png","jpg","jpeg","webp","gif"].includes(s)?(0,i.jsx)(r.A,{className:"size-4 text-muted-foreground"}):"json"===s||"jsonl"===s?(0,i.jsx)(a.A,{className:"size-4 text-muted-foreground"}):["md","mdx","txt"].includes(s)?(0,i.jsx)(n.A,{className:"size-4 text-muted-foreground"}):["ts","tsx","js","jsx","mjs","cjs","py","go","rs","java","c","cpp","h","hpp","css","scss","html","xml","yaml","yml","toml","sql","sh"].includes(s)?(0,i.jsx)(o.A,{className:"size-4 text-muted-foreground"}):(0,i.jsx)(l.A,{className:"size-4 text-muted-foreground"})}function J(e){if(e)return(0,B.iH)(e.change)}function G({state:e,onRetry:t}){let{t:s}=(0,x.Bd)("projectFiles");return e&&"idle"!==e.status&&"loading"!==e.status?"error"!==e.status?null:(0,i.jsx)("button",{type:"button",onClick:t,className:"min-h-8 w-full rounded px-2 text-left text-xs text-destructive hover:bg-destructive/10",children:s("retryReading",{error:e.error})}):(0,i.jsxs)("div",{className:"flex min-h-8 items-center gap-2 px-2 text-xs text-muted-foreground",children:[(0,i.jsx)(c.A,{className:"size-3.5 animate-spin"})," ",s("reading")]})}function X({cwd:e,projectName:t,runtime:s,gitRuntime:r,onOpenGitBranches:a,onFileOpened:n,rootTitle:o,showRootTitle:l=!0,gitReadOnly:c=!1}){let j,w,k,{t:R}=(0,x.Bd)("projectFiles"),{locale:D}=(0,b.i)();(0,g.useSyncExternalStore)(s.subscribe,s.getRevision,s.getRevision),(0,g.useSyncExternalStore)(r.subscribe,r.getRevision,r.getRevision);let T=s.state,$=r.getWorkspace(e),I=(0,g.useRef)(null),E=(0,g.useRef)(null),O=(0,g.useRef)(null),L=(0,g.useRef)(null),[W,Q]=(0,g.useState)(!1),Z=(0,g.useRef)({}),ee=(0,g.useCallback)(e=>{e?K.set(s,Z.current):K.get(s)===Z.current&&K.delete(s),Q(e)},[s]),et=T.searchOpen,es=()=>{Q(!1),s.setSearchOpen(!1),requestAnimationFrame(()=>L.current?.focus())},[ei,er]=(0,g.useState)({}),ea=(e,t)=>{let s=ei[e]??300;return s<t?(0,i.jsx)("button",{type:"button",className:"min-h-8 px-3 text-sm text-muted-foreground hover:bg-accent",onClick:t=>{t.stopPropagation(),er(t=>({...t,[e]:s+300}))},children:R("showMore",{visible:s,total:t})}):null},en=T?.search.query??"",eo=$?.snapshot.repositories??H,el=(0,B.eP)(eo),ec=new Map(el.map(e=>[e.projectPath,e])),ed=eo.map(e=>e.root).filter(Boolean);(0,g.useEffect)(()=>{s.ensureRoot(),r.ensureSnapshot(e)},[e,r,s]),(0,g.useEffect)(()=>{let e=I.current;e&&!et&&(e.scrollTop=T.treeScrollTop)},[et,T]),(0,g.useEffect)(()=>{if(!et||!en.trim()||W)return;let e=window.setTimeout(()=>{K.has(s)||s.search(en)},220);return()=>window.clearTimeout(e)},[W,s,et,en]);let eu=[...$?.expandedRepositories??[]].join("\0");(0,g.useEffect)(()=>{if($&&"repository"===$.layout)for(let e of $.expandedRepositories)s.ensureDirectory(e)},[eu,$,s]);let eh=new Set(ed),ep=new Map,em=new Set([...T.expandedPaths].map(e=>(0,V.Im)("directory",e))),ef=(e,t)=>{let i=new Set(T.expandedPaths);for(let s of e.paths)t?i.add(s):i.delete(s);s.setExpandedPaths(i,!1),t&&!$?.changesOnly&&s.expandDirectoryChain(e.path,eh)},eg=e=>{for(let[t,s]of[...ep].filter(([t])=>e.has((0,V.Im)("directory",t))!==T.expandedPaths.has(t)))ef(s,e.has((0,V.Im)("directory",t)))},ex=(e,t)=>{s.openFile(e,t),n?.()},ev=e=>{s.openDiff(e.repositoryRoot,e.path),n?.()},eb=(t,r)=>(0,i.jsx)(_.J,{cwd:e,path:t.targetPath,type:"directory",trigger:r,expanded:T.expandedPaths.has(t.path),onToggle:()=>ef(t,!T.expandedPaths.has(t.path)),onReveal:s.canReveal?(e,t)=>s.revealFile(e,t):void 0},(0,V.Im)("directory",t.path)),ey=(t,r,a=null,n=!1,o)=>(0,i.jsx)(_.J,{cwd:e,path:t,type:"file",trigger:r,openLabel:R(n?"viewDiff":"openPreview"),onOpen:()=>n&&a?ev(a):ex(t,o),oldPath:a?.change.oldPath?(0,V._J)(a.repositoryRoot,a.change.oldPath):void 0,onReveal:s.canReveal?(e,t)=>s.revealFile(e,t):void 0},void 0===o?(0,V.Im)("file",t):`${t}:${o}`),ej=(e,t,s,r)=>ey(e,(0,i.jsxs)(M,{path:(0,V.Im)("file",e),name:t,title:e,"data-testid":`project-file-${e}`,onClick:()=>{r&&s?ev(s):ex(e)},children:[(0,i.jsx)("span",{className:"size-6 shrink-0"}),(0,i.jsx)(C,{children:U(e)}),(0,i.jsx)(S,{"data-testid":`project-file-name-${e}`,className:(0,y.cn)("min-w-0 flex-1",J(s)),children:t}),s?(0,i.jsx)("span",{className:(0,y.cn)("text-xs tabular-nums",J(s)),"aria-label":R("gitStatus",{status:(0,B.XB)(s.change)}),children:(0,B.XB)(s.change)}):null]}),s,r),ew=(e,t,r)=>{let a=T?.directories.get(e);if(a?.status!=="ready")return(0,i.jsx)(G,{state:a,onRetry:()=>void s.ensureDirectory(e)});let n=r?a.entries.filter(s=>{let i;return i=(0,V._J)(e,s.name),!ed.some(e=>e!==t&&i===e)}):a.entries;return(0,i.jsxs)(i.Fragment,{children:[n.slice(0,ei[`directory:${e}`]??300).map(a=>{let n=(0,V._J)(e,a.name);if("file"===a.type)return ej(n,a.name,ec.get(n)??null,!1);let o=s.compactDirectory(n,eh);return ep.set(n,o),eb(o,(0,i.jsx)(z,{path:(0,V.Im)("directory",n),name:o.label,title:o.targetPath,"data-testid":`project-folder-${n}`,children:ew(o.targetPath,t,r)}))}),ea(`directory:${e}`,n.length),a.truncated?(0,i.jsx)("p",{className:"px-2 py-2 text-xs leading-5 text-amber-600 dark:text-amber-400",children:R("directoryLimit")}):null,0===n.length?(0,i.jsx)("p",{className:"px-2 py-2 text-xs text-muted-foreground",children:R("emptyDirectory")}):null]})},ek=(e,t)=>{let s=e.get(t);if(!s)return null;let r=[...s.directories.keys()].sort(V.Kn),a=[...s.files].sort(V.Kn),n=ei[`changes:${t}`]??300;return(0,i.jsxs)(i.Fragment,{children:[r.slice(0,n).map(t=>{let s=(0,V.xV)(t,e,eh);return ep.set(t,s),eb(s,(0,i.jsx)(z,{path:(0,V.Im)("directory",t),name:s.label,title:s.targetPath,"data-testid":`project-folder-${t}`,children:ek(e,s.targetPath)}))}),a.slice(0,Math.max(0,n-r.length)).map(e=>ej(e,e.slice(e.lastIndexOf("/")+1),ec.get(e)??null,!0)),ea(`changes:${t}`,r.length+a.length)]})},eN=e=>{if(e.startsWith("directory:")){let t=ep.get(e.slice(10));t&&ef(t,!T.expandedPaths.has(t.path));return}let t=e.slice(5),s=ec.get(t);$?.changesOnly&&s?ev(s):ex(t)},eC=(n,o,l)=>{if($?.changesOnly&&!n)return null;let m=$?.expandedRepositories.has(o)??!1,f=n?.state==="ready"?el.filter(e=>e.repositoryRoot===o):[],g=f.length;if($?.changesOnly&&n?.state==="ready"&&0===g)return null;let x=(0,V.OA)(f.map(e=>e.projectPath),o);return(0,i.jsxs)("section",{"data-testid":`project-git-repository-${o||"root"}`,className:"border-b last:border-b-0",children:[(0,i.jsxs)("div",{className:"flex min-h-8 items-center gap-1 px-1 py-0.5",children:[(0,i.jsxs)("button",{"data-testid":`project-git-repository-toggle-${o||"root"}`,type:"button",className:"flex min-w-0 flex-1 items-center gap-1 rounded-md px-1 py-0.5 text-left hover:bg-muted/60","aria-expanded":m,onClick:()=>{m&&s.cancelDirectoryExpansion(o),r.toggleRepository(e,o),m||s.ensureDirectory(o)},children:[(0,i.jsx)(d.A,{className:(0,y.cn)("size-3 shrink-0 text-muted-foreground transition-transform",m&&"rotate-90")}),n?(0,i.jsx)(u.A,{className:"size-4 shrink-0 text-muted-foreground"}):(0,i.jsx)(h.A,{className:"size-4 shrink-0 text-muted-foreground"}),(0,i.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",title:n&&o||t,children:l})]}),n?(0,i.jsxs)("button",{"data-testid":`project-git-branch-${o||"root"}`,type:"button",disabled:c||"ready"!==n.state,className:(0,y.cn)((0,A.r)({variant:"ghost",size:"sm"}),"max-w-28 shrink gap-1 font-mono text-xs text-muted-foreground"),title:"ready"===n.state?R(c?"gitBranchReadOnly":"gitBranches"):(0,v.fD)(n.message,D),"aria-label":R(c?"gitBranchReadOnly":"gitBranches"),onClick:()=>a(o),children:[(0,i.jsx)(p.A,{className:"size-3 shrink-0"}),(0,i.jsx)("span",{className:"min-w-0 truncate",children:"ready"===n.state?(0,B.ws)(n.head):R("unavailable")}),g>0?(0,i.jsx)("span",{className:"rounded-md bg-muted px-1 text-xs text-status-warning",children:g}):null]}):null]}),m?$?.changesOnly?(0,i.jsx)(N,{className:"rounded-none border-0 bg-transparent px-1 pb-1",expanded:em,selectedPath:T?.activeDiff?(0,V.Im)("file",(0,B.oW)(T.activeDiff.repositoryRoot,T.activeDiff.path)):void 0,onExpandedChange:eg,onSelect:eN,children:g>0?ek(x,o):(0,i.jsx)("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:R("noChanges")})}):(0,i.jsx)(N,{className:"rounded-none border-0 bg-transparent px-1 pb-1",expanded:em,selectedPath:T.activePath?(0,V.Im)("file",T.activePath):void 0,onExpandedChange:eg,onSelect:eN,children:ew(o,n?.root??null,!0)}):null]},n?`git:${o}`:"workspace")},eS=1===eo.length&&eo[0]?.root===""?eo[0]:null,eR=eo.length>0&&!eS,ez=eR?$?.layout??"directory":"directory",eD=eS?(0,i.jsxs)("button",{type:"button",disabled:c||"ready"!==eS.state,className:(0,y.cn)((0,A.r)({variant:"ghost",size:"sm"}),"max-w-32 shrink gap-1 font-mono text-xs text-muted-foreground",!l&&"min-w-0 flex-1 justify-start"),"aria-label":R(c?"gitBranchReadOnly":"gitBranches"),title:"ready"===eS.state?`${R(c?"gitBranchReadOnly":"gitBranches")} \xb7 ${(0,B.ws)(eS.head)}`:(0,v.fD)(eS.message,D),onClick:()=>a(""),children:[(0,i.jsx)(p.A,{className:"size-3 shrink-0"}),(0,i.jsx)("span",{className:"truncate",children:"ready"===eS.state?(0,B.ws)(eS.head):R("unavailable")})]}):null,eM=(0,i.jsxs)("div",{className:"flex min-h-8 min-w-0 flex-wrap items-center gap-x-1 gap-y-0.5 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",tabIndex:l?void 0:0,"aria-label":R("projectFiles",{name:t}),children:[eR?(0,i.jsx)("div",{className:"flex shrink-0 gap-0.5",role:"group","aria-label":R("layout"),children:["directory","repository"].map(t=>(0,i.jsx)("button",{"data-testid":`project-file-layout-${t}`,type:"button","aria-pressed":ez===t,className:(0,y.cn)((0,A.r)({variant:"ghost",size:"sm"}),ez===t&&"bg-accent text-accent-foreground"),onClick:()=>{s.cancelDirectoryExpansion(),r.setLayout(e,t)},children:R("directory"===t?"directory":"repository")},t))}):null,eo.length>0?(0,i.jsxs)("button",{"data-testid":"project-git-changes-toggle",type:"button","aria-pressed":$?.changesOnly??!1,className:(0,y.cn)((0,A.r)({variant:"ghost",size:"sm"}),"min-w-0 gap-1",$?.changesOnly&&"bg-accent text-accent-foreground"),onClick:()=>{s.cancelDirectoryExpansion(),r.setChangesOnly(e,!$?.changesOnly)},children:[(0,i.jsx)(m.A,{className:"size-3 shrink-0"}),(0,i.jsx)("span",{className:"truncate",children:R("changesOnly")}),(0,i.jsx)("span",{className:"rounded-md bg-muted px-1 font-mono text-xs",children:el.length})]}):null,l?null:eD,(0,i.jsx)("button",{ref:L,type:"button",className:(0,y.cn)((0,A.r)({variant:"ghost",size:"icon-sm"}),"ml-auto"),"aria-label":R("searchProject"),title:R("searchProject"),onClick:()=>{s.setSearchOpen(!0),requestAnimationFrame(()=>E.current?.focus())},children:(0,i.jsx)(f.A,{className:"size-3.5"})})]});return(0,i.jsxs)("section",{className:"flex h-full min-h-0 flex-col bg-sidebar","aria-label":R("projectFiles",{name:t}),onKeyDown:e=>{!et||"Escape"!==e.key||(e.stopPropagation(),e.nativeEvent.isComposing||W||(e.preventDefault(),es()))},children:[et?(0,i.jsx)(q,{input:T.search,inputRef:E,invalid:"error"===T.search.status,onQueryChange:e=>s.setSearchQuery(e),onOptionsChange:e=>s.setSearchOptions(e),onComposingChange:ee,onClose:es,onOpenFirst:()=>{let e=s.state.search;if("ready"!==e.status)return;let t=e.fileMatches[0],i=e.contentMatches[0];t?ex(t.path):i&&ex(i.path,i.line)},onFocusResults:()=>O.current?.querySelector("button")?.focus()}):(0,i.jsxs)("div",{className:"border-b px-1",children:[l?(0,i.jsxs)("div",{className:"flex min-h-7 min-w-0 items-center gap-1",children:[(0,i.jsx)(_.J,{cwd:e,path:"",type:"directory",onReveal:s.canReveal?(e,t)=>s.revealFile(e,t):void 0,trigger:o?(0,i.jsx)("div",{className:"flex min-w-0 flex-1",children:o}):(0,i.jsxs)("div",{tabIndex:0,className:"flex min-w-0 flex-1 items-baseline gap-1",children:[(0,i.jsx)("p",{className:"shrink-0 truncate text-xs font-semibold",title:t,children:t}),(0,i.jsx)("span",{className:"text-xs text-muted-foreground",children:"\xb7"}),(0,i.jsx)("p",{className:"min-w-0 truncate font-mono text-xs text-muted-foreground",title:e,children:(j=e.replaceAll("\\","/").split("/").filter(Boolean)).length<=2?e:`…/${j.slice(-2).join("/")}`})]})}),eD]}):null,l?eM:(0,i.jsx)(_.J,{cwd:e,path:"",type:"directory",onReveal:s.canReveal?(e,t)=>s.revealFile(e,t):void 0,trigger:eM})]}),et?(0,i.jsx)(F,{search:T.search,resultsRef:O,activePath:T.activeDiff?null:T.activePath,onOpen:ex,wrapFile:(e,t,s)=>ey(e,s,ec.get(e)??null,!1,t),renderFileIcon:U,fileDecoration:e=>{let t=ec.get(e)??null;return{className:J(t),badge:t?(0,B.XB)(t.change):void 0}}},JSON.stringify([T.search.query,T.search.scope,T.search.caseSensitive,T.search.wholeWord,T.search.regex])):(0,i.jsxs)(P.V,{className:(0,y.cn)(Y().tree,"min-h-0 flex-1"),viewportClassName:"py-0.5",viewportRef:I,onViewportScroll:e=>s.setTreeScrollTop(e.currentTarget.scrollTop),children:[eo.filter(e=>"unavailable"===e.state).map(e=>"unavailable"===e.state?(0,i.jsxs)("p",{role:"alert",className:"mx-2 mb-1 break-words rounded-md bg-muted px-2 py-2 text-sm text-destructive",children:[e.root||t,":",(0,v.fD)(e.message,D)]},e.root):null),$?.snapshot.status==="error"?(0,i.jsx)("p",{className:"mx-2 mb-1 rounded-md bg-muted px-2 py-2 text-sm text-destructive",children:$.snapshot.error}):null,"repository"===ez?(w=eo.some(e=>""===e.root),k=$?.changesOnly?eo.filter(e=>"unavailable"===e.state||e.changes.length>0):eo,(0,i.jsxs)("div",{className:"px-1",children:[w?null:eC(null,"",t),k.map(e=>eC(e,e.root,(0,B.Hj)(t,e.root))),$?.changesOnly&&0===k.length?(0,i.jsx)("p",{className:"px-2 py-5 text-center text-xs text-muted-foreground",children:R("noChangedFiles")}):null]})):(()=>{if($?.changesOnly){let e=(0,V.OA)(el.map(e=>e.projectPath));return(0,i.jsx)(N,{className:"rounded-none border-0 bg-transparent",expanded:em,selectedPath:T?.activeDiff?(0,V.Im)("file",(0,B.oW)(T.activeDiff.repositoryRoot,T.activeDiff.path)):T.activePath?(0,V.Im)("file",T.activePath):void 0,onExpandedChange:eg,onSelect:eN,children:el.length>0?ek(e,""):(0,i.jsx)("p",{className:"px-2 py-5 text-center text-xs text-muted-foreground",children:eo.some(e=>"unavailable"===e.state)?R("incompleteRepository"):R("noChangedFiles")})})}return(0,i.jsx)(N,{className:"rounded-none border-0 bg-transparent",expanded:em,selectedPath:T.activePath?(0,V.Im)("file",T.activePath):void 0,onExpandedChange:eg,onSelect:eN,children:ew("",null,!1)})})()]})]})}},35842:(e,t,s)=>{"use strict";s.d(t,{X:()=>x});var i=s(7962),r=s(49762),a=s(49362),n=s(24121),o=s(86758),l=s(69266),c=s(78121),d=s(49426),u=s(86963),h=s(1364),p=s(73165),m=s(35989);let f=[{scope:"current",label:"closeTab"},{scope:"others",label:"closeOtherTabs"},{scope:"right",label:"closeRightTabs"},{scope:"left",label:"closeLeftTabs"},{scope:"all",label:"closeAllTabs"}];function g(e,t){let s=e.replaceAll("\\","/").split("/"),i=s.at(-1)??e;return t.some(t=>t!==e&&t.split("/").at(-1)===i)&&s.length>1?s.slice(-2).join("/"):i}function x({cwd:e,gitRuntime:t,paths:s,activePath:v,diffPath:b,mobile:y,actions:j,onActivate:w,onClose:k}){let{t:N}=(0,c.Bd)("projectFiles");(0,l.useSyncExternalStore)(t.subscribe,t.getRevision,t.getRevision);let C=t.getWorkspace(e)?.snapshot,S=(0,l.useRef)(null),R=(0,l.useRef)(!1),[z,D]=(0,l.useState)(!1),[M,P]=(0,l.useState)(!1),[A,T]=(0,l.useState)([]),$=void 0!==j,I=$&&!y?32:36,E=(y?2:3)*I,O=s.map(e=>({path:e,label:g(e,s),title:e}));b&&O.push({path:null,label:`${g(b,s)} \xb7 Diff`,title:b});let q=b?null:v;return((0,l.useLayoutEffect)(()=>{let e=S.current;if(!e)return;let t=()=>{let t=Array.from(e.children).filter(e=>e instanceof HTMLElement).flatMap((e,t)=>e.offsetTop>=E?[t]:[]);T(e=>e.join(",")===t.join(",")?e:t),P(e.scrollHeight>E);let s=e.querySelector('[aria-selected="true"]')?.closest("[data-file-tab]");s&&s.offsetTop>=E&&D(!0)};t();let s=new ResizeObserver(t);return s.observe(e),()=>s.disconnect()},[q,b,E,s]),0===O.length)?null:(0,i.jsxs)("div",{className:(0,d.cn)("shrink-0 bg-muted",$?"flex flex-wrap items-start":"border-b"),"data-testid":"file-tabs",children:[(0,i.jsx)("div",{className:(0,d.cn)("overflow-hidden",$&&"min-w-0 flex-[1_1_12rem]"),style:{maxHeight:z?void 0:E},children:(0,i.jsx)("div",{ref:S,role:"tablist","aria-label":N("openFiles"),className:"relative flex flex-wrap content-start items-start",children:O.map((t,s)=>{let n=!z&&A.includes(s),o=t.path===q,l=t.path&&C?.status==="ready"?(0,m.lN)(e,t.path,C.repositories)?.change:void 0,c=null===t.path?N("closeDiff",{name:t.title.split("/").at(-1)}):N("closeFile",{name:t.title.split("/").at(-1)});return(0,i.jsxs)(h.tz,{onOpenChange:(e,t)=>{e&&"pointerType"in t.event&&"touch"===t.event.pointerType&&(R.current=!0)},children:[(0,i.jsxs)(h.Rc,{render:(0,i.jsx)("div",{"data-file-tab":!0,"data-testid":null===t.path?`file-diff-tab-${t.title}`:`file-tab-${t.path}`,"aria-hidden":n||void 0,inert:n||void 0,title:t.title,className:(0,d.cn)("flex max-w-full items-center text-sm",$?y?"h-9":"h-8":"h-9 border-r border-b",y?"w-[min(50%,12rem)]":"max-w-60",n&&"invisible",o?"bg-background text-foreground shadow-[inset_0_-2px_0_var(--primary)]":"text-muted-foreground"),onPointerDown:e=>{"touch"===e.pointerType&&(R.current=!1)}}),children:[(0,i.jsxs)("button",{type:"button",role:"tab","aria-selected":o,className:"flex h-full min-w-0 flex-1 cursor-pointer items-center gap-2 pl-3 pr-1 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",onClick:()=>{if(R.current){R.current=!1;return}null!==t.path&&w(t.path)},onKeyDown:e=>{if("F10"===e.key&&e.shiftKey){e.preventDefault(),e.stopPropagation();let t=e.currentTarget.closest('[data-slot="context-menu-trigger"]');if(t){let e=t.getBoundingClientRect();t.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:e.left+e.width/2,clientY:e.top+e.height/2}))}return}let t="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!t)return;e.preventDefault();let i=(s+t+O.length)%O.length;D(!0);let r=S.current?.querySelectorAll('[role="tab"]');r?.[i]?.focus({preventScroll:!0})},children:[(0,i.jsx)(r.A,{className:"size-3.5 shrink-0"}),(0,i.jsx)("span",{className:(0,d.cn)("truncate",l&&(0,m.iH)(l)),children:t.label}),l?(0,i.jsx)("span",{className:(0,d.cn)("shrink-0 text-xs",(0,m.iH)(l)),"aria-label":N("gitStatus",{status:(0,m.XB)(l)}),children:(0,m.XB)(l)}):null]}),(0,i.jsx)(u.$,{variant:"ghost",size:"icon","data-testid":null===t.path?`file-diff-tab-close-${t.title}`:`file-tab-close-${t.path}`,"aria-label":c,onClick:e=>{if(e.stopPropagation(),R.current){R.current=!1;return}k(t.path,"current")},children:(0,i.jsx)(a.A,{className:"size-3.5"})})]}),(0,i.jsx)(p.D,{children:f.map(({scope:e,label:r})=>(0,i.jsxs)("span",{children:["all"===e?(0,i.jsx)(h.K5,{}):null,(0,i.jsx)(h.kt,{disabled:"others"===e?O.length<=1:"left"===e?0===s:"right"===e&&s===O.length-1,onClick:()=>{R.current=!1,k(t.path,e)},children:N(r)})]},e))})]},t.path??"diff")})})}),$&&j?(0,i.jsx)("div",{className:"ml-auto flex min-h-8 max-w-full flex-wrap items-center justify-end gap-1 px-1",role:"group","aria-label":N("fileActions"),children:j}):null,M?(0,i.jsxs)(u.$,{variant:"ghost",className:"w-full rounded-none text-muted-foreground","aria-expanded":z,onClick:()=>D(e=>!e),children:[z?(0,i.jsx)(n.A,{className:"size-3.5"}):(0,i.jsx)(o.A,{className:"size-3.5"}),z?N("collapseTabs"):N("expandTabs",{count:O.length})]}):null]})}},35907:e=>{e.exports={document:"l3-markdown-preview_document__tuJfC"}},35989:(e,t,s)=>{"use strict";s.d(t,{A_:()=>d,Hj:()=>l,XB:()=>u,eP:()=>m,iH:()=>h,lN:()=>p,oW:()=>o,oY:()=>n,ws:()=>c});var i=s(15265),r=s(93540),a=s(82075);function n(e){let t=new Map;for(let s of e){let e=s.split("/").filter(Boolean),i=t,r="";for(let[t,a]of e.entries()){r=r?`${r}/${a}`:a;let n=i.get(a);n||(n={name:a,path:r,branchName:null,children:new Map},i.set(a,n)),t===e.length-1&&(n.branchName=s),i=n.children}}return function e(t){return[...t].sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0,sensitivity:"base"})).map(t=>({name:t.name,path:t.path,branchName:t.branchName,children:e(t.children.values())}))}(t.values())}function o(e,t){return(0,a._J)(e,t)}function l(e,t){return t.split("/").at(-1)||e}function c(e){return"branch"===e.type?e.name:`@ ${e.commit.slice(0,7)}`}function d(e,t,s="en"){if(0===t.length)return null;let a=r.C[s];if(1===t.length){let r=t[0],n=l(e,r.root);if("unavailable"===r.state){let e=a.gitUnavailable;return{full:r.root?`${n} \xb7 ${e}`:e,compact:"Git !",title:`${n}${"en"===s?": ":":"}${(0,i.fD)(r.message,s)}`,diverged:!0}}let o=c(r.head);return{full:r.root?`${n} \xb7 ${o}`:o,compact:o,title:`${a.gitBranches}: ${n} \xb7 ${o}`,diverged:"detached"===r.head.type}}let n=`${t.length} ${a.repositoriesUnit}`;return{full:n,compact:`Git ${t.length}`,title:`${a.gitBranches}: ${n}`,diverged:!1}}function u(e){let t=[e.indexStatus,e.worktreeStatus];return t.includes("unmerged")?"!":t.includes("deleted")?"D":t.includes("renamed")?"R":t.includes("added")?"A":t.includes("modified")?"M":"?"}function h(e){let t=u(e);return"D"===t?"text-muted-foreground":"?"===t?"text-red-600 dark:text-red-400":"A"===t?"text-emerald-600 dark:text-emerald-400":"!"===t?"text-violet-600 dark:text-violet-400":"text-blue-600 dark:text-blue-400"}function p(e,t,s){if(/^(?:[a-z]:|\/|\\\\)/i.test(t))return null;let i=/^[a-z]:[\\/]/i.test(e)||e.startsWith("\\\\"),r=e=>i?e.toLowerCase():e,a=[...s].sort((e,t)=>t.root.length-e.root.length).find(e=>!e.root||r(t).startsWith(`${r(e.root)}/`));if(!a)return null;let n=a.root?t.slice(a.root.length+1):t;return{repository:a,path:n,change:"ready"===a.state?a.changes.find(e=>r(e.path)===r(n)):void 0}}function m(e){return e.flatMap(e=>"ready"===e.state?e.changes.map(t=>({repositoryRoot:e.root,repository:e,path:t.path,projectPath:o(e.root,t.path),change:t})):[])}},36510:(e,t,s)=>{"use strict";s.d(t,{z:()=>r});let i=`<script>
2
+ window.addEventListener('keydown', function (event) {
3
+ if (event.defaultPrevented || event.isComposing || event.repeat) return;
4
+ if (event.key === 'Escape' && !event.ctrlKey && !event.altKey && !event.metaKey && !event.shiftKey) {
5
+ event.preventDefault();
6
+ window.parent.postMessage('pi-desk:file-escape', '*');
7
+ } else if (event.key === 'Tab' && event.ctrlKey && !event.altKey && !event.metaKey) {
8
+ event.preventDefault();
9
+ window.parent.postMessage('pi-desk:file-switch-pane', '*');
10
+ }
11
+ });
12
+ </script>`;function r(e){return`${e}
13
+ ${i}`}},45273:(e,t,s)=>{"use strict";s.d(t,{F:()=>r});let i="/project-preview";function r(e){return e?`${i}?cwd=${encodeURIComponent(e)}`:i}},46487:(e,t,s)=>{"use strict";s.d(t,{n:()=>h});var i=s(7962),r=s(57445),a=s(73028),n=s(69266),o=s(10508),l=s(8001),c=s(35907),d=s.n(c);let u={cjk:r.h,code:a.a},h=(0,n.memo)(function({content:e,label:t,savedScrollTop:s,onScroll:r}){let a=(0,n.useRef)(null),c=(0,n.useRef)(s);return(0,n.useLayoutEffect)(()=>{a.current&&(a.current.scrollTop=c.current)},[]),(0,i.jsx)("div",{ref:a,"data-testid":"markdown-preview",role:"region","aria-label":t,tabIndex:0,className:"h-full min-h-0 overflow-auto overscroll-contain bg-background outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",onScroll:e=>r(e.currentTarget.scrollTop),children:(0,i.jsx)(o.jH,{className:`${d().document} ${l.om}`,allowedTags:l.IV,components:l.e6,remarkPlugins:l.XC,mode:"static",parseIncompleteMarkdown:!1,isAnimating:!1,controls:!1,lineNumbers:!1,plugins:u,children:e})})})},56592:(e,t,s)=>{"use strict";s.d(t,{h:()=>m});var i=s(93540),r=s(73230),a=s(7237),n=s(33550),o=s(93320),l=s(97921),c=s(82075);let d={scope:"all",caseSensitive:!1,wholeWord:!1,regex:!1};function u(e){return{...e,status:e.query.trim()?"loading":"idle",fileMatches:[],contentMatches:[],truncated:!1,error:null}}function h(e,t){return(0,r.B)({msg:i.C["zh-CN"][e],i18n:{key:`projectFiles:${e}`,...t?{params:t}:{}}})}function p(e){return e instanceof Error?e.message:h("projectReadFailed")}class m{constructor(e,t,s){this.cwd=e,this.reader=t,this.options=s,this.state={tabs:[],activePath:null,directories:new Map,expandedPaths:new Set,treeScrollTop:0,search:u({query:"",...d}),searchOpen:!1,documents:new Map,activeDiff:null},this.listeners=new Set,this.directoryRequests=new Map,this.compactRequests=new Map,this.documentRequests=new Map,this.closeMissing=new Set,this.restoredTabs=new Set,this.restoredEditorStates=new Map,this.restoredFileViewModes=new Map,this.restoredPreviewScrollTops=new Map,this.searchRequest=null,this.navigation=null,this.diffRequest=null,this.revision=0,this.disposed=!1,this.subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e)),this.getRevision=()=>this.revision}setSearchOpen(e){this.disposed||this.state.searchOpen===e||(this.cancelSearch(),this.state.searchOpen=e,this.state.search=u({...this.searchInput(),scope:e?"all":this.state.search.scope}),this.publish())}get pendingNavigation(){let e=this.state.activePath;return e&&!this.documentRequests.has(e)?this.navigation:null}consumeNavigation(e,t){this.navigation===e&&(this.navigation=null,t||this.options.onNotice?.(h("searchLineUnavailable")),this.publish())}get canReveal(){return!!this.options.reveal}getBrowsingDocumentSettings(){let e={},t={};for(let s of this.state.tabs){let i=this.state.documents.get(s),r=i?.status==="text"?i.editorState:this.restoredEditorStates.get(s);r&&JSON.stringify(r).length<32768&&(e[s]=r);let a=i?.status==="text"?i.viewMode:this.restoredFileViewModes.get(s);a&&(t[s]=a)}return{editorStates:e,fileViewModes:t}}restoreBrowsing(e){for(let t of(this.state.tabs=[...e.tabs],e.tabs)){this.restoredTabs.add(t);let s=e.editorStates[t];s&&this.restoredEditorStates.set(t,s);let i=e.fileViewModes[t];i&&this.restoredFileViewModes.set(t,i)}for(let t of(this.state.activePath=e.activePath&&e.tabs.includes(e.activePath)?e.activePath:null,this.state.expandedPaths=new Set(e.expandedPaths),this.state.treeScrollTop=e.treeScrollTop,this.state.search=u({query:e.searchQuery,...d}),e.tabs))this.state.documents.set(t,{status:"unloaded"});for(let t of e.expandedPaths)this.ensureDirectory(t);e.activeDiff?this.openDiff(e.activeDiff.repositoryRoot,e.activeDiff.path,e.activeDiff.comparison):this.state.activePath&&this.ensureDocument(this.state.activePath)}async revealFile(e,t="file"){if(!this.options.reveal)throw Error(h("revealUnavailable"));await this.options.reveal(e,t)}ensureRoot(){return this.ensureDirectory("")}ensureDirectory(e){if(this.disposed||this.state.directories.get(e)?.status==="ready")return Promise.resolve();let t=this.directoryRequests.get(e);if(t)return t.promise;let s=new AbortController,i=Promise.resolve().then(async()=>{try{if(s.signal.aborted)return;let t=await this.reader.list(e,s.signal);if(this.directoryRequests.get(e)?.controller!==s)return;this.state.directories.set(e,{status:"ready",...t})}catch(t){if(this.directoryRequests.get(e)?.controller!==s)return;this.state.directories.set(e,{status:"error",error:p(t)})}this.directoryRequests.get(e)?.controller===s&&(this.directoryRequests.delete(e),this.publish())});return this.directoryRequests.set(e,{controller:s,promise:i}),this.state.directories.set(e,{status:"loading"}),this.publish(),i}setExpandedPaths(e,t=!0){let s=[...this.state.expandedPaths].filter(t=>!e.has(t));for(let t of(this.state.expandedPaths=new Set(e),this.compactRequests.keys()))s.some(e=>t===e||t.startsWith(`${e}/`))&&this.compactRequests.delete(t);if(this.publish(),t)for(let t of e)this.ensureDirectory(t)}cancelDirectoryExpansion(e=""){for(let t of this.compactRequests.keys())(!e||t===e||t.startsWith(`${e}/`))&&this.compactRequests.delete(t)}compactDirectory(e,t){return(0,c.rk)(e,e=>{let t=this.onlyDirectory(e);return t&&this.state.directories.has(t)?t:null},t)}async expandDirectoryChain(e,t){let s={};this.compactRequests.set(e,s);let i=e,r=16;for(;!this.disposed&&this.compactRequests.get(e)===s&&this.state.expandedPaths.has(e);){if(this.state.directories.get(i)?.status!=="ready"){if(r--<=0)break;await this.ensureDirectory(i)}if(this.compactRequests.get(e)!==s||this.disposed)return;let a=this.onlyDirectory(i);if(!a||t.has(i)||t.has(a)||r<=0&&this.state.directories.get(a)?.status!=="ready")break;this.state.expandedPaths.add(a),i=a,this.publish()}this.compactRequests.get(e)===s&&this.compactRequests.delete(e)}onlyDirectory(e){let t=this.state.directories.get(e);if(t?.status!=="ready"||t.truncated||1!==t.entries.length)return null;let s=t.entries[0];return"directory"===s.type?(0,c._J)(e,s.name):null}setTreeScrollTop(e){this.state.treeScrollTop=e}refreshTree(){for(let e of(this.compactRequests.clear(),this.directoryRequests.values()))e.controller.abort();this.directoryRequests.clear(),this.state.directories.clear(),this.cancelSearch(),this.state.search=u(this.searchInput()),this.publish(),this.ensureRoot().then(()=>{if(!this.disposed){for(let e of this.state.expandedPaths)this.ensureDirectory(e);this.state.searchOpen&&this.state.search.query.trim()&&(this.cancelSearch(),this.state.search={...this.state.search,status:"loading"},this.search(this.state.search.query))}})}setSearchQuery(e){this.disposed||this.state.search.query===e||(this.cancelSearch(),this.state.search=u({...this.searchInput(),query:e}),this.publish())}setSearchOptions(e){if(this.disposed)return;let t=this.searchInput(),s={...t,...e};(s.scope!==t.scope||s.caseSensitive!==t.caseSensitive||s.wholeWord!==t.wholeWord||s.regex!==t.regex)&&(this.cancelSearch(),this.state.search=u(s),this.publish(),this.state.searchOpen&&this.search(s.query))}searchInput(){let{query:e,scope:t,caseSensitive:s,wholeWord:i,regex:r}=this.state.search;return{query:e,scope:t,caseSensitive:s,wholeWord:i,regex:r}}async search(e){if(this.disposed||!e.trim()||this.state.search.query!==e||"ready"===this.state.search.status||this.searchRequest)return;let t=new AbortController;this.searchRequest=t;let s=this.searchInput();this.state.search=u(s),this.publish();try{let e=await this.reader.search(s,t.signal);if(this.searchRequest!==t)return;this.state.search={...s,status:"ready",...e,error:null}}catch(e){if(this.searchRequest!==t)return;this.state.search={...u(s),status:"error",error:p(e)}}this.searchRequest===t&&(this.searchRequest=null,this.publish())}openFile(e,t){var s;let i,r;if(this.disposed)return;let a=(s=this.cwd,i=e.replaceAll("\\","/"),r=`${s.replaceAll("\\","/").replace(/\/+$/,"")}/`,(/^[a-z]:\//i.test(r)||r.startsWith("//")?i.toLowerCase().startsWith(r.toLowerCase()):i.startsWith(r))?i.slice(r.length):i),n=/^[a-z]:[\\/]/i.test(this.cwd)||this.cwd.startsWith("\\\\")?this.state.tabs.find(e=>e.toLowerCase()===a.toLowerCase())??a:a;if(!this.state.tabs.includes(n)){if(this.options.maxTabs&&this.state.tabs.length>=this.options.maxTabs)return void this.options.onNotice?.(h("maxOpenFiles",{count:this.options.maxTabs}));this.state.tabs.push(n)}this.clearDiff(),this.state.documents.has(n)||this.state.documents.set(n,{status:"unloaded"}),this.state.activePath=n,this.navigation=void 0===t?null:{line:t};let o=this.state.documents.get(n);void 0!==t&&o?.status==="text"&&(o.viewMode="source"),this.ensureDocument(n,void 0!==t),this.publish()}closeTabs(e,t){let s=this.state,i=[...s.tabs,...s.activeDiff?[null]:[]],r=i.indexOf(e);if(r<0&&"all"!==t)return;let a=new Set(i.filter((s,i)=>"all"===t||("current"===t?s===e:"others"===t?s!==e:"left"===t?i<r:i>r)));if(!a.size)return;let n=s.activeDiff?null:s.activePath;for(let e of a){if(null===e){this.clearDiff();continue}this.documentRequests.get(e)?.abort(),this.documentRequests.delete(e),this.releaseDocument(s.documents.get(e)),s.documents.delete(e),this.restoredEditorStates.delete(e),this.restoredFileViewModes.delete(e),this.restoredPreviewScrollTops.delete(e),this.closeMissing.delete(e),this.restoredTabs.delete(e)}if(s.tabs=s.tabs.filter(e=>!a.has(e)),s.activePath&&a.has(s.activePath)){this.navigation=null;let e=i.indexOf(s.activePath);s.activePath=i.slice(e+1).find(e=>null!==e&&!a.has(e))??i.slice(0,e).reverse().find(e=>null!==e&&!a.has(e))??null}this.publish(),!s.activeDiff&&s.activePath&&n!==s.activePath&&this.ensureDocument(s.activePath)}reloadFile(e){if(this.state.tabs.includes(e)){if(this.state.activePath===e&&this.navigation)return void this.ensureDocument(e,!0);this.invalidateDocument(e),this.publish(),this.ensureDocument(e)}}async ensureDocument(e,t=!1){if(this.disposed||!this.state.tabs.includes(e)||this.documentRequests.has(e))return;let s=this.state.documents.get(e);if(!t&&s&&["loading","text","image"].includes(s.status))return;let i=new AbortController;this.documentRequests.set(e,i),s?.status!=="text"&&this.state.documents.set(e,{status:"loading"}),this.publish();try{let t=await this.reader.get(e,this.options.imagePreviewMode(),i.signal);if(this.documentRequests.get(e)!==i)return;this.documentRequests.delete(e),this.closeMissing.delete(e),this.restoredTabs.delete(e),(s?.status!=="text"||"text"!==t.kind||s.content!==t.content||s.size!==t.size)&&this.state.documents.set(e,"text"===t.kind?{status:"text",content:t.content,size:t.size,editorState:s?.status==="text"?s.editorState:this.restoredEditorStates.get(e)??null,viewMode:this.state.activePath===e&&this.navigation?"source":s?.status==="text"?s.viewMode:this.restoredFileViewModes.get(e)??("markdown"===(0,l.g)(e)||this.options.htmlPreview&&"html"===(0,l.g)(e)?"preview":"source"),previewScrollTop:s?.status==="text"?s.previewScrollTop:this.restoredPreviewScrollTops.get(e)??0}:{status:"image",mimeType:t.mimeType,size:t.size,objectUrl:URL.createObjectURL((0,a.E)(t))}),this.state.activePath===e&&"text"!==t.kind&&(this.navigation=null),this.releaseDocument(s)}catch(a){if(this.documentRequests.get(e)!==i)return;this.documentRequests.delete(e);let t=this.restoredTabs.delete(e),r=this.closeMissing.delete(e);if((t||r)&&a instanceof o.aw&&404===a.status&&"errors:fileMissing"===a.errorKey){this.closeTabs(e,"current"),r&&this.options.onNotice?.(h("branchFileClosed",{path:e}));return}console.warn("[Pi Desk][ProjectFile] 读取文件失败",{cwd:this.cwd,path:e,error:p(a)}),this.state.documents.set(e,{status:"error",error:p(a)}),this.releaseDocument(s),this.state.activePath===e&&(this.navigation=null)}this.publish()}async compareFile(e,t,s){let i=this.state.documents.get(e);if(this.disposed||s.aborted||i?.status!=="text")return;if(!t){i.comparison&&(delete i.comparison,this.publish());return}let r={status:"loading"};i.comparison=r,this.publish();let a=()=>!this.disposed&&!s.aborted&&this.state.documents.get(e)===i&&i.comparison===r;try{let e=await this.reader.diff(t.repositoryRoot,t.path,s);if(!a())return;"text"===e.kind?(i.content=e.modified.content,i.size=new TextEncoder().encode(e.modified.content).length,i.comparison={status:"ready",repositoryRoot:t.repositoryRoot,path:t.path,original:e.original}):i.comparison={status:"unavailable"}}catch(t){if(!a())return;console.warn("[Pi Desk][ProjectFile] 读取行变更失败",{cwd:this.cwd,path:e,error:p(t)}),i.comparison={status:"error",error:p(t)}}this.publish()}openFileDiff(e,t){let s=this.state.documents.get(e);if(this.disposed||s?.status!=="text"||s.comparison?.status!=="ready")return;let i=s.comparison;this.clearDiff(),this.state.activeDiff={status:"text",repositoryRoot:i.repositoryRoot,path:i.path,original:i.original,modified:{path:i.path,content:s.content},initialLine:t},this.publish()}openDiff(e,t,s,i){this.disposed||(this.clearDiff(),this.state.activeDiff={status:"loading",repositoryRoot:e,path:t,comparison:s,label:i},this.publish(),this.ensureDiff())}closeDiff(){this.closeTabs(null,"current")}reloadDiff(){let e=this.state.activeDiff;e&&(this.clearDiff(),this.state.activeDiff={...e,status:"loading"},this.publish(),this.ensureDiff())}saveDiffState(e,t){this.state.activeDiff===e&&(e.editorState=t)}setDiffViewMode(e){this.state.activeDiff&&(0,n.ZQ)({diffViewMode:e})}setDiffWrapLines(e){this.state.activeDiff&&(0,n.ZQ)({wrapLines:e})}setDiffCollapseUnchanged(e){this.state.activeDiff&&(0,n.ZQ)({collapseUnchanged:e})}handleGitBranchChanged(e){for(let t of(this.refreshTree(),this.state.tabs))(!e||t===e||t.startsWith(`${e}/`))&&(this.invalidateDocument(t),this.closeMissing.add(t));this.state.activeDiff?.repositoryRoot===e?this.reloadDiff():this.publish(),!this.state.activeDiff&&this.state.activePath&&this.ensureDocument(this.state.activePath)}saveEditorState(e,t){let s=this.state.documents.get(e);s?.status==="text"&&(s.editorState=t)}savePreviewScrollTop(e,t){let s=this.state.documents.get(e);s?.status==="text"&&(s.previewScrollTop=t)}setWrapLines(e,t){this.state.documents.get(e)?.status==="text"&&(0,n.ZQ)({wrapLines:t})}setTextViewMode(e,t){let s=this.state.documents.get(e);s?.status==="text"&&s.viewMode!==t&&(s.viewMode=t,this.publish())}dispose(){for(let e of(this.disposed=!0,this.compactRequests.clear(),this.directoryRequests.values()))e.controller.abort();for(let e of(this.directoryRequests.clear(),this.documentRequests.values()))e.abort();for(let e of(this.documentRequests.clear(),this.cancelSearch(),this.clearDiff(),this.state.documents.values()))this.releaseDocument(e);this.state.documents.clear(),this.restoredPreviewScrollTops.clear(),this.listeners.clear()}async ensureDiff(){let e=this.state.activeDiff;if(this.disposed||e?.status!=="loading"||this.diffRequest)return;let t=new AbortController;this.diffRequest=t;try{let s=await this.reader.diff(e.repositoryRoot,e.path,t.signal,e.comparison);if(this.diffRequest!==t)return;this.state.activeDiff="text"===s.kind?{...e,status:"text",original:s.original,modified:s.modified}:"metadata"===s.kind?{...e,status:"metadata",originalMetadata:s.original,modifiedMetadata:s.modified}:{...e,status:s.kind,error:null}}catch(s){if(this.diffRequest!==t)return;this.state.activeDiff={...e,status:"error",error:p(s)}}this.diffRequest===t&&(this.diffRequest=null,this.publish())}clearDiff(){this.navigation=null,this.diffRequest?.abort(),this.diffRequest=null,this.state.activeDiff=null}cancelSearch(){this.searchRequest?.abort(),this.searchRequest=null}invalidateDocument(e){this.state.activePath===e&&(this.navigation=null),this.documentRequests.get(e)?.abort(),this.documentRequests.delete(e);let t=this.state.documents.get(e);t?.status==="text"&&(t.editorState&&this.restoredEditorStates.set(e,t.editorState),this.restoredFileViewModes.set(e,t.viewMode),this.restoredPreviewScrollTops.set(e,t.previewScrollTop)),this.releaseDocument(t),this.state.documents.set(e,{status:"unloaded"})}releaseDocument(e){e?.status==="image"&&URL.revokeObjectURL(e.objectUrl)}publish(){if(!this.disposed)for(let e of(this.revision+=1,this.listeners))e()}}},58840:(e,t,s)=>{"use strict";s.d(t,{k:()=>h});var i=s(7962),r=s(82028),a=s.n(r),n=s(69266),o=s(49426),l=s(5816);let c=[[".viewer-zoom-in","放大","Zoom in"],[".viewer-zoom-out","缩小","Zoom out"],[".viewer-one-to-one","原始尺寸","Actual size"],[".viewer-reset","重置","Reset"],[".viewer-prev","上一张","Previous image"],[".viewer-next","下一张","Next image"],[".viewer-rotate-left","向左旋转","Rotate left"],[".viewer-rotate-right","向右旋转","Rotate right"]];function d(e){return document.querySelector(`.${e}`)}function u(e,t){e?.querySelectorAll(".viewer-list > li").forEach((e,s)=>{let i="en"===t?`View image ${s+1}`:`查看第 ${s+1} 张图片`;e.setAttribute("aria-label",i),e.setAttribute("title",i)})}function h(e){let{locale:t}=(0,l.i)(),{slides:s,index:r=0,onIndexChange:h,className:p,thumbnails:m=!0,ariaLabel:f="en"===t?"Image preview":"图片预览"}=e,g="inline"===e.mode,x="inline"===e.mode||e.open,v="modal"===e.mode?e.onClose:void 0,b=s.length>1,y=Math.min(Math.max(r,0),Math.max(s.length-1,0)),j=`pi-desk-image-viewer-${(0,n.useId)().replaceAll(":","")}`,w=(0,n.useRef)(null),k=(0,n.useRef)(null),N=(0,n.useRef)(null),C=(0,n.useRef)(""),S=(0,n.useRef)(""),R=(0,n.useRef)(y),z=(0,n.useRef)(y),D=(0,n.useRef)(h),M=(0,n.useRef)(v),P=(0,n.useMemo)(()=>JSON.stringify(s.map(e=>[e.src,e.alt])),[s]),A=(0,o.cn)("pi-desk-image-viewer",g?"pi-desk-image-viewer-inline":"pi-desk-image-viewer-modal",j,p);if((0,n.useEffect)(()=>{S.current=P},[P]),(0,n.useEffect)(()=>{z.current=y},[y]),(0,n.useEffect)(()=>{D.current=h},[h]),(0,n.useEffect)(()=>{M.current=v},[v]),(0,n.useEffect)(()=>{let e=w.current;if(!e||!x||0===s.length)return;let i=!1,r=null,n=0,o=null,l=e=>{!("Escape"===e.key&&!e.defaultPrevented&&!e.isComposing&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&r?.fulled)||(e.preventDefault(),e.stopImmediatePropagation(),e.repeat||d(j)?.querySelector(".viewer-button")?.click())};window.addEventListener("keydown",l,!0);let h=()=>{if(i)return;let l=z.current;R.current=l;let h=window.matchMedia("(pointer: coarse)").matches||navigator.maxTouchPoints>0;r=new(a())(e,{inline:g,initialViewIndex:l,initialCoverage:g?.82:.88,minWidth:0,minHeight:0,minZoomRatio:.05,maxZoomRatio:8,zoomRatio:.12,zIndex:200,zIndexInline:1,backdrop:!g,button:!0,focus:!0,keyboard:!0,loading:!0,loop:!1,movable:!0,navbar:!!b&&!!m&&2,rotatable:!0,scalable:!1,slideOnTouch:b,title:!g&&1,toolbar:{prev:b,zoomOut:!0,zoomIn:!0,oneToOne:{show:2},reset:!0,rotateLeft:{show:2},rotateRight:{show:2},next:b},tooltip:!0,transition:!window.matchMedia("(prefers-reduced-motion: reduce)").matches,toggleOnDblclick:!h,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,className:A,ready:()=>(function(e,t,s,i,r,a){let n=d(e);if(!n)return;for(let[e,t,i]of(n.setAttribute("aria-label",s),n.setAttribute("lang",a),c)){let s=n.querySelector(e);if(!s)continue;let r="en"===a?i:t;s.setAttribute("aria-label",r),s.setAttribute("title",r)}u(n,a);let o=n.querySelector(".viewer-button");if(o){let e=()=>{let e=t?o.classList.contains("viewer-fullscreen-exit")?"en"===a?"Exit fullscreen":"退出全屏":"en"===a?"View image fullscreen":"全屏查看图片":"en"===a?"Close image preview":"关闭图片预览";o.setAttribute("aria-label",e),o.setAttribute("title",e)};e(),t&&o.addEventListener("click",()=>requestAnimationFrame(e))}if(i>1){let e=document.createElement("div");e.className="pi-desk-image-viewer-counter",e.dataset.piDeskViewerCounter="",e.setAttribute("aria-live","polite"),e.textContent=`${r+1} / ${i}`,n.appendChild(e)}})(j,g,f,s.length,l,t),view:e=>{let t=function(e){let t=e.detail;if("object"!=typeof t||null===t)return null;let s=Reflect.get(t,"index");return"number"==typeof s&&Number.isInteger(s)?s:null}(e);if(null!==t){var i;let e;b&&N.current&&(N.current.options.transition=!1),R.current=t,i=s.length,(e=d(j)?.querySelector("[data-pi-desk-viewer-counter]"))&&(e.textContent=`${t+1} / ${i}`),D.current?.(t)}},viewed:()=>{let e=N.current;if(!b||!e?.image)return;let t=window.matchMedia("(prefers-reduced-motion: reduce)").matches;e.options.transition=!t,t||(e.image.getBoundingClientRect(),e.image.classList.add("viewer-transition"),e.image.animate([{opacity:0},{opacity:1}],{duration:150,easing:"ease-out"}))},hidden:()=>M.current?.()}),N.current=r,C.current=S.current,g&&k.current?(o=new ResizeObserver(()=>{cancelAnimationFrame(n),n=requestAnimationFrame(()=>r?.resize())})).observe(k.current):r.show()},p=Array.from(e.querySelectorAll("img"));return g&&p.some(e=>!e.complete)?Promise.all(p.map(e=>e.decode().catch(()=>void 0))).then(h):h(),()=>{i=!0,window.removeEventListener("keydown",l,!0),o?.disconnect(),cancelAnimationFrame(n),N.current===r&&(N.current=null),r?.destroy()}},[x,f,g,j,t,b,s.length,m,A]),(0,n.useEffect)(()=>{let e=N.current;if(!e||C.current===P)return;C.current=P;let s=R.current,i=w.current?.querySelectorAll("img")[s],r=e.image?.src!==i?.src||e.image?.alt!==i?.alt;r&&(e.viewed=!1),e.update(),r&&e.view(s),u(d(j),t)},[j,t,P]),(0,n.useEffect)(()=>{let e=N.current;e&&R.current!==y&&e.view(y)},[y]),0===s.length||!x)return null;let T=(0,i.jsx)("span",{ref:w,className:"pi-desk-image-viewer-source","aria-hidden":"true",children:s.map((e,t)=>(0,i.jsx)("img",{src:e.src,alt:e.alt,width:e.width,height:e.height,decoding:"async",draggable:!1},t))});return g?(0,i.jsx)("div",{ref:k,className:"pi-desk-image-viewer-host",role:"region","aria-label":f,tabIndex:0,onKeyDown:e=>{let t=N.current;!t||t.fulled||e.altKey||e.ctrlKey||e.metaKey||e.nativeEvent.isComposing||("ArrowLeft"===e.key||"ArrowRight"===e.key)&&(e.preventDefault(),e.stopPropagation(),"ArrowLeft"===e.key?t.prev(!1):t.next(!1))},children:T}):T}},60471:(e,t,s)=>{"use strict";s.d(t,{b:()=>u});var i=s(7962),r=s(46783),a=s(69266),n=s(78121),o=s(86963),l=s(89790),c=s(90434),d=s(49426);function u({value:e,options:t,onChange:s,ariaLabel:h,placeholder:p,searchPlaceholder:m,emptyText:f,disabled:g=!1,className:x}){let{t:v}=(0,n.Bd)("common"),[b,y]=(0,a.useState)(!1),j=t.find(t=>t.value===e);return(0,i.jsxs)(c.AM,{open:b,onOpenChange:y,children:[(0,i.jsx)(c.Wv,{render:(0,i.jsxs)(o.$,{type:"button",variant:"outline",role:"combobox","aria-label":h,"aria-expanded":b,disabled:g,className:(0,d.cn)("w-full min-w-0 justify-between border-input px-2.5 font-normal focus-visible:-outline-offset-2",x),children:[(0,i.jsx)("span",{className:(0,d.cn)("min-w-0 truncate",!j&&"text-muted-foreground"),children:j?.label??p??v("selectPlaceholder")}),(0,i.jsx)(r.A,{className:"text-muted-foreground"})]})}),(0,i.jsx)(c.hl,{align:"start",sideOffset:4,positionerClassName:"z-[120]",className:"w-(--anchor-width) max-w-[calc(100vw-2rem)] gap-0 p-0",children:(0,i.jsxs)(l.uB,{children:[(0,i.jsx)(l.G7,{placeholder:m??v("searchPlaceholder"),autoFocus:!0}),(0,i.jsxs)(l.oI,{className:"max-h-[min(20rem,var(--available-height))]",children:[(0,i.jsx)(l.xL,{children:f??v("noMatches")}),(0,i.jsx)(l.L$,{children:t.map(t=>(0,i.jsx)(l.h_,{value:`${t.label} ${t.description??""} ${t.value}`,"data-checked":t.value===e?"true":void 0,onSelect:()=>{s(t.value),y(!1)},children:(0,i.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,i.jsx)("span",{className:"block truncate",children:t.label}),t.description?(0,i.jsx)("span",{className:"mt-0.5 block truncate text-xs text-muted-foreground",children:t.description}):null]})},t.value))})]})]})})]})}},60682:(e,t,s)=>{"use strict";s.d(t,{J:()=>g});var i=s(7962),r=s(49762),a=s(86758),n=s(36670),o=s(50479),l=s(35995),c=s(69266),d=s(78121),u=s(99084),h=s(51821),p=s(1364),m=s(73165),f=s(93119);function g({cwd:e,path:t,type:s,trigger:x,openLabel:v,onOpen:b,expanded:y,onToggle:j,historical:w,oldPath:k,onReveal:N}){let{t:C}=(0,d.Bd)("projectFiles"),S=(0,h.G)(),[R,z]=(0,c.useState)(null),D=R??{cwd:e,path:t,type:s,oldPath:k},M=(0,c.useRef)(!1),P=(0,c.useRef)(""),A="file"===s?"file":"folder",T=e=>{(0,u.x)(e).then(e=>{e?S.success(C("copied")):S.error(C("copyFailed"))})},$=(D.path||D.cwd.replaceAll("\\","/")).split("/").filter(Boolean).at(-1)??D.cwd;return(0,i.jsxs)(p.tz,{onOpenChange:(i,r)=>{z(i?{cwd:e,path:t,type:s,oldPath:k}:null);let a=r.event;i&&("touch"===P.current||"pointerType"in a&&"touch"===a.pointerType||a.type.startsWith("touch"))&&(M.current=!0)},children:[(0,i.jsx)(p.Rc,{render:x,"data-project-path-menu-trigger":"",onPointerDown:e=>{P.current=e.pointerType,M.current=!1},onTouchEndCapture:e=>{let t=e.target;!R||!M.current||"touch"!==P.current||t instanceof Element&&t.closest("[data-project-path-menu-trigger]")===e.currentTarget&&e.cancelable&&e.preventDefault()},onClickCapture:e=>{M.current&&(e.preventDefault(),e.stopPropagation(),M.current=!1)},onKeyDownCapture:e=>{if(e.defaultPrevented||e.nativeEvent.isComposing)return;let t=e.target;if(!(t instanceof Element)||t.closest("[data-project-path-menu-trigger]")!==e.currentTarget||(P.current="keyboard",M.current=!1,"ContextMenu"!==e.key&&!("F10"===e.key&&e.shiftKey)))return;e.preventDefault(),e.stopPropagation();let s=t.getBoundingClientRect();e.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,button:2,clientX:s.left+Math.min(s.width,120)/2,clientY:s.top+Math.min(s.height,36)/2}))}}),(0,i.jsxs)(m.D,{children:[b?(0,i.jsxs)(p.kt,{onClick:b,children:[(0,i.jsx)(r.A,{}),v??C("openPreview")]}):null,j?(0,i.jsxs)(p.kt,{onClick:j,children:[y?(0,i.jsx)(a.A,{}):(0,i.jsx)(n.A,{}),C(y?"collapse":"expand")]}):null,b||j?(0,i.jsx)(p.K5,{}):null,N?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(p.kt,{"data-testid":`project-${A}-reveal-${t}`,onClick:()=>{N&&N(D.path,D.type).then(()=>S.success(C("revealRequested"))).catch(e=>{S.error(e instanceof Error?e.message:C("revealFailed"))})},children:[(0,i.jsx)(o.A,{}),w?"directory"===s?C("openCurrentWorkspace"):C("locateCurrentWorkspace"):"directory"===s?C("openFolder"):C("openContainingFolder")]}),(0,i.jsx)(p.K5,{})]}):null,(0,i.jsxs)(p.kt,{"data-testid":`project-${A}-copy-address-${t}`,onClick:()=>T((0,f.$)(D.cwd,D.path)),children:[(0,i.jsx)(l.A,{}),C("copyAbsolutePath")]}),(0,i.jsxs)(p.kt,{onClick:()=>T(D.path||"."),children:[(0,i.jsx)(l.A,{}),C("copyRelativePath")]}),(0,i.jsxs)(p.kt,{onClick:()=>T($),children:[(0,i.jsx)(l.A,{}),C("directory"===s?"copyFolderName":"copyFileName")]}),D.oldPath?(0,i.jsxs)(p.kt,{onClick:()=>T(D.oldPath),children:[(0,i.jsx)(l.A,{}),C("copyOldRelativePath")]}):null]})]})}},64334:(e,t,s)=>{"use strict";s.d(t,{Ms:()=>b,N1:()=>v,Sb:()=>j,tQ:()=>y});var i=s(38979),r=s(67765),a=s(86062);let n="pi-super:project-preview:global",o="pi-super:project-preview:projects",l=i.ai().min(5).max(95),c=i.Ik({maximized:i.zM(),directoryOpen:i.zM(),gitOpen:i.zM(),gitMaximized:i.zM(),treeLayout:i.k5(["directory","repository"]),directorySize:l,gitSize:l,logSize:l,changeSize:l}),d={maximized:!1,directoryOpen:!0,gitOpen:!1,gitMaximized:!1,treeLayout:"directory",directorySize:22,gitSize:45,logSize:62,changeSize:70},u=i.Ik({repositoryRoot:i.Yj().nullable(),mode:i.k5(["history","compare"]),tip:i.Yj(),base:i.Yj(),target:i.Yj(),strategy:i.k5(["merge-base","direct"]),query:i.Yj().max(200),author:i.Yj().max(200),selectedCommit:a.aD.nullable(),selectedChangePath:r._g.nullable(),logScroll:i.ai().nonnegative(),changesScroll:i.ai().nonnegative()}),h=i.Ie(e=>"object"==typeof e&&null!==e&&Array.isArray(e.cursorState)&&"object"==typeof e.viewState),p=i.Ik({page:i.k5(["files","code","git"]),historyPane:i.k5(["log","files"]),tabs:i.YO(r._g).max(20),activePath:r._g.nullable(),editorStates:i.g1(r._g,h),fileViewModes:i.g1(r._g,i.k5(["source","preview"])),expandedPaths:i.YO(i.Yj()).max(500),treeScrollTop:i.ai().nonnegative(),searchQuery:i.Yj().max(200),changesOnly:i.zM(),expandedRepositories:i.YO(i.Yj()).max(100),history:u,activeDiff:i.Ik({repositoryRoot:i.Yj(),path:r._g,comparison:a.xv.optional()}).nullable()}),m=i.Ik({cwd:i.Yj(),lastOpenedAt:i.ai(),state:p});function f(e){let t=e.replaceAll("\\","/").replace(/\/+$/,"");return/^[a-z]:\//i.test(t)||t.startsWith("//")?t.toLowerCase():t}function g(){try{let e=JSON.parse(window.localStorage.getItem(o)??"[]");if(!Array.isArray(e))return[];let t=Date.now();return e.flatMap(e=>{let s=m.safeParse(e);return s.success&&t-s.data.lastOpenedAt<2592e6?[s.data]:[]})}catch{return[]}}function x(e){try{window.localStorage.setItem(o,JSON.stringify(e.sort((e,t)=>t.lastOpenedAt-e.lastOpenedAt).slice(0,50)))}catch(e){console.warn("[Pi Desk][ProjectPreview] 保存项目浏览状态失败",e)}}function v(){try{let e=JSON.parse(window.localStorage.getItem(n)??"null");return{...d,...c.partial().parse(e)}}catch{return{...d}}}function b(e){try{window.localStorage.setItem(n,JSON.stringify(e))}catch(e){console.warn("[Pi Desk][ProjectPreview] 保存全局布局失败",e)}}function y(e){let t=f(e),s=g(),i=s.find(e=>e.cwd===t);return i&&(i.lastOpenedAt=Date.now()),x(s),i?.state??null}function j(e,t){let s=p.safeParse(t);if(!s.success)return;let i=f(e),r=g(),a=r.find(e=>e.cwd===i);a?a.state=s.data:r.push({cwd:i,lastOpenedAt:Date.now(),state:s.data}),x(r)}},66453:(e,t,s)=>{"use strict";s.d(t,{$E:()=>a,Rv:()=>n,m4:()=>r});var i=s(38979);let r=i.Yj().trim().min(1),a=i.Yj().trim().min(1),n=i.Yj().trim().min(1)},67765:(e,t,s)=>{"use strict";s.d(t,{CT:()=>p,JH:()=>f,NL:()=>n,Nu:()=>g,_g:()=>d,eC:()=>u,gB:()=>o,ih:()=>j,jI:()=>y,p$:()=>h,rh:()=>c,uV:()=>r,xm:()=>a});var i=s(38979);let r=4096,a=5e3,n=5242880,o=1048576;function l(e,t){return""===e?t:!(e.length>r||e.startsWith("/")||e.includes("\\")||e.includes("\0")||/^[a-zA-Z]:/.test(e))&&e.split("/").every(e=>e.length>0&&"."!==e&&".."!==e)}let c=i.Yj().max(r).refine(e=>l(e,!0),"目录路径必须是规范相对路径"),d=i.Yj().min(1).max(r).refine(e=>l(e,!1),"文件路径必须是规范相对路径"),u=i.Yj().min(1).max(r).refine(e=>l(e,!1)||e.length>0&&e.length<=r&&!e.includes("\0")&&(e.startsWith("/")||e.startsWith("\\\\")||/^[a-zA-Z]:[\\/]/.test(e)),"预览路径必须是规范相对路径或绝对路径"),h=i.k5(["compressed","original"]),p=i.k5(["image/jpeg","image/png","image/webp","image/gif"]),m=i.Ik({name:i.Yj().min(1),type:i.k5(["directory","file"])}).strict(),f=i.Ik({entries:i.YO(m).max(a),truncated:i.zM()}).strict(),g=i.Ik({query:i.Yj().min(1).max(200).refine(e=>e.trim().length>0&&!/[\0\r\n]/.test(e),"搜索词必须是非空单行文本"),scope:i.k5(["all","files","content"]).default("all"),caseSensitive:i.zM().default(!1),wholeWord:i.zM().default(!1),regex:i.zM().default(!1)}).strict(),x=i.Ik({start:i.ai().int().nonnegative(),end:i.ai().int().nonnegative()}).strict().refine(e=>e.start<=e.end,"搜索命中区间无效"),v=i.Ik({path:d,ranges:i.YO(x)}).strict().refine(e=>e.ranges.every(t=>t.end<=e.path.length),"文件名命中区间越界"),b=i.Ik({path:d,line:i.ai().int().positive(),text:i.Yj().max(1e3),ranges:i.YO(x)}).strict().refine(e=>e.ranges.every(t=>t.end<=e.text.length),"正文命中区间越界"),y=i.Ik({fileMatches:i.YO(v).max(100),contentMatches:i.YO(b).max(200),truncated:i.zM()}).strict(),j=i.gM("kind",[i.Ik({kind:i.eu("text"),content:i.Yj(),size:i.ai().int().nonnegative().max(n)}).strict(),i.Ik({kind:i.eu("image"),mimeType:p,data:i.Yj().min(1),size:i.ai().int().positive().max(0xa00000)}).strict()])},68017:(e,t,s)=>{"use strict";s.d(t,{T:()=>a});var i=s(7962);s(69266);var r=s(49426);function a({className:e,...t}){return(0,i.jsx)("textarea",{"data-slot":"textarea",className:(0,r.cn)("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-card px-2.5 py-2 text-sm leading-5 transition-colors duration-150 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-50 aria-invalid:border-destructive aria-invalid:outline-destructive",e),...t})}},70698:(e,t,s)=>{"use strict";s.d(t,{k:()=>i});let i=s(38979).ai().int().nonnegative().max(Number.MAX_SAFE_INTEGER)},72282:(e,t,s)=>{"use strict";s.d(t,{HK:()=>n,WM:()=>l,wV:()=>o});var i=s(7962),r=s(55493),a=s(49426);function n({className:e,...t}){return(0,i.jsx)(r.YJ,{"data-slot":"resizable-panel-group",className:(0,a.cn)("flex h-full w-full aria-[orientation=vertical]:flex-col",e),...t})}function o({...e}){return(0,i.jsx)(r.Zk,{"data-slot":"resizable-panel",...e})}function l({withHandle:e,className:t,...s}){return(0,i.jsx)(r.wv,{"data-slot":"resizable-handle",className:(0,a.cn)("relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",t),...s})}},73068:(e,t,s)=>{"use strict";s.d(t,{R:()=>T});var i=s(7962),r=s(31123),a=s(28436),n=s(60278),o=s(55628),l=s(47974),c=s(90680),d=s(3433),u=s(41148),h=s(15824),p=s(35995),m=s(49762),f=s(14044),g=s(69266),x=s(78121),v=s(99084),b=s(90504),y=s(91182),j=s(18302),w=s(33550);let k=(0,g.forwardRef)(function({original:e,modified:t,viewMode:s,onEscape:r,savedState:a,onSaveState:n,initialLine:o},l){let{t:c}=(0,x.Bd)("common"),{wrapLines:d,collapseUnchanged:u}=(0,w.TX)(),h=(0,g.useRef)(null),p=(0,g.useRef)(null),m=(0,g.useRef)({viewMode:s,wrapLines:d,collapseUnchanged:u}),v=(0,g.useRef)(r),b=(0,g.useRef)(a),k=(0,g.useRef)(n),N=(0,g.useRef)(o);(0,g.useEffect)(()=>{v.current=r,b.current=a,k.current=n,N.current=o},[o,r,n,a]);let[C,S]=(0,g.useState)("loading"),[R,z]=(0,g.useState)(null);return(0,g.useEffect)(()=>{m.current={viewMode:s,wrapLines:d,collapseUnchanged:u}},[u,s,d]),(0,g.useImperativeHandle)(l,()=>({previousChange(){p.current?.goToDiff("previous")},nextChange(){p.current?.goToDiff("next")},focus(){p.current?.getModifiedEditor().focus()}}),[]),(0,g.useEffect)(()=>{let s=h.current;if(!s)return;let i=!0,r=null,a=null,n=null,o=()=>void 0,l=()=>void 0,d=[];return queueMicrotask(()=>{i&&(S("loading"),z(null))}),(0,y.cu)().then(u=>{if(!i)return;a=u.editor.createModel(e.content,(0,y.ix)(e.path,new TextEncoder().encode(e.content).length),(0,y.B3)(u,e.path,"diff-original")),n=u.editor.createModel(t.content,(0,y.ix)(t.path,new TextEncoder().encode(t.content).length),(0,y.B3)(u,t.path,"diff-modified"));let h=m.current;r=u.editor.createDiffEditor(s,{theme:(0,y.dC)(),readOnly:!0,domReadOnly:!0,editContext:!1,originalEditable:!1,automaticLayout:!0,renderSideBySide:"side-by-side"===h.viewMode,useInlineViewWhenSpaceIsLimited:!1,enableSplitViewResizing:!0,diffAlgorithm:"advanced",ignoreTrimWhitespace:!1,maxComputationTime:5e3,hideUnchangedRegions:h.collapseUnchanged?{enabled:!0,revealLineCount:3,minimumLineCount:6,contextLineCount:3}:{enabled:!1},minimap:{enabled:!1},stickyScroll:{enabled:!1},scrollBeyondLastLine:!1,smoothScrolling:!0,diffWordWrap:h.wrapLines?"on":"off",wrappingIndent:"same",...(0,y.R)(),lineNumbersMinChars:3,renderValidationDecorations:"off",renderWhitespace:"selection",unicodeHighlight:{nonBasicASCII:!1},padding:{top:10,bottom:10},overviewRulerBorder:!1,contextmenu:!0,ariaLabel:c("gitDiffReadOnly")});let f=N.current,g=!1;d.push(r.onDidUpdateDiff(()=>{if(!i||!r)return;let e=r.getLineChanges();if(z(e?.length??null),!g&&null!==e&&void 0!==f){g=!0;let e=Math.max(1,Math.min(f,n?.getLineCount()??1)),t=r.getModifiedEditor();t.setPosition({lineNumber:e,column:1}),t.revealLineInCenter(e)}})),r.setModel({original:a,modified:n}),void 0===f&&b.current&&r.restoreViewState(b.current);let x=()=>k.current?.(r?.saveViewState()??null);d.push(r.getOriginalEditor().onDidScrollChange(x),r.getModifiedEditor().onDidScrollChange(x)),v.current&&((0,j.e)(r.getOriginalEditor(),u.KeyCode.Escape,()=>v.current?.()),(0,j.e)(r.getModifiedEditor(),u.KeyCode.Escape,()=>v.current?.())),p.current=r,o=(0,y.Tr)(e=>u.editor.setTheme(e)),l=(0,y.BK)(e=>r?.updateOptions(e)),S("ready")}).catch(s=>{i&&(console.error("[Pi Desk][CodeDiff] Monaco 加载失败",{originalPath:e.path,modifiedPath:t.path,errorName:s instanceof Error?s.name:"UnknownError"}),S("error"))}),()=>{for(let e of(i=!1,o(),l(),k.current?.(r?.saveViewState()??null),d))e.dispose();p.current=null,r?.setModel(null),r?.dispose(),window.setTimeout(()=>{a?.dispose(),n?.dispose()},0)}},[t.content,t.path,e.content,e.path,c]),(0,g.useEffect)(()=>{p.current?.updateOptions({renderSideBySide:"side-by-side"===s,diffWordWrap:d?"on":"off",hideUnchangedRegions:u?{enabled:!0,revealLineCount:3,minimumLineCount:6,contextLineCount:3}:{enabled:!1}}),"side-by-side"===s&&p.current?.getOriginalEditor().updateOptions({wordWrapOverride2:"inherit"})},[u,s,d]),(0,i.jsxs)("div",{"data-testid":"code-diff",className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden bg-background",children:[(0,i.jsx)("div",{ref:h,className:"min-h-0 flex-1"}),(0,i.jsx)("div",{role:"status","aria-label":c("diffStatus"),className:"flex min-h-6 shrink-0 items-center justify-end border-t px-3 text-xs text-muted-foreground",children:null===R?c("diffCalculating"):c("diffCount",{count:R})}),"loading"===C?(0,i.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center gap-2 bg-background text-sm text-muted-foreground",children:[(0,i.jsx)(f.A,{className:"size-4 animate-spin"})," ",c("diffLoading")]}):null,"error"===C?(0,i.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center text-sm text-destructive",children:c("diffFailed")}):null]})});var N=s(58840),C=s(51821),S=s(86963),R=s(35989),z=s(32892);function D({label:e,onClick:t,active:s=!1,children:r}){return(0,i.jsxs)(z.m_,{children:[(0,i.jsx)(z.k$,{render:(0,i.jsx)(S.$,{type:"button",size:"icon-sm",variant:"ghost","aria-label":e,"aria-pressed":s||void 0,onPointerDown:e=>e.preventDefault(),onClick:t}),children:r}),(0,i.jsx)(z.ZI,{children:e})]})}var M=s(36510),P=s(46487),A=s(97921);function T({ref:e,runtime:t,gitRuntime:s,compact:f,visible:y=!0,refreshOnFocus:j=!0,onEscape:z,onSwitchPane:I,renderHeader:E}){let{t:O}=(0,x.Bd)("projectFiles"),{wrapLines:q,diffViewMode:L,collapseUnchanged:F}=(0,w.TX)();(0,g.useSyncExternalStore)(t.subscribe,t.getRevision,t.getRevision);let{activeDiff:B,activePath:_}=t.state,W=!B&&_?t.state.documents.get(_):null,Y=_?(0,A.g)(_):null,V=W?.status==="text"&&(!Y||"source"===W.viewMode),H=(0,g.useRef)(null),K=(0,g.useRef)(null),U=(0,g.useRef)(null),J=(0,g.useRef)(null),G=(0,C.G)();(0,g.useImperativeHandle)(e,()=>({focus(){V?K.current?.focus():B?U.current?.focus():H.current?.querySelector('[data-testid="markdown-preview"]')?.focus()}}),[B,V]),(0,g.useEffect)(()=>{let e=e=>{J.current&&e.source===J.current.contentWindow&&("pi-desk:file-escape"===e.data&&z(),"pi-desk:file-switch-pane"===e.data&&I?.())};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[z,I]);let X=()=>{_&&K.current&&t.saveEditorState(_,K.current.getViewState())},{refresh:Q,unavailable:Z}=function(e,t,s,i,r,a=!0){(0,g.useSyncExternalStore)(t.subscribe,t.getRevision,t.getRevision);let n=t.getWorkspace(e.cwd)?.snapshot,o=e.state.activePath,l=!!e.state.activeDiff,c=o?e.state.documents.get(o):void 0,d=(0,g.useRef)(i);(0,g.useEffect)(()=>{d.current=i},[i]);let u=(0,g.useCallback)(()=>{o&&!l&&(d.current(),e.reloadFile(o),t.refreshSnapshot(e.cwd))},[l,t,o,e]);(0,g.useEffect)(()=>{if(!a||!r||!o||l)return;let i=()=>"visible"===window.document.visibilityState&&!!s.current?.getClientRects().length&&!s.current?.closest('[inert], [aria-hidden="true"]'),n=Date.now();i()&&(e.state.documents.get(o)?.status==="text"&&(d.current(),e.reloadFile(o)),t.refreshSnapshot(e.cwd));let c=()=>{!i()||Date.now()-n<1e3||(n=Date.now(),u())};return window.addEventListener("focus",c),window.document.addEventListener("visibilitychange",c),()=>{window.removeEventListener("focus",c),window.document.removeEventListener("visibilitychange",c)}},[r,l,t,s,o,u,a,e]),(0,g.useEffect)(()=>{if(!r||!o||l||c?.status!=="text")return;let t=new AbortController,s=n?.status==="ready"?(0,R.lN)(e.cwd,o,n.repositories):null;return e.compareFile(o,s?.repository.state==="ready"&&s.change?{repositoryRoot:s.repository.root,path:s.change.path}:null,t.signal),()=>t.abort()},[r,l,c,o,e,n]);let h=o&&n?.status==="ready"?(0,R.lN)(e.cwd,o,n.repositories):null;return{refresh:u,unavailable:n?.status==="error"||h?.repository.state==="unavailable"}}(t,s,H,X,y,j),ee=W?.status==="text"?W.comparison:void 0,[et,es]=(0,g.useState)(null),ei=ee?.status==="ready"&&W?.status==="text"&&et?.original===ee.original.content&&et.modified===W.content?et.count:void 0,er=e=>{_&&(X(),t.openFileDiff(_,e))},ea=Z||ee?.status==="error"?O("gitMarkersFailed"):ee?.status==="unavailable"||ee?.status==="ready"&&null===ei?O("gitMarkersUnavailable"):ee?.status==="loading"||ee?.status==="ready"&&void 0===ei?O("gitMarkersLoading"):ee?.status==="ready"?O("gitChangesCount",{count:ei}):null,en=B||_?(0,i.jsx)(i.Fragment,{children:B?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("span",{className:"mr-auto shrink-0 px-1 text-xs text-muted-foreground",children:[B.label??O("headToWorking"),"text"===B.status&&B.original.content===B.modified.content?O("noDiffChanges"):""]}),(0,i.jsx)(D,{label:O("previousChange"),onClick:()=>U.current?.previousChange(),children:(0,i.jsx)(r.A,{className:"size-4"})}),(0,i.jsx)(D,{label:O("nextChange"),onClick:()=>U.current?.nextChange(),children:(0,i.jsx)(a.A,{className:"size-4"})}),f?null:(0,i.jsx)(D,{label:"side-by-side"===L?O("inlineDiff"):O("sideBySideDiff"),active:"inline"===L,onClick:()=>t.setDiffViewMode("side-by-side"===L?"inline":"side-by-side"),children:(0,i.jsx)(n.A,{className:"size-4"})}),(0,i.jsx)(D,{label:O(q?"wrapOff":"wrapOn"),active:q,onClick:()=>t.setDiffWrapLines(!q),children:(0,i.jsx)(o.A,{className:"size-4"})}),(0,i.jsx)(D,{label:O(F?"expandUnchanged":"collapseUnchanged"),active:F,onClick:()=>t.setDiffCollapseUnchanged(!F),children:(0,i.jsx)(l.A,{className:"size-4"})}),(0,i.jsx)(D,{label:O("reloadDiff"),onClick:()=>t.reloadDiff(),children:(0,i.jsx)(c.A,{className:"size-4"})})]}):(0,i.jsxs)(i.Fragment,{children:[Y&&W?.status==="text"&&_?(0,i.jsx)("div",{className:"mr-auto flex shrink-0",role:"group","aria-label":O("markdown"===Y?"markdownMode":"htmlMode"),children:["preview","source"].map(e=>(0,i.jsx)(S.$,{variant:W.viewMode===e?"secondary":"ghost",size:"sm","aria-pressed":W.viewMode===e,onClick:()=>{X(),t.setTextViewMode(_,e)},children:O("preview"===e?"previewMode":"sourceMode")},e))}):null,V&&ea?(0,i.jsx)("span",{"data-testid":"file-git-status",role:"status",className:"mr-auto min-w-0 truncate text-xs text-muted-foreground",title:ee?.status==="error"?ee.error:ea,children:f&&ee?.status==="ready"&&"number"==typeof ei?O("gitChangesCompact",{count:ei}):ea}):null,V&&ee?.status==="ready"?(0,i.jsxs)(i.Fragment,{children:["number"==typeof ei&&ei>0?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{label:O("previousChange"),onClick:()=>K.current?.previousChange(),children:(0,i.jsx)(r.A,{className:"size-4"})}),(0,i.jsx)(D,{label:O("nextChange"),onClick:()=>K.current?.nextChange(),children:(0,i.jsx)(a.A,{className:"size-4"})})]}):null,(0,i.jsx)(D,{label:O("viewDiff"),onClick:()=>er(),children:(0,i.jsx)(d.A,{className:"size-4"})})]}):null,V&&_?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D,{label:O("findInFile"),onClick:()=>K.current?.openSearch(),children:(0,i.jsx)(u.A,{className:"size-4"})}),f?null:(0,i.jsx)(D,{label:O("goToLine"),onClick:()=>K.current?.gotoLine(),children:(0,i.jsx)(h.A,{className:"size-4"})}),(0,i.jsx)(D,{label:O(q?"wrapOff":"wrapOn"),active:q,onClick:()=>t.setWrapLines(_,!q),children:(0,i.jsx)(o.A,{className:"size-4"})}),(0,i.jsx)(D,{label:O("copySelectionOrAll"),onClick:()=>{if(W?.status!=="text")return;let e=K.current?.getSelectionText()??"";(0,v.x)(e||W.content).then(t=>{t?G.success(O(e?"selectedCodeCopied":"allCodeCopied")):G.error(O("copyContentFailed"))})},children:(0,i.jsx)(p.A,{className:"size-4"})})]}):null,_?(0,i.jsx)(D,{label:O("reloadCurrentFile"),onClick:Q,children:(0,i.jsx)(c.A,{className:"size-4"})}):null]})}):null;return(0,i.jsxs)("div",{ref:H,className:"flex size-full min-h-0 min-w-0 flex-col outline-none",tabIndex:-1,onFocus:e=>{e.target===e.currentTarget&&(V?K.current?.focus():B?U.current?.focus():H.current?.querySelector('[data-testid="markdown-preview"]')?.focus())},children:[E?E(en):en?(0,i.jsx)("div",{className:"flex min-h-9 shrink-0 flex-wrap items-center justify-end gap-2 border-b px-3 py-1","aria-label":O("fileActions"),children:en}):null,(0,i.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden pb-[env(safe-area-inset-bottom)]",children:B?"text"===B.status?(0,i.jsx)(k,{ref:U,original:B.original,modified:B.modified,viewMode:f?"inline":L,savedState:B.editorState,initialLine:B.initialLine,onSaveState:e=>t.saveDiffState(B,e),onEscape:z},`${B.repositoryRoot}:${B.path}`):"metadata"===B.status?(0,i.jsxs)("div",{className:"grid h-full grid-cols-1 gap-4 overflow-auto p-4 md:grid-cols-2",children:[(0,i.jsx)("pre",{className:"whitespace-pre-wrap break-all text-sm",children:B.originalMetadata}),(0,i.jsx)("pre",{className:"whitespace-pre-wrap break-all text-sm",children:B.modifiedMetadata})]}):"loading"===B.status?(0,i.jsx)($,{}):(0,i.jsxs)("div",{className:"flex size-full flex-col items-center justify-center gap-3 p-6 text-center text-sm",children:[(0,i.jsx)("p",{className:"text-muted-foreground",children:"binary"===B.status?O("binaryDiffUnavailable"):"too_large"===B.status?O("largeDiffUnavailable"):B.error}),"error"===B.status?(0,i.jsx)(S.$,{variant:"outline",onClick:()=>t.reloadDiff(),children:O("readAgain")}):null]}):_&&W?"loading"===W.status||"unloaded"===W.status?(0,i.jsx)($,{}):"error"===W.status?(0,i.jsxs)("div",{className:"flex size-full flex-col items-center justify-center gap-3 p-6 text-center",children:[(0,i.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:W.error}),(0,i.jsx)(S.$,{variant:"outline",onClick:()=>t.reloadFile(_),children:O("readAgain")})]}):"image"===W.status?(0,i.jsx)(N.k,{mode:"inline",slides:[{src:W.objectUrl,alt:_}],ariaLabel:O("imageViewer",{name:_.replaceAll("\\","/").split("/").at(-1)??_})},W.objectUrl):"markdown"===Y&&"preview"===W.viewMode?(0,i.jsx)(P.n,{content:W.content,label:O("markdownPreview",{name:_}),savedScrollTop:W.previewScrollTop,onScroll:e=>t.savePreviewScrollTop(_,e)},_):"html"===Y&&"preview"===W.viewMode?(0,i.jsx)("iframe",{ref:J,className:"block size-full border-0 bg-white",sandbox:"allow-scripts",srcDoc:(0,M.z)(W.content),title:O("htmlPreview",{name:_})}):(0,i.jsx)(b.e,{ref:K,path:_,content:W.content,size:W.size,originalContent:ee?.status==="ready"?ee.original.content:void 0,onChanges:e=>{ee?.status==="ready"&&es({original:ee.original.content,modified:W.content,count:e})},onOpenDiff:er,savedState:W.editorState,navigation:t.pendingNavigation,onNavigation:(e,s)=>t.consumeNavigation(e,s),onSaveState:(e,s)=>t.saveEditorState(e,s),onEscape:z},_):(0,i.jsxs)("div",{"data-testid":"file-workspace-empty",className:"flex size-full flex-col items-center justify-center gap-3 p-6 text-sm text-muted-foreground",children:[(0,i.jsx)(m.A,{className:"size-6"}),O("noOpenFile")]})})]})}function $(){let{t:e}=(0,x.Bd)("projectFiles");return(0,i.jsxs)("div",{className:"flex size-full items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,i.jsx)(f.A,{className:"size-4 animate-spin"}),e("loadingFile")]})}},73165:(e,t,s)=>{"use strict";s.d(t,{D:()=>d});var i=s(7962),r=s(60454),a=s(93750),n=s(74675),o=s(1364),l=s(49426),c=s(13464);function d({children:e}){return(0,i.jsx)(o.JW,{children:(0,i.jsx)(r.y,{className:"isolate z-[130] outline-none",side:"right",align:"start",alignOffset:4,children:(0,i.jsx)(a._,{"data-slot":"context-menu-content",finalFocus:!1,className:(0,l.cn)(c.hD,"flex flex-col overflow-hidden p-0"),children:(0,i.jsx)(n.V,{className:"min-h-0",viewportClassName:"p-1",children:e})})})})}},73429:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var i=s(7962);s(69266);var r=s(53555),a=s(49426);function n({className:e,type:t,...s}){return(0,i.jsx)(r.p,{type:t,"data-slot":"input",className:(0,a.cn)("min-h-8 w-full min-w-0 rounded-lg border border-input bg-card px-2.5 py-1 text-sm leading-5 transition-colors duration-150 outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-2 focus-visible:outline-solid focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-50 aria-invalid:border-destructive aria-invalid:outline-destructive",e),...s})}},74675:(e,t,s)=>{"use strict";s.d(t,{V:()=>u});var i=s(7962);s(69266);var r=s(82611),a=s(40709),n=s(51173),o=s(49426),l=s(93061),c=s(87425);function d({className:e,orientation:t="vertical",...s}){return(0,i.jsx)(l.V,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:(0,o.cn)("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",e),...s,children:(0,i.jsx)(c.l,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}function u({className:e,viewportClassName:t,viewportRef:s,onViewportScroll:l,children:c,...h}){return(0,i.jsxs)(r.V,{"data-slot":"l4-scroll-area",className:(0,o.cn)("relative min-h-0 overflow-hidden",e),...h,children:[(0,i.jsx)(a.B,{ref:s,"data-slot":"l4-scroll-area-viewport",className:(0,o.cn)("size-full rounded-[inherit] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",t),onScroll:l,children:c}),(0,i.jsx)(d,{className:"data-[orientation=vertical]:h-full data-[orientation=vertical]:w-2.5 data-[orientation=vertical]:border-l data-[orientation=vertical]:border-l-transparent"}),(0,i.jsx)(n.I,{})]})}},79137:(e,t,s)=>{"use strict";async function i(e){let t="u"<typeof navigator?void 0:navigator.clipboard;if(t?.writeText)try{return await t.writeText(e),!0}catch{}if("u"<typeof document||!document.body)return!1;let s=document.activeElement instanceof HTMLElement?document.activeElement:null,i=document.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.style.position="fixed",i.style.top="-9999px",i.style.left="-9999px",i.style.width="1px",i.style.height="1px",i.style.opacity="0";try{return document.body.append(i),i.select(),i.setSelectionRange(0,i.value.length),document.execCommand("copy")}catch{return!1}finally{i.remove();try{s?.focus()}catch{}}}s.d(t,{h3:()=>i,qj:()=>r});class r extends Error{constructor(e){super(e.message,{cause:e.cause}),this.name="PiDeskBrowserPluginError",this.pluginName=e.pluginName,this.contributionName=e.contributionName??null,this.phase=e.phase}}},81649:(e,t,s)=>{"use strict";s.d(t,{Ke:()=>c,Nt:()=>o,R6:()=>l});var i=s(7962),r=s(87946),a=s(36700),n=s(14064);function o({...e}){return(0,i.jsx)(r.N,{"data-slot":"collapsible",...e})}function l({...e}){return(0,i.jsx)(a.R,{"data-slot":"collapsible-trigger",...e})}function c({...e}){return(0,i.jsx)(n.j,{"data-slot":"collapsible-content",...e})}},82075:(e,t,s)=>{"use strict";function i(e,t){return`${e}:${t}`}function r(e,t){return e?`${e}/${t}`:t}function a(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function n(e,t,s=new Set){let i=[e],r=e;for(;!s.has(r);){let e=t(r);if(!e||s.has(e)||!e.startsWith(`${r}/`))break;i.push(e),r=e}return{path:e,targetPath:r,paths:i,label:r.slice(e.lastIndexOf("/")+1)}}function o(e,t=""){let s={path:t,directories:new Map,files:[]},i=new Map([[t,s]]);for(let a of e){let e=(t?a.slice(t.length+1):a).split("/"),n=s;for(let t of e.slice(0,-1)){let e=r(n.path,t),s=i.get(e);s||(s={path:e,directories:new Map,files:[]},i.set(e,s),n.directories.set(e,s)),n=s}n.files.push(a)}return i}function l(e,t,s){return n(e,e=>{let s=t.get(e);return s&&0===s.files.length&&1===s.directories.size?s.directories.keys().next().value??null:null},s)}function c(e,t,s=""){let r=[],n=(s,o)=>{let c=e.get(s);if(c){for(let s of[...c.directories.keys()].sort(a)){let a=l(s,e),c=!a.paths.some(e=>t.has(e));r.push({key:i("directory",s),type:"directory",path:a.targetPath,label:a.label,depth:o,directory:a,expanded:c}),c&&n(a.targetPath,o+1)}for(let e of[...c.files].sort(a))r.push({key:i("file",e),type:"file",path:e,label:e.slice(e.lastIndexOf("/")+1),depth:o})}};return n(s,0),r}s.d(t,{Im:()=>i,Kn:()=>a,OA:()=>o,_J:()=>r,qV:()=>c,rk:()=>n,xV:()=>l})},83029:e=>{e.exports={markdown:"l4-markdown_markdown__oIf6d",status:"l4-markdown_status__EVcKw",alert:"l4-markdown_alert__Aooao",alertTitle:"l4-markdown_alertTitle__GIoFs",alertBody:"l4-markdown_alertBody__BtDVT"}},86062:(e,t,s)=>{"use strict";s.d(t,{T8:()=>g,WW:()=>x,aD:()=>n,co:()=>h,lw:()=>v,ph:()=>f,xv:()=>d,yw:()=>p});var i=s(38979),r=s(67765),a=s(24985);let n=i.Yj().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),o=i.KC([n,i.eu("HEAD"),i.Yj().max(1024).regex(/^refs\/(?:heads|remotes)\/[^\0\r\n]+$/)]).refine(e=>!e.includes("..")&&!e.endsWith("/"),"Git 版本无效"),l=i.KC([i.Ik({commit:o,parent:n.optional()}).strict(),i.Ik({base:o,target:o,strategy:i.k5(["merge-base","direct"])}).strict()]),c=i.Ik({base:n.nullable(),target:n,original:n.nullable()}).strict(),d=i.Ik({baseCommit:n.nullable(),targetCommit:n,oldPath:r._g.optional()}).strict(),u=i.Ik({oid:n,parents:i.YO(n),subject:i.Yj(),author:i.Yj(),timestampMs:i.ai().int(),refs:i.YO(i.Yj())}).strict(),h=i.Ik({tip:o,exclude:o.optional(),query:i.Yj().trim().max(200).default(""),author:i.Yj().trim().max(200).optional(),page:i.Ik({index:i.ai().int().min(1).max(2e3),size:i.ai().int().min(1).max(100)}).strict()}).strict(),p=i.Ik({tip:n.nullable(),exclude:n.nullable(),items:i.YO(u),hasMore:i.zM(),truncated:i.zM()}).strict(),m=i.Ik({path:r._g,oldPath:r._g.nullable(),status:i.k5(["added","modified","deleted","renamed","type-changed"])}).strict(),f=i.Ik({selection:l,page:i.Ik({index:i.ai().int().min(1).max(5e4),size:i.ai().int().min(1).max(500)}).strict()}).strict(),g=i.Ik({comparison:c,commit:u.extend({message:i.Yj(),selectedParent:n.nullable()}).nullable(),items:i.YO(m),hasMore:i.zM(),truncated:i.zM()}).strict(),x=a.gf.extend({upstream:i.Ik({ref:i.Yj(),ahead:i.ai().int().nonnegative().nullable(),behind:i.ai().int().nonnegative().nullable()}).strict().nullable()}).strict(),v=i.KC([a.FJ,i.Ik({kind:i.eu("metadata"),original:i.Yj(),modified:i.Yj()}).strict()])},86963:(e,t,s)=>{"use strict";s.d(t,{$:()=>l,r:()=>o});var i=s(7962),r=s(28549),a=s(73392),n=s(49426);let o=(0,a.F)("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap cursor-pointer transition-colors duration-150 ease-out outline-none select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-pressed:bg-accent aria-pressed:text-accent-foreground aria-pressed:hover:bg-[color-mix(in_oklab,var(--accent),var(--foreground)_5%)] aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-[color-mix(in_oklab,var(--primary),var(--primary-foreground)_8%)] active:bg-[color-mix(in_oklab,var(--primary),var(--primary-foreground)_14%)]",outline:"border-border bg-card text-card-foreground hover:bg-accent active:bg-[color-mix(in_oklab,var(--accent),var(--foreground)_6%)] aria-expanded:bg-accent aria-expanded:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklab,var(--secondary),var(--foreground)_8%)] active:bg-[color-mix(in_oklab,var(--secondary),var(--foreground)_14%)] aria-expanded:bg-accent aria-expanded:text-accent-foreground",ghost:"hover:bg-foreground/8 hover:text-foreground active:bg-foreground/14 aria-expanded:bg-accent aria-expanded:text-accent-foreground",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-foreground underline underline-offset-4 hover:text-muted-foreground"},size:{default:"min-h-8 gap-2 px-2 py-1",xs:"min-h-7 gap-2 rounded-md px-2 py-0.5 text-sm",sm:"min-h-7 gap-2 rounded-md px-2 py-0.5 text-sm",lg:"min-h-10 gap-2 px-3 py-2",icon:"size-8","icon-xs":"size-7 rounded-md","icon-sm":"size-7 rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function l({className:e,variant:t="default",size:s="default",...a}){return(0,i.jsx)(r.$,{"data-slot":"button",className:(0,n.cn)(o({variant:t,size:s,className:e})),...a})}},89790:(e,t,s)=>{"use strict";s.d(t,{G7:()=>d,L$:()=>p,h_:()=>m,oI:()=>u,uB:()=>c,xL:()=>h});var i=s(7962);s(69266);var r=s(30442),a=s(49426);s(5464);var n=s(17511),o=s(41148),l=s(90458);function c({className:e,...t}){return(0,i.jsx)(r.uB,{"data-slot":"command",className:(0,a.cn)("flex size-full flex-col overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground",e),...t})}function d({className:e,...t}){return(0,i.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,i.jsxs)(n.MG,{className:"has-[[data-slot=command-input]:focus-visible]:outline-2 has-[[data-slot=command-input]:focus-visible]:outline-solid has-[[data-slot=command-input]:focus-visible]:-outline-offset-2 has-[[data-slot=command-input]:focus-visible]:outline-ring",children:[(0,i.jsx)(r.uB.Input,{"data-slot":"command-input",className:(0,a.cn)("min-h-8 w-full bg-transparent px-2.5 text-sm leading-5 outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t}),(0,i.jsx)(n.Sq,{children:(0,i.jsx)(o.A,{className:"size-4 shrink-0 opacity-50"})})]})})}function u({className:e,...t}){return(0,i.jsx)(r.uB.List,{"data-slot":"command-list",className:(0,a.cn)("pi-desk-chat-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",e),...t})}function h({className:e,...t}){return(0,i.jsx)(r.uB.Empty,{"data-slot":"command-empty",className:(0,a.cn)("py-6 text-center text-sm",e),...t})}function p({className:e,...t}){return(0,i.jsx)(r.uB.Group,{"data-slot":"command-group",className:(0,a.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",e),...t})}function m({className:e,children:t,...s}){return(0,i.jsxs)(r.uB.Item,{"data-slot":"command-item",className:(0,a.cn)("group/command-item relative flex min-h-8 cursor-pointer items-center gap-2 rounded-md px-2 py-1 text-sm leading-5 outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[selected=true]:*:[svg]:text-foreground",e),...s,children:[t,(0,i.jsx)(l.A,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}},90064:e=>{e.exports={host:"l4-code-line-markers_host__BBo2H",added:"l4-code-line-markers_added__oTNsK",modified:"l4-code-line-markers_modified__PZnY_",deletedBefore:"l4-code-line-markers_deletedBefore___1b0w",deletedAfter:"l4-code-line-markers_deletedAfter__SEoHy"}},90434:(e,t,s)=>{"use strict";s.d(t,{AM:()=>u,Wv:()=>h,eO:()=>m,hl:()=>p});var i=s(7962);s(69266);var r=s(50960),a=s(40252),n=s(17596),o=s(80168),l=s(40287),c=s(76624),d=s(49426);function u({...e}){return(0,i.jsx)(r.y,{"data-slot":"popover",...e})}function h({...e}){return(0,i.jsx)(a.W,{"data-slot":"popover-trigger",...e})}function p({className:e,positionerClassName:t,align:s="center",alignOffset:r=0,side:a="bottom",sideOffset:c=4,finalFocus:u=!1,...h}){return(0,i.jsx)(n.i,{children:(0,i.jsx)(o.U,{align:s,alignOffset:r,side:a,sideOffset:c,className:(0,d.cn)("isolate z-50",t),children:(0,i.jsx)(l.i,{"data-slot":"popover-content",finalFocus:u,className:(0,d.cn)("z-50 flex w-80 max-w-[calc(100vw-2rem)] origin-(--transform-origin) flex-col gap-3 rounded-lg border border-border bg-popover p-3 text-sm text-popover-foreground shadow-md outline-hidden duration-100 motion-reduce:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...h})})})}function m({className:e,...t}){return(0,i.jsx)(c.e,{"data-slot":"popover-title",className:(0,d.cn)("font-medium",e),...t})}},90504:(e,t,s)=>{"use strict";s.d(t,{e:()=>h});var i=s(7962),r=s(14044),a=s(69266),n=s(78121),o=s(91182),l=s(18302),c=s(33550),d=s(90064),u=s.n(d);let h=(0,a.forwardRef)(function({path:e,content:t,size:d,savedState:h,onSaveState:p,onEscape:m,originalContent:f,onChanges:g,onOpenDiff:x,navigation:v,onNavigation:b},y){let{t:j}=(0,n.Bd)("common"),{t:w}=(0,n.Bd)("projectFiles"),{wrapLines:k}=(0,c.TX)(),N=(0,a.useRef)(null),C=(0,a.useRef)(null),S=(0,a.useRef)(p),R=(0,a.useRef)(k),z=(0,a.useRef)(h),D=(0,a.useRef)(m),M=(0,a.useRef)(null),P=(0,a.useRef)(g),A=(0,a.useRef)(x),T=(0,a.useRef)(b),$=(0,a.useRef)(null),I=(0,a.useRef)(null),E=(0,a.useCallback)(e=>{let t=I.current;$.current?.clear(),null===t||t>(e.getModel()?.getLineCount()??0)||($.current??=e.createDecorationsCollection(),$.current.set([{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:"bg-accent"}}]))},[]);(0,a.useEffect)(()=>{z.current=h,D.current=m,P.current=g,A.current=x,T.current=b},[g,m,x,b,h]);let[O,q]=(0,a.useState)("loading");return(0,a.useEffect)(()=>{S.current=p},[p]),(0,a.useEffect)(()=>{R.current=k},[k]),(0,a.useImperativeHandle)(y,()=>({openSearch(){C.current?.getAction("actions.find")?.run()},gotoLine(){C.current?.getAction("editor.action.gotoLine")?.run()},getSelectionText(){let e=C.current,t=e?.getModel(),s=e?.getSelection();return t&&s&&!s.isEmpty()?t.getValueInRange(s):""},getViewState:()=>C.current?.saveViewState()??null,focus(){C.current?.focus()},previousChange(){M.current?.previousChange()},nextChange(){M.current?.nextChange()}}),[]),(0,a.useEffect)(()=>{let i=N.current;if(!i)return;let r=!0,a=null,n=null,c=null,h=()=>void 0,p=()=>void 0;return queueMicrotask(()=>{r&&q("loading")}),(0,o.cu)().then(m=>{r&&(n=m.editor.createModel(t,(0,o.ix)(e,d),(0,o.B3)(m,e,"preview")),a=m.editor.create(i,{model:n,theme:(0,o.dC)(),readOnly:!0,domReadOnly:!0,editContext:!1,automaticLayout:!0,minimap:{enabled:!1},stickyScroll:{enabled:!1},scrollBeyondLastLine:!1,smoothScrolling:!1,wordWrap:R.current?"on":"off",wrappingIndent:"same",...(0,o.R)(),lineNumbersMinChars:3,lineDecorationsWidth:26,folding:d<=1048576,renderValidationDecorations:"off",renderWhitespace:"selection",bracketPairColorization:{enabled:d<=1048576},unicodeHighlight:{nonBasicASCII:!1},padding:{top:10,bottom:10},overviewRulerBorder:!1,contextmenu:!0,ariaLabel:j("codeReadOnly")}),z.current&&a.restoreViewState(z.current),D.current&&(0,l.e)(a,m.KeyCode.Escape,()=>D.current?.()),C.current=a,void 0!==f&&(M.current=c=function(e,t,i){let r=e.createDecorationsCollection(),a=e.getModel()?.getLineCount()??1,n=[],o=!0,l=null,c=null,d=[u().added,u().modified,u().deletedBefore,u().deletedAfter].map(e=>`.${e}`).join(","),h=e=>Math.min(a,"deleted"===e.kind?Math.max(1,e.modifiedStartLineNumber-1):e.modifiedStartLineNumber),p=()=>{null!==c&&clearTimeout(c),c=null,l?.terminate(),l=null},m=e=>{o&&(p(),n=e??[],r.set(n.map(e=>{let s="deleted"===e.kind,r=h(e),a=s?r:e.modifiedEndLineNumberExclusive-1,n=s?e.originalEndLineNumberExclusive-e.originalStartLineNumber:e.modifiedEndLineNumberExclusive-e.modifiedStartLineNumber,o={added:["#16803c","#59c77b"],modified:["#216bcc","#6aabff"],deleted:["#d12c38","#ff757f"]}[e.kind],l=s?1===e.modifiedStartLineNumber?u().deletedBefore:u().deletedAfter:u()[e.kind];return{range:new t.Range(r,1,a,1),options:{isWholeLine:!s,showIfCollapsed:!0,linesDecorationsClassName:s?void 0:l,firstLineDecorationClassName:s?l:void 0,linesDecorationsTooltip:i.tooltip(e.kind,n),overviewRuler:{color:o[0],darkColor:o[1],position:t.editor.OverviewRulerLane.Left}}}})),null===e&&console.warn("[Pi Desk][CodePreview] 行标记不可用,计算失败或超过限制",{path:i.path}),i.onChanges(e?.length??null))},f=e.onMouseDown(e=>{if(e.target.type!==t.editor.MouseTargetType.GUTTER_LINE_DECORATIONS||!e.target.element?.closest(d))return;let s=e.target.position?.lineNumber;void 0===s||n.find(e=>"deleted"===e.kind?h(e)===s:e.modifiedStartLineNumber<=s&&s<e.modifiedEndLineNumberExclusive)&&i.onOpenDiff(s)});try{(l=new Worker(s.tu(new URL(s.p+s.u(58779),s.b)),{type:void 0,name:"pi-desk-line-changes"})).onmessage=e=>m(e.data),l.onerror=()=>m(null),l.onmessageerror=()=>m(null),c=setTimeout(()=>m(null),3e3),l.postMessage({original:i.original,modified:i.modified})}catch{m(null)}let g=t=>{if(0===n.length)return;let s=e.getPosition()?.lineNumber??1,i=n.map(h),r="next"===t?i.find(e=>e>s)??i[0]:i.findLast(e=>e<s)??i[i.length-1];e.setPosition({lineNumber:r,column:1}),e.revealLineInCenter(r),e.focus()};return{previousChange(){g("previous")},nextChange(){g("next")},dispose(){o=!1,p(),f.dispose(),r.clear(),n=[]}}}(a,m,{path:e,original:f,modified:t,tooltip:(e,t)=>w({added:"gitAddedLines",modified:"gitModifiedLines",deleted:"gitDeletedLines"}[e],{count:t}),onChanges:e=>P.current?.(e),onOpenDiff:e=>A.current?.(e)})),h=(0,o.Tr)(e=>m.editor.setTheme(e)),p=(0,o.BK)(e=>a?.updateOptions(e)),E(a),q("ready"))}).catch(t=>{r&&(console.error("[Pi Desk][CodePreview] Monaco 加载失败",{path:e,errorName:t instanceof Error?t.name:"UnknownError"}),q("error"),void 0!==f&&P.current?.(null))}),()=>{r=!1,h(),p(),c?.dispose(),M.current=null,a&&(z.current=a.saveViewState(),S.current(e,z.current)),$.current?.clear(),$.current=null,C.current=null,a?.dispose(),n?.dispose()}},[t,f,E,e,w,d,j]),(0,a.useEffect)(()=>{C.current?.updateOptions({wordWrap:k?"on":"off"})},[k]),(0,a.useEffect)(()=>{let t=C.current;if(!v||"ready"!==O||!t)return;let s=t.getModel(),i=!!(s&&v.line>=1&&v.line<=s.getLineCount());I.current=i?v.line:null,E(t),i&&(t.setPosition({lineNumber:v.line,column:1}),t.revealLineInCenter(v.line),z.current=t.saveViewState(),S.current(e,z.current)),T.current?.(v,i)},[O,v,E,e]),(0,i.jsxs)("div",{"data-testid":"code-preview",className:"relative h-full min-h-0 w-full overflow-hidden bg-background",children:[(0,i.jsx)("div",{ref:N,className:`size-full ${u().host}`}),"loading"===O?(0,i.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center gap-2 bg-background text-sm text-muted-foreground",children:[(0,i.jsx)(r.A,{className:"size-4 animate-spin"})," ",j("codeLoading")]}):null,"error"===O?(0,i.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center text-sm text-destructive",children:j("codeFailed")}):null]})})},91182:(e,t,s)=>{"use strict";s.d(t,{B3:()=>h,BK:()=>n,R:()=>a,Tr:()=>u,cu:()=>c,dC:()=>d,ix:()=>p});var i=s(67765),r=s(48708);function a(){let e=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)/16;return{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace',fontSize:14*e,lineHeight:Math.round(22*e)}}function n(e){let t=new MutationObserver(()=>e(a()));return t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-pi-desk-display-size"]}),()=>t.disconnect()}let o=null,l=0;function c(){return o||(o=(async()=>{(0,r.fx)()?.locale==="zh-CN"&&await s.e(12212).then(s.t.bind(s,12212,23));let{monaco:e}=await Promise.all([s.e(87221),s.e(46550),s.e(62134),s.e(38459),s.e(95287),s.e(54206),s.e(87086)]).then(s.bind(s,87086));return globalThis.MonacoEnvironment={getWorker:(e,t)=>new Worker(s.tu(new URL(s.p+s.u(53291),s.b)),{type:void 0,name:t})},e})())}function d(){return document.documentElement.classList.contains("dark")?"vs-dark":"vs"}function u(e){let t=new MutationObserver(()=>e(d()));return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()}function h(e,t,s){l+=1;let i=t.split("/").map(e=>encodeURIComponent(e)).join("/");return e.Uri.parse(`inmemory://pi-desk/${l}/${s}/${i}`)}function p(e,t){if(t>i.gB)return"plaintext";let s=e.replaceAll("\\","/").split("/").at(-1)?.toLocaleLowerCase()??"";return"dockerfile"===s?"dockerfile":"makefile"===s?"plaintext":({bat:"bat",c:"c",cc:"cpp",cjs:"javascript",cpp:"cpp",cs:"csharp",css:"css",dockerfile:"dockerfile",go:"go",h:"cpp",hpp:"cpp",htm:"html",html:"html",ini:"ini",java:"java",js:"javascript",json:"javascript",jsonl:"javascript",jsx:"javascript",kt:"kotlin",less:"less",lua:"lua",md:"markdown",mdx:"markdown",mjs:"javascript",php:"php",ps1:"powershell",py:"python",rb:"ruby",rs:"rust",scss:"scss",sh:"shell",sql:"sql",swift:"swift",toml:"ini",ts:"typescript",tsx:"typescript",txt:"plaintext",xml:"xml",yaml:"yaml",yml:"yaml"})[s.includes(".")?s.split(".").at(-1)??"":""]??"plaintext"}},93119:(e,t,s)=>{"use strict";s.d(t,{$:()=>n,P:()=>a});var i=s(94853),r=s(93320);async function a(e,t,s,a){await (0,r.QL)(e,i.Ot,{...t,path:s,targetType:a})}function n(e,t){let s=/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\"),i=s?"\\":"/",r=(s?e.replaceAll("/","\\"):e).replace(/[\\/]+$/,"");return t?`${r}${i}${t.replaceAll("/",i)}`:/^[a-z]:$/i.test(r)?`${r}${i}`:r||i}},93320:(e,t,s)=>{"use strict";s.d(t,{QL:()=>n,Y4:()=>o,aw:()=>a});var i=s(73230),r=s(94853);class a extends Error{constructor(e,t,s,i=null){super(s),this.status=e,this.code=t,this.errorKey=i,this.name="L3ProjectRequestError"}}async function n(e,t,s,r){let n=await fetch(t.path,{method:"POST",headers:{"Content-Type":"application/json","X-Pi-Desk-Client-Id":e},body:JSON.stringify(t.request.parse(s)),signal:r}),o=await n.json();if(!n.ok||0!==o.code||null===o.data)throw new a(n.status,o.code,o.msg?(0,i.B)(o):"项目读取失败",o.i18n?.key??null);return t.response.parse(o.data)}function o(e,t,s){async function i(t,i,r){try{return await n(e,t,i,r)}catch(e){throw!r?.aborted&&e instanceof a&&401===e.status&&s?.(),e}}return{list:(e,s)=>i(r.Xe,{...t,path:e},s),search:(e,s)=>i(r.fg,{...t,...e},s),get:(e,s,a)=>i(r.ZI,{...t,path:e,imagePreviewMode:s},a),snapshot:(e,s)=>i(r.p0,{...t,refresh:s},e),branches:(e,s)=>i(r.ry,{...t,repositoryRoot:e},s),log:(e,s,a)=>i(r.p3,{...t,repositoryRoot:e,...s},a),changes:(e,s,a)=>i(r.ys,{...t,repositoryRoot:e,...s},a),diff:(e,s,a,n)=>i(r.OC,{...t,repositoryRoot:e,path:s,comparison:n},a)}}},94306:(e,t,s)=>{"use strict";s.d(t,{q:()=>Y});var i=s(7962),r=s(78121),a=s(31761),n=s(24925),o=s(48155),l=s(63013),c=s(55079),d=s(49667),u=s(90680),h=s(24863),p=s(49762),m=s(60278),f=s(72282),g=s(86963),x=s(35800),v=s(35842),b=s(73068),y=s(51821),j=s(99084),w=s(69266),k=s(28460),N=s(64334),C=s(14044),S=s(57731),R=s(35995),z=s(15265),D=s(5816),M=s(74675),P=s(73429),A=s(60471),T=s(49426);function $({items:e,label:t,scrollTop:s,onScroll:r,render:a,role:n="listbox",onKeyDown:o}){let l=(0,w.useRef)(null),[c,d]=(0,w.useState)({top:s,height:300});(0,w.useLayoutEffect)(()=>{let e=l.current;if(!e)return;e.scrollTop=s;let t=()=>d({top:e.scrollTop,height:e.clientHeight});t();let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[]),(0,w.useLayoutEffect)(()=>{l.current&&(l.current.scrollTop=s)},[e,s]);let u=Math.max(0,Math.floor(c.top/36)-8),h=Math.min(e.length,Math.ceil((c.top+c.height)/36)+8);return(0,i.jsx)("div",{ref:l,role:n,tabIndex:"tree"===n?0:void 0,onKeyDown:o,"aria-label":t,className:"min-h-0 flex-1 overflow-auto overscroll-contain",onScroll:e=>{let t=e.currentTarget.scrollTop;d(e=>({...e,top:t})),r(t)},children:(0,i.jsx)("div",{style:{height:36*e.length,position:"relative"},children:(0,i.jsx)("div",{style:{position:"absolute",top:36*u,left:0,right:0},children:e.slice(u,h).map((e,t)=>a(e,u+t))})})})}var I=s(36670),E=s(50479),O=s(66584),q=s(60682),L=s(82075);let F={added:"A",modified:"M",deleted:"D",renamed:"R","type-changed":"T"};function B({cwd:e,repositoryRoot:t,rows:s,changes:a,selectedPath:n,scrollTop:o,onScroll:l,onSelect:c,onToggle:d,onOpen:u,onReveal:h}){let{t:p}=(0,r.Bd)("projectHistory"),f=new Map(a.map(e=>[e.path,e]));return(0,i.jsx)($,{role:"tree",label:p("changeFiles"),items:s,scrollTop:o,onScroll:l,onKeyDown:e=>{if(e.defaultPrevented||!e.currentTarget.contains(e.target))return;let t=e.target instanceof Element?e.target.closest("[data-tree-key]"):null;if(e.target instanceof Element&&e.target.closest("button"))return;let i=t?s.findIndex(e=>e.key===t.dataset.treeKey):-1,r=s[i],a=i;if("ArrowDown"===e.key)a=Math.min(s.length-1,i+1);else if("ArrowUp"===e.key)a=Math.max(0,i-1);else if("Home"===e.key)a=0;else if("End"===e.key)a=s.length-1;else if("ArrowRight"===e.key&&r?.directory)r.expanded?a=Math.min(s.length-1,i+1):d(r.directory.path);else if("ArrowLeft"===e.key&&r){if(r.expanded&&r.directory)d(r.directory.path);else for(let e=i-1;e>=0;e-=1)if(s[e].depth<r.depth){a=e;break}}else{if("Enter"!==e.key&&" "!==e.key||!r)return;r.directory?d(r.directory.path):"Enter"===e.key?u(r.path):c(r.path)}e.preventDefault();let n=s[a];if(!n)return;let o=e.currentTarget;36*a<o.scrollTop?o.scrollTop=36*a:(a+1)*36>o.scrollTop+o.clientHeight&&(o.scrollTop=(a+1)*36-o.clientHeight),requestAnimationFrame(()=>{[...o.querySelectorAll("[data-tree-key]")].find(e=>e.dataset.treeKey===n.key)?.focus()})},render:s=>{let r=f.get(s.path),a=(0,L._J)(t,s.path),o=s.directory;return(0,i.jsx)(q.J,{cwd:e,path:a,type:s.type,historical:!0,expanded:s.expanded,onToggle:o?()=>d(o.path):void 0,onOpen:"file"===s.type?()=>u(s.path):void 0,openLabel:p("viewDiff"),oldPath:"file"===s.type&&r?.oldPath?(0,L._J)(t,r.oldPath):void 0,onReveal:h,trigger:(0,i.jsxs)("div",{role:"treeitem",tabIndex:0,"aria-level":s.depth+1,"aria-expanded":s.expanded,"aria-selected":"file"===s.type&&n===s.path,"data-tree-key":s.key,className:(0,T.cn)("flex h-9 min-w-0 cursor-pointer items-center gap-2 pr-2 text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","file"===s.type&&n===s.path&&"bg-accent"),style:{paddingLeft:8+16*s.depth},title:r?.oldPath&&"file"===s.type?`${(0,L._J)(t,r.oldPath)} → ${a}`:a,onClick:e=>{o?e.detail<2&&d(o.path):c(s.path)},onDoubleClick:()=>{"file"===s.type&&u(s.path)},children:[o?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(I.A,{className:(0,T.cn)("size-4 shrink-0 text-muted-foreground",s.expanded&&"rotate-90")}),s.expanded?(0,i.jsx)(E.A,{className:"size-4 shrink-0 text-muted-foreground"}):(0,i.jsx)(O.A,{className:"size-4 shrink-0 text-muted-foreground"})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"w-4 shrink-0"}),(0,i.jsx)("span",{className:(0,T.cn)("w-4 shrink-0 font-mono text-xs",r?.status==="added"?"text-emerald-600 dark:text-emerald-400":r?.status==="deleted"?"text-red-600 dark:text-red-400":"text-blue-600 dark:text-blue-400"),"aria-label":p("gitStatus",{status:r?F[r.status]:""}),children:r?F[r.status]:""})]}),(0,i.jsxs)("span",{className:"min-w-0 flex-1 truncate",children:[s.label,"directory"===s.type&&f.has(s.path)?"/":""]}),"file"===s.type?(0,i.jsx)(g.$,{size:"icon-sm",variant:"ghost","aria-label":p("viewDiffPath",{path:s.path}),onDoubleClick:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),u(s.path)},children:(0,i.jsx)(m.A,{className:"size-4"})}):null]})},s.key)}})}function _(e){let{state:t,repositories:s,projectName:a,narrow:n,scroll:o}=e,{t:l}=(0,r.Bd)("projectHistory"),{locale:c,timeZone:d}=(0,D.i)(),h=(0,w.useMemo)(()=>new Intl.DateTimeFormat("en"===c?"en-US":"zh-CN",{timeZone:d,month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[c,d]),p=(0,w.useMemo)(()=>new Intl.DateTimeFormat("en"===c?"en-US":"zh-CN",{timeZone:d,timeZoneName:"shortOffset",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[c,d]),m=(0,w.useId)(),{mobilePane:x,onMobilePane:v}=e,b=t.changes.data,y=`${t.repositoryRoot}:${b?.comparison.original}:${b?.comparison.target}`,j=t.selectedChangePath,k=[{value:"HEAD",label:l("currentHead")},...(t.branches.data?.local??[]).map(e=>({value:`refs/heads/${e}`,label:e,description:l("localBranch")})),...(t.branches.data?.remote??[]).map(e=>({value:`refs/remotes/${e}`,label:e,description:l("remoteBranch")}))],N=t.branches.data?.upstream,I=b?.commit,E=s=>s?(0,i.jsxs)("div",{role:"alert",className:"flex flex-wrap items-center gap-2 p-3 text-sm text-destructive",children:[(0,i.jsx)("span",{className:"min-w-0 flex-1 break-words",children:s}),(0,i.jsx)(g.$,{size:"sm",variant:"outline",onClick:e.onRefresh,children:l("retry")}),"compare"===t.mode&&"merge-base"===t.strategy?(0,i.jsx)(g.$,{size:"sm",variant:"outline",onClick:()=>e.onStrategy("direct"),children:l("compareDirect")}):null]}):null,O=(0,i.jsxs)("div",{className:"flex size-full min-h-0 min-w-0 flex-col",children:[E(t.log.error),"loading"===t.log.status?(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",children:[(0,i.jsx)(C.A,{className:"size-4 animate-spin"}),l("loadingCommits")]}):null,(0,i.jsx)($,{items:t.log.data?.items??[],label:l("commitList"),scrollTop:o.log,onScroll:t=>e.onScroll("log",t),render:s=>(0,i.jsxs)("button",{type:"button",role:"option","aria-selected":t.selectedCommit===s.oid,className:(0,T.cn)("flex h-9 w-full items-center gap-3 border-b border-border/40 px-3 text-left text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",t.selectedCommit===s.oid&&"bg-accent"),onClick:()=>{var t;return t=s.oid,void(e.onCommit(t),n&&v("files"))},title:`${s.subject}
14
+ ${s.oid}
15
+ ${s.author} \xb7 ${p.format(s.timestampMs)}`,children:[(0,i.jsxs)("span",{className:"min-w-0 flex-1 truncate",children:[s.subject||l("noCommitMessage"),s.refs.length?(0,i.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:s.refs.join(" \xb7 ")}):null]}),(0,i.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:s.oid.slice(0,7)}),n?null:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"w-20 truncate text-xs text-muted-foreground",children:s.author}),(0,i.jsx)("time",{className:"w-28 shrink-0 text-right text-xs text-muted-foreground",children:h.format(s.timestampMs)})]})]},s.oid)},`${t.repositoryRoot}:${t.mode}:${t.tip}:${t.base}:${t.target}:${t.query}:${t.author}`),"ready"!==t.log.status||t.log.data?.items.length?null:(0,i.jsx)("p",{className:"px-3 py-4 text-sm text-muted-foreground",children:t.query||t.author?l("noMatchingCommits"):l("noCommits")}),t.log.data?.truncated?(0,i.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:l("scanLimit")}):null,(t.log.data?.items.length??0)>=2e3?(0,i.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:l("loadedLimit")}):t.log.data?.hasMore?(0,i.jsx)(g.$,{variant:"ghost",size:"sm",disabled:"loading"===t.log.status,onClick:e.onMoreLog,children:l("loadMoreCommits")}):null]}),q=(0,i.jsxs)("div",{className:"flex size-full min-h-0 min-w-0 flex-col",children:[(0,i.jsxs)("div",{className:"flex min-h-9 shrink-0 flex-wrap items-center gap-2 border-b px-3 py-1",children:[n?(0,i.jsx)(g.$,{variant:"ghost",size:"icon-sm","aria-label":l("backCommits"),onClick:()=>v("log"),children:(0,i.jsx)(S.A,{className:"size-4"})}):null,(0,i.jsx)("span",{className:"text-sm font-medium",children:t.selectedCommit?l("commitChanges"):l("cumulativeChanges")}),b?(0,i.jsx)("span",{className:"text-xs text-muted-foreground",children:l("loadedFiles",{count:b.items.length})}):null,"compare"===t.mode&&t.selectedCommit?(0,i.jsx)(g.$,{variant:"ghost",size:"sm",onClick:e.onAggregate,children:l("backCumulative")}):null]}),E(t.changes.error),"loading"===t.changes.status?(0,i.jsxs)("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[(0,i.jsx)(C.A,{className:"size-4 animate-spin"}),l("loadingChanges")]}):null,(0,i.jsxs)(f.HK,{orientation:"vertical",defaultLayout:{"project-changes":e.panelSizes.changes,"project-detail":100-e.panelSizes.changes},onLayoutChanged:(t,s)=>{s.isUserInteraction&&void 0!==t["project-changes"]&&e.onPanelSize("changes",t["project-changes"])},children:[(0,i.jsx)(f.wV,{id:"project-changes",defaultSize:`${e.panelSizes.changes}%`,minSize:"80px",children:(0,i.jsxs)("div",{className:"flex size-full min-h-0 flex-col",children:[(0,i.jsx)(B,{cwd:e.cwd,repositoryRoot:t.repositoryRoot??"",rows:e.changeRows,changes:b?.items??[],selectedPath:j,scrollTop:o.changes,onScroll:t=>e.onScroll("changes",t),onSelect:e.onSelectChange,onToggle:e.onToggleDirectory,onOpen:e.onOpenFile,onReveal:e.onReveal},y),"ready"!==t.changes.status||b?.items.length?null:(0,i.jsx)("p",{className:"px-3 py-4 text-sm text-muted-foreground",children:l("noDiff")}),b?.hasMore?(0,i.jsx)(g.$,{size:"sm",variant:"ghost",disabled:"loading"===t.changes.status,onClick:e.onMoreChanges,children:l("loadMoreFiles")}):null,b?.truncated?(0,i.jsx)("p",{className:"p-3 text-xs text-muted-foreground",children:l("changesLimit")}):null]})}),(0,i.jsx)(f.WM,{}),(0,i.jsx)(f.wV,{id:"project-detail",defaultSize:`${100-e.panelSizes.changes}%`,minSize:"60px",children:(0,i.jsxs)(M.V,{className:"h-full",viewportClassName:"p-3 text-sm",role:"region","aria-label":l("commitDetails"),children:[I?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("pre",{className:"mb-3 whitespace-pre-wrap break-words font-sans leading-relaxed",children:I.message}),(0,i.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,i.jsx)("span",{className:"min-w-0 flex-1 break-all font-mono text-xs",children:I.oid}),(0,i.jsx)(g.$,{size:"icon-sm",variant:"ghost","aria-label":l("copySha"),onClick:()=>e.onCopy(I.oid),children:(0,i.jsx)(R.A,{className:"size-4"})})]}),(0,i.jsxs)("p",{className:"mb-3 text-xs text-muted-foreground",children:[I.author," \xb7 ",p.format(I.timestampMs)]}),I.parents.length>1?(0,i.jsx)(A.b,{className:"mb-3",ariaLabel:l("compareParent"),value:I.selectedParent??"",options:I.parents.map((e,t)=>({value:e,label:l("parentCommit",{count:t+1,oid:e.slice(0,10)})})),onChange:t=>e.onCommit(I.oid,t)}):null]}):b?(0,i.jsxs)("div",{className:"space-y-2 text-xs text-muted-foreground",children:[(0,i.jsx)("p",{children:"merge-base"===t.strategy?l("mergeBaseToTarget"):l("baseToTarget")}),(0,i.jsx)("p",{className:"break-all font-mono",children:b.comparison.original??l("emptyRevision")}),(0,i.jsx)("p",{className:"break-all font-mono",children:b.comparison.target})]}):(0,i.jsx)("p",{className:"text-muted-foreground",children:l("selectCommit")}),j?(0,i.jsx)("p",{className:"mt-3 break-all font-mono text-xs text-muted-foreground",children:j}):null]})})]})]});return(0,i.jsxs)("section",{className:"flex size-full min-h-0 min-w-0 flex-col","aria-label":l("historyAndCompare"),children:[(0,i.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b px-3 py-2",children:[(0,i.jsxs)("div",{className:"flex gap-1",role:"group","aria-label":l("viewMode"),children:[(0,i.jsx)(g.$,{size:"sm",variant:"history"===t.mode?"secondary":"ghost","aria-pressed":"history"===t.mode,onClick:()=>{e.onMode("history"),v("log")},children:l("historyMode")}),(0,i.jsx)(g.$,{size:"sm",variant:"compare"===t.mode?"secondary":"ghost","aria-pressed":"compare"===t.mode,onClick:()=>{e.onMode("compare"),v("log")},children:l("compareMode")})]}),(0,i.jsx)(A.b,{className:"w-44",ariaLabel:l("selectRepository"),value:t.repositoryRoot??"",options:s.map(e=>({value:e.root,label:e.root||a,description:"unavailable"===e.state?(0,z.fD)(e.message,c):void 0})),onChange:e.onRepository}),"history"===t.mode?(0,i.jsx)(A.b,{className:"w-48",ariaLabel:l("viewBranch"),value:t.tip,options:k,onChange:t=>e.onRevision("tip",t)}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(A.b,{className:"w-44",ariaLabel:l("baseBranch"),placeholder:l("chooseBase"),value:t.base,options:k,onChange:t=>e.onRevision("base",t)}),(0,i.jsx)("span",{className:"text-xs text-muted-foreground",children:"→"}),(0,i.jsx)(A.b,{className:"w-44",ariaLabel:l("targetBranch"),value:t.target,options:k,onChange:t=>e.onRevision("target",t)}),(0,i.jsx)(A.b,{className:"w-48",ariaLabel:l("comparison"),value:t.strategy,options:[{value:"merge-base",label:l("introducedChanges")},{value:"direct",label:l("directComparison")}],onChange:t=>e.onStrategy("direct"===t?"direct":"merge-base")}),n?(0,i.jsx)(g.$,{size:"sm",variant:"outline",onClick:()=>v("files"),children:l("cumulativeChanges")}):null]}),(0,i.jsx)(P.p,{className:"w-40 shrink-0","aria-label":l("filterAuthor"),placeholder:l("author"),list:m,value:t.author,onChange:t=>e.onAuthor(t.target.value)}),(0,i.jsx)("datalist",{id:m,children:t.authorSuggestions.map(e=>(0,i.jsx)("option",{value:e},e))}),(0,i.jsx)(P.p,{className:"min-w-32 flex-1 basis-40","aria-label":l("searchCommits"),placeholder:l("searchCommits"),value:t.query,onChange:t=>e.onQuery(t.target.value)}),(0,i.jsx)(g.$,{size:"icon-sm",variant:"ghost","aria-label":l("refreshGit"),onClick:e.onRefresh,children:(0,i.jsx)(u.A,{className:"size-4"})})]}),t.branches.error?E(t.branches.error):null,N?(0,i.jsxs)("p",{className:"shrink-0 truncate border-b px-3 py-1 text-xs text-muted-foreground",title:N.ref,children:[N.ref.replace("refs/remotes/","")," \xb7 ",l("localRecord")," \xb7"," ",null===N.ahead||null===N.behind?l("refUnavailable"):l("aheadBehind",{ahead:N.ahead,behind:N.behind})]}):null,"compare"!==t.mode||t.base?n?"log"===x?O:q:(0,i.jsxs)(f.HK,{orientation:"horizontal",defaultLayout:{"project-log":e.panelSizes.log,"project-files":100-e.panelSizes.log},onLayoutChanged:(t,s)=>{s.isUserInteraction&&void 0!==t["project-log"]&&e.onPanelSize("log",t["project-log"])},children:[(0,i.jsx)(f.wV,{id:"project-log",defaultSize:`${e.panelSizes.log}%`,minSize:"30%",children:O}),(0,i.jsx)(f.WM,{}),(0,i.jsx)(f.wV,{id:"project-files",defaultSize:`${100-e.panelSizes.log}%`,minSize:"25%",children:q})]}):(0,i.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:l("chooseBaseBranch")})]})}let W=()=>{};function Y({clientId:e,cwd:t,refreshOnFocus:s,title:C,actions:S,onEscape:R=W,onUnauthorized:z}){let{t:D}=(0,r.Bd)("projectHistory"),M=(0,y.G)(),{files:P,git:A,history:T,global:$,updateGlobal:I,page:E,setPage:O,historyPane:q,setHistoryPane:L,setContainer:F,narrow:B,stacked:V,width:H,openGit:K,refresh:U}=function(e,t,s,i){let r=(0,y.G)(),[a]=(0,w.useState)(N.N1),[n,o]=(0,w.useState)(a),l=(0,w.useCallback)(e=>{o(t=>({...t,...e})),(0,N.Ms)({...(0,N.N1)(),...e})},[]),[c]=(0,w.useState)(()=>(0,N.tQ)(t)),[d]=(0,w.useState)(()=>(0,k.ph)(e,t,e=>r.show({level:"info",title:e}),c,a,{lazyHistory:!s,onUnauthorized:i})),{files:u,git:h,history:p}=d;(0,w.useSyncExternalStore)(u.subscribe,u.getRevision,u.getRevision);let m=(0,w.useSyncExternalStore)(h.subscribe,h.getRevision,h.getRevision);(0,w.useSyncExternalStore)(p.subscribe,p.getRevision,p.getRevision);let[f,g]=(0,w.useState)(c?.page??"files"),[x,v]=(0,w.useState)(c?.historyPane??"log"),[b,j]=(0,w.useState)({width:1200,height:800}),[C,S]=(0,w.useState)(null),R=(0,w.useRef)(!1),z=(0,w.useRef)(()=>void 0),D=b.width<900,M=D||b.height<680,P=h.getWorkspace(t).snapshot.repositories,A=u.state;(0,w.useEffect)(()=>{z.current=()=>{let e=h.getWorkspace(t),s=p.state,i={page:f,historyPane:x,tabs:[...u.state.tabs],activePath:u.state.activePath,...u.getBrowsingDocumentSettings(),expandedPaths:[...u.state.expandedPaths].slice(0,500),treeScrollTop:u.state.treeScrollTop,searchQuery:u.state.search.query.slice(0,200),changesOnly:e.changesOnly,expandedRepositories:[...e.expandedRepositories].slice(0,100),history:{repositoryRoot:s.repositoryRoot,mode:s.mode,tip:s.tip,base:s.base,target:s.target,strategy:s.strategy,query:s.query.slice(0,200),author:s.author.slice(0,200),selectedCommit:s.selectedCommit,selectedChangePath:s.selectedChangePath,logScroll:p.scroll.log,changesScroll:p.scroll.changes},activeDiff:u.state.activeDiff?{repositoryRoot:u.state.activeDiff.repositoryRoot,path:u.state.activeDiff.path,...u.state.activeDiff.comparison?{comparison:u.state.activeDiff.comparison}:{}}:null};(0,N.Sb)(t,i)}},[t,u,h,p,x,f]),(0,w.useEffect)(()=>{R.current=!0,d.restore(),u.ensureRoot(),h.ensureSnapshot(t);let e=()=>z.current();return window.addEventListener("pagehide",e),()=>{R.current=!1,window.removeEventListener("pagehide",e),queueMicrotask(()=>{R.current||(z.current(),d.dispose())})}},[t,u,h,d]),(0,w.useEffect)(()=>{if(!s)return;let e=Date.now(),i=()=>{Date.now()-e<5e3||(e=Date.now(),h.refreshSnapshot(t))};return window.addEventListener("focus",i),()=>window.removeEventListener("focus",i)},[t,h,s]),(0,w.useEffect)(()=>{if(!C)return;let e=()=>j({width:C.clientWidth,height:C.clientHeight});e();let t=new ResizeObserver(e);return t.observe(C),()=>t.disconnect()},[C]);let T=n.gitOpen&&(!M||"git"===f);return(0,w.useEffect)(()=>{if(!T||!P.length)return;if(P.some(e=>e.root===p.state.repositoryRoot))return void p.setRepository(p.state.repositoryRoot);let e=A.activeDiff?[A.activeDiff.repositoryRoot,A.activeDiff.path].filter(Boolean).join("/"):A.activePath,t=e?[...P].sort((e,t)=>t.root.length-e.root.length).find(t=>!t.root||e.startsWith(`${t.root}/`)):null;p.setRepository(t?.root??P.find(e=>""===e.root)?.root??P[0].root)},[T,m,p,P,A.activeDiff,A.activePath]),(0,w.useEffect)(()=>h.subscribe(()=>{let e=h.getWorkspace(t)?.layout;e&&e!==n.treeLayout&&l({treeLayout:e})}),[t,h,n.treeLayout,l]),{files:u,git:h,history:p,global:n,updateGlobal:l,page:f,setPage:g,historyPane:x,setHistoryPane:v,setContainer:S,narrow:D,stacked:M,width:b.width,openGit(e){l({gitOpen:!0}),g("git"),void 0!==e&&p.setRepository(e)},refresh(){u.refreshTree(),h.refreshSnapshot(t),A.activeDiff?u.reloadDiff():A.activePath&&u.reloadFile(A.activePath),T&&p.refresh()}}}(e,t,s,z),{directoryOpen:J,gitOpen:G,gitMaximized:X}=$,Q=t.replaceAll("\\","/").split("/").filter(Boolean).at(-1)??t,Z=A.getWorkspace(t),ee=Z.snapshot.repositories,et=P.state,es=et.activeDiff?[et.activeDiff.repositoryRoot,et.activeDiff.path].filter(Boolean).join("/"):null,ei=(0,i.jsx)(x.F,{cwd:t,projectName:Q,showRootTitle:!1,runtime:P,gitRuntime:A,onOpenGitBranches:K,onFileOpened:()=>O("code")}),er=(0,i.jsx)(b.R,{runtime:P,gitRuntime:A,compact:H<1100,refreshOnFocus:s,onEscape:R,renderHeader:e=>(0,i.jsx)(v.X,{cwd:t,gitRuntime:A,paths:et.tabs,activePath:et.activePath,diffPath:es,mobile:B,actions:e,onActivate:e=>P.openFile(e),onClose:(e,t)=>P.closeTabs(e,t)})}),ea=(0,i.jsxs)("div",{className:"flex size-full min-h-0 min-w-0 flex-col",children:[(0,i.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-2 border-b bg-muted px-3",children:[(0,i.jsx)(a.A,{className:"size-4"}),(0,i.jsx)("span",{className:"flex-1 text-sm font-medium",children:"Git"}),V?null:(0,i.jsx)(g.$,{size:"icon-sm",variant:"ghost","aria-label":D(X?"restoreGit":"maximizeGit"),onClick:()=>I({gitMaximized:!X}),children:X?(0,i.jsx)(n.A,{className:"size-4"}):(0,i.jsx)(o.A,{className:"size-4"})}),(0,i.jsx)(g.$,{size:"icon-sm",variant:"ghost","aria-label":D("collapseGit"),onClick:()=>{I({gitOpen:!1,gitMaximized:!1}),O("code")},children:(0,i.jsx)(l.A,{className:"size-4"})})]}),ee.length?(0,i.jsx)(_,{state:T.state,cwd:t,changeRows:T.getChangeRows(),onSelectChange:e=>T.selectChange(e),onToggleDirectory:e=>T.toggleChangeDirectory(e),onReveal:(e,t)=>P.revealFile(e,t),repositories:ee,projectName:Q,narrow:B,mobilePane:q,onMobilePane:L,scroll:T.scroll,onScroll:(e,t)=>T.setScroll(e,t),panelSizes:{log:$.logSize,changes:$.changeSize},onPanelSize:(e,t)=>I("log"===e?{logSize:t}:{changeSize:t}),onRepository:e=>{T.setRepository(e),L("log")},onMode:e=>T.setMode(e),onRevision:(e,t)=>T.setRevision(e,t),onStrategy:e=>T.setStrategy(e),onQuery:e=>T.setQuery(e),onAuthor:e=>T.setAuthor(e),onCommit:(e,t)=>T.selectCommit(e,t),onAggregate:()=>T.showAggregate(),onMoreLog:()=>T.loadMoreLog(),onMoreChanges:()=>T.loadMoreChanges(),onOpenFile:e=>{T.openChange(e),O("code"),I({gitMaximized:!1})},onRefresh:()=>T.refresh(),onCopy:e=>{(0,j.x)(e).then(e=>{e||M.error(D("copyFailed"))})}}):(0,i.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:"loading"===Z.snapshot.status||"idle"===Z.snapshot.status?D("findingGit"):Z.snapshot.error??D("noGit")})]}),en=(0,i.jsxs)(f.HK,{orientation:"horizontal",defaultLayout:J?{"project-tree":$.directorySize,"project-code":100-$.directorySize}:void 0,onLayoutChanged:(e,t)=>{t.isUserInteraction&&void 0!==e["project-tree"]&&I({directorySize:e["project-tree"]})},children:[J?(0,i.jsx)(f.wV,{id:"project-tree",defaultSize:`${$.directorySize}%`,minSize:"180px",maxSize:"40%",children:ei}):null,J?(0,i.jsx)(f.WM,{}):null,(0,i.jsx)(f.wV,{id:"project-code",minSize:"40%",children:er})]},J?"tree-visible":"tree-hidden");return(0,i.jsxs)("div",{ref:F,className:"flex size-full min-h-0 min-w-0 flex-col overflow-hidden","data-testid":"project-preview",children:[(0,i.jsxs)("header",{className:"flex min-h-9 shrink-0 items-center gap-1 bg-muted px-2 py-1 pt-[max(4px,env(safe-area-inset-top))]",children:[V?null:(0,i.jsx)(g.$,{size:"icon-sm",variant:"ghost","aria-label":D(J?"collapseDirectory":"expandDirectory"),onClick:()=>I({directoryOpen:!J}),children:J?(0,i.jsx)(c.A,{className:"size-4"}):(0,i.jsx)(d.A,{className:"size-4"})}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 items-baseline gap-3",title:t,children:[(0,i.jsx)("div",{className:"min-w-0 shrink-0 max-w-[50%] max-sm:max-w-full max-sm:shrink",children:C??(0,i.jsx)("h1",{className:"truncate text-sm font-semibold",children:Q})}),(0,i.jsx)("p",{className:"min-w-0 truncate text-xs text-muted-foreground max-sm:hidden",children:t})]}),(0,i.jsxs)(g.$,{size:"sm",variant:G?"secondary":"ghost","aria-pressed":G,onClick:()=>K(),children:[(0,i.jsx)(a.A,{className:"size-4"}),(0,i.jsx)("span",{className:"max-sm:hidden",children:D("gitRecords")})]}),(0,i.jsx)(g.$,{size:"icon-sm",variant:"ghost","aria-label":D("refreshPreview"),onClick:U,children:(0,i.jsx)(u.A,{className:"size-4"})}),S]}),Z.snapshot.error?(0,i.jsx)("p",{role:"alert",className:"shrink-0 border-b px-3 py-2 text-sm text-destructive",children:Z.snapshot.error}):null,V?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"flex shrink-0 gap-1 px-2 py-1",role:"group","aria-label":D("previewArea"),children:[(0,i.jsxs)(g.$,{size:"sm",variant:"files"===E?"secondary":"ghost",onClick:()=>O("files"),children:[(0,i.jsx)(h.A,{className:"size-4"}),D("files")]}),(0,i.jsxs)(g.$,{size:"sm",variant:"code"===E?"secondary":"ghost",onClick:()=>O("code"),children:[(0,i.jsx)(p.A,{className:"size-4"}),D("code")]}),(0,i.jsxs)(g.$,{size:"sm",variant:"git"===E?"secondary":"ghost",onClick:()=>K(),children:[(0,i.jsx)(m.A,{className:"size-4"}),"Git"]})]}),(0,i.jsx)("div",{className:"min-h-0 flex-1",children:"files"===E?ei:"git"===E?ea:er})]}):X&&G?ea:(0,i.jsxs)(f.HK,{orientation:"vertical",defaultLayout:G?{"project-main":100-$.gitSize,"project-git":$.gitSize}:void 0,onLayoutChanged:(e,t)=>{t.isUserInteraction&&void 0!==e["project-git"]&&I({gitSize:e["project-git"]})},children:[(0,i.jsx)(f.wV,{id:"project-main",defaultSize:G?`${100-$.gitSize}%`:"100%",minSize:"35%",children:en}),G?(0,i.jsx)(f.WM,{}):null,G?(0,i.jsx)(f.wV,{id:"project-git",defaultSize:`${$.gitSize}%`,minSize:"300px",children:ea}):null]},G?"git-visible":"git-hidden")]})}},94853:(e,t,s)=>{"use strict";s.d(t,{OC:()=>y,Ot:()=>u,Xe:()=>h,ZI:()=>m,_X:()=>g,fg:()=>p,p0:()=>f,p3:()=>v,ry:()=>x,ys:()=>b});var i=s(38979),r=s(67765),a=s(24985),n=s(86062);let o=i.Ik({cwd:i.Yj().trim().min(1).max(4096),workId:i.Yj().trim().min(1).optional()}).strict(),l=o.extend({repositoryRoot:r.rh}),c=o.extend({path:r.eC,imagePreviewMode:r.p$}).superRefine((e,t)=>{e.workId||r._g.safeParse(e.path).success||t.addIssue({code:"custom",path:["path"],message:"独立项目预览只接受根内相对路径"})}),d=i.k5(["file","directory"]),u={path:"/api/project-files/reveal",request:o.extend({path:i.KC([r.rh,r.eC]),targetType:d.optional()}).refine(e=>""!==e.path||"directory"===e.targetType,"文件路径不能为空").refine(e=>e.workId&&"directory"!==e.targetType||r.rh.safeParse(e.path).success,"独立项目和目录定位只接受根内相对路径"),response:i.Ik({}).strict()},h={path:"/api/project-files/list",request:o.extend({path:r.rh}).strict(),response:r.JH},p={path:"/api/project-files/search",request:o.extend(r.Nu.shape).strict(),response:r.jI},m={path:"/api/project-files/get",request:c,response:r.ih},f={path:"/api/project-git/get",request:o.extend({refresh:i.zM().optional()}).strict(),response:i.Ik({repositories:i.YO(a.u2).max(100)}).strict()},g={path:"/api/project-git-heads/get",request:o,response:i.Ik({repositories:i.YO(a.yl).max(a.y2)}).strict()},x={path:"/api/project-git-branches/list",request:l.strict(),response:n.WW},v={path:"/api/project-git-log/list",request:l.extend(n.co.shape).strict(),response:n.yw},b={path:"/api/project-git-changes/list",request:l.extend(n.ph.shape).strict(),response:n.T8},y={path:"/api/project-git-diff/get",request:l.extend({path:r._g,comparison:n.xv.optional()}).strict(),response:n.lw}},97921:(e,t,s)=>{"use strict";function i(e){return/\.(md|markdown)$/i.test(e)?"markdown":/\.html?$/i.test(e)?"html":null}s.d(t,{g:()=>i})},99084:(e,t,s)=>{"use strict";s.d(t,{x:()=>r});var i=s(79137);function r(e){return(0,i.h3)(e)}}}]);