libre-webui 0.17.0 → 0.19.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 (438) hide show
  1. package/README.md +30 -17
  2. package/backend/dist/db.d.ts.map +1 -1
  3. package/backend/dist/db.js +195 -6
  4. package/backend/dist/db.js.map +1 -1
  5. package/backend/dist/index.d.ts.map +1 -1
  6. package/backend/dist/index.js +48 -19
  7. package/backend/dist/index.js.map +1 -1
  8. package/backend/dist/middleware/auth.d.ts.map +1 -1
  9. package/backend/dist/middleware/auth.js +35 -3
  10. package/backend/dist/middleware/auth.js.map +1 -1
  11. package/backend/dist/middleware/index.d.ts.map +1 -1
  12. package/backend/dist/models/personaModel.d.ts.map +1 -1
  13. package/backend/dist/models/personaModel.js.map +1 -1
  14. package/backend/dist/models/userModel.d.ts +24 -0
  15. package/backend/dist/models/userModel.d.ts.map +1 -1
  16. package/backend/dist/models/userModel.js +92 -24
  17. package/backend/dist/models/userModel.js.map +1 -1
  18. package/backend/dist/routes/agentCli.d.ts.map +1 -1
  19. package/backend/dist/routes/agentCli.js +4 -2
  20. package/backend/dist/routes/agentCli.js.map +1 -1
  21. package/backend/dist/routes/auth.d.ts.map +1 -1
  22. package/backend/dist/routes/auth.js +118 -55
  23. package/backend/dist/routes/auth.js.map +1 -1
  24. package/backend/dist/routes/chat.d.ts.map +1 -1
  25. package/backend/dist/routes/chat.js +106 -3
  26. package/backend/dist/routes/chat.js.map +1 -1
  27. package/backend/dist/routes/documents.d.ts.map +1 -1
  28. package/backend/dist/routes/documents.js +179 -41
  29. package/backend/dist/routes/documents.js.map +1 -1
  30. package/backend/dist/routes/embeddings.d.ts.map +1 -1
  31. package/backend/dist/routes/embeddings.js +2 -2
  32. package/backend/dist/routes/embeddings.js.map +1 -1
  33. package/backend/dist/routes/huggingfaceHub.d.ts.map +1 -1
  34. package/backend/dist/routes/huggingfaceHub.js +3 -1
  35. package/backend/dist/routes/huggingfaceHub.js.map +1 -1
  36. package/backend/dist/routes/imageGen.d.ts.map +1 -1
  37. package/backend/dist/routes/imageGen.js +2 -0
  38. package/backend/dist/routes/imageGen.js.map +1 -1
  39. package/backend/dist/routes/libreClaw.d.ts.map +1 -1
  40. package/backend/dist/routes/media.d.ts +3 -0
  41. package/backend/dist/routes/media.d.ts.map +1 -0
  42. package/backend/dist/routes/media.js +429 -0
  43. package/backend/dist/routes/media.js.map +1 -0
  44. package/backend/dist/routes/notes.d.ts +3 -0
  45. package/backend/dist/routes/notes.d.ts.map +1 -0
  46. package/backend/dist/routes/notes.js +121 -0
  47. package/backend/dist/routes/notes.js.map +1 -0
  48. package/backend/dist/routes/ollama.d.ts.map +1 -1
  49. package/backend/dist/routes/ollama.js +17 -85
  50. package/backend/dist/routes/ollama.js.map +1 -1
  51. package/backend/dist/routes/personas.d.ts.map +1 -1
  52. package/backend/dist/routes/personas.js +2 -0
  53. package/backend/dist/routes/personas.js.map +1 -1
  54. package/backend/dist/routes/plugins.d.ts.map +1 -1
  55. package/backend/dist/routes/plugins.js +28 -0
  56. package/backend/dist/routes/plugins.js.map +1 -1
  57. package/backend/dist/routes/preferences.d.ts.map +1 -1
  58. package/backend/dist/routes/systemDiagnostics.d.ts +3 -0
  59. package/backend/dist/routes/systemDiagnostics.d.ts.map +1 -0
  60. package/backend/dist/routes/systemDiagnostics.js +49 -0
  61. package/backend/dist/routes/systemDiagnostics.js.map +1 -0
  62. package/backend/dist/routes/tts.d.ts.map +1 -1
  63. package/backend/dist/routes/tts.js +4 -0
  64. package/backend/dist/routes/tts.js.map +1 -1
  65. package/backend/dist/routes/users.d.ts.map +1 -1
  66. package/backend/dist/routes/users.js +79 -0
  67. package/backend/dist/routes/users.js.map +1 -1
  68. package/backend/dist/routes/work.d.ts.map +1 -1
  69. package/backend/dist/routes/work.js +84 -0
  70. package/backend/dist/routes/work.js.map +1 -1
  71. package/backend/dist/services/agentCliService.d.ts +37 -4
  72. package/backend/dist/services/agentCliService.d.ts.map +1 -1
  73. package/backend/dist/services/agentCliService.js +229 -10
  74. package/backend/dist/services/agentCliService.js.map +1 -1
  75. package/backend/dist/services/assistantCompletionService.d.ts.map +1 -1
  76. package/backend/dist/services/authService.d.ts +15 -9
  77. package/backend/dist/services/authService.d.ts.map +1 -1
  78. package/backend/dist/services/authService.js +39 -29
  79. package/backend/dist/services/authService.js.map +1 -1
  80. package/backend/dist/services/chatGenerationService.d.ts.map +1 -1
  81. package/backend/dist/services/chatGenerationService.js +3 -3
  82. package/backend/dist/services/chatGenerationService.js.map +1 -1
  83. package/backend/dist/services/chatRequestService.d.ts +8 -2
  84. package/backend/dist/services/chatRequestService.d.ts.map +1 -1
  85. package/backend/dist/services/chatRequestService.js +30 -3
  86. package/backend/dist/services/chatRequestService.js.map +1 -1
  87. package/backend/dist/services/chatService.d.ts +6 -1
  88. package/backend/dist/services/chatService.d.ts.map +1 -1
  89. package/backend/dist/services/chatService.js +54 -1
  90. package/backend/dist/services/chatService.js.map +1 -1
  91. package/backend/dist/services/codexOAuthService.d.ts +22 -0
  92. package/backend/dist/services/codexOAuthService.d.ts.map +1 -0
  93. package/backend/dist/services/codexOAuthService.js +176 -0
  94. package/backend/dist/services/codexOAuthService.js.map +1 -0
  95. package/backend/dist/services/documentService.d.ts +17 -10
  96. package/backend/dist/services/documentService.d.ts.map +1 -1
  97. package/backend/dist/services/documentService.js +79 -58
  98. package/backend/dist/services/documentService.js.map +1 -1
  99. package/backend/dist/services/embeddingService.d.ts.map +1 -1
  100. package/backend/dist/services/encryptionService.d.ts.map +1 -1
  101. package/backend/dist/services/encryptionService.js +18 -8
  102. package/backend/dist/services/encryptionService.js.map +1 -1
  103. package/backend/dist/services/followUpService.d.ts +44 -0
  104. package/backend/dist/services/followUpService.d.ts.map +1 -0
  105. package/backend/dist/services/followUpService.js +123 -0
  106. package/backend/dist/services/followUpService.js.map +1 -0
  107. package/backend/dist/services/galleryService.d.ts +23 -1
  108. package/backend/dist/services/galleryService.d.ts.map +1 -1
  109. package/backend/dist/services/galleryService.js +125 -8
  110. package/backend/dist/services/galleryService.js.map +1 -1
  111. package/backend/dist/services/libreClawService.d.ts.map +1 -1
  112. package/backend/dist/services/mediaGenerationJobService.d.ts +25 -0
  113. package/backend/dist/services/mediaGenerationJobService.d.ts.map +1 -0
  114. package/backend/dist/services/mediaGenerationJobService.js +82 -0
  115. package/backend/dist/services/mediaGenerationJobService.js.map +1 -0
  116. package/backend/dist/services/memoryService.d.ts.map +1 -1
  117. package/backend/dist/services/memoryService.js.map +1 -1
  118. package/backend/dist/services/mutationEngineService.d.ts.map +1 -1
  119. package/backend/dist/services/oauthSecurity.d.ts +14 -0
  120. package/backend/dist/services/oauthSecurity.d.ts.map +1 -0
  121. package/backend/dist/services/oauthSecurity.js +101 -0
  122. package/backend/dist/services/oauthSecurity.js.map +1 -0
  123. package/backend/dist/services/ollamaService.d.ts +8 -2
  124. package/backend/dist/services/ollamaService.d.ts.map +1 -1
  125. package/backend/dist/services/ollamaService.js +40 -2
  126. package/backend/dist/services/ollamaService.js.map +1 -1
  127. package/backend/dist/services/personaService.d.ts.map +1 -1
  128. package/backend/dist/services/personaService.js.map +1 -1
  129. package/backend/dist/services/pluginActivationService.d.ts.map +1 -1
  130. package/backend/dist/services/pluginActivationService.js.map +1 -1
  131. package/backend/dist/services/pluginAudioGenerationService.d.ts +34 -0
  132. package/backend/dist/services/pluginAudioGenerationService.d.ts.map +1 -0
  133. package/backend/dist/services/pluginAudioGenerationService.js +211 -0
  134. package/backend/dist/services/pluginAudioGenerationService.js.map +1 -0
  135. package/backend/dist/services/pluginCapabilityRegistryService.d.ts.map +1 -1
  136. package/backend/dist/services/pluginCapabilityRegistryService.js +6 -0
  137. package/backend/dist/services/pluginCapabilityRegistryService.js.map +1 -1
  138. package/backend/dist/services/pluginCredentialsService.d.ts.map +1 -1
  139. package/backend/dist/services/pluginEmbeddingService.d.ts +2 -0
  140. package/backend/dist/services/pluginEmbeddingService.d.ts.map +1 -1
  141. package/backend/dist/services/pluginEmbeddingService.js +66 -35
  142. package/backend/dist/services/pluginEmbeddingService.js.map +1 -1
  143. package/backend/dist/services/pluginImageGenerationService.d.ts +2 -0
  144. package/backend/dist/services/pluginImageGenerationService.d.ts.map +1 -1
  145. package/backend/dist/services/pluginImageGenerationService.js +63 -38
  146. package/backend/dist/services/pluginImageGenerationService.js.map +1 -1
  147. package/backend/dist/services/pluginService.d.ts +43 -1
  148. package/backend/dist/services/pluginService.d.ts.map +1 -1
  149. package/backend/dist/services/pluginService.js +441 -71
  150. package/backend/dist/services/pluginService.js.map +1 -1
  151. package/backend/dist/services/pluginTTSService.d.ts +2 -0
  152. package/backend/dist/services/pluginTTSService.d.ts.map +1 -1
  153. package/backend/dist/services/pluginTTSService.js +27 -2
  154. package/backend/dist/services/pluginTTSService.js.map +1 -1
  155. package/backend/dist/services/pluginUsageService.d.ts +100 -0
  156. package/backend/dist/services/pluginUsageService.d.ts.map +1 -0
  157. package/backend/dist/services/pluginUsageService.js +291 -0
  158. package/backend/dist/services/pluginUsageService.js.map +1 -0
  159. package/backend/dist/services/pluginVariablesService.d.ts.map +1 -1
  160. package/backend/dist/services/pluginVariablesService.js.map +1 -1
  161. package/backend/dist/services/pluginVideoGenerationService.d.ts +45 -0
  162. package/backend/dist/services/pluginVideoGenerationService.d.ts.map +1 -0
  163. package/backend/dist/services/pluginVideoGenerationService.js +198 -0
  164. package/backend/dist/services/pluginVideoGenerationService.js.map +1 -0
  165. package/backend/dist/services/preferencesService.d.ts.map +1 -1
  166. package/backend/dist/services/preferencesService.js +16 -1
  167. package/backend/dist/services/preferencesService.js.map +1 -1
  168. package/backend/dist/services/registrationPolicy.d.ts +5 -0
  169. package/backend/dist/services/registrationPolicy.d.ts.map +1 -0
  170. package/backend/dist/services/registrationPolicy.js +21 -0
  171. package/backend/dist/services/registrationPolicy.js.map +1 -0
  172. package/backend/dist/services/simpleGitHubOAuth.d.ts +1 -1
  173. package/backend/dist/services/simpleGitHubOAuth.d.ts.map +1 -1
  174. package/backend/dist/services/simpleGitHubOAuth.js +13 -13
  175. package/backend/dist/services/simpleGitHubOAuth.js.map +1 -1
  176. package/backend/dist/services/simpleHuggingFaceOAuth.d.ts +1 -1
  177. package/backend/dist/services/simpleHuggingFaceOAuth.d.ts.map +1 -1
  178. package/backend/dist/services/simpleHuggingFaceOAuth.js +12 -17
  179. package/backend/dist/services/simpleHuggingFaceOAuth.js.map +1 -1
  180. package/backend/dist/services/systemDiagnosticsService.d.ts +117 -0
  181. package/backend/dist/services/systemDiagnosticsService.d.ts.map +1 -0
  182. package/backend/dist/services/systemDiagnosticsService.js +326 -0
  183. package/backend/dist/services/systemDiagnosticsService.js.map +1 -0
  184. package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
  185. package/backend/dist/services/turnstileService.d.ts +2 -1
  186. package/backend/dist/services/turnstileService.d.ts.map +1 -1
  187. package/backend/dist/services/turnstileService.js +28 -2
  188. package/backend/dist/services/turnstileService.js.map +1 -1
  189. package/backend/dist/services/userService.d.ts +1 -0
  190. package/backend/dist/services/userService.js +1 -1
  191. package/backend/dist/services/workAgentService.d.ts.map +1 -1
  192. package/backend/dist/services/workAgentService.js.map +1 -1
  193. package/backend/dist/services/workEventService.d.ts.map +1 -1
  194. package/backend/dist/services/workEventService.js.map +1 -1
  195. package/backend/dist/services/workHostWorkspaceService.d.ts.map +1 -1
  196. package/backend/dist/services/workModelProviderService.d.ts +3 -0
  197. package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
  198. package/backend/dist/services/workModelProviderService.js +67 -10
  199. package/backend/dist/services/workModelProviderService.js.map +1 -1
  200. package/backend/dist/services/workPreviewProxyService.d.ts +27 -0
  201. package/backend/dist/services/workPreviewProxyService.d.ts.map +1 -0
  202. package/backend/dist/services/workPreviewProxyService.js +514 -0
  203. package/backend/dist/services/workPreviewProxyService.js.map +1 -0
  204. package/backend/dist/services/workRuntimeService.d.ts +28 -7
  205. package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
  206. package/backend/dist/services/workRuntimeService.js +287 -8
  207. package/backend/dist/services/workRuntimeService.js.map +1 -1
  208. package/backend/dist/services/workTaskService.d.ts.map +1 -1
  209. package/backend/dist/services/workTaskService.js.map +1 -1
  210. package/backend/dist/services/workTerminalService.d.ts +1 -1
  211. package/backend/dist/services/workTerminalService.d.ts.map +1 -1
  212. package/backend/dist/services/workTerminalService.js.map +1 -1
  213. package/backend/dist/storage.d.ts +12 -1
  214. package/backend/dist/storage.d.ts.map +1 -1
  215. package/backend/dist/storage.js +183 -9
  216. package/backend/dist/storage.js.map +1 -1
  217. package/backend/dist/storageMappers.d.ts +13 -0
  218. package/backend/dist/storageMappers.d.ts.map +1 -1
  219. package/backend/dist/storageMappers.js +5 -0
  220. package/backend/dist/storageMappers.js.map +1 -1
  221. package/backend/dist/types/index.d.ts +106 -1
  222. package/backend/dist/types/index.d.ts.map +1 -1
  223. package/backend/dist/types/index.js.map +1 -1
  224. package/backend/dist/types/work.d.ts +31 -0
  225. package/backend/dist/types/work.d.ts.map +1 -1
  226. package/backend/dist/utils/chatContext.js.map +1 -1
  227. package/backend/dist/utils/chatDocumentContext.d.ts +1 -1
  228. package/backend/dist/utils/chatDocumentContext.d.ts.map +1 -1
  229. package/backend/dist/utils/chatDocumentContext.js +9 -4
  230. package/backend/dist/utils/chatDocumentContext.js.map +1 -1
  231. package/backend/dist/utils/chatProviderSelection.d.ts.map +1 -1
  232. package/backend/dist/utils/generationUtils.d.ts.map +1 -1
  233. package/backend/dist/utils/hash.d.ts.map +1 -1
  234. package/backend/dist/utils/hash.js +13 -2
  235. package/backend/dist/utils/hash.js.map +1 -1
  236. package/backend/dist/utils/logger.d.ts +1 -1
  237. package/backend/dist/utils/logger.d.ts.map +1 -1
  238. package/backend/dist/utils/ollamaStreaming.d.ts +6 -2
  239. package/backend/dist/utils/ollamaStreaming.d.ts.map +1 -1
  240. package/backend/dist/utils/ollamaStreaming.js +12 -2
  241. package/backend/dist/utils/ollamaStreaming.js.map +1 -1
  242. package/backend/dist/utils/openAIResponsesAdapter.js.map +1 -1
  243. package/backend/dist/utils/packagePaths.js.map +1 -1
  244. package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
  245. package/backend/dist/utils/pluginChatAdapter.js +11 -4
  246. package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
  247. package/backend/dist/utils/pluginChatContext.js.map +1 -1
  248. package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
  249. package/backend/dist/utils/pluginDefinitionTrust.js +2 -1
  250. package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
  251. package/backend/dist/utils/pluginStreamAdapter.d.ts +10 -1
  252. package/backend/dist/utils/pluginStreamAdapter.d.ts.map +1 -1
  253. package/backend/dist/utils/pluginStreamAdapter.js +30 -23
  254. package/backend/dist/utils/pluginStreamAdapter.js.map +1 -1
  255. package/backend/dist/utils/pluginValidation.d.ts +4 -3
  256. package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
  257. package/backend/dist/utils/pluginValidation.js +47 -2
  258. package/backend/dist/utils/pluginValidation.js.map +1 -1
  259. package/backend/dist/utils/resourceLimits.d.ts +10 -0
  260. package/backend/dist/utils/resourceLimits.d.ts.map +1 -0
  261. package/backend/dist/utils/resourceLimits.js +29 -0
  262. package/backend/dist/utils/resourceLimits.js.map +1 -0
  263. package/backend/dist/utils/thinkingPhaseTimer.d.ts +21 -0
  264. package/backend/dist/utils/thinkingPhaseTimer.d.ts.map +1 -0
  265. package/backend/dist/utils/thinkingPhaseTimer.js +84 -0
  266. package/backend/dist/utils/thinkingPhaseTimer.js.map +1 -0
  267. package/backend/dist/utils/webpageFetcher.d.ts +25 -0
  268. package/backend/dist/utils/webpageFetcher.d.ts.map +1 -0
  269. package/backend/dist/utils/webpageFetcher.js +231 -0
  270. package/backend/dist/utils/webpageFetcher.js.map +1 -0
  271. package/backend/dist/utils/websocketMessages.js.map +1 -1
  272. package/backend/dist/utils/workGit.d.ts +14 -0
  273. package/backend/dist/utils/workGit.d.ts.map +1 -0
  274. package/backend/dist/utils/workGit.js +207 -0
  275. package/backend/dist/utils/workGit.js.map +1 -0
  276. package/backend/dist/websocketServer.d.ts +1 -0
  277. package/backend/dist/websocketServer.d.ts.map +1 -1
  278. package/backend/dist/websocketServer.js +110 -25
  279. package/backend/dist/websocketServer.js.map +1 -1
  280. package/backend/dist/workTerminalServer.d.ts.map +1 -1
  281. package/backend/dist/workTerminalServer.js +3 -1
  282. package/backend/dist/workTerminalServer.js.map +1 -1
  283. package/backend/package.json +8 -7
  284. package/bin/cli.js +2 -2
  285. package/frontend/dist/assets/index-CFhy8YLA.css +1 -0
  286. package/frontend/dist/assets/index-_lG_lwU-.js +164 -0
  287. package/frontend/dist/assets/markdown-math-ClQbWekD.css +1 -0
  288. package/frontend/dist/assets/xterm-DHcfr8qj.css +1 -0
  289. package/frontend/dist/index.html +41 -16
  290. package/frontend/dist/js/ArtifactContainer-CjpvtR8G.js +1 -0
  291. package/frontend/dist/js/{ArtifactDemoPage-B4qsvUnF.js → ArtifactDemoPage-yrPXLBQo.js} +1 -1
  292. package/frontend/dist/js/ArtifactSlideOutPanel-DdsL2AOQ.js +1 -0
  293. package/frontend/dist/js/{Button-CRwzOaDZ.js → Button-X9TT9gTD.js} +1 -1
  294. package/frontend/dist/js/ChatPage-D9lWGM8g.js +16 -0
  295. package/frontend/dist/js/FirstTimeSetup-CwLPbHkI.js +1 -0
  296. package/frontend/dist/js/GalleryPage-C9DTdo_-.js +1 -0
  297. package/frontend/dist/js/HomePage-iF44c34e.js +1 -0
  298. package/frontend/dist/js/LibreClawPage-B9wWZIz6.js +1 -0
  299. package/frontend/dist/js/{ModelManagerModals-DMoEav1l.js → ModelManagerModals-D9j9RECi.js} +1 -1
  300. package/frontend/dist/js/ModelSelector-B0RKEJwC.js +1 -0
  301. package/frontend/dist/js/ModelsPage-DJXoIOs8.js +2 -0
  302. package/frontend/dist/js/NotesPage-BTNH6JR2.js +1 -0
  303. package/frontend/dist/js/{OptimizedSyntaxHighlighter-Ci9sRc78.js → OptimizedSyntaxHighlighter-CWYUn9Oe.js} +1 -1
  304. package/frontend/dist/js/PersonasPage--nqoJ-wA.js +13 -0
  305. package/frontend/dist/js/PluginUsagePage-BHwm-BBr.js +1 -0
  306. package/frontend/dist/js/{RichMessageContent-BJ49VN9j.js → RichMessageContent-DYRrXJ75.js} +3 -3
  307. package/frontend/dist/js/SettingsModal-y1Nzg55O.js +1 -0
  308. package/frontend/dist/js/SystemPage-CHez8h3p.js +1 -0
  309. package/frontend/dist/js/UserManagementPage-aJhKXQxG.js +1 -0
  310. package/frontend/dist/js/WorkPage-Ccla0MDm.js +5 -0
  311. package/frontend/dist/js/addon-fit-DIOBYJe3.js +1 -0
  312. package/frontend/dist/js/api-DVP8xiYT.js +19 -0
  313. package/frontend/dist/js/appStore-Cw7PmG-J.js +2 -0
  314. package/frontend/dist/js/ar-ONXFvOB1.js +2 -0
  315. package/frontend/dist/js/artifactHtml-C0Hu9I1u.js +41 -0
  316. package/frontend/dist/js/authStore-gv_MgDKr.js +3 -0
  317. package/frontend/dist/js/babel-CmENXdZw.js +16 -0
  318. package/frontend/dist/js/bn-BLhREPm6.js +2 -0
  319. package/frontend/dist/js/chatStore-DmDbolTg.js +2 -0
  320. package/frontend/dist/js/cs-Bg8E9fG5.js +2 -0
  321. package/frontend/dist/js/da-ODCU8w4x.js +2 -0
  322. package/frontend/dist/js/de-nuGHRJ5N.js +2 -0
  323. package/frontend/dist/js/es-DcN_cwum.js +2 -0
  324. package/frontend/dist/js/estree-DJwQLE88.js +44 -0
  325. package/frontend/dist/js/fr-C-L_xGr5.js +2 -0
  326. package/frontend/dist/js/hi-DUEtwA9G.js +2 -0
  327. package/frontend/dist/js/html-DdAOfeK4.js +25 -0
  328. package/frontend/dist/js/i18n-xir4Zz7C.js +2 -0
  329. package/frontend/dist/js/i18next-DgmgtwsV.js +1 -0
  330. package/frontend/dist/js/id-DNTYhti_.js +2 -0
  331. package/frontend/dist/js/imageGenModels-Dx_QMLJQ.js +1 -0
  332. package/frontend/dist/js/is-Bx28ymbQ.js +2 -0
  333. package/frontend/dist/js/it-BjW-JLlS.js +2 -0
  334. package/frontend/dist/js/ja-uThj4Q1w.js +2 -0
  335. package/frontend/dist/js/ko-DqgmMYXK.js +2 -0
  336. package/frontend/dist/js/logger-DSXjF4ye.js +1 -0
  337. package/frontend/dist/js/markdown-RaVsONor.js +70 -0
  338. package/frontend/dist/js/markdown-core-DHnR5Hw8.js +16 -0
  339. package/frontend/dist/js/markdown-math-B7FlYsmr.js +261 -0
  340. package/frontend/dist/js/messageCodeStyles-cTX0rQGK.js +2 -0
  341. package/frontend/dist/js/ms-R9kt_P0T.js +2 -0
  342. package/frontend/dist/js/nl-BjmtEgpK.js +2 -0
  343. package/frontend/dist/js/pl-C8_gU9r1.js +2 -0
  344. package/frontend/dist/js/postcss-B5WIGhAY.js +62 -0
  345. package/frontend/dist/js/pt-7BJForUD.js +2 -0
  346. package/frontend/dist/js/react-vendor-DPNXrO-8.js +9 -0
  347. package/frontend/dist/js/{rolldown-runtime-QTnfLwEv.js → rolldown-runtime-hePW80VL.js} +1 -1
  348. package/frontend/dist/js/router-vendor-Ca9zqOqT.js +1 -0
  349. package/frontend/dist/js/ru-D2HmhY6Y.js +2 -0
  350. package/frontend/dist/js/{standalone-DmLfI4Qj.js → standalone-B_aPlu7o.js} +8 -8
  351. package/frontend/dist/js/sv-zny3sDBM.js +2 -0
  352. package/frontend/dist/js/syntax-highlight-Ca9bHsaz.js +8 -0
  353. package/frontend/dist/js/th-CAzEKRz8.js +2 -0
  354. package/frontend/dist/js/tr-BmYgtmUo.js +2 -0
  355. package/frontend/dist/js/{typescript-Bcq62agC.js → typescript-Dz4OUZSl.js} +10 -10
  356. package/frontend/dist/js/ui-DDlcz2oy.js +2 -0
  357. package/frontend/dist/js/ui-vendor-D_pYT79f.js +177 -0
  358. package/frontend/dist/js/uk-eiYZ0uRq.js +2 -0
  359. package/frontend/dist/js/useTranslation-CdeLZqSW.js +1 -0
  360. package/frontend/dist/js/utils-BhpNrGnR.js +1 -0
  361. package/frontend/dist/js/utils-vendor-1zob7nK9.js +9 -0
  362. package/frontend/dist/js/vi-C7SVAWpO.js +2 -0
  363. package/frontend/dist/js/welcomePrompts-to5mv_gx.js +1 -0
  364. package/frontend/dist/js/xterm-Da5ppSVt.js +18 -0
  365. package/frontend/dist/js/{yaml-mLy9chOK.js → yaml-QD4znPfZ.js} +20 -20
  366. package/frontend/dist/js/zh-2Q3cQv3s.js +2 -0
  367. package/package.json +20 -13
  368. package/plugins/codex-oauth.json +19 -0
  369. package/plugins/openrouter.json +89 -0
  370. package/backend/dist/services/systemSettingsService.d.ts +0 -12
  371. package/backend/dist/services/systemSettingsService.d.ts.map +0 -1
  372. package/backend/dist/services/systemSettingsService.js +0 -70
  373. package/backend/dist/services/systemSettingsService.js.map +0 -1
  374. package/frontend/dist/assets/index-BqI0kezz.css +0 -1
  375. package/frontend/dist/assets/index-CRC6g6bL.js +0 -3
  376. package/frontend/dist/assets/markdown-math-CYlHEDRF.css +0 -1
  377. package/frontend/dist/assets/xterm-CmMoOwwu.css +0 -1
  378. package/frontend/dist/js/ArtifactContainer-Cdy-973y.js +0 -1
  379. package/frontend/dist/js/ArtifactSlideOutPanel-CmKgQ4eD.js +0 -1
  380. package/frontend/dist/js/ChatPage-CYT69oBR.js +0 -16
  381. package/frontend/dist/js/FirstTimeSetup-C8LdLP5J.js +0 -1
  382. package/frontend/dist/js/GalleryPage-Bm89pnS8.js +0 -1
  383. package/frontend/dist/js/HomePage-CeCYnMUG.js +0 -1
  384. package/frontend/dist/js/LibreClawPage-DGMEV6dm.js +0 -1
  385. package/frontend/dist/js/ModelSelector-DXPdGdQ_.js +0 -1
  386. package/frontend/dist/js/ModelsPage-D-FIy2x-.js +0 -2
  387. package/frontend/dist/js/PersonasPage-CIrEVFo5.js +0 -13
  388. package/frontend/dist/js/SettingsModal-CxtOXPY7.js +0 -1
  389. package/frontend/dist/js/UserManagementPage-BfyYGGFQ.js +0 -1
  390. package/frontend/dist/js/WorkPage-C7bW6Hxx.js +0 -4
  391. package/frontend/dist/js/addon-fit-Cj0_dfHF.js +0 -1
  392. package/frontend/dist/js/api-DCD41-l9.js +0 -19
  393. package/frontend/dist/js/appStore-Bw-8Exsx.js +0 -2
  394. package/frontend/dist/js/ar-BAHlIvy0.js +0 -2
  395. package/frontend/dist/js/artifactHtml-B7Oy2e__.js +0 -27
  396. package/frontend/dist/js/authStore-mOYH_AXI.js +0 -4
  397. package/frontend/dist/js/babel-BnLuavNv.js +0 -16
  398. package/frontend/dist/js/bn-BxquDVbd.js +0 -2
  399. package/frontend/dist/js/cs-C4DoKzRm.js +0 -2
  400. package/frontend/dist/js/da-CFslpGTw.js +0 -2
  401. package/frontend/dist/js/de-ChudoRh2.js +0 -2
  402. package/frontend/dist/js/demoMode-BhEpMVh5.js +0 -1
  403. package/frontend/dist/js/es-B36fefE-.js +0 -2
  404. package/frontend/dist/js/estree-0vwU39qX.js +0 -44
  405. package/frontend/dist/js/fr-BSVeTM5W.js +0 -2
  406. package/frontend/dist/js/hi-BGoFbl5V.js +0 -2
  407. package/frontend/dist/js/html-CApr2Bvi.js +0 -25
  408. package/frontend/dist/js/id-BfYs2p_j.js +0 -2
  409. package/frontend/dist/js/is-DZ1MS-5A.js +0 -2
  410. package/frontend/dist/js/it-CXtrPCG1.js +0 -2
  411. package/frontend/dist/js/ja-FPJ_NK_y.js +0 -2
  412. package/frontend/dist/js/ko-DVwD4ZZF.js +0 -2
  413. package/frontend/dist/js/logger-DbNs3-DK.js +0 -1
  414. package/frontend/dist/js/markdown-C78Qc6xu.js +0 -70
  415. package/frontend/dist/js/markdown-core-GI9BPwrB.js +0 -16
  416. package/frontend/dist/js/markdown-math-E4O1gcxj.js +0 -261
  417. package/frontend/dist/js/ms-PKPP0RX3.js +0 -2
  418. package/frontend/dist/js/nl-DWM5HJZ8.js +0 -2
  419. package/frontend/dist/js/pl-B9va8Tuf.js +0 -2
  420. package/frontend/dist/js/postcss-DSDkwgFE.js +0 -62
  421. package/frontend/dist/js/pt-P0IQi-Zr.js +0 -2
  422. package/frontend/dist/js/react-vendor-DyG_ODzn.js +0 -9
  423. package/frontend/dist/js/router-vendor-BjDI9mRe.js +0 -1
  424. package/frontend/dist/js/ru-Ca2bxYnc.js +0 -2
  425. package/frontend/dist/js/sv-DI4RDwyZ.js +0 -2
  426. package/frontend/dist/js/syntax-highlight-pM1xnNpY.js +0 -8
  427. package/frontend/dist/js/th-DN0bDS9d.js +0 -2
  428. package/frontend/dist/js/tr-ChqMv5Q4.js +0 -2
  429. package/frontend/dist/js/ui-vendor-DohPFHDW.js +0 -177
  430. package/frontend/dist/js/uk-Cr51h_XQ.js +0 -2
  431. package/frontend/dist/js/useBaseQuery-BAOlhjar.js +0 -1
  432. package/frontend/dist/js/useQuery-CcRqxveh.js +0 -1
  433. package/frontend/dist/js/useTranslation-Cs6iTP4m.js +0 -1
  434. package/frontend/dist/js/utils-DmZD5uA3.js +0 -1
  435. package/frontend/dist/js/utils-vendor-Cbaj0BC5.js +0 -9
  436. package/frontend/dist/js/vi-D4OhoVMH.js +0 -2
  437. package/frontend/dist/js/xterm-DKl1QLiw.js +0 -7
  438. package/frontend/dist/js/zh-Bvau7hlR.js +0 -2
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/RichMessageContent-BJ49VN9j.js","js/rolldown-runtime-QTnfLwEv.js","js/markdown-core-GI9BPwrB.js","js/router-vendor-BjDI9mRe.js","js/utils-DmZD5uA3.js","js/utils-vendor-Cbaj0BC5.js","js/appStore-Bw-8Exsx.js","js/demoMode-BhEpMVh5.js","js/logger-DbNs3-DK.js","js/markdown-math-E4O1gcxj.js","assets/markdown-math-CYlHEDRF.css","js/SettingsModal-CxtOXPY7.js","js/useQuery-CcRqxveh.js","js/useBaseQuery-BAOlhjar.js","js/useTranslation-Cs6iTP4m.js","js/ui-vendor-DohPFHDW.js","js/api-DCD41-l9.js","js/authStore-mOYH_AXI.js","js/Button-CRwzOaDZ.js","js/HomePage-CeCYnMUG.js","js/work-DVgm81bJ.js","js/ChatPage-CYT69oBR.js","js/react-vendor-DyG_ODzn.js","js/artifactHtml-B7Oy2e__.js","js/ArtifactContainer-Cdy-973y.js","js/OptimizedSyntaxHighlighter-Ci9sRc78.js","js/syntax-highlight-pM1xnNpY.js","js/ModelSelector-DXPdGdQ_.js","js/ModelsPage-D-FIy2x-.js","js/PersonasPage-CIrEVFo5.js","js/GalleryPage-Bm89pnS8.js","js/LibreClawPage-DGMEV6dm.js","js/WorkPage-C7bW6Hxx.js","js/UserManagementPage-BfyYGGFQ.js","js/ArtifactDemoPage-B4qsvUnF.js","js/ArtifactSlideOutPanel-CmKgQ4eD.js","js/FirstTimeSetup-C8LdLP5J.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"../js/rolldown-runtime-QTnfLwEv.js";import{d as t,f as n}from"../js/markdown-core-GI9BPwrB.js";import{n as r,t as i}from"../js/react-vendor-DyG_ODzn.js";import{_ as a,a as o,c as s,d as c,g as l,h as u,i as d,m as f,n as p,o as m,r as h,s as g,t as _,u as v,v as y}from"../js/router-vendor-BjDI9mRe.js";import{r as b,t as x}from"../js/useTranslation-Cs6iTP4m.js";import{$t as S,At as C,B as w,C as T,Ct as E,E as D,Et as ee,G as te,Gt as O,Ht as k,L as A,N as ne,O as re,Ot as j,P as ie,Qt as ae,St as oe,Tt as se,U as ce,V as le,Wt as ue,X as de,Xt as fe,_ as pe,_t as me,c as he,d as ge,dt as _e,en as M,ft as ve,ht as ye,jt as be,l as xe,m as Se,n as Ce,o as we,pt as Te,qt as Ee,s as De,tt as Oe,v as ke,y as Ae,zt as je}from"../js/ui-vendor-DohPFHDW.js";import{a as Me,o as Ne,t as Pe}from"../js/utils-vendor-Cbaj0BC5.js";import{n as Fe}from"../js/demoMode-BhEpMVh5.js";import{t as N}from"../js/logger-DbNs3-DK.js";import{D as Ie,E as Le,O as Re,f as ze}from"../js/api-DCD41-l9.js";import{i as Be,n as Ve,o as He,t as P}from"../js/utils-DmZD5uA3.js";import{a as Ue,c as We,h as Ge,l as Ke,n as F,p as qe,r as Je,u as Ye}from"../js/authStore-mOYH_AXI.js";import{t as Xe}from"../js/appStore-Bw-8Exsx.js";import{t as I}from"../js/Button-CRwzOaDZ.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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ze,Qe,$e={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},et=new(Ze=new WeakMap,Qe=new WeakMap,class{constructor(){a(this,Ze,$e),a(this,Qe,!1)}setTimeoutProvider(e){f(Ze,this,e)}setTimeout(e,t){return u(Ze,this).setTimeout(e,t)}clearTimeout(e){u(Ze,this).clearTimeout(e)}setInterval(e,t){return u(Ze,this).setInterval(e,t)}clearInterval(e){u(Ze,this).clearInterval(e)}});function tt(e){setTimeout(e,0)}var nt=typeof window>`u`||`Deno`in globalThis;function L(){}function rt(e,t){return typeof e==`function`?e(t):e}function it(e){return typeof e==`number`&&e>=0&&e!==1/0}function at(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ot(e,t){return typeof e==`function`?e(t):e}function st(e,t){return typeof e==`function`?e(t):e}function ct(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==ut(o,t.options))return!1}else if(!ft(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function lt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(dt(t.options.mutationKey)!==dt(a))return!1}else if(!ft(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function ut(e,t){return(t?.queryKeyHashFn||dt)(e)}function dt(e){return JSON.stringify(e,(e,t)=>_t(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ft(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>ft(e[n],t[n])):!1}var pt=Object.prototype.hasOwnProperty;function mt(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=gt(e)&&gt(t);if(!r&&!(_t(e)&&_t(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:pt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=mt(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ht(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function gt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function _t(e){if(!vt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!vt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function vt(e){return Object.prototype.toString.call(e)===`[object Object]`}function yt(e){return new Promise(t=>{et.setTimeout(t,e)})}function bt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:mt(e,t)}function xt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function St(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ct=Symbol();function wt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ct?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Tt(e,t){return typeof e==`function`?e(...t):!!e}function Et(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Dt=(()=>{let e=()=>nt;return{isServer(){return e()},setIsServer(t){e=t}}})(),Ot=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},kt,At,jt,Mt=new(kt=new WeakMap,At=new WeakMap,jt=new WeakMap,class extends Ot{constructor(){super(),a(this,kt,void 0),a(this,At,void 0),a(this,jt,void 0),f(jt,this,e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}})}onSubscribe(){u(At,this)||this.setEventListener(u(jt,this))}onUnsubscribe(){this.hasListeners()||(u(At,this)?.call(this),f(At,this,void 0))}setEventListener(e){f(jt,this,e),u(At,this)?.call(this),f(At,this,e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()}))}setFocused(e){u(kt,this)!==e&&(f(kt,this,e),this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof u(kt,this)==`boolean`?u(kt,this):globalThis.document?.visibilityState!==`hidden`}}),Nt=tt;function Pt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Nt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var R=Pt(),Ft,It,Lt,Rt=new(Ft=new WeakMap,It=new WeakMap,Lt=new WeakMap,class extends Ot{constructor(){super(),a(this,Ft,!0),a(this,It,void 0),a(this,Lt,void 0),f(Lt,this,e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}})}onSubscribe(){u(It,this)||this.setEventListener(u(Lt,this))}onUnsubscribe(){this.hasListeners()||(u(It,this)?.call(this),f(It,this,void 0))}setEventListener(e){f(Lt,this,e),u(It,this)?.call(this),f(It,this,e(this.setOnline.bind(this)))}setOnline(e){u(Ft,this)!==e&&(f(Ft,this,e),this.listeners.forEach(t=>{t(e)}))}isOnline(){return u(Ft,this)}});function zt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function Bt(e){return Math.min(1e3*2**e,3e4)}function Vt(e){return(e??`online`)===`online`?Rt.isOnline():!0}var Ht=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ut(e){let t=!1,n=0,r,i=zt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Ht(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Mt.isFocused()&&(e.networkMode===`always`||Rt.isOnline())&&e.canRun(),u=()=>Vt(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Dt.isServer()?0:3),o=e.retryDelay??Bt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),yt(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var Wt,Gt=(Wt=new WeakMap,class{constructor(){a(this,Wt,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),it(this.gcTime)&&f(Wt,this,et.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Dt.isServer()?1/0:300*1e3))}clearGcTimeout(){u(Wt,this)!==void 0&&(et.clearTimeout(u(Wt,this)),f(Wt,this,void 0))}});function Kt(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Et(e,()=>t.signal,()=>n=!0)},u=wt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?St:xt;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Jt:qt,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:qt(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function qt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Jt(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Yt(e,t){return t?qt(e,t)!=null:!1}function Xt(e,t){return!t||!e.getPreviousPageParam?!1:Jt(e,t)!=null}function Zt(e,t){y(e,t),t.add(e)}var Qt,$t,en,z,tn,B,nn,rn,V,an=(Qt=new WeakMap,$t=new WeakMap,en=new WeakMap,z=new WeakMap,tn=new WeakMap,B=new WeakMap,nn=new WeakMap,rn=new WeakMap,V=new WeakSet,class extends Gt{constructor(e){super(),Zt(this,V),a(this,Qt,void 0),a(this,$t,void 0),a(this,en,void 0),a(this,z,void 0),a(this,tn,void 0),a(this,B,void 0),a(this,nn,void 0),a(this,rn,void 0),f(rn,this,!1),f(nn,this,e.defaultOptions),this.setOptions(e.options),this.observers=[],f(tn,this,e.client),f(z,this,u(tn,this).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,f($t,this,un(this.options)),this.state=e.state??u($t,this),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return u(Qt,this)}get promise(){return u(B,this)?.promise}setOptions(e){if(this.options={...u(nn,this),...e},e?._type&&f(Qt,this,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=un(this.options);e.data!==void 0&&(this.setState(ln(e.data,e.dataUpdatedAt)),f($t,this,e))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&u(z,this).remove(this)}setData(e,t){let n=bt(this.state.data,e,this.options);return l(V,this,sn).call(this,{data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){l(V,this,sn).call(this,{type:`setState`,state:e})}cancel(e){let t=u(B,this)?.promise;return u(B,this)?.cancel(e),t?t.then(L).catch(L):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return u($t,this)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>st(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ct||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>ot(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!at(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),u(B,this)?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),u(B,this)?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),u(z,this).notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(u(B,this)&&(u(rn,this)||l(V,this,on).call(this)?u(B,this).cancel({revert:!0}):u(B,this).cancelRetry()),this.scheduleGc()),u(z,this).notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||l(V,this,sn).call(this,{type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&u(B,this)?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(u(B,this))return u(B,this).continueRetry(),u(B,this).promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(f(rn,this,!0),n.signal)})},i=()=>{let e=wt(this.options,t),n=(()=>{let e={client:u(tn,this),queryKey:this.queryKey,meta:this.meta};return r(e),e})();return f(rn,this,!1),this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:u(tn,this),state:this.state,fetchFn:i};return r(e),e})();(u(Qt,this)===`infinite`?Kt(this.options.pages):this.options.behavior)?.onFetch(a,this),f(en,this,this.state),(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&l(V,this,sn).call(this,{type:`fetch`,meta:a.fetchOptions?.meta}),f(B,this,Ut({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Ht&&e.revert&&this.setState({...u(en,this),fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{l(V,this,sn).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{l(V,this,sn).call(this,{type:`pause`})},onContinue:()=>{l(V,this,sn).call(this,{type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{let e=await u(B,this).start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),u(z,this).config.onSuccess?.(e,this),u(z,this).config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Ht){if(e.silent)return u(B,this).promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw l(V,this,sn).call(this,{type:`error`,error:e}),u(z,this).config.onError?.(e,this),u(z,this).config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}});function on(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}function sn(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...cn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...ln(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return f(en,this,e.manual?n:void 0),n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),R.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),u(z,this).notify({query:this,type:`updated`,action:e})})}function cn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function ln(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function un(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var H,dn=(H=new WeakMap,class extends Ot{constructor(e={}){super(),a(this,H,void 0),this.config=e,f(H,this,new Map)}build(e,t,n){let r=t.queryKey,i=t.queryHash??ut(r,t),a=this.get(i);return a||(a=new an({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){u(H,this).has(e.queryHash)||(u(H,this).set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=u(H,this).get(e.queryHash);t&&(e.destroy(),t===e&&u(H,this).delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){R.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return u(H,this).get(e)}getAll(){return[...u(H,this).values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ct(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ct(e,t)):t}notify(e){R.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){R.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){R.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}}),fn,U,W,pn,mn,hn=(fn=new WeakMap,U=new WeakMap,W=new WeakMap,pn=new WeakMap,mn=new WeakSet,class extends Gt{constructor(e){super(),Zt(this,mn),a(this,fn,void 0),a(this,U,void 0),a(this,W,void 0),a(this,pn,void 0),f(fn,this,e.client),this.mutationId=e.mutationId,f(W,this,e.mutationCache),f(U,this,[]),this.state=e.state||_n(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){u(U,this).includes(e)||(u(U,this).push(e),this.clearGcTimeout(),u(W,this).notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){f(U,this,u(U,this).filter(t=>t!==e)),this.scheduleGc(),u(W,this).notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){u(U,this).length||(this.state.status===`pending`?this.scheduleGc():u(W,this).remove(this))}continue(){return u(pn,this)?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{l(mn,this,gn).call(this,{type:`continue`})},n={client:u(fn,this),meta:this.options.meta,mutationKey:this.options.mutationKey};f(pn,this,Ut({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{l(mn,this,gn).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{l(mn,this,gn).call(this,{type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>u(W,this).canRun(this)}));let r=this.state.status===`pending`,i=!u(pn,this).canStart();try{if(r)t();else{l(mn,this,gn).call(this,{type:`pending`,variables:e,isPaused:i}),u(W,this).config.onMutate&&await u(W,this).config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&l(mn,this,gn).call(this,{type:`pending`,context:t,variables:e,isPaused:i})}let a=await u(pn,this).start();return await u(W,this).config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await u(W,this).config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),l(mn,this,gn).call(this,{type:`success`,data:a}),a}catch(t){try{await u(W,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 u(W,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 l(mn,this,gn).call(this,{type:`error`,error:t}),t}finally{u(W,this).runNext(this)}}});function gn(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),R.batch(()=>{u(U,this).forEach(t=>{t.onMutationUpdate(e)}),u(W,this).notify({mutation:this,type:`updated`,action:e})})}function _n(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var vn,G,yn,bn=(vn=new WeakMap,G=new WeakMap,yn=new WeakMap,class extends Ot{constructor(e={}){super(),a(this,vn,void 0),a(this,G,void 0),a(this,yn,void 0),this.config=e,f(vn,this,new Set),f(G,this,new Map),f(yn,this,0)}build(e,t,n){var r;let i=new hn({client:e,mutationCache:this,mutationId:f(yn,this,(r=u(yn,this),++r)),options:e.defaultMutationOptions(t),state:n});return this.add(i),i}add(e){u(vn,this).add(e);let t=xn(e);if(typeof t==`string`){let n=u(G,this).get(t);n?n.push(e):u(G,this).set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(u(vn,this).delete(e)){let t=xn(e);if(typeof t==`string`){let n=u(G,this).get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&u(G,this).delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=xn(e);if(typeof t==`string`){let n=u(G,this).get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=xn(e);return typeof t==`string`?(u(G,this).get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){R.batch(()=>{u(vn,this).forEach(e=>{this.notify({type:`removed`,mutation:e})}),u(vn,this).clear(),u(G,this).clear()})}getAll(){return Array.from(u(vn,this))}find(e){let t={exact:!0,...e};return this.getAll().find(e=>lt(t,e))}findAll(e={}){return this.getAll().filter(t=>lt(e,t))}notify(e){R.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return R.batch(()=>Promise.all(e.map(e=>e.continue().catch(L))))}});function xn(e){return e.options.scope?.id}var K,Sn,Cn,wn,Tn,En,Dn,On,kn=(K=new WeakMap,Sn=new WeakMap,Cn=new WeakMap,wn=new WeakMap,Tn=new WeakMap,En=new WeakMap,Dn=new WeakMap,On=new WeakMap,class{constructor(e={}){a(this,K,void 0),a(this,Sn,void 0),a(this,Cn,void 0),a(this,wn,void 0),a(this,Tn,void 0),a(this,En,void 0),a(this,Dn,void 0),a(this,On,void 0),f(K,this,e.queryCache||new dn),f(Sn,this,e.mutationCache||new bn),f(Cn,this,e.defaultOptions||{}),f(wn,this,new Map),f(Tn,this,new Map),f(En,this,0)}mount(){var e;f(En,this,(e=u(En,this),e++,e)),u(En,this)===1&&(f(Dn,this,Mt.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(K,this).onFocus())})),f(On,this,Rt.subscribe(async e=>{e&&(await this.resumePausedMutations(),u(K,this).onOnline())})))}unmount(){var e;f(En,this,(e=u(En,this),e--,e)),u(En,this)===0&&(u(Dn,this)?.call(this),f(Dn,this,void 0),u(On,this)?.call(this),f(On,this,void 0))}isFetching(e){return u(K,this).findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return u(Sn,this).findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return u(K,this).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=u(K,this).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ot(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return u(K,this).findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=u(K,this).get(r.queryHash)?.state.data,a=rt(t,i);if(a!==void 0)return u(K,this).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return R.batch(()=>u(K,this).findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return u(K,this).get(t.queryHash)?.state}removeQueries(e){let t=u(K,this);R.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=u(K,this);return R.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=R.batch(()=>u(K,this).findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(L).catch(L)}invalidateQueries(e,t={}){return R.batch(()=>(u(K,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=R.batch(()=>u(K,this).findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(L)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(L)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=u(K,this).build(this,t);return n.isStaleByTime(ot(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(L).catch(L)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(L).catch(L)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Rt.isOnline()?u(Sn,this).resumePausedMutations():Promise.resolve()}getQueryCache(){return u(K,this)}getMutationCache(){return u(Sn,this)}getDefaultOptions(){return u(Cn,this)}setDefaultOptions(e){f(Cn,this,e)}setQueryDefaults(e,t){u(wn,this).set(dt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...u(wn,this).values()],n={};return t.forEach(t=>{ft(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){u(Tn,this).set(dt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...u(Tn,this).values()],n={};return t.forEach(t=>{ft(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...u(Cn,this).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ut(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===Ct&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...u(Cn,this).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){u(K,this).clear(),u(Sn,this).clear()}}),q=e(n(),1),J=t(),An=q.createContext(void 0),jn=e=>{let t=q.useContext(An);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Mn=({client:e,children:t})=>(q.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,J.jsx)(An.Provider,{value:e,children:t})),Nn=e(i(),1),Y=e=>typeof e==`string`,Pn=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},Fn=e=>e==null?``:String(e),In=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},Ln=/###/g,Rn=e=>e&&e.includes(`###`)?e.replace(Ln,`.`):e,zn=e=>!e||Y(e),Bn=(e,t,n)=>{let r=Y(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(zn(e))return{};let t=Rn(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return zn(e)?{}:{obj:e,k:Rn(r[i])}},Vn=(e,t,n)=>{let{obj:r,k:i}=Bn(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=Bn(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=Bn(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},Hn=(e,t,n,r)=>{let{obj:i,k:a}=Bn(e,t,Object);i[a]=i[a]||[],i[a].push(n)},Un=(e,t)=>{let{obj:n,k:r}=Bn(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},Wn=(e,t,n)=>{let r=Un(e,n);return r===void 0?Un(t,n):r},Gn=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?Y(e[r])||e[r]instanceof String||Y(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Gn(e[r],t[r],n):e[r]=t[r]);return e},X=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),Kn={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},qn=e=>Y(e)?e.replace(/[&<>"'\/]/g,e=>Kn[e]):e,Jn=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},Yn=[` `,`,`,`?`,`!`,`;`],Xn=new Jn(20),Zn=(e,t,n)=>{t=t||``,n=n||``;let r=Yn.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=Xn.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},Qn=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},$n=e=>e?.replace(/_/g,`-`),er={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},Z=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||er,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>Y(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),Y(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},tr=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},nr=class extends tr{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):Y(n)&&i?o.push(...n.split(i)):o.push(n)));let s=Un(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!Y(n)?s:Qn(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),Vn(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(Y(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=Un(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Gn(s,n,i):s={...s,...n},Vn(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},rr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},ir=Symbol(`i18next/PATH_KEY`);function ar(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===ir?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function or(e,t){let{[ir]:n}=e(ar()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var sr=e=>!Y(e)&&typeof e!=`boolean`&&typeof e!=`number`,cr=class e extends tr{constructor(e,t={}){super(),In([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=Z.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=sr(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Zn(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Y(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:Y(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||(i={}),t==null)return``;typeof t==`function`&&(t=or(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?or(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!Y(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=sr(E),ee=Object.prototype.toString.apply(E);if(y&&E&&D&&!_.includes(ee)&&!(Y(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:sr(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&Y(v)&&Array.isArray(m))m=m.join(v),m&&(m=this.extendTranslation(m,t,i,r));else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,b&&!c?`${s}${this.pluralResolver.getSuffix(d,i.count,i)}`:s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=Y(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!Y(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=Y(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=rr.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return Y(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?or(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!Y(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(Y(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(i)&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!Y(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r.count=e.count),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},lr=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Z.create(`languageUtils`)}getScriptPartFromCode(e){if(e=$n(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=$n(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Y(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),Y(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}toResolveHierarchy(e,t){let n=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),r=[],i=e=>{e&&(this.isSupportedCode(e)?r.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Y(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&i(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&i(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&i(this.getLanguagePartFromCode(e))):Y(e)&&i(this.formatLanguageCode(e)),n.forEach(e=>{r.includes(e)||i(this.formatLanguageCode(e))}),r}},ur={zero:0,one:1,two:2,few:3,many:4,other:5},dr={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},fr=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Z.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=$n(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),dr;if(!e.match(/-|_/))return dr;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule(`dev`,t)),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||(n=this.getRule(`dev`,t)),n?n.resolvedOptions().pluralCategories.sort((e,t)=>ur[e]-ur[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},pr=(e,t,n,r=`.`,i=!0)=>{let a=Wn(e,t,n);return!a&&i&&Y(n)&&(a=Qn(e,n,r),a===void 0&&(a=Qn(t,n,r))),a},mr=e=>e.replace(/\$/g,`$$$$`),hr=class{constructor(e={}){this.logger=Z.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?qn:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?X(i):a||`{{`,this.suffix=o?X(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?X(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?X(l):``,this.nestingPrefix=d?X(d):f||X(`$t(`),this.nestingSuffix=p?X(p):m||X(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_===void 0?!1:_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){let i=pr(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(pr(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>mr(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?mr(this.escape(e)):mr(e)}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=Y(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else!Y(a)&&!this.useRawValueToEscape&&(a=Fn(a));let s=t.safeValue(a);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=a.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${X(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!Y(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!Y(i))return i;Y(i)||(i=Fn(i)),i||(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),i=``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],i),this.regexp.lastIndex=0}return e}},gr=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||(n.currency=i.trim()):t===`relativetime`&&!i.includes(`:`)?n.range||(n.range=i.trim()):i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},_r=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e($n(r),i),t[o]=s),s(n)}},vr=e=>(t,n,r)=>e($n(n),r)(t),yr=class{constructor(e={}){this.logger=Z.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?_r:vr;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=_r(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator),a=[];for(let e=0;e<i.length;e++){let t=i[e];for(;t.indexOf(`(`)>-1&&!t.includes(`)`)&&e+1<i.length;)t=`${t}${this.formatSeparator}${i[++e]}`;a.push(t)}return a.reduce((e,t)=>{let{formatName:i,formatOptions:a}=gr(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},br=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},xr=class extends tr{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Z.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{Hn(n.loaded,[i],a),br(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();Y(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Y(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},Sr=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),Y(e[1])&&(t.defaultValue=e[1]),Y(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Cr=e=>(Y(e.ns)&&(e.ns=[e.ns]),Y(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Y(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),wr=()=>{},Tr=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},Q=class e extends tr{constructor(e={},t){if(super(),this.options=Cr(e),this.services={},this.logger=Z,this.modules={external:[]},Tr(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(Y(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=Sr();this.options={...n,...this.options,...Cr(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?Z.init(r(this.modules.logger),this.options):Z.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:yr;let t=new lr(this.options);this.store=new nr(this.options.resources,this.options);let n=this.services;n.logger=Z,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new fr(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new hr(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new xr(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new cr(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=wr),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=Pn(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=wr){let n=t,r=Y(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=Pn();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),n||(n=wr),this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&rr.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&![`cimode`,`dev`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=Pn();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=Y(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(Y(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n,r){let i=r?.scopeNs,a=(e,t,...r)=>{let o;o=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),o.lng=o.lng||a.lng,o.lngs=o.lngs||a.lngs;let s=o.ns!==void 0&&o.ns!==null;o.ns=o.ns||a.ns,o.keyPrefix!==``&&(o.keyPrefix=o.keyPrefix||n||a.keyPrefix);let c={...this.options,...o};Array.isArray(i)&&!s&&(c.ns=i),typeof o.keyPrefix==`function`&&(o.keyPrefix=or(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=or(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=or(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return Y(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=Pn();return this.options.ns?(Y(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=Pn();Y(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new lr(Sr());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=wr){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new nr(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...Sr().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new hr(n)}return a.translator=new cr(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();Q.createInstance,Q.dir,Q.init,Q.loadResources,Q.reloadResources,Q.use,Q.changeLanguage,Q.getFixedT,Q.t,Q.exists,Q.setDefaultNamespace,Q.hasLoadedNamespace,Q.loadNamespaces,Q.loadLanguages;var{slice:Er,forEach:Dr}=[];function Or(e){return Dr.call(Er.call(arguments,1),t=>{if(t)for(let n in t)e[n]===void 0&&(e[n]=t[n])}),e}function kr(e){return typeof e==`string`?[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(t=>t.test(e)):!1}var Ar=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,jr=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:`/`},r=`${e}=${encodeURIComponent(t)}`;if(n.maxAge>0){let e=n.maxAge-0;if(Number.isNaN(e))throw Error(`maxAge should be a Number`);r+=`; Max-Age=${Math.floor(e)}`}if(n.domain){if(!Ar.test(n.domain))throw TypeError(`option domain is invalid`);r+=`; Domain=${n.domain}`}if(n.path){if(!Ar.test(n.path))throw TypeError(`option path is invalid`);r+=`; Path=${n.path}`}if(n.expires){if(typeof n.expires.toUTCString!=`function`)throw TypeError(`option expires is invalid`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite)switch(typeof n.sameSite==`string`?n.sameSite.toLowerCase():n.sameSite){case!0:r+=`; SameSite=Strict`;break;case`lax`:r+=`; SameSite=Lax`;break;case`strict`:r+=`; SameSite=Strict`;break;case`none`:r+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid`)}return n.partitioned&&(r+=`; Partitioned`),r},Mr={create(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:`/`,sameSite:`strict`};n&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+n*60*1e3)),r&&(i.domain=r),document.cookie=jr(e,t,i)},read(e){let t=`${e}=`,n=document.cookie.split(`;`);for(let e=0;e<n.length;e++){let r=n[e];for(;r.charAt(0)===` `;)r=r.substring(1,r.length);if(r.indexOf(t)===0)return r.substring(t.length,r.length)}return null},remove(e,t){this.create(e,``,-1,t)}},Nr={name:`cookie`,lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<`u`)return Mr.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:i,cookieOptions:a}=t;n&&typeof document<`u`&&Mr.create(n,e,r,i,a)}},Pr={name:`querystring`,lookup(e){let{lookupQuerystring:t}=e,n;if(typeof window<`u`){let{search:e}=window.location;!window.location.search&&window.location.hash?.indexOf(`?`)>-1&&(e=window.location.hash.substring(window.location.hash.indexOf(`?`)));let r=e.substring(1).split(`&`);for(let e=0;e<r.length;e++){let i=r[e].indexOf(`=`);i>0&&r[e].substring(0,i)===t&&(n=r[e].substring(i+1))}}return n}},Fr={name:`hash`,lookup(e){let{lookupHash:t,lookupFromHashIndex:n}=e,r;if(typeof window<`u`){let{hash:e}=window.location;if(e&&e.length>2){let i=e.substring(1);if(t){let e=i.split(`&`);for(let n=0;n<e.length;n++){let i=e[n].indexOf(`=`);i>0&&e[n].substring(0,i)===t&&(r=e[n].substring(i+1))}}if(r)return r;if(!r&&n>-1){let t=e.match(/\/([a-zA-Z-]*)/g);return Array.isArray(t)?t[typeof n==`number`?n:0]?.replace(`/`,``):void 0}}}return r}},Ir=null,Lr=()=>{if(Ir!==null)return Ir;try{if(Ir=typeof window<`u`&&window.localStorage!==null,!Ir)return!1;let e=`i18next.translate.boo`;window.localStorage.setItem(e,`foo`),window.localStorage.removeItem(e)}catch{Ir=!1}return Ir},Rr={name:`localStorage`,lookup(e){let{lookupLocalStorage:t}=e;if(t&&Lr())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&Lr()&&window.localStorage.setItem(n,e)}},zr=null,Br=()=>{if(zr!==null)return zr;try{if(zr=typeof window<`u`&&window.sessionStorage!==null,!zr)return!1;let e=`i18next.translate.boo`;window.sessionStorage.setItem(e,`foo`),window.sessionStorage.removeItem(e)}catch{zr=!1}return zr},Vr={name:`sessionStorage`,lookup(e){let{lookupSessionStorage:t}=e;if(t&&Br())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&Br()&&window.sessionStorage.setItem(n,e)}},Hr={name:`navigator`,lookup(e){let t=[];if(typeof navigator<`u`){let{languages:e,userLanguage:n,language:r}=navigator;if(e)for(let n=0;n<e.length;n++)t.push(e[n]);n&&t.push(n),r&&t.push(r)}return t.length>0?t:void 0}},Ur={name:`htmlTag`,lookup(e){let{htmlTag:t}=e,n,r=t||(typeof document<`u`?document.documentElement:null);return r&&typeof r.getAttribute==`function`&&(n=r.getAttribute(`lang`)),n}},Wr={name:`path`,lookup(e){let{lookupFromPathIndex:t}=e;if(typeof window>`u`)return;let n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(Array.isArray(n))return n[typeof t==`number`?t:0]?.replace(`/`,``)}},Gr={name:`subdomain`,lookup(e){let{lookupFromSubdomainIndex:t}=e,n=typeof t==`number`?t+1:1,r=typeof window<`u`&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}},Kr=!1;try{document.cookie,Kr=!0}catch{}var qr=[`querystring`,`cookie`,`localStorage`,`sessionStorage`,`navigator`,`htmlTag`];Kr||qr.splice(1,1);var Jr=()=>({order:qr,lookupQuerystring:`lng`,lookupCookie:`i18next`,lookupLocalStorage:`i18nextLng`,lookupSessionStorage:`i18nextLng`,caches:[`localStorage`],excludeCacheFor:[`cimode`],convertDetectedLanguage:e=>e}),Yr=class{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type=`languageDetector`,this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=Or(t,this.options||{},Jr()),typeof this.options.convertDetectedLanguage==`string`&&this.options.convertDetectedLanguage.indexOf(`15897`)>-1&&(this.options.convertDetectedLanguage=e=>e.replace(`-`,`_`)),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=n,this.addDetector(Nr),this.addDetector(Pr),this.addDetector(Rr),this.addDetector(Vr),this.addDetector(Hr),this.addDetector(Ur),this.addDetector(Wr),this.addDetector(Gr),this.addDetector(Fr)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,t=[];return e.forEach(e=>{if(this.detectors[e]){let n=this.detectors[e].lookup(this.options);n&&typeof n==`string`&&(n=[n]),n&&(t=t.concat(n))}}),t=t.filter(e=>e!=null&&!kr(e)).map(e=>this.options.convertDetectedLanguage(e)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach(t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(e,this.options)}))}};Yr.type=`languageDetector`;var Xr={common:{loading:`Loading...`,save:`Save`,saving:`Saving...`,cancel:`Cancel`,delete:`Delete`,edit:`Edit`,close:`Close`,back:`Back`,next:`Next`,confirm:`Confirm`,error:`Error`,success:`Success`,warning:`Warning`,or:`or`,optional:`optional`,enabled:`Enabled`,disabled:`Disabled`,on:`On`,off:`Off`,yes:`Yes`,no:`No`,search:`Search`,noResults:`No results found`,retry:`Retry`,refresh:`Refresh`,download:`Download`,upload:`Upload`,export:`Export`,import:`Import`,reset:`Reset`,apply:`Apply`,clear:`Clear`,all:`All`,none:`None`,default:`Default`,custom:`Custom`,remove:`Remove`},brand:{name:`Libre WebUI`,shortName:`Libre`},auth:{login:{title:`Welcome Back`,subtitle:`Sign in to your account to continue`,username:`Username`,usernamePlaceholder:`Enter your username`,password:`Password`,passwordPlaceholder:`Enter your password`,signIn:`Sign In`,signingIn:`Signing in...`,noAccount:`Don't have an account?`,signUpHere:`Sign up here`,loginSuccess:`Login successful!`,loginFailed:`Login failed`,checkCredentials:`Login failed. Please check your credentials.`,enterBoth:`Please enter both username and password`,githubSuccess:`GitHub login successful!`,githubFailed:`GitHub authentication failed`,githubVerifyFailed:`Failed to verify GitHub authentication`},signup:{title:`Create Account`,subtitle:`Sign up for your new account`,username:`Username`,usernamePlaceholder:`Choose a username`,email:`Email`,emailPlaceholder:`your@email.com`,password:`Password`,passwordPlaceholder:`Choose a password`,confirmPassword:`Confirm Password`,confirmPasswordPlaceholder:`Confirm your password`,createAccount:`Create Account`,creatingAccount:`Creating account...`,hasAccount:`Already have an account?`,signInHere:`Sign in here`,signupSuccess:`Account created successfully!`,signupFailed:`Signup failed`,tryAgain:`Signup failed. Please try again.`,usernameRequired:`Username and password are required`,passwordMismatch:`Passwords do not match`,passwordTooShort:`Password must be at least 6 characters long`},logout:{button:`Log out`,success:`Logged out successfully`},oauth:{continueWith:`Continue with {{provider}}`,connectingTo:`Connecting to {{provider}}...`,github:`GitHub`,huggingFace:`Hugging Face`},checkingAuth:`Checking authentication...`,welcome:`Welcome`,noEmail:`No email provided`,role:`Role`,id:`ID`,userId:`User ID`,signInDescription:`Sign in with your GitHub account to continue`,signInWithGitHub:`Sign in with GitHub`,jwtActive:`JWT Authentication Active`,jwtDescription:`JWT-based authentication with GitHub OAuth`,github:`GitHub`,provider:`Provider`,tagline:`Your AI stack should answer to you.`,selfHosted:`Self-hosted · Apache 2.0`,highlights:{local:{title:`Local first`,body:`Your conversations and files stay on the machine you run this on.`},providers:{title:`Any provider`,body:`Local models through Ollama, plus the remote providers you choose to add.`},work:{title:`Isolated Work`,body:`Give a model a sandboxed workspace with files, a terminal, and a preview.`}}},setup:{welcome:{title:`Welcome to Libre WebUI`,subtitle:`Let's Get Started`,description:`Set up your Libre WebUI instance in just a few steps`,createAdmin:`Create Admin Account`,features:{secure:{title:`Secure & Private`,description:`Your conversations stay on your device`},fast:{title:`Fast & Responsive`,description:`Optimized for speed and performance`},openSource:{title:`Open Source`,description:`Free and open source software`}}},admin:{title:`Create Admin Account`,subtitle:`Administrator Setup`,description:`Create the first admin account for your Libre WebUI instance`,usernamePlaceholder:`Enter admin username`,passwordPlaceholder:`Enter password (min 6 characters)`,confirmPlaceholder:`Confirm your password`,creating:`Creating...`,createAdmin:`Create Admin`,success:`Admin account created successfully!`,failed:`Failed to create admin account`,fillAllFields:`Please fill in all fields`,note:`This will be the primary administrator account for your Libre WebUI instance`},encryptionKey:{title:`Save Your Encryption Key`,subtitle:`Important: Save This Key`,description:`This encryption key protects your sensitive data. Store it securely - you'll need it if you ever need to restore your database.`,warning:`Warning`,warningText:`If you lose this key and need to restore your database, your encrypted data (API keys, preferences) will be unrecoverable.`,label:`Your Encryption Key`,loading:`Loading...`,copyToClipboard:`Copy to clipboard`,copied:`Encryption key copied to clipboard!`,copyFailed:`Failed to copy key to clipboard`,envNote:`This key is also saved in your backend/.env file as ENCRYPTION_KEY`,acknowledgment:`I have saved my encryption key in a secure location and understand that losing it may result in data loss.`,confirmRequired:`Please confirm that you have saved the encryption key`,continue:`Continue to Libre WebUI`}},chat:{greeting:{morning:`Good morning`,afternoon:`Good afternoon`,evening:`Good evening`,night:`Good night`},welcome:{helpToday:`What can I help with today?`,helpTonight:`What can I help with tonight?`,variety:{create:{title:`What should we make?`,subtitle:`Start with a thought, a sketch, or a stubborn problem.`},explore:{title:`Where should we begin?`,subtitle:`Bring the question you keep returning to.`},imagine:{title:`What are you imagining?`,subtitle:`We can shape it together.`},focus:{title:`What deserves your attention?`,subtitle:`Let's make the next step clear.`},untangle:{title:`What's tangled?`,subtitle:`Give me the messy version first.`},momentum:{title:`Ready when you are.`,subtitle:`Pick up an idea, plan, or unfinished thread.`},open:{title:`What's on your mind?`,subtitle:`Small thought or ambitious project. Both work.`},challenge:{title:`What are we solving?`,subtitle:`Tell me what isn't working yet.`},draft:{title:`Let's start somewhere.`,subtitle:`It doesn't have to be polished.`},possibility:{title:`What could this become?`,subtitle:`Show me the raw material.`},unexpected:{title:`Make something unexpected.`,subtitle:`Give me a constraint, a mood, or a half-formed idea.`}}},input:{placeholder:`Send a message`,messagePlaceholder:`Message...`,attachImages:`Attach images`,attachments:`Attachments and advanced features`,sendMessage:`Send message`,stopGeneration:`Stop generation`},session:{new:`New Chat`,work:`Work`,chat:`Chat`,private:`Private`,privateMode:`Private Mode`,privateDescription:`This conversation won't be saved`,privateTooltip:`Start a private conversation that won't be saved`,deleteConfirm:`Are you sure you want to delete this chat?`,generatingTitle:`Generating title`,noChats:`No chats yet`,createFirst:`Create your first chat above`,chats:`Chats`,renameChat:`Rename chat`,deleteChat:`Delete chat`},persona:{applied:`Persona applied`,label:`Persona`},model:{updated:`Model updated`,noModels:`No models available`,noModelsDescription:`No models available. Make sure Ollama is running and has models installed.`,pullCommand:`ollama pull llama3.2:3b`,noModelsTooltip:`No models available. Please ensure Ollama is running and models are installed.`},footer:{disclaimer:`LLM can make mistakes - verify important information`,images:`{{count}} image`,images_plural:`{{count}} images`,structuredOutput:`Structured output`},mediaUpload:{dropImagesHere:`Drop images here or`,supportedFormats:`Supports: JPG, PNG, GIF, WebP (max 10MB each)`,browse:`browse`},structuredOutput:{title:`Response Format`,none:`None (Natural Language)`,noneDescription:`Default natural language response`,json:`JSON`,jsonDescription:`Structured JSON format`,list:`List`,listDescription:`Array of items`,summary:`Summary`,summaryDescription:`Document summary with key points`,analysis:`Analysis`,analysisDescription:`Structured analysis with pros/cons`,custom:`Custom Schema`,customDescription:`Define your own JSON schema`,customSchema:`Custom JSON schema`,schemaPreview:`Schema Preview`,applySchema:`Apply Schema`,cancel:`Cancel`,enabled:`Structured output enabled`}},sidebar:{navigation:{chat:`Chat`,models:`Models`,personas:`Personas`,imagine:`Imagine`,agents:`Agents`,work:`Work`,settings:`Settings`,userManagement:`User Management`,signOut:`Sign Out`,exploreLabel:`Explore`},toggleSize:`Toggle sidebar size`,expandSidebar:`Expand sidebar`},user:{menu:{changePicture:`Change Picture`,settings:`Settings`,userManagement:`User Management`,logout:`Log out`},avatar:{title:`Change Profile Picture`,updated:`Profile picture updated`,updateFailed:`Failed to update profile picture`,saving:`Saving...`,label:`Avatar`,uploadAvatarImage:`Upload avatar image`,dragAndDrop:`Drag and drop an image or click to browse`,chooseImage:`Choose Image`,uploading:`Uploading...`,enterImageUrl:`Or enter image URL`,supportedFormats:`Supports: JPG, PNG, GIF, WebP (max 2MB). Square images work best.`,customAvatar:`Custom avatar image`,clickToChange:`Click to change or remove`,removed:`Avatar removed`,uploaded:`Avatar uploaded successfully`,invalidFile:`Please select a valid image file`,fileTooLarge:`Avatar image size must be less than 2MB`,readFailed:`Failed to read image file`,uploadFailed:`Failed to upload avatar image`},profile:{noEmail:`No email provided`}},settings:JSON.parse(`{"title":"Settings","tabs":{"appearance":"Appearance","model":"Model","systemMessage":"System Message","plugins":"Plugins","generation":"Generation","documents":"Documents","tts":"Speech","imageGen":"Images","data":"Data","about":"About"},"appearance":{"title":"Appearance","language":{"title":"Language","description":"Select your preferred language"},"theme":{"title":"Theme","light":"Light","dark":"Dark","amoled":"Pure Black","system":"System"},"accent":{"title":"Accent color","custom":"Custom color","useColor":"Use {{color}} accent","behaviorTitle":"Interface palette","behaviorDescription":"Choose whether the accent stays on controls or adapts the entire light or dark interface.","defaultStyle":"Default","defaultStyleDescription":"Keep the neutral light and dark surfaces.","adaptedStyle":"Adapt to accent","adaptedStyleDescription":"Tint surfaces, borders, and text with your accent."},"chatInterface":{"title":"Chat Interface","showUsername":"Show Username","showUsernameDescription":"Display username in chat messages"},"background":{"title":"Background Image","enable":"Enable background image","enableDescription":"Show custom background with blur effect","blur":"Blur","opacity":"Opacity","upload":"Upload background image","dragDrop":"Drag and drop an image or click to browse","chooseImage":"Choose Image"}},"saveSettings":"Save Settings","model":{"title":"Model Settings","defaultModel":"Default Model","defaultModelDescription":"This model will be used by default for new conversations","selectModel":"Select a model","persona":"Persona","updateAll":"Update All Models","updateAllDescription":"Check for updates and pull latest versions of all installed models","updateAllButton":"Update All","updating":"Updating models...","currentModelInfo":"Current Model Info","name":"Name","size":"Size","family":"Family","format":"Format","status":"Status","statusStarting":"Starting...","statusComplete":"Complete","statusError":"Error","bulkOperations":"Bulk Operations","autoTitle":{"title":"Auto Title Generation","enable":"Enable Auto Title","enableDescription":"Automatically generate titles for new conversations","taskModel":"Task Model","selectTaskModel":"Select task model","taskModelDescription":"Model used for generating conversation titles"},"updatingModel":"Updating {{name}} ({{current}}/{{total}})","modelsProgress":"{{current}} of {{total}} models","modelPullAccess":"Model Install Access","modelPullAccessDescription":"Allow non-admin users to pull and install new models.","modelPullAccessSaved":"Model install permissions updated","modelPullAccessSaveFailed":"Failed to update model install permissions"},"systemMessage":{"title":"System Message","description":"Set a custom system message that will be used for all new conversations.","placeholder":"Enter a system message...","saved":"System message saved","saveFailed":"Failed to save system message"},"plugins":{"title":"Plugins","description":"Manage your installed plugins","providerConnections":"Provider connections","providerConnectionsDescription":"Connect, configure, and inspect model providers through plugins.","providers":"Providers","searchProviders":"Search providers","noProvidersFound":"No providers match your search.","selectProvider":"Select a provider","selectProviderDescription":"Choose a provider to inspect its connection and model catalog.","addNew":"Add New Plugin","upload":"Upload Plugin","addJson":"Add JSON","uploading":"Uploading...","jsonPlaceholder":"Paste plugin JSON configuration...","install":"Install Plugin","noPlugins":"No plugins installed","noPluginsDescription":"Add a plugin to extend functionality","loading":"Loading plugins...","installed":"Installed Plugins","active":"Active Plugins","activeLabel":"Active","inactive":"Inactive","activate":"Activate","deactivate":"Deactivate","models":"models","apiKeySet":"API Key Set","apiKeyConfiguration":"API Key Configuration","apiKeyDescription":"Store a personal API key for {{name}}.","apiKeyEnvAlternative":"Alternatively, set the","environmentVariable":"environment variable","apiKeyConfigured":"API key configured","apiKeyPlaceholder":"Enter your API key...","saveApiKey":"Save API Key","showApiKey":"Show API key","hideApiKey":"Hide API key","configure":"Configure","providerSettings":"Provider settings","status":"Status","defaultEndpoint":"Default endpoint","modelCatalog":"Model catalog","modelCatalogDescription":"Discovered and configured models for this provider and its capabilities.","refreshModels":"Refresh models","noModelsConfigured":"No models are configured for this provider.","modelId":"Model ID","capabilities":"Capabilities","modelCatalogUpdated":"Model catalog updated: {{count}} models.","modelCatalogUnchanged":"Model catalog is already up to date.","modelCatalogNeedsApiKey":"Add a valid API key for this provider to load its live model list.","modelCatalogUnavailable":"Could not load the provider's model list.","modelCatalogRefreshFailed":"Failed to refresh the model catalog","capability":{"chat":"Chat","embedding":"Embedding","image":"Image","speech":"Speech","transcription":"Transcription"},"exportPlugin":"Export plugin","deletePlugin":"Delete plugin","apiKey":{"title":"API Key","placeholder":"Enter API key","save":"Save Key","remove":"Remove Key","configured":"API Key Configured","notConfigured":"API Key Required","saved":"API key saved successfully","removed":"API key removed","saveFailed":"Failed to save API key","removeFailed":"Failed to remove API key","enterKey":"Please enter an API key"},"variables":"Variables"},"generation":{"title":"Generation Options","description":"Configure how the AI generates responses","advancedSettings":"Advanced generation settings","advancedSettingsDescription":"Sampling, token limits, context, penalties, and stop sequences","coreParameters":"Core Parameters","temperature":"Temperature","temperatureDescription":"Controls randomness. Lower values are more focused, higher values more creative.","topP":"Top P","topPDescription":"Controls diversity via nucleus sampling. Lower values focus on likely tokens.","topK":"Top K","topKDescription":"Limits token selection to top K most likely. Set to 0 to disable.","minP":"Min P","minPDescription":"Minimum probability threshold for token selection.","generationControl":"Generation Control","maxTokens":"Max Tokens","maxTokensDescription":"Maximum number of tokens to generate in the response.","repeatPenalty":"Repeat Penalty","repeatPenaltyDescription":"Penalizes repeated tokens. Higher values reduce repetition.","contextLength":"Context Length","contextLengthDescription":"Maximum context window size for conversations.","seed":"Seed","optional":"optional","random":"Random","seedDescription":"Set a specific seed for reproducible outputs.","advancedOptions":"Advanced Options","presencePenalty":"Presence Penalty","presencePenaltyDescription":"Penalizes tokens that appear in the context.","frequencyPenalty":"Frequency Penalty","frequencyPenaltyDescription":"Penalizes frequently used tokens.","stopSequences":"Stop Sequences","commaSeparated":"comma separated","stopSequencesDescription":"Custom tokens that will stop generation when encountered.","resetDefaults":"Reset to Defaults","saveOptions":"Save Options","embeddingSettings":"Embedding Settings","enableEmbeddings":"Enable Document Embeddings"},"documents":{"title":"Document Settings","embeddings":{"title":"Embeddings","enable":"Enable document embeddings","model":"Embedding Model","modelDescription":"Select the model used for document embedding","chunkSize":"Chunk Size","chunkSizeInTokens":"(in tokens)","chunkSizeDescription":"Size of text chunks for embedding","chunkOverlap":"Chunk Overlap","chunkOverlapInTokens":"(in tokens)","chunkOverlapDescription":"Overlap between consecutive chunks","similarityThreshold":"Similarity Threshold","similarityDescription":"Minimum similarity score to include results","status":"Embedding Status","statusLabel":"Status","available":"Available","unavailable":"Unavailable","chunksWithEmbeddings":"Chunks with embeddings","coverage":"Coverage","regenerate":"Regenerate Embeddings","regenerating":"Regenerating..."}},"tts":{"title":"Text-to-Speech","description":"Configure text-to-speech settings for reading messages aloud","loadingProviders":"Loading TTS providers...","noProviders":"No TTS Providers","noProvidersDescription":"Configure a plugin with TTS support to enable text-to-speech","enable":"Enable TTS","enableDescription":"Allow text-to-speech for assistant messages","autoPlay":"Auto-play Responses","autoPlayDescription":"Automatically read new assistant messages aloud","streamSentences":"Stream Sentences","streamSentencesDescription":"Play audio sentence by sentence instead of waiting for the full message. Recommended for local TTS to avoid timeouts on long messages.","voiceConfiguration":"Voice Configuration","model":"TTS Model","modelDescription":"Select the model for text-to-speech generation","voice":"Voice","selectVoice":"Select a voice","voiceDescription":"Choose the voice for text-to-speech","speed":"Speed","speedSlow":"0.5x","speedNormal":"1.0x","speedFast":"2.0x","availableProviders":"Available Providers","models":"models","test":"Test","testing":"Testing...","stop":"Stop"},"imageGen":{"title":"Image Generation","description":"Configure image generation settings and providers","loadingProviders":"Loading image generation providers...","noProviders":"No Image Generation Providers","noProvidersDescription":"Configure a plugin with image generation support","enable":"Enable Image Generation","enableDescription":"Allow AI image generation in conversations","configuration":"Configuration","model":"Model","modelDescription":"Select the model for image generation","size":"Size","sizeDescription":"Resolution of generated images","quality":"Quality","qualityDescription":"Quality level of generated images","style":"Style","styleDescription":"Style preset for generated images","availableProviders":"Available Providers","models":"models"},"data":{"title":"Data Management","export":"Export Data","exportDescription":"Download all your data including preferences, sessions, and documents.","exportAll":"Export All Data","import":"Import Data","importDescription":"Import data from a previous export.","importData":"Import Data","importing":"Importing...","clearSessions":"Clear Sessions","clearSessionsDescription":"Delete all chat sessions. This action cannot be undone.","clearAll":"Clear All","clearing":"Clearing...","importOptions":"Import Options","importOptionsDescription":"Choose how to handle existing data","skipDuplicates":"Skip duplicates","overwrite":"Overwrite existing","importResults":"Import Results","preferences":"Preferences","imported":"Imported","failed":"Failed","sessions":"Sessions","importedLabel":"imported","skipped":"skipped","documents":"Documents","errors":"Errors"},"about":{"title":"About","versionLabel":"Version","ollama":{"title":"Ollama Status","version":"Version","healthy":"Healthy","unhealthy":"Unhealthy"},"stats":{"models":"Models","sessions":"Sessions"},"features":{"privacy":{"title":"Privacy First","description":"Your data stays on your device"},"openSource":{"title":"Open Source","description":"Free and open source software"},"localInference":{"title":"Local Inference","description":"Run AI models locally with Ollama"}},"openSourceBy":"Open source by {{company}}","links":{"title":"Links","github":"GitHub","githubDescription":"View source code and contribute","website":"Website","websiteDescription":"Visit our website","ollama":"Ollama","ollamaDescription":"Learn more about Ollama","documentation":"Documentation","reportIssue":"Report Issues","reportIssueDescription":"Bug reports & feature requests","gitlab":"GitLab Mirror","gitlabDescription":"Self-hosted GitLab repository","documentationDescription":"Guides, tutorials and API reference"},"version":"Version {{version}}"},"groups":{"general":"General","chat":"Chat","media":"Speech & images","connections":"Connections"}}`),models:{title:`Models`,subtitle:`Pull, manage, and monitor your Ollama models`,installed:`Installed Models`,available:`Available Models`,pull:`Pull Model`,pulling:`Pulling...`,delete:`Delete Model`,deleting:`Deleting...`,size:`Size`,modified:`Modified`,family:`Family`,parameters:`Parameters`,quantization:`Quantization`,noModels:`No models installed`,pullFirst:`Pull a model to get started`,noModelsFound:`No models found`},personas:{title:`Personas`,create:`Create Persona`,edit:`Edit Persona`,delete:`Delete Persona`,name:`Name`,description:`Description`,systemPrompt:`System Prompt`,model:`Model`,avatar:`Avatar`,background:`Background`,noPersonas:`No personas created`,createFirst:`Create your first persona to customize your chat experience`},gallery:{title:`Gallery`,subtitle:`Your AI-generated image gallery`,imageCount:`{{count}} images`,generate:`Generate Image`,generateDescription:`Create images with AI`,generating:`Generating...`,prompt:`Prompt`,promptPlaceholder:`Describe the image you want to generate...`,noImages:`No images generated yet`,download:`Download`,delete:`Delete`,regenerate:`Regenerate`,model:`Model`,size:`Size`,quality:`Quality`,created:`Created`},errors:{generic:`An error occurred`,network:`Network error. Please check your connection.`,unauthorized:`You are not authorized to perform this action.`,notFound:`The requested resource was not found.`,serverError:`Server error. Please try again later.`,validation:`Please check your input and try again.`},keyboard:{title:`Keyboard Shortcuts`,toggleSidebar:`Toggle sidebar`,openSettings:`Open settings`,toggleDarkMode:`Toggle dark mode`,showShortcuts:`Show keyboard shortcuts`,closeModals:`Close modals`,groups:{navigation:`Navigation`,settings:`Settings`,general:`General`,chat:`Chat`},actions:{sendMessage:`Send message`,newLine:`New line in message`},footer:`Press {{key1}} or {{key2}} to show this help`,tooltip:`Keyboard shortcuts`},modelManager:{title:`Models`,loading:`Loading models...`,systemStatus:{online:`Ollama Online`,offline:`Ollama Offline`,models:`model`,models_plural:`models`,running:`running`,vram:`VRAM`},sections:{pull:`Pull New Model`,library:`Browse Library`,huggingface:`HuggingFace Hub`,running:`Running Models`,local:`Local Models`,advanced:`Advanced Actions`},pull:{placeholder:`Enter model name (e.g., llama3.2:3b, deepseek-r1:14b)`,button:`Pull`,cancel:`Cancel`,popular:`Popular models:`,browseAll:`Browse all models on ollama.com`,success:`Model {{name}} pulled successfully`,cancelled:`Model pull cancelled`,failed:`Failed to pull model`,enterName:`Please enter a model name`,restricted:`Model installation is restricted to administrators on this instance.`},progress:{starting:`Initializing...`,pulling:`Downloading model...`,pullingLayer:`pulling`,verifying:`Verifying integrity...`,verifyingDigest:`verifying sha256 digest`,writing:`Writing manifest...`,cleaning:`Cleaning up...`},library:{available:`available`,search:`Search models...`,noResults:`No models found matching your criteria`,installed:`Installed`,more:`+{{count}} more`,refresh:`Refresh Library`},huggingface:{browseAll:`Browse all on HuggingFace`,checkingGguf:`Checking for GGUF files...`,noGgufAvailable:`No GGUF files available for direct Ollama pull`,ggufFilesCount:`GGUF Files ({{count}}) - Pull directly to Ollama`,noModelsFound:`No models found`,noResults:`No models found. Try adjusting your search or filters.`,browseAllLink:`Browse all`,search:`Search HuggingFace models...`,by:`by`,gated:`Gated`,viewOnHF:`View on HuggingFace`,sortDownloads:`Downloads`,sortLikes:`Likes`,sortRecent:`Recent`,taskTextGeneration:`Text Generation`,taskTextToSpeech:`Text to Speech`,taskTextToImage:`Text to Image`,taskSpeechRecognition:`Speech Recognition`,tasks:{textGen:`Text Generation`,tts:`Text to Speech`,image:`Text to Image`,stt:`Speech Recognition`},sort:{downloads:`Most Downloads`,likes:`Most Liked`,recent:`Recently Updated`}},local:{noModels:`No models installed yet`,pullToStart:`Pull a model above to get started`,installed:`installed`,running:`Running`,info:`Info`,copy:`Copy`,delete:`Delete`,deleteConfirm:`Are you sure you want to delete model "{{name}}"?`,deleteSuccess:`Model {{name}} deleted successfully`,deleteFailed:`Failed to delete model`},advanced:{createModel:`Create Model`,fromModelfile:`From Modelfile`,copyModel:`Copy Model`,duplicateExisting:`Duplicate existing`,testEmbeddings:`Test Embeddings`,generateVectors:`Generate vectors`,healthCheck:`Health Check`,testConnection:`Test connection`,healthy:`Ollama is healthy!`},modals:{details:{title:`Model Details`,info:`Model Information`,family:`Family`,parameters:`Parameters`,quantization:`Quantization`,format:`Format`,systemPrompt:`System Prompt`,template:`Template`,license:`License`,modelfile:`Modelfile`,noDetails:`No details available`},copy:{title:`Copy Model`,source:`Source Model`,selectModel:`Select a model...`,newName:`New Model Name`,placeholder:`e.g., my-custom-model`,copying:`Copying...`,button:`Copy Model`,success:`Model copied to {{name}}`,failed:`Failed to copy model`,enterBoth:`Please enter both source and destination names`},create:{title:`Create Custom Model`,name:`Model Name`,namePlaceholder:`e.g., my-assistant`,modelfile:`Modelfile`,modelfilePlaceholder:`FROM llama3.2
3
- SYSTEM You are a helpful assistant.`,see:`See`,docs:`Modelfile docs`,docsLink:`for syntax reference`,creating:`Creating...`,button:`Create Model`,success:`Model {{name}} created successfully`,failed:`Failed to create model`,enterBoth:`Please enter model name and Modelfile content`},embeddings:{title:`Test Embeddings`,model:`Embedding Model`,selectModel:`Select a model...`,recommended:`Recommended: nomic-embed-text, mxbai-embed-large`,input:`Input Text`,placeholder:`Enter text to generate embeddings for...`,generating:`Generating...`,button:`Generate Embeddings`,result:`Result ({{count}} dimensions)`,success:`Generated {{count}}-dimensional embedding vector`,failed:`Failed to generate embeddings`,enterBoth:`Please select a model and enter text`}}},personaManager:{title:`Personas`,subtitle:`Create and manage AI personas with custom personalities, memories, and behaviors`,loading:`Loading personas...`,createButton:`Create Persona`,importExport:`Import/Export`,stats:{title:`Your Personas`,count:`{{count}} persona created`,count_plural:`{{count}} personas created`},empty:{title:`No personas yet`,description:`Create your first persona to get started with personalized AI interactions`,button:`Create Your First Persona`},deleteConfirm:`Are you sure you want to delete "{{name}}"?`,deleteSuccess:`Persona "{{name}}" deleted successfully`,downloadSuccess:`Persona "{{name}}" downloaded successfully`,failed:`Failed to {{action}} persona`},personaForm:{title:{create:`Create New Persona`,edit:`Edit Persona`},subtitle:{create:`Create a new AI persona with custom personality, memory systems, and adaptive learning capabilities`,edit:`Customize your AI persona with advanced memory, adaptive learning, and intelligent parameters`},loading:`Loading form...`,saved:`Saved`,tabs:{basic:`Basic`,parameters:`Parameters`,memory:`Memory & Learning`,advanced:`Advanced`},basic:{name:`Name`,namePlaceholder:`Enter persona name`,model:`Model`,selectModel:`Select a model`,description:`Description`,descriptionPlaceholder:`Describe your persona...`,systemPrompt:`System Prompt`,systemPromptPlaceholder:`Enter the system prompt that defines your persona behavior...`,systemPromptHint:`The system prompt defines how your persona will behave and respond.`},parameters:{temperature:`Temperature`,temperatureHint:`Controls creativity vs consistency`,topP:`Top-P`,topPHint:`Controls response diversity`,topK:`Top-K`,topKHint:`Limits vocabulary to top-k tokens`,contextWindow:`Context Window`,contextWindowHint:`Maximum conversation history length`,maxTokens:`Max Tokens`,maxTokensHint:`Maximum response length`,repeatPenalty:`Repeat Penalty`,repeatPenaltyHint:`Reduces repetitive responses`},memory:{title:`Memory System`,subtitle:`Persona remembers conversations over time`,enableHint:`Enable the memory system to let your persona remember conversations and build context over time.`,loading:`Loading memory status...`,noData:`No memory data yet`,memories:`Memories`,mbUsed:`MB Used`,lastBackup:`Last Backup`,never:`Never`,maxMemories:`Maximum Memories`,maxMemoriesHint:`How many memories this persona can store`,retention:`Memory Retention`,retentionHint:`Days to keep memories before cleanup`,autoCleanup:`Auto-cleanup old memories`,wipeAll:`Wipe All Memories`,wipeCannot:`This cannot be undone`,wipeButton:`Wipe`,wiping:`Wiping...`,wipeConfirm:`Are you sure you want to wipe all memories? This cannot be undone.`,wipeSuccess:`Wiped {{count}} memories`},learning:{title:`Adaptive Learning`,subtitle:`Persona evolves based on interactions`,enableHint:`Enable adaptive learning to let your persona evolve and personalize responses based on your interactions.`,speed:`Learning Speed`,slow:`Slow`,slowDesc:`Gradual changes`,balanced:`Balanced`,balancedDesc:`Moderate pace`,fast:`Fast`,fastDesc:`Quick adaptation`,autoAdapt:`Auto-adapt to user preferences`,whatLearns:`What the persona learns:`,conversationTone:`Conversation tone`,responseStyle:`Response style`,userPreferences:`User preferences`,topicInterests:`Topic interests`},advanced:{embeddingModel:`Embedding Model`,embeddingHint:`Select the model used for memory encoding and semantic search. Embedding models are shown first, followed by other available models.`,noModels:`No models found`,embeddingModels:`Embedding Models`,otherModels:`Other Models`,installHint:`Install an embedding model:`,recommended:`Recommended: nomic-embed-text, mxbai-embed-large, bge-m3, snowflake-arctic-embed`,aboutTitle:`About Advanced Settings`,aboutDescription:`The embedding model is used by the memory system to understand semantic meaning and find relevant memories during conversations. Choose a model that matches your use case and available resources.`},actions:{cancel:`Cancel`,save:`Save`,saving:`Saving...`,saveClose:`Save & Close`,create:`Create`},success:{created:`Persona created`,updated:`Persona updated`},error:{saveFailed:`Failed to save`}},personaCard:{enhanced:`Enhanced`,systemPrompt:`System Prompt`,memories:`memories`,use:`Use`,editTooltip:`Edit persona`,downloadTooltip:`Download persona`,backup:`Backup`,exportDNA:`Export DNA`,wipeMemories:`Wipe Memories`,wipeConfirm:`Are you sure you want to wipe all memories for this persona? This action cannot be undone.`,wipeSuccess:`Wiped {{count}} memories`,backupSuccess:`Persona backup downloaded successfully`,dnaSuccess:`Persona DNA exported successfully`,failed:`Failed to {{action}}`},userManager:{title:`User Management`,subtitle:`Manage user accounts and permissions`,pageDescription:`Manage user accounts, permissions, and access controls for your Libre WebUI instance.`,loading:`Loading users...`,createUser:`Create User`,search:`Search users...`,noUsers:`No users found`,noUsersMatching:`No users matching your search`,columns:{user:`User`,email:`Email`,role:`Role`,created:`Created`,actions:`Actions`},roles:{admin:`Admin`,user:`User`},noEmail:`No email`,deleteConfirm:`Are you sure you want to delete user "{{name}}"?`,deleteSuccess:`User deleted successfully`,deleteFailed:`Failed to delete user`,cannotDeleteSelf:`You cannot delete your own account`,form:{title:{create:`Create User`,edit:`Edit User`},username:`Username`,usernamePlaceholder:`Enter username`,email:`Email`,emailPlaceholder:`Enter email (optional)`,password:`Password`,passwordPlaceholder:`Enter password`,passwordHint:`Leave blank to keep current password`,role:`Role`,creating:`Creating...`,updating:`Updating...`,createButton:`Create User`,updateButton:`Update User`,createSuccess:`User created successfully`,updateSuccess:`User updated successfully`,createFailed:`Failed to create user`,updateFailed:`Failed to update user`}},chatHistory:{label:`Conversation history`,jumpToTurn:`Jump to turn {{index}} of {{total}}`},chatMessage:{you:`You`,assistant:`Assistant`,system:`System`,copy:`Copy`,copyMessage:`Copy message`,copied:`Copied!`,regenerate:`Regenerate`,regenerateResponse:`Regenerate response`,edit:`Edit`,editSystemMessage:`Edit system message`,saveChanges:`Save changes`,cancelEditing:`Cancel editing`,delete:`Delete`,deleteConfirm:`Delete this message?`,branch:`Branch`,speaking:`Speaking...`,speakMessage:`Speak message`,stopSpeaking:`Stop speaking`,showMore:`Show more`,showLess:`Show less`,thinking:`Thinking`,systemMessagePlaceholder:`Enter your system message...`,fullSizeImage:`Full size image`,startConversation:`Start a conversation`,startConversationDescription:`Send a message to begin chatting with your AI assistant. Ask questions, get help with code, or have a natural conversation.`,scrollToBottom:`Scroll to bottom`,newMessages:`New messages`},imageGallery:{title:`Image Gallery`,noImages:`No images yet`,noImagesHint:`Generate your first image using the panel on the right`,delete:`Delete`,download:`Download`,deleteConfirm:`Are you sure you want to delete this image?`,deleteSuccess:`Image deleted`,deleteFailed:`Failed to delete image`,downloadFailed:`Failed to download image`,loadMore:`Load More ({{current}} of {{total}})`,loadFailed:`Failed to load gallery`},imageGeneration:{title:`Generate Image`,prompt:`Prompt`,promptPlaceholder:`Describe the image you want to create...`,model:`Model`,selectModel:`Select model`,noModels:`No image generation models available`,configurePlugin:`Configure a plugin with image generation support`,size:`Size`,quality:`Quality`,style:`Style`,generate:`Generate`,generating:`Generating...`,success:`Image generated successfully`,failed:`Failed to generate image`,enterPrompt:`Please enter a prompt`,promptTooLong:`Prompt exceeds maximum length of {{max}} characters`},errorBoundary:{title:`Something went wrong`,description:`We encountered an unexpected error. Please try refreshing the page.`,tryAgain:`Refresh Page`,goHome:`Go to Home`,errorDetails:`Error Details (Development)`},documents:{title:`Documents`,upload:`Upload Document`,uploading:`Uploading...`,noDocuments:`No documents uploaded`,uploadHint:`Upload documents to use in your conversations`,delete:`Delete`,deleteConfirm:`Are you sure you want to delete this document?`,deleteSuccess:`Document deleted`,deleteFailed:`Failed to delete document`,uploadSuccess:`Document uploaded successfully`,uploadFailed:`Failed to upload document`,types:`Supported: PDF, TXT, MD, DOCX`,unsupportedFileType:`Only PDF and TXT files are supported`,fileSizeTooLarge:`File size must be less than 10MB`,uploadSuccessWithName:`Document "{{name}}" uploaded successfully`,removeSuccess:`Document removed successfully`,removeFailed:`Failed to remove document`,removeError:`An error occurred while removing the document`,clickToUpload:`Click to upload`,orDragAndDrop:`or drag and drop`,fileTypesAndSize:`PDF or TXT files up to 10MB`,uploadedDocuments:`Uploaded Documents`,removeDocument:`Remove document`},ttsButton:{speak:`Speak`,stop:`Stop`,speaking:`Speaking...`,generateFailed:`Failed to generate speech`,playbackFailed:`Audio playback failed`,stopSpeaking:`Stop speaking`,generatingSpeech:`Generating speech...`,readAloud:`Read aloud`},artifacts:{title:`Artifacts`,code:`Code`,preview:`Preview`,copy:`Copy code`,copied:`Copied!`,download:`Download`,expand:`Expand`,collapse:`Collapse`,openInNewTab:`Open in new tab`,invalidSvg:`Invalid SVG content`,invalidJson:`Invalid JSON content`,previewMode:`Preview mode`,codeMode:`Code mode`,copyContent:`Copy content`,openInPanel:`Open in panel`,openInNewWindow:`Open in new window`,created:`Created`,closePanelEsc:`Close panel (Esc)`,copyButton:`Copy`,open:`Open`,dragEdgeToResize:`Drag edge to resize`,previewUnavailable:`Preview unavailable`,previewUnavailableDescription:`This artifact does not contain renderable preview content. Switch to code view to inspect the source.`},personaImportExport:{title:`Import & Export Personas`,description:`Export your personas to share them or import personas from others`,exportPersonas:`Export Personas`,importPersonas:`Import Personas`,noPersonasToExport:`No personas to export`,personasAvailable:`{{count}} persona available`,personasAvailable_plural:`{{count}} personas available`,exportAll:`Export All`,uploadJsonFile:`Upload JSON File`,pasteJsonLabel:`Paste JSON Data`,pasteJsonPlaceholder:`Paste persona JSON data here...`,importing:`Importing...`,importButton:`Import Persona(s)`,expectedFormat:`Expected JSON Format:`,exportSuccess:`Persona "{{name}}" exported successfully`,exportFailed:`Failed to export persona`,exportAllSuccess:`All {{count}} personas exported successfully`,exportAllFailed:`Failed to export personas`,pasteJsonData:`Please paste the persona JSON data`,importMultipleSuccess:`Successfully imported {{count}} personas`,importMultipleFailed:`Failed to import {{count}} personas`,importNoneFailed:`Failed to import any personas`,importSuccess:`Persona imported successfully`,importFailed:`Failed to import persona`},generationStats:{details:`Details`,promptTokens:`Prompt tokens:`,generatedTokens:`Generated tokens:`,totalTokens:`Total tokens:`,speed:`Speed:`,promptEval:`Prompt eval:`,generation:`Generation:`,modelLoad:`Model load:`,totalTime:`Total time:`,generatedAt:`Generated at:`},userMenu:{loggedOut:`Logged out successfully`,pictureUpdated:`Profile picture updated`,failedUpdateAvatar:`Failed to update avatar`,failedUpdatePicture:`Failed to update profile picture`,noEmail:`No email provided`,changePicture:`Change Picture`,settings:`Settings`,userManagement:`User Management`,signOut:`Sign Out`,changeProfilePicture:`Change Profile Picture`},pluginManager:{title:`Plugin Manager`,upload:`Upload`,addJson:`Add JSON`,browseHF:`Browse HF Hub`,confirmDelete:`Are you sure you want to delete this plugin?`,uploading:`Uploading plugin...`,pasteJson:`Paste plugin JSON here...`,installPlugin:`Install Plugin`,loading:`Loading plugins...`,noPlugins:`No Plugins Installed`,noPluginsDescription:`Upload a plugin file or add a plugin from JSON to get started.`,active:`Active`,id:`ID`,endpoint:`Endpoint`,activate:`Activate`,deactivate:`Deactivate`,activePlugin:`Active Plugin`,activePluginDescription:`All chat requests will be routed through this plugin`,variables:{title:`Variables`,save:`Save`,saving:`Saving...`,saved:`Variables saved`,saveFailed:`Failed to save variables`,resetDefaults:`Reset to Defaults`,reset:`Variables reset to defaults`,resetFailed:`Failed to reset variables`,sensitiveSet:`Value is set (enter new value to change)`,showValue:`Show {{label}} value`,hideValue:`Hide {{label}} value`,connection:`Connection`,advanced:`Advanced parameters`,inherited:`Use provider default`,inheritedValue:`Use provider default ({{value}})`,enabled:`Enabled`,disabled:`Disabled`,required:`A value is required`,fullApiEndpoint:`Full API endpoint URL`,endpointHelp:`Enter the complete request URL, including its operation path (for example, /v1/chat/completions), not only the provider base URL.`,invalidUrl:`Enter a valid full API endpoint URL, for example https://provider.example/v1/chat/completions`,insecureUrl:`API endpoints must use HTTP or HTTPS.`,httpWarning:`HTTP does not encrypt credentials or traffic. Use it only on a trusted network.`,invalidBaseUrl:`Base URLs cannot contain a query string or fragment.`,invalidApiPath:`Must start with / and contain no URL, query, fragment, or .. segment`,tooLong:`Value is too long`}},huggingface:{title:`HuggingFace Model Browser`,subtitle:`Browse and select models from the Hub`,searchPlaceholder:`Search models...`,filters:`Filters`,task:`Task`,sortBy:`Sort By`,noModels:`No models found`,adjustSearch:`Try adjusting your search or filters`,gated:`Gated`,selected:`Selected`,select:`Select`,refresh:`Refresh`,modelsFound:`models found`},demoMode:{title:`Demo Mode`,github:`GitHub`},libreClaw:{title:`Agents`,subtitle:`Local agent runs, approvals, schedules, memory, tools, and usage.`,dashboard:`Dashboard`,connection:{disconnectedTitle:`Libre Claw daemon is not connected`,disconnectedDescription:`Start it locally with <command>libre-claw start</command> or set <env>LIBRE_CLAW_BASE_URL</env> in the backend environment.`},status:{connected:`Connected`,disconnected:`Disconnected`,activeRuns:`{{count}} active`,activeRuns_plural:`{{count}} active`},states:{queued:`Queued`,running:`Running`,blocked:`Blocked`,done:`Done`,failed:`Failed`,cancelled:`Cancelled`},startRun:{title:`Start Agent Run`,placeholder:`Ask Libre Claw to inspect a repo, fix a bug, run a review, schedule a report...`,chatRun:`Chat run`,goalMode:`Goal mode`,providerOverride:`Provider override`,modelOverride:`Model override`,run:`Run`},modelRoute:{title:`Model Route`,providerPlaceholder:`provider`,modelPlaceholder:`model`,persistGlobal:`Persist to Libre Claw global config`,saveModel:`Save model`,theme:`Libre Claw theme`,saveTheme:`Save theme`},runs:{title:`Runs`,empty:`No Libre Claw runs yet.`},timeline:{title:`Run Timeline`,empty:`Select a run to inspect its events.`,streaming:`Streaming...`,assistantResponse:`Assistant response`,resultOk:`ok`,resultError:`error`,labels:{userMessage:`User message`,toolCall:`Tool call`,toolResult:`Tool result`,approvalRequest:`Approval request`,approvalResponse:`Approval response`,runStarted:`Run started`,runFinished:`Run finished`,usage:`Usage`,error:`Error`}},approvals:{needed:`Approval needed`,allowOnce:`Allow once`,alwaysAllowTool:`Always allow tool`,deny:`Deny`,toolApprovalRequested:`Tool approval requested`},automations:{title:`Automations`,namePlaceholder:`Name`,schedulePlaceholder:`daily 09:00`,promptPlaceholder:`Automation prompt`,create:`Create`,empty:`No scheduled Libre Claw automations.`,runNow:`Run now`,pause:`Pause`,resume:`Resume`,routes:{report:`Report`,telegram:`Telegram`},status:{active:`Active`,paused:`Paused`}},usageFallback:{title:`Usage And Fallback`,usage:`Usage`,fallbackRoute:`Fallback Route`,noUsage:`No usage records yet.`},metrics:{provider:`Provider`,model:`Model`,input:`Input`,output:`Output`,cached:`Cached`,reasoning:`Reasoning`,cost:`Cost`,tool:`Tool`,resolution:`Resolution`,state:`State`,stopReason:`Stop reason`,tokens:`{{formatted}} token`,tokens_plural:`{{formatted}} tokens`},fallbacks:{tool:`tool`,unknown:`unknown`,resolved:`resolved`,unknownError:`Unknown error`},toasts:{loadStatusFailed:`Could not load Libre Claw status`,enterTask:`Enter a task for Libre Claw`,runStarted:`Libre Claw run started`,startRunFailed:`Could not start Libre Claw run`,runCancelled:`Run cancelled`,cancelRunFailed:`Could not cancel run`,approved:`Approved`,denied:`Denied`,resolvePermissionFailed:`Could not resolve permission`,providerModelRequired:`Provider and model are required`,modelUpdated:`Libre Claw model updated`,updateModelFailed:`Could not update model`,themeUpdated:`Libre Claw theme updated`,updateThemeFailed:`Could not update theme`,automationRequired:`Automation name, schedule, and prompt are required`,automationCreated:`Automation created`,createAutomationFailed:`Could not create automation`,automationUpdated:`Automation updated`,updateAutomationFailed:`Could not update automation`}},work:{title:`Work`,subtitle:`Isolated model workspaces`,tasks:{title:`Work tasks`,subtitle:`Persistent local workspaces`,new:`New task`,emptyTitle:`No Work tasks yet`,empty:`Your Work tasks will appear here after you send the first message.`,untitled:`Untitled task`,actions:`Task actions`,delete:`Delete task`,deleteNamed:`Delete {{title}}`,deleteConfirm:`Delete “{{title}}” and its workspace permanently?`,close:`Close Work tasks`,open:`Open Work tasks`,rename:`Task title`,loading:`Loading task…`,notFound:`This Work task is unavailable`,back:`Start a new task`,status:`Status: {{status}}`},landing:{title:`Start a new Work task`,description:`Give a local or configured provider model a durable, isolated workspace. It can inspect files, run tools, and continue where it left off when you return.`,isolated:`Isolated`,isolatedBody:`Every task gets its own container and files.`,durable:`Durable`,durableBody:`Return to its conversation and workspace later.`,controlled:`Controlled`,controlledBody:`The runtime and task files stay isolated from the host.`},composer:{placeholder:`Describe what you want to build or change…`,model:`Work model`,noModels:`No Work-compatible models`,cancel:`Stop`,send:`Run`,hint:`Each task keeps its own files and history. Review model output before using it.`,remoteTitle:`Remote provider`,remoteHint:`Conversation and tool output are sent to the configured service. One autonomous run can make multiple provider calls and may incur charges. Workspace files stay local unless a tool returns their contents.`,remoteDismiss:`Dismiss`,remoteDismissLabel:`Dismiss remote provider notice`,remoteDismissFailed:`Could not save the remote provider preference.`,noModelSelected:`No Work-compatible model is selected.`},conversation:{ready:`Workspace ready`,empty:`Continue the task below. This conversation and its files stay attached to this workspace.`,loadOlder:`Load older messages`},status:{preparing:`Preparing isolated workspace…`,running:`Working in the local workspace…`},statusLabels:{idle:`Idle`,thinking:`Thinking`,complete:`Complete`,needsInput:`Needs input`,error:`Error`},live:{connecting:`Connecting to live updates…`,reconnecting:`Reconnecting to live updates…`,unavailable:`Live updates unavailable`,newActivity:`New activity`,skillsLoaded:`Workspace skills · {{count}}`},runtime:{unavailable:`Runtime unavailable`,ready:`Runtime ready`,readyOllama:`Docker ready`,readyPlugin:`Docker + plugin ready`,readyHybrid:`Docker + models ready`,reason:`Docker and an available Ollama or plugin model provider are required.`},workspace:{label:`Workspace views`,files:`Files`,activity:`Activity`,preview:`Preview`,resize:`Resize conversation and workspace`,resizeHint:`Drag to resize. Use arrow keys for precise control. Double-click or press Enter to reset.`,splitSize:`Conversation {{conversation}}%, workspace {{workspace}}%`,terminal:`Terminal`},files:{discard:`Discard unsaved file changes?`,leaveWithDraft:`Leave this file? Your unsaved edit will remain as a browser draft.`,up:`Parent folder`,back:`Back to files`,empty:`No files in this folder yet.`,select:`Select a file to inspect and edit it.`,editorLabel:`File editor: {{path}}`,format:`Format`,formatted:`Code formatted.`,formatFailed:`Could not format this file.`,formatShortcut:`Format (Shift+Alt+F)`,formatTooLarge:`Formatting is limited to files under 100,000 characters and 4,000 lines.`,formatUnsupported:`Formatting is not available for this file type.`,saveShortcut:`Save (⌘/Ctrl+S)`,highlightPaused:`Live highlighting is paused for large files to keep editing responsive.`,plainTextLarge:`Plain text · large file`,changes:`Changes`,changesSince:`What changed since the last turn`,diffLabel:`Changes since the last turn: {{path}}`,diffFolded:`{{count}} unchanged lines`},activity:{empty:`Commands, file operations, and tool results will appear here.`,toolActivity:`Tool activity`,details:`Details`,kinds:{message:`Message`,toolCall:`Tool call`,toolResult:`Tool result`,error:`Error`}},preview:{command:`Optional start command`,start:`Start preview`,stop:`Stop preview`,open:`Open`,starting:`Starting preview…`,frameTitle:`Workspace preview`,failed:`The preview could not start. Check Activity, then try another command.`,empty:`Start the app inside this workspace to inspect it here.`},mobile:{surface:`Task surface`,conversation:`Conversation`,workspace:`Workspace`},toasts:{runFailed:`Could not start the Work task.`,updateFailed:`Could not update this task.`,renameFailed:`Could not rename this task.`,cancelled:`Work run stopped.`,cancelFailed:`Could not stop the Work run.`,deleteFailed:`Could not delete this Work task.`,saveFailed:`Could not save this file.`,saved:`File saved.`,previewFailed:`Could not start the preview.`,previewStopFailed:`Could not stop the preview.`},terminal:{connecting:`Opening a shell in the sandbox…`,closed:`Terminal session ended.`,failed:`The terminal session could not start.`,reconnect:`Reconnect`,unavailable:`The interactive terminal is not available in this deployment.`,blockedByRun:`The model is using this container. The terminal opens when the turn finishes.`,taskRunning:`Model turn in progress`}},personaBackground:{label:`Background Image`,uploadBackgroundImage:`Upload background image`,dragAndDrop:`Drag and drop an image or click to browse`,chooseImage:`Choose Image`,uploading:`Uploading...`,enterImageUrl:`Or enter image URL`,supportedFormats:`Supports: JPG, PNG, GIF, WebP (max 5MB). Wide landscape images work best.`,customBackground:`Custom background image`,clickToChange:`Click to change or remove`,removed:`Background removed`,uploaded:`Background uploaded successfully`,invalidFile:`Please select a valid image file`,fileTooLarge:`Background image size must be less than 5MB`,readFailed:`Failed to read image file`,uploadFailed:`Failed to upload background image`},modelSelector:{searchInstalled:`Search installed models...`,searchOllama:`Search Ollama library...`,searchHuggingFace:`Search HuggingFace...`,selectModel:`Select a model`,personas:`Personas`,ollamaModels:`Ollama Models`,pluginModels:`Plugin Models`,actions:`Actions`,installed:`Installed`,use:`Use`,pull:`Pull`,pullRestricted:`Model installation is restricted to administrators on this instance.`,adminOnlyPull:`Admins only`}},Zr={en:{translation:Xr}},Qr=[{code:`en`,name:`English`,nativeName:`English`,dir:`ltr`},{code:`ar`,name:`Arabic`,nativeName:`العربية`,dir:`rtl`},{code:`bn`,name:`Bengali`,nativeName:`বাংলা`,dir:`ltr`},{code:`cs`,name:`Czech`,nativeName:`Čeština`,dir:`ltr`},{code:`da`,name:`Danish`,nativeName:`Dansk`,dir:`ltr`},{code:`de`,name:`German`,nativeName:`Deutsch`,dir:`ltr`},{code:`es`,name:`Spanish`,nativeName:`Español`,dir:`ltr`},{code:`fr`,name:`French`,nativeName:`Français`,dir:`ltr`},{code:`hi`,name:`Hindi`,nativeName:`हिन्दी`,dir:`ltr`},{code:`id`,name:`Indonesian`,nativeName:`Bahasa Indonesia`,dir:`ltr`},{code:`is`,name:`Icelandic`,nativeName:`Íslenska`,dir:`ltr`},{code:`it`,name:`Italian`,nativeName:`Italiano`,dir:`ltr`},{code:`ja`,name:`Japanese`,nativeName:`日本語`,dir:`ltr`},{code:`ko`,name:`Korean`,nativeName:`한국어`,dir:`ltr`},{code:`ms`,name:`Malay`,nativeName:`Bahasa Melayu`,dir:`ltr`},{code:`nl`,name:`Dutch`,nativeName:`Nederlands`,dir:`ltr`},{code:`pl`,name:`Polish`,nativeName:`Polski`,dir:`ltr`},{code:`pt`,name:`Portuguese`,nativeName:`Português`,dir:`ltr`},{code:`ru`,name:`Russian`,nativeName:`Русский`,dir:`ltr`},{code:`sv`,name:`Swedish`,nativeName:`Svenska`,dir:`ltr`},{code:`th`,name:`Thai`,nativeName:`ไทย`,dir:`ltr`},{code:`tr`,name:`Turkish`,nativeName:`Türkçe`,dir:`ltr`},{code:`uk`,name:`Ukrainian`,nativeName:`Українська`,dir:`ltr`},{code:`vi`,name:`Vietnamese`,nativeName:`Tiếng Việt`,dir:`ltr`},{code:`zh`,name:`Chinese`,nativeName:`中文`,dir:`ltr`}],$r=[`ar`,`he`,`fa`,`ur`],ei=Qr.map(e=>e.code),ti={en:()=>Promise.resolve(Xr),ar:()=>d(()=>import(`../js/ar-BAHlIvy0.js`).then(e=>e.default),[]),bn:()=>d(()=>import(`../js/bn-BxquDVbd.js`).then(e=>e.default),[]),cs:()=>d(()=>import(`../js/cs-C4DoKzRm.js`).then(e=>e.default),[]),da:()=>d(()=>import(`../js/da-CFslpGTw.js`).then(e=>e.default),[]),de:()=>d(()=>import(`../js/de-ChudoRh2.js`).then(e=>e.default),[]),es:()=>d(()=>import(`../js/es-B36fefE-.js`).then(e=>e.default),[]),fr:()=>d(()=>import(`../js/fr-BSVeTM5W.js`).then(e=>e.default),[]),hi:()=>d(()=>import(`../js/hi-BGoFbl5V.js`).then(e=>e.default),[]),id:()=>d(()=>import(`../js/id-BfYs2p_j.js`).then(e=>e.default),[]),is:()=>d(()=>import(`../js/is-DZ1MS-5A.js`).then(e=>e.default),[]),it:()=>d(()=>import(`../js/it-CXtrPCG1.js`).then(e=>e.default),[]),ja:()=>d(()=>import(`../js/ja-FPJ_NK_y.js`).then(e=>e.default),[]),ko:()=>d(()=>import(`../js/ko-DVwD4ZZF.js`).then(e=>e.default),[]),ms:()=>d(()=>import(`../js/ms-PKPP0RX3.js`).then(e=>e.default),[]),nl:()=>d(()=>import(`../js/nl-DWM5HJZ8.js`).then(e=>e.default),[]),pl:()=>d(()=>import(`../js/pl-B9va8Tuf.js`).then(e=>e.default),[]),pt:()=>d(()=>import(`../js/pt-P0IQi-Zr.js`).then(e=>e.default),[]),ru:()=>d(()=>import(`../js/ru-Ca2bxYnc.js`).then(e=>e.default),[]),sv:()=>d(()=>import(`../js/sv-DI4RDwyZ.js`).then(e=>e.default),[]),th:()=>d(()=>import(`../js/th-DN0bDS9d.js`).then(e=>e.default),[]),tr:()=>d(()=>import(`../js/tr-ChqMv5Q4.js`).then(e=>e.default),[]),uk:()=>d(()=>import(`../js/uk-Cr51h_XQ.js`).then(e=>e.default),[]),vi:()=>d(()=>import(`../js/vi-D4OhoVMH.js`).then(e=>e.default),[]),zh:()=>d(()=>import(`../js/zh-Bvau7hlR.js`).then(e=>e.default),[])},ni=e=>{let t=e?.toLowerCase().split(`-`)[0];return ei.includes(t)?t:`en`},ri=e=>$r.includes(ni(e)),ii=e=>{if(typeof document>`u`)return;let t=ni(e);document.documentElement.lang=t,document.documentElement.dir=ri(t)?`rtl`:`ltr`},ai=async e=>{let t=ni(e);if(!Q.hasResourceBundle(t,`translation`)){let e=await ti[t]();Q.addResourceBundle(t,`translation`,e,!0,!0)}return t},oi=async e=>{let t=await ai(e);return await Q.changeLanguage(t),t};if(typeof window<`u`){let e=navigator.language;try{e=window.localStorage.getItem(`i18nextLng`)||e}catch{}ii(e),Q.on(`languageChanged`,ii)}var si=(async()=>{Q.isInitialized||await Q.use(Yr).use(b).init({resources:Zr,fallbackLng:`en`,supportedLngs:ei,nonExplicitSupportedLngs:!0,load:`languageOnly`,debug:!1,interpolation:{escapeValue:!1},detection:{order:[`localStorage`,`navigator`,`htmlTag`],caches:[`localStorage`],lookupLocalStorage:`i18nextLng`}});let e=ni(Q.language||Q.resolvedLanguage);if(e!==`en`)try{await ai(e),ni(Q.language)===e&&await Q.changeLanguage(e)}catch{await Q.changeLanguage(`en`)}ii(Q.resolvedLanguage||Q.language||`en`)})(),$={id:`home`,kind:`home`,path:`/`},ci=[`/models`,`/personas`,`/gallery`,`/agents`,`/users`,`/artifacts`],li=e=>{if(e===`/`||e===`/home`)return $;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}:ci.includes(e)?{id:`page:${e}`,kind:`page`,path:e}:null},ui=e=>[$,...e.filter(e=>e.id!==$.id)],di=Ne()(Pe((e,t)=>({tabs:[$],activeTabId:$.id,syncWithPath:t=>{let n=li(t);n&&e(e=>{let t=ui(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:n=>{if(n===$.id)return null;let r=t(),i=ui(r.tabs),a=i.findIndex(e=>e.id===n);if(a===-1)return null;let o=i.filter(e=>e.id!==n);if(r.activeTabId!==n)return e({tabs:o}),null;let s=o[Math.max(0,a-1)]??$;return e({tabs:o,activeTabId:s.id}),s},reset:()=>e({tabs:[$],activeTabId:$.id})}),{name:`libre-webui-tabs`,merge:(e,t)=>{let n=e??{},r=Array.isArray(n.tabs)?ui(n.tabs.filter(e=>!!e&&typeof e.id==`string`&&typeof e.path==`string`&&li(e.path)?.id===e.id)):t.tabs,i=r.some(e=>e.id===n.activeTabId)?n.activeTabId:$.id;return{...t,tabs:r,activeTabId:i}}})),fi=`welcomePromptIndex`,pi=`libre:welcome-prompt-change`,mi=[`time`,`create`,`explore`,`imagine`,`focus`,`untangle`,`momentum`,`open`,`challenge`,`draft`,`possibility`,`unexpected`],hi=0,gi=e=>Number.isInteger(e)&&e>=0&&e<mi.length,_i=()=>{if(typeof window>`u`)return hi;try{let e=window.sessionStorage.getItem(fi),t=Number(e);e!==null&&gi(t)&&(hi=t)}catch{}return hi},vi=()=>{let e=(_i()+1)%mi.length;if(hi=e,typeof window<`u`){try{window.sessionStorage.setItem(fi,String(e))}catch{}window.dispatchEvent(new Event(pi))}return e},yi=e=>mi[e]??`time`,bi=r(),xi=({label:e,error:t,helper:n,className:r,id:i,...a})=>{let o=(0,q.useId)(),s=i||`input-${o}`;return(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,J.jsx)(`label`,{htmlFor:s,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,J.jsx)(`input`,{id:s,className:P(`block w-full rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`placeholder:text-ink-subtle transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,r),...a}),t&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})},Si=q.forwardRef(({label:e,error:t,helper:n,className:r,id:i,...a},o)=>{let s=(0,q.useId)(),c=i||`textarea-${s}`;return(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,J.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,J.jsx)(`textarea`,{ref:o,id:c,className:P(`block w-full resize-none rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`placeholder:text-ink-subtle transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,r),...a}),t&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})});Si.displayName=`Textarea`;var Ci=({label:e,error:t,helper:n,options:r,className:i,id:a,...o})=>{let s=(0,q.useId)(),c=a||`select-${s}`;return(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[e&&(0,J.jsx)(`label`,{htmlFor:c,className:`block text-sm font-medium tracking-[-0.005em] text-ink-muted`,children:e}),(0,J.jsx)(`select`,{id:c,className:P(`block w-full rounded-xl border border-line bg-surface-raised px-3.5 py-2.5 text-base text-ink shadow-none`,`transition-[background-color,border-color,box-shadow,color] duration-150 ease-out`,`focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus-visible:outline-none dark:focus:border-primary-400 dark:focus:ring-primary-400/20`,`disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-subtle disabled:opacity-70`,t&&`border-error-500 focus:border-error-500 focus:ring-error-500/20`,i),...o,children:r.map((e,t)=>(0,J.jsx)(`option`,{value:e.value,children:e.label},e.key??`${e.value}-${t}`))}),t&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-error-600 dark:text-error-400`,children:t}),n&&!t&&(0,J.jsx)(`p`,{className:`text-xs leading-relaxed text-ink-muted`,children:n})]})},wi=[/^ {0,3}(?:`{3,}|~{3,})/m,/`[^`\n]+`/,/^\s{0,3}#{1,6}\s/m,/^\s{0,3}[-*+]\s/m,/^\s{0,3}\d+\.\s/m,/^\s{0,3}>\s/m,/\[[^\]]+\]\([^)]+\)/,/!\[[^\]]*]\([^)]+\)/,/\|.*\|/,/\*\*[^*]+\*\*/,/__[^_]+__/,/~~[^~]+~~/,/\\\[[\s\S]*?\\\]/,/\\\([\s\S]*?\\\)/,/\$\$[\s\S]*?\$\$/,/(^|[^$])\$[^$\n]+\$/],Ti=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function Ei(e){let t=[],n=/^( {0,3})(`{3,}|~{3,})([^\n\r]*)(?:\r?\n|$)/gm,r;for(;r=n.exec(e);){let i=r[1].length,a=r[2],o=a[0],s=r[3].trim();if(o==="`"&&s.includes("`"))continue;let c=n.lastIndex,l=RegExp(`^ {0,3}${Ti(o)}{${a.length},}[ \\t]*(?:\\r?\\n|$)`,`gm`);l.lastIndex=c;let u=l.exec(e),d=s.split(/\s+/)[0]||null;if(!u){t.push({start:r.index,end:e.length,codeStart:c,codeEnd:e.length,indent:i,language:d,complete:!1});break}t.push({start:r.index,end:l.lastIndex,codeStart:c,codeEnd:u.index,indent:i,language:d,complete:!0}),n.lastIndex=l.lastIndex}return t}function Di(e){return/<(?:html|head|body)(?:\s|>)|<\/(?:head|body|html)\s*>/i.test(e)}function Oi(e,t){return e.start<t.end&&t.start<e.end}function ki(e,t){let n=/^( {0,3})(<!doctype\s+html(?:\s|>|$)|<html(?:\s[^>\n\r]*)?>)/gim,r;for(;r=n.exec(e);){let n=r.index+r[1].length;if(t.some(e=>n>=e.start&&n<e.end))continue;let i=e.slice(n);if(!Di(i.slice(r[2].length)))continue;let a=/<\/html\s*>/i.exec(i),o=a?n+a.index+a[0].length:e.length;return{start:r.index,end:o,codeStart:n,codeEnd:o,indent:0,language:`html`,complete:!!a}}return null}function Ai(e){let t=Ei(e),n=ki(e,t);return n?[...t.filter(e=>!Oi(e,n)),n].sort((e,t)=>e.start-t.start):t}function ji(e,t){return t===0?e:e.replace(RegExp(`^ {1,${t}}`,`gm`),``)}function Mi(e){return wi.some(t=>t.test(e))}function Ni(e){let t=[],n=Ai(e),r=0;for(let i of n){let n=e.slice(r,i.start);n&&t.push({type:`text`,content:n}),t.push({type:`code`,language:i.language,content:ji(e.slice(i.codeStart,i.codeEnd),i.indent),complete:i.complete}),r=i.end}let i=e.slice(r);return(i||t.length===0)&&t.push({type:`text`,content:i}),t}function Pi(e){let t=e=>e.replace(/\\\[([\s\S]*?)\\\]/g,(e,t)=>`$$${t}$$`).replace(/\\\(([\s\S]*?)\\\)/g,(e,t)=>`$${t}$`),n=e=>{let n=/`[^`\n]+`/g,r=``,i=0,a;for(;a=n.exec(e);)r+=t(e.slice(i,a.index)),r+=a[0],i=n.lastIndex;return r+t(e.slice(i))},r=Ei(e),i=``,a=0;for(let t of r)i+=n(e.slice(a,t.start)),i+=e.slice(t.start,t.end),a=t.end;return i+=n(e.slice(a)),i}var Fi=N(`components:ui:message-code-block`);function Ii({code:e,language:t,state:n,children:r}){let{t:i}=x(),[a,o]=q.useState(null),s=q.useRef(null),c=a===e,l=t||`text`,u=i(c?`artifacts.copied`:`artifacts.copy`),d=`${u}: ${l}`;return q.useEffect(()=>()=>{s.current!==null&&window.clearTimeout(s.current)},[]),(0,J.jsxs)(`div`,{dir:`ltr`,"data-testid":`code-block`,"data-state":n,"data-language":l,className:`group relative my-4 overflow-hidden rounded-xl border border-line bg-surface-subtle text-left text-ink shadow-[0_12px_32px_rgba(13,17,23,0.1)] dark:border-white/10 dark:bg-[#0D1117] dark:text-[#E6EDF3] dark:shadow-[0_12px_32px_rgba(13,17,23,0.16)]`,children:[(0,J.jsxs)(`div`,{className:`flex h-10 items-center justify-between border-b border-line bg-surface-raised/70 px-3.5 dark:border-white/10 dark:bg-white/[0.035]`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(fe,{className:`h-3.5 w-3.5 shrink-0 text-ink-subtle dark:text-[#8B949E]`}),(0,J.jsx)(`span`,{className:`truncate font-mono text-[11px] font-medium lowercase tracking-[-0.01em] text-ink-muted dark:text-[#B1BAC4]`,children:l})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[n===`streaming`&&(0,J.jsx)(`span`,{role:`status`,"aria-label":i(`common.loading`),className:`flex h-7 w-7 items-center justify-center`,children:(0,J.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-primary-400`})}),(0,J.jsx)(`button`,{type:`button`,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),o(e),s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{o(null),s.current=null},2e3)}catch(e){Fi.error(`Failed to copy code:`,e)}},disabled:!e,className:`flex h-7 w-7 items-center justify-center rounded-md text-ink-subtle transition-colors hover:bg-surface-subtle hover:text-ink focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-400/70 disabled:cursor-default disabled:opacity-35 dark:text-[#8B949E] dark:hover:bg-white/[0.08] dark:hover:text-[#E6EDF3]`,title:u,"aria-label":d,children:c?(0,J.jsx)(se,{className:`h-3.5 w-3.5 text-green-400`}):(0,J.jsx)(me,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:c?d:``})]})]}),r]})}var Li=`#0D1117`,Ri=`rgb(var(--color-surface-subtle))`,zi=`max-h-[60vh] min-h-12 overflow-auto bg-surface-subtle p-4 text-left font-mono text-[14px] leading-6 text-ink whitespace-pre tabular-nums dark:bg-[#0D1117] dark:text-[#E6EDF3]`,Bi={maxHeight:`60vh`,minHeight:`3rem`,overflow:`auto`,padding:`1rem`,fontSize:`14px`,lineHeight:`1.5rem`,fontFamily:`"JetBrains Mono", ui-monospace, SFMono-Regular, monospace`,whiteSpace:`pre`};function Vi({content:e}){return e?(0,J.jsx)(`div`,{dir:`auto`,className:`whitespace-pre-wrap break-words leading-relaxed`,children:e}):null}function Hi({content:e,language:t,complete:n}){let r=n?e.replace(/\r?\n$/,``):e,i=q.useRef(null),a=q.useRef(!0);return q.useLayoutEffect(()=>{let e=i.current;e&&a.current&&(e.scrollTop=e.scrollHeight)},[r]),(0,J.jsx)(Ii,{code:r,language:t,state:n?`complete`:`streaming`,children:(0,J.jsx)(`pre`,{ref:i,onScroll:()=>{let e=i.current;e&&(a.current=e.scrollHeight-e.scrollTop-e.clientHeight<24)},className:zi,children:(0,J.jsx)(`code`,{children:r})})})}var Ui=({content:e,className:t,segments:n,isStreaming:r=!0})=>{let i=q.useMemo(()=>n??Ni(e),[e,n]),a=i[i.length-1],o=a?.type===`code`&&!a.complete;return(0,J.jsxs)(`div`,{className:P(`text-sm leading-relaxed text-gray-700 dark:text-dark-700`,t),children:[i.map((e,t)=>e.type===`code`?(0,J.jsx)(Hi,{...e},`${e.type}-${t}`):(0,J.jsx)(Vi,{content:e.content},`${e.type}-${t}`)),r&&!o&&(0,J.jsx)(`span`,{"data-testid":`message-streaming-cursor`,"aria-hidden":`true`,className:`ms-1 inline-block h-5 w-1 animate-pulse rounded-full bg-primary-500 align-text-bottom`})]})},Wi=q.lazy(()=>d(()=>import(`../js/RichMessageContent-BJ49VN9j.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])));function Gi({content:e,className:t}){return(0,J.jsx)(`div`,{dir:`auto`,className:P(`text-sm leading-relaxed text-gray-700 dark:text-dark-700 whitespace-pre-wrap break-words`,t),children:e})}var Ki=({content:e,className:t,isStreaming:n=!1})=>{let r=q.useMemo(()=>n?Ni(e):[],[e,n]),i=r.some(e=>e.type===`code`);if(n&&i)return(0,J.jsx)(Ui,{content:e,className:t,segments:r});let a;return a=Mi(e)?(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(Ui,{content:e,className:t,isStreaming:!1}),children:(0,J.jsx)(Wi,{content:e,className:t})}):(0,J.jsx)(Gi,{content:e,className:t}),(0,J.jsxs)(J.Fragment,{children:[a,n&&(0,J.jsx)(`span`,{"data-testid":`message-streaming-cursor`,"aria-hidden":`true`,className:`ms-1 inline-block h-5 w-1 animate-pulse rounded-full bg-primary-500 align-text-bottom`})]})},qi=({children:e,htmlFor:t,className:n=``})=>(0,J.jsx)(`label`,{htmlFor:t,className:P(`text-sm font-medium tracking-[-0.005em] text-ink-muted`,n),children:e}),Ji=({children:e,className:t=``})=>(0,J.jsx)(`div`,{className:P(`rounded-2xl border border-line bg-surface-raised shadow-card`,t),children:e}),Yi=({children:e,className:t=``})=>(0,J.jsx)(`div`,{className:P(`flex flex-col space-y-1.5 p-6`,t),children:e}),Xi=({children:e,className:t=``})=>(0,J.jsx)(`h3`,{className:P(`text-lg font-semibold leading-tight tracking-[-0.02em] text-ink`,t),children:e}),Zi=({children:e,className:t=``})=>(0,J.jsx)(`p`,{className:P(`text-sm leading-relaxed text-ink-muted`,t),children:e}),Qi=({children:e,className:t=``})=>(0,J.jsx)(`div`,{className:P(`p-6 pt-0`,t),children:e}),$i={narrow:`max-w-4xl`,default:`max-w-6xl`,wide:`max-w-7xl`},ea=({children:e,width:t=`default`,className:n,contentClassName:r,...i})=>(0,J.jsx)(`div`,{"data-testid":`page-scroll-region`,className:P(`scroll-region h-full min-h-0 scrollbar-thin`,n),...i,children:(0,J.jsx)(`div`,{className:P(`mx-auto w-full px-4 pb-16 pt-7 sm:px-6 sm:pb-20 sm:pt-10 lg:px-8`,$i[t],r),children:e})}),ta=({title:e,description:t,eyebrow:n,actions:r,meta:i,className:a,...o})=>(0,J.jsxs)(`header`,{className:P(`mb-8 flex flex-col gap-6 border-b border-gray-200/70 pb-7 text-start dark:border-white/[0.08] sm:mb-10 sm:pb-9 md:flex-row md:items-end md:justify-between`,a),...o,children:[(0,J.jsxs)(`div`,{className:`min-w-0 max-w-3xl`,children:[n&&(0,J.jsx)(`div`,{className:`mb-3 text-[11px] font-medium uppercase tracking-[0.18em] text-gray-500 dark:text-dark-500 rtl:tracking-normal`,children:n}),(0,J.jsx)(`h1`,{className:`text-balance text-3xl font-normal leading-[1.02] tracking-[-0.04em] text-gray-950 dark:text-dark-950 sm:text-5xl rtl:leading-[1.15] rtl:tracking-normal`,children:e}),t&&(0,J.jsx)(`p`,{className:`mt-4 max-w-2xl text-sm leading-6 text-gray-600 dark:text-dark-600 sm:text-base sm:leading-7`,children:t}),i&&(0,J.jsx)(`div`,{className:`mt-4`,children:i})]}),r&&(0,J.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 md:justify-end`,children:r})]}),na=N(`components:avatar-upload`),ra=({value:e,onChange:t,className:n=``})=>{let{t:r}=x(),i=(0,q.useRef)(null),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=async e=>{if(!e.type.startsWith(`image/`)){M.error(r(`user.avatar.invalidFile`));return}if(e.size>2*1024*1024){M.error(r(`user.avatar.fileTooLarge`));return}o(!0);try{let n=new FileReader;n.onload=e=>{let n=e.target?.result;t(n),M.success(r(`user.avatar.uploaded`))},n.onerror=()=>{M.error(r(`user.avatar.readFailed`))},n.readAsDataURL(e)}catch(e){na.error(`Failed to upload avatar:`,e),M.error(r(`user.avatar.uploadFailed`))}finally{o(!1)}},u=e=>{let t=e.target.files?.[0];t&&l(t)},d=e=>{e.preventDefault(),c(!0)},f=e=>{e.preventDefault(),c(!1)},p=e=>{e.preventDefault(),c(!1);let t=e.dataTransfer.files?.[0];t&&l(t)},m=()=>{t(``),M.success(r(`user.avatar.removed`))},h=()=>e||null;return(0,J.jsx)(`div`,{className:`space-y-4 ${n}`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:r(`user.avatar.label`)}),(0,J.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,J.jsx)(`div`,{className:`flex-shrink-0`,children:(0,J.jsx)(`div`,{className:`w-20 h-20 rounded-full overflow-hidden bg-gray-100 dark:bg-dark-200 border-2 border-gray-300 dark:border-dark-300 flex items-center justify-center`,children:h()?(0,J.jsx)(`img`,{src:h(),alt:`Avatar preview`,className:`w-full h-full object-cover`}):(0,J.jsx)(De,{className:`h-8 w-8 text-gray-400 dark:text-gray-500`})})}),(0,J.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[e?(0,J.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-gray-50 dark:bg-dark-200 rounded-lg`,children:[(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:r(`user.avatar.customAvatar`)}),(0,J.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:r(`user.avatar.clickToChange`)})]}),(0,J.jsx)(I,{variant:`ghost`,size:`sm`,onClick:m,className:`text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-900/20`,children:(0,J.jsx)(Ce,{className:`h-4 w-4`})})]}):(0,J.jsxs)(`div`,{className:`border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors ${s?`border-primary-500 bg-primary-50 dark:bg-primary-900/20`:`border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500`}`,onDragOver:d,onDragLeave:f,onDrop:p,onClick:()=>i.current?.click(),children:[(0,J.jsx)(xe,{className:`h-8 w-8 mx-auto text-gray-400 dark:text-gray-500 mb-2`}),(0,J.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 mb-2`,children:r(`user.avatar.uploadAvatarImage`)}),(0,J.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-2`,children:r(`user.avatar.dragAndDrop`)}),(0,J.jsxs)(I,{variant:`outline`,size:`sm`,disabled:a,className:`mx-auto`,children:[(0,J.jsx)(xe,{className:`h-4 w-4 mr-2`}),r(a?`user.avatar.uploading`:`user.avatar.chooseImage`)]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1`,children:r(`user.avatar.enterImageUrl`)}),(0,J.jsx)(`input`,{type:`url`,value:e,onChange:e=>t(e.target.value),className:`w-full px-3 py-2 text-sm border border-gray-300 dark:border-dark-300 rounded-md bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800`,placeholder:`https://example.com/avatar.jpg`})]})]})]}),(0,J.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,onChange:u,className:`hidden`}),(0,J.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-2`,children:r(`user.avatar.supportedFormats`)})]})})};function ia({open:e,value:t,saving:n,onChange:r,onClose:i,onSave:a}){let{t:o}=x();return e?(0,bi.createPortal)((0,J.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,J.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,J.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,J.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,J.jsx)(`button`,{onClick:i,className:`p-2 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:(0,J.jsx)(Ce,{size:20,className:`text-gray-500`})})]}),(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(ra,{value:t,onChange:r}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-3 pt-4 border-t border-gray-200 dark:border-dark-300`,children:[(0,J.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,J.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 aa={sm:`text-[1.0625rem] leading-none`,md:`text-[1.625rem] leading-none`,lg:`text-[2.5rem] leading-none`},oa=({className:e,size:t=`md`,wordmark:n=!0})=>(0,J.jsxs)(`span`,{dir:`ltr`,className:P(`libre-brand inline-flex items-baseline whitespace-nowrap`,aa[t],e),children:[`Libre`,n&&(0,J.jsx)(`span`,{className:`ms-1 font-normal tracking-[-0.035em]`,children:`WebUI`})]}),sa=()=>{let{theme:e,toggleTheme:t}=Xe(),n=e.mode===`light`?`dark`:`light`,r=e.mode===`light`?(0,J.jsx)(ie,{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,J.jsx)(Se,{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,J.jsx)(I,{variant:`ghost`,size:`sm`,onClick:t,className:`h-9 w-9 rounded-full p-0`,"aria-label":i,title:`${i} (⌘D)`,children:r})};function ca({sidebarCompact:e,isElectron:t,showWork:n,activeMode:r,selectedModel:i,modelCount:a,onToggleCompact:o,onStartWork:s,onCreateSession:c}){let{t:l}=x(),u=!i||a===0,d=u?l(`chat.model.noModelsTooltip`):``;return(0,J.jsxs)(`div`,{className:P(e?`px-2 pb-3 pt-3`:`px-4 pb-4 pt-4`,t&&`pt-10`),children:[(0,J.jsx)(`div`,{className:P(`flex items-center`,e?`justify-center mb-3`:`justify-between mb-4`),children:e?(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,J.jsx)(oa,{size:`sm`,wordmark:!1,className:`text-gray-950 dark:text-dark-950 text-base tracking-[-0.035em]`}),(0,J.jsx)(I,{variant:`ghost`,size:`sm`,onClick:o,className:`h-9 w-9 p-0 rounded-xl text-gray-500 dark:text-dark-600 hover:bg-white/80 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation`,title:l(`sidebar.expandSidebar`),"aria-label":l(`sidebar.expandSidebar`),children:(0,J.jsx)(oe,{className:`h-4 w-4 rtl:rotate-180`})}),(0,J.jsx)(sa,{})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(oa,{size:`sm`,className:`text-gray-950 dark:text-dark-950 tracking-[-0.035em]`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,J.jsx)(sa,{}),(0,J.jsx)(I,{variant:`ghost`,size:`sm`,onClick:o,className:`h-9 w-9 p-0 rounded-xl text-gray-500 dark:text-dark-600 hover:bg-white/80 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation`,title:l(`sidebar.toggleSize`),"aria-label":l(`sidebar.toggleSize`),children:(0,J.jsx)(E,{className:`h-4 w-4 rtl:rotate-180`})})]})]})}),(0,J.jsxs)(`div`,{className:P(`grid w-full gap-2`,e||!n?`grid-cols-1`:`grid-cols-2`),"data-testid":`sidebar-create-actions`,children:[n&&(0,J.jsxs)(I,{variant:r===`work`?`primary`:`secondary`,onClick:s,className:P(`h-10 rounded-xl shadow-none touch-manipulation`,e&&`w-full p-0`),size:`sm`,title:l(`chat.session.work`),"aria-label":l(`chat.session.work`),"aria-pressed":r===`work`,"data-testid":`sidebar-work-button`,children:[(0,J.jsx)(j,{className:`h-4 w-4`}),!e&&l(`chat.session.work`)]}),(0,J.jsxs)(I,{variant:r===`chat`?`primary`:`secondary`,onClick:c,disabled:u,className:P(`h-10 rounded-xl shadow-none touch-manipulation`,e&&`w-full p-0`),size:`sm`,title:u?d:l(`chat.session.chat`),"aria-label":l(`chat.session.chat`),"aria-pressed":r===`chat`,"data-testid":`sidebar-chat-button`,children:[(0,J.jsx)(A,{className:`h-4 w-4`}),!e&&l(`chat.session.chat`)]})]}),(0,J.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:P(`mt-2 flex items-center gap-2.5 rounded-xl text-[13px] text-gray-500 transition-colors hover:bg-white/60 hover:text-gray-950 dark:text-dark-600 dark:hover:bg-dark-200/60 dark:hover:text-dark-950 outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30 touch-manipulation`,e?`h-11 w-11 justify-center p-0 mx-auto`:`w-full px-2.5 py-2`),children:[(0,J.jsx)(T,{className:`h-4 w-4 shrink-0`}),!e&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`flex-1 text-start`,children:l(`palette.search`,`Search`)}),(0,J.jsxs)(`span`,{className:`font-mono text-[10px] tracking-wide text-gray-400 dark:text-dark-500`,children:[Be()?`⌘`:`Ctrl`,`K`]})]})]})]})}var la=[{path:`/models`,icon:ye,labelKey:`sidebar.navigation.models`},{path:`/personas`,icon:De,labelKey:`sidebar.navigation.personas`},{path:`/gallery`,icon:k,labelKey:`sidebar.navigation.imagine`},{path:`/agents`,icon:be,labelKey:`sidebar.navigation.agents`}];function ua({sidebarCompact:e,activePath:t,onMobileNavigate:n}){let{t:r}=x();return(0,J.jsx)(`div`,{className:P(`pb-3`,e?`px-2`:`px-3`),children:(0,J.jsx)(`nav`,{"data-testid":`sidebar-navigation`,"aria-label":r(`sidebar.navigation.exploreLabel`,`Explore`),className:P(`flex gap-1`,e?`flex-col items-center`:`items-center`),children:la.map(({path:i,icon:a,labelKey:o})=>{let s=t===i,c=r(o);return(0,J.jsx)(_,{to:i,onClick:n,title:c,"aria-label":c,"aria-current":s?`page`:void 0,className:P(`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-11 w-11`:`h-9 flex-1`,s?`bg-white text-gray-950 ring-1 ring-black/[0.04] dark:bg-dark-200 dark:text-dark-950 dark:ring-white/[0.06]`:`text-gray-500 hover:bg-white/60 hover:text-gray-950 dark:text-dark-600 dark:hover:bg-dark-200/60 dark:hover:text-dark-950`),children:(0,J.jsx)(a,{className:`h-[18px] w-[18px] shrink-0`})},i)})})})}function da({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}){let{t:p,i18n:m}=x();return(0,J.jsx)(`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,J.jsxs)(`div`,{className:P(`px-3 py-3`,i&&`px-2`),children:[!i&&e.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between mb-2 px-1`,children:[(0,J.jsx)(`h3`,{className:`text-[10px] font-semibold text-gray-500 dark:text-dark-500 uppercase tracking-[0.16em] rtl:tracking-normal`,children:p(`chat.session.chats`)}),(0,J.jsx)(`span`,{className:`text-[10px] tabular-nums text-gray-400 dark:text-dark-500 font-medium`,children:e.length})]}),e.length===0?(0,J.jsxs)(`div`,{className:P(`text-center py-8`,i?`px-1`:`px-2`),children:[(0,J.jsx)(`div`,{className:P(`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,J.jsx)(A,{className:P(`text-gray-400 dark:text-gray-500`,i?`h-4 w-4`:`h-5 w-5`)})}),!i&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:p(`chat.session.noChats`)}),(0,J.jsx)(`p`,{className:`text-xs mt-1 text-gray-400 dark:text-dark-500`,children:p(`chat.session.createFirst`)})]})]}):(0,J.jsx)(`div`,{className:P(`space-y-0.5`,i&&`space-y-1`),children:e.map(e=>{let h=n===e.id,g=e.personaId?t[e.personaId]:null;return(0,J.jsx)(`div`,{className:P(`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.5 py-2`,h?`bg-white ring-1 ring-black/[0.04] dark:bg-dark-200 dark:ring-white/[0.05]`:`hover:bg-white/60 dark:hover:bg-dark-200/60`),onClick:()=>c(e),title:i?`${e.title} - ${e.model}`:void 0,children:i?(0,J.jsx)(`div`,{className:`flex items-center justify-center w-full h-10`,children:(0,J.jsx)(`div`,{className:P(`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`:h?`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,J.jsxs)(`div`,{className:`flex items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(xi,{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,J.jsx)(I,{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,J.jsx)(se,{className:`h-3 w-3`})}),(0,J.jsx)(I,{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,J.jsx)(Ce,{className:`h-3 w-3`})})]}):(0,J.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,J.jsxs)(`div`,{className:`flex-1 min-w-0 me-2`,children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-medium truncate leading-tight text-gray-900 dark:text-dark-900`,children:r===e.id?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)(`span`,{className:`animate-pulse`,children:p(`chat.session.generatingTitle`)}),(0,J.jsxs)(`span`,{className:`inline-flex`,children:[(0,J.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`0ms`},children:`.`}),(0,J.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`150ms`},children:`.`}),(0,J.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`300ms`},children:`.`})]})]}):He(e.title,32)}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[(0,J.jsx)(`span`,{dir:`auto`,className:P(`text-[11px] tabular-nums`,h?`text-gray-500 dark:text-dark-600`:`text-gray-400 dark:text-dark-500`),children:Ve(e.updatedAt,m.language)}),(0,J.jsx)(`span`,{className:`text-gray-300 dark:text-dark-400`,children:`•`}),e.personaId?g?(0,J.jsxs)(`span`,{className:P(`flex items-center gap-1 text-[11px] font-medium`,h?`text-primary-600 dark:text-primary-400`:`text-primary-500 dark:text-primary-500`),title:g.description||g.name,children:[g.avatar&&!g.avatar.startsWith(`data:`)&&(0,J.jsx)(`span`,{className:`text-[10px]`,children:g.avatar}),(0,J.jsx)(`span`,{className:`truncate max-w-[100px]`,children:g.name})]}):(0,J.jsx)(`span`,{className:P(`text-[11px] font-medium italic`,h?`text-gray-500 dark:text-gray-500`:`text-gray-400 dark:text-gray-600`),children:`Persona`}):(0,J.jsx)(`span`,{dir:`ltr`,className:P(`font-mono text-[10px] truncate max-w-[108px]`,h?`text-gray-700 dark:text-gray-300`:`text-gray-600 dark:text-gray-400`),title:e.model,children:e.model})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100 transition-opacity duration-150 shrink-0`,children:[(0,J.jsx)(I,{variant:`ghost`,size:`sm`,onClick:t=>l(e,t),className:`h-7 w-7 sm:h-7 sm:w-7 p-0 hover:bg-gray-100 dark:hover:bg-dark-300 rounded-lg touch-manipulation`,title:p(`chat.session.renameChat`),children:(0,J.jsx)(ue,{className:`h-3 w-3`})}),(0,J.jsx)(I,{variant:`ghost`,size:`sm`,onClick:t=>f(e.id,t),className:`h-7 w-7 sm:h-7 sm:w-7 p-0 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg touch-manipulation`,title:p(`chat.session.deleteChat`),children:(0,J.jsx)(ge,{className:`h-3 w-3`})})]})]})},e.id)})})]})})}function fa({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,J.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,J.jsx)(`div`,{className:`${n} bg-gray-950 dark:bg-white rounded-full flex items-center justify-center`,title:`${e.username} (${e.role})`,children:(0,J.jsx)(`span`,{className:`text-white dark:text-gray-950 ${r} font-medium`,children:e.username.charAt(0).toUpperCase()})})}function pa({requiresAuth:e,user:t,isAdmin:n,sidebarCompact:r,userMenuOpen:i,userMenuRef:a,onToggleUserMenu:o,onOpenSettings:s,onOpenAvatar:c,onLogout:l,onMobileNavigate:u,onCloseUserMenu:d}){let{t:f}=x();return!e||!t?null:(0,J.jsx)(`div`,{className:P(`border-t border-black/[0.05] dark:border-white/[0.05]`,r?`p-2`:`p-3`),children:r?(0,J.jsxs)(`div`,{className:`flex flex-col items-center space-y-2`,children:[(0,J.jsx)(fa,{user:t,size:`sm`}),(0,J.jsx)(`button`,{onClick:s,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:f(`sidebar.navigation.settings`),children:(0,J.jsx)(Ae,{className:`h-4 w-4`})}),n&&(0,J.jsx)(_,{to:`/users`,onClick:u,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:f(`sidebar.navigation.userManagement`),children:(0,J.jsx)(De,{className:`h-4 w-4`})}),(0,J.jsx)(`button`,{onClick:l,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-500 dark:text-dark-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600 dark:hover:text-red-400 touch-manipulation transition-colors duration-150`,title:f(`sidebar.navigation.signOut`),children:(0,J.jsx)(w,{className:`h-4 w-4`})})]}):(0,J.jsxs)(`div`,{className:`relative`,ref:a,children:[(0,J.jsx)(`button`,{onClick:o,className:`w-full p-2.5 rounded-xl hover:bg-white/70 dark:hover:bg-dark-200 transition-colors duration-150 text-start touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,J.jsx)(fa,{user:t,size:`sm`}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,J.jsxs)(`div`,{className:`flex items-center mt-0.5`,children:[t.role===`admin`&&(0,J.jsx)(pe,{size:10,className:`text-primary-500 me-1`}),(0,J.jsx)(`span`,{className:`text-[11px] text-gray-500 dark:text-dark-500 capitalize`,children:t.role})]})]}),(0,J.jsx)(oe,{className:P(`h-4 w-4 text-gray-400 dark:text-dark-500 transition-transform duration-150 rtl:rotate-180`,i&&`rotate-90 rtl:rotate-90`)})]})}),i&&(0,J.jsxs)(`div`,{className:`scroll-region absolute bottom-full left-0 right-0 z-50 mb-2 max-h-[calc(100dvh-1rem)] rounded-2xl border border-black/[0.07] bg-white/95 py-2 shadow-[0_18px_60px_rgba(15,23,42,0.16)] backdrop-blur-xl animate-scale-in scrollbar-thin dark:border-white/[0.08] dark:bg-dark-25/95`,children:[(0,J.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-100 dark:border-dark-200/50`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,J.jsx)(fa,{user:t,size:`md`}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,J.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:t.email||f(`user.profile.noEmail`)})]})]})}),(0,J.jsxs)(`div`,{className:`py-1`,children:[(0,J.jsxs)(`button`,{onClick:()=>{c(t.avatar||``),d()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150 text-start`,children:[(0,J.jsx)(ee,{className:`h-4 w-4 shrink-0`}),f(`user.menu.changePicture`)]}),(0,J.jsxs)(`button`,{onClick:()=>{s(),d()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150 text-start`,children:[(0,J.jsx)(Ae,{className:`h-4 w-4 shrink-0`}),f(`user.menu.settings`)]}),n&&(0,J.jsxs)(_,{to:`/users`,onClick:()=>{d(),u()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150`,children:[(0,J.jsx)(De,{className:`h-4 w-4 shrink-0`}),f(`user.menu.userManagement`)]}),(0,J.jsx)(`div`,{className:`border-t border-gray-100 dark:border-dark-200/50 my-1`}),(0,J.jsxs)(`button`,{onClick:()=>{l(),d()},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,J.jsx)(w,{className:`h-4 w-4 shrink-0`}),f(`user.menu.logout`)]})]})]})]})})}var ma={idle:{labelKey:`work.statusLabels.idle`,label:`Idle`,color:`rgb(255, 255, 255)`,animated:!1},preparing:{labelKey:`work.statusLabels.thinking`,label:`Thinking`,color:`rgb(48, 121, 255)`,animated:!0},running:{labelKey:`work.statusLabels.thinking`,label:`Thinking`,color:`rgb(48, 121, 255)`,animated:!0},completed:{labelKey:`work.statusLabels.complete`,label:`Complete`,color:`rgb(76, 212, 117)`,animated:!1},needs_input:{labelKey:`work.statusLabels.needsInput`,label:`Needs input`,color:`rgb(255, 204, 0)`,animated:!1},cancelled:{labelKey:`work.statusLabels.needsInput`,label:`Needs input`,color:`rgb(255, 204, 0)`,animated:!1},failed:{labelKey:`work.statusLabels.error`,label:`Error`,color:`rgb(255, 61, 129)`,animated:!1}};function ha({tasks:e,currentTaskId:t,loading:n,actionLoading:r,sidebarCompact:i,onSelectTask:a,onDeleteTask:o}){let{t:s,i18n:c}=x();return(0,J.jsx)(`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,J.jsxs)(`div`,{className:P(`px-3 py-3`,i&&`px-2`),children:[!i&&e.length>0&&(0,J.jsxs)(`div`,{className:`mb-2 flex items-center justify-between px-1`,children:[(0,J.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-gray-500 dark:text-dark-500 rtl:tracking-normal`,children:s(`work.tasks.title`,{defaultValue:`Work tasks`})}),(0,J.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums text-gray-400 dark:text-dark-500`,children:e.length})]}),n&&e.length===0?(0,J.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex items-center justify-center py-10 text-gray-400 dark:text-dark-500`,children:[(0,J.jsx)(O,{"aria-hidden":`true`,className:`h-5 w-5 animate-spin`}),(0,J.jsx)(`span`,{className:`sr-only`,children:s(`work.tasks.loading`,{defaultValue:`Loading Work tasks`})})]}):e.length===0?(0,J.jsxs)(`div`,{className:P(`py-8 text-center`,i?`px-1`:`px-2`),children:[(0,J.jsx)(`div`,{className:P(`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]`,i?`h-8 w-8`:`h-12 w-12`),children:(0,J.jsx)(j,{className:P(`text-gray-400 dark:text-gray-500`,i?`h-4 w-4`:`h-5 w-5`)})}),!i&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:s(`work.tasks.emptyTitle`,{defaultValue:`No Work tasks yet`})}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-gray-400 dark:text-dark-500`,children:s(`work.tasks.empty`,{defaultValue:`Your Work tasks will appear here after you send the first message.`})})]})]}):(0,J.jsx)(`div`,{"data-testid":`sidebar-work-task-list`,className:P(`space-y-0.5`,i&&`space-y-1`),children:e.map(e=>{let n=t===e.id,l=ma[e.status],u=s(l.labelKey,{defaultValue:l.label});return(0,J.jsxs)(`div`,{"data-testid":`sidebar-work-task-item`,"data-task-id":e.id,className:P(`group relative transition-colors duration-150 outline-none`,i?`flex items-center justify-center rounded-xl p-1`:`rounded-xl px-3 py-2.5`,n?`bg-white ring-1 ring-black/[0.04] dark:bg-dark-200 dark:ring-white/[0.05]`:`hover:bg-white/60 dark:hover:bg-dark-200/60`),children:[(0,J.jsxs)(`button`,{type:`button`,"aria-current":n?`page`:void 0,className:P(`w-full text-start outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,i?`flex h-10 items-center justify-center`:`pe-8`),title:i?`${e.title} · ${e.model}`:void 0,onClick:()=>a(e.id),children:[i?(0,J.jsxs)(`span`,{className:P(`relative flex h-9 w-9 items-center justify-center rounded-xl text-[11px] font-semibold uppercase transition-colors`,n?`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)||`•`,(0,J.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-work-task-status`,"data-status-label":u,className:P(`absolute -bottom-0.5 -end-0.5 h-2.5 w-2.5 rounded-full border-2 border-gray-100 dark:border-dark-50`,l.animated&&`animate-pulse`,e.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:l.color}})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-work-task-status`,"data-status-label":u,className:P(`h-2 w-2 shrink-0 rounded-full`,l.animated&&`animate-pulse`,e.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:l.color}}),(0,J.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate text-[13px] font-medium leading-tight text-gray-900 dark:text-dark-900`,children:He(e.title||s(`work.tasks.untitled`,{defaultValue:`Untitled task`}),32)})]}),(0,J.jsxs)(`span`,{className:`mt-1 flex items-center gap-1.5 ps-4 text-[11px] text-gray-400 dark:text-dark-500`,children:[(0,J.jsx)(`span`,{className:`tabular-nums`,children:Ve(e.updatedAt,c.language)}),(0,J.jsx)(`span`,{className:`text-gray-300 dark:text-dark-400`,children:`•`}),(0,J.jsx)(`span`,{dir:`ltr`,className:`min-w-0 truncate font-medium text-gray-600 dark:text-gray-400`,title:e.model,children:e.model})]})]}),(0,J.jsx)(`span`,{className:`sr-only`,children:s(`work.tasks.status`,{defaultValue:`Status: {{status}}`,status:u})})]}),!i&&(0,J.jsx)(`button`,{type:`button`,"data-testid":`sidebar-work-task-delete`,disabled:r,className:P(`absolute end-2 top-1/2 -translate-y-1/2 rounded-lg p-1.5 text-gray-400 transition-[color,background-color,opacity] hover:bg-error-500/10 hover:text-error-600 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-error-500/30 disabled:cursor-not-allowed disabled:opacity-40 group-focus-within:opacity-100 group-hover:opacity-100 dark:text-dark-500`,n?`opacity-100`:`opacity-0`),"aria-label":s(`work.tasks.deleteNamed`,{defaultValue:`Delete {{title}}`,title:e.title||s(`work.tasks.untitled`,{defaultValue:`Untitled task`})}),onClick:t=>{t.stopPropagation(),o(e)},children:(0,J.jsx)(ge,{"aria-hidden":`true`,className:`h-3.5 w-3.5`})})]},e.id)})})]})})}var ga=N(`components:sidebar`),_a=q.lazy(()=>d(()=>import(`../js/SettingsModal-CxtOXPY7.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([11,1,2,12,13,3,14,15,8,7,16,5,4,17,6,18]))),va=({isOpen:e,onClose:t,className:n})=>{let{t:r}=x(),i=v(),a=c(),{sessions:o,deleteSession:s,updateSessionTitle:l,selectedModel:u,models:d,currentSession:f,generatingTitleForSession:p,personas:m}=Ye(),h=Ke(e=>e.tasks),g=Ke(e=>e.loadingTasks),_=Ke(e=>e.actionLoading),y=Ke(e=>e.deleteTask),{user:b,isAdmin:C,systemInfo:w,setUser:T}=F(),{backgroundImage:E,sidebarCompact:D,toggleSidebarCompact:ee}=Xe(),[te,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(``),[ne,re]=(0,q.useState)(!1),[j,ie]=(0,q.useState)(!1),[ae,oe]=(0,q.useState)(!1),[se,ce]=(0,q.useState)(``),[le,ue]=(0,q.useState)(!1),de=(0,q.useRef)(null),fe=(0,q.useRef)(null),pe=i.pathname.match(/^\/c\/([^/]+)$/)?.[1]||null,me=f?.id||pe,he=()=>{window.innerWidth<768&&!D&&ee()},ge=()=>{let{setCurrentSession:e}=Ye.getState();vi(),e(null),sessionStorage.setItem(`forceWelcomeScreen`,`true`)};(0,q.useEffect)(()=>{let e=e=>{de.current&&!de.current.contains(e.target)&&ie(!1)};if(j)return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[j]),(0,q.useEffect)(()=>{let t=t=>{fe.current&&!fe.current.contains(t.target)&&window.innerWidth<768&&e&&!D&&ee()};if(e&&!D&&window.innerWidth<768)return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[e,D,ee]);let _e=async()=>{ue(!0);try{let e=await Ie.updateMyAvatar(se||null);e.success&&e.data?(T(e.data),S.success(r(`user.avatar.updated`)),oe(!1)):S.error(e.message||r(`user.avatar.updateFailed`))}catch(e){ga.error(`Failed to update avatar:`,e),S.error(r(`user.avatar.updateFailed`))}finally{ue(!1)}},M=()=>{ge(),a(`/chat`,{replace:!0}),he()},ve=()=>{Ke.getState().clearError(),a(`/work`),he()},ye=e=>{a(`/c/${e.id}`,{replace:!0}),he()},be=e=>{a(`/work/${e}`,{replace:!0}),he()},xe=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`})})))try{await y(e.id),Ue(e.id),di.getState().closeTab(`work:${e.id}`),je===e.id&&a(`/work`,{replace:!0,state:{deletedWorkTaskId:e.id}})}catch(e){ga.error(`Failed to delete Work task:`,e),S.error(r(`work.toasts.deleteFailed`,{defaultValue:`Could not delete this Work task.`}))}},Se=async(e,t)=>{if(t.stopPropagation(),ga.debug(`Delete session clicked:`,e),window.confirm(r(`chat.session.deleteConfirm`)))try{ga.debug(`Attempting to delete session:`,e);let t=me===e;if(await s(e),ga.debug(`Session deleted successfully`),di.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){ga.error(`Error deleting session:`,e)}},Ce=(e,t)=>{t.stopPropagation(),O(e.id),A(e.title)},we=async e=>{k.trim()&&await l(e,k.trim()),O(null),A(``)},Te=()=>{O(null),A(``)},Ee=async()=>{try{await Le.logout();let{logout:e}=F.getState();e(),a(`/login`),S.success(r(`auth.logout.success`))}catch(e){ga.error(`Logout error:`,e);let{logout:t}=F.getState();t(),a(`/login`)}},De=()=>{re(!0),he()},Oe=e=>{ce(e),oe(!0)},ke=window.location.protocol===`file:`,Ae=i.pathname===`/work`||i.pathname.startsWith(`/work/`),je=i.pathname.match(/^\/work\/([^/]+)$/)?.[1]||null,Me=i.pathname===`/`||i.pathname===`/chat`||i.pathname.startsWith(`/c/`),Ne=w?.requiresAuth===!1||C();return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{ref:fe,"data-testid":`sidebar`,className:P(`fixed inset-y-0 start-0 z-50 border-e border-black/[0.06] 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)]`,D?`w-18`:`w-72 max-sm:w-64`,e?`translate-x-0`:`ltr:-translate-x-full rtl:translate-x-full`,`lg:shadow-none`,E?`bg-gray-100/75 dark:bg-dark-50/75 backdrop-blur-xl`:`bg-gray-100 dark:bg-dark-50`,`overscroll-behavior-contain`,n),style:{WebkitOverflowScrolling:`touch`},children:[ke&&(0,J.jsx)(`div`,{className:`absolute top-0 start-16 end-0 h-8 z-[60]`,style:{WebkitAppRegion:`drag`}}),(0,J.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,J.jsx)(ca,{sidebarCompact:D,isElectron:ke,showWork:Ne,activeMode:Ae?`work`:Me?`chat`:null,selectedModel:u,modelCount:d.length,onToggleCompact:ee,onStartWork:ve,onCreateSession:M}),(0,J.jsx)(ua,{sidebarCompact:D,activePath:i.pathname,onMobileNavigate:he}),Ae&&Ne?(0,J.jsx)(ha,{tasks:h,currentTaskId:je,loading:g,actionLoading:_,sidebarCompact:D,onSelectTask:be,onDeleteTask:e=>void xe(e)}):(0,J.jsx)(da,{sessions:o,personas:m,currentSessionId:me,generatingTitleForSession:p,sidebarCompact:D,editingSessionId:te,editingTitle:k,onEditingTitleChange:A,onSelectSession:ye,onStartEditing:Ce,onSaveEdit:we,onCancelEdit:Te,onDeleteSession:Se}),(0,J.jsx)(pa,{requiresAuth:w?.requiresAuth,user:b,isAdmin:C(),sidebarCompact:D,userMenuOpen:j,userMenuRef:de,onToggleUserMenu:()=>ie(e=>!e),onOpenSettings:De,onOpenAvatar:Oe,onLogout:Ee,onMobileNavigate:he,onCloseUserMenu:()=>ie(!1)})]})]}),ne&&(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(_a,{isOpen:ne,onClose:()=>re(!1)})}),(0,J.jsx)(ia,{open:ae,value:se,saving:le,onChange:ce,onClose:()=>oe(!1),onSave:_e})]})},ya=({children:e,requireAuth:t=!0,requireAdmin:n=!1})=>{let{isAuthenticated:r,user:i,systemInfo:a,isLoading:s}=F();return v(),s?(0,J.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 dark:bg-dark-50`,children:(0,J.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`})}):a&&!a.requiresAuth?(0,J.jsx)(J.Fragment,{children:e}):t&&!r?(0,J.jsx)(o,{to:`/login`,replace:!0}):n&&(!i||i.role!==`admin`)?(0,J.jsx)(o,{to:`/`,replace:!0}):(0,J.jsx)(J.Fragment,{children:e})},ba=N(`components:error-boundary`),xa=({error:e})=>{let{t}=x();return(0,J.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,J.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,J.jsxs)(`div`,{className:`p-6 text-center`,children:[(0,J.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,J.jsx)(je,{className:`h-6 w-6`})}),(0,J.jsx)(`h1`,{className:`mb-2 text-xl font-semibold text-gray-950 dark:text-dark-950`,children:t(`errorBoundary.title`)}),(0,J.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-gray-600 dark:text-dark-600`,children:t(`errorBoundary.description`)}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:justify-center`,children:[(0,J.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,J.jsx)(D,{className:`h-4 w-4`}),t(`errorBoundary.tryAgain`)]}),(0,J.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,J.jsx)(Ee,{className:`h-4 w-4`}),t(`common.home`,`Home`)]})]}),!1]})})})},Sa=class extends q.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){ba.error(`ErrorBoundary caught an error:`,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,J.jsx)(xa,{error:this.state.error}):this.props.children}},Ca=(e,t=!0)=>{let n=(0,q.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===`?`||e.key===`h`);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:!0,o=e.ctrlKey?n.ctrlKey:!0,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,q.useEffect)(()=>{if(t)return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n)}},[n,t])},wa=e=>{let t=[];e.metaKey&&t.push(navigator.platform.includes(`Mac`)?`⌘`:`Ctrl`),e.ctrlKey&&t.push(`Ctrl`),e.shiftKey&&t.push(`⇧`),e.altKey&&t.push(navigator.platform.includes(`Mac`)?`⌥`:`Alt`);let n=e.key.toUpperCase();return e.key===`,`&&(n=`,`),e.key===` `&&(n=`Space`),e.key===`Enter`&&(n=`↩`),e.key===`Escape`&&(n=`Esc`),t.push(n),t.join(`+`)},Ta=({isOpen:e,onClose:t,shortcuts:n})=>{let{t:r}=x();if(!e)return null;let i={navigation:n.filter(e=>e.description.includes(`sidebar`)||e.description.includes(`Toggle`)),settings:n.filter(e=>e.description.includes(`settings`)||e.description.includes(`dark mode`)),general:n.filter(e=>!e.description.includes(`sidebar`)&&!e.description.includes(`settings`)&&!e.description.includes(`dark mode`)&&!e.description.includes(`Toggle`))};return(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4`,children:(0,J.jsxs)(`div`,{className:`flex max-h-[calc(100dvh-2rem)] min-h-0 w-full max-w-md flex-col overflow-hidden rounded-xl bg-white shadow-2xl dark:bg-dark-100 sm:max-h-[80dvh]`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between p-6 border-b border-gray-200 dark:border-dark-300`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(ce,{className:`h-5 w-5 text-gray-700 dark:text-dark-600`}),(0,J.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:r(`keyboard.title`)})]}),(0,J.jsx)(I,{variant:`ghost`,size:`sm`,onClick:t,className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,J.jsx)(Ce,{className:`h-4 w-4`})})]}),(0,J.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 space-y-6 p-6 scrollbar-thin`,children:[Object.entries(i).map(([e,t])=>t.length===0?null:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 dark:text-dark-600 mb-3`,children:r(`keyboard.groups.${e}`)}),(0,J.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,J.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:e.description}),(0,J.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:wa(e)})]},t))})]},e)),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 dark:text-dark-600 mb-3`,children:r(`keyboard.groups.chat`)}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,J.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:r(`keyboard.actions.sendMessage`)}),(0,J.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:`Enter`})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,J.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:r(`keyboard.actions.newLine`)}),(0,J.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:`Shift+Enter`})]})]})]})]}),(0,J.jsx)(`div`,{className:`px-6 py-4 bg-gray-50 dark:bg-dark-200 border-t border-gray-200 dark:border-dark-300`,children:(0,J.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-dark-400 text-center`,children:[r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`?`)[0],(0,J.jsx)(`kbd`,{className:`px-1 py-0.5 text-xs font-mono bg-gray-200 dark:bg-dark-300 rounded`,children:`?`}),r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`?`)[1].split(`H`)[0],(0,J.jsx)(`kbd`,{className:`px-1 py-0.5 text-xs font-mono bg-gray-200 dark:bg-dark-300 rounded`,children:`H`}),r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`H`)[1]]})})]})})},Ea=({onClick:e,className:t})=>{let{t:n}=x(),[r,i]=(0,q.useState)(!1);return(0,J.jsxs)(I,{variant:`ghost`,size:`sm`,onClick:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),className:P(`fixed bottom-4 end-4 h-10 w-10 p-0 bg-white/80 dark:bg-dark-100/80 backdrop-blur-sm border border-gray-200 dark:border-dark-300 shadow-lg hover:shadow-xl transition-all duration-200 z-50`,`hover:bg-white dark:hover:bg-dark-100`,t),title:n(`keyboard.tooltip`),children:[(0,J.jsx)(ce,{className:`h-4 w-4`}),r&&(0,J.jsx)(`div`,{className:`absolute bottom-full mb-2 end-0 px-2 py-1 text-xs bg-gray-900 text-white rounded whitespace-nowrap`,children:n(`keyboard.tooltip`)})]})},Da=({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,q.useState)(!1),{t:a}=x();return r?null:(0,J.jsx)(`div`,{className:P(`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,J.jsxs)(`div`,{className:`flex items-center justify-between max-w-6xl mx-auto gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,J.jsx)(`div`,{className:`flex-shrink-0`,children:(0,J.jsx)(te,{className:`h-4 w-4 text-white/65 dark:text-gray-950/60`})}),(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,J.jsx)(`p`,{className:`shrink-0 text-xs font-semibold tracking-wide`,children:a(`demoMode.title`)}),(0,J.jsx)(`p`,{className:`hidden truncate text-xs text-white/60 dark:text-gray-950/60 sm:block`,children:e})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,J.jsxs)(I,{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,J.jsx)(Te,{className:`h-4 w-4`}),(0,J.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:a(`demoMode.github`)})]}),(0,J.jsx)(I,{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,J.jsx)(Ce,{className:`h-4 w-4`})})]})]})})},Oa=()=>{let{preferences:e,backgroundImage:t}=Xe(),n=e.backgroundSettings||{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6},r=t||n.imageUrl;return!n.enabled||!r?null:(0,J.jsx)(`div`,{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)`}})},ka=e=>{vi(),Ye.getState().setCurrentSession(null),sessionStorage.setItem(`forceWelcomeScreen`,`true`),e(`/chat`)},Aa=e=>{Ke.getState().clearError(),e(`/work`)},ja={"/models":{icon:ye,labelKey:`sidebar.navigation.models`},"/personas":{icon:De,labelKey:`sidebar.navigation.personas`},"/gallery":{icon:k,labelKey:`sidebar.navigation.imagine`},"/agents":{icon:be,labelKey:`sidebar.navigation.agents`},"/users":{icon:we,labelKey:`tabs.users`},"/artifacts":{icon:ne,labelKey:`tabs.artifacts`}},Ma=e=>e.kind===`home`?Ee:e.kind===`chat`?A:e.kind===`work`?j:ja[e.path]?.icon??ne,Na=()=>Be()?`⌘`:`Ctrl`,Pa=()=>{let{t:e}=x(),t=v(),n=c(),r=di(e=>e.tabs),i=di(e=>e.activeTabId),a=di(e=>e.syncWithPath),o=di(e=>e.closeTab),s=Ye(e=>e.sessions),l=Ke(e=>e.tasks),{systemInfo:u,isAdmin:d}=F(),[f,p]=(0,q.useState)(!1),m=(0,q.useRef)(null),h=(0,q.useRef)(null),g=u?.requiresAuth===!1||d();(0,q.useEffect)(()=>{a(t.pathname)},[t.pathname,a]),(0,q.useEffect)(()=>{(h.current?.querySelector(`[data-active="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},[i,r.length]),(0,q.useEffect)(()=>{if(!f)return;let e=e=>{m.current?.contains(e.target)||p(!1)},t=e=>{e.key===`Escape`&&p(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[f]);let _=t=>{if(t.kind===`home`)return e(`tabs.home`,`Home`);if(t.kind===`chat`){if(t.id===`chat:new`)return e(`tabs.newChat`,`New Chat`);let n=t.id.slice(5);return s.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 l.find(e=>e.id===n)?.title||e(`tabs.work`,`Work`)}let n=ja[t.path];return n?e(n.labelKey,t.path.slice(1)):t.path.slice(1)},y=(e,t)=>{e.stopPropagation(),e.preventDefault();let r=o(t.id);r&&n(r.path)},b=[{key:`chat`,label:e(`tabs.newChat`,`New Chat`),icon:A,shortcut:`${Na()}⇧O`,action:()=>ka(n)},...g?[{key:`work`,label:e(`tabs.newWork`,`New Work`),icon:j,shortcut:`${Na()}⇧U`,action:()=>Aa(n)}]:[],...[`/models`,`/personas`,`/gallery`,`/agents`].map(t=>({key:t,label:e(ja[t].labelKey,t.slice(1)),icon:ja[t].icon,action:()=>n(t)}))];return(0,J.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,J.jsx)(`div`,{ref:h,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:r.map(t=>{let r=Ma(t),a=t.id===i;return(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":a,"data-active":a||void 0,"data-testid":`app-tab`,title:_(t),onClick:()=>n(t.path),onAuxClick:e=>{e.button===1&&t.id!==`home`&&y(e,t)},className:P(`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,J.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`}),(0,J.jsx)(`span`,{className:`max-w-[9rem] truncate`,children:_(t)}),t.id!==`home`&&(0,J.jsx)(`span`,{role:`button`,tabIndex:-1,"aria-label":e(`tabs.close`,`Close tab`),"data-testid":`app-tab-close`,onClick:e=>y(e,t),className:P(`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,J.jsx)(Ce,{className:`h-3 w-3`})})]},t.id)})}),(0,J.jsxs)(`div`,{className:`relative flex-none`,ref:m,children:[(0,J.jsx)(`button`,{type:`button`,"aria-label":e(`tabs.new`,`New tab`),"aria-expanded":f,"data-testid":`app-tab-new`,onClick:()=>p(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,J.jsx)(re,{className:`h-4 w-4`})}),f&&(0,J.jsx)(`div`,{role:`menu`,"data-testid":`app-tab-new-menu`,className:`absolute start-0 top-full z-50 mt-1 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`,children:b.map(e=>(0,J.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{p(!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,J.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-start`,children:e.label}),e.shortcut&&(0,J.jsx)(`span`,{className:`font-mono text-[10px] tracking-wide text-ink-subtle`,children:e.shortcut})]},e.key))})]})]})},Fa=({onOpenSettings:e})=>{let{t,i18n:n}=x(),r=c(),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(``),[l,u]=(0,q.useState)(0),d=(0,q.useRef)(null),f=(0,q.useRef)(null),p=Ye(e=>e.sessions),m=Ke(e=>e.tasks),h=Xe(e=>e.toggleTheme),{systemInfo:g,isAdmin:_}=F(),v=g?.requiresAuth===!1||_(),y=Be()?`⌘`:`Ctrl`;(0,q.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),s(``),u(0),a(e=>!e))},t=()=>{s(``),u(0),a(!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,q.useEffect)(()=>{if(!i)return;let e=window.requestAnimationFrame(()=>d.current?.focus());return()=>window.cancelAnimationFrame(e)},[i]);let b=(0,q.useCallback)(()=>a(!1),[]),S=(0,q.useMemo)(()=>{let i=t(`palette.actions`,`Actions`),a=[{id:`action:new-chat`,section:i,label:t(`tabs.newChat`,`New Chat`),icon:A,hint:`${y}⇧O`,run:()=>ka(r)},...v?[{id:`action:new-work`,section:i,label:t(`tabs.newWork`,`New Work`),icon:j,hint:`${y}⇧U`,run:()=>Aa(r)}]:[],{id:`action:home`,section:i,label:t(`tabs.home`,`Home`),icon:Ee,run:()=>r(`/`)},{id:`action:models`,section:i,label:t(`sidebar.navigation.models`,`Models`),icon:ye,run:()=>r(`/models`)},{id:`action:personas`,section:i,label:t(`sidebar.navigation.personas`,`Personas`),icon:De,run:()=>r(`/personas`)},{id:`action:gallery`,section:i,label:t(`sidebar.navigation.imagine`,`Imagine`),icon:k,run:()=>r(`/gallery`)},{id:`action:agents`,section:i,label:t(`sidebar.navigation.agents`,`Agents`),icon:be,run:()=>r(`/agents`)},{id:`action:settings`,section:i,label:t(`palette.settings`,`Settings`),icon:Ae,hint:`${y},`,run:e},{id:`action:theme`,section:i,label:t(`palette.toggleTheme`,`Toggle theme`),icon:ie,hint:`${y}D`,run:h}],o=[...p].sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>({id:`session:${e.id}`,section:t(`palette.chats`,`Chats`),label:e.title||t(`tabs.chat`,`Chat`),icon:A,hint:Ve(e.updatedAt,n.language),keywords:e.model,run:()=>r(`/c/${e.id}`)})),s=v?[...m].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:`work:${e.id}`,section:t(`palette.work`,`Work`),label:e.title||t(`work.tasks.untitled`,`Untitled task`),icon:j,hint:e.status,run:()=>r(`/work/${e.id}`)})):[];return[...a,...o,...s]},[t,y,r,e,h,p,m,v,n.language]),C=(0,q.useMemo)(()=>{let e=o.trim().toLowerCase();if(!e){let e=S.filter(e=>e.id.startsWith(`action:`)),t=S.filter(e=>e.id.startsWith(`session:`)).slice(0,4),n=S.filter(e=>e.id.startsWith(`work:`)).slice(0,3);return[...e,...t,...n]}return S.filter(t=>`${t.label} ${t.keywords??``}`.toLowerCase().includes(e)).slice(0,20)},[S,o]);(0,q.useEffect)(()=>{(f.current?.querySelector(`[data-selected="true"]`))?.scrollIntoView({block:`nearest`})},[l,C.length]);let w=e=>{e&&(b(),e.run())};if(!i)return null;let E=``;return(0,bi.createPortal)((0,J.jsx)(`div`,{"data-testid":`command-palette`,className:`fixed inset-0 z-[120] flex items-start justify-center bg-black/25 px-4 pt-[14vh] backdrop-blur-[2px] dark:bg-black/45`,onMouseDown:e=>{e.target===e.currentTarget&&b()},children:(0,J.jsxs)(`div`,{className:`w-full max-w-lg 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,J.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-line px-3.5`,children:[(0,J.jsx)(T,{className:`h-4 w-4 shrink-0 text-ink-subtle`}),(0,J.jsx)(`input`,{ref:d,"data-testid":`command-palette-input`,value:o,onChange:e=>{s(e.target.value),u(0)},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),b()):e.key===`ArrowDown`?(e.preventDefault(),u(e=>Math.min(C.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),u(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),w(C[l]))},placeholder:t(`palette.placeholder`,`Search chats, Work, actions…`),className:`h-11 w-full bg-transparent text-sm text-ink outline-none placeholder:text-ink-subtle`}),(0,J.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,J.jsxs)(`div`,{ref:f,className:`max-h-[19rem] overflow-y-auto p-1.5 scrollbar-thin`,children:[C.length===0&&(0,J.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-ink-subtle`,children:t(`palette.empty`,`No matches.`)}),C.map((e,t)=>{let n=e.section!==E;return E=e.section,(0,J.jsxs)(q.Fragment,{children:[n&&(0,J.jsx)(`p`,{className:`px-2.5 pb-1 pt-2 text-[10px] font-medium uppercase tracking-[0.08em] text-ink-subtle first:pt-1`,children:e.section}),(0,J.jsxs)(`button`,{type:`button`,"data-selected":t===l||void 0,onMouseEnter:()=>u(t),onClick:()=>w(e),className:P(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-start text-sm transition-colors`,t===l?`bg-black/[0.05] text-ink dark:bg-white/[0.07]`:`text-ink-muted`),children:[(0,J.jsx)(e.icon,{className:`h-4 w-4 shrink-0 text-ink-subtle`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.hint&&(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-ink-subtle`,children:e.hint})]})]},e.id)})]})]})}),document.body)},Ia=N(`user-service`),La=class{static async initializeAuth(){let{setLoading:e,setSystemInfo:t,login:n}=F.getState();try{e(!0),Ia.debug(`Starting auth initialization...`),Ia.debug(`Fetching system info...`);let r=await Le.getSystemInfo();Ia.debug(`System info response:`,r),r.success&&r.data?(Ia.debug(`Setting system info:`,r.data),t(r.data)):Ia.error(`System info response failed:`,r);let i=localStorage.getItem(`auth-token`);if(i)try{let e=(await d(async()=>{let{default:e}=await import(`../js/utils-vendor-Cbaj0BC5.js`).then(e=>e.i);return{default:e}},__vite__mapDeps([5,1,2]))).default,t=e.defaults.headers.common;e.defaults.headers.common.Authorization=`Bearer ${i}`;let r=await Le.verifyToken();if(r.success&&r.data){let e=F.getState().systemInfo;e&&n(r.data,i,e)}e.defaults.headers.common=t}catch(e){Ia.error(`Token verification failed:`,e),localStorage.removeItem(`auth-token`)}}catch(e){Ia.error(`Auth initialization error:`,e)}finally{e(!1)}}};Me.interceptors.request.use(e=>{let t=localStorage.getItem(`auth-token`);return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e)),Me.interceptors.response.use(e=>e,e=>{if(e.response?.status===401){localStorage.removeItem(`auth-token`);let{logout:e}=F.getState();e();let t=window.location.protocol===`file:`;window.location.href=t?`#/login`:`/login`}return Promise.reject(e)});var Ra=N(`initialize`),za=()=>{let e=(0,q.useRef)(!1),t=(0,q.useRef)(!1),{loadSessions:n,loadModels:r,loadPreferences:i,setSelectedModel:a,models:o}=Ye(),{loadPreferences:s}=Xe(),{loadPlugins:c,plugins:l}=We();(0,q.useEffect)(()=>{e.current||t.current||(async()=>{t.current=!0;try{Ra.debug(`Initializing Libre WebUI...`),await La.initializeAuth();try{!(await ze.checkHealth()).success&&!Fe()&&M.error(`Ollama service is not available. Plugin models may still be used.`)}catch(e){Ra.warn(`Ollama health check failed; continuing provider initialization:`,e),Fe()||M.error(`Ollama service is not available. Plugin models may still be used.`)}await Promise.all([s(),i()]),await Promise.all([r(),n(),c()]),e.current=!0,Ra.debug(`Libre WebUI initialized successfully`)}catch(t){Fe()?(await Promise.all([s(),i()]),await Promise.all([r(),n(),c()]),e.current=!0):(Ra.error(`Failed to initialize app:`,t),M.error(`Failed to connect to the backend service`))}finally{t.current=!1}})()},[s,i,r,n,c]),(0,q.useEffect)(()=>{if(o.length>0){let e=o.filter(e=>!e.name.includes(`embed`))[0]||o[0],{selectedModel:t,selectedProviderType:n,selectedProviderId:r}=Ye.getState();if(t){if(!Ge(o,{model:t,providerType:n,providerId:r})&&n!==`ollama`&&n!==`plugin`){let t=qe(e);Ra.debug(`Legacy selected model not available, falling back to:`,t.model),a(t.model,t.providerType,t.providerId)}}else{let t=qe(e);Ra.debug(`No model selected, using first available:`,t.model),a(t.model,t.providerType,t.providerId)}}},[o,a]),(0,q.useEffect)(()=>{e.current&&(Ra.debug(`Plugin availability changed, reloading models...`),r())},[l,r])},Ba=N(`components:git-hub-auth-button`),Va=()=>{let{t:e}=x(),[t,n]=(0,q.useState)(!1),[r,i]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Re}/auth/oauth/github/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Ba.debug(`GitHub OAuth configured:`,t.configured)}else Ba.debug(`GitHub OAuth status check failed`),i(!1)}catch(e){Ba.debug(`GitHub OAuth not configured:`,e),i(!1)}})()},[]),r?(0,J.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Re}/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,J.jsxs)(`div`,{className:`flex items-center`,children:[(0,J.jsx)(O,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.github`)})]}):(0,J.jsxs)(`div`,{className:`flex items-center`,children:[(0,J.jsx)(Oe,{size:16,className:`me-2`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.github`)})]})}):null},Ha=N(`components:hugging-face-auth-button`),Ua=()=>{let{t:e}=x(),[t,n]=(0,q.useState)(!1),[r,i]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Re}/auth/oauth/huggingface/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Ha.debug(`Hugging Face OAuth configured:`,t.configured)}else Ha.debug(`Hugging Face OAuth status check failed`),i(!1)}catch(e){Ha.debug(`Hugging Face OAuth not configured:`,e),i(!1)}})()},[]),r?(0,J.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Re}/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,J.jsxs)(`div`,{className:`flex items-center`,children:[(0,J.jsx)(O,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.huggingFace`)})]}):(0,J.jsxs)(`div`,{className:`flex items-center`,children:[(0,J.jsx)(`span`,{className:`me-2 text-base`,children:`🤗`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.huggingFace`)})]})}):null},Wa=N(`hooks:oauth-providers`),Ga=async e=>{try{let t=await fetch(`${Re}/auth/oauth/${e}/status`,{method:`GET`,credentials:`include`});return t.ok?!!(await t.json()).configured:!1}catch(t){return Wa.debug(`${e} OAuth not configured:`,t),!1}},Ka=()=>{let[e,t]=(0,q.useState)({github:!1,huggingface:!1});return(0,q.useEffect)(()=>{let e=!0;return Promise.all([Ga(`github`),Ga(`huggingface`)]).then(([n,r])=>{e&&t({github:n,huggingface:r})}),()=>{e=!1}},[]),{...e,hasAny:e.github||e.huggingface}},qa=N(`components:login-form`),Ja={username:`demo`,password:`demo`},Ya=({onLogin:e,onShowSignup:t,bare:n=!1})=>{let{t:r}=x(),i=Fe(),a=Ka(),[o,s]=(0,q.useState)(i?Ja.username:``),[l,u]=(0,q.useState)(i?Ja.password:``),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(!1),h=c(),{login:g}=F(),_=async t=>{t.preventDefault();let n=i?Ja.username:o.trim(),a=i?Ja.password:l.trim();if(!n||!a){S.error(r(`auth.login.enterBoth`));return}m(!0);try{localStorage.removeItem(`auth-token`);let t=await Le.login({username:n,password:a});t.success&&t.data?(g(t.data.user,t.data.token,t.data.systemInfo),S.success(r(`auth.login.loginSuccess`)),e?.(),h(`/`)):S.error(t.message||r(`auth.login.loginFailed`))}catch(e){qa.error(`Login error:`,e),S.error(r(`auth.login.checkCredentials`))}finally{m(!1)}},v=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return(0,J.jsxs)(`div`,{className:P(`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,J.jsxs)(`div`,{className:P(`mb-8`,n?`text-start`:`text-center`),children:[(0,J.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:r(`auth.login.title`)}),(0,J.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:r(`auth.login.subtitle`)})]}),(0,J.jsxs)(`form`,{onSubmit:_,className:`space-y-5`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.login.username`)}),(0,J.jsx)(`input`,{id:`username`,type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:v,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:r(`auth.login.usernamePlaceholder`),required:!0,disabled:p||i})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.login.password`)}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`input`,{id:`password`,type:d?`text`:`password`,value:l,onChange:e=>u(e.target.value),onKeyDown:v,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:r(`auth.login.passwordPlaceholder`),required:!0,disabled:p||i}),(0,J.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||i,"aria-label":d?`Hide characters`:`Reveal characters`,children:d?(0,J.jsx)(_e,{size:20}):(0,J.jsx)(ve,{size:20})})]})]}),(0,J.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,J.jsxs)(`div`,{className:`flex items-center`,children:[(0,J.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),r(`auth.login.signingIn`)]}):(0,J.jsxs)(`div`,{className:`flex items-center`,children:[(0,J.jsx)(le,{size:16,className:`me-2`}),r(`auth.login.signIn`)]})})]}),!i&&(0,J.jsxs)(J.Fragment,{children:[a.hasAny&&(0,J.jsxs)(`div`,{className:`mt-6`,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,J.jsx)(`div`,{className:`w-full border-t border-line`})}),(0,J.jsx)(`div`,{className:`relative flex justify-center text-sm`,children:(0,J.jsx)(`span`,{className:P(`px-2 text-ink-muted`,n?`bg-canvas`:`bg-surface-raised`),children:r(`common.or`)})})]}),(0,J.jsxs)(`div`,{className:`mt-6 space-y-3`,children:[a.github&&(0,J.jsx)(Va,{}),a.huggingface&&(0,J.jsx)(Ua,{})]})]}),(0,J.jsx)(`div`,{className:`mt-6 text-center`,children:(0,J.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[r(`auth.login.noAccount`),` `,(0,J.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.login.signUpHere`)})]})})]})]})},Xa=N(`components:turnstile-widget`),Za=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,Qa=null,$a=()=>window.turnstile?Promise.resolve():Qa||(Qa=new Promise((e,t)=>{let n=document.querySelector(`script[src="${Za}"]`);if(n){n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,t,{once:!0});return}let r=document.createElement(`script`);r.src=Za,r.async=!0,r.defer=!0,r.onload=()=>e(),r.onerror=t,document.head.appendChild(r)}),Qa),eo=({siteKey:e,disabled:t=!1,errorMessage:n,onTokenChange:r})=>{let i=(0,q.useRef)(null),a=(0,q.useRef)(null),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{let t=!1,n=i.current;return r(``),$a().then(()=>{t||!n||!window.turnstile||(n.innerHTML=``,a.current=window.turnstile.render(n,{sitekey:e,theme:`auto`,callback:e=>r(e),"expired-callback":()=>r(``),"error-callback":()=>r(``)}))}).catch(e=>{Xa.error(`Turnstile script failed to load:`,e),t||s(!0)}),()=>{t=!0,r(``),a.current&&window.turnstile?.remove?window.turnstile.remove(a.current):n&&(n.innerHTML=``),a.current=null}},[r,e]),(0,q.useEffect)(()=>{t&&a.current&&(window.turnstile?.reset(a.current),r(``))},[t,r]),o?(0,J.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300`,children:n}):(0,J.jsx)(`div`,{className:`rounded-lg border border-accent-200 bg-accent-50/40 p-3 transition-opacity dark:border-accent-800/70 dark:bg-accent-950/20 ${t?`pointer-events-none opacity-60`:``}`,"aria-label":`Security verification`,children:(0,J.jsx)(`div`,{ref:i,className:`min-h-[65px]`})})},to=N(`components:signup-form`),no=({onSignup:e,onBackToLogin:t,bare:n=!1})=>{let{t:r}=x(),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(``),[l,u]=(0,q.useState)(``),[d,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(``),C=c(),{login:w,systemInfo:T}=F(),E=T?.turnstile?.siteKey,D=!!(T?.turnstile?.enabled&&E),ee=(0,q.useCallback)(e=>{b(e)},[]),te=(0,q.useMemo)(()=>_||D&&!y,[_,D,y]),O=async t=>{if(t.preventDefault(),!i.trim()||!l.trim()){S.error(r(`auth.signup.usernameRequired`));return}if(l!==d){S.error(r(`auth.signup.passwordMismatch`));return}if(l.length<6){S.error(r(`auth.signup.passwordTooShort`));return}if(D&&!y){S.error(r(`auth.signup.tryAgain`));return}v(!0);try{let t=await Le.signup({username:i,password:l,email:o,turnstileToken:y});t.success&&t.data?(w(t.data.user,t.data.token,t.data.systemInfo),S.success(r(`auth.signup.signupSuccess`)),e?.(),C(`/`)):S.error(t.message||r(`auth.signup.signupFailed`))}catch(e){to.error(`Signup error:`,e),S.error(r(`auth.signup.tryAgain`))}finally{b(``),v(!1)}},k=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return(0,J.jsxs)(`div`,{className:P(`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,J.jsxs)(`div`,{className:P(`mb-8`,n?`text-start`:`text-center`),children:[(0,J.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:r(`auth.signup.title`)}),(0,J.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:r(`auth.signup.subtitle`)})]}),(0,J.jsxs)(`form`,{onSubmit:O,className:`space-y-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.username`)}),(0,J.jsx)(`input`,{id:`username`,type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:k,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:_})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`label`,{htmlFor:`email`,className:`mb-2 block text-sm font-medium text-ink`,children:[r(`auth.signup.email`),` `,(0,J.jsxs)(`span`,{className:`text-ink-muted`,children:[`(`,r(`common.optional`),`)`]})]}),(0,J.jsx)(`input`,{id:`email`,type:`email`,value:o,onChange:e=>s(e.target.value),onKeyDown:k,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:_})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.password`)}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`input`,{id:`password`,type:p?`text`:`password`,value:l,onChange:e=>u(e.target.value),onKeyDown:k,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:_}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>m(!p),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:_,"aria-label":p?`Hide characters`:`Reveal characters`,children:p?(0,J.jsx)(_e,{size:20}):(0,J.jsx)(ve,{size:20})})]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{htmlFor:`confirmPassword`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.confirmPassword`)}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`input`,{id:`confirmPassword`,type:h?`text`:`password`,value:d,onChange:e=>f(e.target.value),onKeyDown:k,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:_}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>g(!h),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:_,"aria-label":h?`Hide confirmation`:`Reveal confirmation`,children:h?(0,J.jsx)(_e,{size:20}):(0,J.jsx)(ve,{size:20})})]})]}),D&&E&&(0,J.jsx)(eo,{siteKey:E,disabled:_,errorMessage:r(`auth.signup.tryAgain`),onTokenChange:ee}),(0,J.jsx)(`button`,{type:`submit`,disabled:te,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:_?(0,J.jsxs)(`div`,{className:`flex items-center`,children:[(0,J.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),r(`auth.signup.creatingAccount`)]}):(0,J.jsxs)(`div`,{className:`flex items-center`,children:[(0,J.jsx)(he,{size:16,className:`me-2`}),r(`auth.signup.createAccount`)]})})]}),(0,J.jsx)(Va,{}),(0,J.jsx)(`div`,{className:`mt-6 text-center`,children:(0,J.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[r(`auth.signup.hasAccount`),` `,(0,J.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`)})]})})]})},ro=`0.17.0`,io=()=>{let{t:e}=x(),t=c(),{isAuthenticated:n,requiresAuth:r,systemInfo:i}=F(),[a,o]=(0,q.useState)(!1),s=r();if((0,q.useEffect)(()=>{(n||!s)&&t(`/`)},[s,n,t]),n||!s)return null;let l=[{icon:ke,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:C,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:de,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.`)}],u=i?.version||ro;return(0,J.jsxs)(`div`,{className:`relative min-h-screen overflow-y-auto bg-canvas text-ink`,children:[(0,J.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,J.jsx)(oa,{size:`sm`,className:`text-ink lg:invisible`}),(0,J.jsx)(sa,{})]}),(0,J.jsxs)(`main`,{className:`grid min-h-screen lg:grid-cols-2`,children:[(0,J.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,J.jsx)(oa,{size:`lg`,className:`relative z-10 text-ink`}),(0,J.jsxs)(`div`,{className:`relative z-10 max-w-lg`,children:[(0,J.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,J.jsx)(`ul`,{className:`mt-10 space-y-5`,children:l.map(e=>(0,J.jsxs)(`li`,{className:`flex gap-3`,children:[(0,J.jsx)(e.icon,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-ink-subtle`}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-ink`,children:e.title}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-relaxed text-ink-muted`,children:e.body})]})]},e.title))})]}),(0,J.jsxs)(`p`,{className:`relative z-10 font-mono text-[11px] text-ink-subtle`,children:[u?`v${u}`:``,u?` · `:``,e(`auth.selfHosted`,`Self-hosted · Apache 2.0`)]})]}),(0,J.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,J.jsx)(`div`,{className:`w-full max-w-sm`,children:a?(0,J.jsx)(no,{bare:!0,onBackToLogin:()=>o(!1),onSignup:()=>o(!1)}):(0,J.jsx)(Ya,{bare:!0,onShowSignup:()=>o(!0)})})})]})]})},ao=window.location.protocol===`file:`,oo=()=>ao?(0,J.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-8 z-50`,style:{WebkitAppRegion:`drag`}}):null,so=N(`app`),co=q.lazy(()=>d(()=>import(`../js/HomePage-CeCYnMUG.js`),__vite__mapDeps([19,1,2,3,14,15,4,5,17,7,8,16,6,20]))),lo=q.lazy(()=>d(()=>import(`../js/ChatPage-CYT69oBR.js`),__vite__mapDeps([21,1,2,22,3,14,15,7,8,16,5,4,17,6,18,23,24,25,26,27,12,13]))),uo=q.lazy(()=>d(()=>import(`../js/ModelsPage-D-FIy2x-.js`),__vite__mapDeps([28,1,2,3,12,13,14,15,8,7,16,5,4,17,6,18]))),fo=q.lazy(()=>d(()=>import(`../js/PersonasPage-CIrEVFo5.js`),__vite__mapDeps([29,1,2,12,13,3,14,15,8,7,16,5,4,6,18]))),po=q.lazy(()=>d(()=>import(`../js/GalleryPage-Bm89pnS8.js`),__vite__mapDeps([30,1,2,22,13,3,14,15,8,7,16,5,4,6,18]))),mo=q.lazy(()=>d(()=>import(`../js/LibreClawPage-DGMEV6dm.js`),__vite__mapDeps([31,1,2,14,15,8,7,16,3,5,4,18]))),ho=q.lazy(()=>d(()=>import(`../js/WorkPage-C7bW6Hxx.js`),__vite__mapDeps([32,1,2,3,14,15,16,5,7,8,4,17,6,18,0,9,10,27,22,12,13,20]))),go=q.lazy(()=>d(()=>import(`../js/UserManagementPage-BfyYGGFQ.js`),__vite__mapDeps([33,1,2,12,13,3,14,15,8,7,16,5,17,4,6,18]))),_o=q.lazy(()=>d(()=>import(`../js/ArtifactDemoPage-B4qsvUnF.js`),__vite__mapDeps([34,1,2,18,4,5,24,14,15,8,7,6,3,25,26,23]))),vo=q.lazy(()=>d(()=>import(`../js/SettingsModal-CxtOXPY7.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([11,1,2,12,13,3,14,15,8,7,16,5,4,17,6,18]))),yo=q.lazy(()=>d(()=>import(`../js/ArtifactSlideOutPanel-CmKgQ4eD.js`).then(e=>({default:e.ArtifactSlideOutPanel})),__vite__mapDeps([35,1,2,22,14,15,8,7,4,5,6,3,18,25,26,23]))),bo=q.lazy(()=>d(()=>import(`../js/FirstTimeSetup-C8LdLP5J.js`).then(e=>({default:e.FirstTimeSetup})),__vite__mapDeps([36,1,2,14,15,8,7,16,3,5,17,4,6]))),xo=()=>{let{t:e}=x();return(0,J.jsx)(`div`,{className:`flex h-full min-h-screen items-center justify-center bg-gray-50 dark:bg-dark-100`,children:(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,J.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,J.jsx)(`div`,{className:`text-gray-600 dark:text-dark-600`,children:e(`common.loading`)})]})})},So=({isOpen:e,compact:t})=>(0,J.jsx)(`div`,{"aria-hidden":`true`,className:P(`hidden lg:block flex-shrink-0 transition-[width] duration-200 ease-out`,e?t?`w-18`:`w-72`:`w-0`)}),Co=({hasBackground:e,sidebarOpen:t,sidebarCompact:n,onCloseSidebar:r,showDemoBanner:i,demoMessage:a,children:o})=>(0,J.jsxs)(`div`,{className:P(`flex h-dvh min-h-0 text-gray-950 dark:text-dark-900 relative overflow-hidden`,e?`bg-gray-100/60 dark:bg-dark-50/60`:`bg-gray-100 dark:bg-dark-50`),children:[(0,J.jsx)(oo,{}),(0,J.jsx)(Oa,{}),(0,J.jsx)(va,{isOpen:t,onClose:r}),(0,J.jsx)(So,{isOpen:t,compact:n}),(0,J.jsxs)(`div`,{"data-testid":`app-shell-content`,className:P(`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`,ao?`pt-8`:`lg:pt-1.5`,t&&n?`max-lg:ms-18`:`max-lg:ms-0`,e?`bg-white/10 dark:bg-dark-50/10`:`bg-transparent`),children:[i&&(0,J.jsx)(Da,{message:a}),(0,J.jsx)(Pa,{}),(0,J.jsx)(`main`,{className:P(`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-100/35 backdrop-blur-sm`:`bg-gray-50 dark:bg-dark-100`),children:(0,J.jsx)(Sa,{children:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(xo,{}),children:o})})})]})]}),wo=({onClick:e})=>{let t=v();return t.pathname===`/chat`||t.pathname.startsWith(`/c/`)?(0,J.jsx)(`div`,{className:`hidden lg:block`,children:(0,J.jsx)(Ea,{onClick:e})}):null},To=()=>{let{t:e,i18n:t}=x(),n=c(),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1),[l,u]=(0,q.useState)(0),[d,f]=(0,q.useState)(!1),{sidebarOpen:p,sidebarCompact:h,setSidebarOpen:g,setSidebarCompact:_,toggleSidebar:v,toggleSidebarCompact:y,toggleTheme:b,backgroundImage:S,preferences:C,artifactPanelOpen:w}=Xe(),{systemInfo:T,isLoading:E,user:D,isAuthenticated:ee}=F(),{isDemoMode:te,demoConfig:O}=Xe(),[k,A]=q.useState(!1),ne=q.useRef(!1);q.useEffect(()=>{(async()=>{if(ne.current){so.debug(`OAuth already processing, skipping...`);return}so.debug(`Starting OAuth callback processing...`),ne.current=!0;let e=new URLSearchParams(window.location.search),t=e.get(`token`),n=e.get(`auth`);if(t&&n===`success`){try{let e=await fetch(`${Re}/auth/me`,{headers:{Authorization:`Bearer ${t}`},credentials:`include`});if(e.ok){let n=await e.json();if(n.success&&n.data){let{login:e,systemInfo:r}=F.getState();e(n.data,t,r||{requiresAuth:!0,hasUsers:!0,userCount:1,version:`0.1.6`}),so.debug(`OAuth login successful, showing toast`),M.success(`GitHub login successful!`)}else M.error(`Failed to verify GitHub authentication`)}else M.error(`GitHub authentication verification failed`)}catch(e){so.error(`OAuth processing error:`,e),M.error(`GitHub authentication failed`)}window.history.replaceState({},document.title,window.location.pathname)}so.debug(`OAuth processing completed`),A(!0),ne.current=!1})()},[]),za();let re=()=>{if(S)return!0;let e=C.backgroundSettings;return e?.enabled&&e?.imageUrl},j=[{key:`b`,metaKey:!0,action:()=>{window.innerWidth>=1024?p?y():(_(!1),v()):(!p&&h&&_(!1),v())},description:e(`keyboard.toggleSidebar`)},{key:`,`,metaKey:!0,action:()=>i(!0),description:e(`keyboard.openSettings`)},{key:`o`,metaKey:!0,shiftKey:!0,action:()=>ka(n),description:e(`keyboard.newChat`,`New chat`)},{key:`u`,metaKey:!0,shiftKey:!0,action:()=>{let{systemInfo:e,isAdmin:t}=F.getState();(e?.requiresAuth===!1||t())&&Aa(n)},description:e(`keyboard.newWork`,`New Work session`)},{key:`d`,metaKey:!0,action:b,description:e(`keyboard.toggleDarkMode`)},{key:`h`,action:()=>o(!0),description:e(`keyboard.showShortcuts`)},{key:`Escape`,action:()=>{i(!1),o(!1)},description:e(`keyboard.closeModals`)}];Ca(j),q.useEffect(()=>(Je.connect().catch(so.error),()=>{Je.disconnect()}),[]),q.useEffect(()=>{if(!T&&!E&&l<15){let e=setTimeout(async()=>{u(e=>e+1);try{await La.initializeAuth()}catch{}},2e3);return()=>clearTimeout(e)}},[T,E,l]);let ie=!d&&T?.requiresAuth===!0&&T?.hasUsers===!1;return E?(0,J.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,J.jsx)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:(0,J.jsx)(`div`,{className:`flex flex-col items-center`,children:(0,J.jsx)(oa,{className:`text-gray-900 dark:text-gray-100`})})}),(0,J.jsx)(`div`,{className:`mt-8 flex flex-col items-center gap-4`,children:(0,J.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`})})]}):T?ie&&!d?(0,J.jsx)(Sa,{children:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(xo,{}),children:(0,J.jsx)(bo,{onComplete:()=>{f(!0)}})})}):k?(0,J.jsxs)(J.Fragment,{children:[T&&!T.requiresAuth?(0,J.jsx)(Co,{hasBackground:!!re(),sidebarOpen:p,sidebarCompact:h,onCloseSidebar:()=>g(!1),showDemoBanner:te&&O.showBanner,demoMessage:O.message,children:(0,J.jsxs)(s,{children:[(0,J.jsx)(m,{path:`/`,element:(0,J.jsx)(co,{})}),(0,J.jsx)(m,{path:`/chat`,element:(0,J.jsx)(lo,{})}),(0,J.jsx)(m,{path:`/c/:sessionId`,element:(0,J.jsx)(lo,{})}),(0,J.jsx)(m,{path:`/models`,element:(0,J.jsx)(uo,{})}),(0,J.jsx)(m,{path:`/personas`,element:(0,J.jsx)(fo,{})}),(0,J.jsx)(m,{path:`/gallery`,element:(0,J.jsx)(po,{})}),(0,J.jsx)(m,{path:`/work`,element:(0,J.jsx)(ya,{requireAdmin:!0,children:(0,J.jsx)(ho,{})})}),(0,J.jsx)(m,{path:`/work/:taskId`,element:(0,J.jsx)(ya,{requireAdmin:!0,children:(0,J.jsx)(ho,{})})}),(0,J.jsx)(m,{path:`/agents`,element:(0,J.jsx)(mo,{})}),(0,J.jsx)(m,{path:`/login`,element:(0,J.jsx)(io,{})})]})}):(0,J.jsxs)(s,{children:[(0,J.jsx)(m,{path:`/login`,element:(0,J.jsx)(io,{})}),(0,J.jsx)(m,{path:`/*`,element:(0,J.jsx)(ya,{children:(0,J.jsx)(Co,{hasBackground:!!re(),sidebarOpen:p,sidebarCompact:h,onCloseSidebar:()=>g(!1),showDemoBanner:te&&O.showBanner,demoMessage:O.message,children:(0,J.jsxs)(s,{children:[(0,J.jsx)(m,{path:`/`,element:(0,J.jsx)(co,{})}),(0,J.jsx)(m,{path:`/chat`,element:(0,J.jsx)(lo,{})}),(0,J.jsx)(m,{path:`/c/:sessionId`,element:(0,J.jsx)(lo,{})}),(0,J.jsx)(m,{path:`/models`,element:(0,J.jsx)(uo,{})}),(0,J.jsx)(m,{path:`/personas`,element:(0,J.jsx)(fo,{})}),(0,J.jsx)(m,{path:`/gallery`,element:(0,J.jsx)(po,{})}),(0,J.jsx)(m,{path:`/work`,element:(0,J.jsx)(ya,{requireAdmin:!0,children:(0,J.jsx)(ho,{})})}),(0,J.jsx)(m,{path:`/work/:taskId`,element:(0,J.jsx)(ya,{requireAdmin:!0,children:(0,J.jsx)(ho,{})})}),(0,J.jsx)(m,{path:`/agents`,element:(0,J.jsx)(mo,{})}),(0,J.jsx)(m,{path:`/artifacts`,element:(0,J.jsx)(_o,{})}),(0,J.jsx)(m,{path:`/users`,element:(0,J.jsx)(ya,{requireAdmin:!0,children:(0,J.jsx)(go,{})})})]})})})})]}),r&&(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(vo,{isOpen:r,onClose:()=>i(!1)})}),(0,J.jsx)(Ta,{isOpen:a,onClose:()=>o(!1),shortcuts:j}),(0,J.jsx)(wo,{onClick:()=>o(!0)}),w&&(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(yo,{})}),(0,J.jsx)(ae,{position:ri(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}}),(0,J.jsx)(Fa,{onOpenSettings:()=>i(!0)})]}):(0,J.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center`,children:(0,J.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,J.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4`,children:(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsx)(`div`,{className:`mb-8`,children:(0,J.jsx)(oa,{className:`text-gray-900 dark:text-white`})}),(0,J.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,J.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,J.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 text-sm`,children:l>0?`Connecting to backend... (${l}/15)`:`Starting up...`})]})})},Eo=ao?h([{path:`*`,element:(0,J.jsx)(To,{})}]):p([{path:`*`,element:(0,J.jsx)(To,{})}]),Do=()=>(0,J.jsx)(Sa,{children:(0,J.jsx)(g,{router:Eo})}),Oo=new kn({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});si.catch(()=>{ii(`en`)}).then(()=>{Nn.createRoot(document.getElementById(`root`)).render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(Mn,{client:Oo,children:(0,J.jsx)(Do,{})})}))});export{ri as A,R as B,Ci as C,yi as D,pi as E,cn as F,L as G,Ot as H,Zt as I,ot as J,bt as K,Yt as L,Qr as M,or as N,_i as O,jn as P,et as Q,Xt as R,Pi as S,xi as T,Dt as U,Mt as V,it as W,Tt as X,ht as Y,at as Z,Li as _,oa as a,Bi as b,ea as c,Zi as d,Yi as f,Ui as g,Ki as h,ma as i,ni as j,oi as k,Ji as l,qi as m,ka as n,ra as o,Xi as p,st as q,Aa as r,ta as s,eo as t,Qi as u,Ri as v,Si as w,Ii as x,zi as y,zt as z};