@bendyline/gezel-service 1.0.7 → 1.1.0

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 (237) hide show
  1. package/dist/bin/gezeld.js +6253 -3616
  2. package/dist/handboek-content/whats-new/1.26224.md +1 -0
  3. package/dist/handboek-content/whats-new/1.26226.md +1 -0
  4. package/dist/handboek-content/whats-new/1.26231.md +1 -0
  5. package/dist/handboek-content/whats-new/1.26234.md +1 -0
  6. package/dist/handboek-content/whats-new/1.26237.md +1 -0
  7. package/dist/handboek-content/whats-new/1.26244.md +2 -1
  8. package/dist/handboek-content/whats-new/1.26247.md +88 -0
  9. package/dist/handboek-content/whats-new/whats-new-index.md +1 -0
  10. package/dist/index-store/static-index-worker.js +17 -1
  11. package/dist/index.d.ts +473 -209
  12. package/dist/index.js +6251 -3614
  13. package/dist/memory/embed-worker.js +58 -2
  14. package/dist/memory/image-embed-worker.js +8 -0
  15. package/dist/providers/llama-cpp/gguf-metadata-worker.js +2 -0
  16. package/dist/providers/mlx/python/gezel_mlx_server.py +18 -18
  17. package/dist/ui/assets/AmbientDashboardCard-Cf5fi_fY.js +1 -0
  18. package/dist/ui/assets/{AudioEngineSettings-BDrNIGGm.js → AudioEngineSettings-D3L7HOHe.js} +1 -1
  19. package/dist/ui/assets/{BenchmarksView-CHyujjs8.js → BenchmarksView-B68hrLCl.js} +1 -1
  20. package/dist/ui/assets/CatalogBrowser-DEM9t7Es.js +1 -0
  21. package/dist/ui/assets/{ChannelsSettings-Be_W1mr8.js → ChannelsSettings-DtK_k0Ul.js} +1 -1
  22. package/dist/ui/assets/ChatTimelineView-CQ4Sf4Ip.js +7 -0
  23. package/dist/ui/assets/ConfirmDialog-Dt1ed4Fh.js +1 -0
  24. package/dist/ui/assets/ConnectedAppsPanel-Cl8LEkrt.js +1 -0
  25. package/dist/ui/assets/CraftbookEditor-DEQRlQ2p.js +1 -0
  26. package/dist/ui/assets/{CraftbookScriptEditorView-DXIZYZT3.js → CraftbookScriptEditorView-DhXkkIdK.js} +1 -1
  27. package/dist/ui/assets/{CraftbookTabContent-Bm7t_b37.js → CraftbookTabContent-_oIdpQTG.js} +1 -1
  28. package/dist/ui/assets/{CraftbookToolsetSetup-DTEA-3K3.js → CraftbookToolsetSetup-BKg136L1.js} +1 -1
  29. package/dist/ui/assets/{CraftbooksView-C4X99TTe.js → CraftbooksView-Dm2zH-nW.js} +2 -2
  30. package/dist/ui/assets/{DiffpackReviewView-ClcNxtmF.js → DiffpackReviewView-EFLGJnwr.js} +1 -1
  31. package/dist/ui/assets/DocumentDetail-ClDRj2N-.js +1 -0
  32. package/dist/ui/assets/DocumentsView-ny9oieg2.js +1 -0
  33. package/dist/ui/assets/DropdownMenu-S4d9-3j3.js +1 -0
  34. package/dist/ui/assets/Ds4Settings-CeWlm5Vf.js +1 -0
  35. package/dist/ui/assets/EmbeddedChat-Hjrrgpao.js +1 -0
  36. package/dist/ui/assets/{FaceRecognitionCard-D3hdc7uU.js → FaceRecognitionCard-D7ufKqjI.js} +1 -1
  37. package/dist/ui/assets/FileMapView-DRjf59RH.js +1 -0
  38. package/dist/ui/assets/{FoldersSettings-BcNzl4vT.js → FoldersSettings-DDUhaFio.js} +1 -1
  39. package/dist/ui/assets/GezelDetail-Cph6pVGb.js +1 -0
  40. package/dist/ui/assets/{GezelJsonEditor-fOvYclu9.js → GezelJsonEditor-7vDGyBib.js} +1 -1
  41. package/dist/ui/assets/{GezellenView-BTzhHrxi.js → GezellenView-DQhcO1CP.js} +1 -1
  42. package/dist/ui/assets/{GildeUpdatesCard-Bq6XEpLP.js → GildeUpdatesCard-UKKNm_U8.js} +1 -1
  43. package/dist/ui/assets/{GithubSignInChip-CnlTCG8G.js → GithubSignInChip-DjM3qZsL.js} +1 -1
  44. package/dist/ui/assets/{HandboekMediaProvider-BfQW8_Nr.js → HandboekMediaProvider-DixaXTAH.js} +1 -1
  45. package/dist/ui/assets/HandboekView-BeNQqho9.js +1 -0
  46. package/dist/ui/assets/HistoryView-E2szGNGS.js +1 -0
  47. package/dist/ui/assets/{HomeView-CB_5TJIp.css → HomeView-CNeqCFPc.css} +1 -1
  48. package/dist/ui/assets/HomeView-CkiS3DXy.js +1 -0
  49. package/dist/ui/assets/{ImageEngineSettings-BpMfQy4f.js → ImageEngineSettings-BCKT7Gvi.js} +1 -1
  50. package/dist/ui/assets/{ImageRecognitionSettings-Ct-7-Oas.js → ImageRecognitionSettings-DD6syFez.js} +1 -1
  51. package/dist/ui/assets/IncompleteDownloads-BiPaaahS.js +1 -0
  52. package/dist/ui/assets/InstallProgressRow-DyKOI4MU.js +1 -0
  53. package/dist/ui/assets/KnowledgeCatalogsCard-B132vzRa.js +1 -0
  54. package/dist/ui/assets/KnowledgeView-CtPuIlN4.js +1 -0
  55. package/dist/ui/assets/LlamaCppSettings-D6zHcu4W.js +1 -0
  56. package/dist/ui/assets/{MarkdownField-D-0Zw7gM.js → MarkdownField-CK8K3fzj.js} +1 -1
  57. package/dist/ui/assets/MemoriesTree-DzjXzIrM.js +1 -0
  58. package/dist/ui/assets/{MicrophoneSettings-BIaFxyY_.js → MicrophoneSettings-1FH83SCq.js} +1 -1
  59. package/dist/ui/assets/MlxSettings-BYxUqFnJ.js +1 -0
  60. package/dist/ui/assets/ModelPicker-DoXPfQkQ.js +1 -0
  61. package/dist/ui/assets/{NewScriptDialog-D-gkY8TS.js → NewScriptDialog-C5X-7PMt.js} +1 -1
  62. package/dist/ui/assets/NewTaskDialog-Cyqtmigv.js +2 -0
  63. package/dist/ui/assets/{OllamaSettings-oIE2Mech.js → OllamaSettings-DkjmA-sB.js} +1 -1
  64. package/dist/ui/assets/ProjectChat-YEqUME6k.js +5 -0
  65. package/dist/ui/assets/{ProjectConnectionsTab-BZqp-oKI.js → ProjectConnectionsTab-dFCJpW93.js} +1 -1
  66. package/dist/ui/assets/ProjectGitStatusBar-CjZxG54t.js +1 -0
  67. package/dist/ui/assets/{ProjectGithubView-w8suLCsA.js → ProjectGithubView-CQ4-tmPx.js} +1 -1
  68. package/dist/ui/assets/{ProjectMailTab-DGo7eyB8.js → ProjectMailTab-NaScsZJf.js} +1 -1
  69. package/dist/ui/assets/ProjectOverviewView-ChjxbQas.js +1 -0
  70. package/dist/ui/assets/{ProjectTimeline-DRe3D9qY.js → ProjectTimeline-BZpdCisR.js} +1 -1
  71. package/dist/ui/assets/ProjectsView-J77ECk6V.js +7 -0
  72. package/dist/ui/assets/{RecommendedBadge-BKiDixnB.js → RecommendedBadge-D0m68PAu.js} +1 -1
  73. package/dist/ui/assets/{RemoteServersPanel-DGyl6-Rg.js → RemoteServersPanel-BdLOoORu.js} +1 -1
  74. package/dist/ui/assets/ScriptEditorTabs-BFvIiDFZ.js +2 -0
  75. package/dist/ui/assets/ScriptEditorView-B09rm1vz.js +5 -0
  76. package/dist/ui/assets/{ScriptsView-WQc28TmQ.js → ScriptsView-BvNAJXpo.js} +1 -1
  77. package/dist/ui/assets/{SecurityComplianceSettings-DsMEA4J3.js → SecurityComplianceSettings-DzGOnptO.js} +1 -1
  78. package/dist/ui/assets/SessionSwitcher-6okzcxT7.js +1 -0
  79. package/dist/ui/assets/SettingsView-Dur4dLhW.js +3 -0
  80. package/dist/ui/assets/SquisqIntegration-6v3yNOIP.js +2 -0
  81. package/dist/ui/assets/{StorageCleanupDialog-DHqwyMZZ.js → StorageCleanupDialog-OQlomMJD.js} +1 -1
  82. package/dist/ui/assets/{StorageUsageCard-CdT6SU51.js → StorageUsageCard-f6c6qTbM.js} +1 -1
  83. package/dist/ui/assets/Tabs-jE0Z5Tzd.js +1 -0
  84. package/dist/ui/assets/TaskTabContent-0w3kAUWR.js +1 -0
  85. package/dist/ui/assets/TasksView-BVMT4BAY.js +1 -0
  86. package/dist/ui/assets/{TerminalCodeEditor-77pBm6f3.js → TerminalCodeEditor-DO7zLKy-.js} +2 -2
  87. package/dist/ui/assets/ToolsetsEditor-Bb1wD5mV.js +8 -0
  88. package/dist/ui/assets/TransformToolbarButton-BWYkEB0d.js +5 -0
  89. package/dist/ui/assets/UnrecognizedModels-HtdMZUqK.js +1 -0
  90. package/dist/ui/assets/{VideoEngineSettings-DzMeINuv.js → VideoEngineSettings-Dq8Nw_tK.js} +1 -1
  91. package/dist/ui/assets/{WorkspaceIndexPane-DU4yd4Ai.js → WorkspaceIndexPane-fpDz4MwZ.js} +1 -1
  92. package/dist/ui/assets/{api-BX5xXiFs.js → api-BPraLwsh.js} +1 -1
  93. package/dist/ui/assets/chat-thread-memory-Be48zsyG.js +1 -0
  94. package/dist/ui/assets/chunk-6ECMNUIP-DDVjPyfK.js +15 -0
  95. package/dist/ui/assets/{chunk-6N2J7C2B-B5QIrD9m.js → chunk-6N2J7C2B-CsppiLVr.js} +1 -1
  96. package/dist/ui/assets/{chunk-A6N6IN3I-DXok09eC.js → chunk-A6N6IN3I-ofeM4l8g.js} +1 -1
  97. package/dist/ui/assets/chunk-B7GEAZBI-Divd2h1k.js +1 -0
  98. package/dist/ui/assets/chunk-DXYWKZ52-BXcAlClu.js +1 -0
  99. package/dist/ui/assets/chunk-FLR2ARKC-D7wrvQgT.js +2 -0
  100. package/dist/ui/assets/chunk-IIQYS2YH-DKZhWMpn.js +1 -0
  101. package/dist/ui/assets/{chunk-ILCJ3WFD-WRukZ7R1.js → chunk-ILCJ3WFD-CLZxw4Ge.js} +3 -3
  102. package/dist/ui/assets/chunk-OBADJV7C-CDVOcmYt.js +1 -0
  103. package/dist/ui/assets/chunk-Q77KNJIN-BIDRf0aP.js +6 -0
  104. package/dist/ui/assets/chunk-S5PCVMKU-Df5XzhSE.js +6 -0
  105. package/dist/ui/assets/chunk-UBFT2CDQ-FexGDigd.js +31 -0
  106. package/dist/ui/assets/{chunk-USU6HTKB-D5FmDzJU.js → chunk-USU6HTKB-B_p-YcDp.js} +1 -1
  107. package/dist/ui/assets/chunk-VKXOZTYP-BoVvWSBR.js +5 -0
  108. package/dist/ui/assets/{chunk-6RQOV3B3-CwvKotJw.js → chunk-VPWPEMZJ-DRKoa_j0.js} +1 -1
  109. package/dist/ui/assets/{chunk-WATAOG4Y-DXg2lov5.js → chunk-WATAOG4Y-C1EXVPmG.js} +1 -1
  110. package/dist/ui/assets/{container-B7jJtK5V.js → container-Ce94efbg.js} +1 -1
  111. package/dist/ui/assets/csv-62UGQMzZ.js +1 -0
  112. package/dist/ui/assets/data-B2kHjlc5.js +1 -0
  113. package/dist/ui/assets/dist-B9-VrAP8.js +2 -0
  114. package/dist/ui/assets/dist-BaHut5iX.js +2 -0
  115. package/dist/ui/assets/dist-BqGwkOe5.js +225 -0
  116. package/dist/ui/assets/dist-ZnIgkoEi.js +4 -0
  117. package/dist/ui/assets/{dist-BHl1ZAVG.js → dist-l6uUFZMV.js} +2 -2
  118. package/dist/ui/assets/dist-pLLFUPO-.js +1 -0
  119. package/dist/ui/assets/{doc-s6H7T0IO.js → doc-Dr5K49bx.js} +28 -28
  120. package/dist/ui/assets/document-companion-BQk2kS0F.js +1 -0
  121. package/dist/ui/assets/document-import-QoM9UxJr.js +1 -0
  122. package/dist/ui/assets/docx-sXa1Rf41.js +2 -0
  123. package/dist/ui/assets/{epub-B98SgHBz.js → epub-RopMP0ec.js} +4 -4
  124. package/dist/ui/assets/{export-options-Bu-tI6og.js → export-options-f7PKjEBb.js} +1 -1
  125. package/dist/ui/assets/extract-UTAOG7LV-4WDRw1o4.js +1 -0
  126. package/dist/ui/assets/file-browser-c2tf4MIb.js +5 -0
  127. package/dist/ui/assets/html-BGVOMhkv.js +253 -0
  128. package/dist/ui/assets/icons-DWaUNQbT.js +1 -0
  129. package/dist/ui/assets/images-JLBFCDD4-6JitW0hD.js +1 -0
  130. package/dist/ui/assets/index-B8NcxqcR.css +1 -0
  131. package/dist/ui/assets/index-C0DYtvfg.js +34 -0
  132. package/dist/ui/assets/index-J8TOMdvV.js +2 -0
  133. package/dist/ui/assets/{infer-kCLH1C8z.js → infer-LEGOsu64.js} +2 -2
  134. package/dist/ui/assets/ironcalc-BAi5gOlE.js +3 -0
  135. package/dist/ui/assets/layouts-2A7QNF6Y-CVwP7noP.js +1 -0
  136. package/dist/ui/assets/{mail-link-CI6YD6k2.js → mail-link-DXkmCd5b.js} +1 -1
  137. package/dist/ui/assets/markdown-baseline-9B52XlX2.js +1 -0
  138. package/dist/ui/assets/{markdown-Bi9b5f5Y.js → markdown-ryKA_OmY.js} +1 -1
  139. package/dist/ui/assets/materialize-A34OZGEU-xNNKzytx.js +1 -0
  140. package/dist/ui/assets/model-inventory-ykSm_IT5.js +1 -0
  141. package/dist/ui/assets/{model-quantization-BDzrELN_.js → model-quantization-CLO7XLoF.js} +1 -1
  142. package/dist/ui/assets/{monaco-base-BiVSa1J-.js → monaco-base-B1H1U1Sw.js} +1 -1
  143. package/dist/ui/assets/{monaco-setup-UeltVkg_.js → monaco-setup-DjhrGQui.js} +1 -1
  144. package/dist/ui/assets/{new-project-meta-0xhggGA_.js → new-project-meta-_f9sfcRX.js} +1 -1
  145. package/dist/ui/assets/outside-in-D73N1g_b.js +3 -0
  146. package/dist/ui/assets/{pdf-DgTjy3rN.js → pdf-BOjVDlCK.js} +3 -3
  147. package/dist/ui/assets/{pending-drafts-YVW6X55O.js → pending-drafts-B11MKQ9R.js} +1 -1
  148. package/dist/ui/assets/{poppetje-Ce-02Aqi.js → poppetje-DLB8uevw.js} +2 -2
  149. package/dist/ui/assets/pptx-BuxyNxQh.js +6 -0
  150. package/dist/ui/assets/primitives-CWrGZpPI.js +41 -0
  151. package/dist/ui/assets/run-export-ChaMXrKS.js +23 -0
  152. package/dist/ui/assets/squisq-formats-aAdypXoy.js +1 -0
  153. package/dist/ui/assets/standalone-source-q_Zzd1bd.js +11 -0
  154. package/dist/ui/assets/storage-D8pE2zg0.js +1 -0
  155. package/dist/ui/assets/styles-BhnF3s2q.css +1 -0
  156. package/dist/ui/assets/styles-CKVKwqoQ.js +550 -0
  157. package/dist/ui/assets/table-fcouR4db.js +1 -0
  158. package/dist/ui/assets/{terminal-monaco-setup-DNoK2tN4.js → terminal-monaco-setup-BAzrVzeR.js} +1 -1
  159. package/dist/ui/assets/{useCompactLayout-BarJPYcv.js → useCompactLayout-Dtolvzye.js} +0 -0
  160. package/dist/ui/assets/{useCopilotAvailability-BH1nLXQI.js → useCopilotAvailability-3xZvKgTF.js} +1 -1
  161. package/dist/ui/assets/{useDiffpacks-CK8W_OD_.js → useDiffpacks-Dsnr0wtX.js} +1 -1
  162. package/dist/ui/assets/{useGitSync-DWxX5-7K.js → useGitSync-BCTptQsp.js} +1 -1
  163. package/dist/ui/assets/{useShowWorkInProgressFeatures-DwwviLRO.js → useShowWorkInProgressFeatures-BhDNuQiU.js} +1 -1
  164. package/dist/ui/assets/{useTotalRamBytes-WoN_mi-V.js → useTotalRamBytes-DIx-_pf8.js} +1 -1
  165. package/dist/ui/assets/wasm-DdxEDD2H.js +1 -0
  166. package/dist/ui/assets/wasm_bg-DW9Xt_vt.wasm +0 -0
  167. package/dist/ui/assets/xlsx-DyBGuAO1.js +4 -0
  168. package/dist/ui/index.html +19 -18
  169. package/package.json +11 -11
  170. package/dist/ui/assets/AmbientDashboardCard-C1Ee-FKZ.js +0 -1
  171. package/dist/ui/assets/CatalogBrowser-Bz8ZtxPn.js +0 -1
  172. package/dist/ui/assets/ChatTimelineView-Do9EryEH.js +0 -7
  173. package/dist/ui/assets/ConfirmDialog-BHFs6vmJ.js +0 -1
  174. package/dist/ui/assets/ConnectedAppsPanel-BtMayq0R.js +0 -1
  175. package/dist/ui/assets/CraftbookEditor-D5jTzWwF.js +0 -1
  176. package/dist/ui/assets/DocumentDetail-CPU51d04.js +0 -1
  177. package/dist/ui/assets/DocumentsView-B6OyjvJ0.js +0 -1
  178. package/dist/ui/assets/DropdownMenu-D5fCzIrh.js +0 -1
  179. package/dist/ui/assets/Ds4Settings-CrUM_KGP.js +0 -1
  180. package/dist/ui/assets/EmbeddedChat-ue9ia-WY.js +0 -1
  181. package/dist/ui/assets/FileMapView-CxvfDLGA.js +0 -1
  182. package/dist/ui/assets/GezelDetail-DHuqBK55.js +0 -1
  183. package/dist/ui/assets/HandboekView-CPnnyj29.js +0 -1
  184. package/dist/ui/assets/HistoryView-B4VAfEMe.js +0 -1
  185. package/dist/ui/assets/HomeView-ccH60J6f.js +0 -1
  186. package/dist/ui/assets/KnowledgeCatalogsCard-Bi5Rx9Iz.js +0 -1
  187. package/dist/ui/assets/KnowledgeView-DAwjwLZo.js +0 -1
  188. package/dist/ui/assets/LlamaCppSettings-Ceyk9pDP.js +0 -1
  189. package/dist/ui/assets/MemoriesTree-BKZEPJpm.js +0 -1
  190. package/dist/ui/assets/MlxSettings-CG3wfuc3.js +0 -1
  191. package/dist/ui/assets/ModelPicker-CCBVjLMS.js +0 -1
  192. package/dist/ui/assets/NewPathDialog-D4jnNBfP.js +0 -1
  193. package/dist/ui/assets/NewTaskDialog-Ox9D612Z.js +0 -2
  194. package/dist/ui/assets/ProjectChat-DMwKnkW-.js +0 -5
  195. package/dist/ui/assets/ProjectGitStatusBar-C6bkCSby.js +0 -1
  196. package/dist/ui/assets/ProjectOverviewView-NNwXd_QQ.js +0 -1
  197. package/dist/ui/assets/ProjectsView-SBPgYOq8.js +0 -7
  198. package/dist/ui/assets/ScriptEditorTabs-paocQ6dj.js +0 -2
  199. package/dist/ui/assets/ScriptEditorView-N9zSLqqi.js +0 -5
  200. package/dist/ui/assets/SessionSwitcher-C8te7YSe.js +0 -1
  201. package/dist/ui/assets/SettingsView-Brl4JQkW.js +0 -3
  202. package/dist/ui/assets/Tabs-BAY1Q79B.js +0 -1
  203. package/dist/ui/assets/TaskTabContent-CNPJ4DQj.js +0 -1
  204. package/dist/ui/assets/TasksView-DuMjFS8S.js +0 -1
  205. package/dist/ui/assets/ToolsetsEditor-BdxHnIBj.js +0 -8
  206. package/dist/ui/assets/TransformToolbarButton-CVg5nz36.js +0 -5
  207. package/dist/ui/assets/UnrecognizedModels-Cw9Ku_bW.js +0 -1
  208. package/dist/ui/assets/chat-thread-memory-CZGcwgGo.js +0 -1
  209. package/dist/ui/assets/chunk-6ECMNUIP-C1kohb1U.js +0 -15
  210. package/dist/ui/assets/chunk-AONELFLA-Cv2nS9ga.js +0 -1
  211. package/dist/ui/assets/chunk-IIQYS2YH-Dxg6MAfT.js +0 -1
  212. package/dist/ui/assets/chunk-MIKKUKOD-XIkmalSN.js +0 -31
  213. package/dist/ui/assets/chunk-NNJLSQPW-DJA6camf.js +0 -5
  214. package/dist/ui/assets/chunk-S5PCVMKU-DbCZ5AUH.js +0 -6
  215. package/dist/ui/assets/csv-xmd1_Aqd.js +0 -4
  216. package/dist/ui/assets/dist-BPx-FyRH.js +0 -222
  217. package/dist/ui/assets/dist-Bvo52IGx.js +0 -1
  218. package/dist/ui/assets/dist-D5aoNQwk.js +0 -2
  219. package/dist/ui/assets/docx-Cj4A9MhC.js +0 -2
  220. package/dist/ui/assets/extract-UTAOG7LV-C4b7ycaL.js +0 -1
  221. package/dist/ui/assets/file-browser-80qWoVju.js +0 -5
  222. package/dist/ui/assets/html-C9TlzI57.js +0 -253
  223. package/dist/ui/assets/icons-C9dD-bDi.js +0 -1
  224. package/dist/ui/assets/images-ESPQKVTW-D7SgdVJ_.js +0 -1
  225. package/dist/ui/assets/index-D1m4Wx8V.css +0 -1
  226. package/dist/ui/assets/index-DXWR4qW1.js +0 -34
  227. package/dist/ui/assets/layouts-2A7QNF6Y-De2t-YXl.js +0 -1
  228. package/dist/ui/assets/markdown-baseline-HMqF2ChK.js +0 -1
  229. package/dist/ui/assets/outside-in-BFVUUcLa.js +0 -3
  230. package/dist/ui/assets/pptx-6ChgUEf4.js +0 -6
  231. package/dist/ui/assets/primitives-DEsn1shf.js +0 -41
  232. package/dist/ui/assets/run-export-BrYhHj1O.js +0 -23
  233. package/dist/ui/assets/standalone-source-D6mbpa3h.js +0 -11
  234. package/dist/ui/assets/storage-fn4FCEVK.js +0 -1
  235. package/dist/ui/assets/styles-C0EoNJbk.css +0 -1
  236. package/dist/ui/assets/styles-CKr_yrbn.js +0 -541
  237. package/dist/ui/assets/xlsx-DH7sTb3W.js +0 -4
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{_ as r,a as i,d as a,g as ee,i as o,l as s,m as c,p as l,r as te,s as u,t as ne,v as re,y as ie}from"./primitives-DEsn1shf.js";import{t as d}from"./api-BX5xXiFs.js";import{n as ae,t as oe}from"./relative-time-B2kBaekd.js";import{s as se}from"./gitCopy-Dcjz17cJ.js";import{r as ce,t as le}from"./useGitSync-DWxX5-7K.js";var f=e(t(),1),p=n(),ue=`Active — the Meester nudges the voorman, phase handoffs auto-start, and scheduled tasks tick. Read-only or Inactive — ambient gezel work pauses. Chat still works.`,de=`Whether Gezel-managed tools and background work may create, edit, and delete files in this project's workspace. Internal workspaces default to on; a project opened from an existing folder defaults to off (turning it on asks for confirmation first). Provider-native access such as Codex is shown separately.`,m=[{value:`plan`,label:`Plan`,hint:`Read and reason without changing workspace files.`},{value:`edit`,label:`Edit`,hint:`Edit inside the workspace; deny boundary crossings.`},{value:`reviewed`,label:`Reviewed`,hint:`Edit in the workspace; send boundary crossings to an independent Codex reviewer.`},{value:`full`,label:`Full`,hint:`Run without Codex sandboxing or approvals. Gezel still blocks a narrow set of unmistakably destructive commands.`}],h=[{value:`plan`,label:`Plan`,hint:`Read and reason without changing workspace files.`},{value:`default`,label:`Ask`,hint:`Let Claude request permission for tool use.`},{value:`acceptEdits`,label:`Edit`,hint:`Auto-approve file edits; gate shell commands.`},{value:`bypassPermissions`,label:`Full`,hint:`Bypass Claude permission prompts, including for shell commands.`}];function fe(e){let t=m.find(t=>t.value===e);return`Codex ${t?.label??e}: ${t?.hint??``}`}function pe(e){if(e===`mixed`)return`Claude: assigned gezels currently use different permission modes.`;let t=h.find(t=>t.value===e);return`Claude ${t?.label??e}: ${t?.hint??``}`}var me=[{value:`active`,label:`Active`},{value:`stable`,label:`Stable`},{value:`readonly`,label:`Read-only`},{value:`inactive`,label:`Inactive`}];function g({unlocked:e=!1}){return(0,p.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:[(0,p.jsx)(`rect`,{x:`3`,y:`7`,width:`10`,height:`7`,rx:`1.25`,stroke:`currentColor`,strokeWidth:`1.5`}),e?(0,p.jsx)(`path`,{d:`M5 7V5a3 3 0 0 1 5.75-1.2`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`}):(0,p.jsx)(`path`,{d:`M5 7V5a3 3 0 0 1 6 0v2`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`})]})}function he(){return(0,p.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:[(0,p.jsx)(`rect`,{x:`3`,y:`1.75`,width:`10`,height:`12.5`,rx:`1.5`,stroke:`currentColor`,strokeWidth:`1.1`}),(0,p.jsx)(`line`,{x1:`5.2`,y1:`5`,x2:`10.8`,y2:`5`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`,opacity:`0.35`}),(0,p.jsx)(`line`,{x1:`5.2`,y1:`7.5`,x2:`10.8`,y2:`7.5`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`,opacity:`0.35`}),(0,p.jsx)(`line`,{x1:`5.2`,y1:`10`,x2:`9.4`,y2:`10`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`,opacity:`0.35`}),(0,p.jsx)(`line`,{className:`project-index-scanline`,x1:`4.4`,y1:`4.2`,x2:`11.6`,y2:`4.2`,strokeWidth:`1.3`,strokeLinecap:`round`})]})}function ge(){return(0,p.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,focusable:`false`,children:[(0,p.jsxs)(`g`,{className:`project-index-quill-feather`,children:[(0,p.jsx)(`path`,{d:`M13 2.5C10.2 3.4 7.4 5.7 6 8.7L5.1 10.9L7.3 10C10.3 8.6 12.1 5.4 13 2.5Z`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinejoin:`round`}),(0,p.jsx)(`path`,{d:`M11.6 3.9L6.6 9.4`,stroke:`currentColor`,strokeWidth:`0.9`,opacity:`0.45`}),(0,p.jsx)(`path`,{d:`M5.1 10.9L4.2 12.1`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`})]}),(0,p.jsx)(`path`,{className:`project-index-quill-line`,d:`M3.4 13.9H12.4`,strokeWidth:`1.3`,strokeLinecap:`round`})]})}function _e({projectStatus:e,statusLocked:t,onStatusChange:n,managedWritesOn:i,onManagedWorkspaceWritesChange:a,codexMode:o,onCodexModeChange:s,claudeMode:c,onClaudeModeChange:l}){let[te,u]=(0,f.useState)(!1);return!n&&!s&&!l&&(!a||i)?null:(0,p.jsx)(`div`,{className:`project-controls-overflow`,children:(0,p.jsxs)(r,{open:te,onOpenChange:u,children:[(0,p.jsx)(re,{asChild:!0,children:(0,p.jsx)(`button`,{type:`button`,className:`project-controls-overflow-trigger`,title:`More project controls`,"aria-label":`More project controls`,children:`…`})}),(0,p.jsx)(ee,{className:`project-controls-overflow-popover`,side:`top`,align:`end`,children:(0,p.jsxs)(`fieldset`,{className:`project-controls-overflow-fieldset`,children:[(0,p.jsx)(`legend`,{className:`sr-only`,children:`Project controls overflow`}),n&&(0,p.jsxs)(`section`,{className:`project-controls-overflow-section`,children:[(0,p.jsx)(`span`,{className:`project-controls-overflow-label`,children:`Project status`}),(0,p.jsx)(`div`,{className:`project-controls-overflow-options`,children:me.map(r=>(0,p.jsxs)(`button`,{type:`button`,className:`project-controls-overflow-item project-status-select-${r.value}`,"aria-pressed":e===r.value,disabled:t,onClick:()=>{n(r.value),u(!1)},children:[(0,p.jsx)(`span`,{className:`project-status-select-dot`,"aria-hidden":!0}),(0,p.jsx)(`span`,{children:r.label})]},r.value))})]}),a&&!i&&(0,p.jsxs)(`section`,{className:`project-controls-overflow-section`,children:[(0,p.jsx)(`span`,{className:`project-controls-overflow-label`,children:`Built-in tools`}),(0,p.jsxs)(`button`,{type:`button`,className:`project-controls-overflow-item`,onClick:()=>{a(!0),u(!1)},children:[(0,p.jsx)(`span`,{className:`project-writes-select-icon`,"aria-hidden":!0,children:(0,p.jsx)(g,{unlocked:!0})}),(0,p.jsx)(`span`,{children:`Allow workspace edits`})]})]}),o&&s&&(0,p.jsxs)(`section`,{className:`project-controls-overflow-section`,children:[(0,p.jsx)(`span`,{className:`project-controls-overflow-label`,children:`Codex access`}),(0,p.jsx)(`div`,{className:`project-controls-overflow-options`,children:m.map(e=>(0,p.jsx)(`button`,{type:`button`,className:`project-controls-overflow-item`,"aria-pressed":o===e.value,title:e.hint,onClick:()=>{s(e.value),u(!1)},children:e.label},e.value))})]}),c&&l&&(0,p.jsxs)(`section`,{className:`project-controls-overflow-section`,children:[(0,p.jsx)(`span`,{className:`project-controls-overflow-label`,children:`Claude access`}),(0,p.jsx)(`div`,{className:`project-controls-overflow-options`,children:h.map(e=>(0,p.jsx)(`button`,{type:`button`,className:`project-controls-overflow-item`,"aria-pressed":c===e.value,title:e.hint,onClick:()=>{l(e.value),u(!1)},children:e.label},e.value))})]})]})})]})})}function _({projectId:e,compact:t=!1,managedWorkspaceWritable:n=!0,onManagedWorkspaceWritesChange:_,codexMode:v,onCodexModeChange:Se,claudeMode:y,onClaudeModeChange:b,onOpenGitHub:x,onAddBoekwachter:S,status:C,statusLocked:w=!1,onStatusChange:Ce}){let[T,we]=(0,f.useState)(null),[E,Te]=(0,f.useState)(null),[D,O]=(0,f.useState)(null),[k,A]=(0,f.useState)(!1),[Ee,j]=(0,f.useState)(!1),[De,Oe]=(0,f.useState)(``),[ke,M]=(0,f.useState)(``),[Ae,je]=(0,f.useState)(null),[Me,Ne]=(0,f.useState)(!1),[N,Pe]=(0,f.useState)(!1),[Fe,P]=(0,f.useState)(null),[F,I]=(0,f.useState)(`idle`),[L,R]=(0,f.useState)(`idle`),[z,B]=(0,f.useState)(null),[V,Ie]=(0,f.useState)(!1),H=(0,f.useRef)(null),U=n,W=(0,f.useCallback)(async()=>{try{let t=await d.getProjectGitStatus(e);we(t)}catch{}},[e]),G=(0,f.useCallback)(async()=>{try{Te(await d.getProjectIndexStatus(e))}catch{}},[e]);(0,f.useEffect)(()=>{W(),G();let e=window.setInterval(()=>{W(),G()},3e4);return()=>window.clearInterval(e)},[W,G]);let Le=E?.aiDrive!=null||F!==`idle`;(0,f.useEffect)(()=>{if(!Le)return;let e=window.setInterval(()=>void G(),5e3);return()=>window.clearInterval(e)},[Le,G]),(0,f.useEffect)(()=>{let t=t=>{t.detail?.projectId===e&&W()};return window.addEventListener(le,t),()=>window.removeEventListener(le,t)},[e,W]);let K=(0,f.useRef)(null),[Re,ze]=(0,f.useState)(!1);(0,f.useEffect)(()=>{let e=E?.enrichment?.pending;if(e===void 0||e<=0||E?.aiDrive){K.current=null,ze(!1);return}let t=K.current;if(K.current={pending:e,at:Date.now()},!t)return;let n=Date.now()-t.at;if(n<2e4)return;let r=t.pending-e,i=r>0?r/n:5/12e4;ze(e/i>1440*60*1e3)},[E]);let Be=(0,f.useCallback)(async()=>{if(!(N||E===null||E.state===`disabled`||E.state===`indexing`)){Pe(!0),P(null);try{await d.refreshProjectIndex(e),Te(e=>e?{...e,state:`indexing`}:{state:`indexing`}),window.setTimeout(()=>void G(),800)}catch{P(`Couldn’t start the index update. Try again.`)}finally{Pe(!1)}}},[N,E,e,G]),Ve=(0,f.useRef)(null),He=(0,f.useCallback)(async()=>{if(!(F!==`idle`||E===null||E.state===`disabled`||E.aiDrive!=null)){I(`starting`),B(null),Ve.current=E;try{let t=await d.driveIndexEnrichment(e,{intensity:`full`});if(t.mode===`embed-only`){B({code:`boekwachter-required`,message:t.hint??``}),I(`idle`),window.setTimeout(()=>void G(),800);return}I(`running`),window.setTimeout(()=>void G(),800)}catch(e){let t=e&&typeof e==`object`&&`details`in e?e.details:void 0;B({code:t?.error,message:t?.message??`Couldn’t start the full scan. Try again.`}),I(`idle`)}}},[F,E,e,G]),Ue=(0,f.useCallback)(async()=>{if(L===`idle`){R(`requesting`),B(null);try{await d.stopIndexEnrichment(e),R(`stopping`),window.setTimeout(()=>void G(),800)}catch{R(`idle`),B({message:`Couldn’t stop the scan. Try again.`})}}},[L,e,G]),We=(0,f.useCallback)(async()=>{if(!(!S||V)){Ie(!0);try{await S(),B(null)}catch(e){B({message:e instanceof Error?e.message:`Couldn’t add the Boekwachter. Try again.`})}finally{Ie(!1)}}},[V,S]);(0,f.useEffect)(()=>{F===`running`&&E!==Ve.current&&E!==null&&E.aiDrive==null&&I(`idle`)},[F,E]),(0,f.useEffect)(()=>{L!==`idle`&&E!==null&&E.aiDrive==null&&R(`idle`)},[L,E]),(0,f.useEffect)(()=>{if(!k)return;let e=e=>{H.current&&!H.current.contains(e.target)&&(A(!1),j(!1))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[k]),(0,f.useEffect)(()=>{!k||D||d.listProjectGitBranches(e).then(O).catch(()=>O({local:[],remote:[]}))},[k,D,e]);let q=(0,f.useCallback)((e,t)=>{je({kind:e,text:t}),window.setTimeout(()=>je(null),4e3)},[]),{sync:Ge,syncing:Ke}=ce(e,{onToast:q,onNeedsSave:()=>{q(`err`,`Save your changes first — they’re waiting in the GitHub tab.`),x?.()},onConflicts:()=>x?.(),onAuth:()=>x?.()}),qe=(0,f.useCallback)(async()=>{await Ge(),await W()},[Ge,W]),Je=(0,f.useCallback)(async t=>{A(!1),M(`branch`);try{await d.setProjectGitBranch(e,t),await W(),q(`ok`,`Switched to ${t}.`)}catch(e){q(`err`,`Couldn’t switch: ${e instanceof Error?e.message:String(e)}`)}finally{M(``)}},[e,W,q]),Ye=(0,f.useCallback)(async t=>{t.preventDefault();let n=De.trim();if(n){A(!1),j(!1),Oe(``),M(`branch`);try{await d.createProjectGitBranch(e,n),O(null),await W(),q(`ok`,`Created and switched to ${n}.`)}catch(e){q(`err`,`Couldn’t create: ${e instanceof Error?e.message:String(e)}`)}finally{M(``)}}},[De,e,W,q]),Xe=!!T?.github,Ze=T?.branch,J=T?.github?.lastSyncedAt,Y=E?.state??`never`,X=E?.aiScanPending===!0,Qe=E?.embeddings?.status,$e=Qe===`disabled`||Qe===`unavailable`||E?.enrichment?.vectorsAvailable===!1,et=E?.embeddings?.reason??(E?.enrichment?.vectorsAvailable===!1?`the vector extension failed to load`:`the embedding model could not be loaded`),tt=Y===`disabled`?`disabled`:Y===`indexing`?`indexing`:Y===`fresh`?X||$e?`scan`:`fresh`:`stale`,Z=E?.enrichment,nt=Z?.searchReady??Z?.embedded??0;Z&&ve(nt,Z.eligible);let rt=Z?.skipped??0,it=Z?.skippedFiles??[],at=Math.max(0,rt-it.length),ot=Z?`${Z.summarized} of ${Z.eligible} files${rt>0?` · ${rt} skipped after repeated failures`:``}`:``,Q=Z?ye(Z):null,$=E?.aiDrive??null,st=E===null?`Checking workspace index`:Y===`disabled`?`Workspace indexing is off`:Y===`indexing`?`Scanning workspace`:Y===`never`?`Workspace not indexed`:Y===`stale`?`Workspace scan is out of date`:X?Q===null?`AI indexing is pending`:`AI indexing ${Q}% complete`:`Workspace index is ready`,ct=`Indexing status: ${st}`,lt=E===null||Y===`disabled`||Y===`indexing`||N,ut=T?se({mergeInProgress:T.mergeInProgress,changesCount:T.changesCount,ahead:T.ahead,behind:T.behind,syncStale:T.syncStale}):``,dt=T?.mergeInProgress===!0||(T?.changesCount??0)>0||(T?.ahead??0)>0||(T?.behind??0)>0||T?.syncStale===!0,ft=T?.syncStale===!0||(T?.ahead??0)>0||(T?.behind??0)>0;return(0,p.jsxs)(`div`,{className:`project-git-status-bar${t?` is-compact`:``}`,children:[(0,p.jsxs)(`div`,{className:`project-git-status-bar-left`,children:[Xe&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`project-git-branch-picker`,ref:H,children:[(0,p.jsxs)(`button`,{type:`button`,className:`project-git-branch-chip`,onClick:()=>A(e=>!e),disabled:!T?.exists,title:`Switch branch`,children:[(0,p.jsx)(`span`,{className:`project-git-icon`,"aria-hidden":!0,children:`⎇`}),(0,p.jsx)(`span`,{className:`project-git-branch-name`,children:Ze??`(detached)`}),(0,p.jsx)(ie,{className:`project-git-chevron`})]}),k&&(0,p.jsxs)(`div`,{className:`project-git-branch-menu`,role:`menu`,children:[D===null?(0,p.jsx)(`div`,{className:`project-git-branch-loading muted small`,children:`Loading branches…`}):(0,p.jsxs)(p.Fragment,{children:[D.local.length>0&&(0,p.jsxs)(`div`,{className:`project-git-branch-group`,children:[(0,p.jsx)(`div`,{className:`project-git-branch-group-label muted small`,children:`Local`}),D.local.map(e=>(0,p.jsx)(`button`,{type:`button`,className:`project-git-branch-item${e===Ze?` is-current`:``}`,onClick:()=>void Je(e),children:e},`local-${e}`))]}),D.remote.length>0&&(0,p.jsxs)(`div`,{className:`project-git-branch-group`,children:[(0,p.jsx)(`div`,{className:`project-git-branch-group-label muted small`,children:`Remote`}),D.remote.map(e=>(0,p.jsx)(`button`,{type:`button`,className:`project-git-branch-item`,onClick:()=>void Je(e),children:e},`remote-${e}`))]})]}),(0,p.jsx)(`div`,{className:`project-git-branch-divider`}),Ee?(0,p.jsxs)(`form`,{className:`project-git-new-branch-form`,onSubmit:Ye,children:[(0,p.jsx)(`input`,{value:De,onChange:e=>Oe(e.target.value),placeholder:`new-branch-name`,autoFocus:!0}),(0,p.jsx)(`button`,{type:`submit`,className:`primary`,children:`Create`})]}):(0,p.jsx)(`button`,{type:`button`,className:`project-git-branch-item project-git-new-branch-trigger`,onClick:()=>j(!0),children:`+ new branch`})]})]}),T&&!t&&(0,p.jsxs)(`button`,{type:`button`,className:`project-git-status-chip${dt?` has-attention`:``}${T.mergeInProgress?` has-conflict`:``}`,onClick:x,title:`Open the GitHub tab`,children:[ut,!dt&&J&&(0,p.jsxs)(`span`,{className:`muted small`,title:oe(J),children:[` `,`· synced `,ae(J,{seconds:!0})]})]})]}),(0,p.jsxs)(r,{open:Me,onOpenChange:e=>{Ne(e),e&&(P(null),G())},children:[(0,p.jsx)(re,{asChild:!0,children:(0,p.jsxs)(`button`,{type:`button`,className:`project-index-chip project-index-chip-${tt}`,"aria-label":ct,title:`Open indexing status`,children:[(0,p.jsxs)(`svg`,{className:`project-index-icon`,width:`14`,height:`14`,viewBox:`0 0 16 16`,"aria-hidden":`true`,focusable:`false`,children:[(0,p.jsx)(`rect`,{x:`3`,y:`2`,width:`10.5`,height:`12`,rx:`1.3`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.2`}),(0,p.jsx)(`line`,{x1:`6`,y1:`2`,x2:`6`,y2:`14`,stroke:`currentColor`,strokeWidth:`1.2`}),(0,p.jsx)(`line`,{x1:`8`,y1:`5.5`,x2:`11.5`,y2:`5.5`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`}),(0,p.jsx)(`line`,{x1:`8`,y1:`8`,x2:`11.5`,y2:`8`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`}),(0,p.jsx)(`line`,{x1:`8`,y1:`10.5`,x2:`10.5`,y2:`10.5`,stroke:`currentColor`,strokeWidth:`1.1`,strokeLinecap:`round`})]}),(0,p.jsx)(`span`,{className:`project-index-dot`,"aria-hidden":!0})]})}),(0,p.jsx)(ee,{className:`project-index-popover`,side:`top`,align:`center`,"aria-label":`Indexing status`,children:(0,p.jsxs)(`div`,{className:`project-index-panel`,children:[(0,p.jsxs)(`div`,{className:`project-index-panel-heading`,children:[(0,p.jsx)(`span`,{className:`project-index-panel-dot project-index-panel-dot-${tt}`,"aria-hidden":!0}),(0,p.jsx)(`strong`,{children:st}),Y===`indexing`||N?(0,p.jsx)(`span`,{className:`project-index-phase-spinner`,role:`img`,"aria-label":`File scan running`,title:`Reading the workspace file by file`,children:(0,p.jsx)(he,{})}):$!==null||F===`running`?(0,p.jsx)(`span`,{className:`project-index-phase-spinner`,role:`img`,"aria-label":`AI scan running`,title:`Studying files — summaries, reviews, and media`,children:(0,p.jsx)(ge,{})}):null]}),$e&&(0,p.jsxs)(`p`,{className:`project-index-panel-warning`,children:[`Semantic search is off — `,et,`. Results are keyword-only`,Qe===`unavailable`?`; retrying automatically`:``,`.`]}),Z&&Z.eligible>0&&Q!==null&&(0,p.jsxs)(`div`,{className:`project-index-panel-progress`,children:[(0,p.jsxs)(`div`,{className:`project-index-panel-progress-label`,children:[(0,p.jsx)(`span`,{children:`Indexing progress`}),(0,p.jsxs)(`strong`,{children:[Q,`%`]})]}),(0,p.jsx)(`div`,{className:`project-index-panel-progress-track`,role:`progressbar`,"aria-label":`Indexing progress`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Q,tabIndex:-1,children:(0,p.jsx)(`span`,{style:{width:`${Q}%`}})}),(0,p.jsxs)(`span`,{className:`project-index-panel-caption`,children:[nt,` of `,Z.eligible,` files searchable`,Z.pending>0?` · ${Z.pending} waiting`:``]})]}),(0,p.jsxs)(`dl`,{className:`project-index-panel-details`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{children:`File scan`}),(0,p.jsx)(`dd`,{children:be(Y)})]}),E?.meta&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{children:`Indexed`}),(0,p.jsxs)(`dd`,{children:[E.meta.fileCount,` file`,E.meta.fileCount===1?``:`s`]})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{children:`Last scan`}),(0,p.jsxs)(`dd`,{title:oe(E.meta.scannedAt),children:[ae(E.meta.scannedAt,{seconds:!0}),` ·`,` `,xe(E.meta.durationMs)]})]})]}),$&&(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{children:`AI scan`}),(0,p.jsx)(`dd`,{children:$===`full`?`Running at full speed`:`Running quietly in background`})]}),Z&&(Z.shadowsPending??0)>0&&(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{children:`Media scan`}),(0,p.jsxs)(`dd`,{children:[Z.shadowsPending,` waiting`]})]}),Z&&Z.eligible>0&&(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{children:`AI summaries`}),(0,p.jsx)(`dd`,{children:it.length>0?(0,p.jsx)(te,{delayDuration:150,children:(0,p.jsxs)(o,{children:[(0,p.jsx)(i,{asChild:!0,children:(0,p.jsx)(`button`,{type:`button`,className:`project-index-skipped-trigger`,children:ot})}),(0,p.jsx)(ne,{side:`left`,children:(0,p.jsxs)(`div`,{className:`project-index-skipped-tip`,children:[(0,p.jsx)(`strong`,{children:`Skipped after repeated failures`}),(0,p.jsx)(`ul`,{children:it.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsx)(`span`,{className:`project-index-skipped-path`,children:e.path}),e.reason&&(0,p.jsx)(`span`,{className:`project-index-skipped-reason`,children:e.reason})]},e.path))}),at>0&&(0,p.jsxs)(`span`,{className:`project-index-skipped-more`,children:[`and `,at,` more`]}),(0,p.jsx)(`span`,{className:`project-index-skipped-note`,children:`Each retries once its content changes.`})]})})]})}):ot})]}),Z?.reviews&&Z.reviews.eligible>0&&(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`dt`,{children:`Quality review`}),(0,p.jsxs)(`dd`,{children:[Z.reviews.reviewed,` of `,Z.reviews.eligible,Z.reviews.pending>0?` · ${Z.reviews.pending} waiting`:``,Z.reviews.stale>0?` · ${Z.reviews.stale} to refresh`:``]})]})]}),(0,p.jsxs)(`div`,{className:`project-index-panel-footer`,children:[(0,p.jsx)(`span`,{className:`project-index-panel-note`,children:Y===`disabled`?(0,p.jsxs)(p.Fragment,{children:[`Workspace indexing is off.`,` `,(0,p.jsx)(`button`,{type:`button`,className:`project-index-panel-link`,onClick:()=>window.dispatchEvent(new CustomEvent(`gezel:open-project-settings`,{detail:{projectId:e}})),children:`Turn it on in Project Settings`}),`.`]}):$===`full`?`Full scan in progress — it shares the model with chat, so counts move as calls finish.`:$===`background`?`Background scan in progress — it politely waits while you chat.`:Y===`indexing`?`The status updates automatically while the scan runs.`:X&&Re?(0,p.jsxs)(p.Fragment,{children:[`At the idle pace this will take more than a day.`,` `,(0,p.jsx)(`button`,{type:`button`,className:`project-index-panel-link`,onClick:()=>window.dispatchEvent(new CustomEvent(`gezel:open-night-shift`)),children:`Set up Night Shift`}),` `,`or use “Start full AI scan” to finish sooner.`]}):X?`AI indexing continues while the app is idle.`:`Refresh the index whenever you need the latest workspace state.`}),(0,p.jsxs)(`div`,{className:`project-index-panel-actions`,children:[$!==null||F===`running`?(0,p.jsx)(`button`,{type:`button`,className:`project-index-update-button`,disabled:L!==`idle`,onClick:()=>void Ue(),title:`Stop the running scan at its next step. Everything indexed so far is kept.`,children:L===`idle`?`Stop updating index`:`Stopping…`}):(0,p.jsx)(`button`,{type:`button`,className:`project-index-update-button`,disabled:lt,onClick:()=>void Be(),children:Y===`indexing`||N?`Updating index…`:`Update index`}),Y!==`disabled`&&(0,p.jsx)(`button`,{type:`button`,className:`project-index-update-button project-index-full-scan-button`,disabled:F!==`idle`||$!==null||E===null,onClick:()=>void He(),title:`Bring the whole index up to date at full speed — file scan plus AI summaries, rollups, and reviews, run to completion. Shares the model with chat while it works.`,children:F===`starting`?`Starting full scan…`:F===`running`||$===`full`?`Full scan running…`:$===`background`?`Background scan running…`:`Start full AI scan`})]}),Fe&&(0,p.jsx)(`span`,{className:`project-index-panel-error`,role:`alert`,children:Fe}),z&&(0,p.jsx)(`span`,{className:`project-index-panel-error`,role:`alert`,children:z.code===`boekwachter-required`&&S?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`button`,{type:`button`,className:`project-index-panel-error-link`,disabled:V,onClick:()=>void We(),children:V?`Adding Boekwachter…`:`Add a Boekwachter to this project crew`}),` `,`to enable AI summaries, reviews, and semantic enrichment.`]}):z.message})]})]})})]}),(0,p.jsxs)(`div`,{className:`project-controls-inline`,children:[Ce&&(0,p.jsxs)(a,{value:C??`active`,disabled:w,onValueChange:e=>Ce(e),children:[(0,p.jsxs)(l,{className:`project-status-select project-status-select-${C??`active`}`,title:w?`Archived projects are inactive. Restore this project to change its status.`:ue,"aria-label":`Project status`,children:[(0,p.jsx)(`span`,{className:`project-status-select-dot`,"aria-hidden":!0}),(0,p.jsx)(c,{})]}),(0,p.jsx)(u,{children:me.map(e=>(0,p.jsx)(s,{value:e.value,children:e.label},e.value))})]}),_&&(!t||!U)&&(0,p.jsxs)(a,{value:U?`on`:`off`,onValueChange:e=>_(e===`on`),children:[(0,p.jsxs)(l,{className:`project-writes-select project-writes-select-${U?`on`:`off`}`,title:de,"aria-label":`Built-in tool workspace access for this project`,children:[(0,p.jsx)(`span`,{className:`project-writes-select-icon`,"aria-hidden":!0,children:(0,p.jsx)(g,{unlocked:U})}),(0,p.jsx)(c,{})]}),(0,p.jsxs)(u,{children:[(0,p.jsx)(s,{value:`on`,children:`Can edit`}),(0,p.jsx)(s,{value:`off`,children:`Read-only`})]})]}),v&&Se&&(0,p.jsxs)(a,{value:v,onValueChange:e=>Se(e),children:[(0,p.jsxs)(l,{className:`project-writes-select project-codex-mode project-codex-mode-${v}`,title:fe(v),"aria-label":`Codex execution mode for this project`,children:[(0,p.jsx)(`span`,{className:`project-writes-select-icon`,"aria-hidden":!0,children:(0,p.jsx)(g,{unlocked:v!==`plan`})}),(0,p.jsx)(`span`,{className:`project-permission-scope`,children:`Codex:`}),(0,p.jsx)(c,{})]}),(0,p.jsx)(u,{children:m.map(e=>(0,p.jsx)(s,{value:e.value,textValue:e.label,children:e.label},e.value))})]}),y&&b&&(0,p.jsxs)(a,{value:y,onValueChange:e=>{e!==`mixed`&&b(e)},children:[(0,p.jsxs)(l,{className:`project-writes-select project-claude-mode project-claude-mode-${y}`,title:pe(y),"aria-label":`Claude execution mode for this project`,children:[(0,p.jsx)(`span`,{className:`project-writes-select-icon`,"aria-hidden":!0,children:(0,p.jsx)(g,{unlocked:y!==`plan`&&y!==`mixed`})}),(0,p.jsx)(`span`,{className:`project-permission-scope`,children:`Claude:`}),(0,p.jsx)(c,{})]}),(0,p.jsxs)(u,{children:[y===`mixed`&&(0,p.jsx)(s,{value:`mixed`,disabled:!0,children:`Mixed`}),h.map(e=>(0,p.jsx)(s,{value:e.value,textValue:e.label,children:e.label},e.value))]})]})]}),t&&(0,p.jsx)(_e,{projectStatus:C??`active`,statusLocked:w,onStatusChange:Ce,managedWritesOn:U,onManagedWorkspaceWritesChange:_,codexMode:v,onCodexModeChange:Se,claudeMode:y,onClaudeModeChange:b}),!_&&!U&&(0,p.jsxs)(`span`,{className:`project-lockdown-chip`,title:`Managed workspace edits are off for this project. Enable "Allow built-in tools and background work to modify the workspace" in Project → Settings.`,"aria-label":`Built-in tool workspace access is read-only for this project.`,children:[(0,p.jsx)(`span`,{className:`project-lockdown-chip-icon`,"aria-hidden":!0,children:(0,p.jsx)(g,{})}),(0,p.jsx)(`span`,{className:`project-lockdown-chip-label`,children:`edits off`})]})]}),!t&&(0,p.jsx)(`div`,{className:`project-git-status-bar-right`,children:Xe&&(0,p.jsx)(`button`,{type:`button`,className:`project-git-action${ft?` primary`:``}`,onClick:()=>void qe(),disabled:Ke||ke!==``,title:`Get new changes from GitHub and send yours`,children:Ke?`Syncing…`:`Sync`})}),Ae&&(0,p.jsx)(`output`,{className:`project-git-toast project-git-toast-${Ae.kind}`,children:Ae.text})]})}function ve(e,t){return t<=0?null:Math.round(Math.min(Math.max(e,0),t)/t*100)}function ye(e){let t=[[e.summarized,e.eligible],[e.embedded,e.eligible]];e.reviews&&t.push([e.reviews.reviewed,e.reviews.eligible]);let n=0,r=0;for(let[e,i]of t)i<=0||(n+=Math.min(Math.max(e,0),i),r+=i);return r>0?Math.round(n/r*100):null}function be(e){switch(e){case`fresh`:return`Up to date`;case`stale`:return`Needs a rescan`;case`indexing`:return`Scanning now`;case`never`:return`Not scanned yet`;case`disabled`:return`Off for this project`}}function xe(e){if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<6e4)return`${(e/1e3).toFixed(+(e<1e4))}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n>0?`${t}m ${n}s`:`${t}m`}export{_ as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{Z as r,nn as i}from"./dist-BPx-FyRH.js";import{t as a}from"./api-BX5xXiFs.js";import{t as o}from"./ConfirmDialog-BHFs6vmJ.js";import{s}from"./index-DXWR4qW1.js";import{t as c}from"./MarkdownField-D-0Zw7gM.js";import{a as l,i as u}from"./WorkspaceIndexPane-DU4yd4Ai.js";var d=e(t(),1),f=n();function p({projectId:e}){let[t,n]=(0,d.useState)(null),[r,i]=(0,d.useState)(null),[s,c]=(0,d.useState)(``),[u,p]=(0,d.useState)(null),[m,h]=(0,d.useState)(null),g=(0,d.useCallback)(async()=>{try{n(await a.listPeople(e))}catch{n(null)}},[e]);(0,d.useEffect)(()=>{g()},[g]);let _=(0,d.useCallback)(t=>a.fetchProjectWorkspaceBlob(e,t),[e]),v=(0,d.useCallback)(async t=>{let n=s.trim();if(i(null),!(!n||n===t.label)){h(null);try{await a.renamePerson(e,t.entityId,n),await g()}catch(e){h(e instanceof Error?e.message:String(e))}}},[s,e,g]),y=(0,d.useCallback)(async()=>{if(u){h(null);try{await a.forgetPerson(e,u.entityId),p(null),await g()}catch(e){h(e instanceof Error?e.message:String(e))}}},[u,e,g]);return!t?.available||t.people.length===0?null:(0,f.jsxs)(`section`,{className:`people-panel`,children:[(0,f.jsx)(`h3`,{children:`People`}),(0,f.jsx)(`p`,{className:`muted small`,children:`Recognized locally from photos in this project. Name someone once and search can find them everywhere.`}),(0,f.jsx)(`div`,{className:`people-grid`,children:t.people.map(e=>(0,f.jsxs)(`div`,{className:`people-card`,children:[(0,f.jsx)(`div`,{className:`people-card-photo`,children:e.exemplar?(0,f.jsx)(l,{path:e.exemplar.path,fetchBlob:_,alt:e.label}):(0,f.jsx)(`span`,{className:`similar-thumb-fallback`,children:e.label.slice(0,1)})}),r===e.entityId?(0,f.jsx)(`input`,{className:`people-card-rename`,value:s,ref:e=>e?.focus(),onChange:e=>c(e.target.value),onBlur:()=>void v(e),onKeyDown:t=>{t.key===`Enter`&&v(e),t.key===`Escape`&&i(null)},"aria-label":`Name for ${e.label}`}):(0,f.jsx)(`button`,{type:`button`,className:`people-card-name`,title:`Who is this?`,onClick:()=>{c(/^Person \d+$/.test(e.label)?``:e.label),i(e.entityId)},children:e.label}),(0,f.jsxs)(`span`,{className:`muted small`,children:[e.count,` photo`,e.count===1?``:`s`]}),(0,f.jsx)(`button`,{type:`button`,className:`people-card-forget`,onClick:()=>p(e),children:`Forget`})]},e.entityId))}),m&&(0,f.jsx)(`p`,{className:`error small`,children:m}),(0,f.jsx)(o,{open:u!==null,title:`Forget ${u?.label??`this person`}?`,message:`They disappear from People and search, and new photos of them stay unlisted. This does not delete any photos. To erase all face data instead, use Settings.`,confirmLabel:`Forget`,danger:!0,onConfirm:y,onCancel:()=>p(null)})]})}function m({label:e,hint:t,children:n,testId:r}){return(0,f.jsxs)(`section`,{"data-testid":r,children:[(0,f.jsxs)(`div`,{className:`home-workshop-rail-head`,children:[(0,f.jsx)(`div`,{className:`home-workshop-eyebrow`,style:{whiteSpace:`nowrap`},children:e}),t&&(0,f.jsx)(`div`,{className:`home-workshop-rail-hint`,children:t})]}),n]})}var h=()=>void 0;function g(e){let t=e.filter(e=>!e.isDirectory&&/^reports\/digest-\d{4}-W\d{2}\.md$/.test(e.path)).map(e=>e.path).sort();return t[t.length-1]??null}function _({projectId:e,project:t}){let[n,o]=(0,d.useState)(null),[l,_]=(0,d.useState)(null),[v,y]=(0,d.useState)([]),[b,x]=(0,d.useState)(null),[S,C]=(0,d.useState)([]);(0,d.useEffect)(()=>{let t=!1;return o(null),x(null),C([]),a.toolMapRepo(e,{}).then(e=>{t||o(e)}).catch(()=>{t||o(null)}),a.getProjectIndexStatus(e).then(e=>{t||_(e)}).catch(()=>void 0),a.listHistory({projectId:e,limit:8}).then(e=>{t||y(e.entries)}).catch(()=>void 0),a.toolListTables(e).then(e=>{t||C(e.tables)}).catch(()=>void 0),a.listProjectArtifacts(e,`reports`,!0).then(async n=>{let r=g(n.files);if(!r||t)return;let i=await a.readProjectArtifact(e,r);t||x({path:r,content:i.content})}).catch(()=>void 0),()=>{t=!0}},[e]);let w=i(t),T=w?r(w)?.label??w:null,E=(n?.areas??[]).filter(e=>e.purpose),D=l?.state===`indexing`,O=l?.state===`disabled`,k=l?.aiScanPending===!0,A=l?.enrichment?.reviews?.pending??0;return(0,f.jsxs)(`div`,{className:`project-overview`,children:[(0,f.jsxs)(`div`,{className:`project-overview-head`,children:[(0,f.jsxs)(`div`,{className:`project-overview-title`,children:[(0,f.jsx)(s,{project:t,size:24,className:`project-overview-icon`}),(0,f.jsx)(`h2`,{children:t.name})]}),(0,f.jsxs)(`div`,{className:`project-overview-meta`,children:[T&&(0,f.jsx)(`span`,{className:`project-overview-chip`,children:T}),n?.indexed&&(0,f.jsxs)(`span`,{className:`project-overview-chip muted`,children:[n.fileCount,` files indexed`]}),(D||k)&&(0,f.jsx)(`span`,{className:`project-overview-chip pending`,children:u(l)})]})]}),!n?.indexed&&O&&(0,f.jsxs)(`p`,{className:`muted`,children:[`Workspace indexing is off for this project.`,` `,(0,f.jsx)(`button`,{type:`button`,className:`project-index-panel-link`,onClick:()=>window.dispatchEvent(new CustomEvent(`gezel:open-project-settings`,{detail:{projectId:e}})),children:`Turn it on in Project Settings`}),`.`]}),!n?.indexed&&!O&&(0,f.jsx)(`p`,{className:`muted`,children:`The boekwachter hasn't scanned this workspace yet. The map, folder notes, and architecture summary appear here once indexing runs.`}),n?.architecture&&(0,f.jsx)(m,{label:`Architecture`,testId:`overview-architecture`,children:(0,f.jsx)(`p`,{className:`project-overview-architecture`,children:n.architecture})}),n?.indexed&&!n.architecture&&(0,f.jsx)(m,{label:`Architecture`,children:(0,f.jsx)(`p`,{className:`muted small`,children:`Not written yet — the boekwachter distills an architecture note after it has summarized the files (idle time or Night Shift).`})}),n?.health&&(0,f.jsxs)(m,{label:`Health`,testId:`overview-health`,children:[(0,f.jsxs)(`div`,{className:`project-overview-chips`,children:[(0,f.jsxs)(`span`,{className:`project-overview-chip`,children:[`avg `,n.health.avgHealth,`/10`]}),(0,f.jsxs)(`span`,{className:`project-overview-chip muted`,children:[n.health.reviewedFiles,`/`,n.health.eligibleFiles,` files reviewed`]}),n.health.majorIssues>0&&(0,f.jsxs)(`span`,{className:`project-overview-chip pending`,children:[n.health.majorIssues,` major issue`,n.health.majorIssues===1?``:`s`]}),n.health.minorIssues>0&&(0,f.jsxs)(`span`,{className:`project-overview-chip muted`,children:[n.health.minorIssues,` minor`]})]}),A>0&&(0,f.jsxs)(`p`,{className:`muted small`,children:[`The boekwachter is still reviewing — `,A,` file`,A===1?``:`s`,` to go. Scores are its opinion, not a verdict.`]}),n.health.worstFiles.length>0&&(0,f.jsx)(`ul`,{className:`project-overview-areas`,children:n.health.worstFiles.map(t=>(0,f.jsxs)(`li`,{children:[(0,f.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>window.dispatchEvent(new CustomEvent(`gezel:open-file`,{detail:{projectId:e,path:t.path,source:`workspace`}})),children:(0,f.jsx)(`code`,{children:t.path})}),(0,f.jsxs)(`span`,{className:`muted small`,children:[` `,t.health,`/10`]}),t.reason&&(0,f.jsx)(`div`,{className:`muted small`,children:t.reason})]},t.path))})]}),E.length>0&&(0,f.jsx)(m,{label:`Areas`,testId:`overview-areas`,children:(0,f.jsx)(`ul`,{className:`project-overview-areas`,children:E.slice(0,10).map(e=>(0,f.jsxs)(`li`,{children:[(0,f.jsx)(`code`,{children:e.path===`.`?`(root)`:`${e.path}/`}),(0,f.jsxs)(`span`,{className:`muted small`,children:[` `,e.fileCount,` files`]}),(0,f.jsx)(`div`,{children:e.purpose})]},e.path))})}),n&&(n.languages.length>0||n.entryPoints.length>0)&&(0,f.jsxs)(m,{label:`Shape`,children:[n.languages.length>0&&(0,f.jsx)(`div`,{className:`project-overview-chips`,children:n.languages.slice(0,8).map(e=>(0,f.jsxs)(`span`,{className:`project-overview-chip muted`,children:[e.lang,` · `,e.fileCount]},e.lang))}),n.entryPoints.length>0&&(0,f.jsxs)(`p`,{className:`small`,children:[`Entry points:`,` `,n.entryPoints.slice(0,6).map((e,t)=>(0,f.jsxs)(`span`,{children:[t>0&&`, `,(0,f.jsx)(`code`,{children:e})]},e))]})]}),(0,f.jsx)(p,{projectId:e}),v.length>0&&(0,f.jsx)(m,{label:`Recent activity`,testId:`overview-activity`,children:(0,f.jsx)(`ul`,{className:`project-overview-activity`,children:v.map(e=>(0,f.jsxs)(`li`,{children:[(0,f.jsx)(`span`,{className:`muted small`,children:(e.entryType===`event`?e.at:e.lastActivityAt).slice(0,10)}),` `,e.entryType===`event`?e.summary:`Chat: ${e.title}`]},e.id))})}),S.length>0&&(0,f.jsx)(m,{label:`Data tables`,hint:`${S.length} table${S.length===1?``:`s`}`,children:(0,f.jsx)(`ul`,{className:`project-overview-tables`,children:S.map(e=>(0,f.jsxs)(`li`,{className:`small`,children:[(0,f.jsx)(`strong`,{children:e.table}),` `,(0,f.jsxs)(`span`,{className:`muted`,children:[e.rows.toLocaleString(),` `,e.rows===1?`row`:`rows`,` · `,e.columns,` columns`,e.origin===`workspace`?` · from ${e.source}`:` · ${e.source}`,e.schemaInferred?` · schema inferred`:``]})]},`${e.origin}:${e.table}`))})}),b&&(0,f.jsxs)(m,{label:`Latest weekly digest`,hint:b.path,children:[(0,f.jsx)(`div`,{className:`project-overview-digest`,children:(0,f.jsx)(c,{value:b.content,readOnly:!0,onCommit:h},b.path)}),(0,f.jsx)(`button`,{type:`button`,className:`project-overview-open-digest`,onClick:()=>window.dispatchEvent(new CustomEvent(`gezel:open-file`,{detail:{projectId:e,path:b.path,source:`artifacts`}})),children:`Open in artifacts`})]})]})}export{_ as ProjectOverviewView};
@@ -1,7 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectChat-DMwKnkW-.js","assets/rolldown-runtime-aKtaBQYM.js","assets/jsx-runtime-CEpd2cAX.js","assets/primitives-DEsn1shf.js","assets/react-dom-OL4w_gzs.js","assets/Tabs-BAY1Q79B.js","assets/dist-BPx-FyRH.js","assets/api-BX5xXiFs.js","assets/dist-D5aoNQwk.js","assets/DropdownMenu-D5fCzIrh.js","assets/dist-Bvo52IGx.js","assets/relative-time-B2kBaekd.js","assets/preload-helper-Czpn1I53.js","assets/index-DXWR4qW1.js","assets/NewPathDialog-D4jnNBfP.js","assets/FileTypeIcon-Cwzl1GkZ.js","assets/model-memory-copy-CeuXAj-T.js","assets/model-context-DBqdK0PS.js","assets/StorageCleanupDialog-DHqwyMZZ.js","assets/poppetje-Ce-02Aqi.js","assets/safe-svg-image-NbuPaBIv.js","assets/ConfirmDialog-BHFs6vmJ.js","assets/doc-s6H7T0IO.js","assets/chunk-O7JILDEF-CqcO1qaI.js","assets/chunk-BAOV476U-CEOFYt8X.js","assets/chunk-4VOD55SX-BFSSw0c8.js","assets/chunk-GAZKTT4R-BkP6-w3z.js","assets/chunk-MIKKUKOD-XIkmalSN.js","assets/chunk-XRW6P7IF-BeQQgMVK.js","assets/chunk-7ZAAICW4-BsCpYJH6.js","assets/markdown-Bi9b5f5Y.js","assets/schemas-JY4jmLbC.js","assets/chunk-6ECMNUIP-C1kohb1U.js","assets/inlineIconMarker-BQI2HLeD.js","assets/chunk-TT6ENR6T-CaYjVwjm.js","assets/chunk-DAMIRKTO-CGniCSiM.js","assets/new-project-meta-0xhggGA_.js","assets/chunk-AE3IUKMM-mZjzzO8Z.js","assets/index-D1m4Wx8V.css","assets/NewTaskDialog-Ox9D612Z.js","assets/GezelJsonEditor-fOvYclu9.js","assets/dist-BHl1ZAVG.js","assets/icons-C9dD-bDi.js","assets/CraftbookToolsetSetup-DTEA-3K3.js","assets/ToolsetConfigForm-gUVMTPR_.js","assets/useShowWorkInProgressFeatures-DwwviLRO.js","assets/ChatTimelineView-Do9EryEH.js","assets/styles-CKr_yrbn.js","assets/chunk-NNJLSQPW-DJA6camf.js","assets/chunk-V4NBQF5C-D9I4DV9v.js","assets/storage-fn4FCEVK.js","assets/transform-CmAXy0Ck.js","assets/styles-C0EoNJbk.css","assets/microphone-input-5gqW_NKf.js","assets/composer-prefill-CbG_i1Rx.js","assets/SessionSwitcher-C8te7YSe.js","assets/ProjectTimeline-DRe3D9qY.js","assets/chat-thread-memory-CZGcwgGo.js","assets/useCompactLayout-BarJPYcv.js","assets/GitDiffView-DrDrSeBb.js","assets/gitCopy-Dcjz17cJ.js","assets/completion-data--97asQiQ.js","assets/ProjectConnectionsTab-BZqp-oKI.js","assets/ProjectMailTab-DGo7eyB8.js","assets/mail-link-CI6YD6k2.js","assets/DiffpackReviewView-ClcNxtmF.js","assets/MarkdownField-D-0Zw7gM.js","assets/useDiffpacks-CK8W_OD_.js","assets/FileMapView-CxvfDLGA.js","assets/HistoryView-B4VAfEMe.js","assets/ProjectGithubView-w8suLCsA.js","assets/useGitSync-DWxX5-7K.js","assets/GithubSignInChip-CnlTCG8G.js","assets/ProjectOverviewView-NNwXd_QQ.js","assets/WorkspaceIndexPane-DU4yd4Ai.js","assets/TasksView-DuMjFS8S.js","assets/TaskTabContent-CNPJ4DQj.js","assets/TransformToolbarButton-CVg5nz36.js","assets/pending-drafts-YVW6X55O.js","assets/NewScriptDialog-D-gkY8TS.js"])))=>i.map(i=>d[i]);
2
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{n,t as r}from"./jsx-runtime-CEpd2cAX.js";import{i,n as a,r as o}from"./Tabs-BAY1Q79B.js";import{F as s,I as c,M as l,N as u,P as d,d as f,j as p,k as m,l as h,m as g,p as _,s as v,y}from"./primitives-DEsn1shf.js";import{Ct as ee,Dt as b,It as te,N as x,Pt as S,R as C,Rt as w,Wt as T,Z as ne,at as E,b as D,ft as re,hn as ie,ht as ae,nn as oe,rn as se,vt as ce,zt as O}from"./dist-BPx-FyRH.js";import{t as k}from"./dist-D5aoNQwk.js";import{t as A}from"./api-BX5xXiFs.js";import{_ as le,c as ue,d as de,f as fe,h as pe,i as me,l as he,m as ge,p as j,u as _e,y as ve}from"./NewPathDialog-D4jnNBfP.js";import{t as ye}from"./poppetje-Ce-02Aqi.js";import{n as be,t as xe}from"./relative-time-B2kBaekd.js";import{t as M}from"./ConfirmDialog-BHFs6vmJ.js";import{t as N}from"./preload-helper-Czpn1I53.js";import{i as P,n as F}from"./styles-CKr_yrbn.js";import{t as I}from"./GezelJsonEditor-fOvYclu9.js";import{a as L,i as R,n as Se,o as z,r as Ce,t as we}from"./new-project-meta-0xhggGA_.js";import{H as Te,J as Ee,Lt as B,X as De,a as V,b as Oe,c as ke,ct as Ae,ft as je,l as Me,n as Ne,s as Pe,t as Fe,v as H}from"./index-DXWR4qW1.js";import"./provider-default-BLsHrgzI.js";import{c as Ie,h as Le,i as Re,l as ze,m as Be,o as Ve,p as He,r as Ue,s as We,t as Ge,u as U}from"./file-browser-80qWoVju.js";import{t as Ke}from"./useShowWorkInProgressFeatures-DwwviLRO.js";import{n as qe}from"./composer-prefill-CbG_i1Rx.js";import{n as Je,r as Ye,t as Xe}from"./useCompactLayout-BarJPYcv.js";import{n as Ze,r as Qe}from"./mail-link-CI6YD6k2.js";import{a as $e,c as et,l as tt,n as nt,o as rt,r as it,s as at,t as ot,u as st}from"./outside-in-BFVUUcLa.js";import{t as ct}from"./ToolsetsEditor-BdxHnIBj.js";import{t as lt}from"./useDiffpacks-CK8W_OD_.js";import{n as W,r as G,t as K}from"./TransformToolbarButton-CVg5nz36.js";import{i as ut,n as dt,o as ft,r as pt,t as mt}from"./WorkspaceIndexPane-DU4yd4Ai.js";import{n as ht}from"./MemoriesTree-BKZEPJpm.js";import{t as gt}from"./ProjectGitStatusBar-C6bkCSby.js";import{t as _t}from"./markdown-baseline-HMqF2ChK.js";import{t as q}from"./GithubSignInChip-CnlTCG8G.js";var J=e(n(),1),Y=r(),vt=`__GEZEL_PICKER_NONE__`;function yt({gezels:e,value:t,onValueChange:n,noneLabel:r,placeholder:i=`Select a gezel…`,ariaLabel:a,disabled:o,className:s}){let c=Oe(),l=e.find(e=>e.id===t),u=[`gezel-picker-trigger`,s].filter(Boolean).join(` `);return(0,Y.jsxs)(f,{value:l?.id??vt,disabled:o,onValueChange:e=>n(e===vt?null:e),children:[(0,Y.jsx)(_,{className:u,"aria-label":a,children:(0,Y.jsx)(g,{children:l?(0,Y.jsx)(bt,{gezel:l,roleBasedNameOnly:c}):(0,Y.jsx)(`span`,{className:`gezel-picker-empty`,children:r??i})})}),(0,Y.jsxs)(v,{className:`gezel-picker-menu`,children:[r&&(0,Y.jsx)(h,{value:vt,children:r}),e.map(e=>(0,Y.jsx)(h,{value:e.id,textValue:xt(e,c),children:(0,Y.jsx)(bt,{gezel:e,roleBasedNameOnly:c})},e.id))]})]})}function bt({gezel:e,roleBasedNameOnly:t}){let n=C(e,t);return(0,Y.jsxs)(`span`,{className:`gezel-picker-option`,children:[(0,Y.jsx)(B,{svg:e.icon??null,poppetje:e.poppetje,iconOverride:e.iconOverride,name:n,size:26}),(0,Y.jsxs)(`span`,{className:`gezel-picker-option-text`,children:[(0,Y.jsx)(`span`,{className:`gezel-picker-option-name`,children:n}),!t&&e.role&&(0,Y.jsxs)(`span`,{className:`gezel-picker-option-role`,children:[`— `,e.role]})]})]})}function xt(e,t){let n=C(e,t);return!t&&e.role?`${n} — ${e.role}`:n}function St(e){return e?.leadLabel?e.leadLabel:e?.mode===`solo`?`Builder`:`Voorman`}function Ct(e){return e?.leadLabel?e.leadLabel.toLowerCase():e?.mode===`solo`?`builder`:`voorman`}function wt(){return Math.floor(Math.random()*2147483647)}function Tt(e){return e.manifest.kind===`gezel-template`}function Et(e){return(e??``).toLocaleLowerCase().replaceAll(/[^a-z0-9]+/g,``)}function Dt(e,t,n){return[C(e,n),e.role??``].some(e=>e.toLocaleLowerCase().includes(t))}function Ot(e,t){return[e.manifest.name,e.manifest.role,e.manifest.description,...e.manifest.tags].some(e=>e.toLocaleLowerCase().includes(t))}function kt({open:e,project:t,gezels:n,roleBasedNameOnlyMode:r,onClose:i,onAddExisting:a,onCreateTemplate:o}){let[f,h]=(0,J.useState)([]),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(!1),[ee,b]=(0,J.useState)(null),[x,w]=(0,J.useState)(``),[T,D]=(0,J.useState)(null),[re,ie]=(0,J.useState)(``),[ae,se]=(0,J.useState)(),[ce,O]=(0,J.useState)(wt),k=ne(oe(t));(0,J.useEffect)(()=>{if(!e)return;let t=!1;return _(!0),b(null),w(``),D(null),A.listCatalogItems(`gezel-template`).then(({items:e})=>{if(t)return;let n=new Map;for(let t of e)Tt(t)&&!n.has(t.manifest.id)&&n.set(t.manifest.id,t);h([...n.values()])}).catch(e=>{t||b(e.message)}).finally(()=>{t||_(!1)}),()=>{t=!0}},[e]);let le=(0,J.useMemo)(()=>new Set([...t.gezelIds??[],...t.voormanGezelId?[t.voormanGezelId]:[]]),[t.gezelIds,t.voormanGezelId]),ue=(0,J.useMemo)(()=>{let e=new Map,t=0;for(let n of k?.gezelRoles.default??[])e.set(n.templateId,{...n,tier:`default`,rank:t++});for(let n of k?.gezelRoles.suggested??[])e.has(n.templateId)||e.set(n.templateId,{...n,tier:`suggested`,rank:t++});return e},[k]),de=(0,J.useMemo)(()=>{let e=new Map;for(let t of f){let n=ue.get(t.manifest.id);if(n)for(let r of[Et(t.manifest.role),Et(t.manifest.name)])r&&!e.has(r)&&e.set(r,n)}return e},[ue,f]),fe=(0,J.useMemo)(()=>new Set(n.flatMap(e=>e.templateId?[e.templateId]:[])),[n]),pe=(0,J.useMemo)(()=>new Set(n.flatMap(e=>[e.role,e.roleBasedName].map(Et).filter(Boolean))),[n]),me=(0,J.useMemo)(()=>n.filter(e=>!le.has(e.id)&&e.scope!==`project`).sort((e,t)=>C(e,r).localeCompare(C(t,r))),[le,n,r]),he=(0,J.useMemo)(()=>f.filter(e=>!fe.has(e.manifest.id)&&!pe.has(Et(e.manifest.role))&&!pe.has(Et(e.manifest.name))).sort((e,t)=>e.manifest.name.localeCompare(t.manifest.name)),[pe,fe,f]),ge=(0,J.useCallback)(e=>{if(e.templateId){let t=ue.get(e.templateId);if(t)return t}for(let t of[Et(e.role),Et(e.roleBasedName)]){let e=de.get(t);if(e)return e}},[de,ue]),j=(0,J.useMemo)(()=>{let e=[];for(let t of me){let n=ge(t);n&&e.push({kind:`existing`,gezel:t,affinity:n})}for(let t of he){let n=ue.get(t.manifest.id);n&&e.push({kind:`template`,template:t,affinity:n})}return e.sort((e,t)=>e.affinity.rank-t.affinity.rank||(e.kind===`existing`?C(e.gezel,r):e.template.manifest.name).localeCompare(t.kind===`existing`?C(t.gezel,r):t.template.manifest.name))},[ge,me,he,ue,r]),_e=(0,J.useMemo)(()=>new Set(j.flatMap(e=>e.kind===`existing`?[e.gezel.id]:[])),[j]),ve=(0,J.useMemo)(()=>new Set(j.flatMap(e=>e.kind===`template`?[e.template.manifest.id]:[])),[j]),be=(0,J.useMemo)(()=>me.filter(e=>!_e.has(e.id)),[me,_e]),xe=(0,J.useMemo)(()=>he.filter(e=>!ve.has(e.manifest.id)),[he,ve]),M=x.trim().toLocaleLowerCase(),N=(0,J.useMemo)(()=>M?j.filter(e=>e.kind===`existing`?Dt(e.gezel,M,r):Ot(e.template,M)):j,[M,r,j]),P=(0,J.useMemo)(()=>M?be.filter(e=>Dt(e,M,r)):be,[M,be,r]),F=(0,J.useMemo)(()=>M?xe.filter(e=>Ot(e,M)):xe,[M,xe]),I=()=>{v||i()},L=async e=>{y(!0),b(null);try{await a(e),i()}catch(e){b(e.message)}finally{y(!1)}},R=async(e,t)=>{y(!0),b(null);try{await o(e.manifest.id,t),i()}catch(e){b(e.message)}finally{y(!1)}},Se=e=>{if(r){R(e,{name:e.manifest.name});return}let t=S(),n=e.manifest.nameSuggestions??[],i=n.length>0?n[Math.floor(Math.random()*n.length)]:t.name;D(e),ie(i??t.name),se(t.gender),O(wt()),b(null)},z=T&&re.trim()?te(ce,{key:`project-add-preview:${T.manifest.id}`,name:re.trim(),gender:ae}):null;return(0,Y.jsx)(s,{open:e,onOpenChange:e=>!e&&I(),children:(0,Y.jsxs)(d,{children:[(0,Y.jsx)(u,{}),(0,Y.jsxs)(p,{className:`project-add-gezel-dialog`,children:[(0,Y.jsx)(c,{asChild:!0,children:(0,Y.jsx)(`h3`,{children:T?`Customize ${T.manifest.name}`:`Add Gezel`})}),(0,Y.jsx)(l,{className:`muted small`,children:T?`Give this new ${T.manifest.role} a name and appearance before adding them to ${t.name}.`:`Choose someone from your workshop or add a new role to ${t.name}.`}),ee&&(0,Y.jsx)(`p`,{className:`error small project-add-gezel-error`,children:ee}),T?(0,Y.jsxs)(`form`,{className:`project-add-gezel-customize`,onSubmit:e=>{e.preventDefault(),re.trim()&&R(T,{name:re.trim(),...ae?{gender:ae}:{},appearanceSeed:ce})},children:[(0,Y.jsx)(`div`,{className:`project-add-gezel-preview`,"aria-hidden":`true`,children:z&&(0,Y.jsx)(ye,{poppetje:z,variant:`full`,size:150,grainStyle:`wavy`})}),(0,Y.jsxs)(`div`,{className:`project-add-gezel-customize-fields`,children:[(0,Y.jsxs)(`label`,{children:[`Name`,(0,Y.jsx)(`input`,{type:`text`,value:re,onChange:e=>ie(e.target.value),disabled:v})]}),(0,Y.jsx)(`button`,{type:`button`,className:`subtle`,disabled:v,onClick:()=>O(wt()),children:`Reroll appearance`}),(0,Y.jsxs)(`p`,{className:`muted small`,children:[`Their role and working style come from the `,T.manifest.name,` `,`template.`]})]}),(0,Y.jsxs)(m,{children:[(0,Y.jsx)(`button`,{type:`button`,disabled:v,onClick:()=>{D(null),b(null)},children:`Back`}),(0,Y.jsx)(`button`,{type:`submit`,className:`primary`,disabled:v||!re.trim(),children:v?`Adding…`:`Add to project`})]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`label`,{className:`project-add-gezel-search`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:`Search gezels and roles`}),(0,Y.jsx)(`input`,{type:`text`,placeholder:`Search gezels and roles…`,value:x,onChange:e=>w(e.target.value),disabled:v})]}),(0,Y.jsxs)(`div`,{className:`project-add-gezel-options`,children:[N.length>0&&(0,Y.jsxs)(`section`,{className:`project-add-gezel-suggestions`,"aria-labelledby":`project-add-suggested-title`,children:[(0,Y.jsx)(`h4`,{id:`project-add-suggested-title`,children:`Suggested for this project type`}),k&&(0,Y.jsxs)(`p`,{className:`muted small project-add-gezel-section-hint`,children:[k.label,` projects often benefit from these roles.`]}),(0,Y.jsx)(`ul`,{className:`project-add-gezel-list`,children:N.map(e=>{let t=e.affinity.tier==="default"?`Core role`:`Suggested`;if(e.kind===`existing`){let n=C(e.gezel,r);return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,className:`project-add-gezel-option`,disabled:v,onClick:()=>void L(e.gezel.id),children:[(0,Y.jsx)(B,{svg:e.gezel.icon??null,poppetje:e.gezel.poppetje,iconOverride:e.gezel.iconOverride,name:n,size:36}),(0,Y.jsxs)(`span`,{className:`project-add-gezel-option-copy`,children:[(0,Y.jsx)(`span`,{className:`project-add-gezel-option-name`,children:n}),(0,Y.jsxs)(`span`,{className:`muted small`,children:[e.gezel.role??`Gezel`,` · `,e.affinity.reason]})]}),(0,Y.jsx)(`span`,{className:`gz-badge`,children:t})]})},`existing:${e.gezel.id}`)}return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,className:`project-add-gezel-option`,disabled:v,onClick:()=>Se(e.template),children:[(0,Y.jsx)(B,{poppetje:E(`project-role:${e.template.manifest.id}`,e.template.manifest.name),name:e.template.manifest.name,size:36}),(0,Y.jsxs)(`span`,{className:`project-add-gezel-option-copy`,children:[(0,Y.jsx)(`span`,{className:`project-add-gezel-option-name`,children:e.template.manifest.name}),(0,Y.jsx)(`span`,{className:`muted small`,children:e.affinity.reason})]}),(0,Y.jsx)(`span`,{className:`gz-badge`,children:t})]})},`template:${e.template.manifest.id}`)})})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`project-add-existing-title`,children:[(0,Y.jsx)(`h4`,{id:`project-add-existing-title`,children:`From your workshop`}),P.length>0?(0,Y.jsx)(`ul`,{className:`project-add-gezel-list`,children:P.map(e=>{let t=C(e,r);return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,className:`project-add-gezel-option`,disabled:v,onClick:()=>void L(e.id),children:[(0,Y.jsx)(B,{svg:e.icon??null,poppetje:e.poppetje,iconOverride:e.iconOverride,name:t,size:36}),(0,Y.jsxs)(`span`,{className:`project-add-gezel-option-copy`,children:[(0,Y.jsx)(`span`,{className:`project-add-gezel-option-name`,children:t}),(0,Y.jsxs)(`span`,{className:`muted small`,children:[e.role??`Gezel`,` · ready to add`]})]})]})},e.id)})}):(0,Y.jsx)(`p`,{className:`muted small project-add-gezel-empty`,children:be.length>0?`No workshop gezels match that search.`:j.some(e=>e.kind===`existing`)?`No other workshop gezels are available.`:`Every available gezel is already on this project.`})]}),(0,Y.jsxs)(`section`,{"aria-labelledby":`project-add-role-title`,children:[(0,Y.jsx)(`h4`,{id:`project-add-role-title`,children:`Add a new gezel for a role`}),g&&(0,Y.jsx)(`p`,{className:`muted small`,children:`Loading roles…`}),!g&&F.length>0?(0,Y.jsx)(`ul`,{className:`project-add-gezel-list`,children:F.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,className:`project-add-gezel-option`,disabled:v,onClick:()=>Se(e),children:[(0,Y.jsx)(B,{poppetje:E(`project-role:${e.manifest.id}`,e.manifest.name),name:e.manifest.name,size:36}),(0,Y.jsxs)(`span`,{className:`project-add-gezel-option-copy`,children:[(0,Y.jsx)(`span`,{className:`project-add-gezel-option-name`,children:e.manifest.name}),(0,Y.jsx)(`span`,{className:`muted small`,children:e.manifest.description})]}),(0,Y.jsx)(`span`,{className:`gz-badge`,children:`New role`})]})},e.manifest.id))}):!g&&(0,Y.jsx)(`p`,{className:`muted small project-add-gezel-empty`,children:xe.length>0?`No new roles match that search.`:j.some(e=>e.kind===`template`)?`No other role types are available.`:`Every role type already has a gezel.`})]})]}),(0,Y.jsx)(m,{children:(0,Y.jsx)(`button`,{type:`button`,onClick:I,disabled:v,children:`Cancel`})})]})]})]})})}function At({projectId:e,projectProperties:t,refreshKey:n,recentlyAddedGezelId:r}){let[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(!1),m=(0,J.useCallback)(async()=>{try{let t=await A.listSuggestedWork(e);a(t.items)}catch(e){l(e.message)}},[e]);(0,J.useEffect)(()=>{m()},[m,n]);let h=async(e,t)=>{s(e),l(null);try{await t(),await m()}catch(e){l(e.message)}finally{s(null)}},g=async(t,n)=>{d(null),await h(t.key,async()=>{await A.enableSuggestedWork(e,{key:t.key,...n?{params:n}:{}});let r=Pt(t,n);r&&await A.updateProject(e,{properties:r})})};if(i===null)return c?(0,Y.jsx)(`p`,{className:`error small suggested-work-error`,children:c}):null;let _=i.filter(e=>e.state!==`dismissed`),v=i.filter(e=>e.state===`dismissed`);return i.length===0?null:(0,Y.jsxs)(`div`,{className:`suggested-work`,children:[_.map(n=>(0,Y.jsx)(jt,{item:n,busy:o===n.key,flash:n.state===`suggested`&&n.source.kind===`gezel-template`&&n.source.gezelId!==void 0&&n.source.gezelId===r,paramFormOpen:u===n.key,projectProperties:t,onEnable:e=>void g(n,e),onOpenParamForm:()=>d(n.key),onCloseParamForm:()=>d(null),onDisable:()=>void h(n.key,()=>A.disableSuggestedWork(e,n.key)),onDismiss:()=>void h(n.key,()=>A.dismissSuggestedWork(e,n.key,!0))},n.key)),v.length>0&&(0,Y.jsxs)(`div`,{className:`suggested-work-hidden`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`subtle small`,onClick:()=>p(e=>!e),children:f?`Hide dismissed suggestions`:`${v.length} hidden suggestion${v.length===1?``:`s`}`}),f&&v.map(t=>(0,Y.jsxs)(`div`,{className:`project-autonomous-role suggested-work-row`,children:[(0,Y.jsxs)(`div`,{className:`project-autonomous-role-copy`,children:[(0,Y.jsx)(`span`,{className:`project-autonomous-role-title`,children:t.craftbookName??t.craftbookId}),(0,Y.jsx)(`span`,{className:`muted small`,children:`Hidden from suggestions.`})]}),(0,Y.jsx)(`button`,{type:`button`,className:`subtle`,disabled:o===t.key,onClick:()=>void h(t.key,()=>A.dismissSuggestedWork(e,t.key,!1)),children:`Suggest again`})]},t.key))]}),c&&(0,Y.jsx)(`p`,{className:`error small suggested-work-error`,children:c})]})}function jt({item:e,busy:t,flash:n,paramFormOpen:r,projectProperties:i,onEnable:a,onOpenParamForm:o,onCloseParamForm:s,onDisable:c,onDismiss:l}){let u=e.state===`enabled`,d=Nt(e),f=e.runMode===`night-shift`?`Runs during the Night Shift window, at most once per night.`:`Runs on schedule (cron ${e.cron}, UTC).`,p=e.source.kind===`gezel-template`?e.source.gezelName?`Suggested by ${e.source.gezelName}${e.source.role?` — ${e.source.role}`:``}.`:`Suggested by the "${e.source.templateId}" role.`:`From the "${e.source.typeId}" project type.`,m=e.pendingQuestionId?` Awaiting approval — enabling here answers the pending question.`:e.orphaned?` The sponsoring role is no longer on this crew.`:``;return(0,Y.jsxs)(`div`,{className:`project-autonomous-role suggested-work-row${u?` project-autonomous-role-active`:``}${n?` timeline-focus-flash`:``}`,children:[(0,Y.jsx)(`span`,{className:`suggested-work-glyph`,"aria-hidden":`true`,children:e.runMode===`night-shift`?(0,Y.jsx)(Ft,{}):(0,Y.jsx)(It,{})}),(0,Y.jsxs)(`div`,{className:`project-autonomous-role-copy`,children:[(0,Y.jsxs)(`span`,{className:`project-autonomous-role-title`,children:[e.craftbookName??e.craftbookId,` `,u?`on`:`off`]}),(0,Y.jsxs)(`span`,{className:`muted small`,children:[e.reason?`${e.reason} `:``,f,` `,p,m]}),r&&(0,Y.jsx)(Mt,{item:e,projectProperties:i,onSubmit:a,onCancel:s})]}),(0,Y.jsxs)(`div`,{className:`suggested-work-actions`,children:[u?(0,Y.jsx)(`button`,{type:`button`,className:`subtle`,disabled:t,onClick:c,children:t?`Updating…`:`Pause`}):(0,Y.jsx)(`button`,{type:`button`,className:`subtle`,disabled:t||r,onClick:()=>d&&e.state===`suggested`?o():a(),children:t?`Updating…`:e.state===`paused`?`Resume`:`Enable`}),e.state===`suggested`&&(0,Y.jsx)(`button`,{type:`button`,className:`subtle small suggested-work-dismiss`,disabled:t,onClick:l,title:`Don't suggest this for this project`,children:`Don't suggest`})]})]})}function Mt({item:e,projectProperties:t,onSubmit:n,onCancel:r}){let i=e.paramSchema,[a,o]=(0,J.useState)(()=>{let n={},r=i?.properties??{};for(let[i,a]of Object.entries(r)){let r=b(a),o=r?t?.[r]:void 0,s=Ae(a);o===void 0?e.params?.[i]===void 0?s!==void 0&&(n[i]=s):n[i]=e.params[i]:n[i]=o}return n}),s=(0,J.useMemo)(()=>{let e={};for(let[t,n]of Object.entries(a))n!=null&&(typeof n==`boolean`?e[t]=n?`true`:`false`:typeof n==`number`?e[t]=String(n):typeof n==`string`&&(e[t]=n));return e},[a]);return(0,Y.jsxs)(`form`,{className:`suggested-work-param-form`,onSubmit:e=>{e.preventDefault(),n(s)},children:[i&&(0,Y.jsx)(I,{schema:i,value:a,onChange:e=>o(e??{}),density:`compact`}),(0,Y.jsxs)(`div`,{className:`suggested-work-param-actions`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`subtle`,onClick:r,children:`Cancel`}),(0,Y.jsx)(`button`,{type:`submit`,className:`primary`,children:`Enable`})]})]})}function Nt(e){let t=e.paramSchema?.properties;return!!(t&&Object.keys(t).length>0)}function Pt(e,t){if(!t)return null;let n=e.paramSchema?.properties??{},r={};for(let[e,i]of Object.entries(n)){let n=b(i),a=t[e];n&&a!==void 0&&a!==``&&(r[n]=a)}return Object.keys(r).length>0?r:null}function Ft(){return(0,Y.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,Y.jsx)(`path`,{d:`M12 3a9 9 0 1 0 9 9c0-.46-.04-.92-.1-1.36a5.39 5.39 0 0 1-8.54-6.5A8.97 8.97 0 0 0 12 3z`})})}function It(){return(0,Y.jsxs)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,Y.jsx)(`path`,{d:`M12 7v5l3 2`})]})}function Lt({project:e,gezels:t,boekwachterGezelId:n,recentlyAddedGezelId:r,onAddGezel:i,onCreateTemplateGezel:a,onRemoveGezel:o}){let s=Oe(),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),m=(0,J.useMemo)(()=>{let n=new Set,r=[];if(e.voormanGezelId){let i=t.find(t=>t.id===e.voormanGezelId);i&&(r.push({gezel:i,isLead:!0}),n.add(i.id))}for(let i of e.gezelIds??[]){if(n.has(i))continue;let e=t.find(e=>e.id===i);e&&(r.push({gezel:e,isLead:!1}),n.add(i))}return r},[t,e.gezelIds,e.voormanGezelId]),h=n?t.find(e=>e.id===n):void 0,g=t.find(t=>(e.gezelIds??[]).includes(t.id)&&(t.id===n||t.templateId===`boekwachter`||t.role?.trim().toLocaleLowerCase()===`boekwachter`)),_=async e=>{let t=e===`add`?h:g,n=e===`add`?i:o;if(!(!t||!n)){d(!0),p(null);try{await n(t.id)}catch(e){p(e.message)}finally{d(!1)}}};return(0,Y.jsxs)(`section`,{id:`project-about-crew`,className:`project-crew-settings project-about-anchor`,"aria-labelledby":`project-crew-settings-title`,children:[(0,Y.jsxs)(`div`,{className:`project-crew-settings-heading`,children:[(0,Y.jsx)(`h3`,{id:`project-crew-settings-title`,className:`project-crew-settings-title`,children:`Assigned gezellen`}),i&&a&&(0,Y.jsx)(`button`,{type:`button`,className:`primary project-crew-add`,onClick:()=>l(!0),children:`Add Gezel`})]}),(0,Y.jsx)(`p`,{className:`muted small project-crew-settings-hint`,children:`The crew attached to this project. Change the lead below; task and conversation assignments are added automatically.`}),m.length>0?(0,Y.jsx)(`ul`,{className:`project-crew-list`,children:m.map(({gezel:t,isLead:n})=>{let r=C({name:t.name,roleBasedName:t.roleBasedName},s),i=n?`⭐ ${Ct(e)}`:t.role;return(0,Y.jsxs)(`li`,{className:`project-crew-card${n?` project-crew-card-lead`:``}`,children:[(0,Y.jsx)(B,{svg:t.icon??null,poppetje:t.poppetje,iconOverride:t.iconOverride,name:r,size:30}),(0,Y.jsxs)(`span`,{className:`project-crew-card-text`,children:[(0,Y.jsx)(`span`,{className:`project-crew-card-name`,children:r}),i&&(0,Y.jsx)(`span`,{className:`project-crew-card-role`,children:i})]})]},t.id)})}):(0,Y.jsx)(`p`,{className:`muted small project-crew-empty`,children:`No gezellen are assigned to this project yet.`}),(0,Y.jsxs)(`div`,{className:`project-autonomous-role${g?` project-autonomous-role-active`:``}`,children:[(0,Y.jsxs)(`div`,{className:`project-autonomous-role-copy`,children:[(0,Y.jsxs)(`span`,{className:`project-autonomous-role-title`,children:[`AI indexing `,g?`on`:`off`]}),(0,Y.jsx)(`span`,{className:`muted small`,children:g?`${g.name} studies changed files, writes short summaries and reviews, and prepares weekly digests while the workshop is quiet.`:`Structural file and symbol search stays available. Add the Boekwachter to this crew for background AI summaries, reviews, and digests.`})]}),g?(0,Y.jsx)(`button`,{type:`button`,className:`subtle`,disabled:u||!o,onClick:()=>void _(`remove`),children:u?`Updating…`:`Remove Boekwachter`}):(0,Y.jsx)(`button`,{type:`button`,className:`subtle`,disabled:u||!h||!i,onClick:()=>void _(`add`),children:u?`Updating…`:h?`Add ${h.name}`:`No Boekwachter available`})]}),f&&(0,Y.jsx)(`p`,{className:`error small project-autonomous-role-error`,children:f}),(0,Y.jsx)(At,{projectId:e.id,projectProperties:e.properties,refreshKey:[e.voormanGezelId??``,...e.gezelIds??[]].join(`|`),recentlyAddedGezelId:r}),i&&a&&(0,Y.jsx)(kt,{open:c,project:e,gezels:t,roleBasedNameOnlyMode:s,onClose:()=>l(!1),onAddExisting:i,onCreateTemplate:a})]})}function Rt({project:e,onUpdated:t}){let[n,r]=(0,J.useState)([]),i=e.knowledgeCatalogs?.mode??`inherit`,a=e.knowledgeCatalogs?.refs??[];(0,J.useEffect)(()=>{let e=!1;return A.listKnowledgeCatalogs().then(t=>{e||r(t.catalogs)}).catch(()=>{}),()=>{e=!0}},[]);let o=(0,J.useCallback)(async n=>{try{t(await A.updateProject(e.id,{knowledgeCatalogs:n}))}catch(e){console.error(`updateProject(knowledgeCatalogs) failed:`,e)}},[e.id,t]);if(n.length===0)return null;let s=(e,t,n)=>{let r=a.filter(n=>!(n.publisherId===e&&n.catalogId===t)),i=n?[...r,{publisherId:e,catalogId:t}]:r;o({mode:`selected`,refs:i})};return(0,Y.jsxs)(`label`,{className:`config-label`,style:{marginTop:`0.75rem`},children:[`Knowledge catalogs`,(0,Y.jsx)(`div`,{className:`new-row`,style:{alignItems:`center`},children:(0,Y.jsxs)(`select`,{"aria-label":`Knowledge catalog scope`,value:i,onChange:e=>{let t=e.target.value;o(t===`selected`?{mode:t,refs:a}:{mode:t})},children:[(0,Y.jsx)(`option`,{value:`inherit`,children:`All my catalogs`}),(0,Y.jsx)(`option`,{value:`selected`,children:`Only selected catalogs`}),(0,Y.jsx)(`option`,{value:`off`,children:`None for this project`})]})}),i===`selected`&&(0,Y.jsxs)(`fieldset`,{className:`project-tab-settings`,children:[(0,Y.jsx)(`legend`,{children:`Catalogs in scope`}),(0,Y.jsx)(`div`,{className:`project-tab-settings-grid`,children:n.map(e=>(0,Y.jsxs)(`label`,{className:`new-row`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:a.some(t=>t.publisherId===e.ref.publisherId&&t.catalogId===e.ref.catalogId),onChange:t=>s(e.ref.publisherId,e.ref.catalogId,t.target.checked)}),(0,Y.jsx)(`span`,{children:e.name??e.ref.catalogId})]},e.ref.catalogId))})]}),(0,Y.jsx)(`small`,{className:`muted`,children:`Reference material gezellen in this project can search and cite. Manage the catalogs themselves in Settings.`})]})}var zt=360,Bt={width:16,height:16,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,focusable:!1},Vt=()=>(0,Y.jsxs)(`svg`,{...Bt,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M12.5 8a4.5 4.5 0 1 1-1.32-3.18`}),(0,Y.jsx)(`path`,{d:`M12.8 2.6v2.6h-2.6`})]}),Ht=()=>(0,Y.jsxs)(`svg`,{...Bt,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M8 3.5H4.2A0.7 0.7 0 0 0 3.5 4.2V11.8A0.7 0.7 0 0 0 4.2 12.5H11.8A0.7 0.7 0 0 0 12.5 11.8V8`}),(0,Y.jsx)(`path`,{d:`M9.5 3.5H12.5V6.5`}),(0,Y.jsx)(`path`,{d:`M12.5 3.5 8 8`})]}),Ut=()=>(0,Y.jsxs)(`svg`,{...Bt,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M9.5 3.5H12.5V6.5`}),(0,Y.jsx)(`path`,{d:`M12.5 3.5 9 7`}),(0,Y.jsx)(`path`,{d:`M6.5 12.5H3.5V9.5`}),(0,Y.jsx)(`path`,{d:`M3.5 12.5 7 9`})]}),Wt=()=>(0,Y.jsxs)(`svg`,{...Bt,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M12.5 6.5H9.5V3.5`}),(0,Y.jsx)(`path`,{d:`M9.5 6.5 12.8 3.2`}),(0,Y.jsx)(`path`,{d:`M3.5 9.5H6.5V12.5`}),(0,Y.jsx)(`path`,{d:`M6.5 9.5 3.2 12.8`})]}),Gt=()=>(0,Y.jsxs)(`svg`,{...Bt,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M4 4 12 12`}),(0,Y.jsx)(`path`,{d:`M12 4 4 12`})]}),Kt=()=>(0,Y.jsxs)(`svg`,{...Bt,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M5 5 6.2 3.5H9.8L11 5H12.5A1 1 0 0 1 13.5 6V12A1 1 0 0 1 12.5 13H3.5A1 1 0 0 1 2.5 12V6A1 1 0 0 1 3.5 5H5Z`}),(0,Y.jsx)(`circle`,{cx:`8`,cy:`9`,r:`2.25`})]}),qt=()=>(0,Y.jsxs)(`svg`,{...Bt,"aria-hidden":`true`,children:[(0,Y.jsx)(`path`,{d:`M4 2.5H9.5L12 5V13.5H4Z`}),(0,Y.jsx)(`path`,{d:`M9.5 2.5V5H12`}),(0,Y.jsx)(`path`,{d:`M6 8H10`}),(0,Y.jsx)(`path`,{d:`M6 10.5H9`})]});function Jt({actions:e}){let[t,n]=(0,J.useState)(!1),r=(0,J.useRef)(null);return(0,J.useEffect)(()=>{if(!t)return;let e=e=>{r.current&&!r.current.contains(e.target)&&n(!1)},i=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,i)}},[t]),(0,Y.jsxs)(`div`,{className:`project-output-menu`,ref:r,children:[(0,Y.jsx)(`button`,{type:`button`,className:`project-output-btn`,onClick:()=>n(e=>!e),title:`More actions`,"aria-label":`More output actions`,"aria-haspopup":`menu`,"aria-expanded":t,children:`⋯`}),t&&(0,Y.jsx)(`div`,{className:`project-output-menu-dropdown`,role:`menu`,children:e.map(e=>(0,Y.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`project-output-menu-item`,onClick:()=>{n(!1),e.onClick()},disabled:e.disabled,title:e.title,children:[(0,Y.jsx)(`span`,{className:`project-output-menu-item-glyph`,"aria-hidden":`true`,children:e.icon}),(0,Y.jsx)(`span`,{children:e.label})]},e.key))})]})}function Yt({projectId:e,htmlFiles:t,typePage:n,onClose:r,onDebugFrame:i}){let[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,p]=(0,J.useState)(0),[m,y]=(0,J.useState)(!1),[ee,b]=(0,J.useState)(!1),[te,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(null),[ne,E]=(0,J.useState)(`idle`),[D,re]=(0,J.useState)(null),ie=(0,J.useRef)([]),ae=(0,J.useRef)(null),oe=(0,J.useRef)(null),se=Xe(oe,zt);(0,J.useEffect)(()=>{let e=!1;return A.getConfig().then(t=>{e||C(t.debugMode===!0)}).catch(()=>{}),()=>{e=!0}},[]),(0,J.useEffect)(()=>{let n=!1;if(t.length===0){c(``),u(!1);return}return u(!0),(async()=>{let r=await nn(e,t);n||(c(r),u(!1))})(),()=>{n=!0}},[e,(0,J.useMemo)(()=>[...t].sort().join(`
3
- `),[t])]);let ce=(0,J.useMemo)(()=>{let e=[];n&&e.push({id:`type::${n.entry}`,source:`type`,path:n.entry,label:n.label});for(let n of t)e.push({id:`workspace::${n}`,source:`workspace`,path:n,label:Zt(n)});return e},[n,t]),O=(n?ce[0]:void 0)??(s?ce.find(e=>e.source===`workspace`&&e.path===s):void 0)??ce.find(e=>e.source===`workspace`),k=ce.find(e=>e.id===a)??O??null,le=(0,J.useCallback)(()=>p(e=>e+1),[]);(0,J.useEffect)(()=>{let e=e=>{e.key===`F5`?(e.preventDefault(),y(e=>!e)):e.key===`Escape`&&m&&(e.preventDefault(),y(!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]),(0,J.useEffect)(()=>{let e=()=>y(!1);return window.addEventListener(Fe,e),()=>{window.removeEventListener(Fe,e),Ne(!1)}},[]),(0,J.useEffect)(()=>{Ne(m)},[m]);let ue=(0,J.useCallback)(()=>{!k||!D||window.open(D,`_blank`,`noopener,noreferrer`)},[k,D]),de=(0,J.useCallback)(e=>{let t=[...ie.current,e];ie.current=t.length>200?t.slice(-200):t},[]);(0,J.useEffect)(()=>{ie.current=[],x(``),T(null),E(`idle`)},[k?.id,d]),(0,J.useEffect)(()=>{S||(T(null),E(`idle`))},[S]);let fe=(0,J.useCallback)(e=>{T(e),E(`idle`)},[]),pe=(0,J.useCallback)(async()=>{if(w)try{await navigator.clipboard.writeText(Xt(w)),E(`copied`)}catch{E(`error`)}},[w]),me=(0,J.useCallback)(async()=>{if(!k||ee)return;let t=window.__GEZEL__?.capturePageRegion;if(!t){x(`Screenshots need the desktop app.`);return}let n=ae.current;if(n){b(!0),x(``);try{let r=n.getBoundingClientRect(),a=await t({x:r.left,y:r.top,width:r.width,height:r.height});if(!a.ok)throw Error(a.error);let o=Qt(a.dataUrl),{relativePath:s}=await A.uploadProjectAttachment(e,o,`image/png`),c=$t(k.path,s,ie.current);i?.(c)}catch(e){x(e instanceof Error?e.message:String(e))}finally{b(!1)}}},[e,k,ee,i]),he=[{key:`reload`,label:`Reload`,icon:(0,Y.jsx)(Vt,{}),onClick:le,disabled:!k,title:`Reload the preview`,ariaLabel:`Reload the preview`},{key:`open`,label:`Open in browser`,icon:(0,Y.jsx)(Ht,{}),onClick:ue,disabled:!k||!D,title:`Open in your default browser`,ariaLabel:`Open in your default browser`},{key:`maximize`,label:m?`Restore`:`Maximize`,icon:m?(0,Y.jsx)(Wt,{}):(0,Y.jsx)(Ut,{}),onClick:()=>y(e=>!e),title:m?`Restore (F5)`:`Maximize (F5)`,ariaLabel:m?`Restore output pane`:`Maximize output pane`}];m||he.push({key:`close`,label:`Hide output`,icon:(0,Y.jsx)(Gt,{}),onClick:r,title:`Hide output pane`,ariaLabel:`Hide output pane`});let ge=(0,Y.jsxs)(`div`,{className:`project-output-toolbar`,ref:oe,children:[ce.length>0&&(0,Y.jsxs)(f,{value:k?.id,onValueChange:e=>o(e),children:[(0,Y.jsx)(_,{className:`project-output-picker${se?` is-compact`:``}`,"aria-label":k?`Choose output page. Current page: ${k.label}`:`Choose output page`,children:se?(0,Y.jsx)(`span`,{className:`project-output-picker-icon`,"aria-hidden":`true`,children:(0,Y.jsx)(qt,{})}):(0,Y.jsx)(g,{placeholder:l?`Detecting…`:`Select a target…`})}),(0,Y.jsx)(v,{children:ce.map(e=>(0,Y.jsx)(h,{value:e.id,textValue:e.label,children:e.label},e.id))})]}),(0,Y.jsx)(`span`,{className:`project-output-toolbar-spacer`}),se?(0,Y.jsx)(Jt,{actions:he}):he.map(e=>(0,Y.jsx)(`button`,{type:`button`,className:`project-output-btn`,onClick:e.onClick,disabled:e.disabled,title:e.title,"aria-label":e.ariaLabel,children:e.icon},e.key))]}),j=k?(0,Y.jsx)(Ye,{projectId:e,path:k.path,source:k.source,title:k.label,className:`project-output-iframe`,refreshKey:d,onLog:de,onUrlReady:re,...k.source===`type`&&n?.pageTools?.length?{pageTools:n.pageTools}:{},...S?{onPageScriptError:fe}:{},onRequestRefresh:le}):l?(0,Y.jsx)(`div`,{className:`project-output-empty`,children:(0,Y.jsx)(`p`,{className:`muted small`,children:`Detecting output target…`})}):(0,Y.jsx)(`div`,{className:`project-output-empty`,children:(0,Y.jsxs)(`p`,{className:`muted small`,children:[`No previewable HTML in this workspace yet. When a gezel writes an `,(0,Y.jsx)(`code`,{children:`index.html`}),`, it'll show up here.`]})}),_e=i||S&&w?(0,Y.jsxs)(`div`,{className:`project-output-debugbar`,children:[te&&(0,Y.jsx)(`span`,{className:`project-output-debugbar-error small`,role:`alert`,children:te}),S&&w&&(0,Y.jsx)(`output`,{className:`project-output-script-error-label small`,children:w.response?.error??w.transportError??`Script failed`}),(0,Y.jsx)(`span`,{className:`project-output-toolbar-spacer`}),S&&w&&(0,Y.jsx)(`button`,{type:`button`,className:`project-output-script-error-copy`,onClick:()=>void pe(),title:`Copy the full script run, including logs and call trace`,"aria-label":`Copy full script error details`,children:ne===`copied`?`Copied`:ne===`error`?`Copy failed`:`Copy details`}),i&&(0,Y.jsx)(`button`,{type:`button`,className:`project-output-btn`,onClick:me,disabled:!k||ee,title:`Send a screenshot + browser state to the chat`,"aria-label":`Send a debug frame to the chat`,children:(0,Y.jsx)(Kt,{})})]}):null;return(0,Y.jsxs)(`aside`,{className:`project-output-pane${m?` project-output-pane-maximized`:``}`,children:[ge,(0,Y.jsx)(`div`,{ref:ae,className:`project-output-pane-body`,children:j}),_e]})}function Xt(e){let t=[`# Gezel page script error`,``,`Tool: ${e.tool}`];return e.response&&(t.push(`Run ID: ${e.response.runId}`),t.push(`Status: ${e.response.status}`),e.response.error&&t.push(`Error: ${e.response.error}`),t.push(``,`## Page invoke response`,``,"```json"),t.push(JSON.stringify(e.response,null,2)),t.push("```")),e.run&&(t.push(``,`## Full script run`,``,"```json"),t.push(JSON.stringify(e.run,null,2)),t.push("```")),e.transportError&&t.push(``,`Transport error: ${e.transportError}`),e.detailLoadError&&t.push(``,`Full run could not be loaded: ${e.detailLoadError}`),`${t.join(`
4
- `)}\n`}function Zt(e){let t=e.lastIndexOf(`/`),n=t>=0?e.slice(0,t+1):``,r=e.slice(t+1).replace(/\.html?$/i,``);return n+(r.toLowerCase()===`index`?`(Default Page)`:r)}function Qt(e){let t=e.indexOf(`,`),n=e.slice(0,t).match(/data:([^;]+)/)?.[1]??`application/octet-stream`,r=atob(e.slice(t+1)),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return new Blob([i],{type:n})}function $t(e,t,n){let r=[];if(r.push(`![Screenshot of workspace file ${e}](${t})`),n.length>0){r.push(``),r.push(`**Browser state:** ${n.length} console event(s) captured since load:`),r.push(``);for(let e of n.slice(-50))r.push(`- ${en(e)}`)}return r.join(`
5
- `)}function en(e){let t=e.kind===`console.error`?(e.detail.args??[]).join(` `):e.detail.message??`(unknown error)`,n=[e.detail.filename,e.detail.lineno?String(e.detail.lineno):null,e.detail.colno?String(e.detail.colno):null].filter(Boolean).join(`:`);return`**${e.kind}:** ${t}${n?` _(${n})_`:``}`}var tn=24;async function nn(e,t){if(t.length===0)return``;if(t.length===1)return t[0]??``;let n=t.slice(0,tn);return rn(await Promise.all(n.map(async t=>{let[n,r]=await Promise.all([A.statProjectWorkspacePath(e,t).catch(()=>null),A.readProjectWorkspaceFile(e,t).then(e=>e.content).catch(()=>``)]);return{path:t,size:n?.size??r.length,mtimeMs:n?.mtime?Date.parse(n.mtime):0,placeholder:on(r)}})))||(t[0]??``)}function rn(e){if(e.length===0)return``;let t=Math.max(1,...e.map(e=>e.size)),n=e.map(e=>e.mtimeMs).filter(e=>e>0),r=n.length?Math.max(...n):0,i=n.length?Math.min(...n):0,a=r-i,o=e[0],s=-1/0;for(let n of e){let e=n.size/t,r=a>0?(n.mtimeMs-i)/a:0,c=+!!/(^|\/)index\.html?$/i.test(n.path),l=(n.placeholder?0:1e3)+e*100+r*40+c*10;l>s&&(s=l,o=n)}return o?.path??``}var an=[`logic here`,`code here`,`goes here`,`your code`,`add your`,`fill in`,`coming soon`,`placeholder`,`todo`,`fixme`];function on(e){if(!e.trim())return!0;let t=[...e.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi)].map(e=>e[1]??``),n=t.length>0,r=t.join(`
6
- `).replace(/\/\*[\s\S]*?\*\//g,``).replace(/\/\/[^\n]*/g,``).trim();if(n&&r.length<40)return!0;let i=e.toLowerCase();return an.some(e=>i.includes(e))&&e.length<2e3}function sn(){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:`Loading this project…`}),(0,Y.jsx)(`div`,{className:`entity-tabs-row project-tabs-row project-pane-placeholder-tabs`,"aria-hidden":`true`,children:(0,Y.jsx)(`span`,{className:`gz-tabs-trigger`,children:`Chat`})}),(0,Y.jsx)(`div`,{className:`project-pane-placeholder-body`,"aria-hidden":`true`})]})}function cn({project:e,onProjectChange:t}){let[n,r]=(0,J.useState)({}),[i,a]=(0,J.useState)(null),o=e.properties??{},s=Object.keys(o).filter(e=>!O(e)),c=[...D.map(e=>({id:e.id,label:e.label,description:e.description,options:e.options})),...s.map(e=>({id:e,label:e,description:void 0,options:void 0}))],l=async i=>{let s=n[i];if(!(s===void 0||s===(o[i]??``))){a(null);try{t(await A.updateProject(e.id,{properties:{[i]:s}})),r(e=>{let{[i]:t,...n}=e;return n})}catch(e){a(e.message)}}};return(0,Y.jsxs)(`div`,{className:`project-properties`,children:[c.map(e=>(0,Y.jsxs)(`label`,{className:`config-label project-properties-row`,children:[e.label,(0,Y.jsxs)(`div`,{className:`new-row`,children:[(0,Y.jsx)(`input`,{value:n[e.id]??o[e.id]??``,placeholder:`Not set`,list:e.options?`project-property-options-${e.id}`:void 0,onChange:t=>r(n=>({...n,[e.id]:t.target.value})),onBlur:()=>void l(e.id)}),e.options&&(0,Y.jsx)(`datalist`,{id:`project-property-options-${e.id}`,children:e.options.map(e=>(0,Y.jsx)(`option`,{value:e},e))})]}),e.description&&(0,Y.jsx)(`small`,{className:`muted`,children:e.description})]},e.id)),i&&(0,Y.jsx)(`p`,{className:`error small`,children:i})]})}var ln={md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,json:`application/json`,jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,gif:`image/gif`,svg:`image/svg+xml`,webp:`image/webp`,avif:`image/avif`,bmp:`image/bmp`,mp4:`video/mp4`,webm:`video/webm`,mp3:`audio/mpeg`,wav:`audio/wav`,ogg:`audio/ogg`,css:`text/css`,html:`text/html`,js:`application/javascript`,pdf:`application/pdf`,docx:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,pptx:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,xlsx:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};function un(e){let t=e.lastIndexOf(`.`);return t===-1?`application/octet-stream`:ln[e.slice(t+1).toLowerCase()]??`application/octet-stream`}function dn(e){return e===`text/markdown`||e===`text/plain`||e===`application/json`||e===`text/css`||e===`text/html`||e===`application/javascript`||e===`image/svg+xml`}function fn(e,t){return e?t?`${e.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`:e:t}function pn(e){let{projectId:t,root:n,client:r,primaryDocumentFilename:i,source:a=`artifacts`}=e;return{async readFile(e){let i=fn(n,e),o=un(e);try{if(dn(o)){let e=a===`workspace`?await r.readProjectWorkspaceFile(t,i):await r.readProjectArtifact(t,i);return new TextEncoder().encode(e.content).buffer}return await(a===`workspace`?await r.fetchProjectWorkspaceBlob(t,i):await r.fetchProjectArtifactBlob(t,i)).arrayBuffer()}catch{return null}},async writeFile(e,i,o){let s=fn(n,e),c=o??un(e);if(dn(c)){let e=new TextDecoder().decode(i);a===`workspace`?await r.writeProjectWorkspaceFile(t,{path:s,content:e}):await r.writeProjectArtifact(t,s,e);return}a===`workspace`?await r.writeProjectWorkspaceBinary(t,s,i,c):await r.writeProjectArtifactBinary(t,s,i,c)},async removeFile(e){let i=fn(n,e);try{a===`workspace`?await r.rmProjectWorkspacePath(t,i,{recursive:!0}):await r.deleteProjectArtifact(t,i)}catch{}},async listFiles(e){let i=e?fn(n,e):n||void 0,o=a===`workspace`?await r.listProjectWorkspace(t,i,!0):await r.listProjectArtifacts(t,i,!0),s=[],c=n?`${n.replace(/\/+$/,``)}/`:``;for(let e of o.files){if(e.isDirectory||c&&!e.path.startsWith(c))continue;let t=c&&e.path.startsWith(c)?e.path.slice(c.length):e.path;s.push({path:t,mimeType:un(t),size:0})}return s},async exists(e){return await this.readFile(e)!==null},async getDocumentPath(){if(i)return i;let e=(await this.listFiles()).filter(e=>!e.path.includes(`/`));for(let t of[`index.md`,`doc.md`,`document.md`]){let n=e.find(e=>e.path.toLowerCase()===t);if(n)return n.path}return e.find(e=>e.path.toLowerCase().endsWith(`.md`))?.path??null},async readDocument(){let e=await this.getDocumentPath();if(!e)return null;let t=await this.readFile(e);return t?new TextDecoder().decode(t):null},async writeDocument(e,t){let n=t??i??`index.md`,r=new TextEncoder().encode(e);await this.writeFile(n,r,`text/markdown`)}}}function mn(e){return pn({...e,source:`artifacts`})}var hn=[{id:`developer`,label:`Developer`,canonical:[`developer`,`web-developer`]},{id:`writer`,label:`Writer`,canonical:[`copywriter`]},{id:`designer`,label:`Designer`,canonical:[`designer`]},{id:`researcher`,label:`Researcher`,canonical:[`researcher`]}],gn=new Set([`adoc`,`asciidoc`,`markdown`,`md`,`mdx`,`rst`,`tex`,`txt`]),_n=new Set([`ai`,`avif`,`bmp`,`fig`,`gif`,`ico`,`jpeg`,`jpg`,`pdf`,`png`,`psd`,`sketch`,`svg`,`webp`]),vn=new Set([`csv`,`ods`,`parquet`,`tsv`,`xls`,`xlsx`]);function yn(e){let t=e.split(`/`).pop()?.toLowerCase()??``,n=t.includes(`.`)?t.split(`.`).pop()??``:``;return gn.has(n)?`writer`:_n.has(n)?`designer`:vn.has(n)?`researcher`:`developer`}function bn(e,t,n){if(t.stale){let r=t.line==null?``:` It was previously reported near line ${t.line}.`;return`@${n}, can you address ${t.ref} in ${e}: ${t.message}${r} The file has changed since this was reported, so please verify it against the current file before editing.`}let r=t.line==null?``:` at line ${t.line}`;return`@${n}, can you address ${t.ref} in ${e}${r}: ${t.message}`}function xn(e){return se(e.role)??se(e.roleBasedName)}function Sn(e,t,n){let r=new Set(hn.find(e=>e.id===t).canonical);return e.filter(e=>{let t=xn(e);return!e.fixedFunction&&t!==null&&r.has(t)}).sort((e,t)=>Number(n.has(t.id))-Number(n.has(e.id))||e.name.localeCompare(t.name))}function Cn({path:e,issue:t,gezels:n,assignedGezelIds:r,onCancel:i,onConfirm:a}){let o=yn(e),[f,h]=(0,J.useState)(o),g=(0,J.useMemo)(()=>Sn(n,f,r),[r,n,f]),[_,v]=(0,J.useState)(()=>Sn(n,o,r)[0]?.id??``),[y,ee]=(0,J.useState)(()=>bn(e,t,o)),[b,te]=(0,J.useState)(!1),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(null),T=i=>{let a=Sn(n,i,r);h(i),v(a[0]?.id??``),b||ee(bn(e,t,i))},ne=async()=>{if(!(x||!_||!y.trim())){S(!0),w(null);try{await a(_,y.trim())}catch(e){w(e instanceof Error?e.message:String(e))}finally{S(!1)}}},E=hn.find(e=>e.id===f).label;return(0,Y.jsx)(s,{open:!0,onOpenChange:e=>!e&&!x&&i(),children:(0,Y.jsxs)(d,{children:[(0,Y.jsx)(u,{}),(0,Y.jsx)(p,{className:`workspace-issue-fix-dialog`,children:(0,Y.jsxs)(`form`,{className:`workspace-issue-fix-form`,onSubmit:e=>{e.preventDefault(),ne()},children:[(0,Y.jsx)(c,{asChild:!0,children:(0,Y.jsx)(`h3`,{children:`Assign issue fix`})}),(0,Y.jsx)(l,{className:`muted small`,children:`This creates an assigned task and starts its specialist chat immediately. Your files aren’t touched — the fix arrives as a change proposal you review and apply.`}),(0,Y.jsxs)(`label`,{children:[(0,Y.jsx)(`span`,{children:`Assigned role`}),(0,Y.jsx)(`select`,{value:f,onChange:e=>T(e.currentTarget.value),disabled:x,children:hn.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,Y.jsxs)(`label`,{children:[(0,Y.jsx)(`span`,{children:`Gezel`}),(0,Y.jsx)(yt,{gezels:g,value:_,onValueChange:e=>v(e??``),placeholder:`No ${E.toLowerCase()} gezel available`,ariaLabel:`Gezel assigned to fix this issue`,disabled:x||g.length===0})]}),g.length===0&&(0,Y.jsxs)(`p`,{className:`workspace-issue-fix-missing`,role:`alert`,children:[`No `,E.toLowerCase(),` gezel is available. Choose another role or add one to the crew first.`]}),(0,Y.jsxs)(`label`,{children:[(0,Y.jsx)(`span`,{children:`Message`}),(0,Y.jsx)(`textarea`,{value:y,onChange:e=>{ee(e.currentTarget.value),te(!0)},rows:5,disabled:x})]}),C&&(0,Y.jsxs)(`p`,{className:`gz-dialog-error`,role:`alert`,children:[`Couldn’t start the fix: `,C]}),(0,Y.jsxs)(m,{children:[(0,Y.jsx)(`button`,{type:`button`,onClick:i,disabled:x,children:`Cancel`}),(0,Y.jsx)(`button`,{type:`submit`,className:`primary`,disabled:x||!_||!y.trim(),children:x?`Starting…`:`OK`})]})]})})]})})}function X(e,t,n,r){let i=r?.provider??`llama-cpp`,a=new Set(e.gezelIds??[]);e.voormanGezelId&&a.add(e.voormanGezelId);let o=[...t.filter(e=>a.has(e.id)),...n].filter(e=>!e.fixedFunction);return[{provider:i},...o.map(e=>({provider:e.provider??i,gezel:e}))]}function wn(e,t,n,r){let i=X(e,t,n,r),a=!1,o=!1;for(let t of i){let n=T({provider:t.provider,projectCodexMode:e.codexPermissionMode,projectClaudeMode:e.claudePermissionMode,gezel:t.gezel,config:r});n===`none`&&(o=!0),(n===`edit`||n===`reviewed`||n===`full`)&&(a=!0)}return{nativeWritable:a,managedSurfaceAvailable:o}}function Tn(e,t,n,r){let i=w(e),{nativeWritable:a,managedSurfaceAvailable:o}=wn(e,t,n,r);return{managedWritable:i,nativeWritable:a,effectiveWritable:a||i&&o}}function En(e,t,n,r){return X(e,t,n,r).some(e=>e.provider===`codex-cli`)}function Dn(e,t,n,r){return X(e,t,n,r).some(e=>e.provider===`anthropic-cli`)}function On(e,t,n,r){if(e.claudePermissionMode)return e.claudePermissionMode;let i=new Set(X(e,t,n,r).filter(e=>e.provider===`anthropic-cli`).map(e=>e.gezel?.claudePermissionMode??r?.anthropicCli?.defaultPermissionMode??`acceptEdits`));return i.size>1?`mixed`:i.values().next().value??`acceptEdits`}function kn(e){return e.split(/[-_]/).filter(Boolean).map(e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`).join(` `)}function An(e,t){return`${e} ${t}${e===1?``:`s`}`}function jn(e){if(e.source!==`catalog`)return null;let t=e.item.manifest;return t.kind===`project-type`?t:null}function Mn(e){if(e.source===`catalog`){let t=e.item.manifest;return{name:t.name,categoryLabel:z(L(e.item)).label,description:t.description}}return{name:e.kind.label,categoryLabel:z(e.kind.category).label,description:e.kind.description}}function Nn({selection:e,size:t}){let n=e.source===`catalog`,r=jn(e),i=n&&!r?.icon;return(0,Y.jsx)(De,{...i&&e.source===`catalog`&&e.item.iconSvg?{iconSvg:e.item.iconSvg}:{},...i&&e.source===`catalog`&&e.item.logoUrl?{logoUrl:e.item.logoUrl}:{},svgClassName:`gz-npd-hero-art-svg`,fallback:(0,Y.jsx)(Ce,{glyph:e.source===`catalog`?R(e.item):e.kind.glyph,size:t})})}function Pn({selection:e}){let t=jn(e),{description:n}=Mn(e),r=t?t.gezels??[]:[],i=[];if(t){let e=(t.tools??[]).length;e>0&&i.push({glyph:`code`,text:An(e,`custom tool`)}),t.pages&&i.push({glyph:`frame`,text:`Live dashboard in the Output pane`});let n=(t.schedules??[]).length;n>0&&i.push({glyph:`calendar`,text:An(n,`scheduled routine`)});let r=(t.toolsets??[]).length;r>0&&i.push({glyph:`dots`,text:An(r,`toolset`)});let a=(t.craftbooks??[]).length;a>0&&i.push({glyph:`sheet`,text:An(a,`craftbook`)})}let a=e.source===`builtin`?e.kind.give:[],o=r.length>0||i.length>0||a.length>0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`gz-npd-brief-lede`,children:n}),o&&(0,Y.jsxs)(`div`,{className:`gz-npd-give`,children:[(0,Y.jsx)(`p`,{className:`gz-npd-give-eyebrow`,children:`Gezellen and Tools`}),r.length>0&&(0,Y.jsx)(`div`,{className:`gz-npd-crew`,children:r.map(e=>{let t=kn(e.templateId);return(0,Y.jsxs)(`figure`,{className:`gz-npd-crew-member`,children:[(0,Y.jsx)(`span`,{className:`gz-npd-crew-figure`,children:(0,Y.jsx)(ye,{poppetje:E(e.templateId,t),variant:`headshot`,size:44})}),(0,Y.jsxs)(`figcaption`,{children:[t,e.voorman&&(0,Y.jsx)(`span`,{className:`gz-npd-crew-voorman`,children:`voorman`})]})]},e.templateId)})}),(0,Y.jsxs)(`ul`,{className:`gz-npd-give-rows`,children:[i.map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(Ce,{glyph:e.glyph,size:15}),e.text]},e.text)),a.map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(Ce,{glyph:`sheet`,size:15}),e]},e))]})]})]})}function Fn({label:e,description:t,active:n,disabled:r=!1,badge:i,iconSvg:a,logoUrl:o,glyph:s,index:c,onSelect:l}){return(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":r?`${e} (coming soon)`:e,className:`gz-npd-card${n?` active`:``}`,disabled:r,onClick:l,style:{"--card-i":Math.min(c,11)},children:[(0,Y.jsx)(`span`,{className:`gz-npd-card-mark`,"aria-hidden":`true`,children:(0,Y.jsx)(De,{...a?{iconSvg:a}:{},...o?{logoUrl:o}:{},svgClassName:`gz-npd-card-mark-svg`,fallback:(0,Y.jsx)(Ce,{glyph:s??`dots`,size:22})})}),(0,Y.jsx)(`span`,{className:`gz-npd-card-name`,children:e}),(0,Y.jsx)(`span`,{className:`gz-npd-card-description`,children:t}),i&&(0,Y.jsx)(`span`,{className:`gz-npd-card-badge`,"aria-hidden":`true`,children:i})]})}var In=[{id:`imap`,label:`IMAP`},{id:`gmail`,label:`Gmail`},{id:`microsoft365`,label:`Microsoft 365`},{id:`outlook`,label:`Outlook.com`}];function Ln(e){let t=e||`this mailbox`;return{about:`Email workspace for ${t}. Messages are synced here as searchable markdown files so gezellen can triage the inbox, answer questions over your mail, and draft replies for your review.`,mission:`Keep ${t} triaged and responsive: surface threads needing a reply, draft responses for approval, and never send without explicit consent.`}}var Rn=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());function zn(e){let t=e?.properties??{},n={};for(let[e,r]of Object.entries(t))r&&r.default!==void 0&&(n[e]=r.default);return n}function Bn(e){return typeof e==`string`?e.trim()||null:typeof e==`number`&&Number.isFinite(e)?String(e):null}function Vn(e){let t=e.replace(/\s+/g,` `).trim();return t?`${t.charAt(0).toUpperCase()}${t.slice(1)}`:``}function Z(e,t){let n=e.manifest;if(n.kind!==`project-type`)return n.name;if(n.nameTemplate){let e=n.nameTemplate.replace(/\{\{\s*([a-zA-Z0-9_.-]+)\s*\}\}/g,(e,n)=>Bn(t[n])??e);if(!e.includes(`{{`))return Vn(e)}let r=n.params,i=Object.keys(r?.properties??{});return Vn([...(i.length>0?i:Object.keys(t)).map(e=>Bn(t[e])).filter(e=>e!==null).filter((e,t,n)=>n.indexOf(e)===t).slice(0,2),n.name].join(` `))}function Hn({open:e,mode:t,onClose:n,onCreated:r}){let i=Ke(),[a,o]=(0,J.useState)(``),[l,f]=(0,J.useState)(!1),[h,g]=(0,J.useState)(`general`),[_,v]=(0,J.useState)(``),[y,ee]=(0,J.useState)(``),[b,te]=(0,J.useState)([]),[S,C]=(0,J.useState)(null),[w,T]=(0,J.useState)({}),[ne,E]=(0,J.useState)(``),[D,re]=(0,J.useState)(`all`),[ae,oe]=(0,J.useState)(`pick`),[se,ce]=(0,J.useState)(!1),[O,k]=(0,J.useState)(``),[le,ue]=(0,J.useState)(``),[de,fe]=(0,J.useState)(`imap`),[pe,me]=(0,J.useState)(``),[he,ge]=(0,J.useState)(``),[j,_e]=(0,J.useState)(``),[ve,ye]=(0,J.useState)(!0),[be,xe]=(0,J.useState)(``),[M,N]=(0,J.useState)(null),[P,F]=(0,J.useState)(null),[z,Te]=(0,J.useState)(null),[Ee,B]=(0,J.useState)([]),[De,V]=(0,J.useState)(``),[Oe,ke]=(0,J.useState)(!1),Ae=(0,J.useRef)(null),je=(0,J.useRef)(0),Me=(0,J.useRef)(null),Ne=(0,J.useRef)(null),Pe=(0,J.useRef)({name:a,nameManuallyEdited:l,about:_,mission:y});Pe.current={name:a,nameManuallyEdited:l,about:_,mission:y};let Fe=(0,J.useId)();(0,J.useEffect)(()=>{je.current+=1,Me.current=null,Ne.current?.abort(),Ne.current=null,e&&(o(``),f(!1),g(`general`),v(``),ee(``),k(``),N(null),F(null),ue(``),fe(`imap`),me(``),ge(``),_e(``),ye(!0),xe(``),C(null),T({}),E(``),re(`all`),oe(`pick`),ce(!1),V(``),ke(!1),Ae.current=null)},[e]),(0,J.useEffect)(()=>{if(!e)return;let t=!1,n=A.listCatalogItems(`project-type`),r=i?Promise.resolve({items:[]}):A.listCatalogItems(`craftbook-template`);return Promise.all([n,r]).then(([e,n])=>{if(t)return;let r=x(n.items);te(ie(e.items,i,r).filter(e=>e.manifest.id!==`email`))}).catch(()=>{t||te([])}),()=>{t=!0}},[e,i]),(0,J.useEffect)(()=>{!i&&h===`email`&&g(`general`)},[h,i]),(0,J.useEffect)(()=>{if(!e||!z){B([]);return}let t=!1;return A.listGitHubRepos().then(e=>{t||B(e.repos)}).catch(()=>{t||B([])}),()=>{t=!0}},[e,z]);let H=t===`solo`||h===`folder`,Ie=H?`New Job`:`New Project`,Le=H?`Describe the job. What do you want done? What's in scope, what's out? The Builder lands on this with no other context.`:`Who's this project for, what's in scope, what's out. The first thing any gezel joining the project reads.`,Re=H?`Concrete success criteria. What does the finished job look like?`:`Concrete success criteria, usually a bullet list. What does "done" look like?`,ze=window.__GEZEL__?.platform===`win32`?`C:\\projects\\mystuff`:`/path/to/folder`,Be=(0,J.useCallback)(()=>{je.current+=1,Me.current=null,Ne.current?.abort(),Ne.current=null,F(null)},[]),Ve=(0,J.useCallback)(()=>{oe(`pick`),V(``)},[]),He=(0,J.useCallback)(e=>{Be(),N(null),k(e)},[Be]),Ue=(0,J.useCallback)(async e=>{let t=(e??O).trim();if(!t){N(null);return}if(!qn(t)){N({message:`Looks incomplete — enter owner/repo (e.g. bendyline/squisq).`});return}if(Ae.current===t){N(null);return}if(!z){N({message:`Sign in to GitHub to auto-fill About and Mission objectives from this repo.`});return}if(Me.current===t)return;N(null);let n=je.current+1,r=new AbortController;je.current=n,Me.current=t,Ne.current=r,F(`reading`);try{let e=await A.previewGitHubRepo(Kn(t),r.signal);if(je.current!==n)return;F(`drafting`);let i=Pe.current;i.nameManuallyEdited||o(e.repo);let a=i.nameManuallyEdited&&i.name.trim()||e.repo,s=await A.previewProjectAbout({name:a,repoUrl:e.canonicalUrl,...e.description?{description:e.description}:{},...e.topics?{topics:e.topics}:{},readme:e.readme},r.signal);if(je.current!==n)return;let c=Pe.current,l=c.about.trim().length>0,u=c.mission.trim().length>0;(!l&&!u||window.confirm(`Replace the current About and Mission objectives with text drafted from this repo?`))&&(v(s.about),ee(s.missionObjectives),Ae.current=t)}catch(e){if(je.current!==n)return;let t=Yn(e);N({message:`Couldn't read this repo: ${Jn(e)}`,...t?{fixUrl:t}:{}})}finally{je.current===n&&(Me.current=null,Ne.current=null,F(null))}},[O,z]),We=(0,J.useCallback)(async e=>{xe(e);let t=e.trim();if(t)try{let e=await A.previewFolder(t);e.name&&!l&&o(e.name),e.about&&v(t=>t.trim()?t:e.about??``)}catch{if(!l){let e=t.replace(/[\\/]+$/,``).split(/[\\/]/).pop();e&&o(e)}}},[l]),Ge=(0,J.useCallback)(async()=>{let e=window.__GEZEL__?.selectDirectory;if(e)try{let t=await e({title:`Choose a project folder`});t&&await We(t)}catch{}},[We]),U=S?b.find(e=>e.manifest.id===S)??null:null,qe=U?.manifest.kind===`project-type`?U.manifest.params:void 0,Je=(0,J.useMemo)(()=>Se.filter(e=>i||e.id!==`email`),[i]),Ye=ne.trim().toLowerCase(),Xe=(0,J.useMemo)(()=>Ye?Je.filter(e=>`${e.label} ${e.description}`.toLowerCase().includes(Ye)):Je,[Je,Ye]),$e=(0,J.useMemo)(()=>Ye?b.filter(e=>{let t=e.manifest;return`${t.name} ${t.description} ${t.tags.join(` `)}`.toLowerCase().includes(Ye)}):b,[Ye,b]),et=Ye.length>0,tt=(0,J.useMemo)(()=>we.map(e=>({cat:e,builtins:Xe.filter(t=>t.category===e.id),types:$e.filter(t=>L(t)===e.id)})).filter(e=>e.builtins.length+e.types.length>0),[Xe,$e]),nt=et||D===`all`?tt:tt.filter(e=>e.cat.id===D),rt=(0,J.useMemo)(()=>we.map(e=>({cat:e,count:Je.filter(t=>t.category===e.id).length+b.filter(t=>L(t)===e.id).length})).filter(e=>e.count>0),[Je,b]),it=U?{source:`catalog`,item:U}:{source:`builtin`,kind:Je.find(e=>e.id===h)??Je[0]},at=Mn(it),ot=(0,J.useCallback)(async e=>{if(e.preventDefault(),ae!==`configure`)return;if(V(``),S&&U){let e=a.trim();if(!e){V(`Name is required.`);return}ke(!0);try{let t=U.manifest.kind===`project-type`?U.manifest.params:void 0,{project:i,applied:a}=await A.createTypedProject({name:e,...H?{mode:`solo`}:{},projectType:{typeId:S,params:{...zn(t),...w}}});a.gezelsCreated.length>0&&window.dispatchEvent(new CustomEvent(`gezel:gezel-updated`)),await r(i),n()}catch(e){V(e.message)}finally{ke(!1)}return}if(h===`email`){let e=le.trim();if(!Rn(e)){V(`Enter a valid email address — it becomes the project name.`);return}if(de===`imap`&&(!pe.trim()||!j)){V(`IMAP needs at least a host and a password.`);return}ke(!0);try{let t=Ln(e),i=await A.createProject({name:e,about:t.about,missionObjectives:t.mission,...H?{mode:`solo`}:{}}),a=await A.updateProject(i.id,{projectTypeId:`email`}).catch(()=>i);de===`imap`?await Qe(i.id,{address:e,host:pe.trim(),...he.trim()?{port:Number(he.trim())}:{},secure:ve,pass:j}).catch(e=>console.warn(`mail link failed:`,e)):await Ze(i.id,de,e).catch(e=>console.warn(`mail OAuth failed:`,e)),await r(a),n()}catch(e){V(e.message)}finally{ke(!1)}return}let t=a.trim(),i=_.trim(),o=y.trim(),s=O.trim();if(!t){V(`Name is required.`);return}if(h!==`folder`&&!i){V(H?`Job description is required — what you want done, what is in scope, what is out.`:`About is required — who this project is for, what's in scope, what's out.`);return}let c=h===`github`;if(c&&s&&!qn(s)){V(`GitHub repo doesn't look right — leave it blank or use owner/repo.`);return}if(h===`folder`&&!be.trim()){V(`Choose a folder for this project.`);return}ke(!0);try{await r(await A.createProject({name:t,about:i,missionObjectives:o,...H?{mode:`solo`}:{},...h===`folder`?{workingDir:be.trim()}:{},...c&&s?{github:{url:Kn(s)}}:{}})),n()}catch(e){V(e.message)}finally{ke(!1)}},[a,h,_,y,O,le,de,pe,he,j,ve,be,S,U,w,H,ae,n,r]);return(0,Y.jsx)(s,{open:e,onOpenChange:e=>{e||n()},children:(0,Y.jsxs)(d,{children:[(0,Y.jsx)(u,{}),(0,Y.jsx)(p,{className:`gz-npd gz-npd-step-${ae}`,children:(0,Y.jsx)(`form`,{onSubmit:ot,style:{display:`contents`},children:ae===`pick`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`header`,{className:`gz-npd-header`,children:[(0,Y.jsxs)(`div`,{className:`gz-npd-header-copy`,children:[(0,Y.jsx)(c,{asChild:!0,children:(0,Y.jsx)(`h3`,{children:Ie})}),(0,Y.jsx)(`p`,{className:`gz-npd-header-sub`,children:H?`A job is a solo project — one Builder handles the work end to end.`:`Pick a starting point — blank, connected, or purpose-built.`})]}),(0,Y.jsxs)(`label`,{className:`gz-npd-search`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:`Search project types`}),(0,Y.jsx)(`input`,{type:`search`,value:ne,onChange:e=>E(e.target.value),placeholder:`Search types…`})]})]}),(0,Y.jsxs)(`div`,{className:`gz-npd-body`,children:[(0,Y.jsxs)(`nav`,{className:`gz-npd-rail`,"aria-label":`Project type categories`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`gz-npd-rail-item${!et&&D===`all`?` active`:``}`,onClick:()=>re(`all`),children:(0,Y.jsx)(`span`,{className:`gz-npd-rail-label`,children:`All`})}),rt.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`gz-npd-rail-item${!et&&D===e.cat.id?` active`:``}`,onClick:()=>re(e.cat.id),children:[(0,Y.jsx)(Ce,{glyph:e.cat.glyph,size:16}),(0,Y.jsx)(`span`,{className:`gz-npd-rail-label`,children:e.cat.label}),(0,Y.jsx)(`span`,{className:`gz-npd-rail-count`,children:e.count})]},e.cat.id))]}),(0,Y.jsxs)(`div`,{className:`gz-npd-gallery`,role:`radiogroup`,"aria-label":`Project type`,children:[nt.map(e=>(0,Y.jsxs)(`section`,{className:`gz-npd-section`,children:[(0,Y.jsxs)(`div`,{className:`gz-npd-section-head`,children:[(0,Y.jsx)(`span`,{className:`gz-npd-section-title`,children:e.cat.label}),(0,Y.jsx)(`span`,{className:`gz-npd-section-tagline`,children:e.cat.tagline})]}),(0,Y.jsxs)(`div`,{className:`gz-npd-grid`,children:[e.builtins.map((e,t)=>(0,Y.jsx)(Fn,{label:e.label,description:e.description,glyph:e.glyph,index:t,active:se&&!S&&e.id===h,...e.soon?{disabled:!0,badge:`Soon`}:{},onSelect:()=>{e.soon||(h===`github`&&e.id!==`github`&&Be(),g(e.id),ce(!0),C(null),T({}),l||o(``),V(``),oe(`configure`))}},e.id)),e.types.map((t,n)=>(0,Y.jsx)(Fn,{label:t.manifest.name,description:t.manifest.description,glyph:R(t),index:e.builtins.length+n,active:t.manifest.id===S,...!(t.manifest.kind===`project-type`&&t.manifest.icon)&&t.iconSvg?{iconSvg:t.iconSvg}:{},...!(t.manifest.kind===`project-type`&&t.manifest.icon)&&t.logoUrl?{logoUrl:t.logoUrl}:{},onSelect:()=>{h===`github`&&Be(),C(t.manifest.id),g(`general`),ce(!1);let e=zn(t.manifest.kind===`project-type`?t.manifest.params:void 0);T(e),l||o(Z(t,e)),V(``),oe(`configure`)}},t.manifest.id))]})]},e.cat.id)),nt.length===0&&(0,Y.jsx)(`p`,{className:`gz-npd-empty`,children:`No project types match your search.`})]})]}),(0,Y.jsxs)(`div`,{className:`gz-npd-pane-footer gz-npd-pick-footer`,children:[(0,Y.jsx)(`p`,{className:`gz-npd-footnote`,children:`Pick one to see what it brings — nothing is created until the next screen.`}),(0,Y.jsx)(m,{children:(0,Y.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`})})]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`header`,{className:`gz-npd-header gz-npd-detail-header`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`gz-npd-back`,onClick:Ve,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`‹`}),`Project types`]}),(0,Y.jsxs)(`div`,{className:`gz-npd-detail-id`,children:[(0,Y.jsx)(`span`,{className:`gz-npd-detail-art`,"aria-hidden":`true`,children:(0,Y.jsx)(Nn,{selection:it,size:26})}),(0,Y.jsxs)(`div`,{className:`gz-npd-header-copy`,children:[(0,Y.jsx)(`p`,{className:`gz-npd-hero-eyebrow`,children:at.categoryLabel}),(0,Y.jsx)(c,{asChild:!0,children:(0,Y.jsx)(`h3`,{className:`gz-npd-hero-name`,children:at.name})})]})]})]}),(0,Y.jsxs)(`div`,{className:`gz-npd-detail`,"data-lean":U?void 0:`true`,children:[(0,Y.jsx)(`div`,{className:`gz-npd-brief`,children:(0,Y.jsx)(Pn,{selection:it})}),(0,Y.jsx)(`div`,{className:`gz-npd-setup`,children:(0,Y.jsxs)(`div`,{className:`gz-npd-pane-form`,children:[U&&qe&&(0,Y.jsx)(`div`,{className:`gz-npd-params`,children:(0,Y.jsx)(I,{schema:qe,value:w,onChange:e=>{let t=e??{};T(t),l||o(Z(U,t))},density:`compact`})}),h===`github`&&(0,Y.jsxs)(`div`,{className:`gz-npd-field`,children:[(0,Y.jsxs)(`span`,{className:`gz-new-project-github-label`,children:[(0,Y.jsxs)(`label`,{htmlFor:Fe,children:[`GitHub repository `,(0,Y.jsx)(`span`,{className:`muted`,children:`(optional)`})]}),(0,Y.jsx)(q,{onChange:Te,compact:!0})]}),(0,Y.jsx)(Wn,{inputId:Fe,value:O,onChange:He,onBlur:()=>void Ue(),onSelect:e=>{He(e),Ue(e)},repos:Ee}),P&&(0,Y.jsx)(Un,{phase:P,onCancel:Be}),!P&&M&&(0,Y.jsxs)(`small`,{className:`error`,children:[M.message,M.fixUrl&&(0,Y.jsxs)(Y.Fragment,{children:[` `,(0,Y.jsx)(`a`,{href:M.fixUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open GitHub authorization page →`})]})]})]}),h===`folder`&&(0,Y.jsxs)(`label`,{children:[`Folder`,(0,Y.jsxs)(`div`,{className:`gz-folder-row`,children:[(0,Y.jsx)(`input`,{value:be,onChange:e=>xe(e.target.value),onBlur:()=>void We(be),placeholder:ze}),window.__GEZEL__?.selectDirectory&&(0,Y.jsx)(`button`,{type:`button`,className:`gz-folder-browse`,onClick:()=>void Ge(),children:`Browse…`})]}),(0,Y.jsx)(`small`,{className:`muted`,children:`Gezels read — and, with permission, write — files in this folder.`})]}),h===`email`?(0,Y.jsxs)(`label`,{children:[`Email address`,(0,Y.jsx)(`input`,{type:`email`,value:le,onChange:e=>ue(e.target.value),placeholder:`you@example.com`,autoComplete:`email`}),(0,Y.jsx)(`small`,{className:`muted`,children:`The project is named after this address.`})]}):(0,Y.jsxs)(`label`,{children:[`Name`,(0,Y.jsx)(`input`,{value:a,onChange:e=>{o(e.target.value),f(!0)},placeholder:H?`e.g. Bird-feeder prototype`:`e.g. Eliza's Pet Shop`}),U&&a&&!l&&(0,Y.jsx)(`small`,{className:`muted`,children:`Suggested from your choices — edit it anytime.`}),h===`folder`&&a&&!l&&(0,Y.jsx)(`small`,{className:`muted`,children:`Suggested from the folder — edit it anytime.`})]}),h===`email`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`gz-type-field`,children:[(0,Y.jsx)(`span`,{className:`gz-type-field-label`,children:`Provider`}),(0,Y.jsx)(`div`,{className:`gz-type-picker`,role:`radiogroup`,"aria-label":`Mail provider`,children:In.map(e=>{let t=e.id===de;return(0,Y.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:`gz-type-chip${t?` active`:``}`,onClick:()=>fe(e.id),children:e.label},e.id)})})]}),de===`imap`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`label`,{children:[`IMAP host`,(0,Y.jsx)(`input`,{value:pe,onChange:e=>me(e.target.value),placeholder:`imap.example.com`})]}),(0,Y.jsxs)(`div`,{className:`gz-imap-row`,children:[(0,Y.jsxs)(`label`,{className:`gz-imap-port`,children:[`Port `,(0,Y.jsx)(`span`,{className:`muted`,children:`(optional)`}),(0,Y.jsx)(`input`,{value:he,onChange:e=>ge(e.target.value),placeholder:`993`,inputMode:`numeric`})]}),(0,Y.jsxs)(`label`,{className:`gz-imap-tls`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:ve,onChange:e=>ye(e.target.checked)}),`Use TLS`]})]}),(0,Y.jsxs)(`label`,{children:[`Password / app password`,(0,Y.jsx)(`input`,{type:`password`,value:j,onChange:e=>_e(e.target.value),placeholder:`app password`,autoComplete:`off`})]}),(0,Y.jsx)(`small`,{className:`muted`,children:`Gmail and Outlook.com also work over IMAP with an app password. The username is your email address.`})]}):(0,Y.jsxs)(`p`,{className:`muted small`,children:[In.find(e=>e.id===de)?.label,` connects via OAuth. Create the project, then click `,(0,Y.jsx)(`strong`,{children:`Connect`}),` in its Mail tab to authorize in the browser. Synced messages become searchable files; sending is consent-gated.`]})]}),h!==`email`&&!S&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`label`,{children:[H?`Job description`:`About`,` `,(0,Y.jsx)(`span`,{className:`muted`,children:h===`folder`?`(optional)`:``}),(0,Y.jsx)(`textarea`,{value:_,onChange:e=>v(e.target.value),placeholder:h===`folder`?`Optional. Auto-filled from the folder's AGENTS.md or CLAUDE.md if it has one — or add your own notes about what's here.`:Le,rows:4})]}),(0,Y.jsxs)(`label`,{children:[`Mission objectives `,(0,Y.jsx)(`span`,{className:`muted`,children:`(optional)`}),(0,Y.jsx)(`textarea`,{value:y,onChange:e=>ee(e.target.value),placeholder:Re,rows:3})]})]})]})})]},S??h),(0,Y.jsxs)(`div`,{className:`gz-npd-pane-footer gz-npd-detail-footer`,children:[De?(0,Y.jsx)(`p`,{className:`error small gz-npd-submit-error`,role:`alert`,children:De}):(0,Y.jsx)(`p`,{className:`gz-npd-footnote`,children:U?`Creating sets up the crew, tools, and starting files in one go.`:`Nothing is created until you press Create.`}),(0,Y.jsxs)(m,{children:[(0,Y.jsx)(`button`,{type:`button`,onClick:n,disabled:Oe,children:`Cancel`}),(0,Y.jsx)(`button`,{type:`submit`,className:`primary`,disabled:Oe,children:Oe?`Creating…`:`Create`})]})]})]})})})]})})}function Un({phase:e,onCancel:t}){let n=W(),r=n?.name??`Klerk`;return(0,Y.jsxs)(`output`,{className:`gz-npd-repo-progress`,"aria-live":`polite`,children:[(0,Y.jsx)(B,{svg:n?.icon,poppetje:n?.poppetje,iconOverride:n?.iconOverride,name:r,size:28,pulsing:!0,title:`${r} is working`}),(0,Y.jsx)(`span`,{className:`gz-npd-repo-progress-text`,children:e===`reading`?`${r} is reading the repository…`:`${r} is drafting About and Mission objectives…`}),(0,Y.jsx)(`button`,{type:`button`,className:`secondary gz-npd-repo-cancel`,onClick:e=>{e.preventDefault(),t()},children:`Cancel draft`})]})}function Wn({inputId:e,value:t,onChange:n,onBlur:r,onSelect:i,repos:a,disabled:o}){let[s,c]=(0,J.useState)(!1),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useMemo)(()=>{if(a.length===0)return[];let e=t.trim().toLowerCase();return!e||a.some(t=>t.fullName.toLowerCase()===e)?a:a.filter(t=>t.fullName.toLowerCase().includes(e)||(t.description?t.description.toLowerCase().includes(e):!1))},[a,t]);(0,J.useEffect)(()=>{if(!s)return;let e=e=>{l.current&&(l.current.contains(e.target)||c(!1))};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[s]);let f=s&&d.length>0;return(0,Y.jsxs)(`div`,{className:`gz-github-repo-combobox`,ref:l,children:[(0,Y.jsxs)(`div`,{className:`gz-github-repo-input-row`,children:[(0,Y.jsx)(`span`,{className:`gz-github-repo-prefix`,"aria-hidden":`true`,children:`github.com/`}),(0,Y.jsx)(`input`,{id:e,ref:u,value:t,onChange:e=>{n(Gn(e.target.value)),s||c(!0)},onFocus:()=>c(!0),onBlur:()=>{window.setTimeout(()=>r(),120)},onKeyDown:e=>{e.key===`Escape`&&c(!1)},placeholder:`owner/repo`,disabled:o,autoComplete:`off`}),a.length>0&&(0,Y.jsx)(`button`,{type:`button`,className:`gz-github-repo-chevron`,"aria-label":s?`Hide repo suggestions`:`Show repo suggestions`,"aria-expanded":s,disabled:o,onMouseDown:e=>{e.preventDefault(),c(e=>!e),u.current?.focus()},children:(0,Y.jsx)(y,{style:{transform:s?`rotate(180deg)`:`none`,transition:`transform 0.12s`}})})]}),f&&(0,Y.jsx)(`ul`,{className:`gz-github-repo-suggestions`,children:d.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,className:`gz-github-repo-suggestion`,onMouseDown:t=>{t.preventDefault(),i(e.fullName),c(!1)},children:[(0,Y.jsx)(`span`,{className:`gz-github-repo-suggestion-name`,children:e.fullName}),e.description&&(0,Y.jsx)(`span`,{className:`gz-github-repo-suggestion-desc`,children:e.description})]})},e.url))})]})}function Gn(e){return e.replace(/^\s*https?:\/\//i,``).replace(/^www\./i,``).replace(/^github\.com\//i,``).replace(/^\/+/,``)}function Kn(e){let t=Gn(e).trim().replace(/\.git$/i,``).replace(/\/+$/,``);return t?`https://github.com/${t}`:``}function qn(e){let t=Gn(e).trim().replace(/\.git$/i,``).replace(/\/+$/,``);return/^[\w.-]+\/[\w.-]+$/.test(t)}function Jn(e){if(e instanceof k){let t=e.details;if(t&&typeof t==`object`&&`error`in t){let e=t.error;if(typeof e==`string`&&e.length>0)return e}return e.message}return e instanceof Error?e.message:String(e)}function Yn(e){if(!(e instanceof k))return null;let t=e.details;if(t&&typeof t==`object`&&`fixUrl`in t){let e=t.fixUrl;if(typeof e==`string`&&e.length>0)return e}return null}var Xn=t({ProjectDetailView:()=>zr,ProjectsView:()=>Br}),Zn=()=>N(()=>import(`./ProjectChat-DMwKnkW-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61])),Qn=()=>N(()=>import(`./ProjectConnectionsTab-BZqp-oKI.js`),__vite__mapDeps([62,1,2,7,8,6,11,21,3,4,5,36,13,10,14,9,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,12,32,33,34,35,37,38])),$n=()=>N(()=>import(`./ProjectMailTab-DGo7eyB8.js`),__vite__mapDeps([63,1,2,7,8,6,11,64])),er=()=>N(()=>import(`./DiffpackReviewView-ClcNxtmF.js`),__vite__mapDeps([65,1,2,6,7,8,11,21,3,4,5,59,60,66,47,22,23,24,25,26,27,28,29,30,31,12,32,33,34,48,37,13,10,14,9,15,16,17,18,19,20,35,36,38,49,50,42,51,41,52,67])),tr=()=>N(()=>import(`./FileMapView-CxvfDLGA.js`),__vite__mapDeps([68,1,2,3,4,5,6,7,8,47,22,23,24,25,26,27,28,29,30,31,12,32,33,34,48,37,13,10,14,9,11,15,16,17,18,19,20,21,35,36,38,49,50,42,51,41,52,66])),nr=()=>N(()=>import(`./HistoryView-B4VAfEMe.js`),__vite__mapDeps([69,1,2,3,4,5,7,8,6,11,13,10,14,9,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,12,32,33,34,35,36,37,38])),rr=()=>N(()=>import(`./ProjectGithubView-w8suLCsA.js`),__vite__mapDeps([70,1,2,5,4,3,8,6,7,11,21,59,60,66,47,22,23,24,25,26,27,28,29,30,31,12,32,33,34,48,37,13,10,14,9,15,16,17,18,19,20,35,36,38,49,50,42,51,41,52,71,72])),ir=()=>N(()=>import(`./ProjectOverviewView-NNwXd_QQ.js`),__vite__mapDeps([73,1,2,6,7,8,21,3,4,5,13,10,14,9,11,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,12,32,33,34,35,36,37,38,66,47,48,49,50,42,51,41,52,74])),ar=()=>N(()=>import(`./TasksView-DuMjFS8S.js`),__vite__mapDeps([75,1,2,3,4,5,7,8,6,9,10,39,40,25,26,24,31,34,35,41,27,23,30,42,29,36,13,14,11,15,16,17,18,19,20,21,22,28,12,32,33,37,38,43,44,45,76,47,48,49,50,51,52,46,53,54,55,56,66,77,78,79])),or=(0,J.lazy)(()=>Zn().then(({ProjectChat:e})=>({default:e}))),sr=(0,J.lazy)(()=>Qn().then(({ProjectConnectionsTab:e})=>({default:e}))),cr=(0,J.lazy)(()=>$n().then(({ProjectMailTab:e})=>({default:e}))),lr=(0,J.lazy)(()=>er().then(({DiffpackReviewView:e})=>({default:e}))),ur=(0,J.lazy)(()=>tr().then(({FileMapView:e})=>({default:e}))),dr=(0,J.lazy)(()=>nr().then(({HistoryView:e})=>({default:e}))),fr=(0,J.lazy)(()=>rr().then(({ProjectGitHubView:e})=>({default:e}))),pr=(0,J.lazy)(()=>ir().then(({ProjectOverviewView:e})=>({default:e}))),mr=(0,J.lazy)(()=>ar().then(({TasksView:e})=>({default:e}))),hr=`gezel:projects:selectedId`;function gr(e){return/\.html?$/i.test(e)}function _r(e){return/\.(md|markdown|mdx)$/i.test(e)}function vr(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function yr(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function br(e,t){if(!t)return 0;if(!e.isDirectory)return t.issues.filter(t=>t.path===e.path).length;let n=`${e.path.replace(/\/$/,``)}/`;return t.issues.filter(e=>e.path.startsWith(n)).length}function xr(e){let t;switch(e){case`chat`:t=Zn();break;case`tasks`:t=ar();break;case`proposals`:t=er();break;case`github`:t=rr();break;case`mail`:t=$n();break;case`map`:t=tr();break;case`overview`:t=ir();break;case`about`:t=Promise.all([Qn(),nr()]);break;default:break}t?.catch(()=>{})}function Sr({children:e}){return(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(`p`,{className:`placeholder project-pane-loading`,children:`Loading view…`}),children:e})}var Cr=[{key:`overview`,label:`Overview`},{key:`tasks`,label:`Tasks`},{key:`approvals`,label:`Approvals`},{key:`workspace`,label:`Workspace`},{key:`artifacts`,label:`Artifacts`},{key:`map`,label:`Village`}];function wr(e,t){return t===`map`?e.tabVisibility?.map??Pr(e):e.tabVisibility?.[t]!==!1}var Tr=`gezel:project-output-fraction:v2`,Er=.18,Dr=.7,Or=.42;function kr(e){return Number.isFinite(e)?Math.max(Er,Math.min(Dr,e)):Or}function Ar(){if(typeof window>`u`)return Or;try{let e=window.localStorage.getItem(Tr);return e?kr(Number.parseFloat(e)):Or}catch{return Or}}function Q(e){return`gezel.projectOutputVisible:${e}`}function jr(e){try{let t=window.localStorage.getItem(Q(e));return t===null?null:t===`1`}catch{return null}}function Mr(e){try{window.localStorage.removeItem(Q(e))}catch{}}var Nr=new Set([`content-writing`,`media-production`,`design-prototype`]);function Pr(e){let t=oe(e);return!t||!Nr.has(t)}function Fr(e){return oe(e)===`email`||(e.connectors??[]).some(e=>e.type.startsWith(`mail-`))}function Ir({tab:e}){return(0,Y.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.4,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,children:Lr(e)})}function Lr(e){switch(e){case`output`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`rect`,{x:`1.8`,y:`2.8`,width:`12.4`,height:`8.4`,rx:`1.2`}),(0,Y.jsx)(`path`,{d:`M6.5 5.6 L9.8 7.5 L6.5 9.4 Z`,fill:`currentColor`,stroke:`none`}),(0,Y.jsx)(`line`,{x1:`5.5`,y1:`13.4`,x2:`10.5`,y2:`13.4`})]});case`chat`:return(0,Y.jsx)(`path`,{d:`M2.6 4.2A1.6 1.6 0 0 1 4.2 2.6h7.6a1.6 1.6 0 0 1 1.6 1.6v4.4a1.6 1.6 0 0 1-1.6 1.6H6.4L3.4 13V8.6A1.6 1.6 0 0 1 2.6 7Z`});case`about`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`}),(0,Y.jsx)(`line`,{x1:`8`,y1:`7.4`,x2:`8`,y2:`11`}),(0,Y.jsx)(`circle`,{cx:`8`,cy:`5`,r:`0.5`,fill:`currentColor`,stroke:`none`})]});case`tasks`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`rect`,{x:`2.6`,y:`2.6`,width:`10.8`,height:`10.8`,rx:`2`}),(0,Y.jsx)(`path`,{d:`M5.4 8 L7.2 9.8 L10.6 6`})]});case`packages`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d:`M8 2.4 L12.6 4 V7.2 C12.6 10 10.6 12 8 13.2 C5.4 12 3.4 10 3.4 7.2 V4 Z`}),(0,Y.jsx)(`path`,{d:`M6 7.6 L7.4 9 L10 5.9`})]});case`workspace`:return(0,Y.jsx)(`path`,{d:`M2.6 5.4 A1 1 0 0 1 3.6 4.4 H6 L7.3 5.8 H12.4 A1 1 0 0 1 13.4 6.8 V11.6 A1 1 0 0 1 12.4 12.6 H3.6 A1 1 0 0 1 2.6 11.6 Z`});case`artifacts`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d:`M4.4 2.6 H8.6 L11.6 5.6 V13 A0.4 0.4 0 0 1 11.2 13.4 H4.4 A0.4 0.4 0 0 1 4 13 V3 A0.4 0.4 0 0 1 4.4 2.6 Z`}),(0,Y.jsx)(`path`,{d:`M8.4 2.6 V5.6 H11.4`})]});case`github`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`circle`,{cx:`4.6`,cy:`4.2`,r:`1.5`}),(0,Y.jsx)(`circle`,{cx:`4.6`,cy:`11.8`,r:`1.5`}),(0,Y.jsx)(`circle`,{cx:`11.4`,cy:`5.6`,r:`1.5`}),(0,Y.jsx)(`path`,{d:`M4.6 5.7 V10.3`}),(0,Y.jsx)(`path`,{d:`M11.4 7.1 C11.4 9.4 9.4 9.6 7.2 9.7 C5.6 9.8 4.6 10 4.6 11`})]});case`mail`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`rect`,{x:`2.5`,y:`4`,width:`11`,height:`8`,rx:`0.7`}),(0,Y.jsx)(`path`,{d:`M2.8 4.6 L8 8.6 L13.2 4.6`})]});case`connections`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d:`M6 10 L4.2 11.8 A2.2 2.2 0 0 1 4.2 8.6 L5.6 7.2`}),(0,Y.jsx)(`path`,{d:`M10 6 L11.8 4.2 A2.2 2.2 0 0 1 11.8 7.4 L10.4 8.8`}),(0,Y.jsx)(`path`,{d:`M6.4 9.6 L9.6 6.4`})]});case`history`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6`}),(0,Y.jsx)(`path`,{d:`M8 4.6 V8 L10.4 9.4`})]});case`map`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{d:`M1.6 13.4 V7.2 L5.6 3.8 L9.6 7.2 V13.4`}),(0,Y.jsx)(`path`,{d:`M9.6 13.4 V9 L12 6.9 L14.4 9 V13.4`}),(0,Y.jsx)(`path`,{d:`M4.4 13.4 V10.2 H6.8 V13.4`}),(0,Y.jsx)(`path`,{d:`M1.2 13.4 H14.8`})]});case`overview`:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`5.8`}),(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`1.4`,fill:`currentColor`,stroke:`none`}),(0,Y.jsx)(`line`,{x1:`8`,y1:`2.2`,x2:`8`,y2:`4.4`}),(0,Y.jsx)(`line`,{x1:`8`,y1:`11.6`,x2:`8`,y2:`13.8`}),(0,Y.jsx)(`line`,{x1:`2.2`,y1:`8`,x2:`4.4`,y2:`8`}),(0,Y.jsx)(`line`,{x1:`11.6`,y1:`8`,x2:`13.8`,y2:`8`})]});default:return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`line`,{x1:`3`,y1:`5`,x2:`13`,y2:`5`}),(0,Y.jsx)(`line`,{x1:`3`,y1:`11`,x2:`13`,y2:`11`}),(0,Y.jsx)(`circle`,{cx:`6`,cy:`5`,r:`1.5`,fill:`var(--panel)`}),(0,Y.jsx)(`circle`,{cx:`10`,cy:`11`,r:`1.5`,fill:`var(--panel)`})]})}}function Rr(e){return e.stored?e.allowedOrigins.length===0?e.originSource===`webhook`?`Configure an HTTPS webhook URL in Settings → Channels first`:`No HTTPS destination configured`:`Restricted to ${e.allowedOrigins.map(e=>{try{return new URL(e).host}catch{return e}}).join(`, `)}`:null}function zr({projectId:e,compact:t=!1}){return(0,Y.jsx)(Br,{forceProjectId:e,compact:t})}function Br({forceProjectId:e,compact:t=!1}={}){let n=e!==void 0,r=Ke(),s=(0,J.useRef)(null),c=Xe(s),l=t||c,u=je(),[d,p]=(0,J.useState)([]),[m,y]=(0,J.useState)(null),[b,te]=(0,J.useState)(!1),[x,S]=(0,J.useState)(void 0),[C,T]=(0,J.useState)(null),[E,D]=(0,J.useState)(``),[ie,oe]=(0,J.useState)(``),[se,O]=(0,J.useState)(null),[k,ye]=(0,J.useState)({}),[P,F]=(0,J.useState)(null),[I,L]=(0,J.useState)(`chat`);(0,J.useEffect)(()=>{!r&&I===`mail`&&L(`about`)},[r,I]);let[R,Se]=(0,J.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(`gezel.projectsSidebarCollapsed`)===`1`}catch{return!1}});(0,J.useEffect)(()=>{try{window.localStorage.setItem(`gezel.projectsSidebarCollapsed`,R?`1`:`0`)}catch{}},[R]);let z=I===`workspace`?`workspace`:I===`artifacts`?`artifacts`:null,[Ce,we]=(0,J.useState)([]),[B,De]=(0,J.useState)([]),[Oe,Ae]=(0,J.useState)([]),[Ne,Fe]=(0,J.useState)(!1),[H,Le]=(0,J.useState)(!1),[Be,He]=(0,J.useState)({workspace:`tree-alpha`,artifacts:`tree-alpha`}),[Je,Ye]=(0,J.useState)({workspace:!1,artifacts:!1}),[Ze,Qe]=(0,J.useState)(null),[W,G]=(0,J.useState)(null),[K,_t]=(0,J.useState)(null),[q,vt]=(0,J.useState)(null),[bt,xt]=(0,J.useState)(null),[wt,Tt]=(0,J.useState)(null),[Et,Dt]=(0,J.useState)(!1),[Ot,kt]=(0,J.useState)(null),[At,jt]=(0,J.useState)(!1),[Mt,Nt]=(0,J.useState)(null),[Pt,Ft]=(0,J.useState)(null),[It,zt]=(0,J.useState)(null),[Bt,Vt]=(0,J.useState)(null),[Ht,Ut]=(0,J.useState)([]),[Wt,Gt]=(0,J.useState)(null),[Kt,qt]=(0,J.useState)(null),[Jt,Xt]=(0,J.useState)(),[Zt,Qt]=(0,J.useState)(``),[$t,en]=(0,J.useState)(!1),[tn,nn]=(0,J.useState)([]),[rn,an]=(0,J.useState)(``),[on,ln]=(0,J.useState)(``),[un,dn]=(0,J.useState)(!1),[fn,mn]=(0,J.useState)([]),hn=fn.filter(e=>e.stored),gn=(0,J.useCallback)(async()=>{try{p((await A.listProjects()).projects)}catch(e){O(e.message)}},[]),_n=(0,J.useMemo)(()=>d.filter(e=>!e.archived),[d]),vn=(0,J.useMemo)(()=>d.filter(e=>e.archived),[d]),yn=(0,J.useMemo)(()=>{if(!m)return[];let e=new Set(m.linkedProjectIds??[]);return d.filter(t=>t.id!==m.id&&!ae(t)&&(!t.archived||e.has(t.id)))},[d,m]),bn=(m?.linkedProjectIds?.length??0)>=32;(0,J.useEffect)(()=>{gn()},[gn]),(0,J.useEffect)(()=>{let e=e=>{let t=e.detail;if(t?.projectId){if(!t.project){gn();return}p(e=>e.map(e=>e.id===t.projectId?{...e,...t.project}:e)),y(e=>e?.id===t.projectId?t.project:e)}};return window.addEventListener(`gezel:project-updated`,e),()=>window.removeEventListener(`gezel:project-updated`,e)},[gn]),(0,J.useEffect)(()=>{if(n)return;V(`project`)&&T(`crew`);let e=()=>{V(`project`),T(`crew`)};return window.addEventListener(`gezel:new-project`,e),()=>window.removeEventListener(`gezel:new-project`,e)},[n]),(0,J.useEffect)(()=>{let e=e=>{let t=e.detail?.projectId;gn(),t&&y(e=>e?.id===t?null:e)};return window.addEventListener(`gezel:project-deleted`,e),()=>window.removeEventListener(`gezel:project-deleted`,e)},[gn]);let xn=(0,J.useCallback)(async()=>{try{Ut((await A.listGezels()).gezels)}catch(e){console.error(`[ProjectsView] listGezels failed`,e)}},[]),Sn=(0,J.useCallback)(async()=>{try{let e=await A.getConfig();Xt(e.boekwachterGezelId),qt(e)}catch{}},[]);(0,J.useEffect)(()=>{xn(),Sn()},[xn,Sn]),(0,J.useEffect)(()=>{let e=()=>void Sn();return window.addEventListener(`gezel:config-updated`,e),()=>window.removeEventListener(`gezel:config-updated`,e)},[Sn]),(0,J.useEffect)(()=>{let e=()=>void xn();return window.addEventListener(`gezel:gezel-updated`,e),()=>window.removeEventListener(`gezel:gezel-updated`,e)},[xn]);let X=m?.id;(0,J.useEffect)(()=>{if(!X){Gt(null);return}let e=!1,t=()=>{A.listProjectLocalGezels(X).then(t=>{e||Gt({projectId:X,gezels:t.gezels})}).catch(()=>{e||Gt({projectId:X,gezels:[]})})},n=()=>t();return t(),window.addEventListener(`gezel:gezel-updated`,n),()=>{e=!0,window.removeEventListener(`gezel:gezel-updated`,n)}},[X]);let wn=(0,J.useMemo)(()=>{if(!m)return{managedWritable:!0,nativeWritable:!1,effectiveWritable:!0,codexInUse:!1,claudeInUse:!1,claudeMode:`acceptEdits`};let e=Wt?.projectId===m.id?Wt.gezels:[];return{...Tn(m,Ht,e,Kt),codexInUse:En(m,Ht,e,Kt),claudeInUse:Dn(m,Ht,e,Kt),claudeMode:On(m,Ht,e,Kt)}},[m,Ht,Wt,Kt]),kn=ee(m?.codexPermissionMode??Kt?.codexCli?.defaultPermissionMode),An=(0,J.useCallback)(async e=>{if(!m)return;let t=await A.addGezelToProject(m.id,e);S(e),y(e=>e?.id===m.id?{...e,gezelIds:t.gezelIds}:e)},[m]),jn=(0,J.useCallback)(async e=>{if(!m)return;let t=await A.removeGezelFromProject(m.id,e);y(e=>e?.id===m.id?{...e,gezelIds:t.gezelIds}:e)},[m]),Mn=(0,J.useCallback)(async(e,t)=>{if(!m)return;let n=m.id,r=await A.createGezelFromTemplate(e,{name:t.name,...t.gender?{gender:t.gender}:{}});if(t.appearanceSeed!==void 0){let{poppetje:e}=await A.rerollGezelPoppetje(r.id,{seed:t.appearanceSeed});r={...r,poppetje:e}}let i=await A.addGezelToProject(n,r.id);S(r.id),Ut(e=>[...e.filter(e=>e.id!==r.id),r]),y(e=>e?.id===n?{...e,gezelIds:i.gezelIds}:e),window.dispatchEvent(new CustomEvent(`gezel:gezel-updated`,{detail:r}))},[m]),Nn=Je.workspace,Pn=Je.artifacts,Fn=(0,J.useCallback)(async e=>{let[t,n]=await Promise.all([A.listProjectWorkspace(e,``,!0,{stats:!0,hidden:Nn}),A.listProjectArtifacts(e,``,!0,{stats:!0,hidden:Pn})]);we(t.files),Ae(n.files),Fe(t.truncated===!0),Le(n.truncated===!0)},[Nn,Pn]),In=(0,J.useCallback)(async e=>{let t=await A.listProjectWorkspaceHtmlPages(e);De(t.files.map(e=>e.path))},[]),Ln=(0,J.useCallback)(async e=>{await Promise.all([Fn(e),In(e)])},[Fn,In]);(0,J.useEffect)(()=>{z===null||!m||Ln(m.id)},[z,m,Ln]),(0,J.useEffect)(()=>{if(z!==`workspace`||!X)return;let e=!1;_t(null),vt(null),xt(null);let t=async()=>{let[t,n]=await Promise.allSettled([A.getProjectIndexStatus(X),A.toolListFileIssues(X,{maxResults:1e3})]);if(!e)if(t.status===`fulfilled`&&_t(t.value),n.status===`fulfilled`&&vt(n.value),t.status===`rejected`&&n.status===`rejected`){let e=t.reason;xt(e instanceof Error?e.message:String(e))}else xt(null)};t();let n=window.setInterval(()=>void t(),3e4);return()=>{e=!0,window.clearInterval(n)}},[z,X]),(0,J.useEffect)(()=>{if(Qe(null),!X){He({workspace:`tree-alpha`,artifacts:`tree-alpha`}),Ye({workspace:!1,artifacts:!1});return}let e=`tree-alpha`,t=`tree-alpha`,n=!1,r=!1;try{e=_e(window.localStorage.getItem(pe(X,`workspace`)),`workspace`),t=_e(window.localStorage.getItem(pe(X,`artifacts`)),`artifacts`),n=window.localStorage.getItem(ge(X,`workspace`))===`1`,r=window.localStorage.getItem(ge(X,`artifacts`))===`1`}catch{}He({workspace:e,artifacts:t}),Ye({workspace:n,artifacts:r})},[X]);let Rn=(0,J.useCallback)((e,t)=>{if(He(n=>({...n,[e]:t})),X)try{window.localStorage.setItem(pe(X,e),t)}catch{}},[X]),zn=(0,J.useCallback)((e,t)=>{if(Ye(n=>({...n,[e]:t})),X)try{window.localStorage.setItem(ge(X,e),t?`1`:`0`)}catch{}},[X]),Bn=Be.workspace,Vn=K?.meta?.scannedAt;(0,J.useEffect)(()=>{if(z!==`workspace`||Bn!==`flat-modified`||!X)return;let e=!1;return A.listProjectIndexFilesDetail(X,{hidden:Nn}).then(t=>{e||Qe(t.files)}).catch(()=>{e||Qe(null)}),()=>{e=!0}},[z,Bn,X,Vn,Nn]);let Z=z===`workspace`&&W?.source===`workspace`?W.path:null,Un=K?.enrichment?.reviews?.reviewed;(0,J.useEffect)(()=>{if(!X||!Z){Tt(null),Dt(!1),kt(null);return}let e=!1;return Tt(null),Dt(!0),kt(null),A.toolFileReview(X,{path:Z}).then(t=>{e||Tt(t)}).catch(t=>{e||kt(t instanceof Error?t.message:String(t))}).finally(()=>{e||Dt(!1)}),()=>{e=!0}},[X,Z,Un]);let Wn=(0,J.useCallback)(async()=>{if(!X)return;let[e,t]=await Promise.all([A.toolListFileIssues(X,{maxResults:1e3}),Z?A.toolFileReview(X,{path:Z}):Promise.resolve(null)]);vt(e),t&&Tt(t)},[X,Z]),Gn=(0,J.useCallback)(async(e,t)=>{X&&(await A.updateBoekwachterIssue(X,{ref:e.ref,...t}),await Wn())},[Wn,X]);(0,J.useEffect)(()=>{if(I!==`packages`||!m){ye({}),F(null);return}A.listPackageScripts(m.id).then(e=>ye(e.scripts)).catch(e=>{console.warn(`[ProjectsView] listPackageScripts failed`,e),ye({})}),A.getProjectApprovals(m.id).then(F).catch(e=>{console.warn(`[ProjectsView] getProjectApprovals failed`,e),F(null)})},[I,m]),(0,J.useEffect)(()=>{G(null)},[z]),(0,J.useEffect)(()=>{if(I!==`about`||!m)return;let e=!1;return(async()=>{try{let t=await A.listWorkspaceWrites(m.id,20);e||nn(t.entries)}catch{}try{let t=await A.listAvailableCredentials();e||mn(t.credentials.map(e=>{let t=e;return{name:e.name,label:e.label,stored:e.stored,allowedOrigins:t.allowedOrigins??e.defaultOrigins,originSource:t.originSource??(e.name.startsWith(`webhook.`)?`webhook`:`provider`)}}))}catch{}})(),()=>{e=!0}},[I,m]);let Kn=(0,J.useCallback)(async(e,t)=>{if(!m)return;let n=m.grantedCredentials??[],r=t?Array.from(new Set([...n,e])):n.filter(t=>t!==e),i=fn.find(t=>t.name===e);if(t&&(i?.allowedOrigins.length??0)===0){O(`Configure an HTTPS destination for ${e} before granting it.`);return}try{let e=await A.updateProject(m.id,{grantedCredentials:r});y(e),O(null)}catch(e){O(e.message)}},[m,fn]),qn=(0,J.useCallback)((e,t)=>{if(!m)return;let n=qr(e,t);qe(m.id,n),L(`chat`)},[m]),Jn=(0,J.useCallback)(e=>{m&&(qe(m.id,e),L(`chat`))},[m]),Yn=(0,J.useCallback)(async e=>{let t=await A.getProject(e);y(t),G(null),we([]),De([]),Ae([]),jt(!1),L(`chat`),Qt(t.workingDir??``),an(t.github?.url??``),ln(``),await In(e),window.dispatchEvent(new CustomEvent(`gezel:project-opened`,{detail:{id:t.id,name:t.name}}))},[In]),Xn=(0,J.useCallback)(async(e,t,n,r)=>{L(n);let i=ze(t.slice(t.lastIndexOf(`/`)+1));if(i){G({path:t,content:i,source:n});return}let a=n===`workspace`?await A.readProjectWorkspaceFile(e,t):await A.readProjectArtifact(e,t),o=Ie(a.content)?Re:a.content;G({...a,content:o,source:n}),r&&Ft(e=>({path:t,line:r,requestId:(e?.requestId??0)+1}))},[]);(0,J.useEffect)(()=>{let e=e=>{let t=e.detail;t?.projectId&&Yn(t.projectId)};return window.addEventListener(`gezel:open-project`,e),()=>window.removeEventListener(`gezel:open-project`,e)},[Yn]),(0,J.useEffect)(()=>{let e=e=>{let t=e.detail;t?.projectId&&m&&t.projectId!==m.id||L(`settings`)};return window.addEventListener(`gezel:open-project-settings`,e),()=>window.removeEventListener(`gezel:open-project-settings`,e)},[m]),(0,J.useEffect)(()=>{let e=e=>{let t=e.detail;!t?.path||!t.source||m&&(!t.projectId||t.projectId===m.id)&&(Ee(m.id),Xn(m.id,t.path,t.source,t.line))};return window.addEventListener(`gezel:open-file`,e),()=>window.removeEventListener(`gezel:open-file`,e)},[m,Xn]),(0,J.useEffect)(()=>{e&&Yn(e).then(()=>{let t=Ee(e);t&&Xn(e,t.path,t.source,t.line)})},[e,Yn,Xn]);let Zn=(0,J.useCallback)(async e=>{await gn(),y(e),G(null),we([]),De([]),Ae([]),jt(!1),L(`chat`),Qt(``),an(``),ln(``),await In(e.id)},[gn,In]),Qn=(0,J.useCallback)(async()=>{if(!(!m||!E.trim())){oe(`installing…`);try{let e=await A.installPackage(m.id,{name:E.trim()});oe(e.log),y(e.project),D(``)}catch(e){oe(e.message)}}},[E,m]),$n=(0,J.useCallback)(async e=>{if(!m)return;let t=e.trim();if(t!==(m.github?.url??``))try{if(t===``){let e=await A.updateProject(m.id,{github:null});y(e),ln(`Unlinked.`);return}let e=await A.updateProject(m.id,{github:{url:t}});y(e),ln(`Cloning…`);try{let e=await A.cloneProjectGit(m.id),t=await A.getProject(m.id);y(t),ln(e.adopted?`Adopted existing checkout.`:`Cloned.`)}catch(e){let t=e.message||`clone failed`;ln(`Linked, but clone failed: ${t}`)}}catch(e){ln(`save failed: ${e.message}`)}},[m]),er=(0,J.useCallback)(async e=>{if(!m)return;let t=e.trim()||void 0;if(t!==(m.workingDir??void 0))try{let e=await A.setProjectWorkingDir(m.id,t);y(e),await Ln(m.id)}catch(e){console.error(`setProjectWorkingDir failed:`,e)}},[m,Ln]),tr=(0,J.useCallback)(async e=>{if(m)try{let t=await A.updateProject(m.id,{managedWorkspaceWritePolicy:e?`allow`:`deny`});y(t)}catch(e){console.error(`updateProject(managedWorkspaceWritePolicy) failed:`,e)}},[m]),nr=(0,J.useCallback)(async e=>{if(m)try{let t=await A.updateProject(m.id,{codexPermissionMode:e});y(t)}catch(e){console.error(`updateProject(codexPermissionMode) failed:`,e)}},[m]),rr=(0,J.useCallback)(async e=>{if(m)try{let t=await A.updateProject(m.id,{claudePermissionMode:e});y(t)}catch(e){console.error(`updateProject(claudePermissionMode) failed:`,e)}},[m]),ir=(0,J.useCallback)(async e=>{if(m)try{let t=await A.updateProject(m.id,{indexingEnabled:e});y(t),e&&A.refreshProjectIndex(m.id).catch(()=>{})}catch(e){console.error(`updateProject(indexingEnabled) failed:`,e)}},[m]),ar=(0,J.useCallback)(async e=>{if(m)try{y(await A.updateProject(m.id,{nightlyFixesEnabled:e}))}catch(e){console.error(`updateProject(nightlyFixesEnabled) failed:`,e)}},[m]),_r=(0,J.useCallback)(async(e,t)=>{if(!m||un)return;let n=m.linkedProjectIds??[],r=t?Array.from(new Set([...n,e])):n.filter(t=>t!==e);dn(!0);try{let e=await A.updateProject(m.id,{linkedProjectIds:r});y(e),p(t=>t.map(t=>t.id===e.id?{...t,...e}:t))}catch(e){O(e instanceof Error?e.message:String(e))}finally{dn(!1)}},[un,m]),vr=(0,J.useCallback)(async e=>{if(m)try{let t=await A.updateProject(m.id,{nudgeConfig:{...m.nudgeConfig,enabled:!e}});y(t)}catch(e){O(e.message)}},[m]),Or=(0,J.useCallback)(async(e,t)=>{if(m)try{let n=await A.updateProject(m.id,{tabVisibility:{...m.tabVisibility,[e]:t}});y(n),O(null)}catch(e){O(e.message)}},[m]),Q=(0,J.useCallback)(e=>e===`artifacts`||w(m),[m]),Nr=(0,J.useCallback)(async(e,t)=>{if(!m)throw Error(`Open a project before viewing this document.`);let n=at(e.path);if(!n)throw Error(`This file does not support a Markdown companion.`);let r=ot(n,(t===`workspace`?Ce:Oe).filter(e=>!e.isDirectory).map(e=>e.path)),i;if(r)i=(t===`workspace`?await A.readProjectWorkspaceFile(m.id,r):await A.readProjectArtifact(m.id,r)).content;else{if(!Q(t))throw Error(`Enable workspace writes for this external project before importing its Markdown companion.`);let a=await nt(await(t===`workspace`?await A.fetchProjectWorkspaceBlob(m.id,e.path):await A.fetchProjectArtifactBlob(m.id,e.path)).arrayBuffer(),n),o=pn({projectId:m.id,root:n.companionDirectory,client:A,primaryDocumentFilename:n.markdownFilename,source:t});for(let e of await a.container.listFiles()){if(/\.md$/i.test(e.path))continue;let t=await a.container.readFile(e.path);t&&await o.writeFile(e.path,t,e.mimeType)}await o.writeDocument(a.markdown,n.markdownFilename),r=n.markdownPath,i=a.markdown,await Fn(m.id)}let a=st(i,n);return a!==i&&Q(t)&&(t===`workspace`?await A.writeProjectWorkspaceFile(m.id,{path:r,content:a}):await A.writeProjectArtifact(m.id,r,a)),{layout:{...n,markdownPath:r},sourcePath:r,content:a,editingEnabled:it(a)}},[m,Ce,Oe,Q,Fn]),Pr=(0,J.useCallback)(async(e,t)=>{if(!m||e.isDirectory)return;if(at(e.path)){try{let n=await Nr(e,t);G({path:e.path,content:n.content,source:t,outsideIn:{layout:n.layout,sourcePath:n.sourcePath,editingEnabled:n.editingEnabled}}),O(null)}catch(e){O(e instanceof Error?e.message:`Could not open this rendered document.`)}return}let n=ze(e.name);if(n)G({path:e.path,content:n,source:t});else{let n=t===`workspace`?await A.readProjectWorkspaceFile(m.id,e.path):await A.readProjectArtifact(m.id,e.path),r=Ie(n.content)?Re:n.content;G({...n,content:r,source:t})}},[m,Nr]),Lr=(0,J.useCallback)(async(e,t)=>{if(!(!m||e.isDirectory)){if(!Q(t)){O(`Enable workspace writes before allowing Markdown editing.`);return}try{let n=await Nr(e,t),r=t===`workspace`?await A.fetchProjectWorkspaceBlob(m.id,n.layout.targetPath):await A.fetchProjectArtifactBlob(m.id,n.layout.targetPath);try{t===`workspace`?await A.writeProjectWorkspaceBinary(m.id,n.layout.backupPath,r,r.type||`application/octet-stream`,{createOnly:!0}):await A.writeProjectArtifactBinary(m.id,n.layout.backupPath,r,r.type||`application/octet-stream`,{createOnly:!0})}catch(e){if(!(e instanceof Error)||!e.message.includes(`already exists`))throw e}let i=tt(n.content,n.layout);t===`workspace`?await A.writeProjectWorkspaceFile(m.id,{path:n.sourcePath,content:i}):await A.writeProjectArtifact(m.id,n.sourcePath,i),G({path:e.path,content:i,source:t,outsideIn:{layout:n.layout,sourcePath:n.sourcePath,editingEnabled:!0}}),O(null),await Fn(m.id)}catch(e){O(e instanceof Error?e.message:`Could not enable Markdown editing.`)}}},[m,Q,Nr,Fn]),zr=(0,J.useCallback)(e=>{G(t=>t&&{...t,content:e})},[]),Br=(0,J.useCallback)(async e=>{if(!m||!W||Ve.has(W.content))return;let t=e??W.content;if(W.outsideIn){if(!Q(W.source)||!W.outsideIn.editingEnabled)return;let{layout:e,sourcePath:n}=W.outsideIn,r=pn({projectId:m.id,root:e.companionDirectory,client:A,primaryDocumentFilename:yr(n),source:W.source}),i=W.source===`workspace`?Ce:Oe,a=e.format===`html`?et(e.targetPath,new Set(i.filter(e=>e.isDirectory).map(e=>e.path.replace(/^\/+/,``)))):void 0,o=st(t,e),s=await rt(o,e,r,a?$e(e.parentDirectory,a):void 0);if(W.source===`workspace`?await A.writeProjectWorkspaceFile(m.id,{path:n,content:o}):await A.writeProjectArtifact(m.id,n,o),a){let{PLAYER_BUNDLE:e}=await N(async()=>{let{PLAYER_BUNDLE:e}=await import(`./standalone-source-D6mbpa3h.js`);return{PLAYER_BUNDLE:e}},[]);W.source===`workspace`?await A.writeProjectWorkspaceFile(m.id,{path:a,content:e}):await A.writeProjectArtifact(m.id,a,e)}W.source===`workspace`?await A.writeProjectWorkspaceBinary(m.id,e.targetPath,s.bytes,s.mimeType):await A.writeProjectArtifactBinary(m.id,e.targetPath,s.bytes,s.mimeType),G(e=>e?.path===W.path&&e.source===W.source?{...e,content:o}:e),await Ln(m.id);return}Q(W.source)&&(W.source===`workspace`?await A.writeProjectWorkspaceFile(m.id,{path:W.path,content:t}):await A.writeProjectArtifact(m.id,W.path,t))},[m,W,Q,Ce,Oe,Ln]);(0,J.useCallback)((e,t)=>m?`/api/projects/${m.id}/${t===`workspace`?`workspace`:`artifacts`}/read?path=${encodeURIComponent(e)}&raw=1`:``,[m]);let Gr=z===`workspace`?Ce:Oe,Kr=z?Je[z]:!1,Xr=(0,J.useMemo)(()=>Kr?Gr:Gr.filter(e=>!re(e.path)),[Gr,Kr]),$=z?Be[z]:`tree-alpha`,Zr=(0,J.useMemo)(()=>$===`flat-modified`?z===`workspace`&&Ze&&Ze.length>0?Ze.filter(e=>Kr||!re(e.path)).map(e=>j(e.path,e.mtimeMs)).sort(de):Xr.filter(e=>!e.isDirectory).slice().sort(de):[],[$,z,Ze,Xr,Kr]),Qr=(0,J.useMemo)(()=>he(q?.issues??[]),[q]),$r=(0,J.useMemo)(()=>new Map(Qr.map(e=>[e.path,e])),[Qr]),ei=(0,J.useMemo)(()=>$!==`flat-issues`&&$!==`flat-criticality`?[]:ve(Qr,$===`flat-issues`?`count`:`score`).map(e=>j(e.path)),[$,Qr]),ti=$===`flat-modified`&&z===`workspace`&&Ze!==null&&Ze.length>0,ni=(0,J.useMemo)(()=>$===`flat-issues`||$===`flat-criticality`?{entries:ei,emptyMessage:`No open review issues.`,onSelect:e=>{z&&(Pr(e,z),jt(!0))},trailingForEntry:e=>{let t=$r.get(e.path);return t?(0,Y.jsxs)(Y.Fragment,{children:[$===`flat-criticality`?(0,Y.jsx)(`span`,{className:`file-flat-score`,title:`Criticality score ${t.score}`,children:t.score}):(0,Y.jsx)(`span`,{className:`workspace-tree-issue-count`,title:`${t.total} Boekwachter issue${t.total===1?``:`s`} in this file`,children:t.total}),(0,Y.jsx)(`span`,{className:`file-flat-severities`,children:fe(t.bySeverity)})]}):null}}:ti?{entries:Zr,emptyMessage:`No files yet.`,trailingForEntry:e=>e.mtimeMs===void 0?null:(0,Y.jsx)(`span`,{className:`file-flat-time`,title:xe(new Date(e.mtimeMs)),children:le(new Date(e.mtimeMs).toISOString())})}:null,[$,z,ei,Zr,ti,$r,Pr]),ri=(0,J.useMemo)(()=>Ue(m?.id??``,z??`artifacts`,{canWrite:m!==null&&z!==null&&Q(z)}),[m,z,Q]),ii=(0,J.useCallback)(e=>{if(!e){G(null);return}z&&Pr(j(e),z)},[z,Pr]),ai=Ge({source:ri,entries:Gr,selectedPath:W?.path??null,onSelectPath:ii,refresh:(0,J.useCallback)(async()=>{m&&await Ln(m.id)},[m,Ln])}),oi=W?.outsideIn?!W.outsideIn.editingEnabled||!Q(W.source):!z||!Q(z),si=Z?br({name:yr(Z),path:Z,isDirectory:!1},q):0,ci=Pt?.path===W?.path?Pt:null,li=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Vr,{request:ci}),Z?(0,Y.jsx)(dt,{open:At,issueCount:si,onToggle:()=>jt(e=>!e)}):null]}),ui=(0,J.useMemo)(()=>B.some(e=>/(^|\/)index\.html?$/i.test(e)),[B]);(0,J.useEffect)(()=>{if(!m){zt(null);return}if(typeof m.outputPaneVisible==`boolean`){Mr(m.id);return}let e=jr(m.id);if(e===null)return;let t=m.id;zt({projectId:t,visible:e}),A.updateProject(t,{outputPaneVisible:e}).then(e=>{Mr(t),y(n=>n?.id===t?e:n)}).catch(()=>{})},[m?.id]);let di=m?.projectType;(0,J.useEffect)(()=>{let e=!1;if(!di){Vt(null);return}return(async()=>{try{let t=await A.getCatalogItem(`project-type`,di.id,{source:di.source,version:di.version}),n=t.manifest.kind===`project-type`?t.manifest.pages:void 0,r=t.manifest.kind===`project-type`?new Set((t.manifest.tools??[]).map(e=>e.name)):new Set,i=(n?.tools??[]).filter(e=>r.has(e));e||Vt(n?.entry?{entry:n.entry,label:`Dashboard`,...i.length>0?{pageTools:i}:{}}:null)}catch{e||Vt(null)}})(),()=>{e=!0}},[di?.id,di?.version,di?.source]);let fi=It&&It.projectId===m?.id?It.visible:null,pi=!!m&&(fi??m?.outputPaneVisible??(ui||!!Bt)),mi=(0,J.useCallback)(()=>{if(!m)return;let e=!pi,t=m.id;zt({projectId:t,visible:e}),A.updateProject(t,{outputPaneVisible:e}).then(e=>{y(n=>n?.id===t?e:n)}).catch(e=>{O(e.message)})},[m,pi]),hi=(0,J.useRef)(null),[gi,_i]=(0,J.useState)(()=>Ar()),vi=(0,J.useRef)(null),yi=(0,J.useCallback)(e=>{let t=kr(e);_i(t);try{window.localStorage.setItem(Tr,t.toFixed(4))}catch{}},[]),bi=(0,J.useCallback)(e=>{e.preventDefault(),vi.current={startX:e.clientX,startFraction:gi,width:hi.current?.clientWidth??1},document.body.classList.add(`chat-rail-resizing`),document.body.style.cursor=`col-resize`;let t=e=>{let t=vi.current;!t||t.width<=0||yi(t.startFraction+(e.clientX-t.startX)/t.width)},n=()=>{vi.current=null,document.body.style.cursor=``,document.body.classList.remove(`chat-rail-resizing`),window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)},[gi,yi]),xi=(0,J.useCallback)(e=>{let t=e.shiftKey?.08:.02;e.key===`ArrowRight`?(e.preventDefault(),yi(gi+t)):e.key===`ArrowLeft`?(e.preventDefault(),yi(gi-t)):e.key===`Home`?(e.preventDefault(),yi(Er)):e.key===`End`&&(e.preventDefault(),yi(Dr))},[gi,yi]),Si=l&&B.length>0,Ci=lt(m?.id??``);(0,J.useEffect)(()=>{I===`output`&&!Si&&L(`chat`)},[I,Si]);let wi=!l&&pi,Ti=Si&&I===`output`,Ei=(0,J.useCallback)(e=>{if(Yn(e),!n)try{window.localStorage.setItem(hr,e)}catch{}},[n,Yn]),Di=(0,J.useCallback)(async()=>{if(!(!m||m.id==="default"||ae(m))&&!b){te(!0);try{let e=await A.updateProject(m.id,{archived:!m.archived});window.dispatchEvent(new CustomEvent(`gezel:project-updated`,{detail:{projectId:m.id,project:e}}))}catch(e){O(e instanceof Error?e.message:String(e))}finally{te(!1)}}},[b,m]),Oi=(e,t)=>e.map(e=>(0,Y.jsx)(Me,{project:e,onDeleted:()=>void gn(),onChanged:()=>void gn(),children:(0,Y.jsxs)(`li`,{className:`project-rail-row${t?` project-rail-row-archived`:``}`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`project-rail-name${m?.id===e.id?` active`:``}`,onClick:()=>Ei(e.id),title:e.name,"aria-label":R?e.name:void 0,children:[(0,Y.jsx)(Pe,{project:e,size:18,className:`project-rail-mark`}),!R&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`project-rail-label`,children:e.name}),e.storageScope===`machine-shared`&&(0,Y.jsx)(`span`,{className:`machine-shared-badge`,title:`Shared with accounts on this machine`,children:`Shared`})]})]}),!R&&(0,Y.jsx)(ke,{project:e,onDeleted:()=>void gn(),onChanged:()=>void gn()})]})},e.id));return(0,J.useEffect)(()=>{if(n||m||d.length===0)return;let e=null;try{e=window.localStorage.getItem(hr)}catch{e=null}e&&d.some(t=>t.id===e)&&Yn(e)},[n,m,d,Yn]),(0,Y.jsxs)(`div`,{ref:s,className:`two-col${R&&!n?` sidebar-collapsed`:``}${n?` detail-only`:``}${l?` is-compact`:``}`,children:[!n&&(0,Y.jsx)(Hn,{open:C!==null,mode:C??`crew`,onClose:()=>T(null),onCreated:Zn}),m&&Mt&&(0,Y.jsx)(Cn,{path:Mt.path,issue:Mt.issue,gezels:Ht,assignedGezelIds:new Set([...m.gezelIds??[],...m.voormanGezelId?[m.voormanGezelId]:[]]),onCancel:()=>Nt(null),onConfirm:async(e,t)=>{await A.fixBoekwachterIssue(m.id,{ref:Mt.issue.ref,gezelId:e,message:t}),await Wn(),Nt(null),L(`chat`)}},`${Mt.path}:${Mt.issue.category}:${Mt.issue.message}`),!n&&(0,Y.jsxs)(`aside`,{className:`side${R?` collapsed`:``}`,children:[(0,Y.jsxs)(`div`,{className:`area-toolbar`,children:[!R&&(0,Y.jsx)(`button`,{type:`button`,className:`area-toolbar-btn`,onClick:()=>T(`crew`),children:`+ New Project`}),(0,Y.jsx)(`button`,{type:`button`,className:`area-toolbar-toggle`,onClick:()=>Se(e=>!e),title:R?`Expand project list`:`Collapse project list`,"aria-label":R?`Expand project list`:`Collapse project list`,children:R?`›`:`‹`})]}),R&&(0,Y.jsx)(`div`,{className:`new-row collapsed-create-row`,"aria-label":`Create`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`collapsed-create-btn`,onClick:()=>T(`crew`),title:`New Project`,"aria-label":`New Project`,children:[(0,Y.jsx)(`span`,{className:`collapsed-create-symbol`,"aria-hidden":`true`,children:`+`}),(0,Y.jsx)(`span`,{className:`collapsed-create-label`,children:`Project`})]})}),(0,Y.jsx)(`ul`,{children:Oi(_n,!1)}),vn.length>0&&(0,Y.jsxs)(`section`,{className:`project-archive-section${R?` is-collapsed`:``}`,"aria-labelledby":`archived-projects-heading`,children:[(0,Y.jsx)(`h3`,{id:`archived-projects-heading`,children:`Archived projects`}),(0,Y.jsx)(`ul`,{children:Oi(vn,!0)})]}),se&&!R&&(0,Y.jsx)(`p`,{className:`error`,children:se})]}),(0,Y.jsx)(`section`,{className:`main`,children:!n&&!m?(0,Y.jsx)(`p`,{className:`placeholder`,children:`Pick a project on the left to view it here.`}):m?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`entity-tabs-row project-tabs-row`,children:[!l&&(0,Y.jsx)(`button`,{type:`button`,className:`output-toggle${pi?` is-active`:``}`,onClick:mi,title:pi?`Hide output pane`:`Show output pane`,"aria-label":pi?`Hide output pane`:`Show output pane`,"aria-pressed":pi,children:(0,Y.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,"aria-hidden":`true`,focusable:`false`,children:[(0,Y.jsx)(`rect`,{x:`1.5`,y:`2.5`,width:`13`,height:`9`,rx:`1.2`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`}),(0,Y.jsx)(`path`,{d:`M6.4 5.4 L10 7.5 L6.4 9.6 Z`,fill:`currentColor`}),(0,Y.jsx)(`line`,{x1:`5`,y1:`13.6`,x2:`11`,y2:`13.6`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`})]})}),(0,Y.jsx)(o,{value:I,onValueChange:e=>L(e),children:(0,Y.jsx)(a,{children:[{value:`output`,label:`Output`,show:Si},{value:`chat`,label:`Chat`,show:!0},{value:`overview`,label:`Overview`,show:wr(m,`overview`)},{value:`tasks`,label:`Tasks`,show:wr(m,`tasks`)},{value:`packages`,label:`Approvals`,show:wr(m,`approvals`)},{value:`workspace`,label:`Workspace`,show:wr(m,`workspace`)},{value:`artifacts`,label:`Artifacts`,show:wr(m,`artifacts`)},{value:`proposals`,label:`Proposals`,show:Ci>0},{value:`github`,label:`GitHub`,show:!!m.github?.url},{value:`mail`,label:`Mail`,show:r&&Fr(m)},{value:`map`,label:`Village`,show:wr(m,`map`)},{value:`about`,label:`Settings`,show:!0}].filter(e=>e.show).map(e=>l?(0,Y.jsx)(i,{value:e.value,"data-testid":`project-tab-${e.value}`,className:`gz-tab-icon`,"aria-label":e.label,title:e.label,onPointerEnter:()=>xr(e.value),onFocus:()=>xr(e.value),onPointerDown:()=>xr(e.value),children:(0,Y.jsx)(Ir,{tab:e.value})},e.value):(0,Y.jsx)(i,{value:e.value,"data-testid":`project-tab-${e.value}`,onPointerEnter:()=>xr(e.value),onFocus:()=>xr(e.value),onPointerDown:()=>xr(e.value),children:e.label},e.value))})}),m.archived&&(0,Y.jsx)(`span`,{className:`project-archived-badge`,title:`Hidden from primary navigation`,children:`Archived`})]}),(0,Y.jsxs)(`div`,{ref:hi,className:`project-body${wi?` has-output`:``}${l?` project-body-compact`:``}`,style:wi?{"--project-output-width":`${(gi*100).toFixed(2)}%`}:void 0,children:[(wi||Ti)&&(0,Y.jsx)(Yt,{projectId:m.id,htmlFiles:B,typePage:Bt??void 0,onClose:Ti?()=>L(`chat`):mi,onDebugFrame:Jn},m.id),wi&&(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize output pane`,tabIndex:0,className:`chat-rail-grip project-output-grip`,onMouseDown:bi,onKeyDown:xi}),!Ti&&(0,Y.jsxs)(`div`,{className:`project-body-content`,children:[I===`about`&&(0,Y.jsxs)(`div`,{className:`project-about-page`,children:[(0,Y.jsx)(Lt,{project:m,gezels:Ht,boekwachterGezelId:Jt,recentlyAddedGezelId:x,onAddGezel:An,onCreateTemplateGezel:Mn,onRemoveGezel:jn}),(0,Y.jsx)(Jr,{projectId:m.id,resourceKey:`project:${m.id}:about`,id:`project-about-overview`,label:`About this project`,hint:`Flows into the system prompt when a chat is scoped to this project.`,initial:m.about??``,onSave:async e=>{let t=await A.updateProject(m.id,{about:e});return y(n=>n?.id===t.id?{...n,about:e}:n),t}},`${m.id}:about`),(0,Y.jsx)(Jr,{projectId:m.id,resourceKey:`project:${m.id}:mission`,id:`project-about-mission`,label:`Mission objectives`,hint:`A concrete list of what success looks like. Also flows into the system prompt.`,initial:m.missionObjectives??``,onSave:async e=>{let t=await A.updateProject(m.id,{missionObjectives:e});return y(n=>n?.id===t.id?{...n,missionObjectives:e}:n),t}},`${m.id}:mission`),(0,Y.jsx)(ht,{projectId:m.id,projectName:m.name},`${m.id}:memories`),r&&(0,Y.jsx)(`section`,{id:`project-about-connections`,className:`project-about-section project-about-anchor`,children:(0,Y.jsx)(Sr,{children:(0,Y.jsx)(sr,{project:m,onProjectChange:y})})}),(0,Y.jsxs)(`section`,{id:`project-about-settings`,className:`project-about-section project-about-anchor`,children:[(0,Y.jsx)(`h3`,{className:`project-about-section-title`,children:`Settings`}),(0,Y.jsxs)(`div`,{className:`project-config`,children:[(0,Y.jsxs)(`label`,{className:`config-label`,children:[`Working directory`,(0,Y.jsxs)(`div`,{className:`new-row`,children:[(0,Y.jsx)(`input`,{placeholder:`External path (leave blank for internal)`,value:Zt,onChange:e=>Qt(e.target.value),onBlur:()=>void er(Zt)}),window.__GEZEL__?.selectDirectory&&(0,Y.jsx)(`button`,{type:`button`,onClick:async()=>{let e=await window.__GEZEL__?.selectDirectory?.({title:`Choose working directory`,defaultPath:Zt||void 0});e&&(Qt(e),er(e))},title:`Browse for folder`,children:`Browse…`})]}),(0,Y.jsx)(`small`,{className:`muted`,children:m.workingDir?`External: ${m.workingDir}`:`Using internal workspace`})]}),(0,Y.jsxs)(`label`,{className:`config-label`,style:{marginTop:`0.75rem`},children:[`Allow built-in tools and background work to modify the workspace`,(0,Y.jsxs)(`div`,{className:`new-row`,style:{alignItems:`center`},children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:wn.managedWritable,onChange:e=>{let t=e.target.checked;t&&m.workingDir?en(!0):tr(t)}}),(0,Y.jsx)(`span`,{className:`muted small`,children:m.workingDir?`Off by default for external folders. Turn on only if you trust the crew’s tools and automations to edit this path.`:`Internal workspace — on by default. Provider-native access, when used, follows its own project posture.`})]})]}),(0,Y.jsxs)(`label`,{className:`config-label`,style:{marginTop:`0.75rem`},children:[`Index this project's workspace`,(0,Y.jsxs)(`div`,{className:`new-row`,style:{alignItems:`center`},children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:m.indexingEnabled!==!1,onChange:e=>void ir(e.target.checked)}),(0,Y.jsx)(`span`,{className:`muted small`,children:`Builds file search, commands, the Village map, and AI summaries. Turn it off for lightweight projects such as games or language practice.`})]})]}),(0,Y.jsxs)(`label`,{className:`config-label`,style:{marginTop:`0.75rem`},children:[`Fix problems overnight`,(0,Y.jsxs)(`div`,{className:`new-row`,style:{alignItems:`center`},children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:m.nightlyFixesEnabled!==!1,onChange:e=>void ar(e.target.checked)}),(0,Y.jsx)(`span`,{className:`muted small`,children:`When this project has both a Boekwachter and a developer, the developer works through open issues during the night shift. Your files aren’t touched — fixes arrive as change proposals in the Proposals tab for you to review and apply.`})]})]}),!ae(m)&&(0,Y.jsxs)(`fieldset`,{className:`project-tab-settings`,children:[(0,Y.jsx)(`legend`,{children:`Linked projects`}),(0,Y.jsxs)(`p`,{className:`muted small`,children:[`Give this project one-way access to another project’s indexed knowledge and workspace. The other project does not gain access back. Shared documents are always included automatically.`,` `,(m.linkedProjectIds??[]).length,` of 32 linked.`]}),(0,Y.jsxs)(`div`,{className:`project-tab-settings-grid`,children:[yn.map(e=>{let t=(m.linkedProjectIds??[]).includes(e.id);return(0,Y.jsxs)(`label`,{className:`new-row`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:t,disabled:un||!t&&bn,onChange:t=>void _r(e.id,t.target.checked)}),(0,Y.jsxs)(`span`,{children:[e.name,(0,Y.jsxs)(`span`,{className:`muted small`,children:[` — `,e.id]}),e.archived?(0,Y.jsx)(`span`,{className:`muted small`,children:` — archived`}):null,w(e)?null:(0,Y.jsxs)(`span`,{className:`muted small`,children:[` `,`— workspace read-only`]})]})]},e.id)}),yn.length===0?(0,Y.jsx)(`span`,{className:`muted small`,children:`No other projects are available.`}):null]}),(0,Y.jsxs)(`small`,{className:`muted`,children:[`Gezels address linked files with the existing file tools at`,` `,(0,Y.jsx)(`code`,{children:`../project-id/…`}),`. Writes still follow the linked project’s own workspace-write setting.`]})]}),(0,Y.jsx)(Rt,{project:m,onUpdated:y}),(0,Y.jsxs)(`div`,{className:`config-label`,style:{marginTop:`0.75rem`},children:[`Project properties`,(0,Y.jsx)(cn,{project:m,onProjectChange:y}),(0,Y.jsx)(`small`,{className:`muted`,children:`Shared values gezellen and recurring craftbooks draw from — set the designated language once and every translation run uses it.`})]}),(0,Y.jsxs)(`label`,{className:`config-label`,style:{marginTop:`0.75rem`},children:[`GitHub repository`,(0,Y.jsx)(`div`,{className:`new-row`,children:(0,Y.jsx)(`input`,{placeholder:`https://github.com/owner/repo`,value:rn,onChange:e=>an(e.target.value),onBlur:()=>void $n(rn)})}),(0,Y.jsxs)(`small`,{className:`muted`,children:[m.github?.url?m.github.checkoutDir?`Linked. Checkout: ${m.github.checkoutDir}${m.github.branch?` (${m.github.branch})`:``}`:`Linked. Use the GitHub tab to clone.`:`Optional. When set, gezels gain a GitHub-linked checkout and a new GitHub tab.`,on&&(0,Y.jsxs)(Y.Fragment,{children:[` `,`— `,(0,Y.jsx)(`span`,{className:`status`,children:on})]})]})]}),(0,Y.jsxs)(`label`,{className:`config-label`,style:{marginTop:`0.75rem`},children:[St(m),(0,Y.jsx)(`div`,{className:`new-row`,children:(0,Y.jsx)(yt,{gezels:Ht,value:m.voormanGezelId,noneLabel:`(no ${Ct(m)})`,ariaLabel:St(m),onValueChange:async e=>{let t=await A.updateProject(m.id,{voormanGezelId:e});y(t)}})}),(0,Y.jsx)(`small`,{className:`muted`,children:m.mode===`solo`?`The single gezel who handles this entire job — the Builder. Mentioned in the system prompt for any chat scoped here. Team-management tools are stripped from their thread.`:`The gezel who acts as voorman (foreman) of this project. Mentioned in the system prompt for any chat scoped here.`})]}),(0,Y.jsxs)(`div`,{className:`config-label`,style:{marginTop:`0.75rem`},children:[(0,Y.jsxs)(`label`,{className:`new-row`,style:{alignItems:`center`},children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:m.nudgeConfig?.enabled===!1,onChange:e=>void vr(e.target.checked)}),(0,Y.jsx)(`span`,{children:`Exclude from Meester progress check-ins`})]}),(0,Y.jsx)(`small`,{className:`muted`,children:`For long-running or ambient projects. The Meester won’t ask the project lead for overall progress; direct chats and the project’s own work continue.`})]}),(0,Y.jsxs)(`label`,{className:`config-label`,style:{marginTop:`0.75rem`},children:[`Project type`,(0,Y.jsx)(`div`,{className:`new-row`,children:(0,Y.jsxs)(f,{value:m.projectTypeId||`__AUTO__`,onValueChange:async e=>{let t=await A.updateProject(m.id,{projectTypeId:e===`__AUTO__`?null:e});y(t)},children:[(0,Y.jsx)(_,{children:(0,Y.jsx)(g,{})}),(0,Y.jsxs)(v,{children:[(0,Y.jsx)(h,{value:`__AUTO__`,children:(()=>{let e=ne(m.detectedProjectType?.id);return e?`Auto-detect (${e.label})`:`Auto-detect`})()}),ce().map(e=>(0,Y.jsx)(h,{value:e.id,children:e.label},e.id))]})]})}),(0,Y.jsx)(`small`,{className:`muted`,children:`Tunes which craftbooks the command rail suggests for this project. Auto-detect classifies the project from its files and About text.`})]}),(0,Y.jsxs)(`fieldset`,{className:`project-tab-settings`,children:[(0,Y.jsx)(`legend`,{children:`Project tabs`}),(0,Y.jsx)(`p`,{className:`muted small`,children:`Keep this project focused by hiding work areas it does not use.`}),(0,Y.jsx)(`div`,{className:`project-tab-settings-grid`,children:Cr.map(e=>(0,Y.jsxs)(`label`,{className:`new-row`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:wr(m,e.key),onChange:t=>void Or(e.key,t.target.checked)}),(0,Y.jsx)(`span`,{children:e.label})]},e.key))}),(0,Y.jsx)(`small`,{className:`muted`,children:`Chat and Settings always stay available. Output appears whenever the project has a previewable page.`})]}),m.id!=="default"&&!ae(m)&&(0,Y.jsxs)(`div`,{className:`project-archive-setting`,children:[(0,Y.jsxs)(`div`,{className:`project-archive-setting-copy`,children:[(0,Y.jsx)(`span`,{className:`project-archive-setting-title`,children:m.archived?`Restore project`:`Archive project`}),(0,Y.jsx)(`small`,{className:`muted`,children:m.archived?`Return this project to primary navigation. Its previous inactive status is preserved.`:`Hide this project from primary navigation and pause automatic project work. Its files and chats stay on disk.`})]}),(0,Y.jsx)(`button`,{type:`button`,className:`secondary project-archive-setting-action`,onClick:()=>void Di(),disabled:b,children:b?m.archived?`Restoring…`:`Archiving…`:m.archived?`Restore project`:`Archive project`})]}),hn.length>0&&(0,Y.jsxs)(`div`,{className:`project-credentials`,children:[(0,Y.jsx)(`h4`,{children:`Granted credentials`}),(0,Y.jsx)(`p`,{className:`muted small`,children:`Credentials are stored once for your whole workspace and shared across projects you grant them to. Scripts and MCP tools running in this project can resolve only the names checked below. They never see the raw values.`}),(0,Y.jsx)(`ul`,{className:`credentials-list`,children:hn.map(e=>{let t=(m.grantedCredentials??[]).includes(e.name),n=Rr(e);return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`label`,{className:`new-row`,style:{alignItems:`center`},children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!t&&(!e.stored||e.allowedOrigins.length===0),onChange:t=>void Kn(e.name,t.target.checked)}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`code`,{children:e.name}),(0,Y.jsxs)(`span`,{className:`muted small`,children:[` — `,e.label]}),n&&(0,Y.jsxs)(`span`,{className:`muted small`,children:[` `,`— `,n]})]})]})},e.name)})})]}),(0,Y.jsxs)(`div`,{className:`project-writes-log`,children:[(0,Y.jsx)(`h4`,{children:`Recent workspace changes`}),tn.length===0?(0,Y.jsxs)(`p`,{className:`muted small`,children:[`No workspace mutations recorded yet. Gezels that call`,` `,(0,Y.jsx)(`code`,{children:`write_file`}),`, `,(0,Y.jsx)(`code`,{children:`delete_path`}),`,`,` `,(0,Y.jsx)(`code`,{children:`make_dir`}),`, or `,(0,Y.jsx)(`code`,{children:`rename`}),` will show up here.`]}):(0,Y.jsx)(`ul`,{children:tn.map((e,t)=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`span`,{className:`writes-op writes-op-${e.op}`,children:e.op}),(0,Y.jsx)(`code`,{children:e.op===`rename`?`${e.fromPath} → ${e.path}`:e.path}),e.bytes!==void 0&&(0,Y.jsxs)(`span`,{className:`muted small`,children:[` `,`· `,Yr(e.bytes)]}),e.gezelId&&(0,Y.jsxs)(`span`,{className:`muted small`,children:[` · by `,e.gezelId]}),(0,Y.jsxs)(`span`,{className:`muted small`,title:xe(e.at),children:[` `,`· `,be(e.at)]})]},`${e.at}:${t}`))})]})]})]}),(0,Y.jsxs)(`section`,{id:`project-about-toolsets`,className:`project-about-section project-about-anchor`,children:[(0,Y.jsx)(`h3`,{className:`project-about-section-title`,children:`Toolsets`}),(0,Y.jsx)(ct,{scope:{kind:`project`,projectId:m.id},subject:m.name,hint:`Available to every gezel working in this project. Project MCP files are discovered automatically.`})]}),(0,Y.jsxs)(`section`,{id:`project-about-history`,className:`project-about-section project-about-anchor`,children:[(0,Y.jsx)(`h3`,{className:`project-about-section-title`,children:`History`}),(0,Y.jsx)(`div`,{className:`project-about-history`,children:(0,Y.jsx)(Sr,{children:(0,Y.jsx)(dr,{projectId:m.id})})})]}),(0,Y.jsxs)(`nav`,{className:`project-about-toc`,"aria-label":`About sections`,children:[(0,Y.jsx)(`div`,{className:`project-about-toc-title`,children:`On this page`}),(0,Y.jsx)(`a`,{href:`#project-about-crew`,children:`Assigned gezellen`}),(0,Y.jsx)(`a`,{href:`#project-about-overview`,children:`About this project`}),(0,Y.jsx)(`a`,{href:`#project-about-mission`,children:`Mission objectives`}),(0,Y.jsx)(`a`,{href:`#project-about-memories`,children:`Project memories`}),r&&(0,Y.jsx)(`a`,{href:`#project-about-connections`,children:`Connections`}),(0,Y.jsx)(`a`,{href:`#project-about-settings`,children:`Settings`}),(0,Y.jsx)(`a`,{href:`#project-about-toolsets`,children:`Toolsets`}),(0,Y.jsx)(`a`,{href:`#project-about-history`,children:`History`})]})]}),(0,Y.jsx)(M,{open:$t,title:`Enable workspace writes?`,message:m.workingDir?(0,Y.jsxs)(Y.Fragment,{children:[`Gezels will be able to create, modify, and delete files inside`,` `,(0,Y.jsx)(`code`,{children:m.workingDir}),`. Every change is logged in the Settings section. You can turn this back off at any time.`]}):null,confirmLabel:`Enable`,danger:!0,onConfirm:async()=>{await tr(!0),en(!1)},onCancel:()=>en(!1)}),I===`packages`&&(0,Y.jsxs)(`div`,{className:`project-config`,children:[(0,Y.jsx)(`p`,{className:`muted small`,style:{marginTop:0},children:`Each gezel asks the runtime before installing a package or running a script. Decisions persist per project — once approved, future calls run automatically.`}),(0,Y.jsx)(`h4`,{className:`project-section-heading`,children:`Approved npm packages`}),(0,Y.jsxs)(`ul`,{children:[P?.npmApproved.map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`strong`,{children:e.package}),` `,(0,Y.jsx)(`code`,{children:e.version}),` `,(0,Y.jsxs)(`span`,{className:`muted small`,children:[`(`,e.approvedBy===`shipped`?`shipped allowlist`:`approved by you`,`)`]})]},`${e.package}@${e.version}`)),(!P||P.npmApproved.length===0)&&(0,Y.jsx)(`li`,{className:`muted`,children:`No project-specific npm approvals yet.`})]}),P&&P.npmDeclined.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h4`,{className:`project-section-heading`,children:`Declined npm packages`}),(0,Y.jsx)(`ul`,{children:P.npmDeclined.map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`strong`,{children:e.package}),` `,(0,Y.jsx)(`code`,{children:e.version})]},`${e.package}@${e.version}`))})]}),(0,Y.jsx)(`h4`,{className:`project-section-heading`,children:`Approved scripts (run via package.json)`}),(0,Y.jsxs)(`ul`,{children:[P&&Object.entries(P.scriptApprovals).map(([e,t])=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`strong`,{children:e}),` `,(0,Y.jsxs)(`span`,{className:`muted small${t===`declined`?` error`:``}`,children:[`(`,t,`)`]})]},`script-${e}`)),(!P||Object.keys(P.scriptApprovals).length===0)&&(0,Y.jsx)(`li`,{className:`muted`,children:`No script approvals on file yet.`})]}),P&&Object.keys(P.npxApprovals).length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h4`,{className:`project-section-heading`,children:`Approved npx binaries`}),(0,Y.jsx)(`ul`,{children:Object.entries(P.npxApprovals).map(([e,t])=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`strong`,{children:e}),` `,(0,Y.jsxs)(`span`,{className:`muted small${t===`declined`?` error`:``}`,children:[`(`,t,`)`]})]},`npx-${e}`))})]}),(0,Y.jsx)(`h4`,{className:`project-section-heading`,children:`Install a package`}),(0,Y.jsxs)(`div`,{className:`new-row`,children:[(0,Y.jsx)(`input`,{placeholder:`npm package name`,value:E,onChange:e=>D(e.target.value)}),(0,Y.jsx)(`button`,{type:`button`,onClick:Qn,children:`Install`})]}),(0,Y.jsxs)(`ul`,{children:[m.packages.map(e=>(0,Y.jsxs)(`li`,{children:[e.name,` `,(0,Y.jsx)(`code`,{children:e.version})]},e.name)),m.packages.length===0&&(0,Y.jsx)(`li`,{className:`muted`,children:`No packages installed in this project's workspace.`})]}),(0,Y.jsxs)(`h4`,{className:`project-section-heading`,children:[`Available scripts (from `,(0,Y.jsx)(`code`,{children:`package.json`}),`)`]}),(0,Y.jsxs)(`p`,{className:`muted small`,style:{marginTop:`-0.25rem`},children:[`Listed scripts are eligible for first-use approval when a gezel calls`,` `,(0,Y.jsx)(`code`,{children:`run_package_script`}),`.`]}),(0,Y.jsxs)(`ul`,{children:[Object.entries(k).map(([e,t])=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsx)(`strong`,{children:e}),`: `,(0,Y.jsx)(`code`,{children:t})]},e)),Object.keys(k).length===0&&(0,Y.jsx)(`li`,{className:`muted`,children:`no scripts defined in package.json`})]}),ie&&(0,Y.jsx)(`pre`,{className:`log`,children:ie})]}),z!==null&&(0,Y.jsx)(U,{source:ri,layoutClassName:`project-files-layout-${z}`,entries:Xr,truncated:(z===`workspace`?Ne:H)&&!ti,viewMode:$,modes:z===`workspace`?ue:me,onViewModeChange:e=>Rn(z,e),showHidden:Kr,onShowHiddenChange:e=>zn(z,e),selectedPath:W?.path,onSelect:e=>void Pr(e,z),emptyMessage:z===`workspace`?m.workingDir?`Workspace directory is empty.`:`No external working directory set. Use the internal workspace or set an external path under the Settings tab.`:`No artifacts yet. Your gezellen will store reports and outputs here.`,mutations:ai,customList:ni,trailingForEntry:z===`workspace`?e=>{let t=br(e,q);return t>0?(0,Y.jsx)(`span`,{className:`workspace-tree-issue-count`,title:`${t} Boekwachter issue${t===1?``:`s`} ${e.isDirectory?`in this folder`:`in this file`}`,"aria-label":`${t} indexing issue${t===1?``:`s`}`,children:t}):null}:void 0,actionsForEntry:e=>e.isDirectory||!at(e.path)||W?.path===e.path&&W.source===z&&W.outsideIn?.editingEnabled?[]:[{label:`Allow editing via markdown`,disabled:!Q(z),onSelect:()=>Lr(e,z)}],headerExtra:z===`workspace`?(0,Y.jsxs)(`div`,{className:`workspace-tree-index-summary`,"aria-live":`polite`,title:bt??(q?`${q.reviewedFiles} of ${q.eligibleFiles} eligible files reviewed`:ut(K)),children:[(0,Y.jsxs)(`span`,{className:`workspace-index-state workspace-index-state-${pt(K)}`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`}),bt?`Index unavailable`:ut(K)]}),q&&q.counts.total>0&&(0,Y.jsxs)(`span`,{className:`workspace-tree-issue-total`,children:[q.counts.total,` issue`,q.counts.total===1?``:`s`]})]}):void 0,notices:z===`workspace`?(0,Y.jsxs)(Y.Fragment,{children:[$===`flat-modified`&&K&&K.state!==`fresh`&&(0,Y.jsxs)(`div`,{className:`file-flat-notice`,children:[(0,Y.jsx)(`span`,{children:K.state===`indexing`?`Indexing…`:K.state===`stale`?`Index is out of date.`:K.state===`never`?`Not indexed yet — showing files from the folder walk.`:`Indexing is disabled — showing files from the folder walk.`}),(K.state===`stale`||K.state===`never`)&&(0,Y.jsx)(`button`,{type:`button`,className:`file-flat-notice-action`,onClick:()=>void A.refreshProjectIndex(m.id).then(e=>_t(e.status)).catch(()=>{}),children:`Index now`})]}),($===`flat-issues`||$===`flat-criticality`)&&(0,Y.jsxs)(`div`,{className:`file-flat-notice`,children:[(0,Y.jsx)(`span`,{children:q?`${q.reviewedFiles} of ${q.eligibleFiles} eligible files reviewed${q.truncated?` — showing the first 1000 issues`:``}`:`Loading review coverage…`}),(K?.state===`stale`||K?.state===`never`)&&(0,Y.jsx)(`button`,{type:`button`,className:`file-flat-notice-action`,onClick:()=>void A.refreshProjectIndex(m.id).then(e=>_t(e.status)).catch(()=>{}),children:`Index now`})]})]}):void 0,extraPane:z===`workspace`&&At?(0,Y.jsx)(mt,{path:Z,status:K,issues:q,review:wt,loading:Et,error:Ot,onClose:()=>jt(!1),onSelectLine:e=>{Z&&Ft(t=>({path:Z,line:e,requestId:(t?.requestId??0)+1}))},onFixIssue:e=>{Z&&Nt({path:Z,issue:e})},onUpdateIssue:Gn,onOpenTask:e=>Te({kind:`task`,ref:e})}):void 0,viewer:W?W.outsideIn?(0,Y.jsx)(Hr,{projectId:m.id,file:W,outsideIn:W.outsideIn,isReadOnly:oi,editorTheme:u,onChange:zr,onSave:Br,toolbarIndexToggle:li},`${W.source}:${W.path}`):Ve.has(W.content)?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(We,{content:W.content,path:W.path,fetchBlob:ri.fetchBlob,...W.size===void 0?{}:{sizeBytes:W.size}}),W.content===`__IMAGE__`&&W.source===`workspace`&&(0,Y.jsx)(ft,{projectId:m.id,path:W.path,fetchBlob:ri.fetchBlob,onOpen:e=>void Xn(m.id,e,`workspace`)},W.path)]}):gr(W.path)?(0,Y.jsx)(Wr,{projectId:m.id,file:W,isReadOnly:oi,editorTheme:u,onEditorChange:zr,onSave:Br,onComplainAboutPreviewError:qn,toolbarIndexToggle:li,sourceReveal:ci}):(0,Y.jsx)(Ur,{projectId:m.id,file:W,isReadOnly:oi,editorTheme:u,onChange:zr,onSave:Br,toolbarIndexToggle:li},`${W.source}:${W.path}`):(0,Y.jsx)(`p`,{className:`placeholder`,style:{padding:`2rem`},children:`Select a file from the tree to view or edit it.`})}),I===`chat`&&(0,Y.jsx)(Sr,{children:(0,Y.jsx)(or,{project:m,compact:l},m.id)}),I===`tasks`&&(0,Y.jsx)(Sr,{children:(0,Y.jsx)(mr,{projectId:m.id})}),I===`proposals`&&(0,Y.jsx)(Sr,{children:(0,Y.jsx)(lr,{projectId:m.id})}),I===`github`&&m.github?.url&&(0,Y.jsx)(Sr,{children:(0,Y.jsx)(fr,{project:m,onProjectChange:y})}),r&&I===`mail`&&(0,Y.jsx)(Sr,{children:(0,Y.jsx)(cr,{project:m,onProjectChange:y})}),I===`map`&&(0,Y.jsx)(Sr,{children:(0,Y.jsx)(ur,{projectId:m.id})}),I===`overview`&&(0,Y.jsx)(Sr,{children:(0,Y.jsx)(pr,{projectId:m.id,project:m})})]})]}),(0,Y.jsx)(gt,{projectId:m.id,compact:l,managedWorkspaceWritable:wn.managedWritable,onManagedWorkspaceWritesChange:e=>{e&&m.workingDir?en(!0):tr(e)},codexMode:wn.codexInUse?kn:void 0,onCodexModeChange:wn.codexInUse?nr:void 0,claudeMode:wn.claudeInUse?wn.claudeMode:void 0,onClaudeModeChange:wn.claudeInUse?rr:void 0,onOpenGitHub:m.github?.url?()=>L(`github`):void 0,onAddBoekwachter:Jt?()=>An(Jt):void 0,status:m.status??`active`,statusLocked:m.archived===!0,onStatusChange:async e=>{let t=await A.updateProject(m.id,{status:e});y(t)}})]}):(0,Y.jsx)(sn,{})})]})}function Vr({request:e}){let{activeView:t,setActiveView:n,monacoEditor:r}=P();return(0,J.useEffect)(()=>{if(!e)return;if(t!==`raw`){n(`raw`);return}if(!r)return;let i=r.getModel();if(!i)return;let a=Math.max(1,Math.min(e.line,i.getLineCount()));r.setSelection({startLineNumber:a,startColumn:1,endLineNumber:a,endColumn:i.getLineMaxColumn(a)}),r.revealLineInCenter(a),r.focus()},[t,r,e,n]),null}function Hr({projectId:e,file:t,outsideIn:n,isReadOnly:r,editorTheme:i,onChange:a,onSave:o,toolbarIndexToggle:s}){let{layout:c,sourcePath:l}=n,u=H({resourceKey:`outside-in:${e}:${t.source}:${l}`,initialValue:_t(t.content),save:async e=>{await o(e)}}),d=(0,J.useCallback)(e=>{a(e),u.update(e)},[u.update,a]),f=(0,J.useMemo)(()=>pn({projectId:e,root:c.companionDirectory,client:A,primaryDocumentFilename:yr(l),source:t.source}),[t.source,c.companionDirectory,e,l]),p=(0,J.useMemo)(()=>t.source===`artifacts`?He({client:A,currentDocumentPath:l,source:`project-artifacts`,projectId:e}):void 0,[t.source,e,l]);return(0,Y.jsx)(`div`,{className:`editor-wrap`,style:{height:`100%`},children:(0,Y.jsx)(F,{initialMarkdown:u.desiredValue(),fileName:t.path,readOnly:r,onChange:r?void 0:d,height:`100%`,colorScheme:i,fullWidth:!0,workspaceContainer:f,documentLinkProvider:p,allowVersioning:!r,versionBasename:yr(l),outline:!0,toolbarSlotAfterActions:(0,Y.jsxs)(Y.Fragment,{children:[!r&&(0,Y.jsx)(K,{context:`generic`}),(0,Y.jsx)(Be,{fileName:t.path,projectId:e})]}),toolbarSlotRight:(0,Y.jsxs)(Y.Fragment,{children:[s,!r&&(0,Y.jsx)(G,{autosave:u}),!r&&(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>void u.flush(),style:{marginLeft:`0.5rem`},children:[`Save `,c.format.toUpperCase()]}),t.source===`artifacts`&&(0,Y.jsx)(Le,{selectedFile:t.path,mediaContainer:f,mediaSource:{kind:`project-artifacts`,projectId:e}})]})})})}function Ur({projectId:e,file:t,isReadOnly:n,editorTheme:r,onChange:i,onSave:a,toolbarIndexToggle:o}){let s=_r(t.path)&&t.source===`artifacts`,c=(0,J.useMemo)(()=>vr(t.path),[t.path]),l=(0,J.useMemo)(()=>yr(t.path),[t.path]),u=H({resourceKey:`file:${t.source}:${t.path}`,initialValue:s?_t(t.content):t.content,save:async e=>{await a(e)}}),d=(0,J.useCallback)(e=>{i(e),u.update(e)},[u.update,i]),f=(0,J.useMemo)(()=>s?mn({projectId:e,root:c,client:A,primaryDocumentFilename:l}):null,[s,e,c,l]),p=(0,J.useMemo)(()=>s?He({client:A,currentDocumentPath:t.path,source:`project-artifacts`,projectId:e}):null,[s,e,t.path]),m=(0,J.useMemo)(()=>s?Je({projectId:e,reportPath:t.path}):void 0,[s,e,t.path]);return(0,Y.jsx)(`div`,{className:`editor-wrap`,style:{height:`100%`},children:(0,Y.jsx)(F,{initialMarkdown:u.desiredValue(),fileName:t.path,readOnly:n,onChange:n?void 0:d,height:`100%`,colorScheme:r,fullWidth:!0,showPlayTab:s,workspaceContainer:f,documentLinkProvider:p,fenceRenderers:m,allowVersioning:s&&!n,versionBasename:l,outline:s,toolbarSlotAfterActions:s?(0,Y.jsxs)(Y.Fragment,{children:[!n&&(0,Y.jsx)(K,{context:`generic`}),(0,Y.jsx)(Be,{fileName:t.path,projectId:e})]}):void 0,toolbarSlotRight:(0,Y.jsxs)(Y.Fragment,{children:[o,s&&f&&(0,Y.jsx)(Le,{selectedFile:t.path,mediaContainer:f,mediaSource:{kind:`project-artifacts`,projectId:e}})]}),statusBarSlotRight:n?void 0:(0,Y.jsx)(G,{autosave:u})})})}function Wr({projectId:e,file:t,isReadOnly:n,editorTheme:r,onEditorChange:s,onSave:c,onComplainAboutPreviewError:l,toolbarIndexToggle:u,sourceReveal:d}){let[f,p]=(0,J.useState)(`preview`),[m,h]=(0,J.useState)(0),[g,_]=(0,J.useState)([]),[v,y]=(0,J.useState)(!1),[ee,b]=(0,J.useState)(void 0),[te,x]=(0,J.useState)(null);(0,J.useEffect)(()=>{d?.path===t.path&&p(`source`)},[t.path,d]);let S=H({resourceKey:`file:${t.source}:${t.path}`,initialValue:t.content,save:async e=>{await c(e)}}),C=(0,J.useCallback)(e=>{s(e),S.update(e)},[s,S.update]),w=(0,J.useCallback)(async e=>{if(l){b(e.at);try{await l(e,{path:t.path,source:t.source})}finally{b(void 0)}}},[l,t.path,t.source]),T=(0,J.useCallback)(e=>{_(t=>[e,...t].slice(0,50)),y(!1)},[]),ne=(0,J.useCallback)(()=>{h(e=>e+1),_([])},[]),E=(0,J.useCallback)(()=>{te&&window.open(te,`_blank`,`noopener,noreferrer`)},[te]);return(0,Y.jsxs)(`div`,{className:`html-file-viewer`,children:[(0,Y.jsx)(o,{value:f,onValueChange:e=>p(e),children:(0,Y.jsxs)(`div`,{className:`html-file-viewer-bar`,children:[(0,Y.jsxs)(a,{children:[(0,Y.jsx)(i,{value:`preview`,children:`Preview`}),(0,Y.jsx)(i,{value:`source`,children:`Source`})]}),f===`preview`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`button`,{type:`button`,onClick:ne,className:`html-file-viewer-refresh`,title:`Reload the preview`,children:`Refresh`}),(0,Y.jsx)(`button`,{type:`button`,onClick:E,disabled:!te,className:`html-file-viewer-refresh`,title:`Open this page in your default system browser`,children:`Open in browser`})]})]})}),f===`preview`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ye,{projectId:e,path:t.path,source:t.source,title:t.path,className:`html-file-viewer-iframe`,refreshKey:m,onLog:T,onUrlReady:x}),g.length>0&&(0,Y.jsx)(Gr,{logs:g,collapsed:v,onToggleCollapsed:()=>y(e=>!e),onClear:()=>_([]),...l?{onComplain:w}:{},...ee===void 0?{}:{complainBusyAt:ee}})]}):(0,Y.jsx)(`div`,{className:`editor-wrap`,children:(0,Y.jsx)(F,{initialMarkdown:S.desiredValue(),fileName:t.path,onChange:n?void 0:C,height:`100%`,colorScheme:r,showPlayTab:!1,fullWidth:!0,toolbarSlotRight:u,statusBarSlotRight:n?void 0:(0,Y.jsx)(G,{autosave:S})},`${t.source}:${t.path}`)})]})}function Gr({logs:e,collapsed:t,onToggleCollapsed:n,onClear:r,onComplain:i,complainBusyAt:a}){return(0,Y.jsxs)(`div`,{className:`html-preview-log`,children:[(0,Y.jsxs)(`div`,{className:`html-preview-log-bar`,children:[(0,Y.jsxs)(`strong`,{children:[e.length,` preview error`,e.length===1?``:`s`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`html-preview-log-toggle`,title:t?`Show errors`:`Hide errors`,children:t?`Show`:`Hide`}),(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:`html-preview-log-toggle`,title:`Clear error log`,children:`Clear`})]}),!t&&(0,Y.jsx)(`ul`,{className:`html-preview-log-entries`,children:e.map((e,t)=>(0,Y.jsxs)(`li`,{className:`html-preview-log-${e.kind}`,children:[(0,Y.jsx)(`span`,{className:`html-preview-log-kind`,children:e.kind}),(0,Y.jsx)(`span`,{className:`html-preview-log-message`,children:Kr(e)}),(e.detail.filename||e.detail.lineno)&&(0,Y.jsxs)(`span`,{className:`html-preview-log-loc muted small`,children:[e.detail.filename?e.detail.filename.split(`/`).pop():``,e.detail.lineno?`:${e.detail.lineno}`:``,e.detail.colno?`:${e.detail.colno}`:``]}),e.detail.stack&&(0,Y.jsx)(`pre`,{className:`html-preview-log-stack`,children:e.detail.stack}),i&&(0,Y.jsx)(`button`,{type:`button`,className:`html-preview-log-complain`,disabled:a===e.at,onClick:()=>void i(e),title:`Send this error to the project chat as a new message`,children:a===e.at?`Sending…`:`Complain about this`})]},`${e.at}-${t}`))})]})}function Kr(e){return e.kind===`console.error`?(e.detail.args??[]).join(` `):e.detail.message??`(unknown error)`}function qr(e,t){let n=[];n.push(`I was previewing \`${t.source}/${t.path}\` and the browser surfaced a JavaScript error.`),n.push(``),n.push(`- **Kind:** ${e.kind}`);let r=Kr(e);if(r&&n.push(`- **Message:** ${r}`),e.detail.filename){let t=[e.detail.filename,e.detail.lineno?String(e.detail.lineno):null,e.detail.colno?String(e.detail.colno):null].filter(Boolean).join(`:`);n.push(`- **Location:** ${t}`)}return e.url&&n.push(`- **Preview URL:** ${e.url}`),e.detail.stack&&(n.push(``),n.push(`Stack trace:`),n.push("```"),n.push(e.detail.stack),n.push("```")),n.push(``),n.push(`Can you take a look and figure out what's going wrong? Feel free to edit the file directly.`),n.join(`
7
- `)}function Jr({projectId:e,resourceKey:t,id:n,label:r,hint:i,initial:a,onSave:o}){let s=je(),c=H({resourceKey:t,initialValue:(0,J.useMemo)(()=>_t(a),[a]),save:o}),l=(0,J.useCallback)(e=>{c.update(e)},[c.update]);return(0,Y.jsxs)(`section`,{id:n,className:`project-doc-editor project-about-anchor`,children:[(0,Y.jsx)(`h3`,{className:`project-doc-editor-title`,children:r}),(0,Y.jsx)(`p`,{className:`muted small`,style:{marginTop:0,marginBottom:`0.4rem`},children:i}),(0,Y.jsx)(`div`,{className:`editor-wrap`,children:(0,Y.jsx)(F,{initialMarkdown:c.desiredValue(),onChange:l,height:`240px`,colorScheme:s,showPlayTab:!1,fullWidth:!0,toolbarSlotAfterActions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(K,{context:`generic`}),(0,Y.jsx)(Be,{fileName:`${r}.md`,projectId:e})]}),statusBarSlotRight:(0,Y.jsx)(G,{autosave:c})})})]})}function Yr(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}export{Xn as n,zr as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-setup-UeltVkg_.js","assets/dist-BPx-FyRH.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-DeTXJU-n.js","assets/preload-helper-Czpn1I53.js","assets/chunk-V4NBQF5C-D9I4DV9v.js","assets/iconLabel-uMn49Ame.js","assets/iconLabel-Bdh_-Hrb.css","assets/codiconStyles-104B1IQ5.js","assets/codiconStyles-Bp1tMeMk.css","assets/editor.api-DShZZcgD.js","assets/editor-BOOlEWca.css","assets/monaco-Cvm179Eb.css","assets/monaco-base-BiVSa1J-.js","assets/index-DXWR4qW1.js","assets/jsx-runtime-CEpd2cAX.js","assets/react-dom-OL4w_gzs.js","assets/primitives-DEsn1shf.js","assets/Tabs-BAY1Q79B.js","assets/dist-Bvo52IGx.js","assets/dist-D5aoNQwk.js","assets/api-BX5xXiFs.js","assets/NewPathDialog-D4jnNBfP.js","assets/DropdownMenu-D5fCzIrh.js","assets/relative-time-B2kBaekd.js","assets/FileTypeIcon-Cwzl1GkZ.js","assets/model-memory-copy-CeuXAj-T.js","assets/model-context-DBqdK0PS.js","assets/StorageCleanupDialog-DHqwyMZZ.js","assets/poppetje-Ce-02Aqi.js","assets/safe-svg-image-NbuPaBIv.js","assets/ConfirmDialog-BHFs6vmJ.js","assets/doc-s6H7T0IO.js","assets/chunk-O7JILDEF-CqcO1qaI.js","assets/chunk-BAOV476U-CEOFYt8X.js","assets/chunk-4VOD55SX-BFSSw0c8.js","assets/chunk-GAZKTT4R-BkP6-w3z.js","assets/chunk-MIKKUKOD-XIkmalSN.js","assets/chunk-XRW6P7IF-BeQQgMVK.js","assets/chunk-7ZAAICW4-BsCpYJH6.js","assets/markdown-Bi9b5f5Y.js","assets/schemas-JY4jmLbC.js","assets/chunk-6ECMNUIP-C1kohb1U.js","assets/inlineIconMarker-BQI2HLeD.js","assets/chunk-TT6ENR6T-CaYjVwjm.js","assets/chunk-DAMIRKTO-CGniCSiM.js","assets/new-project-meta-0xhggGA_.js","assets/chunk-AE3IUKMM-mZjzzO8Z.js","assets/index-D1m4Wx8V.css"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{i as r,n as i,r as a,t as o}from"./Tabs-BAY1Q79B.js";import{G as s,_t as c,kt as l,ln as u,sn as d,un as f,xt as p}from"./dist-BPx-FyRH.js";import{t as m}from"./preload-helper-Czpn1I53.js";import{t as h}from"./GezelJsonEditor-fOvYclu9.js";import{ft as g}from"./index-DXWR4qW1.js";var _=e(t(),1),v=n();function y(e){e.trigger(`gezel-preamble`,`editor.fold`,{selectionLines:[1]})}var b=(0,_.forwardRef)(function({projectId:e,scriptName:t,initialSource:n,collapsePreambleOnMount:r,readOnly:i,onChangeContent:a,onSave:o,onProblems:s,onReady:c},l){let u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(null),[h,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),C=g(),w=(0,_.useRef)(a),T=(0,_.useRef)(o),E=(0,_.useRef)(s),D=(0,_.useRef)(c);(0,_.useEffect)(()=>{w.current=a,T.current=o,E.current=s,D.current=c},[a,o,s,c]);let O=(0,_.useRef)(n),k=(0,_.useRef)(r??!1),A=(0,_.useRef)(C);return A.current=C,(0,_.useEffect)(()=>{let n=!1,r=[];return(async()=>{let a;try{a=await m(()=>import(`./monaco-setup-UeltVkg_.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48]));let{api:e}=await m(async()=>{let{api:e}=await import(`./api-BX5xXiFs.js`).then(e=>e.n);return{api:e}},__vite__mapDeps([21,2,20,1]));await a.ensureScriptTypescript(()=>e.getSdkTypes())}catch(e){n||S(e.message);return}if(n||!u.current)return;let o=a.monaco;d.current=o;let s=a.scriptModelUri(e,t);o.editor.getModel(s)?.dispose();let c=o.editor.createModel(O.current,`typescript`,s);p.current=c;let l=o.editor.create(u.current,{model:c,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,tabSize:2,fixedOverflowWidgets:!0,readOnly:i??!1});f.current=l,o.editor.setTheme(A.current===`dark`?`gezel-dark`:`gezel-light`),k.current&&y(l),r.push(c.onDidChangeContent(()=>w.current?.(c.getValue()))),l.addCommand(o.KeyMod.CtrlCmd|o.KeyCode.KeyS,()=>T.current?.()),r.push(o.editor.onDidChangeMarkers(e=>{if(!e.some(e=>e.toString()===s.toString()))return;let t=o.editor.getModelMarkers({resource:s});E.current?.(t.map(e=>({severity:e.severity===o.MarkerSeverity.Error?`error`:e.severity===o.MarkerSeverity.Warning?`warning`:`info`,message:e.message,line:e.startLineNumber,column:e.startColumn})))})),b(!0),D.current?.()})(),()=>{n=!0;for(let e of r)e.dispose();f.current?.dispose(),f.current=null,p.current?.dispose(),p.current=null}},[e,t,i]),(0,_.useEffect)(()=>{d.current?.editor.setTheme(C===`dark`?`gezel-dark`:`gezel-light`)},[C]),(0,_.useImperativeHandle)(l,()=>({getValue:()=>p.current?.getValue()??null,setValue:e=>p.current?.setValue(e),revealLine:e=>{f.current?.revealLineInCenter(e),f.current?.setPosition({lineNumber:e,column:1}),f.current?.focus()},focus:()=>f.current?.focus(),collapsePreamble:()=>{f.current&&y(f.current)},setServerDiagnostics:e=>{let t=d.current,n=p.current;!t||!n||t.editor.setModelMarkers(n,`gezel-save`,e.map(e=>({severity:e.severity===`error`?t.MarkerSeverity.Error:e.severity===`warning`?t.MarkerSeverity.Warning:t.MarkerSeverity.Info,message:e.message,startLineNumber:e.line??1,startColumn:e.column??1,endLineNumber:e.line??1,endColumn:e.column?e.column+1:1})))}}),[]),(0,v.jsxs)(`div`,{className:`script-code-editor`,children:[!h&&!x&&(0,v.jsx)(`p`,{className:`muted small`,children:`Loading editor…`}),x&&(0,v.jsxs)(`p`,{className:`script-code-editor__error`,children:[`Editor failed to load: `,x]}),(0,v.jsx)(`div`,{ref:u,className:`script-code-editor__host`})]})});function x({value:e,onChange:t,readOnly:n,issues:r}){return(0,v.jsxs)(`div`,{className:`script-meta-form`,children:[(0,v.jsx)(h,{schema:(0,_.useMemo)(()=>O(),[]),value:e,onChange:n?void 0:e=>t(e??{}),density:`compact`}),r&&r.length>0&&(0,v.jsx)(`ul`,{className:`script-meta-form__issues small`,children:r.map((e,t)=>(0,v.jsx)(`li`,{className:`error`,children:e},`${t}:${e}`))})]})}var S={type:`string`,title:`Name`,pattern:`^[a-zA-Z][\\w-]*$`,squisq:{width:`half`,help:`Becomes a key on the input/output object.`}},C={type:`string`,title:`Description`,squisq:{control:`multiline`,help:`What it is, for teammates and the test-run form.`}},w={type:`boolean`,title:`Required`},T={type:`string`,squisq:{control:`multiline`,help:`JSON (parsed on save).`}};function E(e,t,n){return{type:`object`,title:t,required:[`name`,`type`,`description`],properties:{name:S,type:{type:`string`,const:e,title:`Type`,squisq:{width:`half`}},description:C,required:w,...n}}}function D(e,t,n){return{type:`object`,title:t,required:[`name`,`type`,`description`],properties:{name:S,type:{type:`string`,const:e,title:`Type`,squisq:{width:`half`}},description:C,...n}}}function O(){return{type:`object`,required:[`name`,`description`],properties:{name:{type:`string`,title:`Script name`,pattern:`^[a-zA-Z][\\w-]*$`,squisq:{width:`half`,help:`Letters, digits, _ or -; must start with a letter.`}},description:{type:`string`,title:`Description`,minLength:10,squisq:{control:`multiline`,help:`At least 10 characters.`}},kind:{type:`string`,title:`Kind`,enum:[`action`,`gate`],default:`action`,squisq:{control:`segmented`,width:`half`,enumLabels:{action:`Action`,gate:`Gate`},help:`Gate scripts return a decision for a step gate.`}},inputs:{type:`array`,title:`Inputs`,squisq:{control:`card-stack`,addLabel:`Add input`,itemLabel:{fromField:`name`}},items:{type:`object`,required:[`name`,`type`,`description`],oneOf:[E(`string`,`Text`,{default:{type:`string`,title:`Default`},pattern:{type:`string`,title:`Pattern (regex)`},multiline:{type:`boolean`,title:`Multiline`}}),E(`number`,`Number`,{default:{type:`number`,title:`Default`},min:{type:`number`,title:`Min`,squisq:{width:`third`}},max:{type:`number`,title:`Max`,squisq:{width:`third`}},integer:{type:`boolean`,title:`Integer only`,squisq:{width:`third`}}}),E(`boolean`,`Boolean`,{default:{type:`boolean`,title:`Default`}}),E(`choice`,`Choice`,{default:{type:`string`,title:`Default`},options:{type:`array`,title:`Options`,minItems:1,squisq:{control:`card-stack`,addLabel:`Add option`,itemLabel:{fromField:`value`}},items:{type:`object`,required:[`value`],properties:{value:{type:`string`,title:`Value`,squisq:{width:`half`}},label:{type:`string`,title:`Label`,squisq:{width:`half`}}}}}}),E(`ref`,`Reference`,{kind:{type:`string`,title:`Refers to`,enum:[`gezel`,`task`,`artifact`,`document`],squisq:{control:`segmented`}}}),E(`json`,`JSON`,{defaultJson:{...T,title:`Default (JSON)`},schemaJson:{...T,title:`Schema (JSON)`}})]}},outputs:{type:`array`,title:`Outputs`,squisq:{control:`card-stack`,addLabel:`Add output`,itemLabel:{fromField:`name`}},items:{type:`object`,required:[`name`,`type`,`description`],oneOf:[D(`string`,`Text`,{nullable:{type:`boolean`,title:`Nullable`}}),D(`number`,`Number`,{nullable:{type:`boolean`,title:`Nullable`}}),D(`boolean`,`Boolean`,{nullable:{type:`boolean`,title:`Nullable`}}),D(`array`,`Array`,{itemType:{type:`string`,title:`Item type`,enum:[`string`,`number`,`boolean`,`object`],squisq:{control:`segmented`}}}),D(`object`,`Object`,{schemaJson:{...T,title:`Schema (JSON)`}}),D(`json`,`JSON`,{schemaJson:{...T,title:`Schema (JSON)`}})]}},requires:{type:`array`,title:`Allowed to (capabilities)`,squisq:{control:`chip-bin`,addLabel:`Add capability`,help:`e.g. network, llm, tasks.write, credential:github.token`},items:{type:`string`}}}}}var k=(0,_.forwardRef)(function({projectId:e,scriptName:t,initialSource:n,initialMeta:m,readOnly:h,onChangeContent:g,onSave:y,onProblems:S,onReady:C},w){let T=(0,_.useRef)(null),E=(0,_.useRef)(n),D=(0,_.useRef)(u(n)),O=(0,_.useRef)(!1),k=(0,_.useRef)(!1),A=(0,_.useRef)(0),[j,M]=(0,_.useState)(`script`),N=(0,_.useMemo)(()=>{if(m)return{value:p(m),ok:!0};let e=l(D.current.metaText);return e.ok?{value:p(e.meta),ok:!0}:{value:null,ok:!1}},[]),[P,F]=(0,_.useState)(N.value),[I,L]=(0,_.useState)(N.ok),[R,z]=(0,_.useState)([]),B=D.current.found,V=e=>{A.current++,T.current?.setValue(e),T.current?.collapsePreamble(),A.current--},H=()=>{let e=l(D.current.metaText);e.ok?(F(p(e.meta)),z([]),L(!0)):L(!1)},U=e=>{A.current>0||(E.current=e,D.current=u(e),k.current=!0,g?.(e))},W=e=>{F(e);let t=s(e);if(!t.ok){z(t.issues);return}z([]);let n=d(t.meta);D.current={...D.current,metaText:n,found:!0};let r=f({preamble:D.current.preamble,metaText:c(D.current),body:D.current.body});E.current=r,O.current=!0,g?.(r)},G=e=>{e===`script`&&O.current?(V(E.current),O.current=!1):e===`properties`&&k.current&&(H(),k.current=!1),M(e)};(0,_.useImperativeHandle)(w,()=>({getValue:()=>E.current,setValue:e=>{E.current=e,D.current=u(e),V(e),H(),O.current=!1,k.current=!1,g?.(e)},revealLine:e=>{j!==`script`&&G(`script`),T.current?.revealLine(e)},focus:()=>T.current?.focus(),setServerDiagnostics:e=>T.current?.setServerDiagnostics(e)}),[j]);let K=!B||!I;return(0,v.jsx)(`div`,{className:`script-editor-tabs`,children:(0,v.jsxs)(a,{value:j,onValueChange:e=>G(e),children:[(0,v.jsxs)(i,{"aria-label":`Script editor`,children:[(0,v.jsx)(r,{value:`script`,children:`Script`}),(0,v.jsx)(r,{value:`properties`,disabled:K,children:`Properties`})]}),(0,v.jsx)(o,{value:`script`,forceMount:!0,className:`script-editor-tabs__panel`,children:(0,v.jsx)(b,{ref:T,projectId:e,scriptName:t,initialSource:n,collapsePreambleOnMount:!0,readOnly:h,onChangeContent:U,onSave:y,onProblems:S,onReady:C})}),(0,v.jsx)(o,{value:`properties`,forceMount:!0,className:`script-editor-tabs__panel`,children:K||!P?(0,v.jsx)(`p`,{className:`placeholder small`,children:`The meta block can't be shown as a form — expand the setup section at the top of the Script tab and edit it there.`}):(0,v.jsx)(x,{value:P,onChange:W,readOnly:h,issues:R})})]})})});export{k as t};
@@ -1,5 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{i as r,n as i,r as a,t as o}from"./Tabs-BAY1Q79B.js";import"./primitives-DEsn1shf.js";import{Et as s,Tt as c}from"./dist-BPx-FyRH.js";import{t as ee}from"./dist-D5aoNQwk.js";import{t as l}from"./api-BX5xXiFs.js";import{t as te}from"./ConfirmDialog-BHFs6vmJ.js";import{t as ne}from"./ScriptEditorTabs-paocQ6dj.js";import{a as u,i as re,n as ie,o as ae,r as oe,s as d}from"./pending-drafts-YVW6X55O.js";var f=e(t(),1),p=n(),m=new Map;function h(e){return`gezel:script-draft:${e}`}function se(e){let t=m.get(e);if(t!==void 0)return t;try{return window.localStorage.getItem(h(e))}catch{return null}}function ce(e,t){m.set(e,t);try{window.localStorage.setItem(h(e),t)}catch{}}function le(e){m.delete(e);try{window.localStorage.removeItem(h(e))}catch{}}function g(){m.clear()}var _=[{kind:`craftbook`,marker:`// @gezel-craftbook:`},{kind:`import`,marker:`// @gezel-import:`}];function ue(e){for(let{kind:t,marker:n}of _){if(!e.startsWith(n))continue;let r=e.indexOf(`
2
- `);return{kind:t,ref:(r===-1?e:e.slice(0,r)).slice(n.length).trim()}}return null}function de(e){if(!_.some(({marker:t})=>e.startsWith(t)))return e;let t=e.indexOf(`
3
- `);return t===-1?``:e.slice(t+1)}function fe(e){return e?.includes(`did not declare it in meta.requires`)?/capability:\s*([\w.:-]+)/.exec(e)?.[1]??null:null}function pe(e,t){let n=/requires:\s*\[([^\]]*)\]/.exec(e);if(!n)return null;let r=(n[1]??``).trim().length>0?`requires: [${n[1]}, '${t}']`:`requires: ['${t}']`;return e.slice(0,n.index)+r+e.slice(n.index+n[0].length)}function me(e,t){let n=[];for(let r of e)for(let e of r.craftbook.steps){let i={taskRef:r.ref,taskTitle:r.title,stepName:e.name};c(e.onEnter).some(e=>e.name===t)&&n.push({...i,moment:`enter`}),e.gate&&s(e.gate).scripts.some(e=>e.name===t)&&n.push({...i,moment:`gate`}),c(e.onExit).some(e=>e.name===t)&&n.push({...i,moment:`exit`})}return n}function v({projectId:e,scriptName:t,scope:n}){let s=`${n?`${n}:`:``}${e}/${t}`,c=(0,f.useRef)(null),h=n===`standard`,[g,_]=(0,f.useState)(null),[v,ge]=(0,f.useState)(null),y=(0,f.useRef)(``),[b,x]=(0,f.useState)(!1),[S,C]=(0,f.useState)(!1),[w,T]=(0,f.useState)(null),[E,D]=(0,f.useState)(void 0),[O,k]=(0,f.useState)(!0),[_e,ve]=(0,f.useState)([]),[A,ye]=(0,f.useState)([]),[j,M]=(0,f.useState)(null),[N,P]=(0,f.useState)(null),[be,xe]=(0,f.useState)(!1),[Se,F]=(0,f.useState)(!1),[Ce,I]=(0,f.useState)(!1),[L,we]=(0,f.useState)([]),[R,z]=(0,f.useState)(`about`),[Te,B]=(0,f.useState)(null),[V,H]=(0,f.useState)({}),[Ee,De]=(0,f.useState)(!1),[Oe,U]=(0,f.useState)(null),[W,ke]=(0,f.useState)(null),[Ae,je]=(0,f.useState)(null),[Me,Ne]=(0,f.useState)(!1),G=(0,f.useRef)(null),K=(0,f.useRef)(null),q=(0,f.useCallback)(()=>{G.current&&clearTimeout(G.current),G.current=null,K.current=null,le(s)},[s]);(0,f.useEffect)(()=>()=>{if(!G.current)return;clearTimeout(G.current),G.current=null;let e=K.current;K.current=null,e!==null&&ce(s,e)},[s]),(0,f.useEffect)(()=>{let r=!1;return(n===`standard`?l.getStandardScriptSource(t):n===`user`?l.getUserScriptSource(t):l.getProjectScriptSource(e,t)).then(n=>{if(r)return;let i=se(s);y.current=n.source,_(i!==null&&i!==n.source?{...n,source:i}:n),x(i!==null&&i!==n.source),I(i!==null&&i!==n.source),D(n.meta),k(!n.metaError),P(n.provenance??null),n.metaError&&ve([{severity:`error`,source:`meta`,message:n.metaError}]),n.meta&&H(u(n.meta));let a=ie(s);a&&(B(`busy`),l.draftProjectScript(e,{name:t,description:a}).then(({source:e})=>{r||(B(null),c.current?c.current.setValue(e):(_(t=>t&&{...t,source:e}),x(!0),m.set(s,e)))}).catch(()=>{r||B(`failed`)}))}).catch(e=>{r||ge(e.message)}),l.listProjectTasks(e).then(e=>{r||we(me(e.tasks,t))}).catch(()=>{}),()=>{r=!0}},[e,t,n,s]);let J=(0,f.useCallback)(e=>{let t=e!==y.current;if(x(t),!t){q();return}m.set(s,e),K.current=e,G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{G.current=null,K.current=null,ce(s,e)},500)},[s,q]),Y=(0,f.useCallback)(async(r={})=>{let i=c.current?.getValue();if(i==null||!g)return!1;C(!0),T(null);try{if(n===`standard`)return!1;let a={name:t,source:i,baseHash:r.overrideHash??g.hash},o=n===`user`?await l.saveUserScriptSource(a):await l.saveProjectScriptSource(e,a);return o.status===`conflict`?(M({currentHash:o.currentHash,currentSource:o.currentSource}),!1):(y.current=i,_({...g,source:i,hash:o.hash}),x(!1),I(!1),q(),M(null),k(o.metaOk),o.meta&&(D(o.meta),H(e=>({...u(o.meta),...e}))),ve(o.diagnostics),c.current?.setServerDiagnostics(o.diagnostics),P(ue(i)),o.metaOk)}catch(e){return T(e.message),!1}finally{C(!1)}},[g,q,e,t,n]),Pe=(0,f.useCallback)(()=>{!j||!g||(y.current=j.currentSource,_({...g,source:j.currentSource,hash:j.currentHash}),c.current?.setValue(j.currentSource),x(!1),I(!1),q(),P(ue(j.currentSource)),M(null))},[j,g,q]),Fe=(0,f.useCallback)(()=>{j&&Y({overrideHash:j.currentHash})},[j,Y]),Ie=(0,f.useCallback)(()=>{q(),c.current?.setValue(y.current),_(e=>e&&{...e,source:y.current}),x(!1),I(!1)},[q]);(0,f.useEffect)(()=>{let n=()=>{!g||S||j||l.getProjectScriptSource(e,t).then(e=>{e.hash!==g.hash&&(b?M({currentHash:e.hash,currentSource:e.source}):(y.current=e.source,_(e),c.current?.setValue(e.source),D(e.meta),k(!e.metaError),P(e.provenance??null)))}).catch(()=>{})};return window.addEventListener(`focus`,n),()=>window.removeEventListener(`focus`,n)},[g,b,S,j,e,t]);let X=N!==null&&!be||h,Le=(0,f.useCallback)(async()=>{let n=c.current?.getValue()??g?.source;if(!n)return;let r=de(n);for(let n=0;n<5;n++){let i=n===0?`${t}-custom`:`${t}-custom-${n+1}`;try{await l.createProjectScript(e,{name:i,source:r}),q(),window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`script`,projectId:e,name:i,activate:!0}}));return}catch(e){if(e instanceof ee&&e.status===409)continue;T(e.message);return}}T(`could not find a free name for the copy`)},[g,q,e,t]),Z=(0,f.useCallback)(async()=>{De(!0),U(null),ke(null),je(null);try{if(b||S){if(!await Y())return}else if(!O){U(`Fix the meta block before running.`);return}let r;try{r=await l.runProjectScript(e,{name:t,...n?{scope:n}:{},input:V})}catch(e){let t=e instanceof ee?e.details:null;if(t&&typeof t==`object`&&`runId`in t)r=t;else throw e}ke(r),l.getProjectScriptRun(e,r.runId).then(je).catch(()=>{})}catch(e){U(e.message)}finally{De(!1)}},[b,O,e,V,Y,S,n,t]),Q=fe(W?.error),Re=(0,f.useCallback)(async()=>{if(!Q)return;let e=c.current?.getValue();if(!e)return;let t=pe(e,Q);if(!t){let t=e.slice(0,e.indexOf(`meta`)).split(`
4
- `).length;c.current?.revealLine(Math.max(1,t));return}Ne(!0);try{c.current?.setValue(t),J(t),await Z()}finally{Ne(!1)}},[J,Z,Q]),$=(0,f.useMemo)(()=>A.filter(e=>e.severity===`error`).length,[A]),ze=()=>window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`area`,area:`scripts`,activate:!0}})),Be=e=>window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`task`,ref:e.taskRef,activate:!0}}));return v?(0,p.jsx)(`div`,{className:`script-editor-view`,children:(0,p.jsx)(`p`,{className:`scripts-view__error`,children:v.includes(`404`)||v.includes(`not found`)?`Script "${t}" does not exist in this project.`:`Error: ${v}`})}):g?(0,p.jsxs)(`div`,{className:`script-editor-view`,children:[(0,p.jsxs)(`header`,{className:`script-editor-header`,children:[(0,p.jsx)(`button`,{type:`button`,className:`script-editor-back muted`,onClick:ze,title:`All scripts`,"aria-label":`Back to scripts`,children:`‹`}),(0,p.jsxs)(`div`,{className:`script-editor-title`,children:[(0,p.jsx)(`h1`,{children:t}),E?.description&&(0,p.jsx)(`p`,{className:`muted small`,children:E.description})]}),(0,p.jsx)(ae,{requires:E?.requires}),L.length>0&&(0,p.jsxs)(`button`,{type:`button`,className:`script-editor-usages muted small`,onClick:()=>Be(L[0]),title:L.map(e=>`${e.taskTitle} — ${e.stepName} (on ${e.moment})`).join(`
5
- `),children:[`Runs on `,L.length,` task step`,L.length===1?``:`s`]}),(0,p.jsxs)(`div`,{className:`script-editor-actions`,children:[b&&(0,p.jsx)(`span`,{className:`script-editor-dirty small`,title:`Unsaved changes`,children:`● Unsaved`}),(0,p.jsx)(`button`,{type:`button`,onClick:()=>void Y(),disabled:!b||S||X,children:S?`Saving…`:`Save`}),(0,p.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>{z(`run`)},children:`Test run`}),(0,p.jsx)(`button`,{type:`button`,className:`script-editor-rail-toggle muted`,onClick:()=>z(e=>e===null?`about`:null),title:R===null?`Show panel`:`Hide panel`,"aria-label":R===null?`Show panel`:`Hide panel`,children:R===null?`⟨`:`⟩`})]})]}),Te===`busy`&&(0,p.jsx)(`div`,{className:`script-editor-banner script-editor-banner--info`,children:(0,p.jsx)(`span`,{children:`Drafting with AI… you can start editing; the draft will replace the buffer.`})}),Te===`failed`&&(0,p.jsxs)(`div`,{className:`script-editor-banner script-editor-banner--warn`,children:[(0,p.jsx)(`span`,{children:`The AI draft didn't come through — starting from the blank skeleton instead.`}),(0,p.jsx)(`button`,{type:`button`,className:`muted small`,onClick:()=>B(null),children:`Dismiss`})]}),Ce&&(0,p.jsxs)(`div`,{className:`script-editor-banner script-editor-banner--info`,children:[(0,p.jsx)(`span`,{children:`Restored your unsaved changes from last time.`}),(0,p.jsx)(`button`,{type:`button`,className:`muted small`,onClick:Ie,children:`Discard them`})]}),j&&(0,p.jsxs)(`div`,{className:`script-editor-banner script-editor-banner--warn`,children:[(0,p.jsx)(`span`,{children:`This script changed on disk while you were editing.`}),(0,p.jsx)(`button`,{type:`button`,onClick:Pe,children:`Reload from disk`}),(0,p.jsx)(`button`,{type:`button`,onClick:Fe,children:`Overwrite with my version`})]}),N&&(0,p.jsxs)(`div`,{className:`script-editor-banner script-editor-banner--warn`,children:[(0,p.jsx)(`span`,{children:N.kind===`standard`?`Standard library — packed into the app and read-only. Duplicate it into this project to customize.`:N.kind===`user`?`From your machine-wide library (~/.gezel/scripts). Edits here apply everywhere it is referenced.`:N.kind===`craftbook`?`Part of the ${N.ref} craftbook — updates to the craftbook replace this file, so direct edits would be lost.`:`Generated from import ${N.ref} — re-syncing the import replaces this file.`}),N.kind!==`user`&&(0,p.jsx)(`button`,{type:`button`,onClick:()=>void Le(),children:N.kind===`standard`?`Duplicate into this project`:`Make my own copy`}),!be&&N.kind!==`standard`&&N.kind!==`user`&&(0,p.jsx)(`button`,{type:`button`,className:`muted`,onClick:()=>F(!0),children:`Edit anyway`})]}),!O&&(0,p.jsx)(`div`,{className:`script-editor-banner script-editor-banner--warn`,children:`Saved, but the meta block is invalid — this script is hidden from lists and can't run until it's fixed.`}),w&&(0,p.jsxs)(`div`,{className:`script-editor-banner script-editor-banner--error`,children:[`Save failed: `,w]}),(0,p.jsxs)(`div`,{className:`script-editor-body`,children:[(0,p.jsx)(ne,{ref:c,projectId:e,scriptName:t,initialSource:g.source,initialMeta:E,readOnly:X,onChangeContent:J,onSave:()=>void Y(),onProblems:ye,onReady:()=>{_e.length>0&&c.current?.setServerDiagnostics(_e)}}),R!==null&&(0,p.jsx)(`aside`,{className:`script-editor-rail`,children:(0,p.jsxs)(a,{value:R,onValueChange:e=>z(e),children:[(0,p.jsxs)(i,{"aria-label":`Script panel`,children:[(0,p.jsx)(r,{value:`about`,children:`About`}),(0,p.jsx)(r,{value:`run`,children:`Test run`})]}),(0,p.jsx)(o,{value:`about`,children:(0,p.jsx)(he,{meta:E,provenance:N,usages:L})}),(0,p.jsx)(o,{value:`run`,children:(0,p.jsxs)(`div`,{className:`script-editor-run`,children:[E?.inputs&&Object.keys(E.inputs).length>0&&(0,p.jsxs)(`fieldset`,{className:`script-detail__inputs`,children:[(0,p.jsx)(`legend`,{children:`Inputs`}),(0,p.jsx)(re,{inputs:E.inputs,values:V,onChange:H})]}),(0,p.jsx)(`div`,{className:`script-detail__actions`,children:(0,p.jsx)(`button`,{type:`button`,className:`primary`,disabled:Ee||S||X,onClick:()=>void Z(),children:Ee?`Running…`:b?`Save & run`:`Run`})}),Oe&&(0,p.jsx)(`p`,{className:`scripts-view__error`,children:Oe}),W&&Q&&(0,p.jsxs)(`div`,{className:`script-editor-capfix`,children:[(0,p.jsx)(`p`,{children:(0,p.jsxs)(`strong`,{children:[`This script tried to use “`,d(Q),`”, but it isn't allowed to yet.`]})}),(0,p.jsx)(`p`,{className:`muted small`,children:`Scripts can only use what they declare up front in their meta block.`}),(0,p.jsx)(`button`,{type:`button`,className:`primary`,disabled:Me,onClick:()=>void Re(),children:Me?`Updating…`:`Allow “${d(Q)}” and run again`})]}),W&&E&&(0,p.jsx)(oe,{result:W,meta:E}),Ae?.logs&&(0,p.jsxs)(`section`,{className:`script-editor-logs`,children:[(0,p.jsx)(`h4`,{children:`Log`}),(0,p.jsx)(`pre`,{children:Ae.logs})]})]})})]})})]}),A.length>0&&(0,p.jsxs)(`footer`,{className:`script-editor-problems`,children:[(0,p.jsxs)(`strong`,{className:`small`,children:[`Problems (`,$>0?`${$} error${$===1?``:`s`}`:A.length,`)`]}),(0,p.jsx)(`ul`,{children:A.slice(0,50).map((e,t)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,className:`script-editor-problem script-editor-problem--${e.severity}`,onClick:()=>c.current?.revealLine(e.line),children:[(0,p.jsx)(`span`,{className:`script-editor-problem-msg`,children:e.message}),(0,p.jsxs)(`span`,{className:`muted small`,children:[`line `,e.line]})]})},`${e.line}:${e.column}:${t}`))})]}),(0,p.jsx)(te,{open:Se,title:`Edit a managed script?`,message:`This file is replaced wholesale when its craftbook or import updates — your edits would be lost then. Making your own copy is the safe way to customize it.`,confirmLabel:`Edit anyway`,danger:!0,onConfirm:()=>{xe(!0),F(!1)},onCancel:()=>F(!1)})]}):(0,p.jsx)(`div`,{className:`script-editor-view`,children:(0,p.jsx)(`p`,{className:`muted small`,children:`Loading script…`})})}function he({meta:e,provenance:t,usages:n}){return e?(0,p.jsxs)(`div`,{className:`script-editor-about`,children:[(0,p.jsx)(`p`,{children:e.description}),e.inputs&&Object.keys(e.inputs).length>0&&(0,p.jsxs)(`section`,{children:[(0,p.jsx)(`h4`,{children:`Takes`}),(0,p.jsx)(`ul`,{children:Object.entries(e.inputs).map(([e,t])=>(0,p.jsxs)(`li`,{children:[(0,p.jsx)(`code`,{children:e}),` — `,t.description,t.required?` (required)`:``]},e))})]}),e.outputs&&Object.keys(e.outputs).length>0&&(0,p.jsxs)(`section`,{children:[(0,p.jsx)(`h4`,{children:`Produces`}),(0,p.jsx)(`ul`,{children:Object.entries(e.outputs).map(([e,t])=>(0,p.jsxs)(`li`,{children:[(0,p.jsx)(`code`,{children:e}),` — `,t.description]},e))})]}),e.requires&&e.requires.length>0&&(0,p.jsxs)(`section`,{children:[(0,p.jsx)(`h4`,{children:`Allowed to`}),(0,p.jsx)(`ul`,{children:e.requires.map(e=>(0,p.jsxs)(`li`,{children:[d(e),` `,(0,p.jsx)(`code`,{className:`muted small`,children:e})]},e))})]}),(0,p.jsxs)(`section`,{children:[(0,p.jsx)(`h4`,{children:`Origin`}),(0,p.jsx)(`p`,{className:`muted small`,children:t?t.kind===`standard`?`Standard library (${t.ref}) — ships with the app.`:t.kind===`user`?`Your machine-wide library (~/.gezel/scripts).`:t.kind===`craftbook`?`Installed by the ${t.ref} craftbook.`:`Generated from import ${t.ref}.`:`A script of this project.`})]}),n.length>0&&(0,p.jsxs)(`section`,{children:[(0,p.jsx)(`h4`,{children:`Used by`}),(0,p.jsx)(`ul`,{children:n.map(e=>(0,p.jsxs)(`li`,{children:[e.taskTitle,` — `,e.stepName,` (on `,e.moment,`)`]},`${e.taskRef}:${e.stepName}:${e.moment}`))})]})]}):(0,p.jsx)(`p`,{className:`muted small`,children:`This script's meta block doesn't parse yet, so there's nothing to summarize. Fix the problems listed below the editor.`})}export{v as ScriptEditorView,g as __clearAllScriptDrafts};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{d as r,l as i,m as a,p as o,s}from"./primitives-DEsn1shf.js";import{Mt as c,R as l}from"./dist-BPx-FyRH.js";import{t as u}from"./api-BX5xXiFs.js";import{t as d}from"./poppetje-Ce-02Aqi.js";import{n as f,t as p}from"./relative-time-B2kBaekd.js";import{Bt as m,Nt as h,Rt as g,Y as _,b as v}from"./index-DXWR4qW1.js";var y=e(t(),1),b=n(),x=/@\[([^\]]+)\]\(gezel\\?:[^)\s]+\)/g;function S(e){return e.replace(x,(e,t)=>`@${t}`)}function C(e){return e===`New session`?`New thread`:e}function w(e,t,n){return e.completedAt?`done`:!n&&e.id===t?`active`:`pending`}var T={done:`Signed off`,active:`Active`,pending:`Waiting its turn`};function E({steps:e,activeStepId:t,selectedStepId:n,onSelect:r,onAddStep:i,busy:a=!1,gezels:o=[],taskAssignee:s,taskStatus:c,onAssign:u}){let f=g(),p=v(),m=c===`complete`||c===`canceled`,h=e=>{let t=(e.suggestedGezelId?{kind:`gezel`,gezelId:e.suggestedGezelId}:null)??s??null;if(t?.kind===`user`)return`you`;if(t?.kind===`gezel`){let e=o.find(e=>e.id===t.gezelId);return e?l(e,p):void 0}};return(0,b.jsx)(_,{variant:`bench`,steps:e,selectedStepId:n,onSelect:r,statusOf:e=>w(e,t,m),stepOf:e=>{let n=w(e,t,m),r=e.assignee??(e.suggestedGezelId?{kind:`gezel`,gezelId:e.suggestedGezelId}:null)??s??null,i,c,g;r?.kind===`user`?i=`You`:r?.kind===`gezel`&&(g=o.find(e=>e.id===r.gezelId),i=g?l(g,p):void 0,c=p?void 0:g?.role);let _=n===`active`?c?`${c} · with the task`:`with the task`:c,v=n===`active`&&f&&g?.poppetje?(0,b.jsx)(d,{poppetje:g.poppetje,variant:`full`,size:26,svgId:`track-${e.id}`,...i?{title:i}:{}}):void 0,y=m&&n===`pending`?void 0:T[n],x=e.assignee,S=x?.kind===`user`?`__user`:x?.kind===`gezel`?x.gezelId:`__inherit`,C=h(e),E=u?(0,b.jsxs)(`select`,{className:`bench-step-select`,value:S,disabled:a,"aria-label":`Assignee for ${e.name}`,title:`Assignee for ${e.name}`,onChange:t=>{let n=t.target.value;n===`__inherit`?u(e.id,null):n===`__user`?u(e.id,{kind:`user`}):u(e.id,{kind:`gezel`,gezelId:n})},children:[(0,b.jsx)(`option`,{value:`__inherit`,children:C?`inherit · ${C}`:`inherit from task`}),(0,b.jsx)(`option`,{value:`__user`,children:`you`}),o.map(e=>(0,b.jsx)(`option`,{value:e.id,children:!p&&e.role?`${e.name} · ${e.role}`:l(e,p)},e.id))]}):void 0;return{...v?{figure:v}:{},...E?{assigneeControl:E}:{},...i?{assigneeName:i}:{},..._?{assigneeRole:_}:{},...y?{statusWord:y}:{}}},onAddStep:i,busy:a,ariaLabel:`Task steps`,addLabel:`add a step`,...m?{terminal:{word:c===`complete`?`Complete`:`Canceled`,tone:c===`complete`?`complete`:`canceled`}}:{}})}var D=150;function O({gezelId:e,projectId:t,sessionId:n,gezelName:l,onSessionIdChange:d,onActiveSessionChange:f,onNewSessionCreated:p,refreshKey:h,taskRef:g,stepId:_,autoPickNewest:v=!0,engineLabel:x}){let[S,C]=(0,y.useState)([]),[w,T]=(0,y.useState)(!1),E=(0,y.useRef)(null),O=(0,y.useRef)(null),k=`${e}:${t}:${g??``}`,[A,N]=(0,y.useState)(null),P=(0,y.useCallback)(async()=>{let n=`${e}:${t}:${g??``}`;try{let r;if(g){let t=c(g);if(!t)return[];r=(await u.listTaskSessions(t.projectId,t.num)).sessions.filter(t=>t.gezelId===e)}else r=(await u.listChatSessions({gezelId:e,projectId:t})).sessions.filter(e=>!e.taskRef);let i=r.filter(e=>!e.archived);return C(i),N(n),i}catch(n){return console.error(`[SessionSwitcher] list sessions failed`,{gezelId:e,projectId:t,taskRef:g,err:n}),[]}},[e,t,g]);(0,y.useEffect)(()=>{E.current=null,C([]),N(null),P()},[P,h]),(0,y.useEffect)(()=>{let e=k;if(A===e){if(n&&S.some(e=>e.id===n)){E.current=e;return}E.current!==e&&S.length!==0&&(E.current=e,v&&d(S[0].id))}},[S,A,n,k,v,d]),(0,y.useEffect)(()=>{if(A!==k)return;let e=S.find(e=>e.id===n);n&&!e||f?.(e??null)},[S,A,n,k,f]),(0,y.useEffect)(()=>{if(A!==k||!n||S.some(e=>e.id===n))return;let e=`${k}:${n}`;O.current!==e&&(O.current=e,P())},[S,A,n,k,P]),(0,y.useEffect)(()=>{let n=new AbortController,r=null,i=!1,a=()=>{r!==null&&window.clearTimeout(r),r=window.setTimeout(()=>{r=null,P()},D)};return(async()=>{let r=250;for(;!i;){try{for await(let o of m({url:u.projectEventsUrl(t),headers:u.authHeader(),signal:n.signal,fetch:u.getFetch()})){if(i)return;if(o.projectId!==t||o.gezelId!==e)continue;let{event:n}=o;(n.type===`user_message`||n.type===`done`)&&a(),r=250}}catch(e){if(i||e.name===`AbortError`)return;console.warn(`[SessionSwitcher] chat event stream error (reconnecting in ${r}ms):`,e)}if(i)return;await new Promise(e=>window.setTimeout(e,r)),r=Math.min(r*2,5e3)}})(),()=>{i=!0,n.abort(),r!==null&&window.clearTimeout(r)}},[e,t,P]);let F=(0,y.useCallback)(async()=>{T(!0);try{let n={gezelId:e,projectId:t,...g?{taskRef:g}:{},..._?{stepId:_}:{}},r=await u.createChatSession(n);await P(),d(r.id),p?.(r.id)}finally{T(!1)}},[e,t,g,_,P,d,p]),I=(0,y.useCallback)(async()=>{if(n){T(!0);try{await u.archiveChatSession(n),d((await P())[0]?.id)}finally{T(!1)}}},[n,P,d]),L=S.length>0,R=n&&L?n:`__NONE__`,z=l?`No threads with ${l} yet — a message starts one`:`No threads yet`,B=v?`Pick a thread`:`New thread`;return(0,b.jsxs)(`div`,{className:`gezel-chat-session-header`,children:[(0,b.jsxs)(r,{value:R,onValueChange:e=>{e&&e!==`__NONE__`&&d(e)},disabled:!L||w,children:[(0,b.jsx)(o,{className:`gezel-chat-session-select`,children:(0,b.jsx)(a,{placeholder:L?B:z})}),(0,b.jsx)(s,{className:`gezel-chat-session-menu`,children:L?S.map(e=>(0,b.jsx)(i,{value:e.id,textValue:M(e,x),children:j(e,x)},e.id)):(0,b.jsx)(i,{value:`__NONE__`,disabled:!0,children:z})})]}),(0,b.jsx)(`button`,{type:`button`,className:`gezel-chat-session-btn`,onClick:()=>void F(),disabled:w,title:`Start a fresh thread with this gezel`,children:`+ New`}),(0,b.jsx)(`button`,{type:`button`,className:`gezel-chat-session-btn`,onClick:()=>void I(),disabled:!n||w,title:`Archive this thread (remains on disk; hidden from the list)`,children:`Archive`})]})}function k(e){let t=[],n=0,r=0;for(let i of e.matchAll(x)){let a=i.index??0;a>n&&t.push(e.slice(n,a)),t.push((0,b.jsxs)(`span`,{className:`session-mention`,children:[`@`,i[1]]},`m-${r}`)),n=a+i[0].length,r++}return t.length===0?e:(n<e.length&&t.push(e.slice(n)),t)}function A(e,t){return e.source?.kind===`external`?`From ${e.source.appName} · read-only`:t||`${h(e.providerName,window.__GEZEL__?.platform)}${e.model?` (${e.model})`:``}`}function j(e,t){return(0,b.jsxs)(`span`,{className:`session-row`,children:[(0,b.jsx)(`span`,{className:`session-row-title`,children:k(C(e.title))}),(0,b.jsx)(`span`,{className:`session-row-meta`,title:p(e.lastActivityAt),children:` · ${f(e.lastActivityAt)} · ${A(e,t)}`})]})}function M(e,t){return`${S(C(e.title))} · ${f(e.lastActivityAt)} · ${A(e,t)}`}export{S as a,C as i,E as n,w as r,O as t};