@jingyi0605/codingns 0.8.5 → 0.9.5

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 (515) hide show
  1. package/bin/codingns.mjs +7 -156
  2. package/dist/public/assets/AdaptiveButlerPage-kkJDsnCO.js +2 -0
  3. package/dist/public/assets/{App-BOHBGFOd.js → App-DrNI9lWA.js} +6 -6
  4. package/dist/public/assets/{BootstrapPage-BxHQT4nA.js → BootstrapPage-QgVH5Mps.js} +1 -1
  5. package/dist/public/assets/{ConversationPage-DWFsF6BB.js → ConversationPage-DVk8VfIj.js} +6 -6
  6. package/dist/public/assets/{DesktopDetachPreviewPage-DOgEjYEf.js → DesktopDetachPreviewPage-BhfP0TpH.js} +1 -1
  7. package/dist/public/assets/DesktopModal-DRmDrv0S.js +1 -0
  8. package/dist/public/assets/DesktopWindowPage-DNbJXnSs.js +2 -0
  9. package/dist/public/assets/FileContextPanel---fLO4ve.js +1 -0
  10. package/dist/public/assets/GitSidebar-sXUE0TqT.js +6 -0
  11. package/dist/public/assets/MobileCreateSessionSheet-BftZ5pvb.js +1 -0
  12. package/dist/public/assets/MobileSheet-nw5SCa3N.js +1 -0
  13. package/dist/public/assets/{MobileTopHeaderFrame-lcp2GscV.js → MobileTopHeaderFrame-DH_D02Wy.js} +1 -1
  14. package/dist/public/assets/MobileWorkspaceSwitcherHeader-2K406G5p.js +1 -0
  15. package/dist/public/assets/{PluginAccessOverview-DGcKAMQl.js → PluginAccessOverview-BVJihw3D.js} +1 -1
  16. package/dist/public/assets/PluginContainerPage-CR4vStvr.js +1 -0
  17. package/dist/public/assets/{PluginDetailPage-CAJ7LFpD.js → PluginDetailPage-CrMX0Mnm.js} +1 -1
  18. package/dist/public/assets/{PluginsListPage-BxZG1NyT.js → PluginsListPage-FtIL71Yg.js} +1 -1
  19. package/dist/public/assets/{RelayConnectEntryPage-CfNO_TIl.js → RelayConnectEntryPage-Bt1apX53.js} +1 -1
  20. package/dist/public/assets/{ServerSettingsModal-by36Z_5k.js → ServerSettingsModal-D-guzPrI.js} +1 -1
  21. package/dist/public/assets/SessionIndexPage-CX2FppcJ.js +1 -0
  22. package/dist/public/assets/SettingsPage-BI2Olcvr.js +2 -0
  23. package/dist/public/assets/TerminalManagerPanel-B5MKGPy-.js +1 -0
  24. package/dist/public/assets/{TerminalPage-C4LNoPBp.js → TerminalPage-C2dTNGHK.js} +2 -2
  25. package/dist/public/assets/TerminalRuntimeFallbackModal-DAqOxFD8.js +1 -0
  26. package/dist/public/assets/{ToolFilesPage-47zbdgTW.js → ToolFilesPage-IsNwyE6T.js} +1 -1
  27. package/dist/public/assets/{ToolGitPage-Fuk_b_jg.js → ToolGitPage-BK1JBERN.js} +1 -1
  28. package/dist/public/assets/{ToolProcessesPage-sWSMWD-9.js → ToolProcessesPage-DwTYUQCK.js} +1 -1
  29. package/dist/public/assets/{ToolsHomePage-R1mZlbZi.js → ToolsHomePage-BLOy7lPg.js} +1 -1
  30. package/dist/public/assets/{WorkbenchLandingPage-CqmiFH2u.js → WorkbenchLandingPage-CqZKR6EA.js} +1 -1
  31. package/dist/public/assets/WorkbenchLayout-BksVkkFF.css +1 -0
  32. package/dist/public/assets/WorkbenchLayout-CJHQtwuL.js +1022 -0
  33. package/dist/public/assets/{WorkbenchModal-C7qoQElW.js → WorkbenchModal-BM-OeW-b.js} +1 -1
  34. package/dist/public/assets/WorkbenchShellRoute-2bKI6Q9k.js +1 -0
  35. package/dist/public/assets/WorkbenchShellRoute-BjuZD101.css +1 -0
  36. package/dist/public/assets/WorkspaceDebugDetailPage-BMsEN5iG.js +1 -0
  37. package/dist/public/assets/WorkspaceDetailPage-5H9Gosx2.js +1 -0
  38. package/dist/public/assets/WorkspaceHomePage-DQiXKgiP.js +1 -0
  39. package/dist/public/assets/{client-runtime-manager-wmCJZKYd.js → client-runtime-manager-CgPJq21V.js} +1 -1
  40. package/dist/public/assets/index-BARqMVSw.css +1 -0
  41. package/dist/public/assets/index-BUoNjVrY.js +50 -0
  42. package/dist/public/assets/{login-direct-candidate-resolver-BOAgTuUf.js → login-direct-candidate-resolver-CGaxAXV8.js} +1 -1
  43. package/dist/public/assets/{plugin-permission-copy-Cq99cnzV.js → plugin-permission-copy-BR9gWy8b.js} +1 -1
  44. package/dist/public/assets/{plugins-api-BQTV5DOp.js → plugins-api-CdCsrG2e.js} +1 -1
  45. package/dist/public/assets/{preferences-service-DJxbEEeg.js → preferences-service-lOhnlxzP.js} +1 -1
  46. package/dist/public/assets/{relay-entry-D-LfvdiX.js → relay-entry-CQpxTS8y.js} +1 -1
  47. package/dist/public/assets/{terminal-runtime-meta-BJmy8dyK.js → terminal-runtime-meta-oteTx66X.js} +1 -1
  48. package/dist/public/assets/useRegisteredDebugTemplates-Bu2ykZ6s.js +1 -0
  49. package/dist/public/assets/workbench-navigation-DlgXuFW2.js +1 -0
  50. package/dist/public/index.html +2 -2
  51. package/dist/server/config/env.d.ts +1 -0
  52. package/dist/server/config/env.js +3 -0
  53. package/dist/server/config/env.js.map +1 -1
  54. package/dist/server/middlewares/auth-guard.js +10 -5
  55. package/dist/server/middlewares/auth-guard.js.map +1 -1
  56. package/dist/server/modules/affairs-indexer/contracts/src/errors/app-error.d.ts +11 -0
  57. package/dist/server/modules/affairs-indexer/contracts/src/errors/app-error.js +22 -0
  58. package/dist/server/modules/affairs-indexer/contracts/src/errors/app-error.js.map +1 -0
  59. package/dist/server/modules/affairs-indexer/contracts/src/errors/error-codes.d.ts +23 -0
  60. package/dist/server/modules/affairs-indexer/contracts/src/errors/error-codes.js +23 -0
  61. package/dist/server/modules/affairs-indexer/contracts/src/errors/error-codes.js.map +1 -0
  62. package/dist/server/modules/affairs-indexer/contracts/src/index.d.ts +4 -0
  63. package/dist/server/modules/affairs-indexer/contracts/src/index.js +5 -0
  64. package/dist/server/modules/affairs-indexer/contracts/src/index.js.map +1 -0
  65. package/dist/server/modules/affairs-indexer/contracts/src/types/cli-command-context.d.ts +7 -0
  66. package/dist/server/modules/affairs-indexer/contracts/src/types/cli-command-context.js +2 -0
  67. package/dist/server/modules/affairs-indexer/contracts/src/types/cli-command-context.js.map +1 -0
  68. package/dist/server/modules/affairs-indexer/contracts/src/types/runtime-config.d.ts +16 -0
  69. package/dist/server/modules/affairs-indexer/contracts/src/types/runtime-config.js +2 -0
  70. package/dist/server/modules/affairs-indexer/contracts/src/types/runtime-config.js.map +1 -0
  71. package/dist/server/modules/affairs-indexer/core/src/config/load-runtime-config.d.ts +10 -0
  72. package/dist/server/modules/affairs-indexer/core/src/config/load-runtime-config.js +215 -0
  73. package/dist/server/modules/affairs-indexer/core/src/config/load-runtime-config.js.map +1 -0
  74. package/dist/server/modules/affairs-indexer/core/src/index.d.ts +31 -0
  75. package/dist/server/modules/affairs-indexer/core/src/index.js +32 -0
  76. package/dist/server/modules/affairs-indexer/core/src/index.js.map +1 -0
  77. package/dist/server/modules/affairs-indexer/core/src/logging/structured-logger.d.ts +20 -0
  78. package/dist/server/modules/affairs-indexer/core/src/logging/structured-logger.js +47 -0
  79. package/dist/server/modules/affairs-indexer/core/src/logging/structured-logger.js.map +1 -0
  80. package/dist/server/modules/affairs-indexer/core/src/parser/base-complex-parser-adapter.d.ts +17 -0
  81. package/dist/server/modules/affairs-indexer/core/src/parser/base-complex-parser-adapter.js +63 -0
  82. package/dist/server/modules/affairs-indexer/core/src/parser/base-complex-parser-adapter.js.map +1 -0
  83. package/dist/server/modules/affairs-indexer/core/src/parser/complex-document-skip-adapter.d.ts +12 -0
  84. package/dist/server/modules/affairs-indexer/core/src/parser/complex-document-skip-adapter.js +42 -0
  85. package/dist/server/modules/affairs-indexer/core/src/parser/complex-document-skip-adapter.js.map +1 -0
  86. package/dist/server/modules/affairs-indexer/core/src/parser/csv-parser-adapter.d.ts +7 -0
  87. package/dist/server/modules/affairs-indexer/core/src/parser/csv-parser-adapter.js +107 -0
  88. package/dist/server/modules/affairs-indexer/core/src/parser/csv-parser-adapter.js.map +1 -0
  89. package/dist/server/modules/affairs-indexer/core/src/parser/document-parser.d.ts +19 -0
  90. package/dist/server/modules/affairs-indexer/core/src/parser/document-parser.js +37 -0
  91. package/dist/server/modules/affairs-indexer/core/src/parser/document-parser.js.map +1 -0
  92. package/dist/server/modules/affairs-indexer/core/src/parser/docx-parser-adapter.d.ts +7 -0
  93. package/dist/server/modules/affairs-indexer/core/src/parser/docx-parser-adapter.js +123 -0
  94. package/dist/server/modules/affairs-indexer/core/src/parser/docx-parser-adapter.js.map +1 -0
  95. package/dist/server/modules/affairs-indexer/core/src/parser/openxml-utils.d.ts +8 -0
  96. package/dist/server/modules/affairs-indexer/core/src/parser/openxml-utils.js +111 -0
  97. package/dist/server/modules/affairs-indexer/core/src/parser/openxml-utils.js.map +1 -0
  98. package/dist/server/modules/affairs-indexer/core/src/parser/parser-adapter.d.ts +42 -0
  99. package/dist/server/modules/affairs-indexer/core/src/parser/parser-adapter.js +2 -0
  100. package/dist/server/modules/affairs-indexer/core/src/parser/parser-adapter.js.map +1 -0
  101. package/dist/server/modules/affairs-indexer/core/src/parser/parser-capability-registry.d.ts +18 -0
  102. package/dist/server/modules/affairs-indexer/core/src/parser/parser-capability-registry.js +91 -0
  103. package/dist/server/modules/affairs-indexer/core/src/parser/parser-capability-registry.js.map +1 -0
  104. package/dist/server/modules/affairs-indexer/core/src/parser/parser-router.d.ts +18 -0
  105. package/dist/server/modules/affairs-indexer/core/src/parser/parser-router.js +59 -0
  106. package/dist/server/modules/affairs-indexer/core/src/parser/parser-router.js.map +1 -0
  107. package/dist/server/modules/affairs-indexer/core/src/parser/parser-skip-repository.d.ts +48 -0
  108. package/dist/server/modules/affairs-indexer/core/src/parser/parser-skip-repository.js +193 -0
  109. package/dist/server/modules/affairs-indexer/core/src/parser/parser-skip-repository.js.map +1 -0
  110. package/dist/server/modules/affairs-indexer/core/src/parser/pdf-parser-adapter.d.ts +7 -0
  111. package/dist/server/modules/affairs-indexer/core/src/parser/pdf-parser-adapter.js +371 -0
  112. package/dist/server/modules/affairs-indexer/core/src/parser/pdf-parser-adapter.js.map +1 -0
  113. package/dist/server/modules/affairs-indexer/core/src/parser/plain-text-parser-adapter.d.ts +10 -0
  114. package/dist/server/modules/affairs-indexer/core/src/parser/plain-text-parser-adapter.js +55 -0
  115. package/dist/server/modules/affairs-indexer/core/src/parser/plain-text-parser-adapter.js.map +1 -0
  116. package/dist/server/modules/affairs-indexer/core/src/parser/plain-text-parser.d.ts +9 -0
  117. package/dist/server/modules/affairs-indexer/core/src/parser/plain-text-parser.js +2 -0
  118. package/dist/server/modules/affairs-indexer/core/src/parser/plain-text-parser.js.map +1 -0
  119. package/dist/server/modules/affairs-indexer/core/src/parser/pptx-parser-adapter.d.ts +7 -0
  120. package/dist/server/modules/affairs-indexer/core/src/parser/pptx-parser-adapter.js +130 -0
  121. package/dist/server/modules/affairs-indexer/core/src/parser/pptx-parser-adapter.js.map +1 -0
  122. package/dist/server/modules/affairs-indexer/core/src/parser/xlsx-parser-adapter.d.ts +7 -0
  123. package/dist/server/modules/affairs-indexer/core/src/parser/xlsx-parser-adapter.js +228 -0
  124. package/dist/server/modules/affairs-indexer/core/src/parser/xlsx-parser-adapter.js.map +1 -0
  125. package/dist/server/modules/affairs-indexer/core/src/repositories/catalog-repository.d.ts +205 -0
  126. package/dist/server/modules/affairs-indexer/core/src/repositories/catalog-repository.js +1471 -0
  127. package/dist/server/modules/affairs-indexer/core/src/repositories/catalog-repository.js.map +1 -0
  128. package/dist/server/modules/affairs-indexer/core/src/repositories/catalog-write-repository.d.ts +161 -0
  129. package/dist/server/modules/affairs-indexer/core/src/repositories/catalog-write-repository.js +1350 -0
  130. package/dist/server/modules/affairs-indexer/core/src/repositories/catalog-write-repository.js.map +1 -0
  131. package/dist/server/modules/affairs-indexer/core/src/scanner/file-scanner.d.ts +32 -0
  132. package/dist/server/modules/affairs-indexer/core/src/scanner/file-scanner.js +208 -0
  133. package/dist/server/modules/affairs-indexer/core/src/scanner/file-scanner.js.map +1 -0
  134. package/dist/server/modules/affairs-indexer/core/src/services/dirty/dirty-scope-resolver.d.ts +30 -0
  135. package/dist/server/modules/affairs-indexer/core/src/services/dirty/dirty-scope-resolver.js +66 -0
  136. package/dist/server/modules/affairs-indexer/core/src/services/dirty/dirty-scope-resolver.js.map +1 -0
  137. package/dist/server/modules/affairs-indexer/core/src/services/export/export-builder.d.ts +33 -0
  138. package/dist/server/modules/affairs-indexer/core/src/services/export/export-builder.js +705 -0
  139. package/dist/server/modules/affairs-indexer/core/src/services/export/export-builder.js.map +1 -0
  140. package/dist/server/modules/affairs-indexer/core/src/services/indexer/allowed-extensions-diff-service.d.ts +80 -0
  141. package/dist/server/modules/affairs-indexer/core/src/services/indexer/allowed-extensions-diff-service.js +193 -0
  142. package/dist/server/modules/affairs-indexer/core/src/services/indexer/allowed-extensions-diff-service.js.map +1 -0
  143. package/dist/server/modules/affairs-indexer/core/src/services/indexer/text-indexer.d.ts +77 -0
  144. package/dist/server/modules/affairs-indexer/core/src/services/indexer/text-indexer.js +467 -0
  145. package/dist/server/modules/affairs-indexer/core/src/services/indexer/text-indexer.js.map +1 -0
  146. package/dist/server/modules/affairs-indexer/core/src/services/mcp/mcp-stdio-server.d.ts +17 -0
  147. package/dist/server/modules/affairs-indexer/core/src/services/mcp/mcp-stdio-server.js +264 -0
  148. package/dist/server/modules/affairs-indexer/core/src/services/mcp/mcp-stdio-server.js.map +1 -0
  149. package/dist/server/modules/affairs-indexer/core/src/services/search/offline-search-service.d.ts +11 -0
  150. package/dist/server/modules/affairs-indexer/core/src/services/search/offline-search-service.js +76 -0
  151. package/dist/server/modules/affairs-indexer/core/src/services/search/offline-search-service.js.map +1 -0
  152. package/dist/server/modules/affairs-indexer/core/src/services/search/search-index-builder.d.ts +26 -0
  153. package/dist/server/modules/affairs-indexer/core/src/services/search/search-index-builder.js +305 -0
  154. package/dist/server/modules/affairs-indexer/core/src/services/search/search-index-builder.js.map +1 -0
  155. package/dist/server/modules/affairs-indexer/core/src/services/tagging/tag-recompute-service.d.ts +53 -0
  156. package/dist/server/modules/affairs-indexer/core/src/services/tagging/tag-recompute-service.js +566 -0
  157. package/dist/server/modules/affairs-indexer/core/src/services/tagging/tag-recompute-service.js.map +1 -0
  158. package/dist/server/modules/affairs-indexer/core/src/services/watch/watch-service.d.ts +47 -0
  159. package/dist/server/modules/affairs-indexer/core/src/services/watch/watch-service.js +227 -0
  160. package/dist/server/modules/affairs-indexer/core/src/services/watch/watch-service.js.map +1 -0
  161. package/dist/server/modules/affairs-indexer/core/src/sqlite/catalog-schema.d.ts +5 -0
  162. package/dist/server/modules/affairs-indexer/core/src/sqlite/catalog-schema.js +245 -0
  163. package/dist/server/modules/affairs-indexer/core/src/sqlite/catalog-schema.js.map +1 -0
  164. package/dist/server/modules/affairs-indexer/core/src/sqlite/detect-catalog-schema.d.ts +14 -0
  165. package/dist/server/modules/affairs-indexer/core/src/sqlite/detect-catalog-schema.js +87 -0
  166. package/dist/server/modules/affairs-indexer/core/src/sqlite/detect-catalog-schema.js.map +1 -0
  167. package/dist/server/modules/affairs-indexer/core/src/sqlite/init-catalog.d.ts +13 -0
  168. package/dist/server/modules/affairs-indexer/core/src/sqlite/init-catalog.js +16 -0
  169. package/dist/server/modules/affairs-indexer/core/src/sqlite/init-catalog.js.map +1 -0
  170. package/dist/server/modules/affairs-indexer/core/src/sqlite/migration-runner.d.ts +22 -0
  171. package/dist/server/modules/affairs-indexer/core/src/sqlite/migration-runner.js +430 -0
  172. package/dist/server/modules/affairs-indexer/core/src/sqlite/migration-runner.js.map +1 -0
  173. package/dist/server/modules/affairs-indexer/core/src/sqlite/open-database.d.ts +26 -0
  174. package/dist/server/modules/affairs-indexer/core/src/sqlite/open-database.js +19 -0
  175. package/dist/server/modules/affairs-indexer/core/src/sqlite/open-database.js.map +1 -0
  176. package/dist/server/modules/affairs-indexer/core/src/tagging/simple-tag-inference.d.ts +21 -0
  177. package/dist/server/modules/affairs-indexer/core/src/tagging/simple-tag-inference.js +94 -0
  178. package/dist/server/modules/affairs-indexer/core/src/tagging/simple-tag-inference.js.map +1 -0
  179. package/dist/server/modules/affairs-indexer/core/src/utils/abort.d.ts +2 -0
  180. package/dist/server/modules/affairs-indexer/core/src/utils/abort.js +13 -0
  181. package/dist/server/modules/affairs-indexer/core/src/utils/abort.js.map +1 -0
  182. package/dist/server/modules/affairs-indexer/core/src/utils/file-streaming.d.ts +9 -0
  183. package/dist/server/modules/affairs-indexer/core/src/utils/file-streaming.js +64 -0
  184. package/dist/server/modules/affairs-indexer/core/src/utils/file-streaming.js.map +1 -0
  185. package/dist/server/modules/affairs-indexer/core/src/utils/root-command-lock.d.ts +10 -0
  186. package/dist/server/modules/affairs-indexer/core/src/utils/root-command-lock.js +230 -0
  187. package/dist/server/modules/affairs-indexer/core/src/utils/root-command-lock.js.map +1 -0
  188. package/dist/server/modules/affairs-indexer/core/src/utils/rss-log.d.ts +2 -0
  189. package/dist/server/modules/affairs-indexer/core/src/utils/rss-log.js +19 -0
  190. package/dist/server/modules/affairs-indexer/core/src/utils/rss-log.js.map +1 -0
  191. package/dist/server/modules/affairs-indexer/internal-command-runner.d.ts +31 -0
  192. package/dist/server/modules/affairs-indexer/internal-command-runner.js +643 -0
  193. package/dist/server/modules/affairs-indexer/internal-command-runner.js.map +1 -0
  194. package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +0 -49
  195. package/dist/server/modules/assistant-capability/assistant-capability-controller.js +10 -56
  196. package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
  197. package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +2 -46
  198. package/dist/server/modules/assistant-capability/assistant-capability-service.js +15 -158
  199. package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
  200. package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.d.ts +4 -2
  201. package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.js +62 -21
  202. package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.js.map +1 -1
  203. package/dist/server/modules/butler/butler-control-session-service.d.ts +3 -4
  204. package/dist/server/modules/butler/butler-control-session-service.js +39 -62
  205. package/dist/server/modules/butler/butler-control-session-service.js.map +1 -1
  206. package/dist/server/modules/butler/butler-controller.d.ts +11 -3
  207. package/dist/server/modules/butler/butler-controller.js +19 -4
  208. package/dist/server/modules/butler/butler-controller.js.map +1 -1
  209. package/dist/server/modules/butler/butler-follow-up-service.d.ts +3 -0
  210. package/dist/server/modules/butler/butler-follow-up-service.js +11 -1
  211. package/dist/server/modules/butler/butler-follow-up-service.js.map +1 -1
  212. package/dist/server/modules/butler/butler-inbox-service.d.ts +3 -0
  213. package/dist/server/modules/butler/butler-inbox-service.js +14 -2
  214. package/dist/server/modules/butler/butler-inbox-service.js.map +1 -1
  215. package/dist/server/modules/butler/butler-profile-service.d.ts +1 -1
  216. package/dist/server/modules/butler/butler-profile-service.js +34 -63
  217. package/dist/server/modules/butler/butler-profile-service.js.map +1 -1
  218. package/dist/server/modules/butler/butler-project-service.d.ts +1 -3
  219. package/dist/server/modules/butler/butler-project-service.js +1 -7
  220. package/dist/server/modules/butler/butler-project-service.js.map +1 -1
  221. package/dist/server/modules/butler/butler-session-service.d.ts +4 -0
  222. package/dist/server/modules/butler/butler-session-service.js +127 -0
  223. package/dist/server/modules/butler/butler-session-service.js.map +1 -1
  224. package/dist/server/modules/butler/butler-session-summary-service.js +0 -2
  225. package/dist/server/modules/butler/butler-session-summary-service.js.map +1 -1
  226. package/dist/server/modules/butler/butler-workspace-context.d.ts +5 -1
  227. package/dist/server/modules/butler/butler-workspace-context.js +21 -12
  228. package/dist/server/modules/butler/butler-workspace-context.js.map +1 -1
  229. package/dist/server/modules/file/file-content-service.d.ts +11 -0
  230. package/dist/server/modules/file/file-content-service.js +55 -0
  231. package/dist/server/modules/file/file-content-service.js.map +1 -1
  232. package/dist/server/modules/file/file-controller.d.ts +36 -2
  233. package/dist/server/modules/file/file-controller.js +461 -19
  234. package/dist/server/modules/file/file-controller.js.map +1 -1
  235. package/dist/server/modules/file/file-preview-link-service.d.ts +1 -0
  236. package/dist/server/modules/file/file-preview-link-service.js +25 -0
  237. package/dist/server/modules/file/file-preview-link-service.js.map +1 -1
  238. package/dist/server/modules/file/file-preview-service.js +15 -4
  239. package/dist/server/modules/file/file-preview-service.js.map +1 -1
  240. package/dist/server/modules/file/file-preview-types.d.ts +9 -1
  241. package/dist/server/modules/file/file-preview-types.js +8 -1
  242. package/dist/server/modules/file/file-preview-types.js.map +1 -1
  243. package/dist/server/modules/file/file-search-service.js +200 -12
  244. package/dist/server/modules/file/file-search-service.js.map +1 -1
  245. package/dist/server/modules/file/recent-modified-file-service.d.ts +15 -0
  246. package/dist/server/modules/file/recent-modified-file-service.js +102 -0
  247. package/dist/server/modules/file/recent-modified-file-service.js.map +1 -0
  248. package/dist/server/modules/file/runtime/codingns-workspace-bridge.js +24 -5
  249. package/dist/server/modules/file/workspace-file-bridge-service.d.ts +20 -0
  250. package/dist/server/modules/file/workspace-file-bridge-service.js +22 -0
  251. package/dist/server/modules/file/workspace-file-bridge-service.js.map +1 -1
  252. package/dist/server/modules/file/workspace-file-bridge-watch-service.d.ts +9 -0
  253. package/dist/server/modules/file/workspace-file-bridge-watch-service.js +28 -0
  254. package/dist/server/modules/file/workspace-file-bridge-watch-service.js.map +1 -1
  255. package/dist/server/modules/file/workspace-index-apply-service.d.ts +25 -0
  256. package/dist/server/modules/file/workspace-index-apply-service.js +42 -0
  257. package/dist/server/modules/file/workspace-index-apply-service.js.map +1 -0
  258. package/dist/server/modules/office/office-controller.d.ts +15 -1
  259. package/dist/server/modules/office/office-controller.js +26 -1
  260. package/dist/server/modules/office/office-controller.js.map +1 -1
  261. package/dist/server/modules/office/onlyoffice-integration-service.d.ts +78 -0
  262. package/dist/server/modules/office/onlyoffice-integration-service.js +610 -0
  263. package/dist/server/modules/office/onlyoffice-integration-service.js.map +1 -0
  264. package/dist/server/modules/plugins/plugin-file-gateway-service.d.ts +12 -0
  265. package/dist/server/modules/plugins/plugin-file-gateway-service.js +13 -0
  266. package/dist/server/modules/plugins/plugin-file-gateway-service.js.map +1 -1
  267. package/dist/server/modules/preferences/profile-service.d.ts +1 -0
  268. package/dist/server/modules/preferences/profile-service.js +27 -3
  269. package/dist/server/modules/preferences/profile-service.js.map +1 -1
  270. package/dist/server/modules/sessions/codex-app-server-helper-process.js +0 -8
  271. package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
  272. package/dist/server/modules/sessions/session-controller.d.ts +1 -0
  273. package/dist/server/modules/sessions/session-controller.js +3 -0
  274. package/dist/server/modules/sessions/session-controller.js.map +1 -1
  275. package/dist/server/modules/sessions/session-history-service.d.ts +2 -0
  276. package/dist/server/modules/sessions/session-history-service.js +78 -3
  277. package/dist/server/modules/sessions/session-history-service.js.map +1 -1
  278. package/dist/server/modules/sessions/session-live-runtime-service.d.ts +1 -0
  279. package/dist/server/modules/sessions/session-live-runtime-service.js +4 -0
  280. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  281. package/dist/server/modules/sessions/session-permission-request-service.js +0 -4
  282. package/dist/server/modules/sessions/session-permission-request-service.js.map +1 -1
  283. package/dist/server/modules/sessions/workspace-session-instruction-watch-service.d.ts +23 -0
  284. package/dist/server/modules/sessions/workspace-session-instruction-watch-service.js +122 -0
  285. package/dist/server/modules/sessions/workspace-session-instruction-watch-service.js.map +1 -0
  286. package/dist/server/modules/sessions/workspace-session-runtime-context-service.d.ts +15 -0
  287. package/dist/server/modules/sessions/workspace-session-runtime-context-service.js +93 -10
  288. package/dist/server/modules/sessions/workspace-session-runtime-context-service.js.map +1 -1
  289. package/dist/server/modules/skills/builtin-skills/codingns-assistant/SKILL.md +6 -7
  290. package/dist/server/modules/skills/builtin-skills/codingns-assistant/references/cli-workflow.md +2 -3
  291. package/dist/server/modules/system/host-resource-controller.d.ts +7 -0
  292. package/dist/server/modules/system/host-resource-controller.js +12 -0
  293. package/dist/server/modules/system/host-resource-controller.js.map +1 -0
  294. package/dist/server/modules/system/host-resource-service.d.ts +54 -0
  295. package/dist/server/modules/system/host-resource-service.js +162 -0
  296. package/dist/server/modules/system/host-resource-service.js.map +1 -0
  297. package/dist/server/modules/tasks/observability-service.d.ts +12 -2
  298. package/dist/server/modules/tasks/observability-service.js +13 -1
  299. package/dist/server/modules/tasks/observability-service.js.map +1 -1
  300. package/dist/server/modules/tasks/task-helper-client.d.ts +36 -2
  301. package/dist/server/modules/tasks/task-helper-client.js +201 -19
  302. package/dist/server/modules/tasks/task-helper-client.js.map +1 -1
  303. package/dist/server/modules/tasks/task-helper-pool.d.ts +37 -0
  304. package/dist/server/modules/tasks/task-helper-pool.js +173 -0
  305. package/dist/server/modules/tasks/task-helper-pool.js.map +1 -0
  306. package/dist/server/modules/tasks/task-helper-process-handlers.d.ts +27 -0
  307. package/dist/server/modules/tasks/task-helper-process-handlers.js +25 -1
  308. package/dist/server/modules/tasks/task-helper-process-handlers.js.map +1 -1
  309. package/dist/server/modules/tasks/task-helper-process.js +75 -26
  310. package/dist/server/modules/tasks/task-helper-process.js.map +1 -1
  311. package/dist/server/modules/tasks/task-helper-scheduling.d.ts +11 -0
  312. package/dist/server/modules/tasks/task-helper-scheduling.js +43 -0
  313. package/dist/server/modules/tasks/task-helper-scheduling.js.map +1 -0
  314. package/dist/server/modules/tasks/task-lane-executors.js +19 -3
  315. package/dist/server/modules/tasks/task-lane-executors.js.map +1 -1
  316. package/dist/server/modules/tasks/task-manager.d.ts +1 -0
  317. package/dist/server/modules/tasks/task-manager.js +3 -0
  318. package/dist/server/modules/tasks/task-manager.js.map +1 -1
  319. package/dist/server/modules/tasks/task-registry.d.ts +1 -0
  320. package/dist/server/modules/tasks/task-registry.js +3 -0
  321. package/dist/server/modules/tasks/task-registry.js.map +1 -1
  322. package/dist/server/modules/tasks/task-scheduler.d.ts +6 -0
  323. package/dist/server/modules/tasks/task-scheduler.js +162 -7
  324. package/dist/server/modules/tasks/task-scheduler.js.map +1 -1
  325. package/dist/server/modules/tasks/task-types.d.ts +29 -3
  326. package/dist/server/modules/tasks/task-types.js +15 -2
  327. package/dist/server/modules/tasks/task-types.js.map +1 -1
  328. package/dist/server/modules/workbench/affairs-assistant-session-snapshot-service.d.ts +68 -0
  329. package/dist/server/modules/workbench/affairs-assistant-session-snapshot-service.js +303 -0
  330. package/dist/server/modules/workbench/affairs-assistant-session-snapshot-service.js.map +1 -0
  331. package/dist/server/modules/workbench/workbench-controller.d.ts +5 -0
  332. package/dist/server/modules/workbench/workbench-controller.js +31 -1
  333. package/dist/server/modules/workbench/workbench-controller.js.map +1 -1
  334. package/dist/server/modules/workbench/workbench-service.d.ts +9 -2
  335. package/dist/server/modules/workbench/workbench-service.js +55 -18
  336. package/dist/server/modules/workbench/workbench-service.js.map +1 -1
  337. package/dist/server/modules/workspace/affairs-library-controller.d.ts +125 -0
  338. package/dist/server/modules/workspace/affairs-library-controller.js +175 -0
  339. package/dist/server/modules/workspace/affairs-library-controller.js.map +1 -0
  340. package/dist/server/modules/workspace/affairs-library-debug-log.d.ts +23 -0
  341. package/dist/server/modules/workspace/affairs-library-debug-log.js +107 -0
  342. package/dist/server/modules/workspace/affairs-library-debug-log.js.map +1 -0
  343. package/dist/server/modules/workspace/affairs-library-dirty-watch-service.d.ts +52 -0
  344. package/dist/server/modules/workspace/affairs-library-dirty-watch-service.js +555 -0
  345. package/dist/server/modules/workspace/affairs-library-dirty-watch-service.js.map +1 -0
  346. package/dist/server/modules/workspace/affairs-library-preview-link-service.d.ts +30 -0
  347. package/dist/server/modules/workspace/affairs-library-preview-link-service.js +167 -0
  348. package/dist/server/modules/workspace/affairs-library-preview-link-service.js.map +1 -0
  349. package/dist/server/modules/workspace/affairs-library-refresh-contract.d.ts +56 -0
  350. package/dist/server/modules/workspace/affairs-library-refresh-contract.js +48 -0
  351. package/dist/server/modules/workspace/affairs-library-refresh-contract.js.map +1 -0
  352. package/dist/server/modules/workspace/affairs-library-service.d.ts +353 -0
  353. package/dist/server/modules/workspace/affairs-library-service.js +3895 -0
  354. package/dist/server/modules/workspace/affairs-library-service.js.map +1 -0
  355. package/dist/server/modules/workspace/affairs-lightweight-session-controller.d.ts +86 -0
  356. package/dist/server/modules/workspace/affairs-lightweight-session-controller.js +193 -0
  357. package/dist/server/modules/workspace/affairs-lightweight-session-controller.js.map +1 -0
  358. package/dist/server/modules/workspace/affairs-lightweight-session-service.d.ts +146 -0
  359. package/dist/server/modules/workspace/affairs-lightweight-session-service.js +1593 -0
  360. package/dist/server/modules/workspace/affairs-lightweight-session-service.js.map +1 -0
  361. package/dist/server/modules/workspace/affairs-tag-controller.d.ts +110 -0
  362. package/dist/server/modules/workspace/affairs-tag-controller.js +102 -0
  363. package/dist/server/modules/workspace/affairs-tag-controller.js.map +1 -0
  364. package/dist/server/modules/workspace/affairs-tag-service.d.ts +174 -0
  365. package/dist/server/modules/workspace/affairs-tag-service.js +719 -0
  366. package/dist/server/modules/workspace/affairs-tag-service.js.map +1 -0
  367. package/dist/server/modules/workspace/teable-api-client.d.ts +118 -0
  368. package/dist/server/modules/workspace/teable-api-client.js +142 -0
  369. package/dist/server/modules/workspace/teable-api-client.js.map +1 -0
  370. package/dist/server/modules/workspace/teable-catalog-controller.d.ts +18 -0
  371. package/dist/server/modules/workspace/teable-catalog-controller.js +17 -0
  372. package/dist/server/modules/workspace/teable-catalog-controller.js.map +1 -0
  373. package/dist/server/modules/workspace/teable-catalog-service.d.ts +36 -0
  374. package/dist/server/modules/workspace/teable-catalog-service.js +124 -0
  375. package/dist/server/modules/workspace/teable-catalog-service.js.map +1 -0
  376. package/dist/server/modules/workspace/teable-credential-service.d.ts +8 -0
  377. package/dist/server/modules/workspace/teable-credential-service.js +37 -0
  378. package/dist/server/modules/workspace/teable-credential-service.js.map +1 -0
  379. package/dist/server/modules/workspace/teable-field-mapping-controller.d.ts +25 -0
  380. package/dist/server/modules/workspace/teable-field-mapping-controller.js +31 -0
  381. package/dist/server/modules/workspace/teable-field-mapping-controller.js.map +1 -0
  382. package/dist/server/modules/workspace/teable-field-mapping-service.d.ts +38 -0
  383. package/dist/server/modules/workspace/teable-field-mapping-service.js +215 -0
  384. package/dist/server/modules/workspace/teable-field-mapping-service.js.map +1 -0
  385. package/dist/server/modules/workspace/teable-global-binding-controller.d.ts +22 -0
  386. package/dist/server/modules/workspace/teable-global-binding-controller.js +25 -0
  387. package/dist/server/modules/workspace/teable-global-binding-controller.js.map +1 -0
  388. package/dist/server/modules/workspace/teable-global-binding-service.d.ts +35 -0
  389. package/dist/server/modules/workspace/teable-global-binding-service.js +151 -0
  390. package/dist/server/modules/workspace/teable-global-binding-service.js.map +1 -0
  391. package/dist/server/modules/workspace/teable-mirror-sync-controller.d.ts +29 -0
  392. package/dist/server/modules/workspace/teable-mirror-sync-controller.js +50 -0
  393. package/dist/server/modules/workspace/teable-mirror-sync-controller.js.map +1 -0
  394. package/dist/server/modules/workspace/teable-mirror-sync-service.d.ts +157 -0
  395. package/dist/server/modules/workspace/teable-mirror-sync-service.js +917 -0
  396. package/dist/server/modules/workspace/teable-mirror-sync-service.js.map +1 -0
  397. package/dist/server/modules/workspace/teable-runtime-controller.d.ts +58 -0
  398. package/dist/server/modules/workspace/teable-runtime-controller.js +60 -0
  399. package/dist/server/modules/workspace/teable-runtime-controller.js.map +1 -0
  400. package/dist/server/modules/workspace/teable-runtime-service.d.ts +96 -0
  401. package/dist/server/modules/workspace/teable-runtime-service.js +362 -0
  402. package/dist/server/modules/workspace/teable-runtime-service.js.map +1 -0
  403. package/dist/server/modules/workspace/teable-workbench-sync-config-controller.d.ts +22 -0
  404. package/dist/server/modules/workspace/teable-workbench-sync-config-controller.js +20 -0
  405. package/dist/server/modules/workspace/teable-workbench-sync-config-controller.js.map +1 -0
  406. package/dist/server/modules/workspace/teable-workbench-sync-config-service.d.ts +22 -0
  407. package/dist/server/modules/workspace/teable-workbench-sync-config-service.js +159 -0
  408. package/dist/server/modules/workspace/teable-workbench-sync-config-service.js.map +1 -0
  409. package/dist/server/modules/workspace/workspace-controller.d.ts +2 -1
  410. package/dist/server/modules/workspace/workspace-controller.js +8 -2
  411. package/dist/server/modules/workspace/workspace-controller.js.map +1 -1
  412. package/dist/server/modules/workspace/workspace-service.js +60 -9
  413. package/dist/server/modules/workspace/workspace-service.js.map +1 -1
  414. package/dist/server/routes/affairs.d.ts +11 -0
  415. package/dist/server/routes/affairs.js +126 -0
  416. package/dist/server/routes/affairs.js.map +1 -0
  417. package/dist/server/routes/assistant.js +0 -5
  418. package/dist/server/routes/assistant.js.map +1 -1
  419. package/dist/server/routes/files.js +5 -0
  420. package/dist/server/routes/files.js.map +1 -1
  421. package/dist/server/routes/office.js +4 -0
  422. package/dist/server/routes/office.js.map +1 -1
  423. package/dist/server/routes/system.d.ts +2 -1
  424. package/dist/server/routes/system.js +2 -1
  425. package/dist/server/routes/system.js.map +1 -1
  426. package/dist/server/routes/workbench.js +15 -0
  427. package/dist/server/routes/workbench.js.map +1 -1
  428. package/dist/server/routes/workspaces.d.ts +4 -1
  429. package/dist/server/routes/workspaces.js +56 -1
  430. package/dist/server/routes/workspaces.js.map +1 -1
  431. package/dist/server/server/create-server.d.ts +20 -2
  432. package/dist/server/server/create-server.js +180 -33
  433. package/dist/server/server/create-server.js.map +1 -1
  434. package/dist/server/shared/http/error-handler.js +10 -0
  435. package/dist/server/shared/http/error-handler.js.map +1 -1
  436. package/dist/server/storage/repositories/affairs-assistant-session-snapshot-repository.d.ts +10 -0
  437. package/dist/server/storage/repositories/affairs-assistant-session-snapshot-repository.js +47 -0
  438. package/dist/server/storage/repositories/affairs-assistant-session-snapshot-repository.js.map +1 -0
  439. package/dist/server/storage/repositories/butler-profile-repository.js +7 -3
  440. package/dist/server/storage/repositories/butler-profile-repository.js.map +1 -1
  441. package/dist/server/storage/repositories/office-onlyoffice-setting-repository.d.ts +19 -0
  442. package/dist/server/storage/repositories/office-onlyoffice-setting-repository.js +55 -0
  443. package/dist/server/storage/repositories/office-onlyoffice-setting-repository.js.map +1 -0
  444. package/dist/server/storage/repositories/session-index-repository.js +9 -2
  445. package/dist/server/storage/repositories/session-index-repository.js.map +1 -1
  446. package/dist/server/storage/repositories/user-affairs-library-setting-repository.d.ts +10 -0
  447. package/dist/server/storage/repositories/user-affairs-library-setting-repository.js +72 -0
  448. package/dist/server/storage/repositories/user-affairs-library-setting-repository.js.map +1 -0
  449. package/dist/server/storage/repositories/user-preference-profile-repository.js +6 -3
  450. package/dist/server/storage/repositories/user-preference-profile-repository.js.map +1 -1
  451. package/dist/server/storage/repositories/user-teable-credential-repository.d.ts +9 -0
  452. package/dist/server/storage/repositories/user-teable-credential-repository.js +45 -0
  453. package/dist/server/storage/repositories/user-teable-credential-repository.js.map +1 -0
  454. package/dist/server/storage/repositories/user-teable-field-mapping-repository.d.ts +10 -0
  455. package/dist/server/storage/repositories/user-teable-field-mapping-repository.js +69 -0
  456. package/dist/server/storage/repositories/user-teable-field-mapping-repository.js.map +1 -0
  457. package/dist/server/storage/repositories/user-teable-global-setting-repository.d.ts +8 -0
  458. package/dist/server/storage/repositories/user-teable-global-setting-repository.js +52 -0
  459. package/dist/server/storage/repositories/user-teable-global-setting-repository.js.map +1 -0
  460. package/dist/server/storage/repositories/user-teable-mirror-record-mapping-repository.d.ts +9 -0
  461. package/dist/server/storage/repositories/user-teable-mirror-record-mapping-repository.js +66 -0
  462. package/dist/server/storage/repositories/user-teable-mirror-record-mapping-repository.js.map +1 -0
  463. package/dist/server/storage/repositories/user-teable-mirror-table-binding-repository.d.ts +9 -0
  464. package/dist/server/storage/repositories/user-teable-mirror-table-binding-repository.js +67 -0
  465. package/dist/server/storage/repositories/user-teable-mirror-table-binding-repository.js.map +1 -0
  466. package/dist/server/storage/repositories/user-teable-sync-log-repository.d.ts +14 -0
  467. package/dist/server/storage/repositories/user-teable-sync-log-repository.js +97 -0
  468. package/dist/server/storage/repositories/user-teable-sync-log-repository.js.map +1 -0
  469. package/dist/server/storage/repositories/user-teable-workbench-sync-config-repository.d.ts +8 -0
  470. package/dist/server/storage/repositories/user-teable-workbench-sync-config-repository.js +55 -0
  471. package/dist/server/storage/repositories/user-teable-workbench-sync-config-repository.js.map +1 -0
  472. package/dist/server/storage/repositories/workspace-navigation-state-repository.d.ts +3 -0
  473. package/dist/server/storage/repositories/workspace-navigation-state-repository.js +47 -4
  474. package/dist/server/storage/repositories/workspace-navigation-state-repository.js.map +1 -1
  475. package/dist/server/storage/sqlite/client.js +633 -123
  476. package/dist/server/storage/sqlite/client.js.map +1 -1
  477. package/dist/server/storage/sqlite/schema.sql +214 -25
  478. package/dist/server/types/domain.d.ts +133 -20
  479. package/dist/server/ws/workbench-ws-hub.js +2 -2
  480. package/dist/server/ws/workbench-ws-hub.js.map +1 -1
  481. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js +0 -2
  482. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js.map +1 -1
  483. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +0 -6
  484. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
  485. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.d.ts +22 -3
  486. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js +29 -2
  487. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js.map +1 -1
  488. package/node_modules/@codingns/session-sync-core/package.json +3 -1
  489. package/package.json +1 -1
  490. package/dist/public/assets/AdaptiveButlerPage-B153lk5H.css +0 -1
  491. package/dist/public/assets/AdaptiveButlerPage-CJw8Ae62.js +0 -3
  492. package/dist/public/assets/DesktopModal-D_A8sgQU.js +0 -1
  493. package/dist/public/assets/DesktopWindowPage-DK7L7osV.js +0 -2
  494. package/dist/public/assets/FileContextPanel-BdCoubcJ.js +0 -1
  495. package/dist/public/assets/GitSidebar-BeZ0hj7A.js +0 -6
  496. package/dist/public/assets/MobileCreateSessionSheet-DfLMVu8q.js +0 -1
  497. package/dist/public/assets/MobileSheet-5kZ-w-gU.js +0 -1
  498. package/dist/public/assets/MobileWorkspaceSwitcherHeader-C6JMiOq_.js +0 -1
  499. package/dist/public/assets/PluginContainerPage-BlY-xJDh.js +0 -1
  500. package/dist/public/assets/SessionIndexPage-DkBp9Mqz.js +0 -1
  501. package/dist/public/assets/SettingsPage-C-ASmJAG.js +0 -2
  502. package/dist/public/assets/TerminalManagerPanel-NVZRxxmH.js +0 -1
  503. package/dist/public/assets/TerminalRuntimeFallbackModal-Bzum5nZ0.js +0 -1
  504. package/dist/public/assets/WorkbenchLayout-OFi6CWgH.js +0 -244
  505. package/dist/public/assets/WorkbenchShellRoute-B4XB8SwG.css +0 -1
  506. package/dist/public/assets/WorkbenchShellRoute-BAQe_E0O.js +0 -1
  507. package/dist/public/assets/WorkspaceDebugDetailPage-DhKa6e9y.js +0 -1
  508. package/dist/public/assets/WorkspaceDetailPage-BPsrFffw.js +0 -1
  509. package/dist/public/assets/WorkspaceHomePage-KAtqZOAb.js +0 -1
  510. package/dist/public/assets/file-tree-icon-Mg1DiBRX.js +0 -590
  511. package/dist/public/assets/index-C4t-vvqk.css +0 -1
  512. package/dist/public/assets/index-CL97fwWB.js +0 -42
  513. package/dist/public/assets/realtime-client-CLafKzzJ.js +0 -1
  514. package/dist/public/assets/useRegisteredDebugTemplates-DQAWVdCo.js +0 -1
  515. package/dist/public/assets/workbench-navigation-MEzCSmsK.js +0 -1
@@ -1 +0,0 @@
1
- import{b as c,j as i,t as o,A as In}from"./index-CL97fwWB.js";import{f as ei,e as _i,g as Fi}from"./App-BOHBGFOd.js";import{bI as Ai,bJ as Li,bK as ti,c as nn,w as ft,bL as Bi,b as Wi,u as $i,ah as _e,bM as Oi,bN as gt,bO as Xe,bP as Hi,bQ as Vi,bR as zi,bS as Ui,bT as Ki}from"./WorkbenchLayout-OFi6CWgH.js";import{q as Gi,v as Xi}from"./workbench-navigation-MEzCSmsK.js";import{W as $n}from"./WorkbenchModal-C7qoQElW.js";import{r as Rt,a as Tt,b as qi}from"./file-tree-icon-Mg1DiBRX.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./DesktopModal-D_A8sgQU.js";import"./relay-entry-D-LfvdiX.js";import"./MobileSheet-5kZ-w-gU.js";const Yi=new Set([".ds_store","thumbs.db","ehthumbs.db","desktop.ini",".spotlight-v100",".trashes",".fseventsd","__macosx","$recycle.bin","system volume information",".apdisk",".appledouble",".temporaryitems"]),Ji=["._"];function ut(t){return t.split(/[/\\]/).filter(Boolean).pop()??t}function Qi(t){const n=t.trim().toLowerCase();return n?Yi.has(n)||Ji.some(l=>n.startsWith(l)):!1}function _t(t,n,l){return l?[...t]:t.filter(s=>!Qi(n(s)))}function Nt(t,n){return _t(t,l=>l.name,n)}function Zi(t,n){return n?t:Object.entries(t).reduce((l,[s,m])=>(l[s]=Nt(m,!1),l),{})}async function Dt(t,n){const[l,s]=await Promise.all([Ai(n),Li(t)]);return Ii(l.changes,s.items)}function Ii(t,n){const l=new Set(n.map(s=>kt(s.path)));return t.filter(s=>l.has(kt(s.path))||s.oldPath!==null&&l.has(kt(s.oldPath)))}function ea(t){const n=On("","");for(const l of t){const s=kt(l.path),m=s.split("/").filter(Boolean);let h=n;m.forEach((b,x)=>{const j=m.slice(0,x+1).join("/");if(x===m.length-1){h.children.set(`file:${j}`,{kind:"file",name:b,path:s,change:l});return}const _=`directory:${j}`,M=h.children.get(_);if(M&&M.kind==="directory"){h=M;return}const Z=On(b,j);h.children.set(_,Z),h=Z})}return ai(ii([...n.children.values()]))}function ni(t,n){const l=t.oldPath?`${t.oldPath} -> ${t.path}`:t.path;return ln(t)?`${l} ${n}`:l}function ln(t){return t.status==="D"||t.stagedStatus==="D"||t.worktreeStatus==="D"}function Et(t){return t.split("/").filter(Boolean).pop()??t}function kt(t){return t.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function On(t,n){return{kind:"directory",name:t,path:n,children:new Map}}function ii(t){return[...t].sort((n,l)=>n.kind!==l.kind?n.kind==="directory"?-1:1:n.name.localeCompare(l.name,"zh-CN")).map(n=>n.kind==="directory"?{kind:"directory",name:n.name,path:n.path,children:ii([...n.children.values()])}:n)}function ai(t){return t.map(n=>{var b;if(n.kind!=="directory")return n;const l=ai(n.children);let s=n.name,m=n.path,h=l;for(;h.length===1&&((b=h[0])==null?void 0:b.kind)==="directory";){const x=h[0];s=`${s}/${x.name}`,m=x.path,h=x.children}return{kind:"directory",name:s,path:m,children:h}})}const ta=450,na=60*1e3,Hn=20,Vn=16;function ia({sessionId:t,workspaceId:n,showSystemFiles:l,selectedPath:s,refreshVersion:m,onCountChange:h,onSelectFile:b,onOpenFile:x}){const[j,_]=c.useState("tree"),[M,Z]=c.useState([]),[ye,K]=c.useState(!0),[xe,ge]=c.useState(!1),[G,ht]=c.useState([]),E=c.useRef(null),At=ti(),{showToast:Ne}=ei();c.useEffect(()=>{const p=nn(Pt(n,t),na);_("tree"),Z(p??[]),K(p===null),ge(!1),ht([]),E.current=null},[t,n]),c.useEffect(()=>{let p=!1;async function w(){K(!0);try{const v=await Dt(t,n);p||(Z(v),ft(Pt(n,t),v))}catch(v){p||Ne({title:It(v,o("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{p||K(!1)}}return w(),()=>{p=!0}},[m,t,Ne,n]);async function De(){K(!0);try{const p=await Dt(t,n);Z(p),ft(Pt(n,t),p)}catch(p){Ne({title:It(p,o("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{K(!1)}}async function D(){if(R.length!==0){ge(!0);try{await Bi(n,R.map(w=>w.path));const p=await Dt(t,n);Z(p),ft(Pt(n,t),p),Ne({title:o("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(p){Ne({title:It(p,o("git.stageFailed")),tone:"error"})}finally{ge(!1)}}}function F(p){ht(w=>w.includes(p)?w.filter(v=>v!==p):[...w,p])}function X(p){const w=Date.now(),v=E.current;return E.current={filePath:p,timestamp:w},(v==null?void 0:v.filePath)===p&&w-v.timestamp<=ta}async function $(p,w){if(w&&X(p)){await x(p),E.current=null;return}w||(E.current=null),await b(p)}const ie=c.useMemo(()=>_t(M,p=>Et(p.path),l),[M,l]),R=ie.filter(p=>!p.staged),Fe=ea(ie),ae=new Set(G);return c.useEffect(()=>{h==null||h(ie.length)},[h,ie.length]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"file-panel-session-toolbar",children:[i.jsxs("div",{className:"file-panel-view-modes",role:"tablist","aria-label":o("conversation.filePanelSessionViewLabel"),children:[i.jsx("button",{className:j==="tree"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":j==="tree",onClick:()=>_("tree"),children:o("conversation.filePanelSessionTreeView")}),i.jsx("button",{className:j==="list"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":j==="list",onClick:()=>_("list"),children:o("conversation.filePanelSessionListView")})]}),i.jsxs("div",{className:"file-panel-session-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void De(),disabled:ye||xe,children:o("conversation.filePanelRefresh")}),i.jsx("button",{className:"primary-button",type:"button",onClick:()=>void D(),disabled:xe||R.length===0,children:o("conversation.filePanelSessionStageAll")})]})]}),i.jsxs("div",{className:"file-panel-session-summary",children:[i.jsx("span",{children:`${o("conversation.filePanelSessionSummary")} ${ie.length}`}),i.jsx("span",{children:`${o("conversation.filePanelSessionUnstagedSummary")} ${R.length}`})]}),i.jsx("div",{ref:At,className:"file-tree","data-scrollbar-autohide":"true",children:ye?i.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSessionLoading")}):ie.length===0?i.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSessionEmpty")}):j==="tree"?li({nodes:Fe,depth:0,collapsedPathSet:ae,selectedPath:s,onToggleTreePath:F,onFileClick:$}):aa({items:ie,selectedPath:s,onFileClick:$})})]})}function li({nodes:t,depth:n,collapsedPathSet:l,selectedPath:s,onToggleTreePath:m,onFileClick:h}){return t.map(b=>{if(b.kind==="directory"){const x=!l.has(b.path);return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-kind":"directory","aria-expanded":x,style:{paddingInlineStart:`${Hn+n*Vn}px`},onClick:()=>m(b.path),children:[i.jsx("span",{className:"file-tree-chevron","aria-hidden":"true",children:x?"v":">"}),i.jsx("span",{className:"file-tree-label",children:b.name})]}),x?i.jsx("div",{className:"file-tree-children",children:li({nodes:b.children,depth:n+1,collapsedPathSet:l,selectedPath:s,onToggleTreePath:m,onFileClick:h})}):null]},`session-directory:${b.path}`)}return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-session-change",type:"button","data-active":s===b.change.path,"data-kind":"file",style:{paddingInlineStart:`${Hn+n*Vn}px`},onClick:()=>void h(b.change.path,!ln(b.change)),children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),i.jsx("span",{className:"git-tree-file-icon","data-kind":Tt(b.name),"aria-hidden":"true",children:Rt(b.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:b.name}),i.jsx("span",{className:"file-tree-path",children:ni(b.change,o("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":b.change.status,children:b.change.status}),i.jsx("span",{className:"file-session-badge subtle",children:b.change.staged?o("git.stagedLabel"):o("git.workingTreeLabel")})]})]})},`session-file:${b.path}`)})}function aa({items:t,selectedPath:n,onFileClick:l}){return t.map(s=>i.jsx("div",{className:"file-session-list-item",children:i.jsxs("button",{className:"file-session-list-button",type:"button","data-active":n===s.path,onClick:()=>void l(s.path,!ln(s)),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":Tt(Et(s.path)),"aria-hidden":"true",children:Rt(Et(s.path))}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:Et(s.path)}),i.jsx("span",{className:"file-tree-path",children:ni(s,o("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":s.status,children:s.status}),i.jsx("span",{className:"file-session-badge subtle",children:s.staged?o("git.stagedLabel"):o("git.workingTreeLabel")})]})]})},`session-list:${s.path}`))}function Pt(t,n){return`file-panel.session-changes.${t}.${n}`}function It(t,n){return t instanceof In?t.message:typeof t=="object"&&t&&"message"in t?String(t.message??n):n}const g="",la=450,ne=8,Ct=4,ra=176,oa=120,sa=300*1e3,ca=60*1e3,zn=1600,ua=220,fa=20,da=16;function ha(){if(typeof document>"u")return;const t=document.querySelector(".workbench-modal-card.file-viewer-modal"),n=t==null?void 0:t.getBoundingClientRect();if(!(!n||n.width<=0||n.height<=0))return{width:Math.round(n.width),height:Math.round(n.height),minWidth:720,minHeight:480}}function rl({className:t,sessionId:n,workspaceId:l,hideHeading:s=!1,hideTabs:m=!1,externalRevealRequest:h=null,externalWindowMode:b=!1,workbenchShellOverrides:x}){var Ln,Bn;const j=Wi(),{navigationGroups:_,subscribeFileTree:M,requestFileTreeRefresh:Z,addFileTreeSnapshotListener:ye,subscribeGitSnapshot:K,requestGitRefresh:xe,addGitSnapshotListener:ge}={...j,...x},[G,ht]=c.useState({}),[E,At]=c.useState([]),[Ne,De]=c.useState([]),[D,F]=c.useState(g),[X,$]=c.useState([]),[ie,R]=c.useState(null),[Fe,ae]=c.useState(!1),[p,w]=c.useState(!1),[v,mt]=c.useState(!1),[Ye,Je]=c.useState(!1),[A,Qe]=c.useState(""),[Lt,q]=c.useState(null),[pt,bt]=c.useState(!1),[le,Ae]=c.useState(null),[O,Ze]=c.useState("workspace"),[on,Ee]=c.useState(0),[sn,Bt]=c.useState(0),[Ie,I]=c.useState(!1),[et,L]=c.useState(!1),[re,H]=c.useState(null),[Pe,Le]=c.useState(null),[B,Be]=c.useState(null),[P,Wt]=c.useState(null),[S,tt]=c.useState(null),[$t,We]=c.useState(""),[cn,un]=c.useState([]),[ee,Ot]=c.useState(!1),[hi,oe]=c.useState(null),fn=c.useId(),se=c.useRef({}),Y=c.useRef({}),T=c.useRef([]),te=c.useRef(g),nt=c.useRef(!1),it=c.useRef(null),mi=ti(),dn=c.useRef(null),hn=c.useRef(null),Ht=c.useRef(null),mn=c.useRef(null),pn=c.useRef(null),ce=c.useRef(0),ue=c.useRef(new Map),{showToast:C}=ei(),Ce=_i(),V=$i(e=>e.showSystemFiles),$e=!!(n!=null&&n.trim()),bn=s&&Ce.isMobile;c.useEffect(()=>{_e("file_panel.props",{sessionId:n,workspaceId:l,externalWindowMode:b})},[b,n,l]),c.useEffect(()=>{te.current=D},[D]);function Vt(e){Bt(e),!(!l||!n)&&ft(Yn(l,n),e)}async function vn(){if(!l||!n){Vt(0);return}const e=await Dt(n,l),a=_t(e,r=>ut(r.path),V).length;Vt(a)}function ke(e){ht(a=>{const r=typeof e=="function"?e(a):e;return se.current=r,r})}function Oe(e){At(a=>{const r=typeof e=="function"?e(a):e;return T.current=r,r})}c.useEffect(()=>{var f,d;if(Gt(),!l){Gt(),nt.current=!1,se.current={},Y.current={},T.current=[],te.current=g,ke({}),Oe([]),De([]),F(g),Je(!1),Qe(""),q(null),bt(!1),ae(!1),Ot(!1),oe(null),$([]),R(null),H(null),Le(null),Be(null),tt(null),We("");return}nt.current=!0;const e=nn(qn(l),sa);_e("file_panel.workspace_snapshot",{workspaceId:l,cached:!!e,cachedRootItems:((d=(f=e==null?void 0:e.treeCache)==null?void 0:f[g])==null?void 0:d.length)??0,cachedDirectoryCount:Object.keys((e==null?void 0:e.treeCache)??{}).length});const a=Ra((e==null?void 0:e.activeDirectoryPath)??g,(e==null?void 0:e.treeCache)??{}),r=Xn((e==null?void 0:e.expandedDirectories)??[],a),u=St((e==null?void 0:e.treeCache)??{},a,r);se.current=u,Y.current=Jn((e==null?void 0:e.treeRevisionByPath)??{},u),T.current=r,te.current=a,ke(u),Oe(r),De([]),F(a),ae(!1),w(!1),Je(!1),Qe(""),q(null),bt(!1),queueMicrotask(()=>{nt.current=!1})},[l]),c.useEffect(()=>{if(!h||h.workspaceId!==l)return;const e=()=>{if(pn.current===h.requestId)return;pn.current=h.requestId,Ze("workspace"),(h.openViewer?Ue(h.filePath):he(h.filePath)).catch(r=>{C({title:Q(r,o("conversation.filePanelOpenFailed")),tone:"error"})})};if(nt.current){queueMicrotask(e);return}e()},[h,Ue,he,C,l]),c.useEffect(()=>{if(l)return ye(e=>{e.workspaceId===l&&(Y.current={...Y.current,[e.path]:typeof e.revision=="string"?e.revision:null},ke(a=>({...a,[e.path]:e.items})),e.path===g&&ae(!1),De(a=>a.filter(r=>r!==e.path)),wn(e.path,e.items))})},[ye,l]),c.useEffect(()=>()=>{Gt()},[]),c.useEffect(()=>{l&&M(l,tn(T.current,te.current),{knownRevisionByPath:Y.current})},[D,E,M,l]),c.useEffect(()=>{$([]),R(null),Ae(null),oe(null),Ee(0),I(!1),L(!1),H(null),Le(null),Be(null),tt(null),We(""),it.current=null,ce.current+=1},[n]),c.useEffect(()=>{!$e&&O==="session"&&Ze("workspace")},[O,$e]),c.useEffect(()=>{m&&O!=="workspace"&&Ze("workspace")},[O,m]),c.useEffect(()=>{if(!Ie&&!et&&!re)return;function e(r){var y,N,pe;if(!(r.target instanceof Node))return;const u=((y=dn.current)==null?void 0:y.contains(r.target))??!1,f=((N=hn.current)==null?void 0:N.contains(r.target))??!1,d=((pe=Ht.current)==null?void 0:pe.contains(r.target))??!1;!u&&!f&&!d&&(I(!1),L(!1),H(null),Le(null))}function a(r){r.key==="Escape"&&(I(!1),L(!1),H(null),Le(null))}return document.addEventListener("pointerdown",e),document.addEventListener("keydown",a),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",a)}},[Ie,et,re]),c.useLayoutEffect(()=>{if(!re||typeof window>"u"){Le(null);return}const e=re;function a(){const u=Ht.current;if(!u)return;const f=u.getBoundingClientRect();Le(Pa({x:e.positionX,y:e.positionY},{width:f.width||ra,height:f.height||u.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}a();const r=window.requestAnimationFrame(a);return window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),()=>{window.cancelAnimationFrame(r),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[re]),c.useEffect(()=>{if(!l)return;const e=Xn(E,D),a=St(G,D,e);ft(qn(l),{treeCache:a,treeRevisionByPath:Jn(Y.current,a),expandedDirectories:e,activeDirectoryPath:D})},[D,E,G,l]),c.useEffect(()=>{if(nt.current)return;const e=St(G,D,E);_a(G,e)||ke(e)},[D,E,G]),c.useEffect(()=>{let e=!1;const a=(l==null?void 0:l.trim())??null;async function r(f){if(!a)return;const d=Nt(se.current[g]??[],V),y=(f==null?void 0:f.silent)!==!0&&d.length===0;y&&ae(!0),_e("file_panel.load_root_tree.start",{sessionId:n,workspaceId:a,silent:(f==null?void 0:f.silent)===!0,cachedRootItems:d.length});try{const N=await Kt(g,{force:!0});e||(_e("file_panel.load_root_tree.end",{sessionId:n,workspaceId:a,itemCount:N.length}),ke(pe=>({...St(pe,te.current,T.current),[g]:N})))}catch(N){!e&&!Qn(N)&&C({title:Q(N,o("conversation.filePanelLoadFailed")),tone:"error"})}finally{!e&&y&&ae(!1)}}if(Nt(se.current[g]??[],V).length>0){const f=window.setTimeout(()=>{a&&(M(a,tn(T.current,te.current),{knownRevisionByPath:Y.current}),r({silent:!0}))},1500);return()=>{e=!0,window.clearTimeout(f)}}return r(),()=>{e=!0}},[n,V,C,l]),c.useEffect(()=>{if(!l||!n){Bt(0);return}const e=nn(Yn(l,n),ca);_e("file_panel.session_change_count.snapshot",{sessionId:n,workspaceId:l,cached:e!==null,cachedCount:e}),Bt(e??0);let a=!1;return vn().catch(()=>{}),()=>{a=!0}},[n,on,V,l]),c.useEffect(()=>{if(!l){un([]);return}const e=l.trim();K(e),xe(e)},[l,K,xe]),c.useEffect(()=>{if(!l)return;const e=l.trim();return ge(a=>{var r;a.workspaceId===e&&un(((r=a.status)==null?void 0:r.changes)??[])})},[ge,l]);const vt=c.useMemo(()=>_t(cn,e=>ut(e.path),V),[cn,V]),W=c.useMemo(()=>{const e=new Map,a=new Set;for(const r of vt){const u=r.path.replace(/\\/g,"/"),f=r.worktreeStatus??r.stagedStatus??r.status;e.set(u,f);const d=u.split("/");for(let y=1;y<d.length;y++)a.add(d.slice(0,y).join("/"))}return{statusByPath:e,changedDirs:a}},[vt]),Me=c.useMemo(()=>Zi(G,V),[V,G]),Re=c.useMemo(()=>Lt===null?null:Nt(Lt,V),[Lt,V]),He=Me[g]??[],fe=Ye&&Re!==null,yt=c.useMemo(()=>ee?an(He,Me,W.statusByPath,W.changedDirs):He,[W.changedDirs,W.statusByPath,He,ee,Me]),pi=c.useMemo(()=>fe?(Re??[]).map(e=>U(e.path,e.kind)):ri(yt,Me,E,ee,W.statusByPath,W.changedDirs),[E,W.changedDirs,W.statusByPath,fe,ee,Re,Me,yt]),de=((Ln=_.find(e=>e.workspace.id===l))==null?void 0:Ln.workspace)??null,k=Gn(X),zt=(k==null?void 0:k.path)??null,je=(k==null?void 0:k.kind)==="file"?k.path:null,xt=c.useMemo(()=>new Set(X.map(e=>e.path)),[X]),at=c.useMemo(()=>wt(X),[X]),Ut=!!(de!=null&&de.path&&X.length===1&&zt),yn=X.length===1&&(k==null?void 0:k.kind)==="file",xn=at.length>0,Te=at.length>0,lt=!!(P!=null&&P.items.length&&l),gn=!!l&&X.length===1&&k!==null,Pn=!!((je?ve(je):D)&&E.length),Cn=P?P.mode==="copy"?o("conversation.filePanelClipboardCopyReady",{count:P.items.length}):o("conversation.filePanelClipboardCutReady",{count:P.items.length}):null,z=S?Sa(S):null;async function jn(e,a=!1){if(!l)return[];if(!a){const r=se.current[e];if(r)return r}e===g?ae(!0):De(r=>Mt(r,e));try{const r=await Kt(e,{force:a});return ke(u=>({...u,[e]:r})),r}catch(r){throw Qn(r)||C({title:Q(r,o("conversation.filePanelLoadFailed")),tone:"error"}),r}finally{e===g?ae(!1):De(r=>r.filter(u=>u!==e))}}async function we(e){if(!l)return;const a=(e==null?void 0:e.activeDirectoryPath)??te.current,r=(e==null?void 0:e.expandedDirectories)??T.current,u=Ta(se.current,a,r);_e("file_panel.refresh_tree_cache.start",{sessionId:n,workspaceId:l,targetDirectories:u});const d=(await Promise.all(u.map(async y=>{const N=await Kt(y,{force:!0});return[y,N]}))).reduce((y,[N,pe])=>(y[N]=pe,y),{});_e("file_panel.refresh_tree_cache.end",{sessionId:n,workspaceId:l,targetDirectories:u,directoryCount:Object.keys(d).length}),ke(d)}async function Kt(e,a){if(!l)return[];if(!(a!=null&&a.force)){const d=se.current[e];if(d)return d}const r=tn(Mt(T.current,e),e||te.current);M(l,r,{knownRevisionByPath:Y.current}),Z(l,[e],{knownRevisionByPath:Y.current});const u=bi(e,zn,{allowCached:(a==null?void 0:a.force)!==!0}),f=Fa(ua).then(async()=>{if(!l)return[];const y=(await Ui(l,e||void 0)).items;return Y.current={...Y.current,[e]:null},wn(e,y),y});try{return await Promise.race([u,f])}catch(d){if(!fi(d))throw d;return await f}}function bi(e,a=zn,r){const u=se.current[e];return(r==null?void 0:r.allowCached)!==!1&&u?Promise.resolve(u):new Promise((f,d)=>{const y=window.setTimeout(()=>{vi(e,y),d(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${e}`))},a),N=ue.current.get(e)??[];ue.current.set(e,[...N,{resolve:f,reject:d,timerId:y}])})}function wn(e,a){const r=ue.current.get(e)??[];r.length!==0&&(ue.current.delete(e),r.forEach(u=>{window.clearTimeout(u.timerId),u.resolve(a)}))}function vi(e,a){const u=(ue.current.get(e)??[]).filter(f=>f.timerId!==a);if(u.length===0){ue.current.delete(e);return}ue.current.set(e,u)}function Gt(){for(const[e,a]of ue.current.entries())a.forEach(r=>{window.clearTimeout(r.timerId),r.reject(new Error(`FILE_TREE_ABORTED:${e}`))});ue.current.clear()}function Ve(e){$([e]),R(e.path)}function rt(e){F(e.kind==="directory"?e.path:ve(e.path))}function yi(e){const a=ba(pi,ie,e);$(a),R(e.path),rt(e)}function xi(e){const a=pa(X,e),r=Gn(a);$(a),R(e.path),r&&rt(r)}function Sn(e){Ve(e),rt(e)}function ze(e,a){if(a!=null&&a.shiftKey){yi(e);return}if(jt(a)){xi(e);return}Sn(e)}async function ot(e,a=!1){const r=dt(e,a);if(!r.length){F(g);return}Oe(u=>ui(u,r)),F(r[r.length-1]??g);for(const u of r)try{await jn(u)}catch{return}}async function he(e){const a=U(e,"file");Ve(a),rt(a),await ot(e)}async function Ue(e){Ae(e),oe(null),it.current=null,ce.current+=1,he(e),await gi(e)}async function gi(e){const a=ce.current,r=e.replace(/\\/g,"/"),u=W.statusByPath.get(r);if(l&&u&&u!=="?"&&u!=="D")try{const f=await Oi(l,e,!1);ce.current===a&&oe(f.content||null)}catch{ce.current===a&&oe(null)}}async function Pi(e){if(!l)return;const a=ha(),r=await Hi(Ce,{workspaceId:l,workspaceName:(de==null?void 0:de.name)??null,sessionId:n??null,filePath:e,bounds:a});if(!r.ok){C({title:r.detail??o("conversation.fileViewerOpenInWindowFailed"),tone:"error"});return}ce.current+=1,Ae(null),oe(null)}function Nn(e){const a=Date.now(),r=it.current;return it.current={filePath:e,timestamp:a},(r==null?void 0:r.filePath)===e&&a-r.timestamp<=la}function Se(){it.current=null}async function Ci(e,a){const r=U(e,"file");if(a!=null&&a.shiftKey||jt(a)){Se(),ze(r,a);return}if(Nn(e)){await Ue(e);return}ze(r,a),await ot(e)}function Dn(){Je(!1),Qe(""),q(null),Se()}async function ji(e,a){const r=U(e.path,e.kind);if(a!=null&&a.shiftKey||jt(a)){Se(),ze(r,a);return}if(e.kind==="directory"){Dn(),ze(r,a),await En(e.path);return}if(Nn(e.path)){Dn(),await Ue(e.path);return}await he(e.path)}async function En(e){if(Ve(U(e,"directory")),F(e),!T.current.includes(e))try{await jn(e),Oe(a=>Mt(a,e))}catch{}}async function kn(e){if(Ve(U(e,"directory")),F(e),T.current.includes(e)){Mn(e);return}await En(e)}function Mn(e){Oe(a=>a.filter(r=>r!==e&&!r.startsWith(`${e}/`))),F(ve(e)),$([]),R(null)}async function Rn(){if(!l)return;const e=l;try{if(xe(e),await we(),je&&await ot(je),fe&&A.trim()){const a=await Xe(e,A.trim());q(a.items)}if($e&&n)if(O==="session")Ee(a=>a+1);else try{await vn()}catch(a){C({title:Q(a,o("conversation.filePanelSessionLoadFailed")),tone:"error"})}}catch(a){C({title:Q(a,o("conversation.filePanelLoadFailed")),tone:"error"})}}async function wi(e){if(e==null||e.preventDefault(),!l||!A.trim()){q(null);return}bt(!0);try{const a=await Xe(l,A.trim());q(a.items)}catch(a){C({title:Q(a,o("conversation.filePanelSearchFailed")),tone:"error"})}finally{bt(!1)}}function Tn(){if(Ye){Je(!1),Qe(""),q(null);return}Je(!0)}function J(e){L(!1),e()}function _n(){var e;(e=mn.current)==null||e.click()}async function Si(e){var d;const a=((d=e.target.files)==null?void 0:d[0])??null;if(e.target.value="",!a||!l)return;const r=ma(a.name);if(!r){C({title:o("conversation.filePanelUploadFailed"),tone:"error"});return}const u=Un(D,k),f=Kn(u,r);mt(!0);try{const y=await Na(a);await Vi({workspaceId:l,path:f,contentBase64:y}),await we(),await he(f),C({title:o("conversation.filePanelUploadSuccess",{name:r}),tone:"success"})}catch(y){C({title:Q(y,o("conversation.filePanelUploadFailed")),tone:"error"})}finally{mt(!1)}}async function Xt(e=je){if(!(!l||!e)){mt(!0);try{const a=await zi(l,e),r=Da(a.contentBase64);Ea(a.fileName,new Blob([r],{type:"application/octet-stream"})),C({title:o("conversation.filePanelDownloadSuccess",{name:a.fileName}),tone:"success"})}catch(a){C({title:Q(a,o("conversation.filePanelDownloadFailed")),tone:"error"})}finally{mt(!1)}}}function Fn(){const e=je?ve(je):D;!e||!T.current.includes(e)||Mn(e)}function qt(){tt(null),We("")}function Yt(){p||qt()}function Ke(e,a=Un(D,k)){if(!l)return;const r=a,u=r?`${r}/`:"";I(!1),L(!1),H(null),tt({mode:e,baseDirectory:r}),We(u)}function Jt(e=k){!l||!e||(I(!1),L(!1),H(null),tt({mode:"rename",target:e}),We(e.path))}async function Ni(e){if(e==null||e.preventDefault(),!l||!S)return;const a=($t??"").trim();if(a){if(S.mode==="rename"&&qe(S.target.path)===qe(a)){Yt();return}w(!0);try{if(S.mode==="rename"){const r=S.target.path,u=U(a,S.target.kind),f=le?ci(le,r,a):null;if(await gt({workspaceId:l,opType:"rename",srcPath:r,dstPath:a}),P&&Wt({...P,items:wa(P.items,r,a)}),qt(),Se(),await we(),S.target.kind==="directory"?(await ot(a,!0),Ve(u),F(a)):await he(a),f!==le&&(ce.current+=1,Ae(f),oe(null)),fe&&A.trim()){const d=await Xe(l,A.trim());q(d.items)}Ee(d=>d+1),C({title:o("conversation.filePanelRenameSuccess",{name:ut(a)||a}),tone:"success"});return}if(await gt({workspaceId:l,opType:S.mode,dstPath:a,content:S.mode==="create_file"?"":void 0}),qt(),await we(),S.mode==="create_directory"?(await ot(a,!0),Ve(U(a,"directory")),F(a)):await he(a),fe&&A.trim()){const r=await Xe(l,A.trim());q(r.items)}Ee(r=>r+1)}catch(r){C({title:Q(r,o("conversation.filePanelMutateFailed")),tone:"error"})}finally{w(!1)}}}function me(e,a=at){var u;if(a.length===0)return;const r=wt(a);Wt({mode:e,items:r}),$(r),R(((u=r[r.length-1])==null?void 0:u.path)??null),C({title:e==="copy"?o("conversation.filePanelCopySelectionSuccess",{count:r.length}):o("conversation.filePanelCutSelectionSuccess",{count:r.length}),tone:"success"}),H(null)}async function st(e=xa(k,D)){if(!l||!P||!P.items.length)return;const a=e??g,r=P.items.map(u=>({source:u,destinationPath:Kn(a,ut(u.path)||u.path)}));w(!0);try{for(const d of r)P.mode==="cut"&&qe(d.source.path)===qe(d.destinationPath)||await gt({workspaceId:l,opType:P.mode==="copy"?"copy":"move",srcPath:d.source.path,dstPath:d.destinationPath});const u=r.map(d=>U(d.destinationPath,d.source.kind)),f=u[u.length-1]??null;if(P.mode==="cut"&&Wt(null),$(u),R((f==null?void 0:f.path)??null),f&&rt(f),Se(),await we({activeDirectoryPath:(f==null?void 0:f.kind)==="directory"?f.path:f?ve(f.path):te.current,expandedDirectories:T.current}),fe&&A.trim()){const d=await Xe(l,A.trim());q(d.items)}Ee(d=>d+1),C({title:o("conversation.filePanelPasteSuccess",{count:u.length}),tone:"success"}),H(null)}catch(u){await we().catch(()=>{}),C({title:Q(u,o("conversation.filePanelPasteFailed")),tone:"error"})}finally{w(!1)}}function Qt(e=at){!e.length||p||(Be(wt(e)),H(null))}async function Di(){var a,r;if(!l||!(B!=null&&B.length))return;const e=wt(B);w(!0);try{for(const d of e)await gt({workspaceId:l,opType:"delete",srcPath:d.path});const u=ga(D,e),f=T.current.filter(d=>!e.some(y=>y.kind==="directory"&&Ft(y.path,d)));if(le&&e.some(d=>Ft(d.path,le))&&(ce.current+=1,Ae(null),oe(null)),Be(null),$([]),R(null),te.current=u,T.current=f,F(u),Oe(f),Se(),await we({activeDirectoryPath:u,expandedDirectories:f}),fe&&A.trim()){const d=await Xe(l,A.trim());q(d.items)}Ee(d=>d+1),C({title:e.length===1?o("conversation.filePanelDeleteSuccess",{name:ut(((a=e[0])==null?void 0:a.path)??"")||((r=e[0])==null?void 0:r.path)||""}):o("conversation.filePanelDeleteSelectionSuccess",{count:e.length}),tone:"success"})}catch(u){C({title:Q(u,o("conversation.filePanelMutateFailed")),tone:"error"})}finally{w(!1)}}async function Ge(e,a=k){const r=(de==null?void 0:de.path)??"",u=(a==null?void 0:a.path)??null;if(u===null||!r){I(!1);return}try{const f=ja(r),d=e==="absolute"?Ca(r,u,f):qe(u,f);await ka(d,Ce),C({title:e==="absolute"?o("conversation.filePanelCopyAbsolutePathSuccess"):o("conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(f){C({title:f instanceof Error?f.message:o("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{I(!1),H(null)}}function Ei(e,a,r){return[{id:`open-${e.path}`,label:e.kind==="directory"?E.includes(e.path)?o("conversation.filePanelCollapseDirectory"):o("conversation.filePanelExpandDirectory"):o("conversation.filePanelOpenFile"),onSelect:()=>{if(e.kind==="directory"){kn(e.path);return}Ue(e.path)}},{id:`download-${e.path}`,label:o("conversation.filePanelDownload"),disabled:e.kind!=="file"||v,onSelect:()=>{Xt(e.kind==="file"?e.path:null)}},{id:`create-file-${e.path}`,label:o("conversation.filePanelNewFile"),disabled:!l||p||v,onSelect:()=>{Ke("create_file",r)}},{id:`create-directory-${e.path}`,label:o("conversation.filePanelNewDirectory"),disabled:!l||p||v,onSelect:()=>{Ke("create_directory",r)}},{id:`rename-${e.path}`,label:o("conversation.filePanelRenameMove"),disabled:a.length!==1||p||v,onSelect:()=>Jt(e)},{id:`copy-${e.path}`,label:o("conversation.filePanelCopy"),disabled:a.length===0,onSelect:()=>me("copy",a)},{id:`cut-${e.path}`,label:o("conversation.filePanelCut"),disabled:a.length===0,onSelect:()=>me("cut",a)},{id:`paste-${e.path}`,label:o("conversation.filePanelPaste"),disabled:!lt,onSelect:()=>{st(r)}},{id:`copy-relative-${e.path}`,label:o("conversation.filePanelCopyRelativePath"),onSelect:()=>{Ge("relative",e)}},{id:`copy-absolute-${e.path}`,label:o("conversation.filePanelCopyAbsolutePath"),onSelect:()=>{Ge("absolute",e)}},{id:`delete-${e.path}`,label:o("conversation.filePanelDelete"),disabled:a.length===0||p||v,onSelect:()=>Qt(a)}]}async function An(e,a){if(Ce.isMobile)return;e.preventDefault();const r=U(a.path,a.kind),u=xt.has(r.path)?at:[r],f=r.kind==="directory"?r.path:ve(r.path);xt.has(r.path)||Sn(r);const d=Ei(r,u,f);if(Ce.isDesktop){await Ki(d);return}Ce.isWeb&&(I(!1),L(!1),H({positionX:e.clientX,positionY:e.clientY,items:d}))}c.useEffect(()=>{if(O!=="workspace")return;function e(a){if(!va(a)||a.altKey||a.shiftKey||ya(a.target))return;const r=a.key.toLowerCase();if(r==="c"&&Te){a.preventDefault(),me("copy");return}if(r==="x"&&Te){a.preventDefault(),me("cut");return}r==="v"&&lt&&(a.preventDefault(),st())}return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[O,Te,lt,me,st]);function Zt(e,a){return i.jsx(i.Fragment,{children:e.map(r=>{const u=U(r.path,r.kind),f=r.kind==="directory",d=f&&E.includes(r.path),y=f&&Ne.includes(r.path),N=Me[r.path]??[],pe=ee?an(N,Me,W.statusByPath,W.changedDirs):N,Mi=xt.has(r.path),Ri=zt===r.path,ct=W.statusByPath.get(r.path.replace(/\\/g,"/")),Wn=f&&W.changedDirs.has(r.path.replace(/\\/g,"/")),Ti=(P==null?void 0:P.mode)==="cut"&&P.items.some(be=>be.path===r.path);return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-active":Ri,"data-selected":Mi,"data-cut-pending":Ti||void 0,"data-kind":r.kind,"aria-expanded":f?d:void 0,style:{paddingInlineStart:`${fa+a*da}px`},onClick:be=>{if(f){if(be.shiftKey||jt(be)){Se(),ze(u,be);return}Se(),ze(u,be),kn(r.path);return}Ci(r.path,be)},onContextMenu:be=>{An(be,r)},children:[i.jsx("span",{className:`file-tree-chevron${f?"":" is-hidden"}`,"aria-hidden":"true",children:d?"v":">"}),f?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":Tt(r.name),"aria-hidden":"true",children:Rt(r.name)}),i.jsx("span",{className:"file-tree-label","data-status":ct??void 0,"data-has-changes":Wn||void 0,children:r.name}),!f&&ct?i.jsx("span",{className:"git-status-badge","data-status":ct,"aria-label":ct,children:ct}):null,f&&Wn?i.jsx("span",{className:"file-tree-dir-badge","aria-hidden":"true"}):null,y?i.jsx("span",{className:"file-tree-meta",children:o("common.loading")}):null]}),f&&d?i.jsx("div",{className:"file-tree-children",children:y&&!N.length?i.jsx("p",{className:"file-tree-empty",children:o("common.loading")}):pe.length?Zt(pe,a+1):i.jsx("p",{className:"file-tree-empty",children:o("conversation.filePanelEmptyDirectory")})}):null]},`${r.kind}-${r.path}`)})})}function ki(e){return i.jsx(i.Fragment,{children:e.map(a=>{const r=a.kind==="directory",u=xt.has(a.path),f=zt===a.path;return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":f,"data-selected":u,"data-kind":a.kind,onClick:d=>{ji(a,d)},onContextMenu:d=>{An(d,a)},children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),r?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":Tt(a.name),"aria-hidden":"true",children:Rt(a.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:a.name}),i.jsx("span",{className:"file-tree-path",children:a.path})]})]})},`search-${a.kind}-${a.path}`)})})}return i.jsx("section",{className:["conversation-panel","surface-card","file-panel",t].filter(Boolean).join(" "),"data-testid":"file-context-panel",children:l?i.jsxs(i.Fragment,{children:[i.jsx(qi,{workspaceId:l,filePath:le,open:le!==null,onClose:()=>{ce.current+=1,Ae(null),oe(null)},onSaved:async e=>{await we(),await he(e),Ee(a=>a+1)},diffContent:hi,showDetachAction:Ce.isDesktop&&Ce.bridge.supported,onDetach:()=>{le&&Pi(le)}}),s?null:i.jsx("div",{className:"file-panel-heading-row",children:i.jsx("h2",{className:"file-panel-heading",children:o("conversation.filePanelTitle")})}),m?null:i.jsxs("div",{className:"file-panel-tabs",role:"tablist","aria-label":o("conversation.filePanelTitle"),children:[i.jsx("button",{className:O==="workspace"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":O==="workspace",onClick:()=>Ze("workspace"),children:o("conversation.filePanelWorkspaceTab")}),i.jsxs("button",{className:O==="session"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":O==="session",onClick:()=>{$e&&Ze("session")},disabled:!$e,children:[o("conversation.filePanelSessionTab"),i.jsx("span",{className:"file-panel-tab-badge","aria-label":`${o("conversation.filePanelSessionTab")} ${sn}`,children:sn})]})]}),O==="workspace"?i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:mn,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:e=>void Si(e)}),bn?i.jsx("div",{className:"file-panel-toolbar file-panel-toolbar-mobile","aria-label":o("conversation.filePanelTitle"),children:i.jsxs("div",{className:"file-mobile-action-shell",ref:hn,children:[i.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":o("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":et,"data-active":et,onClick:()=>{I(!1),L(e=>!e)},children:[i.jsx("span",{children:o("conversation.filePanelActionsMenu")}),i.jsx(Xa,{})]}),et?i.jsxs("div",{className:"file-mobile-action-menu",role:"menu","aria-label":o("conversation.filePanelActionsMenu"),children:[i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>J(()=>me("copy")),disabled:!Te,children:o("conversation.filePanelCopy")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>J(()=>me("cut")),disabled:!Te,children:o("conversation.filePanelCut")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>J(()=>st()),disabled:!lt||p||v,children:o("conversation.filePanelPaste")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),Tn()},children:Ye?o("conversation.filePanelHideSearch"):o("conversation.filePanelShowSearch")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),Ot(e=>!e)},disabled:vt.length===0,children:ee?o("conversation.filePanelShowAll"):o("conversation.filePanelFilterChanges")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>J(Rn),disabled:Fe||p||pt,children:o("conversation.filePanelRefresh")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),Fn()},disabled:!Pn,children:o("conversation.filePanelCollapseCurrent")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),_n()},disabled:p||v,children:o("conversation.filePanelUpload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>J(Xt),disabled:!yn||v,children:o("conversation.filePanelDownload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>J(Jt),disabled:!gn||p||v,children:o("conversation.filePanelRenameMove")}),i.jsx("button",{className:"file-mobile-action-menu-item danger",type:"button",role:"menuitem",onClick:()=>J(Qt),disabled:!xn||p||v,children:o("conversation.filePanelDelete")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>J(()=>Ke("create_file")),disabled:p||v,children:o("conversation.filePanelNewFile")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>J(()=>Ke("create_directory")),disabled:p||v,children:o("conversation.filePanelNewDirectory")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>J(()=>Ge("absolute")),disabled:!Ut,children:o("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>J(()=>Ge("relative")),disabled:!Ut,children:o("conversation.filePanelCopyRelativePath")})]}):null]})}):i.jsxs("div",{className:"file-panel-toolbar","aria-label":o("conversation.filePanelTitle"),children:[i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCopy"),"aria-label":o("conversation.filePanelCopy"),onClick:()=>me("copy"),disabled:!Te,children:i.jsx(Wa,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCut"),"aria-label":o("conversation.filePanelCut"),onClick:()=>me("cut"),disabled:!Te,children:i.jsx($a,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelPaste"),"aria-label":o("conversation.filePanelPaste"),onClick:()=>void st(),disabled:!lt||p||v,children:i.jsx(Oa,{})}),i.jsxs("div",{className:"file-toolbar-menu-shell",ref:dn,children:[i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCopyPath"),"aria-label":o("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":Ie,"data-active":Ie,onClick:()=>{L(!1),I(e=>!e)},disabled:!Ut,children:i.jsx(Ba,{})}),Ie?i.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Ge("absolute"),children:o("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Ge("relative"),children:o("conversation.filePanelCopyRelativePath")})]}):null]}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCollapseCurrent"),"aria-label":o("conversation.filePanelCollapseCurrent"),onClick:Fn,disabled:!Pn,children:i.jsx(Aa,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelRefresh"),"aria-label":o("conversation.filePanelRefresh"),onClick:()=>void Rn(),disabled:Fe||p||pt,children:i.jsx(La,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelSearchButton"),"aria-label":o("conversation.filePanelSearchButton"),"data-active":Ye,onClick:Tn,disabled:Fe,children:i.jsx(Zn,{})}),vt.length>0?i.jsx("button",{className:"file-toolbar-button",type:"button",title:ee?o("conversation.filePanelShowAll"):o("conversation.filePanelFilterChanges"),"aria-label":ee?o("conversation.filePanelShowAll"):o("conversation.filePanelFilterChanges"),"data-active":ee,onClick:()=>Ot(e=>!e),children:i.jsx(qa,{})}):null,i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelUpload"),"aria-label":o("conversation.filePanelUpload"),onClick:_n,disabled:p||v,children:i.jsx(Va,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelDownload"),"aria-label":o("conversation.filePanelDownload"),onClick:()=>void Xt(),disabled:!yn||v,children:i.jsx(za,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelRenameMove"),"aria-label":o("conversation.filePanelRenameMove"),onClick:()=>Jt(),disabled:!gn||p||v,children:i.jsx(Ga,{})}),i.jsx("button",{className:"file-toolbar-button danger",type:"button",title:o("conversation.filePanelDelete"),"aria-label":o("conversation.filePanelDelete"),onClick:()=>Qt(),disabled:!xn||p||v,children:i.jsx(Ua,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelNewFile"),"aria-label":o("conversation.filePanelNewFile"),onClick:()=>void Ke("create_file"),disabled:p||v,children:i.jsx(Ha,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelNewDirectory"),"aria-label":o("conversation.filePanelNewDirectory"),onClick:()=>void Ke("create_directory"),disabled:p||v,children:i.jsx(Ka,{})})]}),re&&typeof document<"u"?Fi.createPortal(i.jsx("div",{className:"file-web-context-menu",ref:Ht,role:"menu","aria-label":o("conversation.filePanelActionsMenu"),style:{left:`${(Pe==null?void 0:Pe.left)??Math.max(8,re.positionX)}px`,top:`${(Pe==null?void 0:Pe.top)??Math.max(8,re.positionY)}px`,maxHeight:Pe?`${Pe.maxHeight}px`:void 0},children:re.items.map(e=>i.jsx("button",{className:["file-web-context-menu-item",e.label===o("conversation.filePanelDelete")?"danger":""].filter(Boolean).join(" "),type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>{H(null),e.onSelect()},children:e.label},e.id))}),document.body):null,Cn?i.jsx("p",{className:"file-panel-clipboard-status","data-mode":P==null?void 0:P.mode,children:Cn}):null,Ye?i.jsxs("form",{className:"file-toolbar-search",onSubmit:e=>void wi(e),children:[i.jsx("input",{value:A,onChange:e=>Qe(e.target.value),placeholder:o("conversation.filePanelSearchPlaceholder")}),bn?i.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":o("conversation.filePanelSearchButton"),disabled:pt,children:o("conversation.filePanelSearchButton")}):i.jsx("button",{className:"file-toolbar-button",type:"submit",title:o("conversation.filePanelSearchButton"),"aria-label":o("conversation.filePanelSearchButton"),disabled:pt,children:i.jsx(Zn,{})})]}):null,i.jsx("div",{ref:mi,className:"file-tree","data-search-mode":fe,"data-scrollbar-autohide":"true",children:Fe&&He.length===0?i.jsx("p",{className:"file-tree-status status-text",children:o("common.loading")}):fe?Re!=null&&Re.length?ki(Re):i.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSearchEmpty")}):ee?yt.length?Zt(yt,0):i.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelNoChanges")}):He.length?Zt(He,0):i.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelEmptyDirectory")})}),i.jsx($n,{open:S!==null,title:(z==null?void 0:z.title)??"",description:z==null?void 0:z.description,onClose:Yt,children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:e=>void Ni(e),children:[i.jsx(Gi,{label:o("conversation.filePanelPathFieldLabel"),htmlFor:fn,description:(S==null?void 0:S.mode)==="rename"?S.target.path:(S==null?void 0:S.baseDirectory)||void 0,children:i.jsx("input",{id:fn,type:"text",value:$t??"",placeholder:o("conversation.filePanelPathFieldPlaceholder"),autoFocus:!0,onChange:e=>We(e.target.value)})}),i.jsxs(Xi,{children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:p,onClick:Yt,children:o("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:p||!($t??"").trim(),children:p?(z==null?void 0:z.pendingLabel)??o("common.loading"):(z==null?void 0:z.submitLabel)??o("common.save")})]})]})}),i.jsxs($n,{open:B!==null,title:o("conversation.filePanelDeleteConfirmTitle"),description:o("conversation.filePanelDeleteConfirmDescription"),onClose:()=>{p||Be(null)},children:[i.jsx("p",{className:"workbench-section-empty",children:B!=null&&B.length?B.length===1?((Bn=B[0])==null?void 0:Bn.kind)==="directory"?o("conversation.filePanelDeleteDirectoryConfirm",{path:B[0].path}):o("conversation.filePanelDeleteFileConfirm",{path:B[0].path}):o("conversation.filePanelDeleteSelectionConfirm",{count:B.length}):""}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:p,onClick:()=>Be(null),children:o("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:p,onClick:()=>{Di()},children:p?o("conversation.filePanelDeleting"):o("conversation.filePanelDelete")})]})]})]}):$e&&n?i.jsx(ia,{sessionId:n,workspaceId:l,showSystemFiles:V,selectedPath:je,refreshVersion:on,onCountChange:Vt,onSelectFile:he,onOpenFile:Ue}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:o("conversation.filePanelSessionNoSession")})})]}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:o("conversation.filePanelNoWorkspace")})})})}function ve(t){return t.includes("/")?t.split("/").slice(0,-1).join("/"):g}function dt(t,n=!1){const l=t.split("/").filter(Boolean),s=n?l.length:l.length-1,m=[];for(let h=0;h<s;h+=1)m.push(l.slice(0,h+1).join("/"));return m}function Un(t,n){return t||((n==null?void 0:n.kind)==="directory"?n.path:n!=null&&n.path?ve(n.path):g)}function Kn(t,n){return t?`${t}/${n}`:n}function ma(t){var n;return((n=t.split(/[/\\]/).pop())==null?void 0:n.trim())??""}function U(t,n){return{path:t,kind:n}}function Gn(t){return t[t.length-1]??null}function pa(t,n){return t.findIndex(s=>s.path===n.path)>=0?t.filter(s=>s.path!==n.path):[...t,n]}function ba(t,n,l){const s=t.findIndex(x=>x.path===l.path);if(s<0)return[l];const m=n?t.findIndex(x=>x.path===n):s;if(m<0)return[l];const h=Math.min(m,s),b=Math.max(m,s);return t.slice(h,b+1)}function jt(t){return!!(t!=null&&t.ctrlKey||t!=null&&t.metaKey)}function va(t){return t.ctrlKey||t.metaKey}function ya(t){if(!(t instanceof HTMLElement))return!1;const n=t.tagName.toLowerCase();return n==="input"||n==="textarea"||n==="select"||t.isContentEditable}function wt(t){const n=[...new Map(t.map(s=>[s.path,s])).values()].sort((s,m)=>s.path.localeCompare(m.path)),l=[];for(const s of n)l.some(m=>m.kind==="directory"&&Ft(m.path,s.path))||l.push(s);return l}function xa(t,n){return(t==null?void 0:t.kind)==="directory"?t.path:t!=null&&t.path?ve(t.path):n}function ga(t,n){let l=t;for(;l&&n.some(s=>s.kind==="directory"&&Ft(s.path,l));)l=ve(l);return l}function ri(t,n,l,s,m,h){const b=[];for(const x of t){if(b.push(U(x.path,x.kind)),x.kind!=="directory"||!l.includes(x.path))continue;const j=n[x.path]??[],_=s?an(j,n,m,h):j;b.push(...ri(_,n,l,s,m,h))}return b}function Pa(t,n,l){const s=Math.max(0,l.width),m=Math.max(0,l.height),h=Math.max(0,m-ne*2),b=Math.max(0,s-ne*2),x=Math.min(Math.max(n.width,0),b),j=Math.max(0,m-t.y-Ct-ne),_=Math.max(0,t.y-Ct-ne),M=j<n.height&&_>j,ye=en(Math.max(M?_:j,oa),0,h),K=Math.min(Math.max(n.height,0),ye),xe=M?t.y-Ct-K:t.y+Ct,ge=Math.max(ne,m-ne-K),G=Math.max(ne,s-ne-x);return{top:en(xe,ne,ge),left:en(t.x,ne,G),maxHeight:Math.max(0,ye)}}function en(t,n,l){return!Number.isFinite(t)||l<n?n:Math.min(Math.max(t,n),l)}function qe(t,n="posix"){return t?oi(t,n):"."}function Ca(t,n,l){const s=oi(t,l),m=qe(n,l).replace(/^\.[/\\]?/,"");if(!m)return s;const h=si(l),b=m.replace(/^[/\\]+/,"");return b?s.endsWith("/")||s.endsWith("\\")?`${s}${b}`:`${s}${h}${b}`:s}function ja(t){return/^[a-zA-Z]:[\\/]/.test(t)||t.includes("\\")?"windows":"posix"}function oi(t,n){return t&&(si(n)==="\\"?t.replace(/\//g,"\\"):t.replace(/\\/g,"/"))}function si(t){return t==="windows"?"\\":"/"}function Ft(t,n){return n===t||n.startsWith(`${t}/`)}function ci(t,n,l){return t===n?l:t.startsWith(`${n}/`)?`${l}${t.slice(n.length)}`:t}function wa(t,n,l){return t.map(s=>({...s,path:ci(s.path,n,l)}))}function Sa(t){return t.mode==="create_file"?{title:o("conversation.filePanelNewFile"),description:o("conversation.filePanelCreateFileDescription"),submitLabel:o("conversation.filePanelCreateFileSubmit"),pendingLabel:o("conversation.filePanelCreatingFile")}:t.mode==="create_directory"?{title:o("conversation.filePanelNewDirectory"),description:o("conversation.filePanelCreateDirectoryDescription"),submitLabel:o("conversation.filePanelCreateDirectorySubmit"),pendingLabel:o("conversation.filePanelCreatingDirectory")}:{title:o("conversation.filePanelRenameMove"),description:o("conversation.filePanelRenameDescription"),submitLabel:o("conversation.filePanelRenameSubmit"),pendingLabel:o("conversation.filePanelRenaming")}}async function Na(t){const n=await t.arrayBuffer(),l=new Uint8Array(n),s=32768;let m="";for(let h=0;h<l.length;h+=s){const b=l.subarray(h,h+s);m+=String.fromCharCode(...b)}return btoa(m)}function Da(t){const n=atob(t),l=new Uint8Array(n.length);for(let s=0;s<n.length;s+=1)l[s]=n.charCodeAt(s);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}function Ea(t,n){if(typeof document>"u")throw new Error(o("conversation.filePanelDownloadFailed"));const l=window.URL.createObjectURL(n),s=document.createElement("a");s.href=l,s.download=t,document.body.append(s),s.click(),s.remove(),window.URL.revokeObjectURL(l)}async function ka(t,n){var l;if(!(n.isDesktop&&(await n.bridge.writeClipboardText(t)).ok)){if(typeof navigator<"u"&&((l=navigator.clipboard)!=null&&l.writeText))try{await navigator.clipboard.writeText(t);return}catch{}if(!Ma(t))throw new Error(o("conversation.filePanelCopyPathFailed"))}}function Ma(t){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.top="-9999px",n.style.left="-9999px",n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(n)}}function Ra(t,n){return t&&dt(t,!0).every(m=>m in n)?t:g}function Xn(t,n){if(!n)return[];const l=dt(n,!0);return t.filter(s=>l.includes(s))}function St(t,n,l){const s=rn(n,l);return Object.entries(t).reduce((m,[h,b])=>(s.has(h)&&(m[h]=b),m),{})}function Ta(t,n,l){const m=[...rn(n,l)].filter(h=>h===g||h in t);return m.length?m:[g]}function rn(t,n){const l=new Set([g]),s=ui(n,dt(t,!0));for(const m of s){l.add(m);for(const h of dt(m,!0))l.add(h)}return l}function _a(t,n){const l=Object.keys(t),s=Object.keys(n);return l.length!==s.length?!1:l.every(m=>t[m]===n[m])}function Mt(t,n){return t.includes(n)?t:[...t,n]}function ui(t,n){return n.reduce((l,s)=>Mt(l,s),t)}function qn(t){return`file-panel.workspace-tree.${t}`}function Yn(t,n){return`file-panel.session-change-count.${t}.${n}`}function Jn(t,n){return Object.fromEntries(Object.keys(n).map(l=>[l,t[l]??null]))}function tn(t,n){return[...rn(n,t)]}function Q(t,n){return t instanceof In?t.message:n}function fi(t){return t instanceof Error&&t.message.startsWith("FILE_TREE_SNAPSHOT_TIMEOUT:")}function Qn(t){return fi(t)||t instanceof Error&&t.message.startsWith("FILE_TREE_ABORTED:")}function Fa(t){return new Promise(n=>{window.setTimeout(n,t)})}function Aa(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 4.5h11v2h-11zM2.5 7.5h7v2h-7zM2.5 10.5h4v2h-4z",fill:"currentColor"})})}function La(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M12.8 5.2A5.5 5.5 0 1 0 13.5 8h-1.8A3.7 3.7 0 1 1 10.6 5l-1.4 1.4h4V2l-1.4 1.4z",fill:"currentColor"})})}function Zn(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M11.2 10.1l3 3-1.1 1.1-3-3a5 5 0 1 1 1.1-1.1zM6.8 10.3a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z",fill:"currentColor"})})}function Ba(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3.5 4.3h5.2v1.4H4.9v5.4H3.5zm3.8-2.1h5.2v9.5H7.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M5.7 10.8h4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Wa(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M5 2.5h7.5v9H5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M3.5 5H2.4V13.5H10V12.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function $a(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M4.2 4.2a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8zm0 5.4a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8zm1-3.2 6.6 5.6M5.2 9.6l6.6-5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})}function Oa(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M4 3.5h8v10H4zM6 2.2h4v2H6z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M6 7.2h4M6 9.6h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Ha(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M4 1.5h5l3 3v10H4z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M9 1.5v3h3",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 6.5v5M5.5 9h5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Va(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"m5.5 5 2.5-2.5L10.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function za(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"m5.5 8.5 2.5 2.5 2.5-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ua(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 4.5h9M6.2 2.5h3.6l.6 1.4H13v1.2H3V3.9h2.6zM5.2 5.7v6.1m2.8-6.1v6.1m2.8-6.1v6.1M4.4 13.5h7.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ka(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M1.8 4.5h4l1.2 1.3h7.2v6.7H1.8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8.5 7.2v4M6.5 9.2h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Ga(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.2 11.9h2.2l5.9-5.9-2.2-2.2-5.9 5.9zM8.3 3.8l2.2 2.2M2.8 13.2h10.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Xa(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function qa(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M1.5 2h13l-5 6v5l-3 1.5V8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function an(t,n,l,s){const m=[];for(const h of t){const b=h.path.replace(/\\/g,"/");h.kind==="file"?l.has(b)&&m.push(h):di(b,n,l,s)&&m.push(h)}return m}function di(t,n,l,s,m){const h=m??new Set;if(h.has(t))return!1;h.add(t);const b=n[t];if(!b)return s.has(t);for(const x of b){const j=x.path.replace(/\\/g,"/");if(x.kind==="file"){if(l.has(j))return!0}else if(di(j,n,l,s,h))return!0}return!1}export{rl as FileContextPanel};
@@ -1,6 +0,0 @@
1
- import{b as l,t as n,j as e,A as qn}from"./index-CL97fwWB.js";import{u as ki,e as $i,f as Gi,g as Rn}from"./App-BOHBGFOd.js";import{b as Ui,ah as ut,c as Hn,bY as wn,w as Bi,S as Vi,bZ as Wi,b_ as zi,bI as Ki,b$ as Pn,c0 as Ii,c1 as Xi,bM as qi,c2 as Yi,bL as Zi,c3 as Ji,bK as Yn,c4 as Qi,bT as es,c5 as An,a0 as ts,$ as ns,a1 as is,c6 as ss,c7 as as,c8 as rs,A as os}from"./WorkbenchLayout-OFi6CWgH.js";import{b as ls,r as Wt,a as zt}from"./file-tree-icon-Mg1DiBRX.js";import{W as Oe}from"./WorkbenchModal-C7qoQElW.js";import{b as cs}from"./workbench-navigation-MEzCSmsK.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./DesktopModal-D_A8sgQU.js";import"./relay-entry-D-LfvdiX.js";import"./MobileSheet-5kZ-w-gU.js";const Ot=56,Dn=28,kt=72,dt=8,Ln=960,_n=60*1e3,Fn=20,On=9,kn=9,$t=68,O=12,mt=8,Kt=260,us=120,Gt=6e4,ht={authMode:"none",username:"",password:"",token:"",rememberOnHost:!1};function ks({className:a,workspaceId:i,panelActive:u=!0,externalWindowMode:h=!1,workbenchShellOverrides:g}){const j=ki(),f=$i(),b=Ui(),{subscribeGitSnapshot:x,requestGitRefresh:v,addGitSnapshotListener:R,requestNavigationRefresh:S,selectWorkspace:T,upsertNavigationSession:p}={...b,...g},[o,m]=l.useState(null),[y,H]=l.useState(null),[C,M]=l.useState([]),[F,P]=l.useState(0),[X,se]=l.useState(null),[xe,pt]=l.useState(!1),[U,be]=l.useState(null),[ae,q]=l.useState(null),[ye,je]=l.useState(""),[Ge,B]=l.useState(!1),[N,A]=l.useState(!1),[ai,Zt]=l.useState([]),[te,Jt]=l.useState(!0),[ne,z]=l.useState(!1),[k,ri]=l.useState(()=>typeof window<"u"?window.innerWidth<=Ln:!1),[xt,V]=l.useState([]),[Ce,K]=l.useState(null),[Ne,re]=l.useState("unstaged"),[ve,Y]=l.useState(null),[oe,Z]=l.useState(null),[oi,bt]=l.useState(!1),[li,yt]=l.useState(null),[ci,Ue]=l.useState(!1),[Qt,Be]=l.useState(null),[_,Se]=l.useState(null),[en,Te]=l.useState(null),[ui,Me]=l.useState(!1),[Ee,le]=l.useState(null),[ie,jt]=l.useState(!1),[di,ce]=l.useState(!1),[Ve,Ct]=l.useState("push"),[We,ze]=l.useState([]),[mi,Ke]=l.useState(!1),[Ie,Xe]=l.useState(new Set),[hi,ue]=l.useState(new Map),[qe,tn]=l.useState({}),[gi,de]=l.useState(!1),[Ye,nn]=l.useState(null),[D,J]=l.useState(ht),[sn,an]=l.useState("generic"),[rn,Ze]=l.useState(null),[$,Nt]=l.useState(null),[G,vt]=l.useState(null),[on,ln]=l.useState(Ot),[St,Tt]=l.useState(!1),[cn,Re]=l.useState(null),[fi,He]=l.useState(null),un=l.useRef(null),dn=l.useRef(null),mn=l.useRef(null),hn=l.useRef(null),gn=l.useRef(null),fn=l.useRef(null),Mt=l.useRef(null),we=l.useRef(new Map),Je=l.useRef(new Map),Pe=l.useRef(0),pn=l.useRef(u),xn=l.useRef(u),Qe=l.useRef(null),{showToast:E}=Gi(),bn=f.isDesktop&&!k;l.useEffect(()=>{ut("git_sidebar.props",{workspaceId:i,externalWindowMode:h})},[h,i]),l.useEffect(()=>{xn.current=u},[u]),l.useEffect(()=>{Zt([]),Jt(!0),P(0),se(null),pt(!1),q(null),je(""),z(!1),V([]),K(null),re("unstaged"),Y(null),Z(null),bt(!1),yt(null),Ue(!1),Be(null),Se(null),Te(null),Me(!1),le(null),jt(!1),ce(!1),Ct("push"),ze([]),Xe(new Set),ue(new Map),tn({}),de(!1),nn(null),J(ht),an("generic"),Ze(null),Nt(null),vt(null),Tt(!1),ln(Ot),Re(null),He(null),Je.current.clear(),we.current.clear()},[i]),l.useEffect(()=>{function t(){ri(window.innerWidth<=Ln)}return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[]),l.useEffect(()=>{if(!St)return;const t=document.body.style.cursor,s=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function r(d){vn(d.clientY)}function c(){Tt(!1)}return window.addEventListener("pointermove",r),window.addEventListener("pointerup",c),()=>{document.body.style.cursor=t,document.body.style.userSelect=s,window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",c)}},[St]),l.useEffect(()=>{var c,d;if(!(i!=null&&i.trim())){Qe.current=null,m(null),H(null),M([]),P(0),se(null),be(null),B(!1);return}const t=i.trim(),s=Hn(ke(t),_n),r=Bt(s);if(ut("git_sidebar.snapshot",{workspaceId:t,cached:r,cachedHistoryCount:((c=s==null?void 0:s.history)==null?void 0:c.length)??0,cachedChangedCount:((d=s==null?void 0:s.status)==null?void 0:d.changes.length)??0}),r&&s){Et(s,t),B(!1);return}Qe.current=null,wn(ke(t)),m(null),H(null),M([]),P(0),se(null),be(null),B(!0)},[i]),l.useEffect(()=>{if(i!=null&&i.trim())return R(t=>{var s,r,c;t.workspaceId===i.trim()&&(ut("git_sidebar.snapshot_received",{workspaceId:t.workspaceId,changedCount:((s=t.status)==null?void 0:s.changes.length)??0,historyCount:t.history.length,branchCount:(((r=t.branches)==null?void 0:r.local.length)??0)+(((c=t.branches)==null?void 0:c.remote.length)??0)}),Et(t,t.workspaceId),B(!1))})},[R,i]),l.useEffect(()=>{if(!(i!=null&&i.trim()))return;const t=i.trim(),s=Hn(ke(t),_n),r=Bt(s)?(s==null?void 0:s.revision)??null:null;x(t,{knownRevision:r}),xn.current&&I()},[v,x,i]),l.useEffect(()=>{const t=pn.current;pn.current=u,i!=null&&i.trim()&&!t&&u&&v(i.trim(),{knownRevision:y})},[u,v,y,i]),l.useEffect(()=>{const t=i==null?void 0:i.trim();if(!t||Qe.current!==t)return;const s={revision:y,status:o,history:C,historyTotalCount:F,historyNextCursor:X,branches:U};if(!Bt(s)){wn(ke(t));return}Bi(ke(t),s)},[U,C,X,F,y,o,i]),l.useEffect(()=>{if(!o||!ae)return;o.changes.find(s=>s.path===ae)||q(null)},[ae,o]),l.useEffect(()=>{xs(hn.current)},[ye]),l.useEffect(()=>{k||(V([]),K(null),Y(null),Ze(null))},[k]),l.useEffect(()=>{if(!o){V([]);return}const t=new Set(o.changes.map(s=>s.path));V(s=>s.filter(r=>t.has(r)))},[o]);function pi(){const t=mn.current;if(!t)return;t.querySelectorAll(".git-tree-shell").forEach(r=>{r.scrollTop=0})}function Et(t,s){Qe.current=(s==null?void 0:s.trim())??(i==null?void 0:i.trim())??null,H(typeof t.revision=="string"?t.revision:null),m(t.status),M(Array.isArray(t.history)?t.history:[]),P(typeof t.historyTotalCount=="number"?t.historyTotalCount:0),se(typeof t.historyNextCursor=="string"?t.historyNextCursor:null),be(t.branches??null)}function I(t){i!=null&&i.trim()&&(B(!0),ut("git_sidebar.refresh_requested",{workspaceId:i.trim(),resetTreeScroll:!1}),v(i.trim(),{knownRevision:y}))}async function Rt(t){if(!(i!=null&&i.trim()))return;const s=i.trim();B(!0);try{const[r,c,d]=await Promise.all([Ki(s),Pn(s,Fn,null),Ii(s)]);Et({status:r,history:c.items,historyTotalCount:c.totalCount,historyNextCursor:c.nextCursor,branches:d}),v(s),t!=null&&t.resetTreeScroll&&requestAnimationFrame(()=>{pi()})}catch(r){E({title:L(r,n("git.panelLoadFailed")),tone:"error"})}finally{B(!1)}}async function et(){if(!(!i||!X||xe)){pt(!0);try{const t=await Pn(i,Fn,X);M(s=>{const r=new Set(s.map(d=>d.commitHash)),c=t.items.filter(d=>!r.has(d.commitHash));return[...s,...c]}),P(t.totalCount),se(t.nextCursor)}catch(t){E({title:L(t,n("git.panelLoadFailed")),tone:"error"})}finally{pt(!1)}}}function xi(t){if(!te||xe||!X)return;const s=t.currentTarget;s.scrollHeight-s.scrollTop-s.clientHeight<=40&&et()}async function bi(){if(i){A(!0);try{const t=await zi(i,"ai");je(t.validation.normalizedDraft.subject||t.draft.subject)}catch(t){E({title:L(t,n("git.draftFailed")),tone:"error"})}finally{A(!1)}}}async function tt(t,s){if(i&&t.length){A(!0);try{const r=s?await Yi(i,t):await Zi(i,t);m(r),q(t[t.length-1]??null),V(c=>c.filter(d=>!t.includes(d))),K(null),I()}catch(r){B(!1),E({title:L(r,n("git.stageFailed")),tone:"error"})}finally{A(!1)}}}async function Ht(t){if(i&&t.length){A(!0);try{const s=await Qi(i,t);m(s),t.includes(ae??"")&&q(null),V(r=>r.filter(c=>!t.includes(c))),K(null),I()}catch(s){B(!1),E({title:L(s,n("git.discardFailed")),tone:"error"})}finally{A(!1)}}}async function yi(){if(!(!i||!ye.trim())){A(!0);try{await Xi(i,gs(ye)),E({title:n("git.commitSuccess"),tone:"success"}),je(""),q(null),I()}catch(t){E({title:L(t,n("git.commitFailed")),tone:"error"})}finally{A(!1)}}}async function ji(){if(i!=null&&i.trim()){A(!0),B(!0);try{const t=await Wi(i.trim());m(t),M([]),P(0),se(null),be(null),E({title:n("git.initSuccess"),tone:"success"}),I()}catch(t){E({title:L(t,n("git.initFailed")),tone:"error"})}finally{A(!1),B(!1)}}}async function wt(){const t=i==null?void 0:i.trim();if(!t)return[];const s=await ss(t);return(i==null?void 0:i.trim())!==t?[]:(ze(s),s)}async function nt(t){const s=await wt(),r=gt(s,t);if(!r){E({title:n("git.noRemotes"),tone:"error"});return}const c=qe[r.name]??null;nn(r.name),an(vs(s,r.name)),J(Cs((c==null?void 0:c.auth)??null,(c==null?void 0:c.rememberOnHost)??!1)),de(!0)}async function Ci(){if(i!=null&&i.trim()){Ke(!0);try{const t=await wt();if(t.length===0){E({title:n("git.noRemotes"),tone:"error"});return}if(t.length===1){await nt(t[0].name);return}Ct("auth"),Xe(new Set),ue(new Map),ce(!0)}catch(t){E({title:L(t,n("git.remoteFailed")),tone:"error"})}finally{Ke(!1)}}}function Ni(){const t=Ye==null?void 0:Ye.trim();if(!t){de(!1);return}const s=Ns(D),r=sn==="github"?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder");if(D.authMode==="basic"){if(!D.username.trim()){E({title:n("shell.cloneUsernamePlaceholder"),tone:"error"});return}if(!D.password){E({title:r,tone:"error"});return}}if(D.authMode==="token"&&!D.token){E({title:n("shell.cloneTokenPlaceholder"),tone:"error"});return}tn(c=>{if(!s){const{[t]:d,...w}=c;return w}return{...c,[t]:{auth:s,rememberOnHost:D.rememberOnHost}}}),de(!1),E({title:s?n("git.remoteAuthSaved"):n("git.remoteAuthCleared"),description:s&&D.rememberOnHost?n("git.remoteAuthRememberHint"):void 0,tone:"success"})}async function yn(){if(i){Ke(!0);try{const t=await wt();if(t.length===0){E({title:n("git.noRemotes"),tone:"error"});return}if(t.length===1){jn([t[0].name]);return}Ct("push"),Xe(new Set),ue(new Map),ce(!0)}catch(t){E({title:L(t,n("git.remoteFailed")),tone:"error"})}finally{Ke(!1)}}}async function jn(t){if(!i||t.length===0)return;A(!0),ue(new Map);const s=new Map;let r=!1;try{for(const c of t){const d=qe[c]??null;try{const w=await An(i,"push",c,d==null?void 0:d.auth,(d==null?void 0:d.rememberOnHost)??!1);s.set(c,{ok:!0,summary:w.summary}),d!=null&&d.rememberOnHost&&d.auth&&ze(Oi=>Oi.map(Ft=>Ft.name===c?{...Ft,credentialConfigured:!0}:Ft))}catch(w){if(r=!0,s.set(c,{ok:!1,summary:L(w,n("git.remoteFailed"))}),ue(new Map(s)),Kn(w)){nt(c);return}}}ue(s),I(),r||(E({title:n("git.pushAllSuccess",{count:String(t.length)}),tone:"success"}),ce(!1))}finally{A(!1)}}async function Pt(t){if(i){if(t==="push"){z(!1),yn();return}A(!0);try{const s=In(We),r=s?qe[s]??null:null,c=await An(i,t,void 0,r==null?void 0:r.auth,(r==null?void 0:r.rememberOnHost)??!1);E({title:c.summary,tone:"success"}),s&&(r!=null&&r.rememberOnHost)&&r.auth&&ze(d=>d.map(w=>w.name===s?{...w,credentialConfigured:!0}:w)),z(!1),I()}catch(s){if(Kn(s)){nt(In(We));return}E({title:L(s,n("git.remoteFailed")),tone:"error"})}finally{A(!1)}}}async function me(){if(i){A(!0);try{const t=await Ji(i);je(t.commitSubject??""),E({title:t.summary||n("git.undoLastCommitSuccess"),tone:"success"}),z(!1),I()}catch(t){E({title:L(t,n("git.undoLastCommitFailed")),tone:"error"})}finally{A(!1)}}}async function vi(t){if(i){A(!0);try{const s=await as(i,t,!1);be(s),z(!1),I()}catch(s){E({title:L(s,n("git.branchFailed")),tone:"error"})}finally{A(!1)}}}async function At(t){const s=i==null?void 0:i.trim();if(!s)throw new Error(n("git.panelLoadFailed"));const r=Je.current.get(t);if(r)return r;const c=await rs(s,t);return Je.current.set(t,c),c}async function Ae(t){Z(null),Y(null),yt(t),Be(null);const s=Je.current.get(t)??null;if(Se(s),Ue(!s),s)return;const r=Pe.current+1;Pe.current=r;try{const c=await At(t);if(Pe.current!==r)return;Se(c)}catch(c){if(Pe.current!==r)return;Be(L(c,n("git.commitDetailLoadFailed"))),Se(null)}finally{Pe.current===r&&Ue(!1)}}function Si(){yt(null),Ue(!1),Be(null),Se(null)}async function De(t){try{const s=await At(t);await W(s.versionLabel,n("git.copyCommitVersionSuccess"))}catch(s){E({title:L(s,n("git.commitDetailLoadFailed")),tone:"error"})}}function Le(t){Z(null),Y(null),Te(t),le(null),Me(!0)}function Ti(t){var r;const s=((r=C[0])==null?void 0:r.commitHash)===t.commitHash&&t.commitKind==="local";return[{id:`view-changes:${t.commitHash}`,label:n("git.viewCommitChanges"),onSelect:()=>void Ae(t.commitHash)},{id:`copy-hash:${t.commitHash}`,label:n("git.copyCommitHash"),onSelect:()=>void W(t.commitHash,n("git.copyCommitHashSuccess"))},{id:`copy-message:${t.commitHash}`,label:n("git.copyCommitMessage"),onSelect:()=>void W(pe(t),n("git.copyCommitMessageSuccess"))},{id:`copy-version:${t.commitHash}`,label:n("git.copyCommitVersion"),onSelect:()=>void De(t.commitHash)},{id:`explain:${t.commitHash}`,label:n("git.explainCommitAction"),onSelect:()=>Le(t.commitHash)},...s?[{id:`undo:${t.commitHash}`,label:n("git.undoLastCommit"),disabled:N,onSelect:()=>void me()}]:[]]}async function Cn(t){Z(null),Y(null),await es(Ti(t))}async function Mi(){var t,s;if(!(!i||!en||!Ee||ie)){jt(!0);try{const r=await At(en),c=await ts({workspaceId:i,provider:Ee,content:ps(r),clientRequestId:((s=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:s.call(t))??`git-explain-${Date.now()}-${Math.random().toString(16).slice(2)}`,permissionMode:ns()}),d=c.session??await is(c.sessionId);p(d),S(),T(d.workspaceId),j(cs(d.workspaceId,d.sessionId)),Me(!1),Te(null),le(null),E({title:n("git.explainCommitStarted"),tone:"success"})}catch(r){E({title:L(r,n("git.explainCommitFailed")),tone:"error"})}finally{jt(!1)}}}function it(t){Zt(s=>s.includes(t)?s.filter(r=>r!==t):[...s,t])}const Ei=450;function Nn(t){const s=Date.now(),r=un.current;return un.current={filePath:t,timestamp:s},(r==null?void 0:r.filePath)===t&&s-r.timestamp<=Ei}async function st(t,s){if(s.binary){E({title:n("git.binaryDiff"),tone:"info"});return}if(s.status==="A"||s.status==="?")He(null),Re(t);else if(i)try{const r=await qi(i,t,s.staged);He(r.content),Re(t)}catch{He(null),Re(t)}}function at(t){q(t),K(null),V(s=>s.includes(t)?s.filter(r=>r!==t):[...s,t])}function vn(t){const s=dn.current;if(!s||!Number.isFinite(t))return;const r=s.getBoundingClientRect(),c=r.height-dt;if(!Number.isFinite(r.top)||!Number.isFinite(r.height)||c<=0)return;const d=(t-r.top-dt/2)/c*100;if(!Number.isFinite(d))return;const w=Math.max(Dn,Math.min(kt,Math.round(d)));ln(w)}function Ri(t){t.preventDefault(),vn(t.clientY),Tt(!0)}const _e=(o==null?void 0:o.changes)??[],Q=_e.filter(t=>It(t,"staged")),he=_e.filter(t=>It(t,"unstaged")),Sn=Wn(Q,"staged"),Tn=Wn(he,"unstaged"),rt=new Set(ai),ot=new Set(xt),ge=zn(xt,_e,"staged"),fe=zn(xt,_e,"unstaged"),Dt=_e.length===0&&((o==null?void 0:o.snapshot.ahead)??0)>0,Hi=Q.length>0&&ye.trim().length>0,lt=(U==null?void 0:U.currentBranch)??(o==null?void 0:o.snapshot.branch)??n("common.unknown"),ct=gt(We,Ye),Fe=sn==="github",wi=Fe?n("git.remoteAuthDescriptionGithub"):n("git.remoteAuthDescription"),Pi=Fe?n("git.remoteAuthGithubPatLabel"):n("shell.clonePasswordLabel"),Ai=Fe?n("git.remoteAuthGithubPatPlaceholder"):n("shell.clonePasswordPlaceholder"),Di=Fe?n("git.remoteAuthGithubUsernamePlaceholder"):n("shell.cloneUsernamePlaceholder"),Lt=Number.isFinite(on)?on:Ot,Li=te?`minmax(120px, ${Lt}fr) ${dt}px minmax(140px, ${100-Lt}fr)`:`minmax(120px, 1fr) ${dt}px auto`,_i=ys(o);l.useEffect(()=>{Ce==="staged"&&ge.length===0&&K(null),Ce==="unstaged"&&fe.length===0&&K(null)},[Ce,ge.length,fe.length]),l.useEffect(()=>{if(!k)return;const t=he.length>0?"unstaged":Q.length>0?"staged":"history";re(s=>s==="unstaged"&&he.length>0||s==="staged"&&Q.length>0?s:t)},[k,Q.length,he.length]),l.useEffect(()=>{ve&&(C.some(t=>t.commitHash===ve)||Y(null))},[C,ve]),l.useEffect(()=>{oe&&(C.some(t=>t.commitHash===oe)||Z(null))},[oe,C]),l.useEffect(()=>{k&&Ne!=="history"&&ne&&z(!1)},[k,ne,Ne]),l.useLayoutEffect(()=>{if(k||!ne){Nt(null);return}function t(){const r=gn.current,c=fn.current;!r||!c||typeof window>"u"||Nt(Xn(r.getBoundingClientRect(),{width:c.getBoundingClientRect().width||Kt,height:c.getBoundingClientRect().height||c.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}t();const s=window.requestAnimationFrame(t);return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.cancelAnimationFrame(s),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[N,U==null?void 0:U.local.length,lt,k,ne]);const ee=ve??oe;l.useLayoutEffect(()=>{if(!ee){vt(null);return}const t=ee;function s(){const c=we.current.get(t)??null,d=Mt.current;!c||!d||typeof window>"u"||vt(Xn(c.getBoundingClientRect(),{width:d.getBoundingClientRect().width||Kt,height:d.getBoundingClientRect().height||d.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}s();const r=window.requestAnimationFrame(s);return window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.cancelAnimationFrame(r),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[ee,C.length]),l.useEffect(()=>{if(!ee||typeof document>"u")return;const t=ee;function s(r){const c=r.target;if(!(c instanceof Node))return;const d=we.current.get(t)??null,w=Mt.current;d!=null&&d.contains(c)||w!=null&&w.contains(c)||(Y(null),Z(null))}return document.addEventListener("pointerdown",s),()=>{document.removeEventListener("pointerdown",s)}},[ee]);async function W(t,s){var r;try{if(f.isDesktop&&(await f.bridge.writeClipboardText(t)).ok){E({title:s,tone:"success"});return}if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText)){await navigator.clipboard.writeText(t),E({title:s,tone:"success"});return}if(fs(t)){E({title:s,tone:"success"});return}}catch{E({title:n("common.copyContentFailed"),tone:"error"})}}async function Mn(t,s){typeof window<"u"&&!window.confirm(n("git.discardConfirm",{path:s}))||await Ht(t)}function En(t){const s=(t==null?void 0:t.desktopFloating)===!0&&!k,r=s?{top:($==null?void 0:$.top)??O,left:($==null?void 0:$.left)??O,maxHeight:$==null?void 0:$.maxHeight,transformOrigin:($==null?void 0:$.transformOrigin)??"top right"}:void 0,c=e.jsxs("div",{ref:s?fn:void 0,className:"git-operations-menu","data-floating":s?"true":"false",style:r,children:[e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.currentBranch")}),e.jsx("strong",{className:"git-menu-branch",children:lt})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.remoteAuthStatusLabel")}),e.jsxs("div",{className:"git-menu-branch-list",children:[e.jsx("strong",{className:"git-menu-branch",children:n("git.remoteAuthManageHint")}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||mi,onClick:()=>void Ci(),children:e.jsx("span",{children:n("git.remoteAuthAction")})})]})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.branchTitle")}),e.jsx("div",{className:"git-menu-branch-list",children:U==null?void 0:U.local.map(d=>e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||d.current,onClick:()=>void vi(d.name),children:e.jsx("span",{children:d.current?`${n("git.switchBranch")} ${d.name}`:`${n("git.switchBranchTo")} ${d.name}`})},d.name))})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>{z(!1),bt(!0)},children:e.jsx("span",{children:n("git.viewAllVersions")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void Pt("fetch"),children:e.jsx("span",{children:n("git.fetch")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void Pt("pull"),children:e.jsx("span",{children:n("git.pull")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void Pt("push"),children:e.jsx("span",{children:n("git.push")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N,onClick:()=>void me(),children:e.jsx("span",{children:n("git.undoLastCommit")})}),e.jsx("button",{className:"git-menu-item",type:"button",disabled:N||Ge,onClick:()=>void Rt({resetTreeScroll:!0}),children:e.jsx("span",{children:n("git.refresh")})})]})]});return s?typeof document>"u"?null:Rn.createPortal(c,document.body):c}function _t(t,s){if(s){we.current.set(t,s);return}we.current.delete(t)}function Fi(){var r;if(!ee||typeof document>"u")return null;const t=C.find(c=>c.commitHash===ee);if(!t)return null;const s=((r=C[0])==null?void 0:r.commitHash)===t.commitHash&&t.commitKind==="local";return Rn.createPortal(e.jsx("div",{ref:Mt,className:"git-history-entry-menu","data-floating":"true",style:{top:(G==null?void 0:G.top)??O,left:(G==null?void 0:G.left)??O,maxHeight:G==null?void 0:G.maxHeight,transformOrigin:(G==null?void 0:G.transformOrigin)??"top right"},children:e.jsx(ms,{item:t,canUndo:s,actioning:N,onViewCommitChanges:c=>void Ae(c),onCopyCommitHash:c=>void W(c,n("git.copyCommitHashSuccess")),onCopyCommitMessage:c=>void W(pe(c),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:c=>void De(c),onExplainCommitChange:c=>void Le(c),onUndoLastCommit:()=>void me()})}),document.body)}return o&&!_i?e.jsx("section",{className:["conversation-panel","surface-card","git-sidebar",a].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:e.jsxs("section",{className:"git-card git-scaffold-section git-disabled-state",children:[e.jsxs("div",{className:"git-disabled-copy",children:[e.jsx("h3",{children:n("git.uninitializedTitle")}),e.jsx("p",{children:n("git.uninitializedDescription")})]}),e.jsx("div",{className:"git-primary-actions",children:e.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>void ji(),disabled:N||Ge||!i,children:N?n("git.initInProgress"):n("git.initRepository")})})]})}):e.jsxs("section",{className:["conversation-panel","surface-card","git-sidebar",a].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:[e.jsxs("section",{className:"git-card git-scaffold-section",children:[e.jsxs("div",{className:"git-editor-row",children:[e.jsx("textarea",{ref:hn,rows:1,value:ye,onChange:t=>je(ti(t.target.value)),onKeyDown:t=>{t.key==="Enter"&&t.preventDefault()},placeholder:n("git.commitSubjectPlaceholder")}),e.jsx("button",{className:"git-icon-button",type:"button","aria-label":n("git.generateDraft"),title:n("git.generateDraft"),onClick:()=>void bi(),disabled:N||Ge,children:e.jsx(Ms,{})})]}),e.jsxs("div",{className:"git-primary-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void Rt({resetTreeScroll:!0}),disabled:N||Ge||!i,children:n("git.refreshNow")}),e.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Dt){yn();return}yi()},disabled:N||!Dt&&!Hi,children:Dt?n("git.pushNow"):n("git.commitNow")})]})]}),k?e.jsxs("div",{className:"git-mobile-sections",children:[e.jsx(Ut,{title:n("git.stagedChangesTitle"),count:Q.length,expanded:Ne==="staged",onToggle:()=>re("staged"),children:e.jsx(Gn,{title:n("git.stagedChangesTitle"),nodes:Sn,collapsedTreePathSet:rt,onToggleTreePath:it,onToggleMobileSelection:at,selectedMobilePathSet:ot,selectedTargets:ge,actioning:N,variant:"staged",swipeRowState:rn,onSwipeRowChange:Ze,onStageToggle:tt,onDiscardWithConfirm:Mn,onClearSelectedTargets:()=>V(t=>t.filter(s=>!ge.includes(s))),onPreviewFile:st})}),e.jsx(Ut,{title:n("git.changesTitle"),count:he.length,expanded:Ne==="unstaged",onToggle:()=>re("unstaged"),children:e.jsx(Gn,{title:n("git.changesTitle"),nodes:Tn,collapsedTreePathSet:rt,onToggleTreePath:it,onToggleMobileSelection:at,selectedMobilePathSet:ot,selectedTargets:fe,actioning:N,variant:"unstaged",swipeRowState:rn,onSwipeRowChange:Ze,onStageToggle:tt,onDiscardWithConfirm:Mn,onClearSelectedTargets:()=>V(t=>t.filter(s=>!fe.includes(s))),onPreviewFile:st})}),e.jsxs(Ut,{title:n("git.recentVersionsTitle"),count:F,expanded:Ne==="history",onToggle:()=>re("history"),trailingContent:e.jsx("span",{className:"badge",children:lt}),headerAction:e.jsx("button",{className:"git-icon-button git-mobile-section-action",type:"button","aria-label":n("git.operationMenu"),title:n("git.operationMenu"),"aria-expanded":ne,onClick:()=>{re("history"),z(t=>!t)},disabled:N,children:e.jsx($e,{})}),children:[ne?e.jsx("div",{className:"git-mobile-operations-shell",children:En()}):null,e.jsx(ds,{history:C,historyLoadingMore:xe,hasMore:!!X,actioning:N,openCommitHash:ve,onMenuTriggerRef:_t,onToggleMenu:t=>Y(s=>s===t?null:t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void W(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void W(pe(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void De(t),onExplainCommitChange:t=>void Le(t),onUndoLastCommit:()=>void me(),onLoadMore:()=>void et()})]})]}):e.jsxs("div",{ref:dn,className:"git-content-split",style:{gridTemplateRows:Li},children:[e.jsx("section",{className:"git-card git-tree-panel",children:e.jsxs("div",{ref:mn,className:"git-tree-panel-body",children:[Q.length>0?e.jsx($n,{title:n("git.stagedChangesTitle"),count:Q.length,nodes:Sn,selectedPath:ae,collapsedTreePathSet:rt,onToggleTreePath:it,onSelectFile:q,onPreviewFile:(t,s)=>{Nn(t)&&st(t,s)},onToggleMobileSelection:at,onStageToggle:tt,onDiscard:Ht,actioning:N,variant:"staged",isMobileViewport:k,selectedMobilePathSet:ot,selectedTargets:ge,mobileActionMenuOpen:Ce==="staged",onToggleMobileActionMenu:()=>K(t=>t==="staged"?null:"staged"),onClearSelectedTargets:()=>V(t=>t.filter(s=>!ge.includes(s)))}):null,e.jsx($n,{title:n("git.changesTitle"),count:he.length,nodes:Tn,selectedPath:ae,collapsedTreePathSet:rt,onToggleTreePath:it,onSelectFile:q,onPreviewFile:(t,s)=>{Nn(t)&&st(t,s)},onToggleMobileSelection:at,onStageToggle:tt,onDiscard:Ht,actioning:N,variant:"unstaged",isMobileViewport:k,selectedMobilePathSet:ot,selectedTargets:fe,mobileActionMenuOpen:Ce==="unstaged",onToggleMobileActionMenu:()=>K(t=>t==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>V(t=>t.filter(s=>!fe.includes(s)))})]})}),e.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":n("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":Dn,"aria-valuemax":kt,"aria-valuenow":te?Lt:kt,"data-dragging":St,onPointerDown:Ri,children:e.jsx("span",{className:"git-panel-divider-handle","aria-hidden":"true"})}),e.jsxs("section",{className:"git-card git-history-section",children:[e.jsxs("div",{className:"git-history-topbar",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":te,"aria-label":te?n("git.collapseRecentVersions"):n("git.expandRecentVersions"),onClick:()=>Jt(t=>!t),children:[e.jsxs("span",{className:"git-section-toggle-main",children:[e.jsx(ft,{expanded:te}),e.jsx("span",{children:n("git.recentVersionsTitle")})]}),e.jsx("span",{className:"workbench-section-counter",children:F})]}),e.jsxs("div",{className:"git-history-actions",children:[e.jsx("span",{className:"badge",children:lt}),e.jsx("button",{className:"git-icon-button",type:"button",ref:gn,"aria-label":n("git.operationMenu"),title:n("git.operationMenu"),onClick:()=>z(t=>!t),disabled:N,children:e.jsx($e,{})}),ne?En({desktopFloating:!0}):null]})]}),te?e.jsx(Bn,{history:C,historyLoadingMore:xe,hasMore:!!X,actioning:N,openCommitHash:oe,useNativeContextMenu:bn,onMenuTriggerRef:_t,onScroll:xi,onToggleMenu:t=>{if(bn){const s=C.find(r=>r.commitHash===t);s&&Cn(s);return}Z(s=>s===t?null:t)},onOpenContextMenu:t=>void Cn(t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void W(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void W(pe(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void De(t),onExplainCommitChange:t=>void Le(t),onUndoLastCommit:()=>void me(),onLoadMore:()=>void et()}):null]})]}),e.jsxs(Oe,{open:di,title:Ve==="push"?n("git.selectRemoteTitle"):n("git.remoteAuthManageTitle"),description:Ve==="push"?n("git.selectRemoteDesc"):n("git.remoteAuthManageDescription"),onClose:()=>{N||ce(!1)},children:[e.jsx("div",{className:"git-remote-select-list",children:We.map(t=>{const s=Ie.has(t.name),r=hi.get(t.name),c=Ss(t,qe[t.name]??null);return e.jsxs("div",{className:"git-remote-item",children:[Ve==="push"?e.jsxs("label",{className:"git-remote-item-selector",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:N,onChange:()=>{Xe(d=>{const w=new Set(d);return w.has(t.name)?w.delete(t.name):w.add(t.name),w})}}),e.jsxs("span",{className:"git-remote-item-body",children:[e.jsx("span",{className:"git-remote-name",children:t.name}),e.jsx("span",{className:"git-remote-url",children:t.pushUrl}),r&&e.jsx("span",{className:`git-remote-result ${r.ok?"ok":"err"}`,children:r.summary})]})]}):e.jsx("div",{className:"git-remote-item-selector git-remote-item-selector-static",children:e.jsxs("span",{className:"git-remote-item-body",children:[e.jsx("span",{className:"git-remote-name",children:t.name}),e.jsx("span",{className:"git-remote-url",children:t.pushUrl}),r&&e.jsx("span",{className:`git-remote-result ${r.ok?"ok":"err"}`,children:r.summary})]})}),e.jsxs("div",{className:"git-remote-item-meta",children:[e.jsx("span",{className:`git-remote-credential-badge ${c.kind}`,children:c.label}),e.jsx("button",{className:"secondary-button git-remote-inline-action",type:"button",disabled:N,onClick:()=>void nt(t.name),children:n("git.remoteAuthAction")})]})]},t.name)})}),e.jsxs("div",{className:"git-remote-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",disabled:N,onClick:()=>ce(!1),children:n("common.close")}),Ve==="push"?e.jsx("button",{className:"primary-button",type:"button",disabled:N||Ie.size===0,onClick:()=>void jn(Array.from(Ie)),children:N?n("git.pushing"):n("git.pushSelected",{count:String(Ie.size)})}):null]})]}),e.jsxs(Oe,{open:gi,title:n("git.remoteAuthTitle"),description:wi,onClose:()=>{N||de(!1)},children:[ct?e.jsxs("div",{className:"git-remote-auth-target",children:[e.jsx("strong",{children:ct.name}),e.jsx("span",{children:ct.pushUrl||ct.fetchUrl})]}):null,e.jsxs("div",{className:"workbench-clone-form",children:[e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneAuthModeLabel")}),e.jsxs("select",{value:D.authMode,disabled:N,onChange:t=>J(s=>({...s,authMode:t.target.value})),children:[e.jsx("option",{value:"none",children:n("shell.cloneAuthModeNone")}),e.jsx("option",{value:"basic",children:n("shell.cloneAuthModeBasic")}),e.jsx("option",{value:"token",children:n("shell.cloneAuthModeToken")})]})]}),D.authMode==="basic"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneUsernameLabel")}),e.jsx("input",{type:"text",value:D.username,placeholder:Di,autoComplete:"username",onChange:t=>J(s=>({...s,username:t.target.value}))})]}),e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:Pi}),e.jsx("input",{type:"password",value:D.password,placeholder:Ai,autoComplete:"current-password",onChange:t=>J(s=>({...s,password:t.target.value}))})]})]}):null,D.authMode==="token"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneUsernameLabel")}),e.jsx("input",{type:"text",value:D.username,placeholder:n("shell.cloneTokenUsernamePlaceholder"),autoComplete:"username",onChange:t=>J(s=>({...s,username:t.target.value}))})]}),e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("shell.cloneTokenLabel")}),e.jsx("input",{type:"password",value:D.token,placeholder:n("shell.cloneTokenPlaceholder"),autoComplete:"current-password",onChange:t=>J(s=>({...s,token:t.target.value}))})]})]}):null,Fe?e.jsx("p",{className:"git-remote-auth-hint",children:n("git.remoteAuthGithubPatHint")}):null,D.authMode!=="none"?e.jsxs("label",{className:"settings-checkbox git-remote-auth-remember-toggle",children:[e.jsx("input",{type:"checkbox",checked:D.rememberOnHost,onChange:t=>J(s=>({...s,rememberOnHost:t.target.checked}))}),e.jsx("span",{children:n("git.remoteAuthRemember")})]}):null,e.jsx("p",{className:"git-remote-auth-hint",children:n("git.remoteAuthSessionHint")})]}),e.jsxs("div",{className:"git-remote-actions",children:[e.jsx("button",{className:"secondary-button",type:"button",disabled:N,onClick:()=>de(!1),children:n("common.close")}),e.jsx("button",{className:"primary-button",type:"button",disabled:N,onClick:Ni,children:n("git.remoteAuthSave")})]})]}),e.jsx(Oe,{open:oi,title:n("git.viewAllVersions"),description:n("git.viewAllVersionsDescription",{count:String(F)}),onClose:()=>bt(!1),children:e.jsx(Bn,{history:C,historyLoadingMore:xe,hasMore:!!X,actioning:N,openCommitHash:oe,className:"git-history-modal-list",onMenuTriggerRef:_t,onToggleMenu:t=>Z(s=>s===t?null:t),onViewCommitChanges:t=>void Ae(t),onCopyCommitHash:t=>void W(t,n("git.copyCommitHashSuccess")),onCopyCommitMessage:t=>void W(pe(t),n("git.copyCommitMessageSuccess")),onCopyCommitVersion:t=>void De(t),onExplainCommitChange:t=>void Le(t),onUndoLastCommit:()=>void me(),onLoadMore:()=>void et()})}),e.jsx(Oe,{open:li!==null,className:"git-commit-detail-modal",title:(_==null?void 0:_.subject)||n("git.commitDetailTitle"),description:_?n("git.commitDetailDescription",{hash:_.shortHash}):n("git.commitDetailLoading"),onClose:Si,children:ci?e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailLoading")})}):Qt?e.jsx("div",{className:"git-commit-detail-state is-error",children:e.jsx("p",{children:Qt})}):_?e.jsxs("div",{className:"git-commit-detail-shell",children:[e.jsxs("div",{className:"git-commit-detail-meta-grid",children:[e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitVersionLabel")}),e.jsx("strong",{children:_.versionLabel})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitHashLabel")}),e.jsx("strong",{children:_.commitHash})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitAuthorLabel")}),e.jsx("strong",{children:_.authorName})]}),e.jsxs("div",{className:"git-commit-detail-meta-card",children:[e.jsx("span",{children:n("git.commitTimeLabel")}),e.jsx("strong",{children:bs(_.authoredAt)})]})]}),e.jsxs("section",{className:"git-commit-detail-section",children:[e.jsx("div",{className:"git-commit-detail-section-header",children:e.jsx("h3",{children:n("git.commitMessageLabel")})}),e.jsx("pre",{className:"git-commit-detail-message",children:pe(_)})]}),e.jsxs("section",{className:"git-commit-detail-section",children:[e.jsxs("div",{className:"git-commit-detail-section-header",children:[e.jsx("h3",{children:n("git.changedFilesTitle")}),e.jsx("span",{className:"workbench-section-counter",children:_.changedFiles.length})]}),e.jsx("div",{className:"git-commit-detail-file-list",children:_.changedFiles.map(t=>e.jsxs("div",{className:"git-commit-detail-file-item",children:[e.jsx("span",{className:"git-commit-detail-file-status","data-status":t.status,children:t.status}),e.jsxs("div",{className:"git-commit-detail-file-copy",children:[e.jsx("strong",{children:t.path}),t.oldPath?e.jsx("span",{children:n("git.renamedFromLabel",{path:t.oldPath})}):null]})]},`${t.status}:${t.oldPath??""}:${t.path}`))})]}),e.jsxs("section",{className:"git-commit-detail-section",children:[e.jsxs("div",{className:"git-commit-detail-section-header",children:[e.jsx("h3",{children:n("git.commitDiffLabel")}),_.diffTruncated?e.jsx("span",{className:"git-commit-detail-truncated",children:n("git.diffTruncated")}):null]}),e.jsx("pre",{className:"git-commit-detail-diff",children:_.diffContent||n("git.emptyDiff")})]})]}):e.jsx("div",{className:"git-commit-detail-state",children:e.jsx("p",{children:n("git.commitDetailEmpty")})})}),e.jsx(Oe,{open:ui,className:"git-explain-provider-modal",title:n("git.explainCommitTitle"),description:n("git.explainCommitDescription"),onClose:()=>{ie||(Me(!1),Te(null),le(null))},children:e.jsxs("div",{className:"git-explain-provider-shell",children:[e.jsx(Vi,{workspaceId:i,selectedProvider:Ee,pendingProvider:ie?Ee:null,disabled:ie,onSelect:t=>le(t)}),e.jsxs("div",{className:"git-explain-provider-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:ie,onClick:()=>{Me(!1),Te(null),le(null)},children:n("common.cancel")}),e.jsx("button",{type:"button",className:"primary-button",disabled:!Ee||ie,onClick:()=>void Mi(),children:ie?n("conversation.sendingState"):n("git.startExplainCommit")})]})]})}),e.jsx(ls,{workspaceId:i,filePath:cn,open:cn!==null,onClose:()=>{Re(null),He(null)},onSaved:async()=>{await Rt({resetTreeScroll:!0})},diffContent:fi}),Fi()]})}function $n({title:a,count:i,nodes:u,selectedPath:h,collapsedTreePathSet:g,onToggleTreePath:j,onSelectFile:f,onPreviewFile:b,onToggleMobileSelection:x,onStageToggle:v,onDiscard:R,actioning:S,variant:T,isMobileViewport:p,selectedMobilePathSet:o,selectedTargets:m,mobileActionMenuOpen:y,onToggleMobileActionMenu:H,onClearSelectedTargets:C}){const M=Yn(),F=Yt(u),P=T==="staged"?n("git.unstageAll"):n("git.stageAll");return e.jsxs("section",{className:"git-tree-group","data-variant":T,children:[e.jsxs("div",{className:"git-section-header git-tree-group-header",children:[e.jsx("h3",{children:a}),e.jsxs("div",{className:"git-tree-group-actions",children:[e.jsx("span",{className:"workbench-section-counter",children:i}),!p&&F.length>0?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":P,title:P,onClick:()=>void v(F,T==="staged"),disabled:S,children:e.jsx(Xt,{staged:T==="staged"})}),T==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":n("git.discardAll"),title:n("git.discardAll"),onClick:()=>void R(F),disabled:S,children:e.jsx(qt,{})}):null]}):null,p&&m.length>0?e.jsx("button",{className:"git-icon-button",type:"button","aria-label":n("git.operationMenu"),title:n("git.operationMenu"),onClick:H,disabled:S,children:e.jsx($e,{})}):null]}),p&&y?e.jsxs("div",{className:"git-selection-menu",children:[e.jsxs("div",{className:"git-menu-section",children:[e.jsx("span",{className:"git-menu-caption",children:n("git.selectedFiles")}),e.jsx("strong",{className:"git-menu-branch",children:m.length})]}),e.jsxs("div",{className:"git-menu-section",children:[e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:()=>void v(m,T==="staged"),children:e.jsx("span",{children:T==="staged"?n("git.unstage"):n("git.stage")})}),T==="unstaged"?e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:()=>void R(m),children:e.jsx("span",{children:n("git.discard")})}):null,e.jsx("button",{className:"git-menu-item",type:"button",disabled:S,onClick:C,children:e.jsx("span",{children:n("git.clearSelection")})})]})]}):null]}),e.jsx("div",{ref:M,className:"git-tree-shell",role:"tree","aria-label":a,"data-scrollbar-autohide":"true",children:u.length?Jn({nodes:u,depth:0,collapsedTreePathSet:g,selectedPath:h,onToggleTreePath:j,onSelectFile:f,onPreviewFile:b,onToggleMobileSelection:x,onStageToggle:v,onDiscard:R,actioning:S,variant:T,isMobileViewport:p,selectedMobilePathSet:o}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function Ut({title:a,count:i,expanded:u,onToggle:h,trailingContent:g,headerAction:j,children:f}){return e.jsxs("section",{className:"git-mobile-section","data-expanded":u,children:[e.jsxs("div",{className:"git-mobile-section-header",children:[e.jsxs("button",{className:"git-mobile-section-toggle",type:"button","aria-expanded":u,onClick:h,children:[e.jsxs("span",{className:"git-mobile-section-toggle-main",children:[e.jsx(ft,{expanded:u}),e.jsx("h3",{children:a})]}),e.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[g,e.jsx("span",{className:"workbench-section-counter",children:i})]})]}),j?e.jsx("div",{className:"git-mobile-section-header-action",children:j}):null]}),u?e.jsx("div",{className:"git-mobile-section-body",children:f}):null]})}function Gn({title:a,nodes:i,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,selectedTargets:f,actioning:b,variant:x,swipeRowState:v,onSwipeRowChange:R,onStageToggle:S,onDiscardWithConfirm:T,onClearSelectedTargets:p,onPreviewFile:o}){return e.jsxs("div",{className:"git-mobile-record-shell",children:[f.length>0?e.jsxs("div",{className:"git-mobile-selection-toolbar",children:[e.jsxs("span",{className:"git-mobile-selection-count",children:[n("git.selectedFiles")," ",f.length]}),e.jsxs("div",{className:"git-mobile-selection-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",disabled:b,onClick:()=>void S(f,x==="staged"),children:x==="staged"?n("git.unstage"):n("git.stage")}),x==="unstaged"?e.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:b,onClick:()=>void T(f,`${f.length}`),children:n("git.discard")}):null,e.jsx("button",{type:"button",className:"secondary-button",disabled:b,onClick:p,children:n("git.clearSelection")})]})]}):null,e.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":a,children:i.length?Zn({nodes:i,depth:0,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,actioning:b,variant:x,swipeRowState:v,onSwipeRowChange:R,onStageToggle:S,onDiscardWithConfirm:T,onPreviewFile:o}):e.jsx("p",{className:"git-tree-status",children:n("git.noChanges")})})]})}function Zn({nodes:a,depth:i,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,actioning:f,variant:b,swipeRowState:x,onSwipeRowChange:v,onStageToggle:R,onDiscardWithConfirm:S,onPreviewFile:T}){return a.map(p=>{if(p.kind==="directory"){const y=!u.has(p.path),H=Yt(p.children),C=`directory:${p.path}`;return e.jsxs("div",{className:"git-mobile-record-branch",children:[e.jsx(Un,{rowKey:C,openState:(x==null?void 0:x.path)===C?x.direction:null,onOpenStateChange:M=>v(M?{path:C,direction:M}:null),trailingActions:H.length>0?[{label:b==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void R(H,b==="staged")},...b==="unstaged"?[{label:n("git.discard"),tone:"danger",onPress:()=>void S(H,p.path)}]:[]]:null,children:e.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${On+i*kn}px`},onClick:()=>h(p.path),children:[e.jsxs("span",{className:"git-mobile-record-leading",children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":y,children:e.jsx(ft,{expanded:y})}),e.jsx("span",{className:"git-mobile-record-title",children:p.name})]}),e.jsx("span",{className:"git-mobile-record-meta",children:H.length})]})}),y?e.jsx("div",{className:"git-mobile-record-children",role:"group",children:Zn({nodes:p.children,depth:i+1,collapsedTreePathSet:u,onToggleTreePath:h,onToggleMobileSelection:g,selectedMobilePathSet:j,actioning:f,variant:b,swipeRowState:x,onSwipeRowChange:v,onStageToggle:R,onDiscardWithConfirm:S,onPreviewFile:T})}):null]},C)}const o=`file:${p.path}`,m=j.has(p.path);return e.jsx(Un,{rowKey:o,openState:(x==null?void 0:x.path)===o?x.direction:null,onOpenStateChange:y=>v(y?{path:o,direction:y}:null),trailingActions:[{label:n("git.preview"),tone:"neutral",onPress:()=>T(p.change.path,p.change)},{label:b==="staged"?n("git.unstage"):n("git.stage"),tone:"accent",onPress:()=>void R([p.change.path],b==="staged")},...b==="unstaged"?[{label:n("git.discard"),tone:"danger",onPress:()=>void S([p.change.path],p.path)}]:[]],children:e.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":m,style:{paddingInlineStart:`${On+i*kn}px`},children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:m,"aria-label":`${n("git.selectFile")} ${p.name}`,onChange:()=>g(p.change.path)}),e.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>g(p.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":zt(p.name),"aria-hidden":"true",children:Wt(p.name)}),e.jsxs("span",{className:"git-mobile-record-copy",children:[e.jsx("span",{className:"git-mobile-record-title",children:p.name}),e.jsx("span",{className:"git-mobile-record-path",children:p.path})]}),e.jsx("span",{className:"git-status-badge","data-status":p.status,children:p.status})]})]})},o)})}function Un({rowKey:a,openState:i,onOpenStateChange:u,trailingActions:h,children:g}){const j=os(),f=l.useRef(null),[b,x]=l.useState(0),v=((h==null?void 0:h.length)??0)*$t;l.useEffect(()=>{i||x(0)},[i,a]);const R=b!==0?b:i==="trailing"?-v:0;function S(m){var y,H;m.button===0&&(f.current={pointerId:m.pointerId,startX:m.clientX},(H=(y=m.currentTarget).setPointerCapture)==null||H.call(y,m.pointerId))}function T(m){const y=f.current;if(!y||y.pointerId!==m.pointerId)return;const H=v>0?v+10:0,C=Math.max(-H,Math.min(0,m.clientX-y.startX));x(C)}function p(m){var H,C;const y=f.current;if(!(!y||y.pointerId!==m.pointerId)){if((C=(H=m.currentTarget).releasePointerCapture)==null||C.call(H,m.pointerId),f.current=null,b<=-44&&(h!=null&&h.length)){j.trigger("gesture"),u("trailing"),x(0);return}u(null),x(0)}}function o(m){var H,C;const y=f.current;!y||y.pointerId!==m.pointerId||((C=(H=m.currentTarget).releasePointerCapture)==null||C.call(H,m.pointerId),f.current=null,x(0))}return e.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":i??"closed","data-dragging":b!==0,children:[h==null?void 0:h.map((m,y)=>e.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":m.tone,style:{right:y*$t,width:$t},onClick:()=>{j.trigger(m.tone==="danger"?"warning":"action"),u(null),m.onPress()},children:m.label},`trailing-${y}`)),e.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${R}px)`},onPointerDown:S,onPointerMove:T,onPointerUp:p,onPointerCancel:o,children:g})]})}function ds({history:a,historyLoadingMore:i,hasMore:u,actioning:h,openCommitHash:g,onMenuTriggerRef:j,onToggleMenu:f,onViewCommitChanges:b,onCopyCommitHash:x,onCopyCommitMessage:v,onCopyCommitVersion:R,onExplainCommitChange:S,onUndoLastCommit:T,onLoadMore:p}){return a.length?e.jsxs("div",{className:"git-mobile-history-list",children:[a.map(o=>e.jsx("article",{className:"git-mobile-history-entry","data-kind":o.commitKind,children:e.jsxs("div",{className:"git-mobile-history-entry-main",children:[e.jsx("span",{className:"git-history-marker","data-kind":o.commitKind,"aria-hidden":"true"}),e.jsxs("div",{className:"git-mobile-history-copy",children:[e.jsxs("div",{className:"git-history-title-row",children:[e.jsx("strong",{title:o.subject,children:o.subject}),e.jsx("span",{className:"git-history-kind-badge","data-kind":o.commitKind,children:ni(o.commitKind)})]}),o.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:o.refs.map(m=>e.jsx("span",{className:"git-history-ref-pill","data-kind":m.kind,"data-remote-index":String(ii(m.remoteName)),children:m.name},`${o.commitHash}:${m.kind}:${m.name}`))}):null,e.jsxs("div",{className:"git-history-meta",children:[e.jsx("span",{className:"git-history-hash",children:o.commitHash.slice(0,8)}),e.jsx("span",{children:o.authorName}),e.jsx("time",{dateTime:o.authoredAt,children:si(o.authoredAt)})]})]}),e.jsx("button",{type:"button",className:"git-icon-button",ref:m=>j(o.commitHash,m),"aria-label":n("git.historyItemMenu"),onClick:()=>f(o.commitHash),children:e.jsx($e,{})})]})},o.commitHash)),u?e.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:i,onClick:p,children:i?`${n("git.refreshNow")}...`:n("common.loadMore")}):null]}):e.jsx("p",{className:"git-tree-status",children:n("git.noHistory")})}function Bn({history:a,historyLoadingMore:i,hasMore:u,actioning:h,openCommitHash:g,className:j,useNativeContextMenu:f=!1,onMenuTriggerRef:b,onScroll:x,onToggleMenu:v,onOpenContextMenu:R,onViewCommitChanges:S,onCopyCommitHash:T,onCopyCommitMessage:p,onCopyCommitVersion:o,onExplainCommitChange:m,onUndoLastCommit:y,onLoadMore:H}){const C=Yn();return a.length?e.jsxs("div",{ref:C,className:["git-history-list",j].filter(Boolean).join(" "),onScroll:x,"data-scrollbar-autohide":"true",children:[a.map(M=>{const F=g===M.commitHash;return e.jsxs("article",{className:"git-history-entry","data-kind":M.commitKind,"data-menu-open":F?"true":"false",onContextMenu:P=>{!f||!R||(P.preventDefault(),P.stopPropagation(),R(M))},children:[e.jsx("span",{className:"git-history-marker","data-kind":M.commitKind,"aria-hidden":"true"}),e.jsxs("div",{className:"git-history-body",children:[e.jsxs("div",{className:"git-history-title-row",children:[e.jsx("strong",{title:M.subject,children:M.subject}),e.jsxs("div",{className:"git-history-title-actions",children:[e.jsx("span",{className:"git-history-kind-badge","data-kind":M.commitKind,children:ni(M.commitKind)}),f?null:e.jsx("button",{type:"button",className:"git-icon-button git-history-more",ref:P=>b(M.commitHash,P),"aria-label":n("git.historyItemMenu"),onClick:()=>{v(M.commitHash)},children:e.jsx($e,{})})]})]}),M.refs.length>0?e.jsx("div",{className:"git-history-ref-list",children:M.refs.map(P=>e.jsx("span",{className:"git-history-ref-pill","data-kind":P.kind,"data-remote-index":String(ii(P.remoteName)),children:P.name},`${M.commitHash}:${P.kind}:${P.name}`))}):null,e.jsxs("div",{className:"git-history-meta",children:[e.jsx("span",{className:"git-history-hash",children:M.commitHash.slice(0,8)}),e.jsx("span",{children:M.authorName}),e.jsx("time",{dateTime:M.authoredAt,children:si(M.authoredAt)})]})]})]},M.commitHash)}),i?e.jsxs("p",{className:"git-history-loading",children:[n("git.refreshNow"),"..."]}):null,u?e.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:i,onClick:H,children:i?`${n("git.refreshNow")}...`:n("common.loadMore")}):null]}):e.jsx("p",{className:"status-text",children:n("git.noHistory")})}function ms({item:a,canUndo:i,actioning:u,onViewCommitChanges:h,onCopyCommitHash:g,onCopyCommitMessage:j,onCopyCommitVersion:f,onExplainCommitChange:b,onUndoLastCommit:x}){return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>h(a.commitHash),children:e.jsx("span",{children:n("git.viewCommitChanges")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>g(a.commitHash),children:e.jsx("span",{children:n("git.copyCommitHash")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>j(a),children:e.jsx("span",{children:n("git.copyCommitMessage")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>f(a.commitHash),children:e.jsx("span",{children:n("git.copyCommitVersion")})}),e.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>b(a.commitHash),children:e.jsx("span",{children:n("git.explainCommitAction")})}),i?e.jsx("button",{type:"button",className:"git-menu-item",disabled:u,onClick:x,children:e.jsx("span",{children:n("git.undoLastCommit")})}):null]})}function Jn({nodes:a,depth:i,collapsedTreePathSet:u,selectedPath:h,onToggleTreePath:g,onSelectFile:j,onPreviewFile:f,onToggleMobileSelection:b,onStageToggle:x,onDiscard:v,actioning:R,variant:S,isMobileViewport:T,selectedMobilePathSet:p}){return a.map(o=>{if(o.kind==="directory"){const H=!u.has(o.path),C=Yt(o.children),M=`${S==="staged"?n("git.unstage"):n("git.stage")} ${o.path}`,F=`${n("git.discard")} ${o.path}`;return e.jsxs("div",{className:"git-tree-node",children:[e.jsxs("div",{className:"git-tree-row",role:"treeitem","aria-expanded":H,children:[e.jsxs("button",{className:"git-tree-trigger",type:"button",style:{paddingInlineStart:`${6+i*8}px`},onClick:()=>g(o.path),children:[e.jsx("span",{className:"git-tree-chevron","data-expanded":H,children:e.jsx(ft,{expanded:H})}),e.jsx("span",{className:"git-tree-label git-tree-label-directory",children:o.name})]}),!T&&C.length>0?e.jsxs("div",{className:"git-row-actions",children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":M,title:M,onClick:()=>void x(C,S==="staged"),disabled:R,children:e.jsx(Xt,{staged:S==="staged"})}),S==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":F,title:F,onClick:()=>void v(C),disabled:R,children:e.jsx(qt,{})}):null]}):null]}),H?e.jsx("div",{className:"git-tree-children",role:"group",children:Jn({nodes:o.children,depth:i+1,collapsedTreePathSet:u,selectedPath:h,onToggleTreePath:g,onSelectFile:j,onPreviewFile:f,onToggleMobileSelection:b,onStageToggle:x,onDiscard:v,actioning:R,variant:S,isMobileViewport:T,selectedMobilePathSet:p})}):null]},`directory:${o.path}`)}const m=p.has(o.path),y=T?m:h===o.path;return T?e.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":y,"data-mobile":"true",children:[e.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:m,"aria-label":`${n("git.selectFile")} ${o.name}`,onChange:()=>b(o.change.path)}),e.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":y,"data-mobile":"true",style:{paddingInlineStart:`${18+i*8}px`},onClick:()=>b(o.change.path),children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":zt(o.name),"aria-hidden":"true",children:Wt(o.name)}),e.jsx("span",{className:"git-tree-label-wrap",children:e.jsx("span",{className:"git-tree-label",children:o.name})}),e.jsx("span",{className:"git-tree-file-meta",children:e.jsx("span",{className:"git-status-badge","data-status":o.status,children:o.status})})]})]},`file:${o.path}`):e.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":y,children:[e.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":y,style:{paddingInlineStart:`${18+i*8}px`},onClick:()=>{j(o.change.path),f&&f(o.change.path,o.change)},children:[e.jsx("span",{className:"git-tree-file-icon","data-kind":zt(o.name),"aria-hidden":"true",children:Wt(o.name)}),e.jsx("span",{className:"git-tree-label-wrap",children:e.jsx("span",{className:"git-tree-label",children:o.name})}),e.jsx("span",{className:"git-tree-file-meta",children:e.jsx("span",{className:"git-status-badge","data-status":o.status,children:o.status})})]}),e.jsxs("div",{className:"git-row-actions",children:[e.jsx("button",{className:"git-icon-button",type:"button","aria-label":o.variant==="staged"?n("git.unstage"):n("git.stage"),title:o.variant==="staged"?n("git.unstage"):n("git.stage"),onClick:()=>void x([o.change.path],o.variant==="staged"),disabled:R,children:e.jsx(Xt,{staged:o.variant==="staged"})}),S==="unstaged"?e.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":n("git.discard"),title:n("git.discard"),onClick:()=>void v([o.change.path]),disabled:R,children:e.jsx(qt,{})}):null]})]},`file:${o.path}`)})}function Vn(a,i){return{kind:"directory",name:a,path:i,children:new Map}}function Wn(a,i){const u=Vn("","");for(const h of a){const g=h.path.replace(/\\/g,"/"),j=g.split("/").filter(Boolean);let f=u;j.forEach((b,x)=>{const v=j.slice(0,x+1).join("/");if(x===j.length-1){f.children.set(`file:${v}`,{kind:"file",name:b,path:g,change:h,status:hs(h,i),variant:i});return}const R=`directory:${v}`,S=f.children.get(R);if(S&&S.kind==="directory"){f=S;return}const T=Vn(b,v);f.children.set(R,T),f=T})}return ei(Qn([...u.children.values()]))}function Qn(a){return[...a].sort((i,u)=>i.kind!==u.kind?i.kind==="directory"?-1:1:i.name.localeCompare(u.name,"zh-CN")).map(i=>i.kind==="directory"?{kind:"directory",name:i.name,path:i.path,children:Qn([...i.children.values()])}:i)}function ei(a){return a.map(i=>{var f;if(i.kind!=="directory")return i;const u=ei(i.children);let h=i.name,g=i.path,j=u;for(;j.length===1&&((f=j[0])==null?void 0:f.kind)==="directory";){const b=j[0];h=`${h}/${b.name}`,g=b.path,j=b.children}return{kind:"directory",name:h,path:g,children:j}})}function zn(a,i,u){const h=new Set(a);return i.filter(g=>It(g,u)&&h.has(g.path)).map(g=>g.path)}function Yt(a){const i=[],u=new Set;function h(g){if(g.kind==="file"){u.has(g.path)||(u.add(g.path),i.push(g.path));return}g.children.forEach(h)}return a.forEach(h),i}function It(a,i){return i==="staged"?!!a.stagedStatus:!!a.worktreeStatus}function hs(a,i){return i==="staged"?a.stagedStatus??a.status:a.worktreeStatus??a.status}function gs(a){return{subject:ti(a).trim(),body:null,footer:null,source:"manual"}}function ti(a){return a.replace(/[\r\n]+/g," ")}function fs(a){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const i=document.createElement("textarea");i.value=a,i.setAttribute("readonly","true"),i.style.position="fixed",i.style.top="-9999px",i.style.left="-9999px",i.style.opacity="0",document.body.appendChild(i),i.focus(),i.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(i)}}function pe(a){const i=a.subject.trim(),u=a.body.trim();return u?`${i}
2
-
3
- ${u}`:i}function ps(a){const i=a.changedFiles.map(g=>`- [${g.status}] ${g.path}${g.oldPath?` (from ${g.oldPath})`:""}`).join(`
4
- `),u=a.diffContent.length>Gt?a.diffContent.slice(0,Gt):a.diffContent,h=a.diffContent.length>Gt||a.diffTruncated?`
5
- 注意:diff 内容过长,下面已经截断,只分析可见部分,同时明确指出可能遗漏的区域。`:"";return["请你分析下面这个 Git 提交。","输出要求:","1. 先用 3 到 5 句话说明这次改动的核心目的。","2. 按文件说明关键改动点,不要泛泛而谈。","3. 指出潜在风险、边界情况和可能的回归点。","4. 如果提交信息写得差,给出一条更合适的中文提交说明。","",`版本号:${a.versionLabel}`,`Commit Hash:${a.commitHash}`,`提交标题:${a.subject}`,`提交作者:${a.authorName} <${a.authorEmail}>`,`提交时间:${a.authoredAt}`,"","变更文件:",i||"- 无",h,"","Diff:",u||"(empty diff)"].join(`
6
- `)}function xs(a){if(!a)return;a.style.height="0px";const i=Math.min(Math.max(a.scrollHeight,34),120);a.style.height=`${i}px`,a.style.overflowY=a.scrollHeight>120?"auto":"hidden"}function ni(a){switch(a){case"local":return n("git.historyKindLocal");case"remote":return n("git.historyKindRemote");default:return n("git.historyKindShared")}}function ii(a){if(!a)return 0;let i=0;for(const u of a)i=i*33+u.charCodeAt(0)>>>0;return i%6}function bs(a){const i=Date.parse(a);return Number.isNaN(i)?a:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(i)}function L(a,i){return a instanceof qn?js(a)??a.message:typeof a=="object"&&a&&"message"in a?a.message:i}function ke(a){return`git-sidebar.snapshot.${a}`}function Bt(a){return a?!!(a.status||a.branches||a.history.length>0||a.historyTotalCount>0||a.historyNextCursor||a.revision):!1}function ys(a){return a?a.snapshot.enabled!==!1:!0}function js(a){switch(a.errorCode){case"UNAUTHORIZED":return n("git.errors.unauthorized");case"WORKSPACE_NOT_FOUND":return n("git.errors.workspaceNotFound");case"INVALID_WORKSPACE":return n("git.errors.invalidWorkspace");case"NOT_GIT_REPOSITORY":return n("git.errors.notGitRepository");case"GIT_REPO_NOT_FOUND":return n("git.errors.repoNotFound");case"PATH_OUT_OF_WORKSPACE":return n("git.errors.pathOutOfWorkspace");case"INVALID_TARGET":return n("git.errors.invalidTarget");case"NOT_STAGED":return n("git.errors.notStaged");case"EMPTY_STAGED_CHANGES":return n("git.errors.emptyStagedChanges");case"BRANCH_CONFLICT":return n("git.errors.branchConflict");case"BRANCH_NOT_FOUND":return n("git.errors.branchNotFound");case"REMOTE_NOT_FOUND":return n("git.errors.remoteNotFound");case"GIT_REMOTE_AUTH_FAILED":return n("git.errors.remoteAuthFailed");case"GIT_PUSH_FAILED":return n("git.errors.pushFailed");case"GIT_PULL_FAILED":return n("git.errors.pullFailed");case"GIT_REMOTE_FAILED":return n("git.errors.remoteFailed");case"GIT_COMMAND_TIMEOUT":return n("git.errors.commandTimeout");case"GIT_INIT_FAILED":return n("git.errors.initFailed");case"GIT_DISCARD_FAILED":return n("git.discardFailed");case"GIT_UNDO_FAILED":return n("git.undoLastCommitFailed");default:return null}}function Kn(a){return a instanceof qn&&a.errorCode==="GIT_REMOTE_AUTH_FAILED"}function Cs(a,i=!1){return!a||!a.mode||a.mode==="none"?ht:a.mode==="basic"?{authMode:"basic",username:a.username??"",password:a.password??"",token:"",rememberOnHost:i}:a.mode==="token"?{authMode:"token",username:a.username??"",password:"",token:a.token??"",rememberOnHost:i}:ht}function Ns(a){return a.authMode==="none"?null:a.authMode==="basic"?{mode:"basic",username:a.username.trim(),password:a.password}:{mode:"token",username:a.username.trim()||void 0,token:a.token}}function vs(a,i){const u=gt(a,i);if(!u)return"generic";const h=u.pushUrl||u.fetchUrl;return Ts(h)?"github":"generic"}function gt(a,i){return a.find(u=>u.name===i)??a.find(u=>u.name==="origin")??a[0]??null}function In(a){var i;return(i=gt(a))==null?void 0:i.name}function Ss(a,i){return i!=null&&i.auth?{kind:"session",label:n("git.remoteAuthConfiguredInSession")}:a.credentialConfigured?{kind:"host",label:n("git.remoteAuthConfiguredOnHost")}:{kind:"missing",label:n("git.remoteAuthNotConfigured")}}function Ts(a){const i=(a==null?void 0:a.trim().toLowerCase())??"";return i.startsWith("https://github.com/")||i.startsWith("http://github.com/")||i.startsWith("ssh://git@github.com/")||i.startsWith("git@github.com:")}function Xn(a,i,u){const h=Math.max(0,u.width),g=Math.max(0,u.height),j=Math.max(0,g-O*2),f=Math.max(0,h-O*2),b=Math.min(Math.max(i.width||Kt,0),f),x=Math.max(0,g-a.bottom-mt-O),v=Math.max(0,a.top-mt-O),R=x<i.height&&v>x,T=Vt(Math.max(R?v:x,us),0,j),p=Math.min(Math.max(i.height,0),T),o=R?a.top-mt-p:a.bottom+mt,m=Math.max(O,g-O-p),y=Math.max(O,h-O-b);return{top:Vt(o,O,m),left:Vt(a.right-b,O,y),maxHeight:Math.max(0,T),transformOrigin:`${R?"bottom":"top"} right`}}function Vt(a,i,u){return!Number.isFinite(a)||u<i?i:Math.min(Math.max(a,i),u)}function ft({expanded:a}){return e.jsx("svg",{className:"git-chevron-icon",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:a?"rotate(0deg)":"rotate(-90deg)"},"aria-hidden":"true",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})}function Xt({staged:a}){return a?e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M5 12h14"})}):e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("path",{d:"M12 5v14"}),e.jsx("path",{d:"M5 12h14"})]})}function qt(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("path",{d:"M10 7L6 11l4 4",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M7 11h7c3.87 0 7 3.13 7 7 0 1.9-.76 3.63-2 4.89",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ms(){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"})})}function $e(){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function si(a){try{return new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(a))}catch{return a}}export{ks as GitSidebar,Xn as resolveGitOperationsMenuPosition};
@@ -1 +0,0 @@
1
- import{b as c,j as e,t as n}from"./index-CL97fwWB.js";import{M as k,q as j,s as f,t as g,u as M}from"./workbench-navigation-MEzCSmsK.js";import{M as S}from"./MobileSheet-5kZ-w-gU.js";import{A as v,S as L}from"./WorkbenchLayout-OFi6CWgH.js";function D({open:o,workspaces:l,workspaceOptions:t,initialWorkspaceId:d,onClose:b,onSelect:x}){const[a,u]=c.useState(""),[h,m]=c.useState(!1),p=v(),i=c.useMemo(()=>t??l.map(s=>({workspace:s,label:s.name,subtitle:s.path,depth:0,kind:"workspace",meta:null})),[t,l]),w=c.useMemo(()=>i.map(s=>s.workspace.id).join("|"),[i]);if(c.useEffect(()=>{o&&(u(N(i,d)),m(!1))},[d,o,w]),!o)return null;const r=i.find(s=>s.workspace.id===a)??i[0]??null;return e.jsxs(S,{open:o,title:n("shell.createSessionModalTitle"),description:n("shell.createSessionModalDescription"),kind:"form",height:"three-quarter",className:"mobile-create-session-sheet",cardClassName:"mobile-create-session-sheet-card",bodyClassName:"mobile-feature-form mobile-workspace-home-form mobile-create-session-form",showHandle:!0,onClose:b,children:[e.jsx(k,{className:"mobile-create-session-section",tone:"accent",children:e.jsxs(j,{label:n("shell.createSessionWorkspaceLabel"),children:[e.jsxs("button",{type:"button",className:"mobile-create-session-workspace-trigger","aria-label":`${n("shell.createSessionWorkspaceLabel")} ${(r==null?void 0:r.label)??""}`.trim(),"aria-expanded":h?"true":"false",disabled:i.length===0,onClick:()=>{p.trigger("selection"),m(s=>!s)},children:[e.jsxs("span",{className:"mobile-create-session-workspace-copy",children:[e.jsx("strong",{children:(r==null?void 0:r.label)??n("common.unknown")}),e.jsx("span",{children:(r==null?void 0:r.subtitle)??n("common.unknown")})]}),e.jsx(C,{expanded:h})]}),h?e.jsx(f,{className:"mobile-workspace-home-group mobile-create-session-workspace-list",role:"list",children:i.map(s=>e.jsx(g,{as:"button",className:"mobile-workspace-home-row mobile-create-session-workspace-row","data-worktree-kind":s.kind,"data-worktree-depth":s.depth,selected:s.workspace.id===a,trailing:e.jsx("span",{className:"mobile-workspace-home-row-trailing",children:s.workspace.id===a?e.jsx(I,{}):e.jsx(y,{})}),style:{"--mobile-workspace-tree-depth":String(s.depth)},onClick:()=>{s.workspace.id!==a&&p.trigger("selection"),u(s.workspace.id),m(!1)},children:e.jsxs("span",{className:"mobile-create-session-workspace-option-copy",children:[e.jsxs("strong",{children:[s.kind==="worktree"?e.jsx(M,{className:"mobile-workspace-home-worktree-badge",children:n("shell.mobileWorktreeBadge")}):null,s.label]}),e.jsx("span",{children:s.subtitle})]})},s.workspace.id))}):null]})}),e.jsx(k,{className:"mobile-create-session-provider-block",heading:n("shell.createSessionProviderLabel"),children:e.jsx(L,{disabled:!a,workspaceId:a||null,onSelect:s=>{a&&x(a,s)}})})]})}function N(o,l){var t;return l&&o.some(d=>d.workspace.id===l)?l:((t=o[0])==null?void 0:t.workspace.id)??""}function C({expanded:o}){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"mobile-create-session-workspace-chevron","data-expanded":o?"true":"false",children:e.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function y(){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function I(){return e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}export{D as M};
@@ -1 +0,0 @@
1
- import{b as n,j as e,t as N}from"./index-CL97fwWB.js";import{g}from"./App-BOHBGFOd.js";function I({open:h,title:m,description:o,height:b="auto",kind:u="form",dismissible:t=!0,closeOnBackdrop:p=!0,showHandle:x=!1,showCancelButton:j=!0,cancelLabel:v,className:a,cardClassName:l,bodyClassName:s,footer:i,onClose:r,children:f}){const c=n.useId(),d=n.useId(),k=t&&p;return!h||typeof document>"u"?null:g.createPortal(e.jsx("div",{className:"ios-action-sheet-overlay mobile-sheet-overlay",role:"presentation",onClick:()=>{k&&r()},children:e.jsxs("div",{className:`mobile-workspace-home-sheet mobile-sheet${a?` ${a}`:""}`,"data-height":b,"data-kind":u,role:"dialog","aria-modal":"true","aria-labelledby":c,"aria-describedby":o?d:void 0,onClick:y=>y.stopPropagation(),children:[e.jsxs("div",{className:`mobile-workspace-home-sheet-card mobile-sheet-card${l?` ${l}`:""}`,children:[x?e.jsx("div",{className:"mobile-sheet-handle","aria-hidden":"true"}):null,e.jsx("div",{className:"mobile-workspace-home-sheet-header mobile-sheet-header",children:e.jsxs("div",{className:"mobile-sheet-title-wrap",children:[e.jsx("strong",{id:c,children:m}),o?e.jsx("p",{id:d,children:o}):null]})}),e.jsx("div",{className:s?`mobile-sheet-body ${s}`:"mobile-sheet-body",children:f}),i?e.jsx("div",{className:"mobile-sheet-footer",children:i}):null]}),j?e.jsx("button",{type:"button",className:"ios-action-sheet-cancel mobile-sheet-cancel",disabled:!t,onClick:()=>{t&&r()},children:v??N("common.cancel")}):null]})}),document.body)}export{I as M};
@@ -1 +0,0 @@
1
- import{b as j,f as _,h as $,j as t,t as l}from"./index-CL97fwWB.js";import{s as K,t as F,u as S,H as P}from"./workbench-navigation-MEzCSmsK.js";import{M as z}from"./MobileSheet-5kZ-w-gU.js";import{bz as G,m as q,A as D,bA as X,bB as J}from"./WorkbenchLayout-OFi6CWgH.js";import{u as Q,f as V}from"./App-BOHBGFOd.js";import{M as Y}from"./MobileTopHeaderFrame-lcp2GscV.js";function Z(s){return s.flatMap(o=>[{workspace:o.workspace,label:o.workspace.name,subtitle:o.workspace.path,depth:0,kind:"workspace",meta:null},...v(o.childWorktrees??[])])}function ke(s,o){const a=o==null?void 0:o.trim();if(!a)return null;for(const i of s){if(i.workspace.id===a)return{workspace:i.workspace,sessions:i.sessions,childWorktrees:i.childWorktrees??[],meta:null};const n=H(i.childWorktrees??[],a);if(n)return n}return null}function v(s){return s.flatMap(o=>[{workspace:o.workspace,label:o.meta.displayName||o.workspace.name,subtitle:o.workspace.path,depth:o.meta.depth,kind:"worktree",meta:o.meta},...v(o.children)])}function H(s,o){for(const a of s){if(a.workspace.id===o)return{workspace:a.workspace,sessions:a.sessions,childWorktrees:a.children,meta:a.meta};const i=H(a.children,o);if(i)return i}return null}const W=10080*60*1e3;function ee(s,o){return se(s.hosts,s.activeHostId).flatMap(a=>{const i=a.id===s.activeHostId?o:oe(a.id);return[{kind:"host",host:a,workspaceCount:i.length},...i.map(n=>({kind:"workspace",host:a,workspace:n.workspace,option:n}))]})}function se(s,o){return[...s].sort((a,i)=>{if(a.id===o)return-1;if(i.id===o)return 1;const n=a.lastConnectedAt??a.updatedAt??a.createdAt;return(i.lastConnectedAt??i.updatedAt??i.createdAt).localeCompare(n)})}function oe(s){const o=G(W,s);return o?Z(q(o)):[]}function ue({currentWorkspace:s,workspaces:o,workspaceOptions:a,onSelectWorkspace:i,className:n,containerRef:w,heading:N,content:C,sheetContent:k,triggerLabel:M,triggerAriaLabel:A,onTriggerClick:c,trailing:L,gestureHandlers:y}){const[u,d]=j.useState(!1),[m,b]=j.useState(null),f=D(),I=Q(),{showToast:T}=V(),r=_(e=>e),h=$(r),E=a??o.map(e=>({workspace:{...e,repoRoot:e.path},label:e.name,subtitle:e.path,depth:0,kind:"workspace",meta:null})),O=ee(r,E),p=(s==null?void 0:s.name)??(h==null?void 0:h.name)??null,x=(s==null?void 0:s.path)??(h==null?void 0:h.baseUrl)??null;if(!p)return null;async function B(e){const R=e.kind==="host"?`host:${e.host.id}`:`workspace:${e.host.id}:${e.workspace.id}`;if(!m){b(R);try{e.host.id!==r.activeHostId&&(f.trigger("selection"),await X.switchHost(e.host.id)),e.kind==="host"?I(P()):(e.workspace.id!==(s==null?void 0:s.id)||e.host.id!==r.activeHostId)&&await(i==null?void 0:i(e.workspace.id)),d(!1)}catch(U){T({title:te(U,e.host.name),tone:"error"})}finally{b(null)}}}return t.jsxs(t.Fragment,{children:[t.jsx(Y,{className:n,frameRef:w,...y,children:t.jsxs("section",{className:"mobile-workspace-home-header",children:[t.jsx("h1",{className:"mobile-workspace-switcher-heading",children:N??p}),t.jsxs("div",{className:"mobile-workspace-home-toolbar-top",children:[t.jsxs("button",{type:"button",className:"mobile-workspace-home-switcher","aria-label":A??l("shell.workspaceHomeSwitcherLabel"),onClick:()=>{if(c){c();return}f.trigger("selection"),d(!0)},children:[t.jsx("span",{className:"mobile-workspace-home-switcher-label",children:M??p}),t.jsx(ne,{})]}),t.jsx("div",{className:"mobile-workspace-home-toolbar-actions",children:L})]}),x?t.jsx("p",{className:"mobile-workspace-home-path",children:x}):null,C]})}),u&&!c?t.jsxs(ie,{open:u,title:l("shell.hostWorkspaceSwitcherTitle"),onClose:()=>d(!1),children:[t.jsx(K,{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:O.map(e=>t.jsx(F,{as:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row","data-host-entry-kind":e.kind,"data-host-active":e.host.id===r.activeHostId,"data-worktree-kind":e.kind==="workspace"?e.option.kind:void 0,"data-worktree-depth":e.kind==="workspace"?e.option.depth+1:0,disabled:m!==null,selected:e.kind==="host"&&e.host.id===r.activeHostId||e.kind==="workspace"&&e.workspace.id===(s==null?void 0:s.id)&&e.host.id===r.activeHostId,trailing:t.jsx("span",{className:"mobile-workspace-home-row-trailing",children:e.kind==="host"&&e.host.id===r.activeHostId?t.jsx(g,{}):e.kind==="workspace"&&e.workspace.id===(s==null?void 0:s.id)&&e.host.id===r.activeHostId?t.jsx(g,{}):t.jsx(re,{})}),style:{"--mobile-workspace-tree-depth":String(e.kind==="host"?0:e.option.depth+1)},onClick:()=>{B(e)},label:t.jsxs("span",{className:e.kind==="host"?"mobile-workspace-home-sheet-label mobile-host-workspace-switcher-host-label":"mobile-workspace-home-sheet-label",children:[e.kind==="host"?t.jsx(S,{className:"mobile-host-workspace-switcher-host-badge",children:l("shell.hostSwitcherNodeBadge")}):null,e.kind==="workspace"&&e.option.kind==="worktree"?t.jsx(S,{className:"mobile-workspace-home-worktree-badge",children:l("shell.mobileWorktreeBadge")}):null,t.jsx("span",{className:"mobile-workspace-home-sheet-label-text",children:e.kind==="host"?e.host.name:e.option.label})]}),description:t.jsx("span",{className:"mobile-workspace-home-sheet-description",children:e.kind==="host"?ae(e.host,e.workspaceCount):e.option.subtitle})},e.kind==="host"?`host-${e.host.id}`:`workspace-${e.host.id}-${e.workspace.id}`))}),k?k(()=>d(!1)):null]}):null]})}function te(s,o){return s instanceof J?s.code==="HOST_UNREACHABLE"?l("shell.hostSwitchUnreachable",{name:o}):l("shell.hostSwitchMissing"):l("shell.hostSwitchFailed")}function ae(s,o){return s?s.lastUsername?l("shell.hostSwitcherWorkspaceCountWithUser",{username:s.lastUsername,count:o}):o>0?l("shell.hostSwitcherWorkspaceCount",{count:o}):s.baseUrl:""}function ie({open:s,title:o,onClose:a,children:i}){return t.jsx(z,{open:s,title:o,kind:"picker",height:"three-quarter",className:"mobile-host-workspace-switcher-sheet",bodyClassName:"mobile-workspace-home-form",showHandle:!0,onClose:a,children:i})}function ne(){return t.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function re(){return t.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function g(){return t.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:t.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}export{ue as M,ke as a,Z as f};
@@ -1 +0,0 @@
1
- import{b as f,j as o,t as r,A as h,H as L,I as U,J as x,D as G}from"./index-CL97fwWB.js";import{M as D,s as k,t as b,u as S,G as A,v,K as j}from"./workbench-navigation-MEzCSmsK.js";import{e as C,i as M,T as F,P as K,c as B,u as z,f as H}from"./App-BOHBGFOd.js";import{c as Q,f as W,h as Y,i as $,o as V,j as J,k as X,w as Z,m as q}from"./plugins-api-BQTV5DOp.js";import{D as ee}from"./DesktopModal-D_A8sgQU.js";import{M as ne}from"./MobileSheet-5kZ-w-gU.js";import{g as ie,a as te,b as se}from"./plugin-permission-copy-Cq99cnzV.js";function oe({open:e,request:n,submitting:t,onClose:s,onApprove:i}){const l=C(),c=f.useMemo(()=>re(n),[n]);if(!n)return null;const d=o.jsxs("div",{className:"plugins-permission-prompt",children:[o.jsx(D,{heading:r("plugins.permissionPromptSummaryTitle"),description:r("plugins.permissionPromptSummaryDescription",{pluginName:n.pluginName}),children:o.jsxs(k,{compact:!0,children:[o.jsx(b,{label:r("plugins.permissionPromptPermissionLabel"),description:ie(n.permissionKey),trailing:o.jsx(S,{tone:"warning",children:r("plugins.permissionPromptPendingTag")})}),o.jsx(b,{label:r("plugins.permissionPromptTargetLabel"),description:te(n.scopeType,n.scopePath)})]})}),o.jsx(D,{heading:r("plugins.permissionPromptOptionsTitle"),description:r("plugins.permissionPromptOptionsDescription"),children:c.length===0?o.jsx(A,{title:r("plugins.permissionPromptNoOptionTitle"),description:r("plugins.permissionPromptNoOptionDescription"),compact:!0}):o.jsx(k,{children:c.map(a=>o.jsx(b,{as:"button",disabled:t,label:a.label,description:a.description,trailing:o.jsx(S,{children:se(a.grantMode)}),onClick:()=>{i({scopeType:a.scopeType,scopePath:a.scopePath,grantMode:a.grantMode})}},a.id))})}),o.jsx(v,{align:"end",children:o.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:s,children:r("plugins.permissionPromptDenyAction")})})]});return l.isMobile?o.jsx(ne,{open:e,title:r("plugins.permissionPromptTitle"),description:r("plugins.permissionPromptDescription"),height:"three-quarter",kind:"form",onClose:s,footer:null,children:d}):o.jsx(ee,{open:e,title:r("plugins.permissionPromptTitle"),description:r("plugins.permissionPromptDescription"),size:"regular",layout:"form",onClose:s,footer:null,children:d})}function re(e){var s;if(!e)return[];const n=[],t=((s=e.scopePath)==null?void 0:s.trim())||null;if(e.grantOptions.includes("once")&&n.push({id:"once-file",label:r("plugins.permissionPromptOptionOnce"),description:r("plugins.permissionPromptOptionOnceDescription"),grantMode:"once",scopeType:e.scopeType==="workspace"?"workspace":"file",scopePath:e.scopeType==="workspace"?null:t}),e.grantOptions.includes("session")&&n.push({id:"session-current",label:r("plugins.permissionPromptOptionSession"),description:r("plugins.permissionPromptOptionSessionDescription"),grantMode:"session",scopeType:e.scopeType==="workspace"?"workspace":"file",scopePath:e.scopeType==="workspace"?null:t}),e.grantOptions.includes("persistent")&&t&&e.scopeType!=="workspace"){const i=ae(t);i&&n.push({id:"persistent-directory",label:r("plugins.permissionPromptOptionDirectory"),description:r("plugins.permissionPromptOptionDirectoryDescription",{scopePath:i}),grantMode:"persistent",scopeType:"directory",scopePath:i})}return n}function ae(e){const n=e.replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");if(!n)return null;const t=n.split("/");return t.length<=1?n:t.slice(0,-1).join("/")}const R="codingns-plugin:response",le="codingns-plugin:init",pe="codingns-plugin:ready",ce="codingns-plugin:request";async function de(e,n,t){const s=await Q(e,n);return Ee(s.context,t)}async function O(e,n){await W(e,n)}function ue(e){const{iframe:n,pluginId:t,hostOrigin:s,context:i}=e;function l(c){var m;if(c.source!==n.contentWindow||c.origin!==s)return;const d=c.data;if(!d||typeof d!="object")return;if(d.type===pe){(m=n.contentWindow)==null||m.postMessage({type:le,context:i},s);return}const a=d;a.type!==ce||typeof a.requestId!="string"||me({pluginId:t,pluginName:i.pluginName,runtimeSessionId:i.runtimeSessionId,request:a}).then(g=>{var u;(u=n.contentWindow)==null||u.postMessage({type:R,requestId:a.requestId,ok:!0,result:g},s)}).catch(g=>{var u;(u=n.contentWindow)==null||u.postMessage({type:R,requestId:a.requestId,ok:!1,error:Ne(g)},s)})}return window.addEventListener("message",l),()=>{window.removeEventListener("message",l)}}async function me(e){var c,d,a,m,g,u,P;const{pluginId:n,pluginName:t,runtimeSessionId:s,request:i}=e;if(i.action==="callAction"){const p=typeof((c=i.payload)==null?void 0:c.actionId)=="string"?i.payload.actionId.trim():"";if(!p)throw new h(400,{error_code:"PLUGIN_ACTION_ID_REQUIRED",detail:"插件动作请求缺少 actionId"});return await Y(n,p,s,(d=i.payload)==null?void 0:d.input)}if(i.action==="readFile"){const p=_((a=i.payload)==null?void 0:a.path,"插件读文件缺少路径");return await w({pluginId:n,pluginName:t,runtimeSessionId:s,permissionKey:"workspace.read_file",scopePath:p,execute:async()=>await X(n,s,p)})}if(i.action==="writeFile"){const p=_((m=i.payload)==null?void 0:m.path,"插件写文件缺少路径"),E=typeof((g=i.payload)==null?void 0:g.content)=="string"?i.payload.content:"";return await w({pluginId:n,pluginName:t,runtimeSessionId:s,permissionKey:"workspace.write_file",scopePath:p,execute:async()=>await Z(n,s,p,E)})}if(i.action==="listDir"){const p=typeof((u=i.payload)==null?void 0:u.path)=="string"?i.payload.path.trim():"";return{items:(await w({pluginId:n,pluginName:t,runtimeSessionId:s,permissionKey:"workspace.list_dir",scopePath:p||null,execute:async()=>await $(n,s,p||void 0)})).items.map(ge)}}const l=_((P=i.payload)==null?void 0:P.path,"插件桌面动作缺少路径");if(i.action==="openFile"){const p=await w({pluginId:n,pluginName:t,runtimeSessionId:s,permissionKey:"desktop.open_file",scopePath:l,execute:async()=>await V(n,s,l)}),y=await M().fs.openFile(p.absolutePath);if(!y.ok)throw new h(500,{error_code:y.errorCode??"PLUGIN_DESKTOP_OPEN_FAILED",detail:y.detail??"打开文件失败"});return p}if(i.action==="revealInFileManager"){const p=await w({pluginId:n,pluginName:t,runtimeSessionId:s,permissionKey:"desktop.reveal_in_file_manager",scopePath:l,execute:async()=>await J(n,s,l)}),y=await M().fs.revealInFileManager(p.absolutePath);if(!y.ok)throw new h(500,{error_code:y.errorCode??"PLUGIN_DESKTOP_REVEAL_FAILED",detail:y.detail??"打开所在目录失败"});return p}throw new h(400,{error_code:"PLUGIN_BRIDGE_ACTION_UNKNOWN",detail:`未知插件桥动作:${i.action}`})}function _(e,n){const t=typeof e=="string"?e.trim():"";if(!t)throw new h(400,{error_code:"PLUGIN_PATH_REQUIRED",detail:n});return t}function ge(e){return{path:e.path,name:e.name,kind:e.kind,size:e.size,updatedAt:e.updatedAt}}async function w(e){try{return await e.execute()}catch(n){const t=fe(n,e);if(!t||!await we(t))throw n;return await e.execute()}}function fe(e,n){var c,d,a,m;if(!(e instanceof h)||e.errorCode!=="PLUGIN_PERMISSION_GRANT_REQUIRED")return null;const t=Pe((c=e.data)==null?void 0:c.permissionKey,n.permissionKey),s=he((d=e.data)==null?void 0:d.scopeType,n.scopePath?"file":"workspace"),i=typeof((a=e.data)==null?void 0:a.scopePath)=="string"?e.data.scopePath:n.scopePath,l=ye((m=e.data)==null?void 0:m.grantOptions);return{pluginId:n.pluginId,pluginName:n.pluginName,runtimeSessionId:n.runtimeSessionId,permissionKey:t,scopeType:s,scopePath:i,grantOptions:l}}function Pe(e,n){return e==="workspace.read_file"||e==="workspace.list_dir"||e==="workspace.write_file"||e==="desktop.open_file"||e==="desktop.reveal_in_file_manager"?e:n}function he(e,n){return e==="workspace"||e==="directory"||e==="file"?e:n}function ye(e){return Array.isArray(e)?e.filter(n=>n==="once"||n==="session"||n==="persistent"):["once","session"]}let N=null,I=null;async function we(e){return typeof document>"u"?!1:await new Promise(n=>{Ie();const t=i=>{T({open:!1,request:null,submitting:!1,onClose:()=>t(!1),onApprove:()=>{}}),window.setTimeout(()=>n(i),0)};T({open:!0,request:e,submitting:!1,onClose:()=>t(!1),onApprove:async i=>{T({open:!0,request:e,submitting:!0,onClose:()=>{},onApprove:()=>{}});try{await q(e.pluginId,{runtimeSessionId:e.runtimeSessionId,permissionKey:e.permissionKey,scopeType:i.scopeType,scopePath:i.scopePath,grantMode:i.grantMode}),t(!0)}catch{t(!1)}}})})}function Ie(){I||(I=document.createElement("div"),I.dataset.pluginPermissionPrompt="true",document.body.appendChild(I)),N||(N=L.createRoot(I))}function T(e){N&&N.render(f.createElement(U,null,f.createElement(F,null,f.createElement(K,null,f.createElement(oe,{open:e.open,request:e.request,submitting:e.submitting,onClose:e.onClose,onApprove:e.onApprove})))))}function Ee(e,n){if(!e.frontendEntryUrl)throw new h(404,{error_code:"PLUGIN_FRONTEND_NOT_FOUND",detail:"当前插件没有可运行的前端入口"});return{pluginId:e.pluginId,workspaceId:e.workspaceId,runtimeSessionId:e.runtimeSessionId,pluginName:e.pluginName,pluginVersion:e.pluginVersion,frontendEntryUrl:e.frontendEntryUrl,hostOrigin:n}}function Ne(e){return e instanceof h?{code:e.errorCode??`HTTP_${e.status}`,detail:e.message}:e instanceof Error?{code:"PLUGIN_BRIDGE_REQUEST_FAILED",detail:e.message}:{code:"PLUGIN_BRIDGE_REQUEST_FAILED",detail:"插件桥请求失败"}}const be="allow-scripts allow-forms allow-modals allow-downloads";function Me(){const{workspaceId:e="",pluginId:n=""}=B(),t=z(),{showToast:s}=H(),i=f.useRef(null),[l,c]=f.useState(null),[d,a]=f.useState(!0),m=f.useMemo(()=>{const g=x();try{return new URL(g).origin}catch{return window.location.origin}},[]);return f.useEffect(()=>{let g=!1,u=null;return a(!0),c(null),de(n,e,m).then(P=>{if(g){O(n,P.runtimeSessionId).catch(()=>{});return}u=P,c(P)}).catch(P=>{g||s({title:P instanceof Error?P.message:r("plugins.containerLoadFailed"),tone:"error"})}).finally(()=>{g||a(!1)}),()=>{g=!0,u!=null&&u.runtimeSessionId&&O(n,u.runtimeSessionId).catch(()=>{})}},[m,n,s,e]),f.useEffect(()=>{if(!(!l||!i.current))return ue({iframe:i.current,pluginId:n,hostOrigin:m,context:l})},[l,m,n]),d?o.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root plugins-page",children:o.jsx("article",{className:"surface-card plugins-panel plugins-container-panel",children:o.jsx("p",{className:"plugins-hint-text",children:r("plugins.loading")})})}):l?o.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root plugins-page",children:o.jsxs("article",{className:"surface-card plugins-panel plugins-container-panel",children:[o.jsxs("header",{className:"plugins-page-header",children:[o.jsxs("div",{children:[o.jsx("h1",{children:l.pluginName}),o.jsx("p",{children:r("plugins.containerDescription")})]}),o.jsx(v,{children:o.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t(j(e,n)),children:r("plugins.backToDetail")})})]}),o.jsx("div",{className:"plugins-runtime-shell",children:o.jsx("iframe",{ref:i,title:l.pluginName,className:"plugins-runtime-frame",src:G(l.frontendEntryUrl,x()),sandbox:be,referrerPolicy:"no-referrer"})})]})}):o.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root plugins-page",children:o.jsx("article",{className:"surface-card plugins-panel plugins-container-panel",children:o.jsx(A,{title:r("plugins.containerMissingTitle"),description:r("plugins.containerMissingDescription"),action:o.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t(j(e,n)),children:r("plugins.backToDetail")})})})})}export{Me as PluginContainerPage};
@@ -1 +0,0 @@
1
- import{b as d,j as e,t as a}from"./index-CL97fwWB.js";import{g as pe,u as je}from"./App-BOHBGFOd.js";import{A as ye,d as fe,C as ce,D as Se,E as Ne,F as ke,b as Me,G as Ae,j as Ee}from"./WorkbenchLayout-OFi6CWgH.js";import{f as Ce,a as de,M as Pe}from"./MobileWorkspaceSwitcherHeader-C6JMiOq_.js";import{M as Ie}from"./MobileCreateSessionSheet-DfLMVu8q.js";import{r as Le,j as De,k as Te,l as Re,m as ue,n as se,o as ne,p as Ge,a as Oe,b as We}from"./workbench-navigation-MEzCSmsK.js";import{w as he}from"./styles-JKFlsYFv.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./DesktopModal-D_A8sgQU.js";import"./WorkbenchModal-C7qoQElW.js";import"./relay-entry-D-LfvdiX.js";import"./MobileSheet-5kZ-w-gU.js";import"./MobileTopHeaderFrame-lcp2GscV.js";const Be=420,Fe=156;function Ve({entry:t,isFavorite:i,isActive:u=!1,depth:h=0,variant:c="default",workspaceTone:M="root",hasSubsessions:m=!1,subsessionsExpanded:A=!1,showActions:z=!0,onActivate:Z,onToggleSubsessions:W,onToggleFavorite:te,onArchive:B,onUnarchive:ie,onRename:r}){var v;const[w,D]=d.useState(!1),[T,R]=d.useState(null),[j,F]=d.useState(null),E=d.useRef(null),G=d.useRef(!1),O=d.useRef(null),V=ye(),{session:l,workspace:oe}=t,$=l.title??l.sessionId,q=fe(l.provider),H=[q,$e(l.lastMessageAt??l.updatedAt??null),ce(l)].filter(Boolean).join(" · "),_=c==="mobile"?null:ce(l),K=_?Se("session-list-activity-badge",l):null,S=c!=="mobile",U=S?Le(l.parallelGroup):null,J=S?De(l.parallelGroup):null,ae=S?Te(l.parallelGroup):void 0;d.useEffect(()=>()=>{Y()},[]),d.useLayoutEffect(()=>{if(!w||!j||typeof window>"u"){R(null);return}const n=()=>{var I,y;const g=Ne(j,{width:((I=O.current)==null?void 0:I.offsetWidth)??0,height:((y=O.current)==null?void 0:y.offsetHeight)??0},{width:window.innerWidth,height:window.innerHeight},{estimatedHeightPx:Fe});R({position:"fixed",left:`${Math.round(g.left)}px`,top:`${Math.round(g.top)}px`,width:`${Math.round(g.width)}px`,maxWidth:"calc(100vw - 24px)",maxHeight:`${Math.round(g.maxHeight)}px`,transformOrigin:g.transformOrigin})},x=g=>{var y;const I=g.target;I&&!((y=O.current)!=null&&y.contains(I))&&N()},P=g=>{g.key==="Escape"&&N()};return n(),window.addEventListener("pointerdown",x),window.addEventListener("keydown",P),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",P),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[j,w]);function X(n){F(n),D(!0)}function N(){D(!1),F(null)}function Y(){E.current!==null&&(window.clearTimeout(E.current),E.current=null)}function le(n){if(!z||n.pointerType==="mouse")return;const x={x:n.clientX,y:n.clientY};Y(),E.current=window.setTimeout(()=>{G.current=!0,V.trigger("gesture"),X(x)},Be)}function C(){Y()}function Q(){if(G.current){G.current=!1;return}V.trigger("selection"),Z(l.sessionId)}const s=async()=>{const n=window.prompt(a("shell.renameModalDescription"),$);n&&(await r(l.sessionId,n.trim()),N())},o=async()=>{if(l.isArchived){await ie(l.sessionId),N();return}await B(l.sessionId),N()},p=()=>{te(l.sessionId),N()},f=n=>{if(n.key!=="ContextMenu"&&!(n.shiftKey&&n.key==="F10"))return;n.preventDefault(),n.stopPropagation();const x=n.currentTarget.getBoundingClientRect();X({x:x.right,y:x.bottom})},k=w&&typeof document<"u"?pe.createPortal(e.jsxs("div",{ref:O,className:"session-action-menu surface-card",role:"menu","aria-label":a("shell.sessionMoreAction"),style:T??{position:"fixed",top:0,left:0,visibility:"hidden"},onClick:n=>n.stopPropagation(),children:[e.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:p,children:i?a("shell.unfavoriteAction"):a("shell.favoriteAction")}),e.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void o(),children:l.isArchived?a("shell.unarchiveAction"):a("shell.archiveAction")}),e.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void s(),children:a("shell.renameAction")})]}),document.body):null;return e.jsxs("article",{className:"session-list-item","data-depth":h,"data-active":u,"data-workspace-tone":M,"data-has-subsessions":m,"data-variant":c,"data-parallel-group":S&&l.parallelGroup?"true":void 0,"data-parallel-role":S?((v=l.parallelGroup)==null?void 0:v.role)??void 0:void 0,style:ae,onContextMenu:n=>{z&&(n.preventDefault(),n.stopPropagation(),X({x:n.clientX,y:n.clientY}))},children:[m?e.jsx("button",{type:"button",className:"session-list-subsession-toggle","aria-label":A?a("shell.subagentCollapse"):a("shell.subagentExpand"),title:A?a("shell.subagentCollapse"):a("shell.subagentExpand"),"aria-expanded":A,onClick:n=>{n.stopPropagation(),V.trigger("selection"),W==null||W()},children:e.jsx("span",{className:me(l,{isActive:u,hasSubsessions:m}),"aria-hidden":"true"})}):e.jsx("span",{className:me(l,{isActive:u,hasSubsessions:m}),"aria-hidden":"true"}),e.jsx("button",{type:"button",className:"session-list-link",onClick:Q,onPointerDown:le,onPointerUp:C,onPointerCancel:C,onPointerLeave:C,onKeyDown:f,children:e.jsxs("div",{className:"session-list-copy",children:[e.jsxs("div",{className:"session-list-title-row",children:[e.jsx("div",{className:"session-list-title",children:$||a("shell.searchEntry")}),U?e.jsx("span",{className:"session-list-parallel-badge",children:U}):null,J?e.jsx("span",{className:"session-list-parallel-role-badge",children:J}):null]}),e.jsx("div",{className:"session-list-meta",children:c==="mobile"?e.jsx(e.Fragment,{children:e.jsx("span",{children:H})}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:oe.name}),_&&K?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{className:K,children:_})]}):null,e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{children:q})]})})]})}),k]})}function me(t,i){return ke("session-list-indicator",t,{isActive:i.isActive,hasSubagents:i.hasSubsessions})}function $e(t){return t?new Date(t).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):a("common.unknown")}const ee=5;function cs(){var Q;const t=je(),{navigationGroups:i,favoriteSessionIds:u,currentWorkspaceId:h,currentSessionId:c,navigationLoading:M,selectWorkspace:m,toggleFavoriteSession:A,archiveSession:z,unarchiveSession:Z,renameSession:W,startDraftSession:te}=Me(),B=Ce(i),ie=d.useMemo(()=>Ae(i),[i]),r=de(i,h)??de(i,((Q=i[0])==null?void 0:Q.workspace.id)??null),w=B.find(s=>s.workspace.id===(r==null?void 0:r.workspace.id))??(r?{workspace:r.workspace,label:r.workspace.name,subtitle:r.workspace.path}:null),D=d.useMemo(()=>new Set(u),[u]),T=d.useMemo(()=>r?r.sessions.filter(s=>{if(s.isArchived)return!1;const o=Re(s,{mode:"mobile"});if(!o)return!0;const p=r.sessions.find(f=>f.sessionId===o);return!p||!p.isArchived}).map(s=>({session:s,workspace:r.workspace})):[],[r]),R=d.useMemo(()=>T.filter(s=>D.has(s.session.sessionId)),[T,D]),j=d.useMemo(()=>ue(T,{mode:"mobile"}),[T]),F=d.useMemo(()=>ue(R,{mode:"mobile"}),[R]),E=d.useMemo(()=>r?r.sessions.filter(s=>s.isArchived===!0&&!Ee(s)):[],[r]),G=(r==null?void 0:r.workspace.id)??"",O=!!G,[V,l]=d.useState([]),[oe,$]=d.useState({}),[q,H]=d.useState(!1),[_,K]=d.useState(!1),[S,U]=d.useState(null);d.useEffect(()=>{$(s=>{const o={};for(const p of j){const f=se(ne(p));if(f.length===0)continue;const k=f.findIndex(v=>v.item.session.sessionId===c);o[p.item.session.sessionId]=Xe(f.length,ee,s[p.item.session.sessionId],k)}return Ye(s,o)?s:o})},[c,j]),d.useEffect(()=>{if(!c)return;const s=Ge(j,c,o=>o.session.sessionId);s.length!==0&&l(o=>{const p=new Set(o);let f=!1;for(const k of s)p.has(k)||(p.add(k),f=!0);return f?Array.from(p):o})},[c,j]);function J(s){l(o=>o.includes(s)?o.filter(p=>p!==s):[...o,s])}function ae(s){return oe[s]??ee}function X(s){$(o=>({...o,[s]:(o[s]??ee)+ee}))}function N(s,o){he("immersive"),t(We(s,o))}function Y(s,o){H(!1),he("immersive"),te(s,o)}async function le(s){U(s);try{await Z(s)}finally{U(o=>o===s?null:o)}}function C(s,o=!1,p=[],f=!1,k=!1){var re;const v=s.item.session.sessionId,n=s.children,x=s.depth===0&&n.length>0,P=o||x&&V.includes(v),g=P&&x,I=g?Ue(s,ae(v)):s,y=P?I.children:[],be=se(n).length,xe=se(y).length,ge=g&&xe<be,we=s.depth>0?[...p,f]:[...p];return e.jsxs("div",{className:"session-list-tree-node",children:[e.jsxs("div",{className:"session-list-tree-row",style:{"--session-tree-depth":s.depth},children:[s.depth>0?e.jsxs("div",{className:"session-tree-guides","aria-hidden":"true",style:{"--session-tree-depth":s.depth},children:[p.map((b,L)=>b?e.jsx("span",{className:"session-tree-guide-column",style:{"--session-tree-level":L+1}},`${v}:ancestor:${L}`):null),e.jsx("span",{className:"session-tree-guide-branch","data-continue":f,"data-first":k,style:{"--session-tree-level":s.depth},children:e.jsx("span",{className:"session-tree-guide-branch-horizontal"})})]}):null,e.jsx(Ve,{entry:s.item,isFavorite:D.has(v),isActive:c===v,depth:s.depth,variant:"mobile",workspaceTone:((re=ie[s.item.workspace.id])==null?void 0:re.tone)??"root",hasSubsessions:x,subsessionsExpanded:P,onActivate:b=>N(s.item.workspace.id,b),onToggleSubsessions:x?()=>J(v):void 0,onToggleFavorite:b=>{A(b)},onArchive:b=>z(b),onUnarchive:b=>Z(b),onRename:(b,L)=>W(b,L)})]}),P&&y.length>0?e.jsx("div",{className:"session-list-children",children:y.map((b,L)=>C(b,!0,we,L<y.length-1,L===0))}):null,ge?e.jsx("div",{className:"session-list-children",children:e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>X(v),children:a("shell.subagentExpandMore")})}):null]},`${s.item.workspace.id}:${v}`)}return e.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[e.jsx(Pe,{currentWorkspace:w?{id:w.workspace.id,name:w.label,path:w.subtitle}:null,workspaces:i.map(s=>s.workspace),workspaceOptions:B,onSelectWorkspace:s=>{m(s),t(Oe(s))},content:e.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:M||!O,onClick:()=>H(!0),children:a("shell.createSession")})}),e.jsxs("div",{className:"mobile-page-top-body",children:[e.jsx("div",{className:"session-index-archive-actions",children:e.jsxs("button",{type:"button",className:"primary-button mobile-session-index-create-button session-index-archive-button",disabled:M||!r,onClick:()=>K(!0),children:[e.jsx("span",{children:a("shell.archiveViewAction")}),e.jsx("span",{className:"session-index-archive-count",children:E.length})]})}),F.length>0?e.jsxs("section",{className:"session-section session-section-sheet",children:[e.jsxs("header",{className:"session-section-heading",children:[e.jsx("div",{children:e.jsx("h2",{children:a("shell.favoriteSectionTitle")})}),e.jsx("span",{className:"session-section-count",children:R.length})]}),e.jsx("div",{className:"session-current-workspace-list",children:F.map(s=>C(s))})]}):null,e.jsxs("section",{className:"session-section session-section-sheet",children:[e.jsxs("header",{className:"session-section-heading",children:[e.jsx("div",{children:e.jsx("h2",{children:a("shell.mobileConversationCurrentWorkspaceSection")})}),e.jsx("span",{className:"session-section-count",children:j.length})]}),j.length===0?e.jsx("p",{className:"session-section-empty",children:M?a("shell.searchSessionHint"):a("shell.emptyWorkspaceSessions")}):e.jsx("div",{className:"session-current-workspace-list",children:j.map(s=>C(s))})]})]}),e.jsx(Ie,{open:q,workspaces:i.map(s=>s.workspace),workspaceOptions:B,initialWorkspaceId:h??G,onClose:()=>H(!1),onSelect:Y}),e.jsx(He,{open:_,workspaceName:(w==null?void 0:w.label)??(r==null?void 0:r.workspace.name)??null,sessions:E,restoringSessionId:S,onClose:()=>{S||K(!1)},onRestore:s=>void le(s)})]})}function He({open:t,workspaceName:i,sessions:u,restoringSessionId:h,onClose:c,onRestore:M}){return d.useEffect(()=>{if(!t)return;function m(A){A.key==="Escape"&&!h&&c()}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[c,t,h]),!t||typeof document>"u"?null:pe.createPortal(e.jsxs("div",{className:"workbench-modal-layer",children:[e.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":a("common.close"),disabled:!!h,onClick:c}),e.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":a("shell.archiveModalTitle"),children:[e.jsx("div",{className:"workbench-modal-header",children:e.jsxs("div",{className:"workbench-modal-title-wrap",children:[e.jsx("h2",{children:a("shell.archiveModalTitle")}),e.jsx("p",{children:i?`${i} · ${a("shell.archiveModalDescription")}`:a("shell.archiveModalDescription")})]})}),e.jsx("div",{className:"workbench-modal-body",children:u.length>0?e.jsx("div",{className:"workbench-archive-list",children:u.map(m=>e.jsxs("article",{className:"workbench-archive-item",children:[e.jsxs("div",{className:"workbench-archive-item-main",children:[e.jsx("strong",{title:m.title??m.sessionId,children:m.title??m.sessionId}),e.jsx("p",{children:_e(m)})]}),e.jsx("button",{type:"button",className:"secondary-button",disabled:h===m.sessionId,onClick:()=>{M(m.sessionId)},children:a("shell.unarchiveAction")})]},m.sessionId))}):e.jsx("p",{className:"workbench-section-empty",children:a("shell.archiveEmpty")})})]})]}),document.body)}function _e(t){const i=fe(t.provider),u=Ke(t.lastMessageAt??t.updatedAt??null);return[i,u].filter(Boolean).join(" · ")}function Ke(t){if(!t)return null;const i=Date.parse(t);return Number.isNaN(i)?null:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(i)}function Ue(t,i){const u=new Set(se(ne(t)).sort((h,c)=>(c.item.session.lastMessageAt??c.item.session.updatedAt).localeCompare(h.item.session.lastMessageAt??h.item.session.updatedAt)).slice(0,i).map(h=>h.item.session.sessionId));return{...t,children:ve(ne(t),u)}}function ve(t,i){return t.flatMap(u=>{const h=ve(ne(u),i);return!i.has(u.item.session.sessionId)&&h.length===0?[]:[{...u,children:h}]})}function Xe(t,i,u,h=-1){if(t<=0)return 0;const c=h>=0?Math.max(i,h+1):i;return Math.min(t,Math.max(u??0,c))}function Ye(t,i){const u=Object.keys(t),h=Object.keys(i);return u.length!==h.length?!1:u.every(c=>t[c]===i[c])}export{cs as SessionIndexPage};