libre-webui 0.29.0 → 0.31.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 (261) hide show
  1. package/backend/dist/index.d.ts.map +1 -1
  2. package/backend/dist/index.js +24 -7
  3. package/backend/dist/index.js.map +1 -1
  4. package/backend/dist/persistence/postgresAutomationWebhooksMigration.d.ts +9 -0
  5. package/backend/dist/persistence/postgresAutomationWebhooksMigration.d.ts.map +1 -0
  6. package/backend/dist/persistence/postgresAutomationWebhooksMigration.js +38 -0
  7. package/backend/dist/persistence/postgresAutomationWebhooksMigration.js.map +1 -0
  8. package/backend/dist/persistence/postgresMigrationRegistry.d.ts.map +1 -1
  9. package/backend/dist/persistence/postgresMigrationRegistry.js +4 -0
  10. package/backend/dist/persistence/postgresMigrationRegistry.js.map +1 -1
  11. package/backend/dist/persistence/postgresResourceRepositories.d.ts.map +1 -1
  12. package/backend/dist/persistence/postgresResourceRepositories.js +5 -0
  13. package/backend/dist/persistence/postgresResourceRepositories.js.map +1 -1
  14. package/backend/dist/persistence/postgresWorkApprovalsMigration.d.ts +13 -0
  15. package/backend/dist/persistence/postgresWorkApprovalsMigration.d.ts.map +1 -0
  16. package/backend/dist/persistence/postgresWorkApprovalsMigration.js +69 -0
  17. package/backend/dist/persistence/postgresWorkApprovalsMigration.js.map +1 -0
  18. package/backend/dist/persistence/resourceTypes.d.ts +4 -0
  19. package/backend/dist/persistence/resourceTypes.d.ts.map +1 -1
  20. package/backend/dist/persistence/resourceTypes.js.map +1 -1
  21. package/backend/dist/persistence/sqliteMigrations.d.ts +3 -0
  22. package/backend/dist/persistence/sqliteMigrations.d.ts.map +1 -1
  23. package/backend/dist/persistence/sqliteMigrations.js +156 -2
  24. package/backend/dist/persistence/sqliteMigrations.js.map +1 -1
  25. package/backend/dist/persistence/sqliteResourceRepositories.d.ts.map +1 -1
  26. package/backend/dist/persistence/sqliteResourceRepositories.js +7 -0
  27. package/backend/dist/persistence/sqliteResourceRepositories.js.map +1 -1
  28. package/backend/dist/persistence/sqliteToPostgresMigration.d.ts.map +1 -1
  29. package/backend/dist/persistence/sqliteToPostgresMigration.js +32 -1
  30. package/backend/dist/persistence/sqliteToPostgresMigration.js.map +1 -1
  31. package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts +10 -1
  32. package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts.map +1 -1
  33. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js +85 -5
  34. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js.map +1 -1
  35. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts +10 -1
  36. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts.map +1 -1
  37. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js +67 -7
  38. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js.map +1 -1
  39. package/backend/dist/platform/workPersistence/types.d.ts +37 -0
  40. package/backend/dist/platform/workPersistence/types.d.ts.map +1 -1
  41. package/backend/dist/platform/workPersistence/types.js.map +1 -1
  42. package/backend/dist/routes/automations.d.ts.map +1 -1
  43. package/backend/dist/routes/automations.js +83 -1
  44. package/backend/dist/routes/automations.js.map +1 -1
  45. package/backend/dist/routes/ollama.d.ts.map +1 -1
  46. package/backend/dist/routes/ollama.js +64 -0
  47. package/backend/dist/routes/ollama.js.map +1 -1
  48. package/backend/dist/routes/plugins.d.ts.map +1 -1
  49. package/backend/dist/routes/plugins.js +90 -0
  50. package/backend/dist/routes/plugins.js.map +1 -1
  51. package/backend/dist/routes/work.d.ts.map +1 -1
  52. package/backend/dist/routes/work.js +83 -0
  53. package/backend/dist/routes/work.js.map +1 -1
  54. package/backend/dist/services/authService.d.ts +2 -0
  55. package/backend/dist/services/authService.d.ts.map +1 -1
  56. package/backend/dist/services/authService.js +2 -0
  57. package/backend/dist/services/authService.js.map +1 -1
  58. package/backend/dist/services/automationService.d.ts +13 -1
  59. package/backend/dist/services/automationService.d.ts.map +1 -1
  60. package/backend/dist/services/automationService.js +31 -0
  61. package/backend/dist/services/automationService.js.map +1 -1
  62. package/backend/dist/services/notificationService.d.ts.map +1 -1
  63. package/backend/dist/services/notificationService.js +1 -0
  64. package/backend/dist/services/notificationService.js.map +1 -1
  65. package/backend/dist/services/ollamaService.d.ts +12 -0
  66. package/backend/dist/services/ollamaService.d.ts.map +1 -1
  67. package/backend/dist/services/ollamaService.js +26 -0
  68. package/backend/dist/services/ollamaService.js.map +1 -1
  69. package/backend/dist/services/ollamaSettingsService.d.ts +10 -0
  70. package/backend/dist/services/ollamaSettingsService.d.ts.map +1 -0
  71. package/backend/dist/services/ollamaSettingsService.js +83 -0
  72. package/backend/dist/services/ollamaSettingsService.js.map +1 -0
  73. package/backend/dist/services/workAgentGuidance.d.ts +11 -0
  74. package/backend/dist/services/workAgentGuidance.d.ts.map +1 -1
  75. package/backend/dist/services/workAgentGuidance.js +16 -2
  76. package/backend/dist/services/workAgentGuidance.js.map +1 -1
  77. package/backend/dist/services/workAgentService.d.ts +56 -0
  78. package/backend/dist/services/workAgentService.d.ts.map +1 -1
  79. package/backend/dist/services/workAgentService.js +467 -17
  80. package/backend/dist/services/workAgentService.js.map +1 -1
  81. package/backend/dist/services/workApprovalService.d.ts +67 -0
  82. package/backend/dist/services/workApprovalService.d.ts.map +1 -0
  83. package/backend/dist/services/workApprovalService.js +273 -0
  84. package/backend/dist/services/workApprovalService.js.map +1 -0
  85. package/backend/dist/services/workEventService.d.ts.map +1 -1
  86. package/backend/dist/services/workEventService.js +25 -0
  87. package/backend/dist/services/workEventService.js.map +1 -1
  88. package/backend/dist/services/workPolicyService.d.ts +4 -0
  89. package/backend/dist/services/workPolicyService.d.ts.map +1 -1
  90. package/backend/dist/services/workPolicyService.js +19 -0
  91. package/backend/dist/services/workPolicyService.js.map +1 -1
  92. package/backend/dist/services/workRuntimeShared.d.ts +2 -0
  93. package/backend/dist/services/workRuntimeShared.d.ts.map +1 -1
  94. package/backend/dist/services/workRuntimeShared.js.map +1 -1
  95. package/backend/dist/services/workTaskService.d.ts +3 -1
  96. package/backend/dist/services/workTaskService.d.ts.map +1 -1
  97. package/backend/dist/services/workTaskService.js +21 -4
  98. package/backend/dist/services/workTaskService.js.map +1 -1
  99. package/backend/dist/types/index.d.ts +3 -1
  100. package/backend/dist/types/index.d.ts.map +1 -1
  101. package/backend/dist/types/index.js.map +1 -1
  102. package/backend/dist/types/work.d.ts +32 -11
  103. package/backend/dist/types/work.d.ts.map +1 -1
  104. package/backend/dist/websocketServer.d.ts.map +1 -1
  105. package/backend/dist/websocketServer.js +14 -2
  106. package/backend/dist/websocketServer.js.map +1 -1
  107. package/backend/package.json +2 -2
  108. package/deploy/work-computer/Dockerfile +1 -0
  109. package/deploy/work-computer/tint2rc +1 -0
  110. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  111. package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
  112. package/frontend/dist/artifact-runtime/mermaid.js +8 -8
  113. package/frontend/dist/artifact-runtime/papaparse.js +2 -2
  114. package/frontend/dist/artifact-runtime/plotly.js +371 -652
  115. package/frontend/dist/assets/index-B6xMZpzA.js +76 -0
  116. package/frontend/dist/assets/index-BjipfsCP.css +1 -0
  117. package/frontend/dist/index.html +28 -28
  118. package/frontend/dist/js/{ArtifactContainer-CTXxnWRo.js → ArtifactContainer-Bn6iJtaJ.js} +1 -1
  119. package/frontend/dist/js/{ArtifactDemoPage-CEYuIhJA.js → ArtifactDemoPage-BLF8Ok-o.js} +1 -1
  120. package/frontend/dist/js/{ArtifactSandboxFrame-DLOy2VOm.js → ArtifactSandboxFrame-Cs1Gu1WB.js} +1 -1
  121. package/frontend/dist/js/{ArtifactSlideOutPanel-DnTTc1VY.js → ArtifactSlideOutPanel-CuKq5cL0.js} +1 -1
  122. package/frontend/dist/js/AutomationModal-Dha4KgLI.js +1 -0
  123. package/frontend/dist/js/AutomationsPage-HcMCRV-D.js +1 -0
  124. package/frontend/dist/js/{AvatarUpload-DzL00yOL.js → AvatarUpload-CFrlSszY.js} +1 -1
  125. package/frontend/dist/js/{Button--pDOakZx.js → Button-CgN11mgY.js} +1 -1
  126. package/frontend/dist/js/{CalendarPage-Bls3TBeZ.js → CalendarPage-D_K-XrG9.js} +1 -1
  127. package/frontend/dist/js/ChannelsPage-D3CoImOT.js +1 -0
  128. package/frontend/dist/js/ChatPage-C0iBDbOq.js +14 -0
  129. package/frontend/dist/js/ConnectModels-D_ZbZQub.js +1 -0
  130. package/frontend/dist/js/{EvaluationsPage-DSgj9dT5.js → EvaluationsPage-DOJLpauA.js} +2 -2
  131. package/frontend/dist/js/FirstTimeSetup-DDIP_4Dd.js +1 -0
  132. package/frontend/dist/js/GalleryPage-C8U_F7Ns.js +1 -0
  133. package/frontend/dist/js/{HomePage-BebX3v-x.js → HomePage-B_aotoDU.js} +1 -1
  134. package/frontend/dist/js/LibreClawPage-cr2N6W00.js +1 -0
  135. package/frontend/dist/js/{Logo-BE9SvCC5.js → Logo-B7o7eaPU.js} +1 -1
  136. package/frontend/dist/js/{LogoMark-C8x1yyP3.js → LogoMark-D9g6ls0h.js} +1 -1
  137. package/frontend/dist/js/{ModelManagerModals-CpWAltRA.js → ModelManagerModals-C-J1d7GL.js} +1 -1
  138. package/frontend/dist/js/NotesPage-Bgr7R_Vm.js +3 -0
  139. package/frontend/dist/js/{PasswordStrengthMeter-Cdq2oQbc.js → PasswordStrengthMeter-DR-mGbLF.js} +1 -1
  140. package/frontend/dist/js/PersonasPage-C3D_6lIx.js +13 -0
  141. package/frontend/dist/js/{PluginUsagePage-jMrpL2Jb.js → PluginUsagePage-DK7MgSiu.js} +1 -1
  142. package/frontend/dist/js/RichMessageContent-7FxrZ4A8.js +1 -0
  143. package/frontend/dist/js/{RichMessageContent-CC9QZQKd.js → RichMessageContent-CQkLI7Dt.js} +1 -1
  144. package/frontend/dist/js/SettingsModal-CIV_Bgsf.js +19 -0
  145. package/frontend/dist/js/{SettingsToggle-C16gtVyi.js → SettingsToggle-Cw4OhW7B.js} +1 -1
  146. package/frontend/dist/js/ShareDialog-BCEVgtbN.js +1 -0
  147. package/frontend/dist/js/{SystemPage-Drd1neLN.js → SystemPage-BNVZtLe9.js} +1 -1
  148. package/frontend/dist/js/{UserManagementPage-CquciWKV.js → UserManagementPage-pPC_Svj9.js} +1 -1
  149. package/frontend/dist/js/WorkPage-Q33nIqkM.js +7 -0
  150. package/frontend/dist/js/{api-2DulPtq1.js → api-D-5hpGht.js} +3 -3
  151. package/frontend/dist/js/api-WR1CTYO5.js +1 -0
  152. package/frontend/dist/js/{appNavigation-DAGh98Yj.js → appNavigation-DfHbXBey.js} +1 -1
  153. package/frontend/dist/js/{appStore-Ci1X0yA-.js → appStore-B136FGdu.js} +2 -2
  154. package/frontend/dist/js/appVersion-Ck7dYiHe.js +1 -0
  155. package/frontend/dist/js/ar-Cq-nC6v9.js +2 -0
  156. package/frontend/dist/js/authStore-6AJLgQsD.js +1 -0
  157. package/frontend/dist/js/authStore-Ckz37pwu.js +4 -0
  158. package/frontend/dist/js/axios-CUerAKcc.js +1 -0
  159. package/frontend/dist/js/{babel-D7QYvEns.js → babel-8afoxhZ7.js} +1 -1
  160. package/frontend/dist/js/bn-BFSKytYs.js +2 -0
  161. package/frontend/dist/js/chatStore-Dpm3g_Ln.js +3 -0
  162. package/frontend/dist/js/classPrivateMethodInitSpec-DE0XIqc_.js +1 -0
  163. package/frontend/dist/js/config-DJwXAf8i.js +1 -0
  164. package/frontend/dist/js/cs-BKWXa629.js +2 -0
  165. package/frontend/dist/js/da-Cra_DJnV.js +2 -0
  166. package/frontend/dist/js/de-BQa6_UuE.js +2 -0
  167. package/frontend/dist/js/es-BBOHFrx1.js +2 -0
  168. package/frontend/dist/js/{estree-D7xT4AeP.js → estree-qxY7ACbu.js} +3 -3
  169. package/frontend/dist/js/{evaluationsApi-Cu5PH_qi.js → evaluationsApi-BKY-maUM.js} +1 -1
  170. package/frontend/dist/js/fr-C8kXs5c0.js +2 -0
  171. package/frontend/dist/js/hi-BEef4bjU.js +2 -0
  172. package/frontend/dist/js/{html-HvA9vEyn.js → html-B_cUU1Gi.js} +2 -2
  173. package/frontend/dist/js/id-Djipic7Y.js +2 -0
  174. package/frontend/dist/js/is-pazl6RLG.js +2 -0
  175. package/frontend/dist/js/it-DobPbTwl.js +2 -0
  176. package/frontend/dist/js/ja-DwYNaMNX.js +2 -0
  177. package/frontend/dist/js/ko-BQfXE7_o.js +2 -0
  178. package/frontend/dist/js/{markdown-DaF0SXNk.js → markdown-BAF0w-jL.js} +3 -3
  179. package/frontend/dist/js/{messageCodeStyles-DKq3DH1W.js → messageCodeStyles-CkxF6yil.js} +2 -2
  180. package/frontend/dist/js/ms-CkPQoE5T.js +2 -0
  181. package/frontend/dist/js/nl-X_QsDAtu.js +2 -0
  182. package/frontend/dist/js/pl-CK39gUsy.js +2 -0
  183. package/frontend/dist/js/{postcss-RCIJRrFm.js → postcss-B2vYq4-H.js} +1 -1
  184. package/frontend/dist/js/pt-C0dWyR_I.js +2 -0
  185. package/frontend/dist/js/{router-vendor-BGP0k6Y2.js → router-vendor-CIwPu612.js} +1 -1
  186. package/frontend/dist/js/ru-sNJkEz1G.js +2 -0
  187. package/frontend/dist/js/{standalone-BMD7E0jY.js → standalone-BqZmfuRy.js} +2 -2
  188. package/frontend/dist/js/sv-Bh-uxdF3.js +2 -0
  189. package/frontend/dist/js/{teamEventStream-C4u_py2D.js → teamEventStream-DUodK0-C.js} +1 -1
  190. package/frontend/dist/js/th-DPVtwZj2.js +2 -0
  191. package/frontend/dist/js/tr-BYNM_Tm7.js +2 -0
  192. package/frontend/dist/js/{ttsBatching-C9kQXFB1.js → ttsBatching-7_-p2nxR.js} +1 -1
  193. package/frontend/dist/js/{typescript-LOiqVRM1.js → typescript-DokwN-5Y.js} +1 -1
  194. package/frontend/dist/js/{ui-DUzqxWMk.js → ui-BK53RPmS.js} +2 -2
  195. package/frontend/dist/js/ui-vendor-CPdYrKhz.js +177 -0
  196. package/frontend/dist/js/uk-kvNBuYin.js +2 -0
  197. package/frontend/dist/js/{useChat-6yDWZSTz.js → useChat-Czg2p4Rr.js} +1 -1
  198. package/frontend/dist/js/useDictation-B2lYEYKn.js +1 -0
  199. package/frontend/dist/js/useQuery-ClAiNxQ7.js +1 -0
  200. package/frontend/dist/js/{useTranslation-DrnYb6Cx.js → useTranslation-C7GwbUQA.js} +1 -1
  201. package/frontend/dist/js/{utils-D9UstwTG.js → utils-nNyg0lfc.js} +1 -1
  202. package/frontend/dist/js/utils-vendor-CeUf_ngc.js +9 -0
  203. package/frontend/dist/js/vi-CmLoaP0K.js +2 -0
  204. package/frontend/dist/js/workApi-BoJb9aVF.js +1 -0
  205. package/frontend/dist/js/{workApi-BwDBwG62.js → workApi-CFH097y5.js} +3 -3
  206. package/frontend/dist/js/{yaml-CyhEdlt2.js → yaml-BXEpxPn2.js} +2 -2
  207. package/frontend/dist/js/zh-D2zvmvrj.js +2 -0
  208. package/frontend/dist/sw.js +7 -1
  209. package/package.json +5 -5
  210. package/frontend/dist/assets/index-O8rtJINp.css +0 -1
  211. package/frontend/dist/assets/index-f1s6QpC5.js +0 -93
  212. package/frontend/dist/js/AutomationModal-DB3lrK2K.js +0 -1
  213. package/frontend/dist/js/AutomationsPage-D3v0Cra1.js +0 -1
  214. package/frontend/dist/js/ChannelsPage-BnoCniNf.js +0 -1
  215. package/frontend/dist/js/ChatPage-BMcigJWr.js +0 -14
  216. package/frontend/dist/js/FirstTimeSetup-BRysXCjP.js +0 -1
  217. package/frontend/dist/js/GalleryPage-DUcM4dg0.js +0 -1
  218. package/frontend/dist/js/LibreClawPage-A37KF9_G.js +0 -1
  219. package/frontend/dist/js/ModelSelector-C1ipX-44.js +0 -1
  220. package/frontend/dist/js/NotesPage-CXSz7Hde.js +0 -3
  221. package/frontend/dist/js/PersonasPage-CiOBffF3.js +0 -13
  222. package/frontend/dist/js/RichMessageContent-CU6WTuOs.js +0 -1
  223. package/frontend/dist/js/SettingsModal-DP_wKehV.js +0 -19
  224. package/frontend/dist/js/ShareDialog-BW8iGd_i.js +0 -1
  225. package/frontend/dist/js/WorkPage-BgASwAGs.js +0 -6
  226. package/frontend/dist/js/api-BmIdrQfK.js +0 -1
  227. package/frontend/dist/js/appVersion-BRMnr50t.js +0 -1
  228. package/frontend/dist/js/ar-CpmN0TY8.js +0 -2
  229. package/frontend/dist/js/authStore-DIvsSaOt.js +0 -4
  230. package/frontend/dist/js/authStore-DoxafXFR.js +0 -1
  231. package/frontend/dist/js/axios-C8xWfUG8.js +0 -1
  232. package/frontend/dist/js/bn-BwrMg_Oh.js +0 -2
  233. package/frontend/dist/js/chatStore-DkpmZLOG.js +0 -3
  234. package/frontend/dist/js/classPrivateMethodInitSpec-DUpGnGHL.js +0 -1
  235. package/frontend/dist/js/config-Ckn9cand.js +0 -1
  236. package/frontend/dist/js/cs-f72Fnxz3.js +0 -2
  237. package/frontend/dist/js/da-qp8lOgkJ.js +0 -2
  238. package/frontend/dist/js/de-CpcLHr97.js +0 -2
  239. package/frontend/dist/js/es-gZHsxjG4.js +0 -2
  240. package/frontend/dist/js/fr-BY5aUofi.js +0 -2
  241. package/frontend/dist/js/hi-KCn9gIiT.js +0 -2
  242. package/frontend/dist/js/id-C7U6kS0J.js +0 -2
  243. package/frontend/dist/js/is-N9Ek-Usz.js +0 -2
  244. package/frontend/dist/js/it-CqaqWB8D.js +0 -2
  245. package/frontend/dist/js/ja-C5f9HAm1.js +0 -2
  246. package/frontend/dist/js/ko-BuoboDvb.js +0 -2
  247. package/frontend/dist/js/ms-Cu-UWc6j.js +0 -2
  248. package/frontend/dist/js/nl-nOUc4C_i.js +0 -2
  249. package/frontend/dist/js/pl-BKKwFhxj.js +0 -2
  250. package/frontend/dist/js/pt-B18-KYtS.js +0 -2
  251. package/frontend/dist/js/ru-DflEWNyb.js +0 -2
  252. package/frontend/dist/js/sv-CU-nPjr8.js +0 -2
  253. package/frontend/dist/js/th-dOxm2Hhl.js +0 -2
  254. package/frontend/dist/js/tr-7ThM4F8q.js +0 -2
  255. package/frontend/dist/js/ui-vendor-C0KwbTD4.js +0 -177
  256. package/frontend/dist/js/uk-Cl7Pk0Yf.js +0 -2
  257. package/frontend/dist/js/useQuery-CoWV2PmJ.js +0 -1
  258. package/frontend/dist/js/utils-vendor-DtsgPwcz.js +0 -9
  259. package/frontend/dist/js/vi-eljYUBOk.js +0 -2
  260. package/frontend/dist/js/workApi-uXUZSjsf.js +0 -1
  261. package/frontend/dist/js/zh-B0sinUfQ.js +0 -2
@@ -1,93 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/SettingsModal-DP_wKehV.js","js/rolldown-runtime-hePW80VL.js","js/markdown-core-CsTEqgp1.js","js/useQuery-CoWV2PmJ.js","js/router-vendor-BGP0k6Y2.js","js/classPrivateMethodInitSpec-DUpGnGHL.js","js/useTranslation-DrnYb6Cx.js","js/utils-D9UstwTG.js","js/utils-vendor-DtsgPwcz.js","js/chatStore-DkpmZLOG.js","js/i18next-ChNMiFef.js","js/ui-vendor-C0KwbTD4.js","js/logger-CpCQz3Vi.js","js/api-2DulPtq1.js","js/config-Ckn9cand.js","js/workApi-BwDBwG62.js","js/imageGenModels-Dx_QMLJQ.js","js/authStore-DIvsSaOt.js","js/appStore-Ci1X0yA-.js","js/messageCodeStyles-DKq3DH1W.js","js/Button--pDOakZx.js","js/ui-DUzqxWMk.js","js/react-vendor-BsJBHRYW.js","js/Logo-BE9SvCC5.js","js/LogoMark-C8x1yyP3.js","js/ShareDialog-BW8iGd_i.js","js/ttsBatching-C9kQXFB1.js","js/webauthnClient-CPSq528Q.js","js/appVersion-BRMnr50t.js","js/SettingsToggle-C16gtVyi.js","js/thinking-DwlkTfPX.js","js/axios-C8xWfUG8.js","js/HomePage-BebX3v-x.js","js/workStatus-CcO9Fg41.js","js/appNavigation-DAGh98Yj.js","js/welcomePrompts-to5mv_gx.js","js/work-DVgm81bJ.js","js/ChatPage-BMcigJWr.js","js/useChat-6yDWZSTz.js","js/artifactHtml-DDmfpcB0.js","js/ArtifactContainer-CTXxnWRo.js","js/OptimizedSyntaxHighlighter-BwKLuOu-.js","js/syntax-highlight-DY6Hwrri.js","js/ArtifactSandboxFrame-DLOy2VOm.js","js/evaluationsApi-Cu5PH_qi.js","js/ModelSelector-C1ipX-44.js","js/PersonasPage-CiOBffF3.js","js/AvatarUpload-DzL00yOL.js","js/GalleryPage-DUcM4dg0.js","js/NotesPage-CXSz7Hde.js","js/RichMessageContent-CC9QZQKd.js","js/markdown-math-BhUmos36.js","assets/markdown-math-Ddr6Z9Sf.css","js/CalendarPage-Bls3TBeZ.js","js/calendarDates-Co3o_05Y.js","js/AutomationsPage-D3v0Cra1.js","js/AutomationModal-DB3lrK2K.js","js/LibreClawPage-A37KF9_G.js","js/ChannelsPage-BnoCniNf.js","js/teamEventStream-C4u_py2D.js","js/WorkPage-BgASwAGs.js","js/UserManagementPage-CquciWKV.js","js/PasswordStrengthMeter-Cdq2oQbc.js","js/PluginUsagePage-jMrpL2Jb.js","js/EvaluationsPage-DSgj9dT5.js","js/SystemPage-Drd1neLN.js","js/ArtifactDemoPage-CEYuIhJA.js","js/ArtifactSlideOutPanel-DnTTc1VY.js","js/FirstTimeSetup-BRysXCjP.js","js/TurnstileWidget-lyEp7A0r.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"../js/rolldown-runtime-hePW80VL.js";import{_ as t,g as n,l as r}from"../js/markdown-core-CsTEqgp1.js";import{n as i,t as a}from"../js/react-vendor-BsJBHRYW.js";import{C as o,S as s,_ as c,b as l,d as u,f as d,g as f,h as p,l as m,m as h,o as g,p as _,r as v,t as y,u as b,v as x,x as S,y as C}from"../js/useQuery-CoWV2PmJ.js";import{_ as w,a as T,b as E,c as D,d as O,f as k,h as A,l as j,m as ee,n as te,o as M,r as N,s as P,t as ne,v as F,y as I}from"../js/router-vendor-BGP0k6Y2.js";import{t as L}from"../js/classPrivateMethodInitSpec-DUpGnGHL.js";import{t as R}from"../js/useTranslation-DrnYb6Cx.js";import{a as z,r as re,s as ie,t as B}from"../js/utils-D9UstwTG.js";import{S as ae,T as oe,d as se,m as ce,t as le,w as ue}from"../js/chatStore-DkpmZLOG.js";import{$t as de,A as V,D as H,Dt as U,Gn as fe,Jn as pe,Kn as me,L as he,Lt as ge,Mn as _e,Mt as ve,P as ye,R as be,Rt as xe,Sn as Se,St as Ce,T as we,U as Te,Un as Ee,V as De,Vt as Oe,Wn as ke,Wt as Ae,Y as je,Yn as Me,Z as Ne,Zn as Pe,_n as Fe,_r as Ie,an as Le,ar as Re,bn as ze,c as Be,en as Ve,er as He,et as Ue,fr as We,g as Ge,gn as Ke,gr as W,h as qe,hr as Je,jt as Ye,kt as Xe,lt as Ze,n as G,nr as Qe,ot as $e,pt as et,qn as tt,qt as nt,r as rt,rn as it,rr as at,rt as ot,s as st,st as ct,t as lt,tt as ut,u as dt,un as ft,ut as pt,v as mt,vn as ht,w as gt,xt as _t,z as vt}from"../js/ui-vendor-C0KwbTD4.js";import{a as yt,i as bt,t as xt}from"../js/utils-vendor-DtsgPwcz.js";import{a as St,t as K}from"../js/logger-CpCQz3Vi.js";import{t as Ct}from"../js/config-Ckn9cand.js";import{E as wt,I as Tt,L as Et,R as Dt,T as Ot,_ as kt,g as At,h as jt,v as Mt,w as Nt,y as Pt}from"../js/api-2DulPtq1.js";import{d as Ft,n as It,s as Lt,t as q,u as Rt}from"../js/authStore-DIvsSaOt.js";import{t as zt}from"../js/appStore-Ci1X0yA-.js";import{n as Bt}from"../js/welcomePrompts-to5mv_gx.js";import{l as Vt}from"../js/messageCodeStyles-DKq3DH1W.js";import{t as J}from"../js/Button--pDOakZx.js";import{v as Ht}from"../js/ui-DUzqxWMk.js";import{t as Ut}from"../js/AvatarUpload-DzL00yOL.js";import{t as Wt}from"../js/Logo-BE9SvCC5.js";import{t as Gt}from"../js/LogoMark-C8x1yyP3.js";import{t as Kt}from"../js/ShareDialog-BW8iGd_i.js";import{t as qt}from"../js/teamEventStream-C4u_py2D.js";import{t as Jt}from"../js/workStatus-CcO9Fg41.js";import{t as Yt}from"../js/useChat-6yDWZSTz.js";import{n as Xt,r as Zt,t as Qt}from"../js/appNavigation-DAGh98Yj.js";import{n as $t}from"../js/ttsBatching-C9kQXFB1.js";import{n as en,r as tn}from"../js/webauthnClient-CPSq528Q.js";import{t as nn}from"../js/TurnstileWidget-lyEp7A0r.js";import{n as rn,t as an}from"../js/PasswordStrengthMeter-Cdq2oQbc.js";import{t as on}from"../js/appVersion-BRMnr50t.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var sn,cn,Y,ln,un,dn=(sn=new WeakMap,cn=new WeakMap,Y=new WeakMap,ln=new WeakMap,un=new WeakSet,class extends m{constructor(e){super(),L(this,un),E(this,sn,void 0),E(this,cn,void 0),E(this,Y,void 0),E(this,ln,void 0),F(sn,this,e.client),this.mutationId=e.mutationId,F(Y,this,e.mutationCache),F(cn,this,[]),this.state=e.state||pn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){w(cn,this).includes(e)||(w(cn,this).push(e),this.clearGcTimeout(),w(Y,this).notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){F(cn,this,w(cn,this).filter(t=>t!==e)),this.scheduleGc(),w(Y,this).notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){w(cn,this).length||(this.state.status===`pending`?this.scheduleGc():w(Y,this).remove(this))}continue(){return w(ln,this)?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{I(un,this,fn).call(this,{type:`continue`})},n={client:w(sn,this),meta:this.options.meta,mutationKey:this.options.mutationKey};F(ln,this,b({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{I(un,this,fn).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{I(un,this,fn).call(this,{type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>w(Y,this).canRun(this)}));let r=this.state.status===`pending`,i=!w(ln,this).canStart();try{if(r)t();else{I(un,this,fn).call(this,{type:`pending`,variables:e,isPaused:i}),w(Y,this).config.onMutate&&await w(Y,this).config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&I(un,this,fn).call(this,{type:`pending`,context:t,variables:e,isPaused:i})}let a=await w(ln,this).start();return await w(Y,this).config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await w(Y,this).config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),I(un,this,fn).call(this,{type:`success`,data:a}),a}catch(t){try{await w(Y,this).config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await w(Y,this).config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw I(un,this,fn).call(this,{type:`error`,error:t}),t}finally{w(Y,this).runNext(this)}}});function fn(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),d.batch(()=>{w(cn,this).forEach(t=>{t.onMutationUpdate(e)}),w(Y,this).notify({mutation:this,type:`updated`,action:e})})}function pn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var mn,hn,gn,_n=(mn=new WeakMap,hn=new WeakMap,gn=new WeakMap,class extends o{constructor(e={}){super(),E(this,mn,void 0),E(this,hn,void 0),E(this,gn,void 0),this.config=e,F(mn,this,new Set),F(hn,this,new Map),F(gn,this,0)}build(e,t,n){var r;let i=new dn({client:e,mutationCache:this,mutationId:F(gn,this,(r=w(gn,this),++r)),options:e.defaultMutationOptions(t),state:n});return this.add(i),i}add(e){w(mn,this).add(e);let t=vn(e);if(typeof t==`string`){let n=w(hn,this).get(t);n?n.push(e):w(hn,this).set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(w(mn,this).delete(e)){let t=vn(e);if(typeof t==`string`){let n=w(hn,this).get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&w(hn,this).delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=vn(e);if(typeof t==`string`){let n=w(hn,this).get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=vn(e);return typeof t==`string`?(w(hn,this).get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){d.batch(()=>{w(mn,this).forEach(e=>{this.notify({type:`removed`,mutation:e})}),w(mn,this).clear(),w(hn,this).clear()})}getAll(){return Array.from(w(mn,this))}find(e){let t={exact:!0,...e};return this.getAll().find(e=>f(t,e))}findAll(e={}){return this.getAll().filter(t=>f(e,t))}notify(e){d.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return d.batch(()=>Promise.all(e.map(e=>e.continue().catch(x))))}});function vn(e){return e.options.scope?.id}var yn,bn=(yn=new WeakMap,class extends o{constructor(e={}){super(),E(this,yn,void 0),this.config=e,F(yn,this,new Map)}build(e,t,n){let r=t.queryKey,i=t.queryHash??p(r,t),a=this.get(i);return a||(a=new g({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){w(yn,this).has(e.queryHash)||(w(yn,this).set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=w(yn,this).get(e.queryHash);t&&(e.destroy(),t===e&&w(yn,this).delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){d.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return w(yn,this).get(e)}getAll(){return[...w(yn,this).values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>c(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>c(e,t)):t}notify(e){d.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){d.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){d.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}}),X,xn,Sn,Cn,wn,Tn,En,Dn,On=(X=new WeakMap,xn=new WeakMap,Sn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,Tn=new WeakMap,En=new WeakMap,Dn=new WeakMap,class{constructor(e={}){E(this,X,void 0),E(this,xn,void 0),E(this,Sn,void 0),E(this,Cn,void 0),E(this,wn,void 0),E(this,Tn,void 0),E(this,En,void 0),E(this,Dn,void 0),F(X,this,e.queryCache||new bn),F(xn,this,e.mutationCache||new _n),F(Sn,this,e.defaultOptions||{}),F(Cn,this,new Map),F(wn,this,new Map),F(Tn,this,0)}mount(){var e;F(Tn,this,(e=w(Tn,this),e++,e)),w(Tn,this)===1&&(F(En,this,s.subscribe(async e=>{e&&(await this.resumePausedMutations(),w(X,this).onFocus())})),F(Dn,this,u.subscribe(async e=>{e&&(await this.resumePausedMutations(),w(X,this).onOnline())})))}unmount(){var e;F(Tn,this,(e=w(Tn,this),e--,e)),w(Tn,this)===0&&(w(En,this)?.call(this),F(En,this,void 0),w(Dn,this)?.call(this),F(Dn,this,void 0))}isFetching(e){return w(X,this).findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return w(xn,this).findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return w(X,this).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=w(X,this).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(l(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return w(X,this).findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=w(X,this).get(r.queryHash)?.state.data,a=_(t,i);if(a!==void 0)return w(X,this).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return d.batch(()=>w(X,this).findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return w(X,this).get(t.queryHash)?.state}removeQueries(e){let t=w(X,this);d.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=w(X,this);return d.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=d.batch(()=>w(X,this).findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(x).catch(x)}invalidateQueries(e,t={}){return d.batch(()=>(w(X,this).findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=d.batch(()=>w(X,this).findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(x)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(x)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=w(X,this).build(this,t);return n.isStaleByTime(l(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(x).catch(x)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(x).catch(x)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return u.isOnline()?w(xn,this).resumePausedMutations():Promise.resolve()}getQueryCache(){return w(X,this)}getMutationCache(){return w(xn,this)}getDefaultOptions(){return w(Sn,this)}setDefaultOptions(e){F(Sn,this,e)}setQueryDefaults(e,t){w(Cn,this).set(h(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...w(Cn,this).values()],n={};return t.forEach(t=>{C(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){w(wn,this).set(h(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...w(wn,this).values()],n={};return t.forEach(t=>{C(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...w(Sn,this).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=p(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===S&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...w(Sn,this).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){w(X,this).clear(),w(xn,this).clear()}}),Z=e(t(),1),kn=e(a(),1),Q=n(),An={id:`home`,kind:`home`,path:`/`},jn=[`/calendar`,`/automations`,`/channels`,`/personas`,`/gallery`,`/agents`,`/users`,`/usage`,`/system`,`/artifacts`],Mn=e=>{if(e===`/`||e===`/home`)return An;if(e===`/chat`)return{id:`chat:new`,kind:`chat`,path:`/chat`};let t=e.match(/^\/c\/([^/]+)$/);if(t)return{id:`chat:${t[1]}`,kind:`chat`,path:e};if(e===`/work`)return{id:`work:new`,kind:`work`,path:`/work`};let n=e.match(/^\/work\/([^/]+)$/);return n?{id:`work:${n[1]}`,kind:`work`,path:e}:jn.includes(e)?{id:`page:${e}`,kind:`page`,path:e}:null},Nn=e=>[An,...e.filter(e=>e.id!==An.id)],Pn=yt()(xt((e,t)=>({tabs:[An],activeTabId:An.id,syncWithPath:t=>{let n=Mn(t);n&&e(e=>{let t=Nn(e.tabs),r=t.find(e=>e.id===n.id);if(r)return{tabs:t,activeTabId:r.id};let i=t.find(t=>t.id===e.activeTabId);return i&&i.kind===n.kind&&i.id.endsWith(`:new`)&&!n.id.endsWith(`:new`)?{tabs:t.map(e=>e.id===i.id?n:e),activeTabId:n.id}:{tabs:[...t,n],activeTabId:n.id}})},closeTab:e=>t().closeTabs([e]),closeTabs:(n,r)=>{let i=t(),a=Nn(i.tabs),o=new Set(n.filter(e=>e!==An.id&&a.some(t=>t.id===e)));if(o.size===0)return null;let s=a.findIndex(e=>e.id===i.activeTabId),c=a.filter(e=>!o.has(e.id));if(!o.has(i.activeTabId))return e({tabs:c}),null;let l=r?c.find(e=>e.id===r):void 0,u=a.slice(0,Math.max(0,s)).reverse().find(e=>!o.has(e.id)),d=l??u??c[0]??An;return e({tabs:c,activeTabId:d.id}),d},reset:()=>e({tabs:[An],activeTabId:An.id})}),{name:`libre-webui-tabs`,merge:(e,t)=>{let n=e??{},r=Array.isArray(n.tabs)?Nn(n.tabs.filter(e=>!!e&&typeof e.id==`string`&&typeof e.path==`string`&&Mn(e.path)?.id===e.id)):t.tabs,i=r.some(e=>e.id===n.activeTabId)?n.activeTabId:An.id;return{...t,tabs:r,activeTabId:i}}})),Fn=i();function In({open:e,value:t,saving:n,onChange:r,onClose:i,onSave:a}){let{t:o}=R();return e?(0,Fn.createPortal)((0,Q.jsx)(`div`,{className:`fixed inset-0 z-[2147483647] flex items-center justify-center bg-gray-950/55 p-4 backdrop-blur-md`,onClick:i,children:(0,Q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`avatar-modal-title`,className:`bg-white dark:bg-dark-25 rounded-3xl shadow-[0_24px_80px_rgba(0,0,0,0.24)] p-6 w-full max-w-md border border-black/[0.07] dark:border-white/[0.08] animate-scale-in`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Q.jsx)(`h3`,{id:`avatar-modal-title`,className:`text-lg font-medium tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:o(`user.avatar.title`)}),(0,Q.jsx)(`button`,{onClick:i,className:`p-2 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:(0,Q.jsx)(G,{size:20,className:`text-gray-500`})})]}),(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(Ut,{value:t,onChange:r}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-3 pt-4 border-t border-gray-200 dark:border-dark-300`,children:[(0,Q.jsx)(`button`,{onClick:i,className:`px-4 py-2 text-sm font-medium text-gray-700 dark:text-dark-700 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:o(`common.cancel`)}),(0,Q.jsx)(`button`,{onClick:a,disabled:n,className:`px-4 py-2 text-sm font-medium text-white bg-gray-950 hover:bg-gray-800 dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed rounded-xl transition-colors`,children:o(n?`common.saving`:`common.save`)})]})]})]})}),document.body):null}var Ln=()=>{let{theme:e,toggleTheme:t}=zt(),n=e.mode===`light`?`dark`:`light`,r=e.mode===`light`?(0,Q.jsx)(et,{className:`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,strokeWidth:1.75,"aria-hidden":`true`}):(0,Q.jsx)(gt,{className:`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,strokeWidth:1.75,"aria-hidden":`true`}),i=`Switch to ${n} mode`;return(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:t,className:`h-9 w-9 rounded-full p-0`,"aria-label":i,title:`${i} (⌘D)`,children:r})};function Rn({sidebarCompact:e,isElectron:t,showWork:n,activeMode:r,selectedModel:i,modelCount:a,onToggleCompact:o,onStartWork:s,onCreateSession:c}){let{t:l}=R(),u=!i||a===0,d=u?l(`chat.model.noModelsTooltip`):``,f=`flex h-9 w-9 items-center justify-center rounded-full text-ink transition-colors hover:bg-interactive-hover outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30 touch-manipulation`;return e?(0,Q.jsxs)(`div`,{className:B(`flex flex-col items-center gap-3 px-2 pt-4 pb-2`,t&&`pt-10`),children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:o,className:B(f,`group`),title:l(`sidebar.expandSidebar`),"aria-label":l(`sidebar.expandSidebar`),"data-testid":`sidebar-rail-expand`,children:[(0,Q.jsx)(Gt,{size:`sm`,label:null,className:`h-6 w-6 p-0 text-ink group-hover:hidden`}),(0,Q.jsx)(ct,{className:`hidden h-[18px] w-[18px] group-hover:block rtl:rotate-180`})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled:u,className:B(f,u&&`opacity-40`),title:u?d:l(`chat.session.chat`),"aria-label":l(`chat.session.chat`),"aria-pressed":r===`chat`,"data-testid":`sidebar-chat-button`,children:(0,Q.jsx)(Ce,{className:`h-[18px] w-[18px]`})}),n&&(0,Q.jsx)(`button`,{type:`button`,onClick:s,className:f,title:l(`chat.session.work`),"aria-label":l(`chat.session.work`),"aria-pressed":r===`work`,"data-testid":`sidebar-work-button`,children:(0,Q.jsx)(Pe,{className:`h-[18px] w-[18px]`})}),(0,Q.jsx)(`button`,{type:`button`,"data-testid":`sidebar-search-button`,onClick:()=>window.dispatchEvent(new Event(`libre:open-palette`)),title:l(`palette.search`,`Search`),"aria-label":l(`palette.search`,`Search`),className:f,children:(0,Q.jsx)(Te,{className:`h-[18px] w-[18px]`})})]}):(0,Q.jsxs)(`div`,{className:B(`px-3 pb-2 pt-2`,t&&`pt-10`),children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex h-[52px] min-w-0 items-center justify-between ps-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-ink`,children:[(0,Q.jsx)(Gt,{size:`sm`,label:null}),(0,Q.jsx)(Wt,{size:`sm`,className:`tracking-[-0.035em]`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,Q.jsx)(`div`,{className:`hidden sm:block`,children:(0,Q.jsx)(Ln,{})}),(0,Q.jsx)(`button`,{type:`button`,onClick:o,className:`flex h-7 w-7 items-center justify-center rounded-full text-ink-muted transition-colors hover:bg-interactive-hover hover:text-ink outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30 touch-manipulation`,title:l(`sidebar.toggleSize`),"aria-label":l(`sidebar.toggleSize`),"data-testid":`sidebar-toggle-size`,children:(0,Q.jsx)(ct,{className:`h-4 w-4 rtl:rotate-180`})})]})]}),(0,Q.jsxs)(`div`,{className:B(`grid w-full gap-2`,!n&&`grid-cols-1`,n&&`grid-cols-2`),"data-testid":`sidebar-create-actions`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:c,disabled:u,className:B(`flex h-[38px] items-center justify-center gap-1.5 rounded-xl border text-sm font-medium transition-colors touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,r===`chat`?`border-transparent bg-nav-active text-ink`:`border-line bg-surface-raised text-ink hover:bg-hover-solid dark:border-white/[0.12] dark:bg-dark-25 dark:hover:bg-dark-300`,u&&`opacity-50`),title:u?d:l(`chat.session.chat`),"aria-label":l(`chat.session.chat`),"aria-pressed":r===`chat`,"data-testid":`sidebar-chat-button`,children:[(0,Q.jsx)(Ce,{className:`h-4 w-4`}),l(`chat.session.chat`)]}),n&&(0,Q.jsxs)(`button`,{type:`button`,onClick:s,className:B(`flex h-[38px] items-center justify-center gap-1.5 rounded-xl border text-sm font-medium transition-colors touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,r===`work`?`border-transparent bg-nav-active text-ink`:`border-line bg-surface-raised text-ink hover:bg-hover-solid dark:border-white/[0.12] dark:bg-dark-25 dark:hover:bg-dark-300`),title:l(`chat.session.work`),"aria-label":l(`chat.session.work`),"aria-pressed":r===`work`,"data-testid":`sidebar-work-button`,children:[(0,Q.jsx)(Pe,{className:`h-4 w-4`}),l(`chat.session.work`)]})]}),(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`sidebar-search-button`,onClick:()=>window.dispatchEvent(new Event(`libre:open-palette`)),title:l(`palette.search`,`Search`),"aria-label":l(`palette.search`,`Search`),className:`mt-1.5 flex h-[34px] w-full items-center gap-2 rounded-xl px-2.5 text-sm text-ink-muted transition-colors hover:bg-interactive-hover hover:text-ink outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30 touch-manipulation`,children:[(0,Q.jsx)(Te,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`flex-1 text-start`,children:l(`palette.search`,`Search`)}),(0,Q.jsxs)(`span`,{className:`font-mono text-[10px] tracking-wide text-ink-subtle`,children:[z()?`⌘`:`Ctrl`,`K`]})]})]})}var zn=[{path:`/channels`,icon:_t,labelKey:`sidebar.navigation.channels`},{path:`/notes`,icon:pt,labelKey:`sidebar.navigation.notes`},{path:`/calendar`,icon:Me,labelKey:`sidebar.navigation.calendar`},{path:`/automations`,icon:lt,labelKey:`sidebar.navigation.automations`},{path:`/personas`,icon:Be,labelKey:`sidebar.navigation.personas`},{path:`/gallery`,icon:V,labelKey:`sidebar.navigation.imagine`},{path:`/agents`,icon:Qe,labelKey:`sidebar.navigation.agents`}];function Bn({sidebarCompact:e,activePath:t,showAgents:n,unseenRunCount:r=0,onMobileNavigate:i}){let{t:a}=R();return(0,Q.jsx)(`div`,{className:B(`pb-3`,e?`px-2`:`px-3`),children:(0,Q.jsx)(`nav`,{"data-testid":`sidebar-navigation`,"aria-label":a(`sidebar.navigation.exploreLabel`,`Explore`),className:B(`flex gap-1`,e?`flex-col items-center`:`items-center`),children:zn.filter(e=>e.path!==`/agents`||n).map(({path:n,icon:o,labelKey:s})=>{let c=t===n,l=a(s);return(0,Q.jsxs)(ne,{to:n,onClick:i,title:l,"aria-label":l,"aria-current":c?`page`:void 0,className:B(`relative flex items-center justify-center rounded-xl transition-colors duration-150 touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,e?`h-9 w-9`:`h-9 flex-1`,c?`bg-nav-active text-ink`:`text-ink-muted hover:bg-interactive-hover hover:text-ink`),children:[e&&c&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -start-2 h-5 w-0.5 rounded-full bg-primary-500 shadow-[0_0_12px_rgb(var(--color-primary-500)/0.55)]`}),(0,Q.jsx)(o,{className:`h-[18px] w-[18px] shrink-0`}),n===`/automations`&&r>0&&(0,Q.jsx)(`span`,{"data-testid":`automations-unseen-badge`,className:`absolute -end-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-primary-500 px-0.5 text-[9px] font-semibold leading-none text-white`,children:r>9?`9+`:r})]},n)})})})}function Vn({top:e,left:t,title:n,timestamp:r,children:i}){let{i18n:a}=R();return(0,Fn.createPortal)((0,Q.jsxs)(`div`,{role:`tooltip`,className:`pointer-events-none fixed z-[70] hidden w-72 rounded-2xl border border-black/[0.07] bg-surface/95 p-3.5 shadow-[0_16px_48px_rgba(15,23,42,0.18)] backdrop-blur-xl animate-scale-in dark:border-white/[0.09] dark:bg-dark-100/95 md:block`,style:{top:Math.max(8,Math.min(e,window.innerHeight-220)),left:t},children:[(0,Q.jsx)(`p`,{className:`mb-1 truncate text-[13px] font-semibold text-gray-900 dark:text-dark-900`,children:n}),(0,Q.jsx)(`p`,{className:`mb-2 text-[10px] tabular-nums text-gray-400 dark:text-dark-500`,children:re(r,a.language)}),i]}),document.body)}function Hn(e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=864e5;return e>=n?`today`:e>=n-r?`yesterday`:e>=n-7*r?`previous7Days`:e>=n-30*r?`previous30Days`:`older`}var Un=[`today`,`yesterday`,`previous7Days`,`previous30Days`,`older`];function Wn({preview:e}){let{t}=R(),{session:n}=e,r=n.messages.find(e=>e.role===`user`&&e.content.trim()),i=n.messages.find(e=>e.role===`assistant`&&e.content.trim());return(0,Q.jsxs)(Vn,{top:e.top,left:e.left,title:n.title,timestamp:n.updatedAt,children:[r&&(0,Q.jsx)(`div`,{className:`mb-1.5 flex justify-end`,children:(0,Q.jsx)(`p`,{dir:`auto`,className:`max-w-[85%] rounded-xl rounded-ee-sm bg-gray-900 px-2.5 py-1.5 text-[11px] leading-snug text-white dark:bg-dark-300`,children:ie(r.content,110)})}),i&&(0,Q.jsx)(`p`,{dir:`auto`,className:`text-[11px] leading-snug text-gray-600 dark:text-dark-700`,children:ie(i.content.replace(/\s+/g,` `),180)}),!r&&!i&&(0,Q.jsx)(`p`,{className:`text-[11px] italic text-gray-400 dark:text-dark-500`,children:t(`chat.session.noChats`)})]})}function Gn({sessions:e,personas:t,currentSessionId:n,generatingTitleForSession:r,sidebarCompact:i,editingSessionId:a,editingTitle:o,onEditingTitleChange:s,onSelectSession:c,onStartEditing:l,onSaveEdit:u,onCancelEdit:d,onDeleteSession:f,onArchiveSession:p,onTogglePinSession:m,folders:h=[],onCreateFolder:g,onRenameFolder:_,onDeleteFolder:v,onMoveSession:y,onExpandSidebar:b}){let{t:x,i18n:S}=R(),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),D=(0,Z.useRef)(null),O=T?e.find(e=>e.id===T)??null:null;(0,Z.useEffect)(()=>()=>{D.current!==null&&window.clearTimeout(D.current)},[]);let k=()=>{D.current!==null&&(window.clearTimeout(D.current),D.current=null),w(null)},A=(e,t)=>{let n=window.matchMedia(`(hover: hover) and (pointer: fine)`).matches;i||window.innerWidth<768||!n||(D.current!==null&&window.clearTimeout(D.current),D.current=window.setTimeout(()=>{let n=t.getBoundingClientRect();w({session:e,top:n.top,left:n.right+10})},500))},[j,ee]=(0,Z.useState)(()=>new Set),[te,M]=(0,Z.useState)(!1),[N,P]=(0,Z.useState)(``),[ne,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(null),[z,ae]=(0,Z.useState)(null),oe=I?e.find(e=>e.id===I)??null:null,se=()=>{L(null),ae(null)},ce=e=>{let t=oe;se(),!(!t||!y)&&(t.folderId??null)!==e&&y(t.id,e)},le=(e,t)=>({onDragOver:t=>{I&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,z!==e&&ae(e))},onDragLeave:()=>{z===e&&ae(null)},onDrop:e=>{e.preventDefault(),ce(t)}}),[ue,de]=(0,Z.useState)(null),[V,H]=(0,Z.useState)(null),U=V?e.find(e=>e.id===V.sessionId)??null:null;(0,Z.useEffect)(()=>{if(!V)return;let e=e=>{e.key===`Escape`&&H(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[V]);let pe=(e,t)=>{if(t.stopPropagation(),k(),V?.sessionId===e.id){H(null);return}let n=t.currentTarget.getBoundingClientRect();H({sessionId:e.id,top:Math.max(8,Math.min(n.bottom+6,window.innerHeight-340-8)),left:Math.max(8,Math.min(n.right-208,window.innerWidth-208-8))})},me=e=>{let t=window.location.protocol===`file:`?`${window.location.pathname}#/c/${e.id}`:`/c/${e.id}`;window.open(t,`_blank`,`noopener,noreferrer`)},he=e=>{ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ge=()=>{let e=N.trim();M(!1),P(``),e&&g&&g(e)},_e=e=>{let t=N.trim();F(null),P(``),t&&_&&_(e,t)},ve=new Set(h.map(e=>e.id)),ye=e.filter(e=>e.pinned),xe=e.filter(e=>!e.pinned),Se=xe.filter(e=>!e.folderId||!ve.has(e.folderId)),we=[...ye.length>0?[{key:`pinned`,labelKey:`pinned`,sessions:ye}]:[],...h.map(e=>({key:`folder:${e.id}`,folder:e,sessions:xe.filter(t=>t.folderId===e.id)})),...Un.map(e=>({key:e,labelKey:e,sessions:Se.filter(t=>Hn(t.updatedAt)===e)})).filter(e=>e.sessions.length>0)];return(0,Q.jsxs)(`div`,{"data-testid":`sidebar-session-scroll-region`,className:`scroll-region min-h-0 flex-1 scrollbar-thin border-t border-black/[0.05] dark:border-white/[0.05]`,style:{willChange:`scroll-position`},children:[(0,Q.jsxs)(`div`,{className:B(`px-3 py-3`,i&&`px-2`),children:[!i&&e.length>0&&(0,Q.jsxs)(`div`,{className:`mb-1 flex h-7 items-center justify-between px-1.5`,children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium text-ink-subtle`,children:x(`chat.session.chats`)}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[g&&(0,Q.jsx)(`button`,{onClick:()=>{M(!0),P(``)},className:`flex h-6 w-6 items-center justify-center rounded-md text-ink-subtle transition-colors hover:bg-interactive-hover hover:text-ink`,title:x(`chat.session.folder.new`),children:(0,Q.jsx)(Le,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`span`,{className:`text-[10px] tabular-nums text-ink-subtle font-medium`,children:e.length})]})]}),!i&&te&&(0,Q.jsx)(`div`,{className:`mb-2 px-1`,children:(0,Q.jsx)(Ht,{value:N,onChange:e=>P(e.target.value),onKeyDown:e=>{e.key===`Enter`?ge():e.key===`Escape`&&(M(!1),P(``))},onBlur:ge,placeholder:x(`chat.session.folder.namePlaceholder`),className:`h-8 text-sm`,autoFocus:!0})}),i?(0,Q.jsx)(`div`,{className:`flex flex-col items-center gap-1`,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:b,"data-testid":`sidebar-mobile-chats`,"aria-label":`${x(`chat.session.chats`)} (${e.length})`,title:x(`chat.session.chats`),className:`relative flex h-12 w-12 items-center justify-center rounded-xl text-gray-500 outline-none transition-colors hover:bg-white/70 hover:text-gray-950 focus-visible:ring-2 focus-visible:ring-primary-500/30 dark:text-dark-600 dark:hover:bg-dark-200 dark:hover:text-dark-950 md:hidden`,children:[(0,Q.jsx)(Ce,{className:`h-[18px] w-[18px]`}),e.length>0&&(0,Q.jsx)(`span`,{className:`absolute -end-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-md bg-primary-500 px-1 text-[9px] font-semibold tabular-nums text-white shadow-sm`,children:e.length>99?`99+`:e.length})]})}):e.length===0?(0,Q.jsxs)(`div`,{className:B(`text-center py-8`,i?`px-1`:`px-2`),children:[(0,Q.jsx)(`div`,{className:B(`mx-auto mb-3 bg-white/70 dark:bg-dark-200 rounded-xl flex items-center justify-center ring-1 ring-black/[0.04] dark:ring-white/[0.05]`,i?`w-8 h-8`:`w-12 h-12`),children:(0,Q.jsx)(Ce,{className:B(`text-gray-400 dark:text-gray-500`,i?`h-4 w-4`:`h-5 w-5`)})}),!i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:x(`chat.session.noChats`)}),(0,Q.jsx)(`p`,{className:`text-xs mt-1 text-gray-400 dark:text-dark-500`,children:x(`chat.session.createFirst`)})]})]}):(0,Q.jsx)(`div`,{className:B(`space-y-2`,i&&`space-y-1`),children:we.map(e=>(0,Q.jsxs)(`div`,{children:[!i&&e.folder&&(0,Q.jsx)(`div`,{...le(`folder:${e.folder.id}`,e.folder.id),className:B(`group/folder mb-0.5 flex h-[34px] items-center justify-between rounded-lg px-2 transition-colors hover:bg-interactive-hover`,z===`folder:${e.folder.id}`&&`bg-primary-500/10 ring-1 ring-primary-500/40`),children:ne===e.folder.id?(0,Q.jsx)(Ht,{value:N,onChange:e=>P(e.target.value),onKeyDown:t=>{t.key===`Enter`?_e(e.folder.id):t.key===`Escape`&&(F(null),P(``))},onBlur:()=>_e(e.folder.id),className:`h-7 text-sm`,autoFocus:!0}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{onClick:()=>he(e.folder.id),className:`flex min-w-0 flex-1 items-center gap-1.5 text-sm text-ink transition-colors`,"aria-expanded":!j.has(e.folder.id),children:[j.has(e.folder.id)?(0,Q.jsx)(Ee,{className:`h-3.5 w-3.5 shrink-0 text-ink-subtle rtl:rotate-180`}):(0,Q.jsx)(ke,{className:`h-3.5 w-3.5 shrink-0 text-ink-subtle`}),(0,Q.jsx)(it,{className:`h-4 w-4 shrink-0 text-ink-subtle`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.folder.name}),(0,Q.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums text-ink-subtle`,children:e.sessions.length})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-0 transition-opacity group-hover/folder:opacity-100`,children:[_&&(0,Q.jsx)(`button`,{onClick:()=>{F(e.folder.id),P(e.folder.name)},className:`rounded-md p-0.5 text-gray-400 hover:text-gray-700 dark:text-dark-500 dark:hover:text-dark-800`,title:x(`chat.session.renameChat`),children:(0,Q.jsx)(ot,{className:`h-3 w-3`})}),v&&(0,Q.jsx)(`button`,{onClick:()=>{window.confirm(x(`chat.session.folder.deleteConfirm`))&&v(e.folder.id)},className:`rounded-md p-0.5 text-gray-400 hover:text-red-500 dark:text-dark-500 dark:hover:text-red-400`,title:x(`chat.session.folder.delete`),children:(0,Q.jsx)(mt,{className:`h-3 w-3`})})]})]})}),!i&&!e.folder&&(0,Q.jsx)(`p`,{...le(`group:${e.key}`,null),className:B(`mb-0.5 mt-1 rounded-md px-2 text-[11px] font-medium text-ink-subtle transition-colors`,z===`group:${e.key}`&&oe?.folderId&&`bg-primary-500/10 ring-1 ring-primary-500/40 text-primary-600 dark:text-primary-400`),children:x(`chat.session.groups.${e.labelKey}`)}),e.folder&&j.has(e.folder.id)?null:(0,Q.jsx)(`div`,{className:B(`space-y-0.5`,i&&`space-y-1`),children:e.sessions.map(e=>{let t=n===e.id,l=V?.sessionId===e.id;return(0,Q.jsx)(`div`,{draggable:!i&&!!y&&a!==e.id,onDragStart:t=>{k(),H(null),L(e.id),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.id)},onDragEnd:se,className:B(`group relative cursor-pointer transition-colors duration-150 touch-manipulation outline-none`,i?`rounded-xl p-1 flex items-center justify-center`:`rounded-lg px-2`,t?`bg-interactive-active`:`hover:bg-interactive-hover`,I===e.id&&`opacity-40`),onClick:()=>{k(),c(e)},onMouseEnter:t=>A(e,t.currentTarget),onMouseLeave:k,title:i?`${e.title} - ${e.model}`:void 0,children:i?(0,Q.jsx)(`div`,{className:`flex items-center justify-center w-full h-10`,children:(0,Q.jsx)(`div`,{className:B(`flex h-9 w-9 items-center justify-center rounded-xl text-[11px] font-semibold uppercase transition-colors`,r===e.id?`bg-white text-primary-600 animate-pulse dark:bg-dark-200 dark:text-primary-400`:t?`bg-gray-950 text-white dark:bg-white dark:text-gray-950`:`bg-white/70 text-gray-500 ring-1 ring-black/[0.04] dark:bg-dark-200/70 dark:text-dark-600 dark:ring-white/[0.05]`),children:e.title.trim().charAt(0)||`•`})}):a===e.id?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(Ht,{value:o,onChange:e=>s(e.target.value),onKeyDown:t=>{t.key===`Enter`?u(e.id):t.key===`Escape`&&d()},className:`text-sm h-8`,autoFocus:!0}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>u(e.id),className:`h-8 w-8 p-0 shrink-0 hover:bg-gray-100 dark:hover:bg-dark-300 active:bg-gray-200 dark:active:bg-dark-400 touch-manipulation`,children:(0,Q.jsx)(fe,{className:`h-3 w-3`})}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:d,className:`h-8 w-8 p-0 shrink-0 hover:bg-gray-100 dark:hover:bg-dark-300 active:bg-gray-200 dark:active:bg-dark-400 touch-manipulation`,children:(0,Q.jsx)(G,{className:`h-3 w-3`})})]}):(0,Q.jsxs)(`div`,{className:`flex h-8 w-full items-center`,children:[(0,Q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm leading-5 text-ink`,title:e.title,children:r===e.id?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:x(`chat.session.generatingTitle`),children:[(0,Q.jsx)(Ye,{className:`h-3.5 w-3.5 shrink-0 animate-spin text-ink-subtle`}),(0,Q.jsx)(`span`,{className:`truncate`,children:ie(e.title,40)})]}):ie(e.title,40)}),(0,Q.jsx)(`span`,{dir:`auto`,className:B(`ms-2 shrink-0 text-xs leading-5 tabular-nums text-ink-subtle max-sm:hidden`,`sm:group-hover:hidden sm:group-focus-within:hidden`,l&&`sm:hidden`),children:re(e.updatedAt,S.language)}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:t=>{t.stopPropagation(),k(),E(e.id)},className:`h-8 w-8 shrink-0 rounded-lg p-0 touch-manipulation sm:hidden`,title:x(`palette.actions`),"aria-label":x(`palette.actions`),"data-testid":`sidebar-session-actions-mobile`,children:(0,Q.jsx)(ze,{className:`h-4 w-4`})}),(0,Q.jsx)(`div`,{className:B(`hidden shrink-0`,`sm:group-hover:block sm:group-focus-within:block`,l&&`sm:block`),children:(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:t=>pe(e,t),className:B(`h-6 w-6 rounded-md p-0 text-ink-subtle hover:text-ink hover:bg-transparent touch-manipulation`,l&&`text-ink`),title:x(`palette.actions`),"aria-label":x(`palette.actions`),"aria-haspopup":`menu`,"aria-expanded":l,"data-testid":`sidebar-session-actions`,children:(0,Q.jsx)(ze,{className:`h-4 w-4`})})})]})},e.id)})})]},e.key))})]}),C&&(0,Q.jsx)(Wn,{preview:C}),V&&U&&(0,Fn.createPortal)((0,Q.jsxs)(`div`,{className:`fixed inset-0 z-[75] hidden sm:block`,children:[(0,Q.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":x(`common.close`),className:`absolute inset-0 cursor-default`,onClick:()=>H(null)}),(0,Q.jsxs)(`div`,{role:`menu`,"aria-label":U.title,"data-testid":`sidebar-session-menu`,className:`absolute overflow-y-auto rounded-xl border border-black/[0.04] bg-surface-overlay p-1 shadow-lv3 animate-scale-in dark:border-white/[0.06]`,style:{top:V.top,left:V.left,width:208,maxHeight:340},children:[(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{H(null),me(U)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,children:[(0,Q.jsx)(ht,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.openNewTab`)]}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:e=>{H(null),l(U,e)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,children:[(0,Q.jsx)(ot,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.renameChat`)]}),m&&(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{H(null),m(U.id,!U.pinned)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,children:[U.pinned?(0,Q.jsx)(ut,{className:`h-3.5 w-3.5 shrink-0`}):(0,Q.jsx)(Ue,{className:`h-3.5 w-3.5 shrink-0`}),U.pinned?x(`chat.session.unpinChat`):x(`chat.session.pinChat`)]}),!U.shared&&!U.isPrivate&&(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{H(null),de(U)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,"data-testid":`session-share`,children:[(0,Q.jsx)(be,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.shareChat`)]}),p&&(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:e=>{H(null),p(U.id,e)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,children:[(0,Q.jsx)(We,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.archiveChat`)]}),y&&h.length>0&&(0,Q.jsxs)(`div`,{className:`mt-1 border-t border-black/[0.06] pt-1 dark:border-white/[0.07]`,children:[(0,Q.jsx)(`p`,{className:`px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em] text-gray-400 dark:text-dark-500 rtl:tracking-normal`,children:x(`chat.session.folder.move`)}),h.map(e=>(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{H(null),y(U.id,e.id)},className:B(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,U.folderId===e.id&&`text-primary-600 dark:text-primary-400`),children:[(0,Q.jsx)(it,{className:`h-3.5 w-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),U.folderId&&(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{H(null),y(U.id,null)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink-muted hover:bg-interactive-hover`,children:[(0,Q.jsx)(G,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.folder.remove`)]})]}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:e=>{H(null),f(U.id,e)},className:`mt-1 flex w-full items-center gap-2.5 rounded-lg border-t border-black/[0.06] px-2.5 py-2 text-start text-[13px] text-red-500 hover:bg-red-50 dark:border-white/[0.07] dark:hover:bg-red-900/20`,children:[(0,Q.jsx)(mt,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.deleteChat`)]})]})]}),document.body),ue&&(0,Q.jsx)(Kt,{resourceType:`session`,resourceId:ue.id,resourceLabel:ue.title,onClose:()=>de(null)}),O&&(0,Fn.createPortal)((0,Q.jsxs)(`div`,{className:`fixed inset-0 z-[80] sm:hidden`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-black/35 backdrop-blur-[2px]`,onClick:()=>E(null),"aria-label":x(`common.close`)}),(0,Q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":x(`palette.actions`),className:`absolute inset-x-3 bottom-3 rounded-2xl border border-black/[0.08] bg-surface p-2 shadow-[0_20px_70px_rgba(0,0,0,0.3)] dark:border-white/[0.09] dark:bg-dark-100`,"data-testid":`sidebar-session-actions-sheet`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-2 pt-1`,children:[(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-dark-900`,children:O.title}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>E(null),className:`h-9 w-9 shrink-0 rounded-xl p-0`,title:x(`common.close`),"aria-label":x(`common.close`),children:(0,Q.jsx)(G,{className:`h-4 w-4`})})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:e=>{E(null),l(O,e)},className:`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2 text-start text-sm text-ink hover:bg-interactive-hover`,children:[(0,Q.jsx)(ot,{className:`h-4 w-4 shrink-0`}),x(`chat.session.renameChat`)]}),m&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{E(null),m(O.id,!O.pinned)},className:`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2 text-start text-sm text-ink hover:bg-interactive-hover`,children:[O.pinned?(0,Q.jsx)(ut,{className:`h-4 w-4 shrink-0`}):(0,Q.jsx)(Ue,{className:`h-4 w-4 shrink-0`}),O.pinned?x(`chat.session.unpinChat`):x(`chat.session.pinChat`)]}),p&&(0,Q.jsxs)(`button`,{type:`button`,onClick:e=>{E(null),p(O.id,e)},className:`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2 text-start text-sm text-ink hover:bg-interactive-hover`,children:[(0,Q.jsx)(We,{className:`h-4 w-4 shrink-0`}),x(`chat.session.archiveChat`)]}),y&&h.length>0&&(0,Q.jsxs)(`div`,{className:`mt-1 border-t border-black/[0.06] pt-1 dark:border-white/[0.07]`,children:[(0,Q.jsx)(`p`,{className:`px-3 py-1 text-[10px] font-semibold uppercase tracking-[0.12em] text-gray-400 dark:text-dark-500`,children:x(`chat.session.folder.move`)}),h.map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{E(null),y(O.id,e.id)},className:B(`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2 text-start text-sm text-ink hover:bg-interactive-hover`,O.folderId===e.id&&`text-primary-600 dark:text-primary-400`),children:[(0,Q.jsx)(it,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),O.folderId&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{E(null),y(O.id,null)},className:`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2 text-start text-sm text-gray-500 hover:bg-gray-100 dark:text-dark-600 dark:hover:bg-dark-200`,children:[(0,Q.jsx)(G,{className:`h-4 w-4 shrink-0`}),x(`chat.session.folder.remove`)]})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:e=>{E(null),f(O.id,e)},className:`mt-1 flex min-h-11 w-full items-center gap-3 rounded-xl border-t border-black/[0.06] px-3 py-2 text-start text-sm text-red-500 hover:bg-red-50 dark:border-white/[0.07] dark:hover:bg-red-900/20`,children:[(0,Q.jsx)(mt,{className:`h-4 w-4 shrink-0`}),x(`chat.session.deleteChat`)]})]})]}),document.body)]})}var Kn=[{id:`users`,to:`/users`,icon:Be,labelKey:`user.menu.userManagement`},{id:`system`,to:`/system`,icon:De,labelKey:`user.menu.system`},{id:`usage`,to:`/usage`,icon:tt,labelKey:`user.menu.usageAnalytics`},{id:`evaluations`,to:`/evaluations`,icon:qe,labelKey:`user.menu.evaluations`}];function qn({user:e,size:t}){let n=t===`sm`?`w-7 h-7`:`w-8 h-8`,r=t===`sm`?`text-xs`:`text-sm`;return e.avatar?(0,Q.jsx)(`img`,{src:e.avatar,alt:e.username,className:`${n} rounded-full object-cover ring-1 ring-black/10 dark:ring-white/10`,title:`${e.username} (${e.role})`}):(0,Q.jsx)(`div`,{className:`${n} bg-gray-950 dark:bg-white rounded-full flex items-center justify-center`,title:`${e.username} (${e.role})`,children:(0,Q.jsx)(`span`,{className:`text-white dark:text-gray-950 ${r} font-medium`,children:e.username.charAt(0).toUpperCase()})})}function Jn({requiresAuth:e,user:t,isAdmin:n,pendingApprovalCount:r,sidebarCompact:i,userMenuOpen:a,userMenuRef:o,pinnedShortcuts:s,onToggleShortcutPin:c,onToggleUserMenu:l,onOpenSettings:u,onOpenAvatar:d,onLogout:f,onMobileNavigate:p,onCloseUserMenu:m}){let{t:h}=R();if(!e||!t)return null;let g=n?Kn.filter(e=>s.includes(e.id)):[],_=()=>n&&Kn.map(e=>{let t=s.includes(e.id),n=h(t?`user.menu.unpinShortcut`:`user.menu.pinShortcut`);return(0,Q.jsxs)(`div`,{className:`group/shortcut relative`,children:[(0,Q.jsxs)(ne,{to:e.to,onClick:()=>{m(),p()},className:`flex w-full items-center gap-3 px-3 py-2.5 pe-9 text-[13px] text-ink transition-colors duration-150 hover:bg-interactive-hover`,children:[(0,Q.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-start`,children:h(e.labelKey)}),e.id===`users`&&r>0&&(0,Q.jsx)(`span`,{className:`rounded-md bg-error-500 px-1.5 py-0.5 text-[10px] font-semibold text-white`,children:r>99?`99+`:r})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>c(e.id),className:B(`absolute end-2 top-1/2 -translate-y-1/2 rounded-md p-1 text-ink-subtle transition-[color,opacity] hover:text-ink focus-visible:opacity-100`,t?`opacity-100 text-primary-600 dark:text-primary-400 hover:text-primary-500`:`opacity-0 group-hover/shortcut:opacity-100`),title:n,"aria-label":`${n}: ${h(e.labelKey)}`,"aria-pressed":t,"data-testid":`sidebar-shortcut-pin-${e.id}`,children:t?(0,Q.jsx)(ut,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(Ue,{className:`h-3.5 w-3.5`})})]},e.id)});return(0,Q.jsx)(`div`,{className:B(`border-t border-black/[0.04] dark:border-white/[0.06]`,`p-2`),children:i?(0,Q.jsxs)(`div`,{className:`relative flex flex-col items-center gap-1`,ref:o,children:[g.map(e=>(0,Q.jsxs)(ne,{to:e.to,onClick:p,className:`relative flex h-9 w-9 items-center justify-center rounded-full text-ink outline-none transition-colors hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-primary-500/30`,title:h(e.labelKey),"aria-label":h(e.labelKey),"data-testid":`sidebar-rail-pinned-${e.id}`,children:[(0,Q.jsx)(e.icon,{className:`h-[18px] w-[18px]`}),e.id===`users`&&r>0&&(0,Q.jsx)(`span`,{className:`absolute -end-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-md bg-error-500 px-1 text-[9px] font-semibold text-white shadow-sm`,children:r>99?`99+`:r})]},e.id)),(0,Q.jsx)(`button`,{type:`button`,onClick:u,className:`flex h-9 w-9 items-center justify-center rounded-full text-ink outline-none transition-colors hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-primary-500/30`,title:h(`user.menu.settings`),"aria-label":h(`user.menu.settings`),"data-testid":`sidebar-rail-settings-button`,children:(0,Q.jsx)(vt,{className:`h-[18px] w-[18px]`})}),(0,Q.jsxs)(`button`,{type:`button`,onClick:l,className:`relative flex h-9 w-9 items-center justify-center rounded-full outline-none transition-colors hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-primary-500/30`,"aria-label":t.username,"aria-expanded":a,title:t.username,"data-testid":`sidebar-rail-user-menu-button`,children:[(0,Q.jsx)(qn,{user:t,size:`sm`}),r>0&&(0,Q.jsx)(`span`,{"data-testid":`pending-user-notification-badge`,className:`absolute -end-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-md bg-error-500 px-1 text-[9px] font-semibold text-white shadow-sm`,"aria-label":h(`userManager.approval.notificationBadge`,{count:r,defaultValue:`{{count}} pending user approvals`}),children:r>99?`99+`:r})]}),a&&(0,Q.jsxs)(`div`,{"data-testid":`sidebar-user-menu`,className:`scroll-region absolute bottom-0 start-full z-[70] ms-3 w-64 max-h-[calc(100dvh-1rem)] overflow-y-auto rounded-xl border border-black/[0.04] bg-surface-overlay py-1 shadow-lv3 animate-scale-in scrollbar-thin dark:border-white/[0.06]`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{d(t.avatar||``),m()},className:`flex w-full items-center gap-2.5 border-b border-gray-100 px-3 py-2.5 text-start transition-colors hover:bg-gray-100/70 dark:border-dark-200/50 dark:hover:bg-dark-200/70`,children:[(0,Q.jsx)(qn,{user:t,size:`md`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-gray-900 dark:text-gray-100`,children:t.username}),(0,Q.jsx)(`span`,{className:`block truncate text-xs text-gray-500 dark:text-gray-400`,children:h(`user.menu.changePicture`)})]}),(0,Q.jsx)(pe,{className:`h-4 w-4 shrink-0 text-gray-400`})]}),(0,Q.jsxs)(`div`,{className:`py-1`,children:[_(),(0,Q.jsx)(`div`,{className:`my-1 border-t border-gray-100 dark:border-dark-200/50`}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{u(),m()},className:`flex w-full items-center gap-3 px-3 py-2.5 text-start text-[13px] text-ink transition-colors hover:bg-interactive-hover`,children:[(0,Q.jsx)(vt,{className:`h-4 w-4 shrink-0`}),h(`user.menu.settings`)]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{f(),m()},className:`flex w-full items-center gap-3 px-3 py-2.5 text-start text-[13px] text-red-600 transition-colors hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20`,children:[(0,Q.jsx)(U,{className:`h-4 w-4 shrink-0`}),h(`user.menu.logout`)]})]})]})]}):(0,Q.jsxs)(`div`,{className:`relative`,ref:o,children:[g.map(e=>(0,Q.jsxs)(ne,{to:e.to,onClick:p,className:`flex h-[34px] w-full items-center gap-2 rounded-xl px-2.5 text-start text-sm text-ink transition-colors duration-150 hover:bg-interactive-hover touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,"data-testid":`sidebar-pinned-${e.id}`,children:[(0,Q.jsx)(e.icon,{className:`h-4 w-4 shrink-0 text-ink-muted`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:h(e.labelKey)}),e.id===`users`&&r>0&&(0,Q.jsx)(`span`,{className:`rounded-md bg-error-500 px-1.5 py-0.5 text-[10px] font-semibold text-white`,children:r>99?`99+`:r})]},e.id)),(0,Q.jsxs)(`button`,{type:`button`,onClick:u,className:`flex h-[34px] w-full items-center gap-2 rounded-xl px-2.5 text-start text-sm text-ink transition-colors duration-150 hover:bg-interactive-hover touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,"data-testid":`sidebar-settings-button`,children:[(0,Q.jsx)(vt,{className:`h-4 w-4 shrink-0 text-ink-muted`}),h(`user.menu.settings`)]}),(0,Q.jsxs)(`button`,{onClick:l,className:`relative h-[38px] w-full rounded-xl px-2.5 hover:bg-interactive-hover transition-colors duration-150 text-start touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(qn,{user:t,size:`sm`}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm text-ink`,children:t.username}),t.role===`admin`&&(0,Q.jsx)(ye,{size:11,className:`shrink-0 text-ink-subtle`})]}),(0,Q.jsx)(Ee,{className:B(`h-4 w-4 text-ink-subtle transition-transform duration-150 rtl:rotate-180`,a&&`rotate-90 rtl:rotate-90`)})]}),n&&r>0&&(0,Q.jsx)(`span`,{"data-testid":`pending-user-notification-badge`,className:`absolute -end-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-error-500 px-1 text-[10px] font-semibold text-white shadow-subtle`,"aria-label":h(`userManager.approval.notificationBadge`,{count:r,defaultValue:`{{count}} pending user approvals`}),children:r>99?`99+`:r})]}),a&&(0,Q.jsxs)(`div`,{"data-testid":`sidebar-user-menu`,className:`scroll-region absolute bottom-full left-0 right-0 z-50 mb-2 max-h-[calc(100dvh-1rem)] rounded-xl border border-black/[0.04] bg-surface-overlay py-1 shadow-lv3 animate-scale-in scrollbar-thin dark:border-white/[0.06]`,children:[(0,Q.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-100 dark:border-dark-200/50`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Q.jsx)(qn,{user:t,size:`md`}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,Q.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:t.email||h(`user.profile.noEmail`)})]})]})}),(0,Q.jsxs)(`div`,{className:`py-1`,children:[(0,Q.jsxs)(`button`,{onClick:()=>{d(t.avatar||``),m()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-ink hover:bg-interactive-hover transition-colors duration-150 text-start`,children:[(0,Q.jsx)(pe,{className:`h-4 w-4 shrink-0`}),h(`user.menu.changePicture`)]}),_(),(0,Q.jsx)(`div`,{className:`border-t border-gray-100 dark:border-dark-200/50 my-1`}),(0,Q.jsxs)(`button`,{onClick:()=>{u(),m()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-ink hover:bg-interactive-hover transition-colors duration-150 text-start`,children:[(0,Q.jsx)(vt,{className:`h-4 w-4 shrink-0`}),h(`user.menu.settings`)]}),(0,Q.jsxs)(`button`,{onClick:()=>{f(),m()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors duration-150 text-start`,children:[(0,Q.jsx)(U,{className:`h-4 w-4 shrink-0`}),h(`user.menu.logout`)]})]})]})]})})}var Yn=K(`notification-bell`),Xn=({sidebarCompact:e})=>{let{t,i18n:n}=R(),r=k(),[i,a]=(0,Z.useState)(0),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(null),d=(0,Z.useCallback)(()=>{wt.unreadCount().then(e=>{e.success&&e.data&&a(e.data.count)}).catch(e=>Yn.debug(`Unread poll failed:`,e))},[]);(0,Z.useEffect)(()=>{d();let e=window.setInterval(d,6e4),t=new AbortController;return qt({path:`/notifications/events`,signal:t.signal,onEvent:()=>d()}),()=>{window.clearInterval(e),t.abort()}},[d]);let f=()=>{s(!0),wt.list({limit:50}).then(e=>{e.success&&e.data&&l(e.data)}).catch(e=>Yn.error(`Failed to load notifications:`,e))},p=e=>{wt.markRead(e.id).then(d),s(!1),e.href&&r(e.href)};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>o?s(!1):f(),className:B(`relative flex items-center gap-2 rounded-lg text-[13px] text-gray-600 hover:bg-black/[0.04] dark:text-dark-700 dark:hover:bg-white/[0.06]`,e?`mx-auto h-9 w-9 justify-center`:`mx-2 px-2 py-1.5`),title:t(`notifications.title`),"aria-label":t(`notifications.title`),"data-testid":`notification-bell`,children:[(0,Q.jsx)(Re,{className:`h-4 w-4 shrink-0`}),!e&&(0,Q.jsx)(`span`,{children:t(`notifications.title`)}),i>0&&(0,Q.jsx)(`span`,{className:B(`rounded-full bg-primary-500 px-1.5 text-[10px] font-semibold leading-4 text-white`,e&&`absolute -right-0.5 -top-0.5`),"data-testid":`notification-unread-badge`,children:i>99?`99+`:i})]}),o&&(0,Fn.createPortal)((0,Q.jsx)(`div`,{className:`fixed inset-0 z-[2147483646]`,onClick:()=>s(!1),children:(0,Q.jsxs)(`div`,{ref:u,role:`dialog`,"aria-label":t(`notifications.title`),className:`absolute bottom-16 left-4 flex max-h-[70vh] w-80 flex-col overflow-hidden rounded-2xl border border-black/[0.08] bg-white shadow-[0_18px_60px_rgba(0,0,0,0.22)] dark:border-white/[0.1] dark:bg-dark-25`,onClick:e=>e.stopPropagation(),"data-testid":`notification-panel`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/[0.06] px-3 py-2 dark:border-white/[0.06]`,children:[(0,Q.jsx)(`span`,{className:`flex-1 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-600`,children:t(`notifications.title`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void wt.markAllRead().then(()=>{d(),l(e=>e&&e.map(e=>({...e,readAt:e.readAt??Date.now()})))}),className:`rounded-md p-1 text-gray-400 hover:text-gray-700 dark:hover:text-dark-800`,title:t(`notifications.markAllRead`),"data-testid":`notification-mark-all`,children:(0,Q.jsx)(me,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>s(!1),className:`rounded-md p-1 text-gray-400 hover:text-gray-700 dark:hover:text-dark-800`,children:(0,Q.jsx)(G,{className:`h-3.5 w-3.5`})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scrollbar-thin`,children:c===null?(0,Q.jsx)(Ye,{className:`mx-auto my-6 h-4 w-4 animate-spin text-gray-400`}):c.length===0?(0,Q.jsx)(`p`,{className:`py-8 text-center text-xs text-gray-400 dark:text-dark-500`,children:t(`notifications.empty`)}):c.map(e=>(0,Q.jsxs)(`div`,{className:B(`group flex cursor-pointer items-start gap-2 border-b border-black/[0.04] px-3 py-2.5 last:border-b-0 hover:bg-black/[0.03] dark:border-white/[0.04] dark:hover:bg-white/[0.04]`,!e.readAt&&`bg-primary-500/[0.04]`),onClick:()=>p(e),"data-testid":`notification-item`,children:[(0,Q.jsx)(`span`,{className:B(`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full`,e.readAt?`bg-transparent`:`bg-primary-500`)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-[13px] font-medium leading-snug text-gray-900 dark:text-dark-900`,children:e.title}),e.body&&(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-[12px] text-gray-500 dark:text-dark-600`,children:e.body}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-[11px] text-gray-400 dark:text-dark-500`,children:re(e.createdAt,n.language)})]}),!e.readAt&&(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),wt.markRead(e.id).then(()=>{d(),l(t=>t&&t.map(t=>t.id===e.id?{...t,readAt:Date.now()}:t))})},className:`hidden rounded p-1 text-gray-400 hover:text-emerald-600 group-hover:block`,title:t(`notifications.markRead`),"data-testid":`notification-mark-read`,children:(0,Q.jsx)(fe,{className:`h-3.5 w-3.5`})})]},e.id))})]})}),document.body)]})};function Zn(e,t){return e.isAgent===!0&&!t&&typeof e.lastSeenAt==`number`&&e.updatedAt>e.lastSeenAt&&(e.status===`completed`||e.status===`needs_input`||e.status===`failed`)}function Qn({preview:e}){let{t}=R(),{task:n}=e,r=Jt[n.status],i=t(r.labelKey,{defaultValue:r.label});return(0,Q.jsxs)(Vn,{top:e.top,left:e.left,title:n.title||t(`work.tasks.untitled`,{defaultValue:`Untitled task`}),timestamp:n.updatedAt,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[11px] leading-snug text-gray-600 dark:text-dark-700`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:B(`h-2 w-2 shrink-0 rounded-full`,r.animated&&`animate-pulse`),style:{backgroundColor:r.color}}),i]}),n.statusBlurb&&(0,Q.jsx)(`p`,{dir:`auto`,className:`mt-1.5 line-clamp-2 text-[11px] leading-snug text-gray-600 dark:text-dark-700`,children:n.statusBlurb}),(0,Q.jsx)(`p`,{className:`mt-1.5 truncate font-mono text-[10px] text-gray-400 dark:text-dark-500`,children:n.model}),n.hostPath&&(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-gray-400 dark:text-dark-500`,title:n.hostPath,children:n.hostPath})]})}var $n=208,er=180;function tr({tasks:e,personas:t,currentTaskId:n,loading:r,actionLoading:i,sidebarCompact:a,onSelectTask:o,onDeleteTask:s,onExpandSidebar:c}){let{t:l,i18n:u}=R(),d=e.filter(e=>e.isAgent===!0),f=e.filter(e=>e.isAgent!==!0),p=d,[m,h]=(0,Z.useState)(null),g=(0,Z.useRef)(null),[_,v]=(0,Z.useState)(null),y=_?e.find(e=>e.id===_)??null:null;(0,Z.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current)},[]);let b=()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null),h(null)},x=(e,t)=>{let n=window.matchMedia(`(hover: hover) and (pointer: fine)`).matches;a||window.innerWidth<768||!n||(g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{let n=t.getBoundingClientRect();h({task:e,top:n.top,left:n.right+10})},500))},[S,C]=(0,Z.useState)(null),w=S?e.find(e=>e.id===S.taskId)??null:null;(0,Z.useEffect)(()=>{if(!S)return;let e=e=>{e.key===`Escape`&&C(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[S]);let T=(e,t)=>{if(t.stopPropagation(),b(),S?.taskId===e.id){C(null);return}let n=t.currentTarget.getBoundingClientRect();C({taskId:e.id,top:Math.max(8,Math.min(n.bottom+6,window.innerHeight-er-8)),left:Math.max(8,Math.min(n.right-$n,window.innerWidth-$n-8))})},E=e=>{let t=window.location.protocol===`file:`?`${window.location.pathname}#/work/${e.id}`:`/work/${e.id}`;window.open(t,`_blank`,`noopener,noreferrer`)},D=e=>e.title||l(`work.tasks.untitled`,{defaultValue:`Untitled task`}),O=e=>{let r=n===e.id,i=Jt[e.status],a=l(i.labelKey,{defaultValue:i.label}),s=S?.taskId===e.id,c=e.isAgent===!0,d=c&&e.personaId?t[e.personaId]:void 0,f=Zn(e,r),p=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{dir:`auto`,className:B(`ms-2 shrink-0 text-xs leading-5 tabular-nums text-ink-subtle max-sm:hidden`,`sm:group-hover:hidden sm:group-focus-within:hidden`,s&&`sm:hidden`),children:re(e.updatedAt,u.language)}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:t=>{t.stopPropagation(),b(),v(e.id)},className:`h-8 w-8 shrink-0 rounded-lg p-0 touch-manipulation sm:hidden`,title:l(`palette.actions`),"aria-label":l(`palette.actions`),"data-testid":`sidebar-work-task-actions-mobile`,children:(0,Q.jsx)(ze,{className:`h-4 w-4`})}),(0,Q.jsx)(`div`,{className:B(`hidden shrink-0`,`sm:group-hover:block sm:group-focus-within:block`,s&&`sm:block`),children:(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:t=>T(e,t),className:B(`h-6 w-6 rounded-md p-0 text-ink-subtle hover:text-ink hover:bg-transparent touch-manipulation`,s&&`text-ink`),title:l(`palette.actions`),"aria-label":l(`palette.actions`),"aria-haspopup":`menu`,"aria-expanded":s,"data-testid":`sidebar-work-task-actions`,children:(0,Q.jsx)(ze,{className:`h-4 w-4`})})})]});return(0,Q.jsx)(`div`,{"data-testid":`sidebar-work-task-item`,"data-task-id":e.id,"data-agent":c?`true`:void 0,"aria-current":r?`page`:void 0,className:B(`group relative cursor-pointer rounded-lg px-2 transition-colors duration-150 outline-none touch-manipulation`,r?`bg-interactive-active`:`hover:bg-interactive-hover`),onClick:()=>{b(),o(e.id)},onMouseEnter:t=>x(e,t.currentTarget),onMouseLeave:b,children:c?(0,Q.jsxs)(`div`,{className:`flex w-full items-center gap-2.5 py-1.5`,children:[(0,Q.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,Q.jsx)(`img`,{src:d?At(d,64):jt(D(e),64),alt:``,"aria-hidden":`true`,"data-testid":`sidebar-work-agent-avatar`,onError:t=>kt(t.currentTarget,d?.name??D(e),64),className:`h-8 w-8 rounded-lg object-cover`}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-work-task-status`,"data-status-label":a,className:B(`absolute -bottom-0.5 -end-0.5 h-2.5 w-2.5 rounded-full border-2 border-gray-100 dark:border-dark-50`,i.animated&&`animate-pulse`,e.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:i.color}})]}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsxs)(`h3`,{dir:`auto`,className:B(`min-w-0 flex-1 truncate text-sm leading-5 text-ink`,f&&`font-medium`),title:D(e),children:[ie(D(e),34),(0,Q.jsx)(`span`,{className:`sr-only`,children:l(`work.tasks.status`,{defaultValue:`Status: {{status}}`,status:a})})]}),f&&(0,Q.jsx)(`span`,{"data-testid":`sidebar-work-agent-unread`,"aria-label":l(`work.agent.unread`,{defaultValue:`New activity`}),className:`ms-2 h-2 w-2 shrink-0 rounded-full bg-primary-500 shadow-[0_0_8px_rgb(var(--color-primary-500)/0.6)]`}),p]}),(0,Q.jsx)(`p`,{dir:`auto`,"data-testid":`sidebar-work-agent-blurb`,className:B(`truncate text-[11px] leading-4`,f?`text-ink-muted`:`text-ink-subtle`),title:e.statusBlurb||a,children:e.statusBlurb||a})]})]}):(0,Q.jsxs)(`div`,{className:`flex h-8 w-full items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-work-task-status`,"data-status-label":a,className:B(`me-2 h-2 w-2 shrink-0 rounded-full`,i.animated&&`animate-pulse`,e.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:i.color}}),(0,Q.jsxs)(`h3`,{dir:`auto`,className:`min-w-0 flex-1 truncate text-sm leading-5 text-ink`,title:D(e),children:[ie(D(e),40),(0,Q.jsx)(`span`,{className:`sr-only`,children:l(`work.tasks.status`,{defaultValue:`Status: {{status}}`,status:a})})]}),p]})},e.id)};return(0,Q.jsxs)(`div`,{"data-testid":`sidebar-work-task-scroll-region`,className:`scroll-region min-h-0 flex-1 border-t border-black/[0.05] scrollbar-thin dark:border-white/[0.05]`,style:{willChange:`scroll-position`},children:[(0,Q.jsxs)(`div`,{className:B(`px-3 py-3`,a&&`px-2`),children:[!a&&e.length>0&&(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between px-1`,children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium text-ink-subtle`,children:d.length>0?l(`work.agents.title`,{defaultValue:`Agents`}):l(`work.tasks.title`,{defaultValue:`Work tasks`})}),(0,Q.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums text-gray-400 dark:text-dark-500`,children:d.length>0?d.length:e.length})]}),a?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:c,"data-testid":`sidebar-mobile-work-tasks`,"aria-label":`${l(`work.tasks.title`,{defaultValue:`Work tasks`})} (${e.length})`,title:l(`work.tasks.title`,{defaultValue:`Work tasks`}),className:`relative flex h-12 w-12 items-center justify-center rounded-xl text-gray-500 outline-none transition-colors hover:bg-white/70 hover:text-gray-950 focus-visible:ring-2 focus-visible:ring-primary-500/30 dark:text-dark-600 dark:hover:bg-dark-200 dark:hover:text-dark-950 md:hidden`,children:[(0,Q.jsx)(Pe,{className:`h-[18px] w-[18px]`}),e.length>0&&(0,Q.jsx)(`span`,{className:`absolute -end-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-md bg-primary-500 px-1 text-[9px] font-semibold tabular-nums text-white shadow-sm`,children:e.length>99?`99+`:e.length})]}),(0,Q.jsx)(`div`,{"data-testid":`sidebar-compact-work-agent-list`,className:`flex w-full flex-col items-center gap-1`,children:p.map(e=>{let r=n===e.id,i=Jt[e.status],a=l(i.labelKey,{defaultValue:i.label}),s=D(e),c=e.personaId?t[e.personaId]:void 0,u=Zn(e,r),d=[s,l(`work.tasks.status`,{defaultValue:`Status: {{status}}`,status:a}),u?l(`work.agent.unread`,{defaultValue:`New activity`}):null].filter(Boolean).join(`. `);return(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>o(e.id),"data-testid":`sidebar-compact-work-agent`,"data-task-id":e.id,"data-agent":`true`,"aria-current":r?`page`:void 0,"aria-label":d,title:d,className:B(`relative flex h-12 w-12 items-center justify-center rounded-xl outline-none transition-colors focus-visible:ring-2 focus-visible:ring-primary-500/30`,r?`bg-primary-500/10 text-primary-700 ring-1 ring-primary-500/10 dark:bg-primary-500/15 dark:text-primary-300 dark:ring-primary-400/10`:`text-gray-500 hover:bg-white/70 hover:text-gray-950 dark:text-dark-600 dark:hover:bg-dark-200 dark:hover:text-dark-950`),children:[r&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -start-2 h-5 w-0.5 rounded-full bg-primary-500 shadow-[0_0_12px_rgb(var(--color-primary-500)/0.55)]`}),(0,Q.jsx)(`img`,{src:c?At(c,64):jt(s,64),alt:``,"aria-hidden":`true`,"data-testid":`sidebar-compact-work-agent-avatar`,onError:e=>kt(e.currentTarget,c?.name??s,64),className:`h-9 w-9 rounded-lg object-cover`}),u&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-compact-work-agent-unread`,className:`absolute end-1.5 top-1.5 h-2 w-2 rounded-full bg-primary-500 ring-2 ring-gray-100 dark:ring-dark-50`}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-compact-work-agent-status`,"data-status":e.status,className:B(`absolute bottom-1.5 end-1.5 h-2 w-2 rounded-full border-2 border-gray-100 dark:border-dark-50`,i.animated&&`animate-pulse`,e.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:i.color}})]},e.id)})})]}):r&&e.length===0?(0,Q.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex items-center justify-center py-10 text-gray-400 dark:text-dark-500`,children:[(0,Q.jsx)(Ye,{"aria-hidden":`true`,className:`h-5 w-5 animate-spin`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:l(`work.tasks.loading`,{defaultValue:`Loading Work tasks`})})]}):e.length===0?(0,Q.jsxs)(`div`,{className:B(`py-8 text-center`,a?`px-1`:`px-2`),children:[(0,Q.jsx)(`div`,{className:B(`mx-auto mb-3 flex items-center justify-center rounded-xl bg-white/70 ring-1 ring-black/[0.04] dark:bg-dark-200 dark:ring-white/[0.05]`,a?`h-8 w-8`:`h-12 w-12`),children:(0,Q.jsx)(Pe,{className:B(`text-gray-400 dark:text-gray-500`,a?`h-4 w-4`:`h-5 w-5`)})}),!a&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:l(`work.tasks.emptyTitle`,{defaultValue:`No Work tasks yet`})}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-gray-400 dark:text-dark-500`,children:l(`work.tasks.empty`,{defaultValue:`Your Work tasks will appear here after you send the first message.`})})]})]}):(0,Q.jsx)(`div`,{"data-testid":`sidebar-work-task-list`,className:`space-y-0.5`,children:d.length>0?(0,Q.jsxs)(Q.Fragment,{children:[d.map(O),f.length>0&&(0,Q.jsxs)(`div`,{className:`mb-1 mt-4 flex items-center justify-between px-1`,children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium text-ink-subtle`,children:l(`work.tasks.title`,{defaultValue:`Work tasks`})}),(0,Q.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums text-gray-400 dark:text-dark-500`,children:f.length})]}),f.map(O)]}):e.map(O)})]}),m&&(0,Q.jsx)(Qn,{preview:m}),S&&w&&(0,Fn.createPortal)((0,Q.jsxs)(`div`,{className:`fixed inset-0 z-[75] hidden sm:block`,children:[(0,Q.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":l(`common.close`),className:`absolute inset-0 cursor-default`,onClick:()=>C(null)}),(0,Q.jsxs)(`div`,{role:`menu`,"aria-label":D(w),"data-testid":`sidebar-work-task-menu`,className:`absolute overflow-y-auto rounded-xl border border-black/[0.04] bg-surface-overlay p-1 shadow-lv3 animate-scale-in dark:border-white/[0.06]`,style:{top:S.top,left:S.left,width:$n,maxHeight:er},children:[(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{C(null),E(w)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,children:[(0,Q.jsx)(ht,{className:`h-3.5 w-3.5 shrink-0`}),l(`chat.session.openNewTab`)]}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:i,"data-testid":`sidebar-work-task-delete`,onClick:()=>{C(null),s(w)},className:`mt-1 flex w-full items-center gap-2.5 rounded-lg border-t border-black/[0.06] px-2.5 py-2 text-start text-[13px] text-red-500 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/[0.07] dark:hover:bg-red-900/20`,children:[(0,Q.jsx)(mt,{className:`h-3.5 w-3.5 shrink-0`}),l(`work.tasks.delete`,{defaultValue:`Delete task`})]})]})]}),document.body),y&&(0,Fn.createPortal)((0,Q.jsxs)(`div`,{className:`fixed inset-0 z-[80] sm:hidden`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-black/35 backdrop-blur-[2px]`,onClick:()=>v(null),"aria-label":l(`common.close`)}),(0,Q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":l(`palette.actions`),className:`absolute inset-x-3 bottom-3 rounded-2xl border border-black/[0.08] bg-surface p-2 shadow-[0_20px_70px_rgba(0,0,0,0.3)] dark:border-white/[0.09] dark:bg-dark-100`,"data-testid":`sidebar-work-task-actions-sheet`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-2 pt-1`,children:[(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-dark-900`,children:D(y)}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>v(null),className:`h-9 w-9 shrink-0 rounded-xl p-0`,title:l(`common.close`),"aria-label":l(`common.close`),children:(0,Q.jsx)(G,{className:`h-4 w-4`})})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{v(null),E(y)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-3 text-start text-sm text-ink hover:bg-interactive-hover`,children:[(0,Q.jsx)(ht,{className:`h-4 w-4 shrink-0`}),l(`chat.session.openNewTab`)]}),(0,Q.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{v(null),s(y)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-3 text-start text-sm text-red-500 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-red-900/20`,children:[(0,Q.jsx)(mt,{className:`h-4 w-4 shrink-0`}),l(`work.tasks.delete`,{defaultValue:`Delete task`})]})]})]}),document.body)]})}function nr(e){let{t}=R(),n=(0,Z.useRef)(null),r=y({queryKey:[`users`,`pending-approvals`],enabled:e,queryFn:async()=>{let e=await Dt.getPendingApprovals();if(!e.success||!e.data)throw Error(e.message||`Could not load pending accounts`);return e.data},refetchInterval:6e4,refetchOnWindowFocus:!0});return(0,Z.useEffect)(()=>{if(!r.data)return;let e=n.current,i=e?!!(r.data.count>e.count||r.data.latestCreatedAt&&r.data.latestCreatedAt!==e.latestCreatedAt):r.data.count>0;n.current=r.data,i&&W(t(`userManager.approval.notification`,{count:r.data.count,defaultValue:`{{count}} registration(s) are waiting for your approval.`}),{icon:`👤`})},[r.data,t]),{...r,pendingApprovalCount:r.data?.count??0}}function rr(e){let{t}=R(),n=(0,Z.useRef)(null),r=y({queryKey:[`automations`,`runs-summary`],enabled:e,queryFn:async()=>{let e=await Ot.getRunsSummary();if(!e.success||!e.data)throw Error(e.error||`Could not load automation runs`);return e.data},refetchInterval:6e4,refetchOnWindowFocus:!0});return(0,Z.useEffect)(()=>{if(!r.data)return;let e=n.current,i=r.data.unseenCount;e!==null&&i>e&&W(t(`automations.finishedNotification`,{n:i}),{icon:`⚡`}),n.current=i},[r.data,t]),{...r,unseenRunCount:r.data?.unseenCount??0}}var ir=K(`components:sidebar`),ar=Z.lazy(()=>T(()=>import(`../js/SettingsModal-DP_wKehV.js`).then(e=>({default:e.SettingsModal})),__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]))),or=({isOpen:e,onClose:t,className:n})=>{let{t:r}=R(),i=O(),a=k(),{sessions:o,deleteSession:s,updateSessionTitle:c,setSessionArchived:l,setSessionPinned:u,folders:d,loadFolders:f,createFolder:p,renameFolder:m,deleteFolder:h,moveSessionToFolder:g,selectedModel:_,models:v,currentSession:y,generatingTitleForSession:b,personas:x}=le(),S=Ft(e=>e.tasks),C=Ft(e=>e.loadingTasks),w=Ft(e=>e.actionLoading),T=Ft(e=>e.deleteTask),{user:E,isAdmin:D,systemInfo:A,setUser:j,canUseWork:ee,canUseAgents:te}=q(),{backgroundImage:M,sidebarCompact:N,toggleSidebarCompact:P,isGenerating:ne,pinnedAdminShortcuts:F,toggleAdminShortcut:I}=zt(),L=b??(ne&&y&&Yt(y.title)?y.id:null),z=D(),{pendingApprovalCount:re}=nr(!!(E&&z&&A?.requiresAuth)),{unseenRunCount:ie}=rr(!!(E||A?.requiresAuth===!1)),[ae,oe]=(0,Z.useState)(null),[se,ce]=(0,Z.useState)(``),[ue,de]=(0,Z.useState)(!1),[V,H]=(0,Z.useState)(!1),[U,fe]=(0,Z.useState)(!1),[pe,me]=(0,Z.useState)(``),[he,ge]=(0,Z.useState)(!1),_e=(0,Z.useRef)(null),ve=(0,Z.useRef)(null),ye=i.pathname.match(/^\/c\/([^/]+)$/)?.[1]||y?.id,be=()=>{window.innerWidth<768&&!N&&P()},xe=()=>{Vt(`selection`),P()},Se=()=>{let{setCurrentSession:e}=le.getState();Bt(),e(null),sessionStorage.setItem(`forceWelcomeScreen`,`true`)};(0,Z.useEffect)(()=>{let e=e=>{_e.current&&!_e.current.contains(e.target)&&H(!1)};if(V)return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[V]),(0,Z.useEffect)(()=>{let t=t=>{ve.current&&!ve.current.contains(t.target)&&window.innerWidth<768&&e&&!N&&P()};if(e&&!N&&window.innerWidth<768)return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[e,N,P]);let Ce=async()=>{ge(!0);try{let e=await Dt.updateMyAvatar(pe||null);e.success&&e.data?(j(e.data),W.success(r(`user.avatar.updated`)),fe(!1)):W.error(e.message||r(`user.avatar.updateFailed`))}catch(e){ir.error(`Failed to update avatar:`,e),W.error(r(`user.avatar.updateFailed`))}finally{ge(!1)}},we=()=>{Vt(`impact`),Se(),a(`/chat`,{replace:!0}),be()},Te=()=>{Vt(`impact`),Ft.getState().clearError(),a(`/work`),be()},Ee=e=>{Vt(`selection`),a(`/c/${e.id}`,{replace:!0}),be()},De=e=>{Vt(`selection`),a(`/work/${e}`,{replace:!0}),be()},Oe=async e=>{if(window.confirm(r(`work.tasks.deleteConfirm`,{defaultValue:`Delete “{{title}}” and its workspace permanently?`,title:e.title||r(`work.tasks.untitled`,{defaultValue:`Untitled task`})}))){Vt(`warning`);try{await T(e.id),Lt(e.id),Pn.getState().closeTab(`work:${e.id}`),Be===e.id&&a(`/work`,{replace:!0,state:{deletedWorkTaskId:e.id}})}catch(e){ir.error(`Failed to delete Work task:`,e),W.error(r(`work.toasts.deleteFailed`,{defaultValue:`Could not delete this Work task.`}))}}},ke=async(e,t)=>{if(t.stopPropagation(),ir.debug(`Delete session clicked:`,e),window.confirm(r(`chat.session.deleteConfirm`))){Vt(`warning`);try{ir.debug(`Attempting to delete session:`,e);let t=ye===e;if(await s(e),ir.debug(`Session deleted successfully`),Pn.getState().closeTab(`chat:${e}`),t){let t=o.filter(t=>t.id!==e);t.length>0?a(`/c/${t[0].id}`,{replace:!0}):a(`/`,{replace:!0})}}catch(e){ir.error(`Error deleting session:`,e)}}};(0,Z.useEffect)(()=>{f()},[f]);let Ae=async(e,t)=>{if(t.stopPropagation(),await l(e,!0),Pn.getState().closeTab(`chat:${e}`),ye===e){let t=o.filter(t=>t.id!==e&&!t.archived);t.length>0?a(`/c/${t[0].id}`,{replace:!0}):a(`/`,{replace:!0})}},je=(e,t)=>{u(e,t)},Me=(e,t)=>{t.stopPropagation(),oe(e.id),ce(e.title)},Ne=async e=>{se.trim()&&await c(e,se.trim()),oe(null),ce(``)},Pe=()=>{oe(null),ce(``)},Fe=async()=>{try{await Tt.logout();let{logout:e}=q.getState();e(),a(`/login`),W.success(r(`auth.logout.success`))}catch(e){ir.error(`Logout error:`,e);let{logout:t}=q.getState();t(),a(`/login`)}},Ie=()=>{de(!0),be()},Le=e=>{me(e),fe(!0)},Re=window.location.protocol===`file:`,ze=i.pathname===`/work`||i.pathname.startsWith(`/work/`),Be=i.pathname.match(/^\/work\/([^/]+)$/)?.[1]||null,Ve=i.pathname===`/`||i.pathname===`/chat`||i.pathname.startsWith(`/c/`),He=ee();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:ve,"data-testid":`sidebar`,className:B(`fixed inset-y-0 start-0 z-50 max-lg:border-e border-black/[0.04] dark:border-white/[0.06] transform transition-[width,transform,background-color] duration-200 ease-out shadow-[0_24px_80px_rgba(15,23,42,0.12)]`,N?`w-16`:`w-72 max-sm:w-[calc(100vw-4.5rem)] max-sm:max-w-80`,e?`translate-x-0`:`ltr:-translate-x-full rtl:translate-x-full`,`lg:shadow-none`,M?`bg-sidebar/75 backdrop-blur-xl`:`bg-sidebar`,`overscroll-behavior-contain`,n),style:{WebkitOverflowScrolling:`touch`},children:[Re&&(0,Q.jsx)(`div`,{className:`absolute top-0 start-16 end-0 h-8 z-[60]`,style:{WebkitAppRegion:`drag`}}),(0,Q.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,Q.jsx)(Rn,{sidebarCompact:N,isElectron:Re,showWork:He,activeMode:ze?`work`:Ve?`chat`:null,selectedModel:_,modelCount:v.length,onToggleCompact:xe,onStartWork:Te,onCreateSession:we}),!N&&(0,Q.jsx)(Bn,{sidebarCompact:N,activePath:i.pathname,showAgents:te(),unseenRunCount:ie,onMobileNavigate:be}),ze&&He?(0,Q.jsx)(tr,{tasks:S,personas:x,currentTaskId:Be,loading:C,actionLoading:w,sidebarCompact:N,onSelectTask:De,onDeleteTask:e=>void Oe(e),onExpandSidebar:xe}):(0,Q.jsx)(Gn,{sessions:o.filter(e=>!e.archived),personas:x,currentSessionId:ye,generatingTitleForSession:L,sidebarCompact:N,editingSessionId:ae,editingTitle:se,onEditingTitleChange:ce,onSelectSession:Ee,onStartEditing:Me,onSaveEdit:Ne,onCancelEdit:Pe,onDeleteSession:ke,onArchiveSession:Ae,onTogglePinSession:je,folders:d,onCreateFolder:e=>void p(e),onRenameFolder:(e,t)=>void m(e,t),onDeleteFolder:e=>void h(e),onMoveSession:(e,t)=>void g(e,t),onExpandSidebar:xe}),(0,Q.jsx)(Xn,{sidebarCompact:N}),(0,Q.jsx)(Jn,{requiresAuth:A?.requiresAuth,user:E,isAdmin:z,pendingApprovalCount:re,sidebarCompact:N,userMenuOpen:V,userMenuRef:_e,pinnedShortcuts:F,onToggleShortcutPin:I,onToggleUserMenu:()=>H(e=>!e),onOpenSettings:Ie,onOpenAvatar:Le,onLogout:Fe,onMobileNavigate:be,onCloseUserMenu:()=>H(!1)})]})]}),ue&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(ar,{isOpen:ue,onClose:()=>de(!1)})}),(0,Q.jsx)(In,{open:U,value:pe,saving:he,onChange:me,onClose:()=>fe(!1),onSave:Ce})]})},$=({children:e,requireAuth:t=!0,requireAdmin:n=!1,requireWork:r=!1,requireAgents:i=!1})=>{let{isAuthenticated:a,user:o,systemInfo:s,isLoading:c,canUseWork:l}=q();return O(),c?(0,Q.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 dark:bg-dark-50`,children:(0,Q.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-200 dark:border-dark-300 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}):i&&s?.agentsEnabled!==!0?(0,Q.jsx)(M,{to:`/`,replace:!0}):s&&!s.requiresAuth?(0,Q.jsx)(Q.Fragment,{children:e}):t&&!a?(0,Q.jsx)(M,{to:`/login`,replace:!0}):n&&(!o||o.role!==`admin`)||r&&!l()?(0,Q.jsx)(M,{to:`/`,replace:!0}):(0,Q.jsx)(Q.Fragment,{children:e})},sr=K(`components:error-boundary`),cr=({error:e})=>{let{t}=R();return(0,Q.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4 text-gray-900 dark:text-dark-800`,children:(0,Q.jsx)(`div`,{className:`w-full max-w-md rounded-2xl border border-gray-200 dark:border-dark-300 bg-white/95 dark:bg-dark-100/95 shadow-card backdrop-blur-sm`,children:(0,Q.jsxs)(`div`,{className:`p-6 text-center`,children:[(0,Q.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-primary-100 text-primary-700 dark:bg-primary-900/35 dark:text-primary-300 ring-1 ring-primary-200 dark:ring-primary-800/60`,children:(0,Q.jsx)(Ge,{className:`h-6 w-6`})}),(0,Q.jsx)(`h1`,{className:`mb-2 text-xl font-semibold text-gray-950 dark:text-dark-950`,children:t(`errorBoundary.title`)}),(0,Q.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-gray-600 dark:text-dark-600`,children:t(`errorBoundary.description`)}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:justify-center`,children:[(0,Q.jsxs)(`button`,{onClick:()=>window.location.reload(),className:`inline-flex items-center justify-center gap-2 rounded-xl bg-primary-600 px-4 py-2.5 text-sm font-medium text-white shadow-sm transition-all hover:bg-primary-700 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:focus:ring-offset-dark-100`,children:[(0,Q.jsx)(je,{className:`h-4 w-4`}),t(`errorBoundary.tryAgain`)]}),(0,Q.jsxs)(`button`,{onClick:()=>{window.location.assign(`/`)},className:`inline-flex items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm font-medium text-gray-700 shadow-sm transition-all hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:border-dark-300 dark:bg-dark-50 dark:text-dark-700 dark:hover:bg-dark-200 dark:focus:ring-offset-dark-100`,children:[(0,Q.jsx)(Oe,{className:`h-4 w-4`}),t(`common.home`,`Home`)]})]}),!1]})})})},lr=()=>{let e=ee();(0,Z.useEffect)(()=>{sr.error(`Route error screen caught an error:`,e)},[e]);let t=e instanceof Error?e:A(e)?Error(`${e.status} ${e.statusText}`):Error(String(e));return(0,Q.jsx)(cr,{error:t})},ur=class extends Z.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){sr.error(`ErrorBoundary caught an error:`,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,Q.jsx)(cr,{error:this.state.error}):this.props.children}},dr=({notes:e,onDismiss:t})=>{let{t:n}=R();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-black/55 backdrop-blur-sm transition-opacity duration-200`,onClick:t}),(0,Q.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`whatsNew.title`),onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,Q.jsxs)(`div`,{className:`flex max-h-[82vh] w-full max-w-2xl flex-col rounded-3xl border border-gray-200/80 bg-surface/95 shadow-2xl backdrop-blur-xl animate-scale-in dark:border-white/10 dark:bg-dark-25/95`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between px-6 pb-3 pt-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-xl font-semibold tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:n(`whatsNew.title`)}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:[n(`whatsNew.releaseNotes`),` · v`,e.version,` · `,e.date]})]}),(0,Q.jsx)(`button`,{onClick:t,className:`rounded-full p-2 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-dark-600 dark:hover:bg-white/[0.06] dark:hover:text-dark-900`,title:n(`common.close`),children:(0,Q.jsx)(G,{className:`h-4 w-4`})})]}),(0,Q.jsx)(`div`,{className:`scroll-region min-h-0 flex-1 overflow-y-auto px-6 py-3 scrollbar-thin`,children:(0,Q.jsx)(r,{components:{h3:({children:e})=>(0,Q.jsx)(`h3`,{className:`mb-2 mt-5 text-[11px] font-semibold uppercase tracking-[0.1em] text-primary-600 first:mt-0 dark:text-primary-400`,children:e}),ul:({children:e})=>(0,Q.jsx)(`ul`,{className:`space-y-2.5`,children:e}),li:({children:e})=>(0,Q.jsxs)(`li`,{className:`flex gap-2 text-[13.5px] leading-relaxed text-gray-700 dark:text-dark-700`,children:[(0,Q.jsx)(`span`,{className:`mt-[7px] h-1 w-1 shrink-0 rounded-full bg-gray-300 dark:bg-dark-400`}),(0,Q.jsx)(`span`,{className:`min-w-0`,children:e})]}),strong:({children:e})=>(0,Q.jsx)(`strong`,{className:`font-semibold text-gray-900 dark:text-dark-900`,children:e}),a:({children:e,href:t})=>(0,Q.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`text-primary-600 underline decoration-primary-300 underline-offset-2 hover:text-primary-700 dark:text-primary-400`,children:e}),code:({children:e})=>(0,Q.jsx)(`code`,{className:`rounded-md border border-gray-200 bg-gray-100 px-1 py-0.5 font-mono text-[0.85em] text-gray-800 dark:border-dark-300 dark:bg-dark-200 dark:text-dark-800`,children:e}),p:({children:e})=>(0,Q.jsx)(`p`,{className:`mb-2 text-[13.5px] leading-relaxed text-gray-700 dark:text-dark-700`,children:e})},children:e.body})}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-gray-200/70 px-6 py-4 dark:border-white/[0.08]`,children:[(0,Q.jsxs)(`a`,{href:`https://github.com/libre-webui/libre-webui`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-1.5 text-xs text-gray-500 transition-colors hover:text-gray-900 dark:text-dark-500 dark:hover:text-dark-900`,children:[(0,Q.jsx)(we,{className:`h-3.5 w-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:n(`whatsNew.starAsk`)})]}),(0,Q.jsx)(J,{onClick:t,size:`sm`,children:n(`whatsNew.cta`)})]})]})})]})},fr=`libre-webui:whats-new-seen`;function pr(){let e={version:`0.29.0`,date:`2026-08-28`,body:`Personas can now become persistent Work agents: hire one into a pinned sidebar
3
- identity, revisit its screen and taught skills, schedule routines inside its
4
- existing workspace, and receive notifications when it finishes or needs
5
- attention. Model curation gains persistent stars, while Work gets dictation,
6
- direct file shortcuts, and a calmer, more reliable computer sandbox.
7
-
8
- ### ✨ New Features
9
-
10
- - **Hire personas as named Work agents.** Choose a persona when creating a Work
11
- task and it becomes a persistent agent with that persona's name, avatar, and
12
- instructions. Agents stay pinned above one-off tasks, show concise status and
13
- unread activity, and remain available in the compact sidebar.
14
- - **A home for every agent.** The new Agent tab combines identity, a live
15
- view-only screen thumbnail, scheduled routines, and taught skills. Routines
16
- run inside the agent's existing conversation and workspace instead of
17
- creating a fresh task, while completion, attention, and takeover
18
- notifications link directly back to the agent. Ships with schema migrations
19
- (SQLite v25–v27 / PostgreSQL v24–v26).
20
- - **Star important models.** Administrators can star models in the shared
21
- catalog, placing favorites first in both the catalog and default-model
22
- picker. Several stars follow most-recently-starred order, and removing one
23
- restores its manual or provider position.
24
- - **Dictate Work instructions and open results directly.** The Work composer
25
- now accepts browser speech recognition or configured speech-to-text, and
26
- files created or moved by an agent appear as clickable chips that open
27
- directly in the workspace editor.
28
- - **A living Work Computer start page.** The sandbox desktop gains an offline,
29
- time-aware Sunset Valley scene and built-in, checksum-verified blocking for
30
- ads, trackers, and cookie-consent banners.
31
-
32
- ### 🔧 Improvements
33
-
34
- - Persona identity now carries through model selectors, header chips, and
35
- assistant replies in both Chat and Work, with consistent avatar presentation.
36
- - Settings → Model is now **Defaults**, separating model defaults and catalog
37
- curation from the **Models** manager. The existing bulk Ollama updater now
38
- lives with the installed-model controls, reports per-model progress, and
39
- refreshes the list when it completes.
40
- - The persona editor now uses one clear Save action, stays open after the server
41
- confirms a create or update, and shows an accessible saved state.
42
- - Tool-server save and refresh failures now show the backend's specific reason
43
- instead of a generic error.
44
- - Recommended starter models and hardware guidance now reflect the Gemma 4 and
45
- Qwen 3.8 lineups rather than the older 2024 suggestions.
46
-
47
- ### 🐛 Bug Fixes
48
-
49
- - Persona-backed replies resolve the persona's display name instead of exposing
50
- its raw identifier in model-trigger UI.
51
- - Work Computer runs no longer fail when a provider rejects screenshots: the
52
- run switches to text-only observations, records the degradation, and
53
- continues.
54
- - The animated start scene renders as time-keyed stills so it remains
55
- responsive under the GPU-less SwiftShader sandbox, with improved
56
- initialization and the existing PNG fallback retained.
57
- - Containerized backends now reach Docker-published Work preview, screen, and
58
- audio ports through the configured host address, including working Docker
59
- Desktop defaults.
60
- - Work Computer audio now loads its processor from a same-origin asset, fixing
61
- playback under the production Content Security Policy.
62
- - The cross-replica replay drill now seeds current event timestamps so retention
63
- cannot remove fixtures during its assertion.
64
-
65
- ### 🌍 Translations
66
-
67
- - Added 89 localized interface messages across all 25 shipped languages for
68
- agents, routines, model starring, Work file links, startup and OAuth errors,
69
- chat actions, uploads, settings, model operations, and portable archive
70
- import/export.
71
- - Previously hardcoded toast messages now use the translation catalog, and
72
- portable archive parse failures expose stable error codes for localized
73
- validation.
74
-
75
- ### 🔒 Security & Dependencies
76
-
77
- - Container builds now refresh the runner stage without reusing stale
78
- OS-package layers, ensuring current Alpine and OpenSSL fixes reach security
79
- scans and published images.
80
- - Refreshed AWS SDK, UUID, Framer Motion, i18next, Lucide, Mermaid, React
81
- i18next, Vite, and PostgreSQL type dependencies.
82
- - Work Computer browser extensions are version-pinned and checksum-verified
83
- during image construction.
84
-
85
- ### 📚 Documentation
86
-
87
- - Expanded the Work, Automations, and Notifications guides for hired agents,
88
- task-bound routines, unread state, Work notifications, content blocking,
89
- screenshot degradation, and Docker-published port routing.
90
- - Updated model-management guidance for stars, the Defaults/Models split, bulk
91
- updates, and the current recommended model lineup.
92
- - Refreshed the Work Computer screenshot and corrected documentation media
93
- metadata and demo links.`},[t,n]=(0,Z.useState)(()=>{if(!e||typeof window>`u`)return!1;try{return window.localStorage.getItem(fr)!==e.version}catch{return!1}});return(0,Z.useEffect)(()=>{let e=()=>n(!0);return window.addEventListener(`libre:open-whats-new`,e),()=>window.removeEventListener(`libre:open-whats-new`,e)},[]),{open:t,dismiss:()=>{if(n(!1),e)try{window.localStorage.setItem(fr,e.version)}catch{}},notes:e}}var mr=({message:e=`This is a demo version for presentation purposes only. The Ollama backend is not connected.`,onDismiss:t,className:n})=>{let[r,i]=(0,Z.useState)(!1),{t:a}=R();return r?null:(0,Q.jsx)(`div`,{className:B(`bg-gray-950 text-white dark:bg-white dark:text-gray-950`,`border-b border-black/10 dark:border-white/10`,`px-4 py-2`,n),children:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between max-w-6xl mx-auto gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,Q.jsx)(`div`,{className:`flex-shrink-0`,children:(0,Q.jsx)(xe,{className:`h-4 w-4 text-white/65 dark:text-gray-950/60`})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Q.jsx)(`p`,{className:`shrink-0 text-xs font-semibold tracking-wide`,children:a(`demoMode.title`)}),(0,Q.jsx)(`p`,{className:`hidden truncate text-xs text-white/60 dark:text-gray-950/60 sm:block`,children:e})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,Q.jsxs)(J,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-white/70 hover:bg-white/10 hover:text-white dark:text-gray-950/70 dark:hover:bg-black/[0.06] dark:hover:text-gray-950`,onClick:()=>window.open(`https://github.com/libre-webui/libre-webui`,`_blank`),title:`View on GitHub`,children:[(0,Q.jsx)(ht,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:a(`demoMode.github`)})]}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>{i(!0),t?.()},className:`h-8 w-8 p-0 text-white/70 hover:bg-white/10 hover:text-white dark:text-gray-950/70 dark:hover:bg-black/[0.06] dark:hover:text-gray-950`,title:`Dismiss`,children:(0,Q.jsx)(G,{className:`h-4 w-4`})})]})]})})},hr=()=>{let{preferences:e,backgroundImage:t}=zt(),n=e.backgroundSettings||{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6},r=t||n.imageUrl;return!n.enabled||!r?null:(0,Q.jsx)(`div`,{"data-testid":`app-background`,className:`fixed inset-0 pointer-events-none z-0`,style:{backgroundImage:`url(${r})`,backgroundSize:`cover`,backgroundPosition:`center`,backgroundRepeat:`no-repeat`,filter:`blur(${n.blurAmount}px)`,opacity:n.opacity,transform:`scale(1.1)`}})},gr={"/notes":{icon:pt,labelKey:`sidebar.navigation.notes`},"/calendar":{icon:Me,labelKey:`sidebar.navigation.calendar`},"/automations":{icon:lt,labelKey:`sidebar.navigation.automations`},"/channels":{icon:_t,labelKey:`sidebar.navigation.channels`},"/personas":{icon:Be,labelKey:`sidebar.navigation.personas`},"/gallery":{icon:V,labelKey:`sidebar.navigation.imagine`},"/agents":{icon:Qe,labelKey:`sidebar.navigation.agents`},"/users":{icon:st,labelKey:`sidebar.navigation.userManagement`},"/usage":{icon:tt,labelKey:`usageAnalytics.title`},"/system":{icon:De,labelKey:`systemPage.title`},"/artifacts":{icon:Ze,labelKey:`tabs.artifacts`}},_r=e=>e.kind===`home`?Oe:e.kind===`chat`?Ce:e.kind===`work`?Pe:gr[e.path]?.icon??Ze,vr=()=>z()?`⌘`:`Ctrl`,yr=new Set([`/agents`,`/users`,`/usage`,`/system`]),br=(e,t)=>e.kind===`work`?!t:yr.has(e.path),xr=()=>{let{t:e}=R(),t=O(),n=k(),r=Pn(e=>e.tabs),i=Pn(e=>e.activeTabId),a=Pn(e=>e.syncWithPath),o=Pn(e=>e.closeTab),s=Pn(e=>e.closeTabs),c=le(e=>e.sessions),l=le(e=>e.currentSession),u=Ft(e=>e.tasks),{systemInfo:d,isAdmin:f,canUseWork:p,canUseAgents:m}=q(),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(null),x=(0,Z.useRef)(null),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w=(0,Z.useRef)(null),T=(0,Z.useRef)(null),E=f(),D=d?.requiresAuth===!1||E,A=p(),j=D?r:r.filter(e=>!br(e,A));(0,Z.useEffect)(()=>{a(t.pathname)},[t.pathname,a]),(0,Z.useEffect)(()=>{(T.current?.querySelector(`[data-active="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},[j.length,i]),(0,Z.useEffect)(()=>{if(!d||D)return;let e=r.filter(e=>br(e,A)).map(e=>e.id);if(e.length===0)return;let t=s(e,`home`);t&&n(t.path,{replace:!0})},[s,n,D,A,d,r]),(0,Z.useEffect)(()=>{if(!h&&!y)return;let e=e=>{let t=e.target;!x.current?.contains(t)&&!S.current?.contains(t)&&!w.current?.contains(t)&&(g(!1),b(null))},t=e=>{e.key===`Escape`&&(g(!1),b(null))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[y,h]),(0,Z.useEffect)(()=>{if(!h)return;let e=()=>{let e=C.current;if(!e)return;let t=e.getBoundingClientRect(),n=e.closest(`[data-testid="app-shell-content"]`)?.getBoundingClientRect(),r=n?.left??0,i=n?.right??window.innerWidth,a=r+8,o=i-8,s=Math.max(0,Math.min(224,o-a)),c=o-t.left>=s?t.left:t.right-s,l=Math.max(a,Math.min(c,o-s));v({left:l,top:t.bottom+4,width:s})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[h]),(0,Z.useEffect)(()=>{y&&w.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()},[y]);let ee=t=>{if(t.kind===`home`)return e(`tabs.home`,`Home`);if(t.kind===`chat`){if(t.id===`chat:new`)return l?.isPrivate?e(`chat.session.incognito`,`Incognito Chat`):e(`tabs.newChat`,`New Chat`);let n=t.id.slice(5);return c.find(e=>e.id===n)?.title||e(`tabs.chat`,`Chat`)}if(t.kind===`work`){if(t.id===`work:new`)return e(`tabs.work`,`Work`);let n=t.id.slice(5);return u.find(e=>e.id===n)?.title||e(`tabs.work`,`Work`)}let n=gr[t.path];return n?e(n.labelKey,t.path.slice(1)):t.path.slice(1)},te=(e,t)=>{e.stopPropagation(),e.preventDefault();let r=o(t.id);r&&n(r.path)},M=(e,t,n)=>{g(!1),b({tabId:e.id,x:Math.max(8,Math.min(t,window.innerWidth-224-8)),y:Math.max(8,Math.min(n,window.innerHeight-176-8))})},N=(e,t)=>{e.preventDefault(),e.stopPropagation(),M(t,e.clientX,e.clientY)},P=(e,t)=>{if(e.key!==`ContextMenu`&&!(e.shiftKey&&e.key===`F10`))return;e.preventDefault();let n=e.currentTarget.getBoundingClientRect();M(t,n.left+12,n.bottom+4)},ne=e=>{let t=Array.from(w.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]);if(t.length===0)return;let n=t.indexOf(document.activeElement),r=n;if(e.key===`ArrowDown`)r=(n+1+t.length)%t.length;else if(e.key===`ArrowUp`)r=(n-1+t.length)%t.length;else if(e.key===`Home`)r=0;else if(e.key===`End`)r=t.length-1;else return;e.preventDefault(),t[r]?.focus()},F=(e,t)=>{let r=s(e,t);b(null),r&&n(r.path)},I=[{key:`chat`,label:e(`tabs.newChat`,`New Chat`),icon:Ce,shortcut:`${vr()}⇧O`,action:()=>Xt(n)},{key:`incognito-chat`,label:e(`chat.session.incognito`,`Incognito Chat`),icon:Ve,action:()=>Qt(n)},...A?[{key:`work`,label:e(`tabs.newWork`,`New Work`),icon:Pe,shortcut:`${vr()}⇧U`,action:()=>Zt(n)}]:[],...[`/channels`,`/notes`,`/calendar`,`/automations`,`/personas`,`/gallery`].map(t=>({key:t,label:e(gr[t].labelKey,t.slice(1)),icon:gr[t].icon,action:()=>n(t)})),...m()?[{key:`/agents`,label:e(gr[`/agents`].labelKey,`Agents`),icon:gr[`/agents`].icon,separatorBefore:!0,action:()=>n(`/agents`)}]:[],...E?[`/users`,`/system`,`/usage`].map(t=>({key:t,label:e(gr[t].labelKey,t.slice(1)),icon:gr[t].icon,action:()=>n(t)})):[]],L=y?j.find(e=>e.id===y.tabId):void 0,z=L?j.findIndex(e=>e.id===L.id):-1,re=L?j.filter(e=>e.id!==`home`&&e.id!==L.id).map(e=>e.id):[],ie=z>=0?j.slice(z+1).filter(e=>e.id!==`home`).map(e=>e.id):[],ae=j.filter(e=>e.id!==`home`).map(e=>e.id);return(0,Q.jsxs)(`div`,{"data-testid":`app-tab-bar`,className:`relative z-20 flex h-9 flex-none items-center gap-1 px-1 pb-1 lg:px-0`,children:[(0,Q.jsx)(`div`,{ref:T,role:`tablist`,"aria-label":e(`tabs.label`,`Open tabs`),className:`flex min-w-0 items-center gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:j.map(t=>{let r=t.id===`chat:new`&&l?.isPrivate?Ve:_r(t),a=t.id===i;return(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":a,"data-active":a||void 0,"data-tab-id":t.id,"data-testid":`app-tab`,title:ee(t),onClick:()=>n(t.path),onContextMenu:e=>N(e,t),onKeyDown:e=>P(e,t),onAuxClick:e=>{e.button===1&&t.id!==`home`&&te(e,t)},className:B(`group flex h-7 min-w-0 flex-none items-center gap-1.5 rounded-lg border text-[13px] transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40`,t.id===`home`?`px-2.5`:`ps-2.5 pe-1`,a?`border-black/[0.06] bg-gray-50 text-gray-950 shadow-subtle dark:border-white/[0.07] dark:bg-dark-100 dark:text-dark-950`:`border-transparent text-gray-500 hover:bg-white/60 hover:text-gray-900 dark:text-dark-600 dark:hover:bg-dark-200/60 dark:hover:text-dark-900`),children:[(0,Q.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`max-w-[9rem] truncate`,children:ee(t)}),t.id!==`home`&&(0,Q.jsx)(`span`,{role:`button`,tabIndex:-1,"aria-label":e(`tabs.close`,`Close tab`),"data-testid":`app-tab-close`,onClick:e=>te(e,t),className:B(`flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-gray-400 transition-opacity hover:bg-black/[0.06] hover:text-gray-700 dark:text-dark-500 dark:hover:bg-white/[0.08] dark:hover:text-dark-800`,a?`opacity-100`:`sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-visible:opacity-100`),children:(0,Q.jsx)(G,{className:`h-3 w-3`})})]},t.id)})}),y&&L&&(0,Fn.createPortal)((0,Q.jsxs)(`div`,{ref:w,role:`menu`,"aria-label":e(`tabs.actions`,`Tab actions`),"data-testid":`app-tab-context-menu`,onContextMenu:e=>e.preventDefault(),onKeyDown:ne,className:`fixed z-[100] w-56 rounded-xl border border-line bg-surface-overlay/95 p-1 shadow-overlay backdrop-blur-xl animate-fade-in motion-reduce:animate-none`,style:{left:y.x,top:y.y},children:[(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close`,disabled:L.id===`home`,onClick:()=>{let e=o(L.id);b(null),e&&n(e.path)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-ink-muted transition-colors hover:bg-black/[0.05] hover:text-ink disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-white/[0.06]`,children:[(0,Q.jsx)(G,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{children:e(`tabs.close`,`Close tab`)})]}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close-others`,disabled:re.length===0,onClick:()=>F(re,L.id),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-ink-muted transition-colors hover:bg-black/[0.05] hover:text-ink disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-white/[0.06]`,children:[(0,Q.jsx)(H,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{children:e(`tabs.closeOthers`,`Close other tabs`)})]}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close-right`,disabled:ie.length===0,onClick:()=>F(ie,L.id),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-ink-muted transition-colors hover:bg-black/[0.05] hover:text-ink disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-white/[0.06]`,children:[(0,Q.jsx)($e,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{children:e(`tabs.closeRight`,`Close tabs to the right`)})]}),(0,Q.jsx)(`div`,{className:`mx-2 my-1 h-px bg-line`,role:`separator`}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close-all`,disabled:ae.length===0,onClick:()=>F(ae,`home`),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-ink-muted transition-colors hover:bg-black/[0.05] hover:text-ink disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-white/[0.06]`,children:[(0,Q.jsx)(ve,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{children:e(`tabs.closeAll`,`Close all tabs`)})]})]}),document.body),(0,Q.jsxs)(`div`,{className:`relative flex-none`,ref:x,children:[(0,Q.jsx)(`button`,{ref:C,type:`button`,"aria-label":e(`tabs.new`,`New tab`),"aria-expanded":h,"data-testid":`app-tab-new`,onClick:()=>g(e=>!e),className:`flex h-7 w-7 items-center justify-center rounded-lg text-gray-500 transition-colors hover:bg-white/60 hover:text-gray-900 dark:text-dark-600 dark:hover:bg-dark-200/60 dark:hover:text-dark-900 outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40`,children:(0,Q.jsx)(Ne,{className:`h-4 w-4`})}),h&&_&&(0,Fn.createPortal)((0,Q.jsx)(`div`,{ref:S,role:`menu`,"data-testid":`app-tab-new-menu`,className:`fixed z-[100] max-h-[calc(100dvh-4rem)] overflow-y-auto rounded-xl border border-line bg-surface-overlay/95 p-1 shadow-overlay backdrop-blur-xl animate-fade-in motion-reduce:animate-none`,style:_,children:I.map(e=>(0,Q.jsxs)(Z.Fragment,{children:[e.separatorBefore&&(0,Q.jsx)(`div`,{className:`mx-2 my-1 h-px bg-line`,role:`separator`}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{g(!1),e.action()},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-ink-muted transition-colors hover:bg-black/[0.05] hover:text-ink dark:hover:bg-white/[0.06]`,children:[(0,Q.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-start`,children:e.label}),e.shortcut&&(0,Q.jsx)(`span`,{className:`font-mono text-[10px] tracking-wide text-ink-subtle`,children:e.shortcut})]})]},e.key))}),document.body)]})]})},Sr=24;function Cr(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(!n)return{score:0,ranges:[]};let i=r.indexOf(n);if(i!==-1)return{score:100+(i===0||/[\s\-_/.]/.test(r[i-1])?40:0)-Math.min(i,20)-Math.min(r.length-n.length,10)/10,ranges:[[i,i+n.length]]};let a=[],o=0,s=0;for(let e=0;e<n.length;e++){let t=r.indexOf(n[e],s);if(t===-1)return null;let i=a.length>0&&t===s,c=t===0||/[\s\-_/.]/.test(r[t-1]);o+=2+(i?4:0)+(c?6:0),i||(o-=Math.min(t-s,6)/2);let l=a[a.length-1];l&&l[1]===t?l[1]=t+1:a.push([t,t+1]),s=t+1}return{score:o,ranges:a}}function wr({text:e,ranges:t}){if(t.length===0)return(0,Q.jsx)(Q.Fragment,{children:e});let n=[],r=0;return t.forEach(([t,i],a)=>{t>r&&n.push(e.slice(r,t)),n.push((0,Q.jsx)(`span`,{className:`font-semibold text-ink`,children:e.slice(t,i)},a)),r=i}),r<e.length&&n.push(e.slice(r)),(0,Q.jsx)(Q.Fragment,{children:n})}var Tr=({onOpenSettings:e,onOpenSettingsTab:t})=>{let{t:n,i18n:r}=R(),i=k(),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(0),d=(0,Z.useRef)(null),f=(0,Z.useRef)(null),p=le(e=>e.sessions),m=Ft(e=>e.tasks),h=zt(e=>e.toggleTheme),{canUseWork:g,canUseAgents:_}=q(),v=g(),y=_(),b=z()?`⌘`:`Ctrl`;(0,Z.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),c(``),u(0),o(e=>!e))},t=()=>{c(``),u(0),o(!0)};return document.addEventListener(`keydown`,e,!0),window.addEventListener(`libre:open-palette`,t),()=>{document.removeEventListener(`keydown`,e,!0),window.removeEventListener(`libre:open-palette`,t)}},[]),(0,Z.useEffect)(()=>{if(!a)return;let e=window.requestAnimationFrame(()=>d.current?.focus());return()=>window.cancelAnimationFrame(e)},[a]);let x=(0,Z.useCallback)(()=>o(!1),[]),[S,C]=(0,Z.useState)(null);S!==null&&(!a||s.trim().length<3)&&C(null),(0,Z.useEffect)(()=>{let e=s.trim();if(!a||e.length<3)return;let t=!1,n=window.setTimeout(()=>{Nt.searchApp(e).then(e=>{!t&&e.success&&e.data&&C(e.data)}).catch(()=>{})},300);return()=>{t=!0,window.clearTimeout(n)}},[s,a]);let w=(0,Z.useMemo)(()=>{let a=n(`palette.actions`,`Actions`),o=[{id:`action:new-chat`,section:a,label:n(`tabs.newChat`,`New Chat`),icon:Ce,hint:`${b}⇧O`,keywords:`new chat conversation start`,run:()=>Xt(i)},{id:`action:incognito-chat`,section:a,label:n(`chat.session.incognito`,`Incognito Chat`),icon:Ve,keywords:`incognito private temporary ghost`,run:()=>Qt(i)},...v?[{id:`action:new-work`,section:a,label:n(`tabs.newWork`,`New Work`),icon:Pe,hint:`${b}⇧U`,keywords:`new work task workspace`,run:()=>Zt(i)}]:[],{id:`action:home`,section:a,label:n(`tabs.home`,`Home`),icon:Oe,run:()=>i(`/`)},{id:`action:models`,section:a,label:n(`sidebar.navigation.models`,`Models`),icon:Se,keywords:`models ollama providers llm`,run:()=>t(`model-manager`)},{id:`action:personas`,section:a,label:n(`sidebar.navigation.personas`,`Personas`),icon:Be,run:()=>i(`/personas`)},{id:`action:gallery`,section:a,label:n(`sidebar.navigation.imagine`,`Imagine`),icon:V,keywords:`imagine images generation gallery pictures`,run:()=>i(`/gallery`)},{id:`action:calendar`,section:a,label:n(`sidebar.navigation.calendar`,`Calendar`),icon:Me,keywords:`calendar events schedule agenda`,run:()=>i(`/calendar`)},{id:`action:channels`,section:a,label:n(`sidebar.navigation.channels`,`Channels`),icon:_t,keywords:`channels team messages dm direct chat rooms`,run:()=>i(`/channels`)},{id:`action:automations`,section:a,label:n(`sidebar.navigation.automations`,`Automations`),icon:lt,keywords:`automations schedule cron recurring routines`,run:()=>i(`/automations`)},{id:`action:prompts`,section:a,label:n(`sidebar.navigation.prompts`,`Prompts`),icon:at,keywords:`prompts templates slash snippets library`,run:()=>t(`prompts`)},{id:`action:skills`,section:a,label:n(`sidebar.navigation.skills`,`Skills`),icon:nt,keywords:`skills instructions playbooks load_skill`,run:()=>t(`skills`)},{id:`action:tools`,section:a,label:n(`sidebar.navigation.tools`,`Tools`),icon:rt,keywords:`tools servers mcp openapi integrations approvals`,run:()=>t(`tools`)},...y?[{id:`action:agents`,section:a,label:n(`sidebar.navigation.agents`,`Agents`),icon:Qe,run:()=>i(`/agents`)}]:[],{id:`action:settings`,section:a,label:n(`palette.settings`,`Settings`),icon:vt,hint:`${b},`,keywords:`settings preferences configuration options`,run:e},{id:`action:theme`,section:a,label:n(`palette.toggleTheme`,`Toggle theme`),icon:et,hint:`${b}D`,keywords:`theme dark light mode appearance`,run:h}],s=[...p].sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>({id:`session:${e.id}`,section:n(`palette.chats`,`Chats`),label:e.title||n(`tabs.chat`,`Chat`),icon:Ce,hint:re(e.updatedAt,r.language),keywords:e.model,run:()=>i(`/c/${e.id}`)})),c=v?[...m].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:`work:${e.id}`,section:n(`palette.work`,`Work`),label:e.title||n(`work.tasks.untitled`,`Untitled task`),icon:Pe,hint:e.status,run:()=>i(`/work/${e.id}`)})):[];return[...o,...s,...c]},[n,b,i,e,t,h,p,m,v,y,r.language]),T=(0,Z.useMemo)(()=>{let e=s.trim();if(!e){let e=w.filter(e=>e.id.startsWith(`action:`)),t=w.filter(e=>e.id.startsWith(`session:`)).slice(0,6),n=w.filter(e=>e.id.startsWith(`work:`)).slice(0,4);return[...e,...t,...n].map(e=>({item:e,ranges:[]}))}let r=w.flatMap(t=>{let n=Cr(e,t.label);if(n)return[{item:t,...n}];let r=t.keywords?Cr(e,t.keywords):null;return r?[{item:t,score:r.score-30,ranges:[]}]:[]}),a=new Map;r.forEach(({item:e,score:t})=>{let n=a.get(e.section);(n===void 0||t>n)&&a.set(e.section,t)});let o=r.sort((e,t)=>(a.get(t.item.section)??0)-(a.get(e.item.section)??0)||e.item.section.localeCompare(t.item.section)||t.score-e.score).slice(0,Sr).map(({item:e,ranges:t})=>({item:e,ranges:t}));if(!S)return o;let c=new Set(o.filter(e=>e.item.id.startsWith(`session:`)).map(e=>e.item.id.slice(8))),l=[...S.sessions.filter(e=>!c.has(e.sessionId)).map(e=>({id:`deep-session:${e.sessionId}:${e.messageId}`,section:n(`palette.messages`,`Messages`),label:e.title||n(`tabs.chat`,`Chat`),icon:Ce,hint:e.snippet,run:()=>i(`/c/${e.sessionId}`)})),...S.notes.map(e=>({id:`deep-note:${e.noteId}`,section:n(`palette.notes`,`Notes`),label:e.title||n(`notes.untitled`,`Untitled`),icon:pt,hint:e.snippet,run:()=>i(`/notes?note=${encodeURIComponent(e.noteId)}`)})),...S.documents.map(e=>({id:`deep-document:${e.documentId}`,section:n(`palette.documents`,`Documents`),label:e.filename,icon:ft,hint:e.snippet,run:()=>t(`documents`)}))];return[...o,...l.map(e=>({item:e,ranges:[]}))]},[w,s,S,n,i,t]);(0,Z.useEffect)(()=>{(f.current?.querySelector(`[data-selected="true"]`))?.scrollIntoView({block:`nearest`})},[l,T.length]);let E=e=>{e&&(x(),e.run())};return a?(0,Fn.createPortal)((0,Q.jsx)(`div`,{"data-testid":`command-palette`,className:`fixed inset-0 z-[120] flex items-center justify-center bg-black/25 px-4 backdrop-blur-[2px] dark:bg-black/45`,onMouseDown:e=>{e.target===e.currentTarget&&x()},children:(0,Q.jsxs)(`div`,{className:`flex h-[min(34rem,76vh)] w-full max-w-2xl flex-col overflow-hidden rounded-2xl border border-line bg-surface-overlay/95 shadow-overlay backdrop-blur-xl animate-scale-in motion-reduce:animate-none`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2.5 border-b border-line px-4`,children:[(0,Q.jsx)(Te,{className:`h-4 w-4 shrink-0 text-ink-subtle`}),(0,Q.jsx)(`input`,{ref:d,"data-testid":`command-palette-input`,value:s,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),x()):e.key===`ArrowDown`?(e.preventDefault(),u(e=>Math.min(T.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),u(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),E(T[l]?.item))},placeholder:n(`palette.placeholder`,`Search chats, Work, actions…`),className:`h-[3.25rem] w-full bg-transparent text-[15px] text-ink outline-none placeholder:text-ink-subtle`}),(0,Q.jsx)(`kbd`,{className:`shrink-0 rounded-md border border-line px-1.5 py-0.5 font-mono text-[10px] text-ink-subtle`,children:`esc`})]}),(0,Q.jsxs)(`div`,{ref:f,className:`min-h-0 flex-1 overflow-y-auto p-2 scrollbar-thin`,children:[T.length===0&&(0,Q.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-ink-subtle`,children:n(`palette.empty`,`No matches.`)}),T.map(({item:e,ranges:t},n)=>{let r=n===0||e.section!==T[n-1].item.section;return(0,Q.jsxs)(Z.Fragment,{children:[r&&(0,Q.jsx)(`p`,{className:`px-2.5 pb-1 pt-2.5 text-[10px] font-medium uppercase tracking-[0.08em] text-ink-subtle first:pt-1`,children:e.section}),(0,Q.jsxs)(`button`,{type:`button`,"data-selected":n===l||void 0,onMouseEnter:()=>u(n),onClick:()=>E(e),className:B(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-sm transition-colors`,n===l?`bg-black/[0.05] text-ink dark:bg-white/[0.07]`:`text-ink-muted`),children:[(0,Q.jsx)(e.icon,{className:`h-4 w-4 shrink-0 text-ink-subtle`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Q.jsx)(wr,{text:e.label,ranges:t})}),e.hint&&(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-ink-subtle`,children:e.hint})]})]},e.id)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-t border-line px-4 py-2 text-[10px] text-ink-subtle`,children:[(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:(0,Q.jsx)(`kbd`,{className:`rounded-md border border-line px-1.5 py-0.5 font-mono`,children:`↑↓`})}),(0,Q.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:(0,Q.jsx)(`kbd`,{className:`rounded-md border border-line px-1.5 py-0.5 font-mono`,children:`↵`})}),(0,Q.jsx)(`span`,{className:`ms-auto inline-flex items-center gap-1`,children:(0,Q.jsx)(`kbd`,{className:`rounded-md border border-line px-1.5 py-0.5 font-mono`,children:`esc`})})]})]})}),document.body):null},Er=K(`user-service`),Dr=class{static async initializeAuth(){let{setLoading:e,setSystemInfo:t,login:n}=q.getState();try{e(!0),Er.debug(`Starting auth initialization...`),Er.debug(`Fetching system info...`);let r=await Tt.getSystemInfo();Er.debug(`System info response:`,r),r.success&&r.data?(Er.debug(`Setting system info:`,r.data),t(r.data)):Er.error(`System info response failed:`,r);let i=localStorage.getItem(`auth-token`);if(i)try{let e=(await T(async()=>{let{default:e}=await import(`../js/axios-C8xWfUG8.js`);return{default:e}},__vite__mapDeps([31,8,1,2]))).default,t=e.defaults.headers.common;e.defaults.headers.common.Authorization=`Bearer ${i}`;let r=await Tt.verifyToken();if(r.success&&r.data){let e=q.getState().systemInfo;e&&n(r.data,i,e)}e.defaults.headers.common=t}catch(e){Er.error(`Token verification failed:`,e),localStorage.removeItem(`auth-token`)}}catch(e){Er.error(`Auth initialization error:`,e)}finally{e(!1)}}};bt.interceptors.request.use(e=>{let t=localStorage.getItem(`auth-token`);return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e)),bt.interceptors.response.use(e=>e,e=>{if(e.response?.status===401){localStorage.removeItem(`auth-token`);let{logout:e}=q.getState();e();let t=window.location.protocol===`file:`;window.location.href=t?`#/login`:`/login`}return Promise.reject(e)});var Or=K(`initialize`),kr=()=>{let{t:e}=R(),t=(0,Z.useRef)(!1),n=(0,Z.useRef)(!1),{loadSessions:r,loadModels:i,loadPreferences:a,setSelectedModel:o,models:s,ollamaConnected:c}=le(),{loadPreferences:l}=zt(),{loadPlugins:u,plugins:d}=Rt(),f=q(e=>e.isAuthenticated);(0,Z.useEffect)(()=>{t.current||n.current||(async()=>{n.current=!0;try{Or.debug(`Initializing Libre WebUI...`),await Dr.initializeAuth();let n=q.getState();if(n.requiresAuth()&&!n.isAuthenticated){Or.debug(`Authentication required; deferring protected app initialization`);return}try{!(await Pt.checkHealth()).success&&!St()&&Ie.error(e(`appInitialization.ollamaUnavailable`))}catch(t){Or.warn(`Ollama health check failed; continuing provider initialization:`,t),St()||Ie.error(e(`appInitialization.ollamaUnavailable`))}await Promise.all([l(),a()]),await Promise.all([i(),r(),u()]),t.current=!0,Or.debug(`Libre WebUI initialized successfully`)}catch(n){St()?(await Promise.all([l(),a()]),await Promise.all([i(),r(),u()]),t.current=!0):(Or.error(`Failed to initialize app:`,n),Ie.error(e(`appInitialization.backendConnectionFailed`)))}finally{n.current=!1}})()},[f,l,a,i,r,u,e]),(0,Z.useEffect)(()=>{if(s.length>0){let e=s.filter(e=>!e.name.includes(`embed`))[0]||s[0],{selectedModel:t,selectedProviderType:n,selectedProviderId:r}=le.getState();if(t){if(!ce(s,{model:t,providerType:n,providerId:r})&&n!==`ollama`&&n!==`plugin`){let t=se(e);Or.debug(`Legacy selected model not available, falling back to:`,t.model),o(t.model,t.providerType,t.providerId)}}else{let t=se(e);Or.debug(`No model selected, using first available:`,t.model),o(t.model,t.providerType,t.providerId)}}},[s,o]),(0,Z.useEffect)(()=>{t.current&&(Or.debug(`Plugin availability changed, reloading models...`),i())},[d,i]),(0,Z.useEffect)(()=>{let e=0,t=()=>{if(document.visibilityState!==`visible`)return;let t=q.getState();if(t.requiresAuth()&&!t.isAuthenticated)return;let n=Date.now();n-e<1e4||(e=n,t.refreshWorkAccess())};return window.addEventListener(`focus`,t),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,t),document.removeEventListener(`visibilitychange`,t)}},[]),(0,Z.useEffect)(()=>{let e=()=>{Or.debug(`Installed models changed, reloading models...`),i()};return window.addEventListener(Mt,e),()=>window.removeEventListener(Mt,e)},[i]),(0,Z.useEffect)(()=>{if(c)return;let e=q.getState();if(e.requiresAuth()&&!e.isAuthenticated)return;let t=()=>{document.visibilityState===`visible`&&(Or.debug(`Provider offline at startup, re-checking availability...`),i({quiet:!0}))},n=s.some(e=>!e.isPersona)?void 0:window.setInterval(t,1e4);return window.addEventListener(`focus`,t),()=>{n!==void 0&&window.clearInterval(n),window.removeEventListener(`focus`,t)}},[c,s,i])},Ar=(e,t=!0)=>{let n=(0,Z.useCallback)(n=>{if(!t)return;let r=n.target;if(r.tagName===`INPUT`||r.tagName===`TEXTAREA`||r.contentEditable===`true`||r.isContentEditable)return;if(n.key===`?`||n.key===`/`&&n.shiftKey){let t=e.find(e=>e.key===`?`);if(t){n.preventDefault(),n.stopPropagation(),t.action();return}}let i=e.find(e=>{let t=e.key.toLowerCase()===n.key.toLowerCase(),r=!!e.metaKey,i=n.metaKey||n.ctrlKey,a=!r||i,o=!e.ctrlKey||n.ctrlKey,s=!!e.shiftKey===n.shiftKey,c=!!e.altKey===n.altKey;return t&&a&&o&&s&&c});i&&(n.preventDefault(),n.stopPropagation(),i.action())},[e,t]);(0,Z.useEffect)(()=>{if(t)return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n)}},[n,t])},jr=K(`components:git-hub-auth-button`),Mr=()=>{let{t:e}=R(),[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Ct}/auth/oauth/github/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),jr.debug(`GitHub OAuth configured:`,t.configured)}else jr.debug(`GitHub OAuth status check failed`),i(!1)}catch(e){jr.debug(`GitHub OAuth not configured:`,e),i(!1)}})()},[]),r?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Ct}/auth/oauth/github`;window.location.href=e},disabled:t,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:t?(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(Ye,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.github`)})]}):(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(de,{size:16,className:`me-2`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.github`)})]})}):null},Nr=K(`components:hugging-face-auth-button`),Pr=()=>{let{t:e}=R(),[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Ct}/auth/oauth/huggingface/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Nr.debug(`Hugging Face OAuth configured:`,t.configured)}else Nr.debug(`Hugging Face OAuth status check failed`),i(!1)}catch(e){Nr.debug(`Hugging Face OAuth not configured:`,e),i(!1)}})()},[]),r?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Ct}/auth/oauth/huggingface`;window.location.href=e},disabled:t,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:t?(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(Ye,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.huggingFace`)})]}):(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(`span`,{className:`me-2 text-base`,children:`🤗`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.huggingFace`)})]})}):null},Fr=({displayName:e})=>{let{t}=R(),[n,r]=(0,Z.useState)(!1),i=e||t(`auth.oidc.defaultProviderName`,`Single sign-on`);return(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{n||(r(!0),window.location.href=`${Ct}/auth/oauth/oidc`)},disabled:n,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:n?(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(Ye,{size:16,className:`me-2 animate-spin`}),t(`auth.oauth.connectingTo`,{provider:i})]}):(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(ge,{size:16,className:`me-2`}),t(`auth.oauth.continueWith`,{provider:i})]})})},Ir=K(`hooks:oauth-providers`),Lr=async e=>{try{let t=await fetch(`${Ct}/auth/oauth/${e}/status`,{method:`GET`,credentials:`include`});if(!t.ok)return{configured:!1};let n=await t.json();return{configured:!!n.configured,displayName:typeof n.displayName==`string`?n.displayName:void 0}}catch(t){return Ir.debug(`${e} OAuth not configured:`,t),{configured:!1}}},Rr=()=>{let[e,t]=(0,Z.useState)({github:!1,huggingface:!1,oidc:!1}),[n,r]=(0,Z.useState)(void 0);return(0,Z.useEffect)(()=>{let e=!0;return Promise.all([Lr(`github`),Lr(`huggingface`),Lr(`oidc`)]).then(([n,i,a])=>{e&&(t({github:n.configured,huggingface:i.configured,oidc:a.configured}),r(a.displayName))}),()=>{e=!1}},[]),{...e,oidcDisplayName:n,hasAny:e.github||e.huggingface||e.oidc}},zr=K(`components:login-form`),Br={username:`demo`,password:`demo`},Vr=({onLogin:e,onShowSignup:t,initialApprovalPending:n=!1,bare:r=!1})=>{let{t:i}=R(),a=St(),o=Rr(),[s,c]=(0,Z.useState)(a?Br.username:``),[l,u]=(0,Z.useState)(a?Br.password:``),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(n),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(``),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),[D,O]=(0,Z.useState)(null),A=k(),{login:j,systemInfo:ee}=q(),te=ee?.turnstile?.siteKey,M=!!(ee?.turnstile?.enabled&&te&&!a),N=(0,Z.useCallback)(e=>{v(e)},[]),P=(0,Z.useMemo)(()=>p||M&&!_,[p,M,_]),ne=async t=>{t.preventDefault();let n=a?Br.username:s.trim(),r=a?Br.password:l;if(!n||!r){W.error(i(`auth.login.enterBoth`));return}if(M&&!_){W.error(i(`auth.login.verificationFailed`,`Security verification failed. Please refresh and try again.`));return}m(!0),g(!1);try{localStorage.removeItem(`auth-token`);let t=await Tt.login({username:n,password:r,turnstileToken:_});if(t.success&&t.data){if(Et(t.data)){if(b(t.data),S(``),t.data.requirement===`enroll`){let e=await Tt.mfaEnrollChallenge({challengeToken:t.data.challengeToken});e.success&&e.data?w(e.data):(W.error(e.message||i(`auth.mfa.enrollFailed`)),b(null))}return}j(t.data.user,t.data.token,t.data.systemInfo),W.success(i(`auth.login.loginSuccess`)),e?.(),A(`/`)}else W.error(t.message||i(`auth.login.loginFailed`))}catch(e){zr.error(`Login error:`,e);let t=e;t.response?.data?.code===`ACCOUNT_PENDING`?(g(!0),W.error(t.response.data.message||i(`auth.login.approvalPending`,`Your account is waiting for administrator approval.`))):W.error(i(`auth.login.checkCredentials`))}finally{v(``),m(!1)}},F=t=>{j(t.user,t.token,t.systemInfo),W.success(i(`auth.login.loginSuccess`)),e?.(),A(`/`)},I=async e=>{if(e.preventDefault(),!(!y||!x.trim())){m(!0);try{if(y.requirement===`enroll`){let e=await Tt.mfaActivateChallenge({challengeToken:y.challengeToken,code:x.trim()});if(e.success&&e.data){let{recoveryCodes:t,...n}=e.data;O(n),E(t)}else W.error(e.message||i(`auth.mfa.invalidCode`));return}let e=await Tt.mfaVerify({challengeToken:y.challengeToken,code:x.trim()});e.success&&e.data?F(e.data):W.error(e.message||i(`auth.mfa.invalidCode`))}catch(e){let t=e.response?.data?.message;t&&/challenge/i.test(t)?(W.error(i(`auth.mfa.challengeExpired`)),b(null),w(null)):W.error(t||i(`auth.mfa.invalidCode`))}finally{S(``),m(!1)}}},L=async()=>{m(!0);try{let e=await Tt.passkeyLoginOptions();if(!e.success||!e.data){W.error(e.message||i(`auth.passkeys.signInFailed`));return}let t=await en(e.data.publicKey),n=await Tt.passkeyLogin({challengeToken:e.data.challengeToken,credential:t});n.success&&n.data?(localStorage.removeItem(`auth-token`),F(n.data)):W.error(n.message||i(`auth.passkeys.signInFailed`))}catch(e){let t=e;if(t.name===`NotAllowedError`||t.name===`AbortError`)return;let n=e;zr.error(`Passkey login error:`,e),W.error(n.response?.data?.message||i(`auth.passkeys.signInFailed`))}finally{m(!1)}},z=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}},re=B(`mx-auto w-full max-w-md`,!r&&`rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`);if(T&&D)return(0,Q.jsxs)(`div`,{className:re,"data-testid":`login-recovery-codes`,children:[(0,Q.jsxs)(`div`,{className:B(`mb-6`,r?`text-start`:`text-center`),children:[(0,Q.jsx)(`h1`,{className:`mb-2 text-2xl font-light tracking-[-0.04em] text-ink`,children:i(`auth.mfa.recoveryCodesTitle`)}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:i(`auth.mfa.recoveryCodesHint`)})]}),(0,Q.jsx)(`div`,{className:`mb-6 grid grid-cols-2 gap-2 rounded-xl border border-line bg-surface p-4 font-mono text-sm text-ink`,children:T.map(e=>(0,Q.jsx)(`span`,{dir:`ltr`,children:e},e))}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>F(D),className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:i(`auth.mfa.recoveryCodesSaved`)})]});if(y){let e=y.requirement===`enroll`;return(0,Q.jsxs)(`div`,{className:re,"data-testid":`login-mfa-step`,children:[(0,Q.jsxs)(`div`,{className:B(`mb-6`,r?`text-start`:`text-center`),children:[(0,Q.jsx)(`div`,{className:B(`mb-3 flex`,r?`justify-start`:`justify-center`),children:(0,Q.jsx)(he,{"aria-hidden":`true`,className:`h-8 w-8 text-ink`})}),(0,Q.jsx)(`h1`,{className:`mb-2 text-2xl font-light tracking-[-0.04em] text-ink`,children:i(e?`auth.mfa.setupTitle`:`auth.mfa.verifyTitle`)}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:i(e?`auth.mfa.setupSubtitle`:`auth.mfa.verifyHint`)})]}),e&&C&&(0,Q.jsxs)(`div`,{className:`mb-5 space-y-3 rounded-xl border border-line bg-surface p-4 text-start`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-ink-muted`,children:i(`auth.mfa.secretHint`)}),(0,Q.jsx)(`code`,{dir:`ltr`,"data-testid":`mfa-enroll-secret`,className:`block break-all font-mono text-sm text-ink`,children:C.secret}),(0,Q.jsx)(`a`,{href:C.otpauthUrl,dir:`ltr`,className:`inline-block text-xs font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400`,children:i(`auth.mfa.openAuthenticator`)})]}),(0,Q.jsxs)(`form`,{onSubmit:I,className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`mfa-code`,className:`mb-2 block text-sm font-medium text-ink`,children:i(e?`auth.mfa.codeLabel`:`auth.mfa.codeOrRecoveryLabel`)}),(0,Q.jsx)(`input`,{id:`mfa-code`,"data-testid":`mfa-code-input`,type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,autoFocus:!0,dir:`ltr`,value:x,onChange:e=>S(e.target.value),className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:i(`auth.mfa.codePlaceholder`),required:!0,disabled:p})]}),(0,Q.jsx)(`button`,{type:`submit`,disabled:p||!x.trim(),className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:p?(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),i(`auth.login.signingIn`)]}):i(`auth.mfa.verifyButton`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{b(null),w(null),S(``)},className:`w-full text-center text-sm font-medium text-ink-muted transition-colors hover:text-ink`,children:i(`auth.mfa.backToSignIn`)})]})]})}return(0,Q.jsxs)(`div`,{className:B(`mx-auto w-full max-w-md`,!r&&`rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`),children:[(0,Q.jsxs)(`div`,{className:B(`mb-8`,r?`text-start`:`text-center`),children:[(0,Q.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:i(`auth.login.title`)}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:i(`auth.login.subtitle`)})]}),(0,Q.jsxs)(`form`,{onSubmit:ne,className:`space-y-5`,children:[h&&(0,Q.jsxs)(`div`,{"data-testid":`login-approval-pending`,role:`status`,className:`flex gap-3 rounded-xl border border-warning-500/30 bg-warning-500/10 p-3 text-start`,children:[(0,Q.jsx)(_e,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-warning-700 dark:text-warning-400`}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-ink-muted`,children:i(`auth.login.approvalPending`,`Your account is waiting for administrator approval.`)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:i(`auth.login.username`)}),(0,Q.jsx)(`input`,{id:`username`,type:`text`,value:s,onChange:e=>c(e.target.value),onKeyDown:z,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:i(`auth.login.usernamePlaceholder`),required:!0,disabled:p||a})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:i(`auth.login.password`)}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`input`,{id:`password`,type:d?`text`:`password`,value:l,onChange:e=>u(e.target.value),onKeyDown:z,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:i(`auth.login.passwordPlaceholder`),required:!0,disabled:p||a}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>f(!d),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:p||a,"aria-label":d?`Hide characters`:`Reveal characters`,children:d?(0,Q.jsx)(Fe,{size:20}):(0,Q.jsx)(Ke,{size:20})})]})]}),M&&te&&(0,Q.jsx)(nn,{siteKey:te,action:`login`,disabled:p,errorMessage:i(`auth.login.verificationFailed`,`Security verification failed. Please refresh and try again.`),onTokenChange:N}),(0,Q.jsx)(`button`,{type:`submit`,disabled:P,className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:p?(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),i(`auth.login.signingIn`)]}):(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(Xe,{size:16,className:`me-2`}),i(`auth.login.signIn`)]})})]}),!a&&tn()&&ee?.passkeysInUse&&(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`passkey-signin-button`,onClick:L,disabled:p,className:`mt-3 flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:[(0,Q.jsx)(ge,{size:16,className:`me-2`}),i(`auth.passkeys.signInButton`)]}),!a&&(0,Q.jsxs)(Q.Fragment,{children:[o.hasAny&&(0,Q.jsxs)(`div`,{className:`mt-6`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,Q.jsx)(`div`,{className:`w-full border-t border-line`})}),(0,Q.jsx)(`div`,{className:`relative flex justify-center text-sm`,children:(0,Q.jsx)(`span`,{className:B(`px-2 text-ink-muted`,r?`bg-canvas`:`bg-surface-raised`),children:i(`common.or`)})})]}),(0,Q.jsxs)(`div`,{className:`mt-6 space-y-3`,children:[o.github&&(0,Q.jsx)(Mr,{}),o.huggingface&&(0,Q.jsx)(Pr,{}),o.oidc&&(0,Q.jsx)(Fr,{displayName:o.oidcDisplayName})]})]}),t&&(0,Q.jsx)(`div`,{className:`mt-6 text-center`,children:(0,Q.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[i(`auth.login.noAccount`),` `,(0,Q.jsx)(`button`,{onClick:t,className:`font-medium text-primary-600 transition-colors hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300`,children:i(`auth.login.signUpHere`)})]})})]})]})},Hr=K(`components:signup-form`),Ur=({onSignup:e,onBackToLogin:t,bare:n=!1})=>{let{t:r}=R(),[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(``),S=k(),{login:C,systemInfo:w}=q(),T=w?.turnstile?.siteKey,E=!!(w?.turnstile?.enabled&&T),D=(0,Z.useCallback)(e=>{x(e)},[]),O=(0,Z.useMemo)(()=>g||E&&!b,[g,E,b]),A=async t=>{if(t.preventDefault(),!i.trim()||!c.trim()){W.error(r(`auth.signup.usernameRequired`));return}if(c!==u){W.error(r(`auth.signup.passwordMismatch`));return}let n=rn(c);if(n){W.error(n);return}if(E&&!b){W.error(r(`auth.signup.tryAgain`));return}_(!0);try{let t=await Tt.signup({username:i,password:c,email:o,turnstileToken:b});if(t.success&&t.data){if(!(`token`in t.data)){y(!0),W.success(r(`auth.signup.approvalPending`,`Registration received. An administrator must approve your account.`));return}C(t.data.user,t.data.token,t.data.systemInfo),W.success(r(`auth.signup.signupSuccess`)),e?.(),S(`/`)}else W.error(t.message||r(`auth.signup.signupFailed`))}catch(e){Hr.error(`Signup error:`,e),W.error(r(`auth.signup.tryAgain`))}finally{x(``),_(!1)}},j=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return v?(0,Q.jsxs)(`div`,{"data-testid":`signup-approval-pending`,className:B(`mx-auto w-full max-w-md text-center`,!n&&`rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`),children:[(0,Q.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-warning-500/15 text-warning-700 dark:text-warning-400`,children:(0,Q.jsx)(_e,{"aria-hidden":`true`,className:`h-6 w-6`})}),(0,Q.jsx)(`h1`,{className:`mt-5 text-3xl font-light tracking-[-0.04em] text-ink`,children:r(`auth.signup.awaitingApproval`,`Awaiting approval`)}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-ink-muted`,children:r(`auth.signup.awaitingApprovalDescription`,`Your account has been created, but an administrator must activate it before you can sign in.`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`mt-6 inline-flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:bg-surface-raised`,children:r(`auth.signup.backToSignIn`,`Back to sign in`)})]}):(0,Q.jsxs)(`div`,{className:B(`mx-auto w-full max-w-md`,!n&&`rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`),children:[(0,Q.jsxs)(`div`,{className:B(`mb-8`,n?`text-start`:`text-center`),children:[(0,Q.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:r(`auth.signup.title`)}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:r(`auth.signup.subtitle`)})]}),(0,Q.jsxs)(`form`,{onSubmit:A,className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.username`)}),(0,Q.jsx)(`input`,{id:`username`,type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:j,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:r(`auth.signup.usernamePlaceholder`),required:!0,disabled:g})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`label`,{htmlFor:`email`,className:`mb-2 block text-sm font-medium text-ink`,children:[r(`auth.signup.email`),` `,(0,Q.jsxs)(`span`,{className:`text-ink-muted`,children:[`(`,r(`common.optional`),`)`]})]}),(0,Q.jsx)(`input`,{id:`email`,type:`email`,value:o,onChange:e=>s(e.target.value),onKeyDown:j,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:r(`auth.signup.emailPlaceholder`),disabled:g})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.password`)}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`input`,{id:`password`,type:f?`text`:`password`,value:c,onChange:e=>l(e.target.value),onKeyDown:j,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:r(`auth.signup.passwordPlaceholder`),required:!0,disabled:g}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>p(!f),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:g,"aria-label":f?`Hide characters`:`Reveal characters`,children:f?(0,Q.jsx)(Fe,{size:20}):(0,Q.jsx)(Ke,{size:20})})]}),(0,Q.jsx)(an,{password:c})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`confirmPassword`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.confirmPassword`)}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`input`,{id:`confirmPassword`,type:m?`text`:`password`,value:u,onChange:e=>d(e.target.value),onKeyDown:j,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:r(`auth.signup.confirmPasswordPlaceholder`),required:!0,disabled:g}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>h(!m),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:g,"aria-label":m?`Hide confirmation`:`Reveal confirmation`,children:m?(0,Q.jsx)(Fe,{size:20}):(0,Q.jsx)(Ke,{size:20})})]})]}),E&&T&&(0,Q.jsx)(nn,{siteKey:T,action:`signup`,disabled:g,errorMessage:r(`auth.signup.tryAgain`),onTokenChange:D}),(0,Q.jsx)(`button`,{type:`submit`,disabled:O,className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:g?(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),r(`auth.signup.creatingAccount`)]}):(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(dt,{size:16,className:`me-2`}),r(`auth.signup.createAccount`)]})})]}),(0,Q.jsx)(Mr,{}),(0,Q.jsx)(`div`,{className:`mt-6 text-center`,children:(0,Q.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[r(`auth.signup.hasAccount`),` `,(0,Q.jsx)(`button`,{onClick:t,className:`font-medium text-primary-600 transition-colors hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300`,children:r(`auth.signup.signInHere`)})]})})]})},Wr=()=>{let{t:e}=R(),t=k(),n=O(),{isAuthenticated:r,requiresAuth:i,systemInfo:a}=q(),[o,s]=(0,Z.useState)(!1),c=i(),l=a?.signupEnabled??!0,u=new URLSearchParams(n.search).get(`approval`)===`pending`;if((0,Z.useEffect)(()=>{(r||!c)&&t(`/`)},[c,r,t]),r||!c)return null;let d=[{icon:he,title:e(`auth.highlights.local.title`,`Local first`),body:e(`auth.highlights.local.body`,`Your conversations and files stay on the machine you run this on.`)},{icon:He,title:e(`auth.highlights.providers.title`,`Any provider`),body:e(`auth.highlights.providers.body`,`Local models through Ollama, plus the remote providers you choose to add.`)},{icon:Ae,title:e(`auth.highlights.work.title`,`Isolated Work`),body:e(`auth.highlights.work.body`,`Give a model a sandboxed workspace with files, a terminal, and a preview.`)}],f=on(a?.version);return(0,Q.jsxs)(`div`,{className:`relative min-h-screen overflow-y-auto bg-canvas text-ink`,children:[(0,Q.jsxs)(`header`,{className:`absolute inset-x-0 top-0 z-10 flex h-14 items-center justify-between px-5 sm:px-8`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-ink lg:invisible`,children:[(0,Q.jsx)(Gt,{size:`sm`,label:null}),(0,Q.jsx)(Wt,{size:`sm`})]}),(0,Q.jsx)(Ln,{})]}),(0,Q.jsxs)(`main`,{className:`grid min-h-screen lg:grid-cols-2`,children:[(0,Q.jsxs)(`section`,{className:`relative hidden flex-col justify-between border-e border-line bg-surface px-10 py-12 lg:flex xl:px-16`,children:[(0,Q.jsxs)(`div`,{className:`relative z-10 flex items-center gap-3.5 text-ink`,children:[(0,Q.jsx)(Gt,{size:`lg`,label:null}),(0,Q.jsx)(Wt,{size:`lg`})]}),(0,Q.jsxs)(`div`,{className:`relative z-10 max-w-lg`,children:[(0,Q.jsx)(`p`,{className:`text-[2.6rem] font-light leading-[1.05] tracking-[-0.04em] text-ink xl:text-5xl`,children:e(`auth.tagline`,`Your AI stack should answer to you.`)}),(0,Q.jsx)(`ul`,{className:`mt-10 space-y-5`,children:d.map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-3`,children:[(0,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-ink-subtle`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-[13px] font-medium text-ink`,children:e.title}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-relaxed text-ink-muted`,children:e.body})]})]},e.title))})]}),(0,Q.jsxs)(`div`,{className:`relative z-10 space-y-1 font-mono text-[11px] text-ink-subtle`,children:[(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`a`,{href:`https://librewebui.org`,target:`_blank`,rel:`noopener noreferrer`,className:`transition-colors hover:text-ink`,children:`librewebui.org`}),` · `,(0,Q.jsx)(`a`,{href:`https://docs.librewebui.org`,target:`_blank`,rel:`noopener noreferrer`,className:`transition-colors hover:text-ink`,children:`docs.librewebui.org`})]}),(0,Q.jsxs)(`p`,{"data-testid":`app-version`,children:[f?`v${f}`:``,f?` · `:``,e(`auth.selfHosted`,`Self-hosted · Apache 2.0`),` · `,(0,Q.jsx)(`a`,{href:`https://kroonen.ai`,target:`_blank`,rel:`noopener noreferrer`,className:`transition-colors hover:text-ink`,children:`kroonen.ai`})]})]})]}),(0,Q.jsx)(`section`,{className:`flex items-center justify-center px-5 pb-12 pt-24 sm:px-8 lg:px-12 lg:py-12`,children:(0,Q.jsx)(`div`,{className:`w-full max-w-sm`,children:o&&l?(0,Q.jsx)(Ur,{bare:!0,onBackToLogin:()=>s(!1),onSignup:()=>s(!1)}):(0,Q.jsx)(Vr,{bare:!0,initialApprovalPending:u,onShowSignup:l?()=>s(!0):void 0})})})]})]})},Gr=window.location.protocol===`file:`,Kr=()=>Gr?(0,Q.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-8 z-50`,style:{WebkitAppRegion:`drag`}}):null,qr=K(`app`),Jr=Z.lazy(()=>T(()=>import(`../js/HomePage-BebX3v-x.js`),__vite__mapDeps([32,1,2,4,6,7,8,9,10,11,12,13,14,15,17,18,33,34,35,28,36]))),Yr=Z.lazy(()=>T(()=>import(`../js/ChatPage-BMcigJWr.js`),__vite__mapDeps([37,1,2,22,4,6,7,8,9,10,11,12,13,14,15,17,18,35,19,20,21,24,38,39,26,30,40,41,42,43,44,45,3,5]))),Xr=Z.lazy(()=>T(()=>import(`../js/PersonasPage-CiOBffF3.js`),__vite__mapDeps([46,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,18,20,21,22,19,47,25]))),Zr=Z.lazy(()=>T(()=>import(`../js/GalleryPage-DUcM4dg0.js`),__vite__mapDeps([48,1,2,22,3,4,5,6,7,8,11,12,13,14,15,16,18,20,21,19]))),Qr=Z.lazy(()=>T(()=>import(`../js/NotesPage-CXSz7Hde.js`),__vite__mapDeps([49,1,2,4,6,7,8,9,10,11,12,13,14,15,20,21,22,18,19,50,51,52]))),$r=Z.lazy(()=>T(()=>import(`../js/CalendarPage-Bls3TBeZ.js`),__vite__mapDeps([53,1,2,22,4,6,7,8,11,12,13,14,15,20,21,18,19,25,54]))),ei=Z.lazy(()=>T(()=>import(`../js/AutomationsPage-D3v0Cra1.js`),__vite__mapDeps([55,1,2,4,6,7,8,9,10,11,12,13,14,15,20,21,22,18,19,56,54]))),ti=Z.lazy(()=>T(()=>import(`../js/LibreClawPage-A37KF9_G.js`),__vite__mapDeps([57,1,2,10,6,7,8,11,12,13,4,14,15,20,21,22,18,19]))),ni=Z.lazy(()=>T(()=>import(`../js/ChannelsPage-BnoCniNf.js`),__vite__mapDeps([58,1,2,4,6,7,8,9,10,11,12,13,14,15,17,18,20,21,22,19,59]))),ri=Z.lazy(()=>T(()=>import(`../js/WorkPage-BgASwAGs.js`),__vite__mapDeps([60,1,2,4,6,7,8,9,10,11,12,13,14,15,17,18,20,21,22,19,24,33,50,51,52,56,54,45,3,5,36]))),ii=Z.lazy(()=>T(()=>import(`../js/UserManagementPage-CquciWKV.js`),__vite__mapDeps([61,1,2,3,4,5,6,7,8,11,12,15,14,13,17,9,10,18,20,21,22,19,62,29]))),ai=Z.lazy(()=>T(()=>import(`../js/PluginUsagePage-jMrpL2Jb.js`),__vite__mapDeps([63,1,2,3,4,5,6,7,8,11,15,12,14,13,20,21,22,18,19]))),oi=Z.lazy(()=>T(()=>import(`../js/EvaluationsPage-DSgj9dT5.js`),__vite__mapDeps([64,1,2,6,7,8,9,4,10,11,12,13,14,15,20,21,22,18,19,44]))),si=Z.lazy(()=>T(()=>import(`../js/SystemPage-Drd1neLN.js`),__vite__mapDeps([65,1,2,3,4,5,6,7,8,11,15,12,14,13,17,9,10,18,20,21,22,19]))),ci=Z.lazy(()=>T(()=>import(`../js/ArtifactDemoPage-CEYuIhJA.js`),__vite__mapDeps([66,1,2,20,7,8,21,22,4,6,11,18,12,19,40,39,41,42,43,14]))),li=Z.lazy(()=>T(()=>import(`../js/SettingsModal-DP_wKehV.js`).then(e=>({default:e.SettingsModal})),__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]))),ui=Z.lazy(()=>T(()=>import(`../js/ArtifactSlideOutPanel-DnTTc1VY.js`).then(e=>({default:e.ArtifactSlideOutPanel})),__vite__mapDeps([67,1,2,22,6,7,8,9,4,10,11,12,13,14,15,18,20,39,41,42,43]))),di=Z.lazy(()=>T(()=>import(`../js/FirstTimeSetup-BRysXCjP.js`).then(e=>({default:e.FirstTimeSetup})),__vite__mapDeps([68,1,2,6,7,8,11,12,13,4,14,15,17,9,10,18,23,24,69,62]))),fi=()=>{let{t:e}=R();return(0,Q.jsx)(`div`,{className:`flex h-full min-h-screen items-center justify-center bg-gray-50 dark:bg-dark-100`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,Q.jsx)(`div`,{className:`h-8 w-8 rounded-full border-4 border-gray-200 border-t-primary-500 animate-spin dark:border-dark-300 dark:border-t-primary-400`}),(0,Q.jsx)(`div`,{className:`text-gray-600 dark:text-dark-600`,children:e(`common.loading`)})]})})},pi=({isOpen:e,compact:t})=>(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:B(`hidden lg:block flex-shrink-0 transition-[width] duration-200 ease-out`,e?t?`w-16`:`w-72`:`w-0`)}),mi=()=>{let{artifactPanelOpen:e,artifactPanelWidth:t,artifactPanelResizing:n}=zt();return(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:B(`hidden md:block flex-shrink-0`,!n&&`transition-[width] duration-300 ease-out`),style:{width:e?t:0}})},hi=({hasBackground:e,sidebarOpen:t,sidebarCompact:n,onCloseSidebar:r,showDemoBanner:i,demoMessage:a,children:o})=>(0,Q.jsxs)(`div`,{className:B(`flex h-dvh min-h-0 text-ink relative overflow-hidden`,e?`bg-sidebar/60`:`bg-sidebar`),children:[(0,Q.jsx)(Kr,{}),(0,Q.jsx)(hr,{}),(0,Q.jsx)(or,{isOpen:t,onClose:r}),(0,Q.jsx)(pi,{isOpen:t,compact:n}),(0,Q.jsxs)(`div`,{"data-testid":`app-shell-content`,className:B(`flex-1 basis-0 flex min-h-0 flex-col min-w-0 transition-[margin,background-color] duration-200 ease-out relative z-10 lg:pb-2 lg:pe-2`,Gr?`pt-8`:`lg:pt-1.5`,t&&n?`max-lg:ms-16`:`max-lg:ms-0`,e?`bg-white/10 dark:bg-dark-50/10`:`bg-transparent`),children:[i&&(0,Q.jsx)(mr,{message:a}),(0,Q.jsx)(xr,{}),(0,Q.jsx)(`main`,{className:B(`min-h-0 flex-1 overflow-hidden lg:rounded-[1.5rem] lg:border lg:border-black/[0.06] dark:lg:border-white/[0.07] lg:shadow-[0_1px_2px_rgba(0,0,0,0.03),0_18px_60px_rgba(15,23,42,0.04)]`,e?`bg-white/30 dark:bg-dark-50/35 backdrop-blur-sm`:`bg-canvas`),children:(0,Q.jsx)(ur,{children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(fi,{}),children:o})})})]}),(0,Q.jsx)(mi,{})]}),gi=[{path:`*`,element:(0,Q.jsx)(()=>{let{t:e,i18n:t}=R(),n=k(),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(void 0),[s,c]=(0,Z.useState)(0),[l,u]=(0,Z.useState)(!1),{sidebarOpen:d,sidebarCompact:f,setSidebarOpen:p,setSidebarCompact:m,toggleSidebar:h,toggleSidebarCompact:g,toggleTheme:_,backgroundImage:v,preferences:y,artifactPanelOpen:b,closeArtifactPanel:x}=zt(),{systemInfo:S,isLoading:C,user:w,isAuthenticated:T}=q(),{isDemoMode:E,demoConfig:D}=zt(),O=S?.requiresAuth===!1||T,A=pr();Z.useEffect(()=>{if(!(!y.ttsSettings?.enabled||!y.ttsSettings.autoPlay))return $t()},[y.ttsSettings?.autoPlay,y.ttsSettings?.enabled]);let[ee,te]=Z.useState(!1),M=Z.useRef(!1);Z.useEffect(()=>{(async()=>{if(M.current){qr.debug(`OAuth already processing, skipping...`);return}if(qr.debug(`Starting OAuth callback processing...`),M.current=!0,new URLSearchParams(window.location.search).get(`auth`)===`success`){try{let t=await fetch(`${Ct}/auth/oauth/exchange`,{method:`POST`,credentials:`include`});if(t.ok){let n=await t.json();if(n.success&&n.data){let{login:t}=q.getState();t(n.data.user,n.data.token,n.data.systemInfo),qr.debug(`OAuth login successful`),Ie.success(e(`auth.oauth.loginSuccess`))}else Ie.error(e(`auth.oauth.completionFailed`))}else Ie.error(e(`auth.oauth.verificationFailed`))}catch(t){qr.error(`OAuth processing error:`,t),Ie.error(e(`auth.oauth.authenticationFailed`))}window.history.replaceState({},document.title,window.location.pathname)}qr.debug(`OAuth processing completed`),te(!0),M.current=!1})()},[e]),kr();let N=()=>{if(v)return!0;let e=y.backgroundSettings;return e?.enabled&&e?.imageUrl};Ar([{key:`b`,metaKey:!0,action:()=>{window.innerWidth>=1024?d?g():(m(!1),h()):(!d&&f&&m(!1),h())},description:e(`keyboard.toggleSidebar`)},{key:`,`,metaKey:!0,action:()=>{o(void 0),i(!0)},description:e(`keyboard.openSettings`)},{key:`o`,metaKey:!0,shiftKey:!0,action:()=>Xt(n),description:e(`keyboard.newChat`)},{key:`u`,metaKey:!0,shiftKey:!0,action:()=>{q.getState().canUseWork()&&Zt(n)},description:e(`keyboard.newWork`)},{key:`d`,metaKey:!0,action:_,description:e(`keyboard.toggleDarkMode`)},{key:`?`,action:()=>{o(`shortcuts`),i(!0)},description:e(`keyboard.showShortcuts`)},{key:`Escape`,action:()=>i(!1),description:e(`keyboard.closeModals`)}],O),Z.useEffect(()=>{if(O)return;let e=window.requestAnimationFrame(()=>{i(!1),x()});return()=>window.cancelAnimationFrame(e)},[x,O]),Z.useEffect(()=>{if(!O){It.disconnect();return}return It.connect().catch(qr.error),()=>{It.disconnect()}},[O]),Z.useEffect(()=>{if(!S&&!C&&s<15){let e=setTimeout(async()=>{c(e=>e+1);try{await Dr.initializeAuth()}catch{}},2e3);return()=>clearTimeout(e)}},[S,C,s]);let ne=!l&&S?.requiresAuth===!0&&S?.hasUsers===!1;return C?(0,Q.jsxs)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8`,children:[(0,Q.jsx)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:(0,Q.jsx)(`div`,{className:`flex flex-col items-center`,children:(0,Q.jsx)(Gt,{size:`lg`,className:`text-gray-900 dark:text-gray-100`})})}),(0,Q.jsx)(`div`,{className:`mt-8 flex flex-col items-center gap-4`,children:(0,Q.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})})]}):S?ne&&!l?(0,Q.jsx)(ur,{children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(fi,{}),children:(0,Q.jsx)(di,{onComplete:()=>{u(!0)}})})}):ee?(0,Q.jsxs)(Q.Fragment,{children:[S&&!S.requiresAuth?(0,Q.jsx)(hi,{hasBackground:!!N(),sidebarOpen:d,sidebarCompact:f,onCloseSidebar:()=>p(!1),showDemoBanner:E&&D.showBanner,demoMessage:D.message,children:(0,Q.jsxs)(j,{children:[(0,Q.jsx)(P,{path:`/`,element:(0,Q.jsx)(Jr,{})}),(0,Q.jsx)(P,{path:`/chat`,element:(0,Q.jsx)(Yr,{})}),(0,Q.jsx)(P,{path:`/c/:sessionId`,element:(0,Q.jsx)(Yr,{})}),(0,Q.jsx)(P,{path:`/personas`,element:(0,Q.jsx)(Xr,{})}),(0,Q.jsx)(P,{path:`/gallery`,element:(0,Q.jsx)(Zr,{})}),(0,Q.jsx)(P,{path:`/notes`,element:(0,Q.jsx)(Qr,{})}),(0,Q.jsx)(P,{path:`/calendar`,element:(0,Q.jsx)($r,{})}),(0,Q.jsx)(P,{path:`/automations`,element:(0,Q.jsx)(ei,{})}),(0,Q.jsx)(P,{path:`/channels`,element:(0,Q.jsx)(ni,{})}),(0,Q.jsx)(P,{path:`/work`,element:(0,Q.jsx)($,{requireWork:!0,children:(0,Q.jsx)(ri,{})})}),(0,Q.jsx)(P,{path:`/work/:taskId`,element:(0,Q.jsx)($,{requireWork:!0,children:(0,Q.jsx)(ri,{})})}),(0,Q.jsx)(P,{path:`/agents`,element:(0,Q.jsx)($,{requireAdmin:!0,requireAgents:!0,children:(0,Q.jsx)(ti,{})})}),(0,Q.jsx)(P,{path:`/usage`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(ai,{})})}),(0,Q.jsx)(P,{path:`/evaluations`,element:(0,Q.jsx)(oi,{})}),(0,Q.jsx)(P,{path:`/system`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(si,{})})}),(0,Q.jsx)(P,{path:`/login`,element:(0,Q.jsx)(Wr,{})})]})}):(0,Q.jsxs)(j,{children:[(0,Q.jsx)(P,{path:`/login`,element:(0,Q.jsx)(Wr,{})}),(0,Q.jsx)(P,{path:`/*`,element:(0,Q.jsx)($,{children:(0,Q.jsx)(hi,{hasBackground:!!N(),sidebarOpen:d,sidebarCompact:f,onCloseSidebar:()=>p(!1),showDemoBanner:E&&D.showBanner,demoMessage:D.message,children:(0,Q.jsxs)(j,{children:[(0,Q.jsx)(P,{path:`/`,element:(0,Q.jsx)(Jr,{})}),(0,Q.jsx)(P,{path:`/chat`,element:(0,Q.jsx)(Yr,{})}),(0,Q.jsx)(P,{path:`/c/:sessionId`,element:(0,Q.jsx)(Yr,{})}),(0,Q.jsx)(P,{path:`/personas`,element:(0,Q.jsx)(Xr,{})}),(0,Q.jsx)(P,{path:`/gallery`,element:(0,Q.jsx)(Zr,{})}),(0,Q.jsx)(P,{path:`/notes`,element:(0,Q.jsx)(Qr,{})}),(0,Q.jsx)(P,{path:`/calendar`,element:(0,Q.jsx)($r,{})}),(0,Q.jsx)(P,{path:`/automations`,element:(0,Q.jsx)(ei,{})}),(0,Q.jsx)(P,{path:`/channels`,element:(0,Q.jsx)(ni,{})}),(0,Q.jsx)(P,{path:`/work`,element:(0,Q.jsx)($,{requireWork:!0,children:(0,Q.jsx)(ri,{})})}),(0,Q.jsx)(P,{path:`/work/:taskId`,element:(0,Q.jsx)($,{requireWork:!0,children:(0,Q.jsx)(ri,{})})}),(0,Q.jsx)(P,{path:`/agents`,element:(0,Q.jsx)($,{requireAdmin:!0,requireAgents:!0,children:(0,Q.jsx)(ti,{})})}),(0,Q.jsx)(P,{path:`/artifacts`,element:(0,Q.jsx)(ci,{})}),(0,Q.jsx)(P,{path:`/usage`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(ai,{})})}),(0,Q.jsx)(P,{path:`/evaluations`,element:(0,Q.jsx)(oi,{})}),(0,Q.jsx)(P,{path:`/system`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(si,{})})}),(0,Q.jsx)(P,{path:`/users`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(ii,{})})})]})})})})]}),O&&r&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(li,{isOpen:r,initialTab:a,onClose:()=>i(!1)})}),O&&A.open&&A.notes&&(0,Q.jsx)(dr,{notes:A.notes,onDismiss:A.dismiss}),O&&b&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(ui,{})}),(0,Q.jsx)(Je,{position:oe(t.language)?`top-left`:`top-right`,toastOptions:{duration:4e3,className:`animate-slide-up`,style:{background:`var(--toast-bg)`,color:`var(--toast-color)`,border:`1px solid var(--toast-border)`,borderRadius:`0.75rem`,boxShadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)`,cursor:`pointer`},success:{iconTheme:{primary:`rgb(var(--color-primary-600))`,secondary:`#ffffff`}},error:{iconTheme:{primary:`rgb(var(--color-primary-600))`,secondary:`#ffffff`}}},containerStyle:{top:80,insetInlineEnd:20}}),O&&(0,Q.jsx)(Tr,{onOpenSettings:()=>{o(void 0),i(!0)},onOpenSettingsTab:e=>{o(e),i(!0)}})]}):(0,Q.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}):(0,Q.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4`,children:(0,Q.jsxs)(`div`,{className:`text-center`,children:[(0,Q.jsx)(`div`,{className:`mb-8`,children:(0,Q.jsx)(Gt,{size:`lg`,className:`mx-auto text-gray-900 dark:text-white`})}),(0,Q.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,Q.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-dark-300 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}),(0,Q.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 text-sm`,children:s>0?`Connecting to backend... (${s}/15)`:`Starting up...`})]})})},{}),errorElement:(0,Q.jsx)(lr,{})}],_i=Gr?N(gi):te(gi),vi=()=>(0,Q.jsx)(ur,{children:(0,Q.jsx)(D,{router:_i})}),yi=new On({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});ue.catch(()=>{ae(`en`)}).then(()=>{kn.createRoot(document.getElementById(`root`)).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(v,{client:yi,children:(0,Q.jsx)(vi,{})})}))}),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`).catch(()=>{})});
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,g as n}from"./markdown-core-CsTEqgp1.js";import{n as r}from"./react-vendor-BsJBHRYW.js";import{t as i}from"./useTranslation-DrnYb6Cx.js";import{t as a}from"./utils-D9UstwTG.js";import{Z as o,jn as s,n as c,v as l}from"./ui-vendor-C0KwbTD4.js";import{t as u}from"./workApi-BwDBwG62.js";import"./api-2DulPtq1.js";import{c as d,d as f,l as p,n as m}from"./calendarDates-Co3o_05Y.js";var h=e(t(),1),g=r(),_=(e,t,n)=>new Intl.DateTimeFormat(n,{hour:`numeric`,minute:`2-digit`}).format(new Date(2024,0,1,e,t)),v=(e,t)=>new Intl.DateTimeFormat(t,{weekday:`long`}).format(new Date(2024,0,7+e)),y=(e,t,n)=>new Intl.DateTimeFormat(n,{month:`long`,day:`numeric`}).format(new Date(2024,e-1,t));function b(e,t,n){switch(e.kind){case`once`:return n(`automations.trigger.once`,{when:new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.at))});case`hourly`:{let t=e.startHour!==void 0||e.endHour!==void 0?` (${e.startHour??0}–${e.endHour??23})`:``;return n(`automations.trigger.hourly`,{minute:String(e.minute).padStart(2,`0`)})+t}case`daily`:return n(`automations.trigger.daily`,{time:_(e.hour,e.minute,t)});case`weekly`:return n(`automations.trigger.weekly`,{day:v(e.dayOfWeek,t),time:_(e.hour,e.minute,t)});case`monthly`:return n(`automations.trigger.monthly`,{day:e.dayOfMonth,time:_(e.hour,e.minute,t)});case`yearly`:return n(`automations.trigger.yearly`,{date:y(e.month,e.dayOfMonth,t),time:_(e.hour,e.minute,t)})}}function x(e,t,n){return e.map(e=>b(e,t,n)).join(` · `)}function S(e){let t=(e,t,n)=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=t&&e<=n;switch(e.kind){case`once`:return t(e.at,0,864e13);case`hourly`:return t(e.minute,0,59)&&(e.startHour===void 0||t(e.startHour,0,23))&&(e.endHour===void 0||t(e.endHour,0,23))&&(e.startHour===void 0||e.endHour===void 0||e.endHour>=e.startHour);case`daily`:return t(e.hour,0,23)&&t(e.minute,0,59);case`weekly`:return t(e.dayOfWeek,0,6)&&t(e.hour,0,23)&&t(e.minute,0,59);case`monthly`:return t(e.dayOfMonth,1,31)&&t(e.hour,0,23)&&t(e.minute,0,59);case`yearly`:return t(e.month,1,12)&&t(e.dayOfMonth,1,31)&&t(e.hour,0,23)&&t(e.minute,0,59);default:return!1}}var C=n(),w=[`once`,`hourly`,`daily`,`weekly`,`monthly`,`yearly`],T=`rounded-lg border border-black/[0.08] bg-white px-2 py-1 text-[13px] text-gray-900 focus:border-primary-500/40 focus:outline-none dark:border-white/[0.08] dark:bg-dark-100 dark:text-dark-900`,E=(e,t)=>`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`,D=e=>{switch(e){case`once`:{let e=new Date;return e.setHours(e.getHours()+1,0,0,0),{kind:`once`,at:e.getTime()}}case`hourly`:return{kind:`hourly`,minute:0};case`daily`:return{kind:`daily`,hour:8,minute:0};case`weekly`:return{kind:`weekly`,dayOfWeek:1,hour:9,minute:0};case`monthly`:return{kind:`monthly`,dayOfMonth:1,hour:9,minute:0};case`yearly`:return{kind:`yearly`,month:1,dayOfMonth:1,hour:9,minute:0}}};function O({trigger:e,onChange:t,onRemove:n}){let{t:r,i18n:a}=i(),o=f(a.language,`short`),c=new Intl.DateTimeFormat(a.language,{month:`long`}),u=n=>{let[r,i]=(n||`00:00`).split(`:`).map(Number);e.kind!==`hourly`&&e.kind!==`once`&&t({...e,hour:r,minute:i})},h=e.kind!==`once`&&e.kind!==`hourly`?(0,C.jsx)(`input`,{type:`time`,"aria-label":r(`automations.form.time`),value:E(e.hour,e.minute),onChange:e=>u(e.target.value),className:T}):null;return(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-black/[0.06] bg-black/[0.02] px-2.5 py-2 dark:border-white/[0.06] dark:bg-white/[0.03]`,"data-testid":`automation-trigger`,children:[(0,C.jsx)(s,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-dark-500`}),(0,C.jsx)(`select`,{"aria-label":r(`automations.form.frequency`),value:e.kind,onChange:e=>t(D(e.target.value)),className:T,"data-testid":`automation-trigger-kind`,children:w.map(e=>(0,C.jsx)(`option`,{value:e,children:r(`automations.kind.${e}`)},e))}),e.kind===`once`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`input`,{type:`date`,"aria-label":r(`calendar.date`),value:d(e.at),onChange:n=>t({...e,at:m(n.target.value,p(e.at))}),className:T}),(0,C.jsx)(`input`,{type:`time`,"aria-label":r(`automations.form.time`),value:p(e.at),onChange:n=>t({...e,at:m(d(e.at),n.target.value)}),className:T})]}),e.kind===`hourly`&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`label`,{className:`flex items-center gap-1 text-[12px] text-gray-500 dark:text-dark-500`,children:[r(`automations.form.minute`),(0,C.jsx)(`input`,{type:`number`,min:0,max:59,value:e.minute,onChange:n=>t({...e,minute:Math.min(59,Math.max(0,Number(n.target.value)))}),className:`${T} w-16`})]}),(0,C.jsxs)(`label`,{className:`flex items-center gap-1 text-[12px] text-gray-500 dark:text-dark-500`,children:[r(`automations.form.fromHour`),(0,C.jsx)(`input`,{type:`number`,min:0,max:23,value:e.startHour??0,onChange:n=>t({...e,startHour:Math.min(23,Math.max(0,Number(n.target.value)))}),className:`${T} w-16`})]}),(0,C.jsxs)(`label`,{className:`flex items-center gap-1 text-[12px] text-gray-500 dark:text-dark-500`,children:[r(`automations.form.toHour`),(0,C.jsx)(`input`,{type:`number`,min:0,max:23,value:e.endHour??23,onChange:n=>t({...e,endHour:Math.min(23,Math.max(0,Number(n.target.value)))}),className:`${T} w-16`})]})]}),e.kind===`weekly`&&(0,C.jsx)(`select`,{"aria-label":r(`automations.form.weekday`),value:e.dayOfWeek,onChange:n=>t({...e,dayOfWeek:Number(n.target.value)}),className:T,children:o.map((e,t)=>(0,C.jsx)(`option`,{value:t,children:e},e))}),(e.kind===`monthly`||e.kind===`yearly`)&&(0,C.jsxs)(`label`,{className:`flex items-center gap-1 text-[12px] text-gray-500 dark:text-dark-500`,children:[r(`automations.form.dayOfMonth`),(0,C.jsx)(`input`,{type:`number`,min:1,max:31,value:e.dayOfMonth,onChange:n=>t({...e,dayOfMonth:Math.min(31,Math.max(1,Number(n.target.value)))}),className:`${T} w-16`})]}),e.kind===`yearly`&&(0,C.jsx)(`select`,{"aria-label":r(`automations.form.month`),value:e.month,onChange:n=>t({...e,month:Number(n.target.value)}),className:T,children:Array.from({length:12},(e,t)=>(0,C.jsx)(`option`,{value:t+1,children:c.format(new Date(2024,t,1))},t+1))}),h,n&&(0,C.jsx)(`button`,{type:`button`,onClick:n,"aria-label":r(`common.delete`),className:`ms-auto rounded-md p-1 text-red-500 transition-colors hover:bg-red-50 dark:hover:bg-red-900/20`,children:(0,C.jsx)(l,{className:`h-3.5 w-3.5`})})]})}var k=`w-full rounded-lg border border-black/[0.08] bg-white px-2.5 py-1.5 text-[13px] text-gray-900 focus:border-primary-500/40 focus:outline-none dark:border-white/[0.08] dark:bg-dark-100 dark:text-dark-900`,A=`mb-1 block text-[11px] font-medium uppercase tracking-wide text-gray-400 dark:text-dark-500`,j=e=>e.isPlugin&&e.pluginId?`plugin:${e.pluginId}`:e.isAgent&&e.agentId?`agent:${e.agentId}`:`ollama`;function M({open:e,automation:t,initial:n,fixedWorkTaskId:r,models:i,saving:a,onClose:o,onSave:s}){return e?(0,C.jsx)(N,{automation:t,initial:n,fixedWorkTaskId:r,models:i,saving:a,onClose:o,onSave:s},t?.id??n?.name??`new`):null}function N({automation:e,initial:t,fixedWorkTaskId:n,models:r,saving:s,onClose:l,onSave:d}){let{t:f}=i(),p=!!(n??e?.workTaskId),[m,_]=(0,h.useState)(e?.name??t?.name??``),[v,y]=(0,h.useState)(e?.instructions??t?.instructions??``),[b,x]=(0,h.useState)(e?.triggers??t?.triggers??[{kind:`daily`,hour:8,minute:0}]),[w,T]=(0,h.useState)(e?.model??``),[E,D]=(0,h.useState)(e?.notify??`app`),[M,N]=(0,h.useState)(e?.target??`chat`),[P,F]=(0,h.useState)(e?.workPolicyId??``),[I,L]=(0,h.useState)([]);(0,h.useEffect)(()=>{if(M!==`work`||p)return;let e=!1;return u.listPolicies().then(t=>{!e&&t.success&&Array.isArray(t.data)&&L(t.data)}).catch(()=>void 0),()=>{e=!0}},[M,p]);let R=m.trim().length>0&&v.trim().length>0&&b.length>0&&b.every(S);return(0,g.createPortal)((0,C.jsx)(`div`,{className:`fixed inset-0 z-[2147483647] flex items-center justify-center bg-gray-950/55 p-4 backdrop-blur-md`,onClick:l,children:(0,C.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`automation-modal-title`,"data-testid":`automation-modal`,className:`max-h-[90vh] w-full max-w-lg overflow-y-auto rounded-3xl border border-black/[0.07] bg-white p-6 shadow-[0_24px_80px_rgba(0,0,0,0.24)] animate-scale-in scrollbar-thin dark:border-white/[0.08] dark:bg-dark-25`,onClick:e=>e.stopPropagation(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,C.jsx)(`h3`,{id:`automation-modal-title`,className:`text-lg font-medium tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:f(e?`automations.editAutomation`:`automations.newAutomation`)}),(0,C.jsx)(`button`,{onClick:l,"aria-label":f(`common.close`),className:`rounded-xl p-2 transition-colors hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,C.jsx)(c,{size:20,className:`text-gray-500`})})]}),(0,C.jsxs)(`div`,{className:`space-y-4`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`automation-name`,className:A,children:f(`automations.form.name`)}),(0,C.jsx)(`input`,{id:`automation-name`,"data-testid":`automation-name`,type:`text`,value:m,onChange:e=>_(e.target.value),placeholder:f(`automations.form.namePlaceholder`),className:k,maxLength:200,autoFocus:!0})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:A,children:f(`automations.form.triggers`)}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[b.map((e,t)=>(0,C.jsx)(O,{trigger:e,onChange:e=>x(n=>n.map((n,r)=>r===t?e:n)),onRemove:b.length>1?()=>x(e=>e.filter((e,n)=>n!==t)):void 0},t)),b.length<5&&(0,C.jsxs)(`button`,{type:`button`,onClick:()=>x(e=>[...e,{kind:`daily`,hour:8,minute:0}]),"data-testid":`automation-add-trigger`,className:`flex items-center gap-1.5 rounded-lg px-2 py-1 text-[12px] font-medium text-primary-600 transition-colors hover:bg-primary-500/10 dark:text-primary-400`,children:[(0,C.jsx)(o,{className:`h-3.5 w-3.5`}),f(`automations.form.addTrigger`)]})]})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`automation-instructions`,className:A,children:f(`automations.form.instructions`)}),(0,C.jsx)(`textarea`,{id:`automation-instructions`,"data-testid":`automation-instructions`,value:v,onChange:e=>y(e.target.value),placeholder:f(`automations.form.instructionsPlaceholder`),rows:5,className:k,maxLength:2e4})]}),p&&(0,C.jsx)(`p`,{"data-testid":`automation-task-bound-note`,className:`rounded-lg bg-primary-500/10 px-3 py-2 text-[12px] leading-relaxed text-primary-700 dark:text-primary-300`,children:f(`automations.form.taskBoundNote`,{defaultValue:`This routine runs inside the agent's own workspace and conversation, with the agent's model and runtime.`})}),(0,C.jsxs)(`div`,{className:a(`grid grid-cols-2 gap-3`,p&&`hidden`),children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`automation-target`,className:A,children:f(`automations.form.target`)}),(0,C.jsxs)(`select`,{id:`automation-target`,"data-testid":`automation-target`,value:M,onChange:e=>N(e.target.value),className:k,children:[(0,C.jsx)(`option`,{value:`chat`,children:f(`automations.form.targetChat`)}),(0,C.jsx)(`option`,{value:`work`,children:f(`automations.form.targetWork`)})]})]}),M===`work`&&I.length>0&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`automation-work-policy`,className:A,children:f(`automations.form.workPolicy`)}),(0,C.jsxs)(`select`,{id:`automation-work-policy`,"data-testid":`automation-work-policy`,value:P,onChange:e=>F(e.target.value),className:k,children:[(0,C.jsx)(`option`,{value:``,children:f(`automations.form.workPolicyDefault`)}),I.map(e=>(0,C.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,C.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,C.jsxs)(`div`,{className:a(p&&`hidden`),children:[(0,C.jsx)(`label`,{htmlFor:`automation-model`,className:A,children:f(`automations.form.model`)}),(0,C.jsxs)(`select`,{id:`automation-model`,value:w,onChange:e=>T(e.target.value),className:k,children:[(0,C.jsx)(`option`,{value:``,children:f(`automations.form.modelAuto`)}),r.map(e=>(0,C.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`automation-notify`,className:A,children:f(`automations.form.notification`)}),(0,C.jsxs)(`select`,{id:`automation-notify`,value:E,onChange:e=>D(e.target.value),className:k,children:[(0,C.jsx)(`option`,{value:`app`,children:f(`automations.form.notifyApp`)}),(0,C.jsx)(`option`,{value:`off`,children:f(`automations.form.notifyOff`)})]})]})]}),(0,C.jsxs)(`div`,{className:`flex justify-end gap-3 border-t border-gray-200 pt-4 dark:border-dark-300`,children:[(0,C.jsx)(`button`,{onClick:l,className:`rounded-xl px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-100 dark:text-dark-700 dark:hover:bg-dark-200`,children:f(`common.cancel`)}),(0,C.jsx)(`button`,{onClick:()=>{if(!R)return;if(p){d({name:m.trim(),instructions:v.trim(),triggers:b,notify:E,target:`work`,workTaskId:n??e?.workTaskId});return}let t=r.find(e=>e.name===w);d({name:m.trim(),instructions:v.trim(),triggers:b,...t?{provider:j(t),model:t.name}:{},notify:E,target:M,...M===`work`&&P?{workPolicyId:P}:{}})},disabled:s||!R,"data-testid":`automation-save`,className:`rounded-xl bg-gray-950 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100`,children:f(s?`common.saving`:`common.save`)})]})]})]})}),document.body)}export{x as n,M as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,g as n}from"./markdown-core-CsTEqgp1.js";import{f as r}from"./router-vendor-BGP0k6Y2.js";import{t as i}from"./useTranslation-DrnYb6Cx.js";import{r as a,t as o}from"./utils-D9UstwTG.js";import{t as s}from"./chatStore-DkpmZLOG.js";import{$ as c,Fn as l,In as u,J as d,Pn as f,Z as p,_r as m,bn as h,it as g,jt as _,nt as ee,t as te,v}from"./ui-vendor-C0KwbTD4.js";import{t as y}from"./logger-CpCQz3Vi.js";import{T as b}from"./api-2DulPtq1.js";import{t as x}from"./Button--pDOakZx.js";import"./ui-DUzqxWMk.js";import{n as S,t as C}from"./AutomationModal-DB3lrK2K.js";var w=e(t(),1),T=n();function E({days:e,locale:t}){let{t:n}=i(),r=e.reduce((e,t)=>e+t.succeeded,0),a=e.reduce((e,t)=>e+t.failed,0),o=Math.max(1,...e.map(e=>e.succeeded+e.failed)),s=new Intl.DateTimeFormat(t,{month:`short`,day:`numeric`}),c=new Date,l=e=>s.format(new Date(c.getFullYear(),c.getMonth(),c.getDate()-29+e));return(0,T.jsxs)(`div`,{className:`rounded-2xl border border-black/[0.06] bg-white/60 px-4 py-3 dark:border-white/[0.07] dark:bg-dark-100/60`,"data-testid":`automation-run-strip`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,T.jsx)(`p`,{className:`text-[12px] font-medium text-gray-700 dark:text-dark-700`,children:n(`automations.runHistory`)}),(0,T.jsxs)(`p`,{className:`text-[11px] text-gray-400 dark:text-dark-500`,children:[(0,T.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:[r,` `,n(`automations.succeeded`)]}),` · `,(0,T.jsxs)(`span`,{className:`text-red-500 dark:text-red-400`,children:[a,` `,n(`automations.failed`)]})]})]}),(0,T.jsx)(`div`,{className:`flex h-12 items-end gap-[3px]`,children:e.map((e,t)=>{let n=e.succeeded+e.failed;if(n===0)return(0,T.jsx)(`div`,{title:l(t),className:`h-[3px] flex-1 rounded-sm bg-black/[0.06] dark:bg-white/[0.08]`},t);let r=Math.max(6,Math.round(n/o*48)),i=Math.round(e.failed/n*r);return(0,T.jsxs)(`div`,{title:`${l(t)}: ${e.succeeded}✓ ${e.failed}✗`,className:`flex flex-1 flex-col justify-end overflow-hidden rounded-sm`,style:{height:r},children:[(0,T.jsx)(`div`,{className:`w-full bg-emerald-500/80`,style:{height:r-i}}),i>0&&(0,T.jsx)(`div`,{className:`w-full bg-red-500/80`,style:{height:i}})]},t)})})]})}var D=[{id:`morningBrief`,instructions:`Put together my morning brief: the top world, business, and tech headlines from the last 24 hours with one-line summaries, and one story worth reading in depth and why. Keep the whole thing scannable.`,triggers:[{kind:`daily`,hour:7,minute:30}]},{id:`newsDigest`,instructions:`Summarize the most important AI news from the last 24 hours: model releases, notable research papers, funding rounds, and policy changes. For each item add one sentence on why it matters. Skip minor product updates and rumors.`,triggers:[{kind:`daily`,hour:8,minute:0}]},{id:`weeklyReview`,instructions:`Help me wrap the week: prompt me to reflect on what I accomplished, what is still open, and what the top priorities for next week should be. Structure it as a short template I can fill in.`,triggers:[{kind:`weekly`,dayOfWeek:5,hour:16,minute:0}]},{id:`monthlyReport`,instructions:`Draft a monthly status report outline: key accomplishments, metrics to review, risks, and goals for the next month. Leave placeholders where my specifics belong.`,triggers:[{kind:`monthly`,dayOfMonth:1,hour:9,minute:0}]}],O=y(`pages:automations`),k=()=>{let{t:e,i18n:t}=i(),n=r(),y=s(e=>e.models),k=s(e=>e.loadModels),[j,M]=(0,w.useState)(`automations`),[N,P]=(0,w.useState)([]),[F,I]=(0,w.useState)([]),[L,R]=(0,w.useState)(null),[z,B]=(0,w.useState)(!0),[V,H]=(0,w.useState)(!1),[U,W]=(0,w.useState)(null),[G,K]=(0,w.useState)(null),[q,J]=(0,w.useState)(!1),[Y,X]=(0,w.useState)(null),[Z,ne]=(0,w.useState)(0),Q=(0,w.useCallback)(()=>ne(e=>e+1),[]);(0,w.useEffect)(()=>{let t=!1;return Promise.all([b.getAutomations(),b.getRuns(),b.getRunsSummary()]).then(([e,n,r])=>{t||(e.success&&e.data&&P(e.data),n.success&&n.data&&I(n.data),r.success&&r.data&&R(r.data))}).catch(n=>{t||(O.error(`Failed to load automations:`,n),m.error(e(`automations.loadFailed`)))}).finally(()=>{t||B(!1)}),()=>{t=!0}},[Z,e]),(0,w.useEffect)(()=>{y.length===0&&k({quiet:!0})},[y.length,k]),(0,w.useEffect)(()=>{j===`runs`&&b.markRunsSeen().then(()=>b.getRunsSummary()).then(e=>{e.success&&e.data&&R(e.data)}).catch(()=>void 0)},[j,F.length]);let re=()=>{W(null),K(null),H(!0)},ie=t=>{W(null),K({name:e(`automations.templates.${t.id}.name`),instructions:t.instructions,triggers:t.triggers}),H(!0)},ae=e=>{W(e),K(null),X(null),H(!0)},oe=async t=>{J(!0);try{let n=U?await b.updateAutomation(U.id,t):await b.createAutomation(t);n.success?(H(!1),Q()):m.error(n.error||e(`automations.saveFailed`))}catch(t){O.error(`Failed to save automation:`,t),m.error(e(`automations.saveFailed`))}finally{J(!1)}},$=async(t,n)=>{X(null);try{n===`pause`?await b.pauseAutomation(t.id):n===`resume`?await b.resumeAutomation(t.id):n===`run`?(await b.runAutomationNow(t.id),m.success(e(`automations.runQueued`))):await b.deleteAutomation(t.id),Q()}catch(t){O.error(`Automation ${n} failed:`,t),m.error(e(`automations.actionFailed`))}},se=e=>e.status===`succeeded`?(0,T.jsx)(u,{className:`h-4 w-4 text-emerald-500`}):e.status===`failed`?(0,T.jsx)(f,{className:`h-4 w-4 text-red-500`}):(0,T.jsx)(_,{className:`h-4 w-4 animate-spin text-gray-400`}),ce=t=>N.find(e=>e.id===t)?.name??e(`automations.deletedAutomation`);return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-testid":`automations-page`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-black/[0.06] px-4 py-3 dark:border-white/[0.07]`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.jsx)(`h1`,{className:`text-sm font-semibold text-gray-900 dark:text-dark-900`,children:e(`automations.title`)}),(0,T.jsx)(`div`,{className:`flex items-center rounded-xl bg-black/[0.04] p-0.5 dark:bg-white/[0.06]`,children:[`automations`,`runs`].map(t=>(0,T.jsx)(`button`,{onClick:()=>M(t),"data-testid":`automations-tab-${t}`,className:o(`rounded-[10px] px-2.5 py-1 text-[12px] font-medium transition-colors`,j===t?`bg-white text-gray-900 shadow-sm dark:bg-dark-200 dark:text-dark-900`:`text-gray-500 hover:text-gray-800 dark:text-dark-500 dark:hover:text-dark-800`),children:e(`automations.tab.${t}`)},t))})]}),(0,T.jsxs)(x,{size:`sm`,onClick:re,"data-testid":`automation-new`,className:`h-7 gap-1 px-2.5 text-[12px]`,children:[(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),e(`automations.newAutomation`)]})]}),(0,T.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 overflow-y-auto px-4 py-4 scrollbar-thin`,children:[j===`automations`?z?null:N.length===0?(0,T.jsxs)(`div`,{className:`px-3 py-16 text-center`,children:[(0,T.jsx)(te,{className:`mx-auto mb-2 h-6 w-6 text-gray-300 dark:text-dark-400`}),(0,T.jsx)(`p`,{className:`text-sm text-gray-400 dark:text-dark-500`,children:e(`automations.empty`)})]}):(0,T.jsx)(`div`,{className:`mx-auto w-full max-w-3xl space-y-2`,children:N.map(n=>(0,T.jsx)(`div`,{"data-testid":`automation-row`,className:`rounded-2xl border border-black/[0.06] bg-white/60 px-4 py-3 dark:border-white/[0.07] dark:bg-dark-100/60`,children:(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`p`,{className:`truncate text-[14px] font-medium text-gray-900 dark:text-dark-900`,children:n.name}),(0,T.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide`,n.status===`active`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`bg-gray-500/10 text-gray-500 dark:text-dark-500`),children:e(`automations.status.${n.status}`)})]}),(0,T.jsxs)(`p`,{className:`mt-0.5 truncate text-[12px] text-gray-500 dark:text-dark-500`,children:[S(n.triggers,t.language,e),n.nextRunAt&&(0,T.jsxs)(T.Fragment,{children:[` · `,e(`automations.nextRun`,{when:new Intl.DateTimeFormat(t.language,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).format(n.nextRunAt)})]})]})]}),(0,T.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,T.jsx)(`button`,{onClick:()=>X(e=>e===n.id?null:n.id),"aria-label":e(`automations.actions`),"data-testid":`automation-menu`,className:`rounded-lg p-1.5 text-gray-400 transition-colors hover:bg-black/[0.04] hover:text-gray-700 dark:hover:bg-white/[0.06] dark:hover:text-dark-800`,children:(0,T.jsx)(h,{className:`h-4 w-4`})}),Y===n.id&&(0,T.jsxs)(`div`,{className:`absolute end-0 top-8 z-20 w-44 rounded-xl border border-black/[0.07] bg-white p-1 shadow-lg dark:border-white/[0.08] dark:bg-dark-100`,children:[(0,T.jsx)(A,{icon:ee,label:e(`common.edit`),onClick:()=>ae(n)}),n.status===`active`?(0,T.jsx)(A,{icon:g,label:e(`automations.pause`),onClick:()=>$(n,`pause`)}):(0,T.jsx)(A,{icon:c,label:e(`automations.resume`),onClick:()=>$(n,`resume`)}),(0,T.jsx)(A,{icon:d,label:e(`automations.runNow`),onClick:()=>$(n,`run`)}),(0,T.jsx)(A,{icon:v,label:e(`common.delete`),destructive:!0,onClick:()=>$(n,`delete`)})]})]})]})},n.id))}):null,j===`automations`&&!z&&(0,T.jsxs)(`div`,{className:`mx-auto mt-8 w-full max-w-3xl`,children:[(0,T.jsx)(`p`,{className:`mb-2 text-[11px] font-medium uppercase tracking-wide text-gray-400 dark:text-dark-500`,children:e(`automations.templatesTitle`)}),(0,T.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:D.map(n=>(0,T.jsxs)(`button`,{type:`button`,onClick:()=>ie(n),"data-testid":`automation-template`,className:`rounded-2xl border border-black/[0.06] bg-white/40 px-4 py-3 text-start transition-colors hover:bg-white/80 dark:border-white/[0.07] dark:bg-dark-100/40 dark:hover:bg-dark-100/80`,children:[(0,T.jsx)(`p`,{className:`text-[13px] font-medium text-gray-900 dark:text-dark-900`,children:e(`automations.templates.${n.id}.name`)}),(0,T.jsx)(`p`,{className:`mt-0.5 text-[12px] text-gray-500 dark:text-dark-500`,children:e(`automations.templates.${n.id}.description`)}),(0,T.jsx)(`p`,{className:`mt-1.5 text-[11px] text-gray-400 dark:text-dark-500`,children:S(n.triggers,t.language,e)})]},n.id))})]}),j===`runs`&&(0,T.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl space-y-4`,children:[L&&(0,T.jsx)(E,{days:L.days,locale:t.language}),F.length===0?(0,T.jsxs)(`div`,{className:`px-3 py-12 text-center`,children:[(0,T.jsx)(l,{className:`mx-auto mb-2 h-6 w-6 text-gray-300 dark:text-dark-400`}),(0,T.jsx)(`p`,{className:`text-sm text-gray-400 dark:text-dark-500`,children:e(`automations.noRuns`)})]}):(0,T.jsx)(`div`,{className:`space-y-1`,"data-testid":`automation-run-list`,children:F.map(r=>(0,T.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-black/[0.05] bg-white/50 px-3 py-2 dark:border-white/[0.06] dark:bg-dark-100/50`,children:[se(r),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`p`,{className:`truncate text-[13px] text-gray-900 dark:text-dark-900`,children:ce(r.automationId)}),(0,T.jsxs)(`p`,{className:`truncate text-[11px] text-gray-400 dark:text-dark-500`,children:[a(r.scheduledFor,t.language),r.error&&(0,T.jsxs)(T.Fragment,{children:[` · `,(0,T.jsx)(`span`,{className:`text-red-500`,children:r.error})]})]})]}),r.sessionId&&(0,T.jsx)(`button`,{onClick:()=>n(`/c/${r.sessionId}`),"data-testid":`automation-run-open`,className:`shrink-0 rounded-lg px-2.5 py-1 text-[12px] font-medium text-primary-600 transition-colors hover:bg-primary-500/10 dark:text-primary-400`,children:e(`automations.openChat`)}),r.workTaskId&&(0,T.jsx)(`button`,{onClick:()=>n(`/work/${r.workTaskId}`),"data-testid":`automation-run-open-task`,className:`shrink-0 rounded-lg px-2.5 py-1 text-[12px] font-medium text-primary-600 transition-colors hover:bg-primary-500/10 dark:text-primary-400`,children:e(`automations.openTask`)})]},r.id))})]})]}),(0,T.jsx)(C,{open:V,automation:U,initial:G,models:y,saving:q,onClose:()=>H(!1),onSave:e=>void oe(e)})]})};function A({icon:e,label:t,destructive:n,onClick:r}){return(0,T.jsxs)(`button`,{onClick:r,className:o(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-start text-[13px] transition-colors`,n?`text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20`:`text-gray-700 hover:bg-black/[0.04] dark:text-dark-700 dark:hover:bg-white/[0.06]`),children:[(0,T.jsx)(e,{className:`h-3.5 w-3.5`}),t]})}export{k as default};