libre-webui 0.21.3 → 0.22.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 (945) hide show
  1. package/README.md +308 -328
  2. package/backend/dist/cli/migrateSqliteToPostgres.d.ts +2 -0
  3. package/backend/dist/cli/migrateSqliteToPostgres.d.ts.map +1 -0
  4. package/backend/dist/cli/migrateSqliteToPostgres.js +113 -0
  5. package/backend/dist/cli/migrateSqliteToPostgres.js.map +1 -0
  6. package/backend/dist/cli/recoveryBackup.d.ts +3 -0
  7. package/backend/dist/cli/recoveryBackup.d.ts.map +1 -0
  8. package/backend/dist/cli/recoveryBackup.js +251 -0
  9. package/backend/dist/cli/recoveryBackup.js.map +1 -0
  10. package/backend/dist/cli/recoveryInventory.d.ts +2 -0
  11. package/backend/dist/cli/recoveryInventory.d.ts.map +1 -0
  12. package/backend/dist/cli/recoveryInventory.js +109 -0
  13. package/backend/dist/cli/recoveryInventory.js.map +1 -0
  14. package/backend/dist/db.d.ts +27 -0
  15. package/backend/dist/db.d.ts.map +1 -1
  16. package/backend/dist/db.js +333 -16
  17. package/backend/dist/db.js.map +1 -1
  18. package/backend/dist/env.d.ts.map +1 -1
  19. package/backend/dist/env.js +12 -2
  20. package/backend/dist/env.js.map +1 -1
  21. package/backend/dist/index.d.ts.map +1 -1
  22. package/backend/dist/index.js +235 -47
  23. package/backend/dist/index.js.map +1 -1
  24. package/backend/dist/main.d.ts +2 -0
  25. package/backend/dist/main.d.ts.map +1 -0
  26. package/backend/dist/main.js +137 -0
  27. package/backend/dist/main.js.map +1 -0
  28. package/backend/dist/middleware/auth.d.ts.map +1 -1
  29. package/backend/dist/middleware/auth.js +7 -3
  30. package/backend/dist/middleware/auth.js.map +1 -1
  31. package/backend/dist/middleware/chatCancellationAdmission.d.ts +7 -0
  32. package/backend/dist/middleware/chatCancellationAdmission.d.ts.map +1 -0
  33. package/backend/dist/middleware/chatCancellationAdmission.js +17 -0
  34. package/backend/dist/middleware/chatCancellationAdmission.js.map +1 -0
  35. package/backend/dist/middleware/coordinatedRateLimit.d.ts +18 -0
  36. package/backend/dist/middleware/coordinatedRateLimit.d.ts.map +1 -0
  37. package/backend/dist/middleware/coordinatedRateLimit.js +52 -0
  38. package/backend/dist/middleware/coordinatedRateLimit.js.map +1 -0
  39. package/backend/dist/middleware/sharedRateLimit.d.ts +26 -0
  40. package/backend/dist/middleware/sharedRateLimit.d.ts.map +1 -0
  41. package/backend/dist/middleware/sharedRateLimit.js +99 -0
  42. package/backend/dist/middleware/sharedRateLimit.js.map +1 -0
  43. package/backend/dist/models/personaModel.d.ts +1 -26
  44. package/backend/dist/models/personaModel.d.ts.map +1 -1
  45. package/backend/dist/models/personaModel.js +54 -247
  46. package/backend/dist/models/personaModel.js.map +1 -1
  47. package/backend/dist/models/userModel.d.ts +23 -66
  48. package/backend/dist/models/userModel.d.ts.map +1 -1
  49. package/backend/dist/models/userModel.js +110 -187
  50. package/backend/dist/models/userModel.js.map +1 -1
  51. package/backend/dist/persistence/chatGenerationTypes.d.ts +24 -0
  52. package/backend/dist/persistence/chatGenerationTypes.d.ts.map +1 -0
  53. package/backend/dist/persistence/chatGenerationTypes.js +7 -0
  54. package/backend/dist/persistence/chatGenerationTypes.js.map +1 -0
  55. package/backend/dist/persistence/extensionTypes.d.ts +185 -0
  56. package/backend/dist/persistence/extensionTypes.d.ts.map +1 -0
  57. package/backend/dist/persistence/extensionTypes.js +13 -0
  58. package/backend/dist/persistence/extensionTypes.js.map +1 -0
  59. package/backend/dist/persistence/identityDeletionTypes.d.ts +16 -0
  60. package/backend/dist/persistence/identityDeletionTypes.d.ts.map +1 -0
  61. package/backend/dist/persistence/identityDeletionTypes.js +7 -0
  62. package/backend/dist/persistence/identityDeletionTypes.js.map +1 -0
  63. package/backend/dist/persistence/index.d.ts +48 -0
  64. package/backend/dist/persistence/index.d.ts.map +1 -0
  65. package/backend/dist/persistence/index.js +159 -0
  66. package/backend/dist/persistence/index.js.map +1 -0
  67. package/backend/dist/persistence/postgresConfig.d.ts +32 -0
  68. package/backend/dist/persistence/postgresConfig.d.ts.map +1 -0
  69. package/backend/dist/persistence/postgresConfig.js +91 -0
  70. package/backend/dist/persistence/postgresConfig.js.map +1 -0
  71. package/backend/dist/persistence/postgresCoreMigration.d.ts +8 -0
  72. package/backend/dist/persistence/postgresCoreMigration.d.ts.map +1 -0
  73. package/backend/dist/persistence/postgresCoreMigration.js +179 -0
  74. package/backend/dist/persistence/postgresCoreMigration.js.map +1 -0
  75. package/backend/dist/persistence/postgresDatabase.d.ts +40 -0
  76. package/backend/dist/persistence/postgresDatabase.d.ts.map +1 -0
  77. package/backend/dist/persistence/postgresDatabase.js +148 -0
  78. package/backend/dist/persistence/postgresDatabase.js.map +1 -0
  79. package/backend/dist/persistence/postgresExtensionMigration.d.ts +4 -0
  80. package/backend/dist/persistence/postgresExtensionMigration.d.ts.map +1 -0
  81. package/backend/dist/persistence/postgresExtensionMigration.js +143 -0
  82. package/backend/dist/persistence/postgresExtensionMigration.js.map +1 -0
  83. package/backend/dist/persistence/postgresExtensionRepositories.d.ts +6 -0
  84. package/backend/dist/persistence/postgresExtensionRepositories.d.ts.map +1 -0
  85. package/backend/dist/persistence/postgresExtensionRepositories.js +550 -0
  86. package/backend/dist/persistence/postgresExtensionRepositories.js.map +1 -0
  87. package/backend/dist/persistence/postgresImportState.d.ts +9 -0
  88. package/backend/dist/persistence/postgresImportState.d.ts.map +1 -0
  89. package/backend/dist/persistence/postgresImportState.js +64 -0
  90. package/backend/dist/persistence/postgresImportState.js.map +1 -0
  91. package/backend/dist/persistence/postgresMigrationRegistry.d.ts +4 -0
  92. package/backend/dist/persistence/postgresMigrationRegistry.d.ts.map +1 -0
  93. package/backend/dist/persistence/postgresMigrationRegistry.js +33 -0
  94. package/backend/dist/persistence/postgresMigrationRegistry.js.map +1 -0
  95. package/backend/dist/persistence/postgresMigrationTypes.d.ts +24 -0
  96. package/backend/dist/persistence/postgresMigrationTypes.d.ts.map +1 -0
  97. package/backend/dist/persistence/postgresMigrationTypes.js +7 -0
  98. package/backend/dist/persistence/postgresMigrationTypes.js.map +1 -0
  99. package/backend/dist/persistence/postgresMigrations.d.ts +15 -0
  100. package/backend/dist/persistence/postgresMigrations.d.ts.map +1 -0
  101. package/backend/dist/persistence/postgresMigrations.js +333 -0
  102. package/backend/dist/persistence/postgresMigrations.js.map +1 -0
  103. package/backend/dist/persistence/postgresPersistence.d.ts +17 -0
  104. package/backend/dist/persistence/postgresPersistence.d.ts.map +1 -0
  105. package/backend/dist/persistence/postgresPersistence.js +332 -0
  106. package/backend/dist/persistence/postgresPersistence.js.map +1 -0
  107. package/backend/dist/persistence/postgresPluginDefinitionMigration.d.ts +4 -0
  108. package/backend/dist/persistence/postgresPluginDefinitionMigration.d.ts.map +1 -0
  109. package/backend/dist/persistence/postgresPluginDefinitionMigration.js +40 -0
  110. package/backend/dist/persistence/postgresPluginDefinitionMigration.js.map +1 -0
  111. package/backend/dist/persistence/postgresResourceRepositories.d.ts +7 -0
  112. package/backend/dist/persistence/postgresResourceRepositories.d.ts.map +1 -0
  113. package/backend/dist/persistence/postgresResourceRepositories.js +776 -0
  114. package/backend/dist/persistence/postgresResourceRepositories.js.map +1 -0
  115. package/backend/dist/persistence/postgresSchemaInspector.d.ts +14 -0
  116. package/backend/dist/persistence/postgresSchemaInspector.d.ts.map +1 -0
  117. package/backend/dist/persistence/postgresSchemaInspector.js +817 -0
  118. package/backend/dist/persistence/postgresSchemaInspector.js.map +1 -0
  119. package/backend/dist/persistence/resourceTypes.d.ts +207 -0
  120. package/backend/dist/persistence/resourceTypes.d.ts.map +1 -0
  121. package/backend/dist/persistence/resourceTypes.js +38 -0
  122. package/backend/dist/persistence/resourceTypes.js.map +1 -0
  123. package/backend/dist/persistence/sqliteExtensionRepositories.d.ts +4 -0
  124. package/backend/dist/persistence/sqliteExtensionRepositories.d.ts.map +1 -0
  125. package/backend/dist/persistence/sqliteExtensionRepositories.js +494 -0
  126. package/backend/dist/persistence/sqliteExtensionRepositories.js.map +1 -0
  127. package/backend/dist/persistence/sqliteMigrations.d.ts +93 -0
  128. package/backend/dist/persistence/sqliteMigrations.d.ts.map +1 -0
  129. package/backend/dist/persistence/sqliteMigrations.js +2232 -0
  130. package/backend/dist/persistence/sqliteMigrations.js.map +1 -0
  131. package/backend/dist/persistence/sqlitePersistence.d.ts +23 -0
  132. package/backend/dist/persistence/sqlitePersistence.d.ts.map +1 -0
  133. package/backend/dist/persistence/sqlitePersistence.js +596 -0
  134. package/backend/dist/persistence/sqlitePersistence.js.map +1 -0
  135. package/backend/dist/persistence/sqliteResourceRepositories.d.ts +4 -0
  136. package/backend/dist/persistence/sqliteResourceRepositories.d.ts.map +1 -0
  137. package/backend/dist/persistence/sqliteResourceRepositories.js +663 -0
  138. package/backend/dist/persistence/sqliteResourceRepositories.js.map +1 -0
  139. package/backend/dist/persistence/sqliteSyncExecutor.d.ts +5 -0
  140. package/backend/dist/persistence/sqliteSyncExecutor.d.ts.map +1 -0
  141. package/backend/dist/persistence/sqliteSyncExecutor.js +19 -0
  142. package/backend/dist/persistence/sqliteSyncExecutor.js.map +1 -0
  143. package/backend/dist/persistence/sqliteToPostgresMigration.d.ts +80 -0
  144. package/backend/dist/persistence/sqliteToPostgresMigration.d.ts.map +1 -0
  145. package/backend/dist/persistence/sqliteToPostgresMigration.js +1543 -0
  146. package/backend/dist/persistence/sqliteToPostgresMigration.js.map +1 -0
  147. package/backend/dist/persistence/types.d.ts +131 -0
  148. package/backend/dist/persistence/types.d.ts.map +1 -0
  149. package/backend/dist/persistence/types.js +18 -0
  150. package/backend/dist/persistence/types.js.map +1 -0
  151. package/backend/dist/persistence/voiceProfileNameLookup.d.ts +9 -0
  152. package/backend/dist/persistence/voiceProfileNameLookup.d.ts.map +1 -0
  153. package/backend/dist/persistence/voiceProfileNameLookup.js +15 -0
  154. package/backend/dist/persistence/voiceProfileNameLookup.js.map +1 -0
  155. package/backend/dist/platform/coordination/index.d.ts +7 -0
  156. package/backend/dist/platform/coordination/index.d.ts.map +1 -0
  157. package/backend/dist/platform/coordination/index.js +24 -0
  158. package/backend/dist/platform/coordination/index.js.map +1 -0
  159. package/backend/dist/platform/coordination/localCoordinator.d.ts +49 -0
  160. package/backend/dist/platform/coordination/localCoordinator.d.ts.map +1 -0
  161. package/backend/dist/platform/coordination/localCoordinator.js +380 -0
  162. package/backend/dist/platform/coordination/localCoordinator.js.map +1 -0
  163. package/backend/dist/platform/coordination/redisCoordinator.d.ts +83 -0
  164. package/backend/dist/platform/coordination/redisCoordinator.d.ts.map +1 -0
  165. package/backend/dist/platform/coordination/redisCoordinator.js +726 -0
  166. package/backend/dist/platform/coordination/redisCoordinator.js.map +1 -0
  167. package/backend/dist/platform/coordination/service.d.ts +11 -0
  168. package/backend/dist/platform/coordination/service.d.ts.map +1 -0
  169. package/backend/dist/platform/coordination/service.js +55 -0
  170. package/backend/dist/platform/coordination/service.js.map +1 -0
  171. package/backend/dist/platform/coordination/sharedAdmission.d.ts +53 -0
  172. package/backend/dist/platform/coordination/sharedAdmission.d.ts.map +1 -0
  173. package/backend/dist/platform/coordination/sharedAdmission.js +194 -0
  174. package/backend/dist/platform/coordination/sharedAdmission.js.map +1 -0
  175. package/backend/dist/platform/coordination/types.d.ts +76 -0
  176. package/backend/dist/platform/coordination/types.d.ts.map +1 -0
  177. package/backend/dist/platform/coordination/types.js +32 -0
  178. package/backend/dist/platform/coordination/types.js.map +1 -0
  179. package/backend/dist/platform/events/durableEventGateway.d.ts +54 -0
  180. package/backend/dist/platform/events/durableEventGateway.d.ts.map +1 -0
  181. package/backend/dist/platform/events/durableEventGateway.js +262 -0
  182. package/backend/dist/platform/events/durableEventGateway.js.map +1 -0
  183. package/backend/dist/platform/events/index.d.ts +3 -0
  184. package/backend/dist/platform/events/index.d.ts.map +1 -0
  185. package/backend/dist/platform/events/index.js +8 -0
  186. package/backend/dist/platform/events/index.js.map +1 -0
  187. package/backend/dist/platform/events/service.d.ts +8 -0
  188. package/backend/dist/platform/events/service.d.ts.map +1 -0
  189. package/backend/dist/platform/events/service.js +25 -0
  190. package/backend/dist/platform/events/service.js.map +1 -0
  191. package/backend/dist/platform/jobs/chatGenerationEnqueuer.d.ts +3 -0
  192. package/backend/dist/platform/jobs/chatGenerationEnqueuer.d.ts.map +1 -0
  193. package/backend/dist/platform/jobs/chatGenerationEnqueuer.js +55 -0
  194. package/backend/dist/platform/jobs/chatGenerationEnqueuer.js.map +1 -0
  195. package/backend/dist/platform/jobs/documentIngestionEnqueuer.d.ts +3 -0
  196. package/backend/dist/platform/jobs/documentIngestionEnqueuer.d.ts.map +1 -0
  197. package/backend/dist/platform/jobs/documentIngestionEnqueuer.js +38 -0
  198. package/backend/dist/platform/jobs/documentIngestionEnqueuer.js.map +1 -0
  199. package/backend/dist/platform/jobs/domainJobContracts.d.ts +30 -0
  200. package/backend/dist/platform/jobs/domainJobContracts.d.ts.map +1 -0
  201. package/backend/dist/platform/jobs/domainJobContracts.js +53 -0
  202. package/backend/dist/platform/jobs/domainJobContracts.js.map +1 -0
  203. package/backend/dist/platform/jobs/domainJobHandlers.d.ts +11 -0
  204. package/backend/dist/platform/jobs/domainJobHandlers.d.ts.map +1 -0
  205. package/backend/dist/platform/jobs/domainJobHandlers.js +612 -0
  206. package/backend/dist/platform/jobs/domainJobHandlers.js.map +1 -0
  207. package/backend/dist/platform/jobs/durableEventIdentity.d.ts +8 -0
  208. package/backend/dist/platform/jobs/durableEventIdentity.d.ts.map +1 -0
  209. package/backend/dist/platform/jobs/durableEventIdentity.js +33 -0
  210. package/backend/dist/platform/jobs/durableEventIdentity.js.map +1 -0
  211. package/backend/dist/platform/jobs/durableJobRuntime.d.ts +57 -0
  212. package/backend/dist/platform/jobs/durableJobRuntime.d.ts.map +1 -0
  213. package/backend/dist/platform/jobs/durableJobRuntime.js +131 -0
  214. package/backend/dist/platform/jobs/durableJobRuntime.js.map +1 -0
  215. package/backend/dist/platform/jobs/durableJobRuntimeBackend.d.ts +28 -0
  216. package/backend/dist/platform/jobs/durableJobRuntimeBackend.d.ts.map +1 -0
  217. package/backend/dist/platform/jobs/durableJobRuntimeBackend.js +62 -0
  218. package/backend/dist/platform/jobs/durableJobRuntimeBackend.js.map +1 -0
  219. package/backend/dist/platform/jobs/durableJobService.d.ts +85 -0
  220. package/backend/dist/platform/jobs/durableJobService.d.ts.map +1 -0
  221. package/backend/dist/platform/jobs/durableJobService.js +726 -0
  222. package/backend/dist/platform/jobs/durableJobService.js.map +1 -0
  223. package/backend/dist/platform/jobs/durableJobTypes.d.ts +195 -0
  224. package/backend/dist/platform/jobs/durableJobTypes.d.ts.map +1 -0
  225. package/backend/dist/platform/jobs/durableJobTypes.js +72 -0
  226. package/backend/dist/platform/jobs/durableJobTypes.js.map +1 -0
  227. package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts +87 -0
  228. package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts.map +1 -0
  229. package/backend/dist/platform/jobs/embeddedDurableJobWorker.js +429 -0
  230. package/backend/dist/platform/jobs/embeddedDurableJobWorker.js.map +1 -0
  231. package/backend/dist/platform/jobs/identityDeletionEnqueuer.d.ts +3 -0
  232. package/backend/dist/platform/jobs/identityDeletionEnqueuer.d.ts.map +1 -0
  233. package/backend/dist/platform/jobs/identityDeletionEnqueuer.js +36 -0
  234. package/backend/dist/platform/jobs/identityDeletionEnqueuer.js.map +1 -0
  235. package/backend/dist/platform/jobs/index.d.ts +18 -0
  236. package/backend/dist/platform/jobs/index.d.ts.map +1 -0
  237. package/backend/dist/platform/jobs/index.js +34 -0
  238. package/backend/dist/platform/jobs/index.js.map +1 -0
  239. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.d.ts +4 -0
  240. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.d.ts.map +1 -0
  241. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.js +25 -0
  242. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.js.map +1 -0
  243. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.d.ts +4 -0
  244. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.d.ts.map +1 -0
  245. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.js +23 -0
  246. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.js.map +1 -0
  247. package/backend/dist/platform/jobs/postgresDurableJobMigration.d.ts +11 -0
  248. package/backend/dist/platform/jobs/postgresDurableJobMigration.d.ts.map +1 -0
  249. package/backend/dist/platform/jobs/postgresDurableJobMigration.js +106 -0
  250. package/backend/dist/platform/jobs/postgresDurableJobMigration.js.map +1 -0
  251. package/backend/dist/platform/jobs/postgresDurableJobRepository.d.ts +88 -0
  252. package/backend/dist/platform/jobs/postgresDurableJobRepository.d.ts.map +1 -0
  253. package/backend/dist/platform/jobs/postgresDurableJobRepository.js +1185 -0
  254. package/backend/dist/platform/jobs/postgresDurableJobRepository.js.map +1 -0
  255. package/backend/dist/platform/jobs/postgresDurableJobService.d.ts +86 -0
  256. package/backend/dist/platform/jobs/postgresDurableJobService.d.ts.map +1 -0
  257. package/backend/dist/platform/jobs/postgresDurableJobService.js +696 -0
  258. package/backend/dist/platform/jobs/postgresDurableJobService.js.map +1 -0
  259. package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts +53 -0
  260. package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts.map +1 -0
  261. package/backend/dist/platform/jobs/postgresDurableJobWorker.js +393 -0
  262. package/backend/dist/platform/jobs/postgresDurableJobWorker.js.map +1 -0
  263. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.d.ts +3 -0
  264. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.d.ts.map +1 -0
  265. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.js +43 -0
  266. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.js.map +1 -0
  267. package/backend/dist/platform/jobs/sqliteDurableJobRepository.d.ts +166 -0
  268. package/backend/dist/platform/jobs/sqliteDurableJobRepository.d.ts.map +1 -0
  269. package/backend/dist/platform/jobs/sqliteDurableJobRepository.js +1008 -0
  270. package/backend/dist/platform/jobs/sqliteDurableJobRepository.js.map +1 -0
  271. package/backend/dist/platform/jobs/videoGenerationEnqueuer.d.ts +4 -0
  272. package/backend/dist/platform/jobs/videoGenerationEnqueuer.d.ts.map +1 -0
  273. package/backend/dist/platform/jobs/videoGenerationEnqueuer.js +46 -0
  274. package/backend/dist/platform/jobs/videoGenerationEnqueuer.js.map +1 -0
  275. package/backend/dist/platform/jobs/workExecutionEnqueuer.d.ts +3 -0
  276. package/backend/dist/platform/jobs/workExecutionEnqueuer.d.ts.map +1 -0
  277. package/backend/dist/platform/jobs/workExecutionEnqueuer.js +38 -0
  278. package/backend/dist/platform/jobs/workExecutionEnqueuer.js.map +1 -0
  279. package/backend/dist/platform/ollamaRuntimeConfig.d.ts +40 -0
  280. package/backend/dist/platform/ollamaRuntimeConfig.d.ts.map +1 -0
  281. package/backend/dist/platform/ollamaRuntimeConfig.js +72 -0
  282. package/backend/dist/platform/ollamaRuntimeConfig.js.map +1 -0
  283. package/backend/dist/platform/recovery/backupArchive.d.ts +120 -0
  284. package/backend/dist/platform/recovery/backupArchive.d.ts.map +1 -0
  285. package/backend/dist/platform/recovery/backupArchive.js +842 -0
  286. package/backend/dist/platform/recovery/backupArchive.js.map +1 -0
  287. package/backend/dist/platform/recovery/index.d.ts +3 -0
  288. package/backend/dist/platform/recovery/index.d.ts.map +1 -0
  289. package/backend/dist/platform/recovery/index.js +8 -0
  290. package/backend/dist/platform/recovery/index.js.map +1 -0
  291. package/backend/dist/platform/recovery/teamBackupArchive.d.ts +98 -0
  292. package/backend/dist/platform/recovery/teamBackupArchive.d.ts.map +1 -0
  293. package/backend/dist/platform/recovery/teamBackupArchive.js +1203 -0
  294. package/backend/dist/platform/recovery/teamBackupArchive.js.map +1 -0
  295. package/backend/dist/platform/runtimeConfig.d.ts +70 -0
  296. package/backend/dist/platform/runtimeConfig.d.ts.map +1 -0
  297. package/backend/dist/platform/runtimeConfig.js +205 -0
  298. package/backend/dist/platform/runtimeConfig.js.map +1 -0
  299. package/backend/dist/platform/storage/aesGcmKeyring.d.ts +26 -0
  300. package/backend/dist/platform/storage/aesGcmKeyring.d.ts.map +1 -0
  301. package/backend/dist/platform/storage/aesGcmKeyring.js +135 -0
  302. package/backend/dist/platform/storage/aesGcmKeyring.js.map +1 -0
  303. package/backend/dist/platform/storage/blobReferenceRepository.d.ts +36 -0
  304. package/backend/dist/platform/storage/blobReferenceRepository.d.ts.map +1 -0
  305. package/backend/dist/platform/storage/blobReferenceRepository.js +117 -0
  306. package/backend/dist/platform/storage/blobReferenceRepository.js.map +1 -0
  307. package/backend/dist/platform/storage/blobStore.d.ts +111 -0
  308. package/backend/dist/platform/storage/blobStore.d.ts.map +1 -0
  309. package/backend/dist/platform/storage/blobStore.js +46 -0
  310. package/backend/dist/platform/storage/blobStore.js.map +1 -0
  311. package/backend/dist/platform/storage/documentVectorIndex.d.ts +44 -0
  312. package/backend/dist/platform/storage/documentVectorIndex.d.ts.map +1 -0
  313. package/backend/dist/platform/storage/documentVectorIndex.js +110 -0
  314. package/backend/dist/platform/storage/documentVectorIndex.js.map +1 -0
  315. package/backend/dist/platform/storage/durableBlobQuotaPolicy.d.ts +82 -0
  316. package/backend/dist/platform/storage/durableBlobQuotaPolicy.d.ts.map +1 -0
  317. package/backend/dist/platform/storage/durableBlobQuotaPolicy.js +583 -0
  318. package/backend/dist/platform/storage/durableBlobQuotaPolicy.js.map +1 -0
  319. package/backend/dist/platform/storage/index.d.ts +19 -0
  320. package/backend/dist/platform/storage/index.d.ts.map +1 -0
  321. package/backend/dist/platform/storage/index.js +35 -0
  322. package/backend/dist/platform/storage/index.js.map +1 -0
  323. package/backend/dist/platform/storage/localEncryptedBlobStore.d.ts +120 -0
  324. package/backend/dist/platform/storage/localEncryptedBlobStore.d.ts.map +1 -0
  325. package/backend/dist/platform/storage/localEncryptedBlobStore.js +1205 -0
  326. package/backend/dist/platform/storage/localEncryptedBlobStore.js.map +1 -0
  327. package/backend/dist/platform/storage/personaMemoryIndexing.d.ts +12 -0
  328. package/backend/dist/platform/storage/personaMemoryIndexing.d.ts.map +1 -0
  329. package/backend/dist/platform/storage/personaMemoryIndexing.js +25 -0
  330. package/backend/dist/platform/storage/personaMemoryIndexing.js.map +1 -0
  331. package/backend/dist/platform/storage/pgVectorStore.d.ts +37 -0
  332. package/backend/dist/platform/storage/pgVectorStore.d.ts.map +1 -0
  333. package/backend/dist/platform/storage/pgVectorStore.js +493 -0
  334. package/backend/dist/platform/storage/pgVectorStore.js.map +1 -0
  335. package/backend/dist/platform/storage/platformDomainRepositories.d.ts +244 -0
  336. package/backend/dist/platform/storage/platformDomainRepositories.d.ts.map +1 -0
  337. package/backend/dist/platform/storage/platformDomainRepositories.js +7 -0
  338. package/backend/dist/platform/storage/platformDomainRepositories.js.map +1 -0
  339. package/backend/dist/platform/storage/platformStorageRuntime.d.ts +35 -0
  340. package/backend/dist/platform/storage/platformStorageRuntime.d.ts.map +1 -0
  341. package/backend/dist/platform/storage/platformStorageRuntime.js +299 -0
  342. package/backend/dist/platform/storage/platformStorageRuntime.js.map +1 -0
  343. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts +4 -0
  344. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts.map +1 -0
  345. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js +1017 -0
  346. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js.map +1 -0
  347. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.d.ts +4 -0
  348. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.d.ts.map +1 -0
  349. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.js +40 -0
  350. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.js.map +1 -0
  351. package/backend/dist/platform/storage/resourceContentCleanup.d.ts +29 -0
  352. package/backend/dist/platform/storage/resourceContentCleanup.d.ts.map +1 -0
  353. package/backend/dist/platform/storage/resourceContentCleanup.js +100 -0
  354. package/backend/dist/platform/storage/resourceContentCleanup.js.map +1 -0
  355. package/backend/dist/platform/storage/resourceDeletionLifecycle.d.ts +14 -0
  356. package/backend/dist/platform/storage/resourceDeletionLifecycle.d.ts.map +1 -0
  357. package/backend/dist/platform/storage/resourceDeletionLifecycle.js +31 -0
  358. package/backend/dist/platform/storage/resourceDeletionLifecycle.js.map +1 -0
  359. package/backend/dist/platform/storage/s3EncryptedBlobStore.d.ts +140 -0
  360. package/backend/dist/platform/storage/s3EncryptedBlobStore.d.ts.map +1 -0
  361. package/backend/dist/platform/storage/s3EncryptedBlobStore.js +1309 -0
  362. package/backend/dist/platform/storage/s3EncryptedBlobStore.js.map +1 -0
  363. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts +71 -0
  364. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts.map +1 -0
  365. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js +766 -0
  366. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js.map +1 -0
  367. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts +4 -0
  368. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts.map +1 -0
  369. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js +1037 -0
  370. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js.map +1 -0
  371. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.d.ts +25 -0
  372. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.d.ts.map +1 -0
  373. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.js +1292 -0
  374. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.js.map +1 -0
  375. package/backend/dist/platform/storage/storageFactory.d.ts +81 -0
  376. package/backend/dist/platform/storage/storageFactory.d.ts.map +1 -0
  377. package/backend/dist/platform/storage/storageFactory.js +518 -0
  378. package/backend/dist/platform/storage/storageFactory.js.map +1 -0
  379. package/backend/dist/platform/storage/storageSchemaContracts.d.ts +22 -0
  380. package/backend/dist/platform/storage/storageSchemaContracts.d.ts.map +1 -0
  381. package/backend/dist/platform/storage/storageSchemaContracts.js +299 -0
  382. package/backend/dist/platform/storage/storageSchemaContracts.js.map +1 -0
  383. package/backend/dist/platform/storage/vectorStore.d.ts +117 -0
  384. package/backend/dist/platform/storage/vectorStore.d.ts.map +1 -0
  385. package/backend/dist/platform/storage/vectorStore.js +40 -0
  386. package/backend/dist/platform/storage/vectorStore.js.map +1 -0
  387. package/backend/dist/platform/workPersistence/index.d.ts +9 -0
  388. package/backend/dist/platform/workPersistence/index.d.ts.map +1 -0
  389. package/backend/dist/platform/workPersistence/index.js +14 -0
  390. package/backend/dist/platform/workPersistence/index.js.map +1 -0
  391. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.d.ts +9 -0
  392. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.d.ts.map +1 -0
  393. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.js +47 -0
  394. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.js.map +1 -0
  395. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.d.ts +3 -0
  396. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.d.ts.map +1 -0
  397. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.js +28 -0
  398. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.js.map +1 -0
  399. package/backend/dist/platform/workPersistence/postgresWorkMigration.d.ts +3 -0
  400. package/backend/dist/platform/workPersistence/postgresWorkMigration.d.ts.map +1 -0
  401. package/backend/dist/platform/workPersistence/postgresWorkMigration.js +101 -0
  402. package/backend/dist/platform/workPersistence/postgresWorkMigration.js.map +1 -0
  403. package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts +79 -0
  404. package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts.map +1 -0
  405. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js +521 -0
  406. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js.map +1 -0
  407. package/backend/dist/platform/workPersistence/service.d.ts +6 -0
  408. package/backend/dist/platform/workPersistence/service.d.ts.map +1 -0
  409. package/backend/dist/platform/workPersistence/service.js +27 -0
  410. package/backend/dist/platform/workPersistence/service.js.map +1 -0
  411. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts +77 -0
  412. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts.map +1 -0
  413. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js +463 -0
  414. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js.map +1 -0
  415. package/backend/dist/platform/workPersistence/types.d.ts +159 -0
  416. package/backend/dist/platform/workPersistence/types.d.ts.map +1 -0
  417. package/backend/dist/platform/workPersistence/types.js +13 -0
  418. package/backend/dist/platform/workPersistence/types.js.map +1 -0
  419. package/backend/dist/platform/workPersistence/workExecutionTypes.d.ts +13 -0
  420. package/backend/dist/platform/workPersistence/workExecutionTypes.d.ts.map +1 -0
  421. package/backend/dist/platform/workPersistence/workExecutionTypes.js +7 -0
  422. package/backend/dist/platform/workPersistence/workExecutionTypes.js.map +1 -0
  423. package/backend/dist/platform/workPersistence/workMessageContentCodec.d.ts +8 -0
  424. package/backend/dist/platform/workPersistence/workMessageContentCodec.d.ts.map +1 -0
  425. package/backend/dist/platform/workPersistence/workMessageContentCodec.js +25 -0
  426. package/backend/dist/platform/workPersistence/workMessageContentCodec.js.map +1 -0
  427. package/backend/dist/platform/workPersistence/workTextSafety.d.ts +3 -0
  428. package/backend/dist/platform/workPersistence/workTextSafety.d.ts.map +1 -0
  429. package/backend/dist/platform/workPersistence/workTextSafety.js +8 -0
  430. package/backend/dist/platform/workPersistence/workTextSafety.js.map +1 -0
  431. package/backend/dist/routes/agentCli.js +1 -1
  432. package/backend/dist/routes/agentCli.js.map +1 -1
  433. package/backend/dist/routes/artifacts.d.ts.map +1 -1
  434. package/backend/dist/routes/artifacts.js +2 -1
  435. package/backend/dist/routes/artifacts.js.map +1 -1
  436. package/backend/dist/routes/auth.d.ts.map +1 -1
  437. package/backend/dist/routes/auth.js +64 -18
  438. package/backend/dist/routes/auth.js.map +1 -1
  439. package/backend/dist/routes/chat.d.ts.map +1 -1
  440. package/backend/dist/routes/chat.js +519 -85
  441. package/backend/dist/routes/chat.js.map +1 -1
  442. package/backend/dist/routes/documents.d.ts.map +1 -1
  443. package/backend/dist/routes/documents.js +134 -28
  444. package/backend/dist/routes/documents.js.map +1 -1
  445. package/backend/dist/routes/embeddings.d.ts.map +1 -1
  446. package/backend/dist/routes/embeddings.js +2 -1
  447. package/backend/dist/routes/embeddings.js.map +1 -1
  448. package/backend/dist/routes/health.d.ts +3 -0
  449. package/backend/dist/routes/health.d.ts.map +1 -0
  450. package/backend/dist/routes/health.js +52 -0
  451. package/backend/dist/routes/health.js.map +1 -0
  452. package/backend/dist/routes/huggingfaceHub.d.ts.map +1 -1
  453. package/backend/dist/routes/huggingfaceHub.js +2 -1
  454. package/backend/dist/routes/huggingfaceHub.js.map +1 -1
  455. package/backend/dist/routes/imageGen.d.ts.map +1 -1
  456. package/backend/dist/routes/imageGen.js +42 -10
  457. package/backend/dist/routes/imageGen.js.map +1 -1
  458. package/backend/dist/routes/jobs.d.ts +3 -0
  459. package/backend/dist/routes/jobs.d.ts.map +1 -0
  460. package/backend/dist/routes/jobs.js +117 -0
  461. package/backend/dist/routes/jobs.js.map +1 -0
  462. package/backend/dist/routes/libreClaw.d.ts.map +1 -1
  463. package/backend/dist/routes/libreClaw.js +10 -7
  464. package/backend/dist/routes/libreClaw.js.map +1 -1
  465. package/backend/dist/routes/media.d.ts.map +1 -1
  466. package/backend/dist/routes/media.js +523 -77
  467. package/backend/dist/routes/media.js.map +1 -1
  468. package/backend/dist/routes/notes.d.ts.map +1 -1
  469. package/backend/dist/routes/notes.js +21 -21
  470. package/backend/dist/routes/notes.js.map +1 -1
  471. package/backend/dist/routes/ollama.d.ts.map +1 -1
  472. package/backend/dist/routes/ollama.js +40 -12
  473. package/backend/dist/routes/ollama.js.map +1 -1
  474. package/backend/dist/routes/personas.d.ts.map +1 -1
  475. package/backend/dist/routes/personas.js +4 -2
  476. package/backend/dist/routes/personas.js.map +1 -1
  477. package/backend/dist/routes/plugins.d.ts.map +1 -1
  478. package/backend/dist/routes/plugins.js +79 -51
  479. package/backend/dist/routes/plugins.js.map +1 -1
  480. package/backend/dist/routes/preferences.d.ts.map +1 -1
  481. package/backend/dist/routes/preferences.js +290 -25
  482. package/backend/dist/routes/preferences.js.map +1 -1
  483. package/backend/dist/routes/search.d.ts.map +1 -1
  484. package/backend/dist/routes/search.js +23 -14
  485. package/backend/dist/routes/search.js.map +1 -1
  486. package/backend/dist/routes/stt.d.ts +9 -0
  487. package/backend/dist/routes/stt.d.ts.map +1 -0
  488. package/backend/dist/routes/stt.js +217 -0
  489. package/backend/dist/routes/stt.js.map +1 -0
  490. package/backend/dist/routes/systemDiagnostics.d.ts.map +1 -1
  491. package/backend/dist/routes/systemDiagnostics.js +2 -1
  492. package/backend/dist/routes/systemDiagnostics.js.map +1 -1
  493. package/backend/dist/routes/tts.d.ts.map +1 -1
  494. package/backend/dist/routes/tts.js +577 -28
  495. package/backend/dist/routes/tts.js.map +1 -1
  496. package/backend/dist/routes/users.d.ts.map +1 -1
  497. package/backend/dist/routes/users.js +16 -25
  498. package/backend/dist/routes/users.js.map +1 -1
  499. package/backend/dist/routes/work.d.ts.map +1 -1
  500. package/backend/dist/routes/work.js +167 -113
  501. package/backend/dist/routes/work.js.map +1 -1
  502. package/backend/dist/services/agentAccessService.d.ts +2 -2
  503. package/backend/dist/services/agentAccessService.d.ts.map +1 -1
  504. package/backend/dist/services/agentAccessService.js +5 -14
  505. package/backend/dist/services/agentAccessService.js.map +1 -1
  506. package/backend/dist/services/agentCliService.d.ts +3 -2
  507. package/backend/dist/services/agentCliService.d.ts.map +1 -1
  508. package/backend/dist/services/agentCliService.js +44 -16
  509. package/backend/dist/services/agentCliService.js.map +1 -1
  510. package/backend/dist/services/assistantCompletionService.d.ts +2 -1
  511. package/backend/dist/services/assistantCompletionService.d.ts.map +1 -1
  512. package/backend/dist/services/assistantCompletionService.js +7 -3
  513. package/backend/dist/services/assistantCompletionService.js.map +1 -1
  514. package/backend/dist/services/authService.d.ts +7 -2
  515. package/backend/dist/services/authService.d.ts.map +1 -1
  516. package/backend/dist/services/authService.js +23 -10
  517. package/backend/dist/services/authService.js.map +1 -1
  518. package/backend/dist/services/chatGenerationService.d.ts +5 -4
  519. package/backend/dist/services/chatGenerationService.d.ts.map +1 -1
  520. package/backend/dist/services/chatGenerationService.js +23 -17
  521. package/backend/dist/services/chatGenerationService.js.map +1 -1
  522. package/backend/dist/services/chatRequestService.d.ts +4 -3
  523. package/backend/dist/services/chatRequestService.d.ts.map +1 -1
  524. package/backend/dist/services/chatRequestService.js +3 -3
  525. package/backend/dist/services/chatRequestService.js.map +1 -1
  526. package/backend/dist/services/chatService.d.ts +66 -16
  527. package/backend/dist/services/chatService.d.ts.map +1 -1
  528. package/backend/dist/services/chatService.js +402 -111
  529. package/backend/dist/services/chatService.js.map +1 -1
  530. package/backend/dist/services/codexOAuthService.d.ts +2 -2
  531. package/backend/dist/services/codexOAuthService.d.ts.map +1 -1
  532. package/backend/dist/services/codexOAuthService.js +63 -7
  533. package/backend/dist/services/codexOAuthService.js.map +1 -1
  534. package/backend/dist/services/dataArchiveService.d.ts +88 -0
  535. package/backend/dist/services/dataArchiveService.d.ts.map +1 -0
  536. package/backend/dist/services/dataArchiveService.js +1027 -0
  537. package/backend/dist/services/dataArchiveService.js.map +1 -0
  538. package/backend/dist/services/documentService.d.ts +67 -14
  539. package/backend/dist/services/documentService.d.ts.map +1 -1
  540. package/backend/dist/services/documentService.js +938 -193
  541. package/backend/dist/services/documentService.js.map +1 -1
  542. package/backend/dist/services/durableChatCompletion.d.ts +16 -0
  543. package/backend/dist/services/durableChatCompletion.d.ts.map +1 -0
  544. package/backend/dist/services/durableChatCompletion.js +34 -0
  545. package/backend/dist/services/durableChatCompletion.js.map +1 -0
  546. package/backend/dist/services/durableChatGenerationService.d.ts +19 -0
  547. package/backend/dist/services/durableChatGenerationService.d.ts.map +1 -0
  548. package/backend/dist/services/durableChatGenerationService.js +341 -0
  549. package/backend/dist/services/durableChatGenerationService.js.map +1 -0
  550. package/backend/dist/services/embeddingService.d.ts +1 -1
  551. package/backend/dist/services/embeddingService.d.ts.map +1 -1
  552. package/backend/dist/services/embeddingService.js +16 -13
  553. package/backend/dist/services/embeddingService.js.map +1 -1
  554. package/backend/dist/services/encryptionService.d.ts +28 -1
  555. package/backend/dist/services/encryptionService.d.ts.map +1 -1
  556. package/backend/dist/services/encryptionService.js +131 -51
  557. package/backend/dist/services/encryptionService.js.map +1 -1
  558. package/backend/dist/services/followUpService.d.ts +1 -1
  559. package/backend/dist/services/followUpService.d.ts.map +1 -1
  560. package/backend/dist/services/followUpService.js +1 -1
  561. package/backend/dist/services/followUpService.js.map +1 -1
  562. package/backend/dist/services/galleryService.d.ts +38 -37
  563. package/backend/dist/services/galleryService.d.ts.map +1 -1
  564. package/backend/dist/services/galleryService.js +356 -251
  565. package/backend/dist/services/galleryService.js.map +1 -1
  566. package/backend/dist/services/healthService.d.ts +65 -0
  567. package/backend/dist/services/healthService.d.ts.map +1 -0
  568. package/backend/dist/services/healthService.js +379 -0
  569. package/backend/dist/services/healthService.js.map +1 -0
  570. package/backend/dist/services/legacyCiphertextIntegrity.d.ts +40 -0
  571. package/backend/dist/services/legacyCiphertextIntegrity.d.ts.map +1 -0
  572. package/backend/dist/services/legacyCiphertextIntegrity.js +406 -0
  573. package/backend/dist/services/legacyCiphertextIntegrity.js.map +1 -0
  574. package/backend/dist/services/mediaGenerationJobService.d.ts +27 -5
  575. package/backend/dist/services/mediaGenerationJobService.d.ts.map +1 -1
  576. package/backend/dist/services/mediaGenerationJobService.js +185 -55
  577. package/backend/dist/services/mediaGenerationJobService.js.map +1 -1
  578. package/backend/dist/services/memoryService.d.ts +7 -83
  579. package/backend/dist/services/memoryService.d.ts.map +1 -1
  580. package/backend/dist/services/memoryService.js +428 -573
  581. package/backend/dist/services/memoryService.js.map +1 -1
  582. package/backend/dist/services/memoryUtils.d.ts.map +1 -1
  583. package/backend/dist/services/memoryUtils.js +8 -1
  584. package/backend/dist/services/memoryUtils.js.map +1 -1
  585. package/backend/dist/services/modelAccessService.d.ts +3 -3
  586. package/backend/dist/services/modelAccessService.d.ts.map +1 -1
  587. package/backend/dist/services/modelAccessService.js +8 -16
  588. package/backend/dist/services/modelAccessService.js.map +1 -1
  589. package/backend/dist/services/mutationEngineService.d.ts +0 -7
  590. package/backend/dist/services/mutationEngineService.d.ts.map +1 -1
  591. package/backend/dist/services/mutationEngineService.js +7 -78
  592. package/backend/dist/services/mutationEngineService.js.map +1 -1
  593. package/backend/dist/services/ollamaService.d.ts +4 -4
  594. package/backend/dist/services/ollamaService.d.ts.map +1 -1
  595. package/backend/dist/services/ollamaService.js +62 -31
  596. package/backend/dist/services/ollamaService.js.map +1 -1
  597. package/backend/dist/services/personaService.d.ts.map +1 -1
  598. package/backend/dist/services/personaService.js +19 -54
  599. package/backend/dist/services/personaService.js.map +1 -1
  600. package/backend/dist/services/pluginActivationService.d.ts +6 -5
  601. package/backend/dist/services/pluginActivationService.d.ts.map +1 -1
  602. package/backend/dist/services/pluginActivationService.js +36 -76
  603. package/backend/dist/services/pluginActivationService.js.map +1 -1
  604. package/backend/dist/services/pluginAudioGenerationService.d.ts +11 -6
  605. package/backend/dist/services/pluginAudioGenerationService.d.ts.map +1 -1
  606. package/backend/dist/services/pluginAudioGenerationService.js +74 -16
  607. package/backend/dist/services/pluginAudioGenerationService.js.map +1 -1
  608. package/backend/dist/services/pluginCacheInvalidation.d.ts +38 -0
  609. package/backend/dist/services/pluginCacheInvalidation.d.ts.map +1 -0
  610. package/backend/dist/services/pluginCacheInvalidation.js +198 -0
  611. package/backend/dist/services/pluginCacheInvalidation.js.map +1 -0
  612. package/backend/dist/services/pluginCapabilityRegistryService.d.ts +3 -3
  613. package/backend/dist/services/pluginCapabilityRegistryService.d.ts.map +1 -1
  614. package/backend/dist/services/pluginCapabilityRegistryService.js +11 -7
  615. package/backend/dist/services/pluginCapabilityRegistryService.js.map +1 -1
  616. package/backend/dist/services/pluginCredentialsService.d.ts +9 -8
  617. package/backend/dist/services/pluginCredentialsService.d.ts.map +1 -1
  618. package/backend/dist/services/pluginCredentialsService.js +48 -89
  619. package/backend/dist/services/pluginCredentialsService.js.map +1 -1
  620. package/backend/dist/services/pluginEmbeddingService.d.ts +8 -7
  621. package/backend/dist/services/pluginEmbeddingService.d.ts.map +1 -1
  622. package/backend/dist/services/pluginEmbeddingService.js +13 -11
  623. package/backend/dist/services/pluginEmbeddingService.js.map +1 -1
  624. package/backend/dist/services/pluginImageGenerationService.d.ts +10 -8
  625. package/backend/dist/services/pluginImageGenerationService.d.ts.map +1 -1
  626. package/backend/dist/services/pluginImageGenerationService.js +119 -14
  627. package/backend/dist/services/pluginImageGenerationService.js.map +1 -1
  628. package/backend/dist/services/pluginSTTService.d.ts +47 -0
  629. package/backend/dist/services/pluginSTTService.d.ts.map +1 -0
  630. package/backend/dist/services/pluginSTTService.js +199 -0
  631. package/backend/dist/services/pluginSTTService.js.map +1 -0
  632. package/backend/dist/services/pluginService.d.ts +94 -40
  633. package/backend/dist/services/pluginService.d.ts.map +1 -1
  634. package/backend/dist/services/pluginService.js +799 -274
  635. package/backend/dist/services/pluginService.js.map +1 -1
  636. package/backend/dist/services/pluginTTSService.d.ts +26 -8
  637. package/backend/dist/services/pluginTTSService.d.ts.map +1 -1
  638. package/backend/dist/services/pluginTTSService.js +277 -25
  639. package/backend/dist/services/pluginTTSService.js.map +1 -1
  640. package/backend/dist/services/pluginUsageService.d.ts +4 -4
  641. package/backend/dist/services/pluginUsageService.d.ts.map +1 -1
  642. package/backend/dist/services/pluginUsageService.js +44 -93
  643. package/backend/dist/services/pluginUsageService.js.map +1 -1
  644. package/backend/dist/services/pluginVariablesService.d.ts +14 -7
  645. package/backend/dist/services/pluginVariablesService.d.ts.map +1 -1
  646. package/backend/dist/services/pluginVariablesService.js +116 -81
  647. package/backend/dist/services/pluginVariablesService.js.map +1 -1
  648. package/backend/dist/services/pluginVideoGenerationService.d.ts +19 -8
  649. package/backend/dist/services/pluginVideoGenerationService.d.ts.map +1 -1
  650. package/backend/dist/services/pluginVideoGenerationService.js +116 -20
  651. package/backend/dist/services/pluginVideoGenerationService.js.map +1 -1
  652. package/backend/dist/services/preferencesService.d.ts +31 -21
  653. package/backend/dist/services/preferencesService.d.ts.map +1 -1
  654. package/backend/dist/services/preferencesService.js +104 -102
  655. package/backend/dist/services/preferencesService.js.map +1 -1
  656. package/backend/dist/services/recoveryInventoryService.d.ts +244 -0
  657. package/backend/dist/services/recoveryInventoryService.d.ts.map +1 -0
  658. package/backend/dist/services/recoveryInventoryService.js +1436 -0
  659. package/backend/dist/services/recoveryInventoryService.js.map +1 -0
  660. package/backend/dist/services/simpleGitHubOAuth.js +3 -3
  661. package/backend/dist/services/simpleGitHubOAuth.js.map +1 -1
  662. package/backend/dist/services/simpleHuggingFaceOAuth.d.ts.map +1 -1
  663. package/backend/dist/services/simpleHuggingFaceOAuth.js +3 -3
  664. package/backend/dist/services/simpleHuggingFaceOAuth.js.map +1 -1
  665. package/backend/dist/services/systemDiagnosticsService.d.ts.map +1 -1
  666. package/backend/dist/services/systemDiagnosticsService.js +2 -2
  667. package/backend/dist/services/systemDiagnosticsService.js.map +1 -1
  668. package/backend/dist/services/systemSettingsService.d.ts +5 -0
  669. package/backend/dist/services/systemSettingsService.d.ts.map +1 -0
  670. package/backend/dist/services/systemSettingsService.js +24 -0
  671. package/backend/dist/services/systemSettingsService.js.map +1 -0
  672. package/backend/dist/services/titleGenerationService.d.ts +1 -1
  673. package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
  674. package/backend/dist/services/titleGenerationService.js +1 -1
  675. package/backend/dist/services/titleGenerationService.js.map +1 -1
  676. package/backend/dist/services/voiceProfileService.d.ts +44 -0
  677. package/backend/dist/services/voiceProfileService.d.ts.map +1 -0
  678. package/backend/dist/services/voiceProfileService.js +195 -0
  679. package/backend/dist/services/voiceProfileService.js.map +1 -0
  680. package/backend/dist/services/webSearchService.d.ts +7 -7
  681. package/backend/dist/services/webSearchService.d.ts.map +1 -1
  682. package/backend/dist/services/webSearchService.js +40 -35
  683. package/backend/dist/services/webSearchService.js.map +1 -1
  684. package/backend/dist/services/websocketTicketService.d.ts +39 -0
  685. package/backend/dist/services/websocketTicketService.d.ts.map +1 -0
  686. package/backend/dist/services/websocketTicketService.js +183 -0
  687. package/backend/dist/services/websocketTicketService.js.map +1 -0
  688. package/backend/dist/services/workAccessService.d.ts +3 -3
  689. package/backend/dist/services/workAccessService.d.ts.map +1 -1
  690. package/backend/dist/services/workAccessService.js +8 -16
  691. package/backend/dist/services/workAccessService.js.map +1 -1
  692. package/backend/dist/services/workAdminService.d.ts +3 -3
  693. package/backend/dist/services/workAdminService.d.ts.map +1 -1
  694. package/backend/dist/services/workAdminService.js +4 -4
  695. package/backend/dist/services/workAdminService.js.map +1 -1
  696. package/backend/dist/services/workAgentService.d.ts +25 -1
  697. package/backend/dist/services/workAgentService.d.ts.map +1 -1
  698. package/backend/dist/services/workAgentService.js +294 -126
  699. package/backend/dist/services/workAgentService.js.map +1 -1
  700. package/backend/dist/services/workEventService.d.ts +15 -2
  701. package/backend/dist/services/workEventService.d.ts.map +1 -1
  702. package/backend/dist/services/workEventService.js +201 -3
  703. package/backend/dist/services/workEventService.js.map +1 -1
  704. package/backend/dist/services/workKubernetesDriver.d.ts +8 -7
  705. package/backend/dist/services/workKubernetesDriver.d.ts.map +1 -1
  706. package/backend/dist/services/workKubernetesDriver.js +65 -21
  707. package/backend/dist/services/workKubernetesDriver.js.map +1 -1
  708. package/backend/dist/services/workModelProviderService.d.ts +2 -2
  709. package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
  710. package/backend/dist/services/workModelProviderService.js +38 -34
  711. package/backend/dist/services/workModelProviderService.js.map +1 -1
  712. package/backend/dist/services/workPolicyService.d.ts +7 -7
  713. package/backend/dist/services/workPolicyService.d.ts.map +1 -1
  714. package/backend/dist/services/workPolicyService.js +50 -51
  715. package/backend/dist/services/workPolicyService.js.map +1 -1
  716. package/backend/dist/services/workPreviewProxyService.d.ts +8 -8
  717. package/backend/dist/services/workPreviewProxyService.d.ts.map +1 -1
  718. package/backend/dist/services/workPreviewProxyService.js +47 -44
  719. package/backend/dist/services/workPreviewProxyService.js.map +1 -1
  720. package/backend/dist/services/workRuntimeDriver.d.ts +21 -18
  721. package/backend/dist/services/workRuntimeDriver.d.ts.map +1 -1
  722. package/backend/dist/services/workRuntimeDriver.js +69 -20
  723. package/backend/dist/services/workRuntimeDriver.js.map +1 -1
  724. package/backend/dist/services/workRuntimeService.d.ts +18 -13
  725. package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
  726. package/backend/dist/services/workRuntimeService.js +438 -194
  727. package/backend/dist/services/workRuntimeService.js.map +1 -1
  728. package/backend/dist/services/workRuntimeShared.d.ts +2 -0
  729. package/backend/dist/services/workRuntimeShared.d.ts.map +1 -1
  730. package/backend/dist/services/workRuntimeShared.js.map +1 -1
  731. package/backend/dist/services/workTaskService.d.ts +42 -36
  732. package/backend/dist/services/workTaskService.d.ts.map +1 -1
  733. package/backend/dist/services/workTaskService.js +445 -350
  734. package/backend/dist/services/workTaskService.js.map +1 -1
  735. package/backend/dist/services/workTerminalService.d.ts +1 -1
  736. package/backend/dist/services/workTerminalService.d.ts.map +1 -1
  737. package/backend/dist/services/workTerminalService.js +33 -6
  738. package/backend/dist/services/workTerminalService.js.map +1 -1
  739. package/backend/dist/storage.d.ts +72 -40
  740. package/backend/dist/storage.d.ts.map +1 -1
  741. package/backend/dist/storage.js +312 -660
  742. package/backend/dist/storage.js.map +1 -1
  743. package/backend/dist/types/index.d.ts +28 -0
  744. package/backend/dist/types/index.d.ts.map +1 -1
  745. package/backend/dist/types/index.js.map +1 -1
  746. package/backend/dist/types/work.d.ts +7 -2
  747. package/backend/dist/types/work.d.ts.map +1 -1
  748. package/backend/dist/utils/chatCancellation.d.ts +48 -0
  749. package/backend/dist/utils/chatCancellation.d.ts.map +1 -0
  750. package/backend/dist/utils/chatCancellation.js +152 -0
  751. package/backend/dist/utils/chatCancellation.js.map +1 -0
  752. package/backend/dist/utils/chatDocumentContext.d.ts +1 -1
  753. package/backend/dist/utils/chatDocumentContext.d.ts.map +1 -1
  754. package/backend/dist/utils/chatDocumentContext.js +11 -5
  755. package/backend/dist/utils/chatDocumentContext.js.map +1 -1
  756. package/backend/dist/utils/chatStreamCoalescer.d.ts +15 -0
  757. package/backend/dist/utils/chatStreamCoalescer.d.ts.map +1 -0
  758. package/backend/dist/utils/chatStreamCoalescer.js +59 -0
  759. package/backend/dist/utils/chatStreamCoalescer.js.map +1 -0
  760. package/backend/dist/utils/dataDirectory.d.ts +49 -0
  761. package/backend/dist/utils/dataDirectory.d.ts.map +1 -0
  762. package/backend/dist/utils/dataDirectory.js +291 -0
  763. package/backend/dist/utils/dataDirectory.js.map +1 -0
  764. package/backend/dist/utils/generationUtils.d.ts.map +1 -1
  765. package/backend/dist/utils/generationUtils.js +18 -6
  766. package/backend/dist/utils/generationUtils.js.map +1 -1
  767. package/backend/dist/utils/jwt.d.ts.map +1 -1
  768. package/backend/dist/utils/jwt.js +2 -3
  769. package/backend/dist/utils/jwt.js.map +1 -1
  770. package/backend/dist/utils/ollamaModelDefaults.d.ts.map +1 -1
  771. package/backend/dist/utils/ollamaModelDefaults.js +2 -7
  772. package/backend/dist/utils/ollamaModelDefaults.js.map +1 -1
  773. package/backend/dist/utils/ollamaStreaming.d.ts +2 -1
  774. package/backend/dist/utils/ollamaStreaming.d.ts.map +1 -1
  775. package/backend/dist/utils/ollamaStreaming.js +49 -11
  776. package/backend/dist/utils/ollamaStreaming.js.map +1 -1
  777. package/backend/dist/utils/pluginConnectionVariables.d.ts.map +1 -1
  778. package/backend/dist/utils/pluginConnectionVariables.js +11 -3
  779. package/backend/dist/utils/pluginConnectionVariables.js.map +1 -1
  780. package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
  781. package/backend/dist/utils/pluginDefinitionTrust.js +4 -3
  782. package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
  783. package/backend/dist/utils/pluginStreaming.d.ts +2 -1
  784. package/backend/dist/utils/pluginStreaming.d.ts.map +1 -1
  785. package/backend/dist/utils/pluginStreaming.js +5 -1
  786. package/backend/dist/utils/pluginStreaming.js.map +1 -1
  787. package/backend/dist/utils/pluginUpload.d.ts +1 -0
  788. package/backend/dist/utils/pluginUpload.d.ts.map +1 -1
  789. package/backend/dist/utils/pluginUpload.js +9 -2
  790. package/backend/dist/utils/pluginUpload.js.map +1 -1
  791. package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
  792. package/backend/dist/utils/pluginValidation.js +29 -1
  793. package/backend/dist/utils/pluginValidation.js.map +1 -1
  794. package/backend/dist/utils/sttAudioUpload.d.ts +24 -0
  795. package/backend/dist/utils/sttAudioUpload.d.ts.map +1 -0
  796. package/backend/dist/utils/sttAudioUpload.js +500 -0
  797. package/backend/dist/utils/sttAudioUpload.js.map +1 -0
  798. package/backend/dist/utils/ttsVoiceCloneUpload.d.ts +34 -0
  799. package/backend/dist/utils/ttsVoiceCloneUpload.d.ts.map +1 -0
  800. package/backend/dist/utils/ttsVoiceCloneUpload.js +224 -0
  801. package/backend/dist/utils/ttsVoiceCloneUpload.js.map +1 -0
  802. package/backend/dist/utils/websocketMessages.d.ts +2 -1
  803. package/backend/dist/utils/websocketMessages.d.ts.map +1 -1
  804. package/backend/dist/utils/websocketMessages.js +16 -2
  805. package/backend/dist/utils/websocketMessages.js.map +1 -1
  806. package/backend/dist/websocketServer.d.ts +4 -1
  807. package/backend/dist/websocketServer.d.ts.map +1 -1
  808. package/backend/dist/websocketServer.js +290 -44
  809. package/backend/dist/websocketServer.js.map +1 -1
  810. package/backend/dist/workTerminalServer.d.ts +9 -0
  811. package/backend/dist/workTerminalServer.d.ts.map +1 -1
  812. package/backend/dist/workTerminalServer.js +221 -52
  813. package/backend/dist/workTerminalServer.js.map +1 -1
  814. package/backend/dist/worker.d.ts +2 -0
  815. package/backend/dist/worker.d.ts.map +1 -0
  816. package/backend/dist/worker.js +250 -0
  817. package/backend/dist/worker.js.map +1 -0
  818. package/backend/package.json +19 -9
  819. package/bin/cli.js +126 -99
  820. package/bin/runtime-paths.js +108 -0
  821. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  822. package/frontend/dist/artifact-runtime/framer-motion.js +5 -5
  823. package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
  824. package/frontend/dist/assets/index-CUhEG7E2.js +33 -0
  825. package/frontend/dist/assets/index-kxtZQLV6.css +1 -0
  826. package/frontend/dist/assets/{markdown-math-ClQbWekD.css → markdown-math-ClTedVi7.css} +1 -1
  827. package/frontend/dist/index.html +18 -18
  828. package/frontend/dist/js/{ArtifactContainer-Dy2Q0iIL.js → ArtifactContainer-BTEDhBnv.js} +1 -1
  829. package/frontend/dist/js/{ArtifactDemoPage-K79dWshB.js → ArtifactDemoPage-B0gN3YTl.js} +1 -1
  830. package/frontend/dist/js/{ArtifactSandboxFrame-DhqLNUtY.js → ArtifactSandboxFrame-CLBXQkZs.js} +3 -3
  831. package/frontend/dist/js/{ArtifactSlideOutPanel-Cl8JG7bz.js → ArtifactSlideOutPanel-CfqHPFdE.js} +1 -1
  832. package/frontend/dist/js/{Button-CTXHujOd.js → Button-BV44cTnj.js} +1 -1
  833. package/frontend/dist/js/ChatPage-DIkAXZWA.js +23 -0
  834. package/frontend/dist/js/{FirstTimeSetup-kHhRzGJ8.js → FirstTimeSetup-B8phXGNA.js} +1 -1
  835. package/frontend/dist/js/GalleryPage-W4uI043I.js +1 -0
  836. package/frontend/dist/js/{HomePage-C1L8WAXL.js → HomePage-DlxehbyO.js} +1 -1
  837. package/frontend/dist/js/{LibreClawPage-Dyua8IUu.js → LibreClawPage-CgD0_G_F.js} +1 -1
  838. package/frontend/dist/js/{ModelManagerModals-CuMRGUd-.js → ModelManagerModals-D7jIT3v1.js} +1 -1
  839. package/frontend/dist/js/{ModelSelector-CqHc-Ln4.js → ModelSelector-BYxJU1UV.js} +1 -1
  840. package/frontend/dist/js/ModelsPage-C4XdCKP5.js +2 -0
  841. package/frontend/dist/js/NotesPage-CDECOl4V.js +1 -0
  842. package/frontend/dist/js/{OptimizedSyntaxHighlighter-CWYUn9Oe.js → OptimizedSyntaxHighlighter-XwqZEoTf.js} +1 -1
  843. package/frontend/dist/js/{PersonasPage-D_6WBCH5.js → PersonasPage-CjSLPrgS.js} +2 -2
  844. package/frontend/dist/js/PluginUsagePage-DJOXJuH4.js +1 -0
  845. package/frontend/dist/js/RichMessageContent-Debeh6bi.js +3 -0
  846. package/frontend/dist/js/SettingsModal-cUqAeYUP.js +1 -0
  847. package/frontend/dist/js/{SettingsToggle-DLHlCDBl.js → SettingsToggle-WTa0rgvY.js} +1 -1
  848. package/frontend/dist/js/{SystemPage-BMWEet9e.js → SystemPage-DxPw0GS7.js} +1 -1
  849. package/frontend/dist/js/UserManagementPage-CEdYFe_Z.js +1 -0
  850. package/frontend/dist/js/WorkPage-DDVeuG_9.js +6 -0
  851. package/frontend/dist/js/api-IzobHGND.js +14 -0
  852. package/frontend/dist/js/appStore-DKwC2vgn.js +2 -0
  853. package/frontend/dist/js/ar-xTSvTq05.js +2 -0
  854. package/frontend/dist/js/authStore-OaTuapL7.js +4 -0
  855. package/frontend/dist/js/{babel-CmENXdZw.js → babel-D24oDI9y.js} +1 -1
  856. package/frontend/dist/js/bn-iYAsohEA.js +2 -0
  857. package/frontend/dist/js/chatStore-DXGUVLXD.js +3 -0
  858. package/frontend/dist/js/{config-DkV1ka7I.js → config-DPEEuTAe.js} +1 -1
  859. package/frontend/dist/js/cs-YBHN88Hb.js +2 -0
  860. package/frontend/dist/js/da-D7qlLy_k.js +2 -0
  861. package/frontend/dist/js/de-DV671k2c.js +2 -0
  862. package/frontend/dist/js/es-kyBgzNq-.js +2 -0
  863. package/frontend/dist/js/{estree-D5KP-qbw.js → estree-ChwJsD2w.js} +1 -1
  864. package/frontend/dist/js/fr-Cw1vut7I.js +2 -0
  865. package/frontend/dist/js/hi-DWEFC024.js +2 -0
  866. package/frontend/dist/js/{html-Cm9c2akd.js → html-DFrVjciF.js} +1 -1
  867. package/frontend/dist/js/id-DlMHjjy0.js +2 -0
  868. package/frontend/dist/js/is-B9E_a7dG.js +2 -0
  869. package/frontend/dist/js/it-DawmVbLC.js +2 -0
  870. package/frontend/dist/js/ja-DmVvwY3W.js +2 -0
  871. package/frontend/dist/js/ko-DzOPpkVs.js +2 -0
  872. package/frontend/dist/js/{markdown-B2u7CnKN.js → markdown-FLLx7b67.js} +1 -1
  873. package/frontend/dist/js/markdown-core-BmPPZiuD.js +31 -0
  874. package/frontend/dist/js/{markdown-math-B7FlYsmr.js → markdown-math-mH7AZ_mb.js} +6 -6
  875. package/frontend/dist/js/{messageCodeStyles-DalG2j6U.js → messageCodeStyles-CBkkZY4n.js} +1 -1
  876. package/frontend/dist/js/ms-DpsaOPht.js +2 -0
  877. package/frontend/dist/js/nl-B1d8W22n.js +2 -0
  878. package/frontend/dist/js/pl-nCncRVgt.js +2 -0
  879. package/frontend/dist/js/{postcss-B5WIGhAY.js → postcss-Bx9CTcIc.js} +1 -1
  880. package/frontend/dist/js/pt-DHw8fGuu.js +2 -0
  881. package/frontend/dist/js/{react-vendor-DPNXrO-8.js → react-vendor-C5yShNlM.js} +1 -1
  882. package/frontend/dist/js/{router-vendor-Ca9zqOqT.js → router-vendor-CbPDks39.js} +1 -1
  883. package/frontend/dist/js/ru-Derl_YP_.js +2 -0
  884. package/frontend/dist/js/{standalone-Dwm1daef.js → standalone-i8-5bg5p.js} +1 -1
  885. package/frontend/dist/js/sv-pJAfBVo0.js +2 -0
  886. package/frontend/dist/js/{syntax-highlight-Ca9bHsaz.js → syntax-highlight-3EEX6CGL.js} +3 -3
  887. package/frontend/dist/js/th-C_7fIGnk.js +2 -0
  888. package/frontend/dist/js/tr-CPqsJvaP.js +2 -0
  889. package/frontend/dist/js/{typescript-CwieSptM.js → typescript-CQ3x-Uni.js} +1 -1
  890. package/frontend/dist/js/{ui-BnDZpjfc.js → ui-BHhR3Vok.js} +2 -2
  891. package/frontend/dist/js/ui-vendor-D3Ahl1x5.js +177 -0
  892. package/frontend/dist/js/uk-3o8P_kFi.js +2 -0
  893. package/frontend/dist/js/{useTranslation-CXY69qNk.js → useTranslation-C3ei3mJq.js} +1 -1
  894. package/frontend/dist/js/{utils-BM0_0iFj.js → utils-CuC1beTY.js} +1 -1
  895. package/frontend/dist/js/{utils-vendor-1zob7nK9.js → utils-vendor-BBa8OxtB.js} +1 -1
  896. package/frontend/dist/js/vi-Dv6N7OVD.js +2 -0
  897. package/frontend/dist/js/{workApi-BOS7crs9.js → workApi-Czu69yWS.js} +2 -2
  898. package/frontend/dist/js/{yaml-QD4znPfZ.js → yaml-DioTxVLA.js} +1 -1
  899. package/frontend/dist/js/zh-qg5iqtPi.js +2 -0
  900. package/package.json +16 -5
  901. package/plugins/huggingface.json +12 -3
  902. package/plugins/llama-cpp.json +18 -6
  903. package/plugins/longcat-audiodit.json +114 -0
  904. package/plugins/openai.json +18 -0
  905. package/frontend/dist/assets/index-BBpNbfKW.js +0 -16
  906. package/frontend/dist/assets/index-BLATyFmD.css +0 -1
  907. package/frontend/dist/js/ChatPage-BBayfMLS.js +0 -16
  908. package/frontend/dist/js/GalleryPage-By8VI39Q.js +0 -1
  909. package/frontend/dist/js/ModelsPage-ODeXhDDk.js +0 -2
  910. package/frontend/dist/js/NotesPage-CApzDjOq.js +0 -1
  911. package/frontend/dist/js/PluginUsagePage-kutS6SOd.js +0 -1
  912. package/frontend/dist/js/RichMessageContent-g6WT75Te.js +0 -3
  913. package/frontend/dist/js/SettingsModal-B7z51BCx.js +0 -1
  914. package/frontend/dist/js/UserManagementPage-D08lM51c.js +0 -1
  915. package/frontend/dist/js/WorkPage-DdVLefsK.js +0 -6
  916. package/frontend/dist/js/api-CLEmGcEh.js +0 -14
  917. package/frontend/dist/js/appStore-CGdhvp9P.js +0 -2
  918. package/frontend/dist/js/ar-BTmB2WVm.js +0 -2
  919. package/frontend/dist/js/authStore-Dh3beEOq.js +0 -4
  920. package/frontend/dist/js/bn-CQnH7YVT.js +0 -2
  921. package/frontend/dist/js/chatStore-CDeYWL_q.js +0 -3
  922. package/frontend/dist/js/cs-oTTZkQXr.js +0 -2
  923. package/frontend/dist/js/da-Br0gB6J6.js +0 -2
  924. package/frontend/dist/js/de-DE2iztTF.js +0 -2
  925. package/frontend/dist/js/es-DgthfVtl.js +0 -2
  926. package/frontend/dist/js/fr-BjxjFwPh.js +0 -2
  927. package/frontend/dist/js/hi-D1q7E-9N.js +0 -2
  928. package/frontend/dist/js/id-CDJZqLTF.js +0 -2
  929. package/frontend/dist/js/is-BU7Um_Tq.js +0 -2
  930. package/frontend/dist/js/it-CdAxr8P_.js +0 -2
  931. package/frontend/dist/js/ja-BLbQwz9u.js +0 -2
  932. package/frontend/dist/js/ko-CY5lpkAe.js +0 -2
  933. package/frontend/dist/js/markdown-core-DHnR5Hw8.js +0 -16
  934. package/frontend/dist/js/ms-tQ8AYXEQ.js +0 -2
  935. package/frontend/dist/js/nl-CRNi2oWT.js +0 -2
  936. package/frontend/dist/js/pl-CWtFRS_W.js +0 -2
  937. package/frontend/dist/js/pt-C7SPoLF8.js +0 -2
  938. package/frontend/dist/js/ru-Dz4AX8xc.js +0 -2
  939. package/frontend/dist/js/sv-ETy5-boa.js +0 -2
  940. package/frontend/dist/js/th-DpuMqvxU.js +0 -2
  941. package/frontend/dist/js/tr-C-1AYAqg.js +0 -2
  942. package/frontend/dist/js/ui-vendor-xUzKqAXI.js +0 -177
  943. package/frontend/dist/js/uk-CyS680gr.js +0 -2
  944. package/frontend/dist/js/vi-BG8HuiTz.js +0 -2
  945. package/frontend/dist/js/zh-NCs2mkHj.js +0 -2
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{d as t,f as n}from"./markdown-core-DHnR5Hw8.js";import{t as ee}from"./useTranslation-CXY69qNk.js";import{Bt as r,Kt as i,O as a,St as o,Tn as s,f as c,l,pt as u,sn as d,t as f,vn as p,zt as m}from"./ui-vendor-xUzKqAXI.js";import{t as h}from"./logger-DSXjF4ye.js";import{C as g}from"./api-CLEmGcEh.js";import{n as _}from"./authStore-Dh3beEOq.js";import{i as v,l as y,n as b,r as x,u as S}from"../assets/index-BBpNbfKW.js";var C=e(n(),1),w=t(),T=h(`components:first-time-setup`),E=({onComplete:e})=>{let{t}=ee(),[n,h]=(0,C.useState)(`welcome`),[E,D]=(0,C.useState)(``),[O,k]=(0,C.useState)(``),[A,j]=(0,C.useState)(``),[M,N]=(0,C.useState)(!1),[P,F]=(0,C.useState)(!1),[I,L]=(0,C.useState)(!1),[R,z]=(0,C.useState)(null),[B,V]=(0,C.useState)(!1),[H,U]=(0,C.useState)(!1),[W,G]=(0,C.useState)(``),{login:K,systemInfo:q}=_(),J=q?.turnstile?.siteKey,Y=!!(q?.turnstile?.enabled&&J),X=(0,C.useCallback)(e=>{G(e)},[]),Z=(0,C.useMemo)(()=>I||Y&&!W,[I,Y,W]);(0,C.useEffect)(()=>{n===`encryption-key`&&!R&&g.getEncryptionKey().then(e=>{e.success&&e.data&&z(e.data.encryptionKey)})},[n,R]);let Q=async e=>{if(e.preventDefault(),!E.trim()||!O.trim()||!A.trim()){s.error(t(`setup.admin.fillAllFields`));return}if(O!==A){s.error(t(`auth.signup.passwordMismatch`));return}let n=x(O);if(n){s.error(n);return}if(Y&&!W){s.error(t(`auth.signup.tryAgain`));return}L(!0);try{let e=await g.signup({username:E,password:O,email:``,turnstileToken:W});if(e.success&&e.data){if(!(`token`in e.data)){s.error(t(`setup.admin.approvalUnexpected`,`The initial administrator could not be activated. Please try again.`));return}K(e.data.user,e.data.token,e.data.systemInfo),s.success(t(`setup.admin.success`)),h(`encryption-key`)}else s.error(e.message||t(`setup.admin.failed`))}catch(e){T.error(`Admin creation error:`,e),s.error(t(`setup.admin.failed`))}finally{G(``),L(!1)}},te=async()=>{if(R)try{await navigator.clipboard.writeText(R),V(!0),s.success(t(`setup.encryptionKey.copied`)),setTimeout(()=>V(!1),3e3)}catch{s.error(t(`setup.encryptionKey.copyFailed`))}},ne=()=>{if(!H){s.error(t(`setup.encryptionKey.confirmRequired`));return}e?.()},$=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return n===`welcome`?(0,w.jsxs)(`div`,{className:`min-h-screen bg-gray-50 px-4 py-16 dark:bg-dark-50 sm:px-6 lg:flex lg:flex-col lg:justify-center lg:py-20`,children:[(0,w.jsx)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:(0,w.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 text-gray-900 dark:text-gray-100`,children:[(0,w.jsx)(y,{size:`md`,label:null}),(0,w.jsx)(S,{})]})}),(0,w.jsx)(`div`,{className:`mt-10 sm:mx-auto sm:w-full sm:max-w-md`,children:(0,w.jsxs)(`div`,{className:`mx-auto w-full max-w-md rounded-2xl border border-gray-200/80 bg-white/80 p-6 shadow-sm backdrop-blur-xl dark:border-white/10 dark:bg-white/[0.04] sm:p-8`,children:[(0,w.jsxs)(`div`,{className:`mb-7 text-start`,children:[(0,w.jsx)(`h1`,{className:`mb-2 text-2xl font-normal tracking-[-0.03em] text-gray-950 dark:text-dark-950`,children:t(`setup.welcome.subtitle`)}),(0,w.jsx)(`p`,{className:`text-gray-600 dark:text-dark-500`,children:t(`setup.welcome.description`)})]}),(0,w.jsxs)(`div`,{className:`mb-7 divide-y divide-gray-200/70 border-y border-gray-200/70 dark:divide-white/[0.08] dark:border-white/[0.08]`,children:[(0,w.jsxs)(`div`,{className:`flex items-start gap-3 py-4`,children:[(0,w.jsx)(`div`,{className:`flex-shrink-0 mt-1`,children:(0,w.jsx)(a,{className:`h-5 w-5 text-primary-600 dark:text-primary-400`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-gray-900 dark:text-dark-950`,children:t(`setup.welcome.features.secure.title`)}),(0,w.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:t(`setup.welcome.features.secure.description`)})]})]}),(0,w.jsxs)(`div`,{className:`flex items-start gap-3 py-4`,children:[(0,w.jsx)(`div`,{className:`flex-shrink-0 mt-1`,children:(0,w.jsx)(f,{className:`h-5 w-5 text-primary-600 dark:text-primary-400`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-gray-900 dark:text-dark-950`,children:t(`setup.welcome.features.fast.title`)}),(0,w.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:t(`setup.welcome.features.fast.description`)})]})]}),(0,w.jsxs)(`div`,{className:`flex items-start gap-3 py-4`,children:[(0,w.jsx)(`div`,{className:`flex-shrink-0 mt-1`,children:(0,w.jsx)(o,{className:`h-5 w-5 text-primary-600 dark:text-primary-400`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-gray-900 dark:text-dark-950`,children:t(`setup.welcome.features.openSource.title`)}),(0,w.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:t(`setup.welcome.features.openSource.description`)})]})]})]}),(0,w.jsx)(`button`,{onClick:()=>h(`create-admin`),className:`flex min-h-11 w-full items-center justify-center rounded-xl border border-transparent bg-primary-600 px-4 py-2.5 text-sm font-medium text-white transition-colors duration-200 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2`,children:(0,w.jsxs)(`div`,{className:`flex items-center`,children:[(0,w.jsx)(`span`,{children:t(`setup.welcome.createAdmin`)}),(0,w.jsx)(p,{size:16,className:`ms-2 rtl:rotate-180`})]})})]})})]}):n===`encryption-key`?(0,w.jsxs)(`div`,{className:`min-h-screen bg-gray-50 px-4 py-16 dark:bg-dark-50 sm:px-6 lg:flex lg:flex-col lg:justify-center lg:py-20`,children:[(0,w.jsxs)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 text-gray-900 dark:text-gray-100`,children:[(0,w.jsx)(y,{size:`md`,label:null}),(0,w.jsx)(S,{})]}),(0,w.jsx)(`h2`,{className:`mt-8 text-center text-3xl font-light tracking-[-0.035em] text-gray-950 dark:text-dark-950`,children:t(`setup.encryptionKey.title`)})]}),(0,w.jsx)(`div`,{className:`mt-10 sm:mx-auto sm:w-full sm:max-w-lg`,children:(0,w.jsxs)(`div`,{className:`mx-auto w-full max-w-lg rounded-2xl border border-gray-200/80 bg-white/80 p-6 shadow-sm backdrop-blur-xl dark:border-white/10 dark:bg-white/[0.04] sm:p-8`,children:[(0,w.jsxs)(`div`,{className:`mb-7 text-start`,children:[(0,w.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,w.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-500/10 p-3 dark:border-amber-800/60 dark:bg-amber-900/20`,children:(0,w.jsx)(u,{className:`h-8 w-8 text-amber-600 dark:text-amber-400`})})}),(0,w.jsx)(`h1`,{className:`mb-2 text-2xl font-normal tracking-[-0.03em] text-gray-950 dark:text-dark-950`,children:t(`setup.encryptionKey.subtitle`)}),(0,w.jsx)(`p`,{className:`text-gray-600 dark:text-dark-500`,children:t(`setup.encryptionKey.description`)})]}),(0,w.jsx)(`div`,{className:`mb-6 rounded-xl border border-amber-200 bg-amber-500/10 p-4 dark:border-amber-800/60 dark:bg-amber-900/20`,children:(0,w.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,w.jsx)(c,{className:`h-5 w-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`}),(0,w.jsxs)(`div`,{className:`text-sm text-ink`,children:[(0,w.jsx)(`p`,{className:`font-medium mb-1`,children:t(`setup.encryptionKey.warning`)}),(0,w.jsx)(`p`,{children:t(`setup.encryptionKey.warningText`)})]})]})}),(0,w.jsxs)(`div`,{className:`mb-6`,children:[(0,w.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-700 mb-2`,children:t(`setup.encryptionKey.label`)}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`div`,{className:`w-full break-all rounded-xl border border-gray-200 bg-gray-50 px-3 py-3 pe-12 font-mono text-sm text-gray-900 dark:border-white/10 dark:bg-white/[0.035] dark:text-dark-800`,children:R||t(`setup.encryptionKey.loading`)}),(0,w.jsx)(`button`,{type:`button`,onClick:te,disabled:!R,className:`absolute end-2 top-1/2 -translate-y-1/2 p-2 text-gray-500 hover:text-gray-700 disabled:opacity-50 dark:text-dark-500 dark:hover:text-dark-700`,title:t(`setup.encryptionKey.copyToClipboard`),children:B?(0,w.jsx)(d,{className:`h-5 w-5 text-green-500`}):(0,w.jsx)(i,{className:`h-5 w-5`})})]}),(0,w.jsx)(`p`,{className:`mt-2 text-xs text-gray-500 dark:text-dark-500`,children:t(`setup.encryptionKey.envNote`)})]}),(0,w.jsx)(`div`,{className:`mb-6`,children:(0,w.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked),className:`mt-1 h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 dark:border-dark-300 rounded`}),(0,w.jsx)(`span`,{className:`text-sm text-gray-700 dark:text-dark-700`,children:t(`setup.encryptionKey.acknowledgment`)})]})}),(0,w.jsx)(`button`,{onClick:ne,disabled:!H,className:`flex min-h-11 w-full items-center justify-center rounded-xl border border-transparent bg-primary-600 px-4 py-2.5 text-sm font-medium text-white transition-colors duration-200 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:(0,w.jsxs)(`div`,{className:`flex items-center`,children:[(0,w.jsx)(`span`,{children:t(`setup.encryptionKey.continue`)}),(0,w.jsx)(p,{size:16,className:`ms-2 rtl:rotate-180`})]})})]})})]}):(0,w.jsxs)(`div`,{className:`min-h-screen bg-gray-50 px-4 py-16 dark:bg-dark-50 sm:px-6 lg:flex lg:flex-col lg:justify-center lg:py-20`,children:[(0,w.jsxs)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 text-gray-900 dark:text-gray-100`,children:[(0,w.jsx)(y,{size:`md`,label:null}),(0,w.jsx)(S,{})]}),(0,w.jsx)(`h2`,{className:`mt-8 text-center text-3xl font-light tracking-[-0.035em] text-gray-950 dark:text-dark-950`,children:t(`setup.admin.title`)})]}),(0,w.jsx)(`div`,{className:`mt-10 sm:mx-auto sm:w-full sm:max-w-md`,children:(0,w.jsxs)(`div`,{className:`mx-auto w-full max-w-md rounded-2xl border border-gray-200/80 bg-white/80 p-6 shadow-sm backdrop-blur-xl dark:border-white/10 dark:bg-white/[0.04] sm:p-8`,children:[(0,w.jsxs)(`div`,{className:`mb-7 text-start`,children:[(0,w.jsx)(`h1`,{className:`mb-2 text-2xl font-normal tracking-[-0.03em] text-gray-950 dark:text-dark-950`,children:t(`setup.admin.subtitle`)}),(0,w.jsx)(`p`,{className:`text-gray-600 dark:text-dark-500`,children:t(`setup.admin.description`)})]}),(0,w.jsxs)(`form`,{onSubmit:Q,className:`space-y-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`username`,className:`block text-sm font-medium text-gray-700 dark:text-dark-700 mb-2`,children:t(`auth.login.username`)}),(0,w.jsx)(`input`,{id:`username`,type:`text`,value:E,onChange:e=>D(e.target.value),onKeyDown:$,className:`w-full rounded-xl border border-gray-200 bg-white/80 px-3 py-2.5 text-gray-900 transition-colors duration-200 focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 dark:border-white/10 dark:bg-white/[0.04] dark:text-dark-800`,placeholder:t(`setup.admin.usernamePlaceholder`),required:!0,disabled:I})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`password`,className:`block text-sm font-medium text-gray-700 dark:text-dark-700 mb-2`,children:t(`auth.login.password`)}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`input`,{id:`password`,type:M?`text`:`password`,value:O,onChange:e=>k(e.target.value),onKeyDown:$,className:`w-full rounded-xl border border-gray-200 bg-white/80 px-3 py-2.5 pe-10 text-gray-900 transition-colors duration-200 focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 dark:border-white/10 dark:bg-white/[0.04] dark:text-dark-800`,placeholder:t(`setup.admin.passwordPlaceholder`),required:!0,disabled:I}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>N(!M),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-gray-400 hover:text-gray-600 dark:text-dark-500 dark:hover:text-dark-700`,disabled:I,children:M?(0,w.jsx)(r,{size:20}):(0,w.jsx)(m,{size:20})})]}),(0,w.jsx)(`p`,{className:`mt-1.5 text-xs text-gray-500 dark:text-dark-500`,children:b})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`confirmPassword`,className:`block text-sm font-medium text-gray-700 dark:text-dark-700 mb-2`,children:t(`auth.signup.confirmPassword`)}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`input`,{id:`confirmPassword`,type:P?`text`:`password`,value:A,onChange:e=>j(e.target.value),onKeyDown:$,className:`w-full rounded-xl border border-gray-200 bg-white/80 px-3 py-2.5 pe-10 text-gray-900 transition-colors duration-200 focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 dark:border-white/10 dark:bg-white/[0.04] dark:text-dark-800`,placeholder:t(`setup.admin.confirmPlaceholder`),required:!0,disabled:I}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>F(!P),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-gray-400 hover:text-gray-600 dark:text-dark-500 dark:hover:text-dark-700`,disabled:I,children:P?(0,w.jsx)(r,{size:20}):(0,w.jsx)(m,{size:20})})]})]}),Y&&J&&(0,w.jsx)(v,{siteKey:J,action:`signup`,disabled:I,errorMessage:t(`auth.signup.tryAgain`),onTokenChange:X}),(0,w.jsxs)(`div`,{className:`flex gap-3`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>h(`welcome`),disabled:I,className:`min-h-11 flex-1 rounded-xl border border-gray-200 bg-transparent px-4 py-2.5 text-sm font-medium text-gray-700 transition-colors duration-200 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:text-dark-700 dark:hover:bg-white/[0.06]`,children:t(`common.back`)}),(0,w.jsx)(`button`,{type:`submit`,disabled:Z,className:`flex min-h-11 flex-1 items-center justify-center rounded-xl border border-transparent bg-primary-600 px-4 py-2.5 text-sm font-medium text-white transition-colors duration-200 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:I?(0,w.jsxs)(`div`,{className:`flex items-center`,children:[(0,w.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-white`}),t(`setup.admin.creating`)]}):(0,w.jsxs)(`div`,{className:`flex items-center`,children:[(0,w.jsx)(l,{size:16,className:`me-2`}),t(`setup.admin.createAdmin`)]})})]})]}),(0,w.jsx)(`div`,{className:`mt-6 text-center`,children:(0,w.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:t(`setup.admin.note`)})})]})})]})};export{E as FirstTimeSetup};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{t as r}from"./useTranslation-C3ei3mJq.js";import{Bt as i,En as a,Kt as o,O as s,St as ee,f as c,l,pt as u,sn as d,t as f,yn as p,zt as m}from"./ui-vendor-D3Ahl1x5.js";import{t as h}from"./logger-DSXjF4ye.js";import{T as g}from"./api-IzobHGND.js";import{n as _}from"./authStore-OaTuapL7.js";import{g as v,h as y,i as b,n as x,r as S}from"../assets/index-CUhEG7E2.js";var C=e(t(),1),w=n(),T=h(`components:first-time-setup`),E=({onComplete:e})=>{let{t}=r(),[n,h]=(0,C.useState)(`welcome`),[E,D]=(0,C.useState)(``),[O,k]=(0,C.useState)(``),[A,j]=(0,C.useState)(``),[M,N]=(0,C.useState)(!1),[P,F]=(0,C.useState)(!1),[I,L]=(0,C.useState)(!1),[R,z]=(0,C.useState)(null),[B,V]=(0,C.useState)(!1),[H,U]=(0,C.useState)(!1),[W,G]=(0,C.useState)(``),{login:K,systemInfo:q}=_(),J=q?.turnstile?.siteKey,Y=!!(q?.turnstile?.enabled&&J),X=(0,C.useCallback)(e=>{G(e)},[]),Z=(0,C.useMemo)(()=>I||Y&&!W,[I,Y,W]);(0,C.useEffect)(()=>{n===`encryption-key`&&!R&&g.getEncryptionKey().then(e=>{e.success&&e.data&&z(e.data.encryptionKey)})},[n,R]);let Q=async e=>{if(e.preventDefault(),!E.trim()||!O.trim()||!A.trim()){a.error(t(`setup.admin.fillAllFields`));return}if(O!==A){a.error(t(`auth.signup.passwordMismatch`));return}let n=S(O);if(n){a.error(n);return}if(Y&&!W){a.error(t(`auth.signup.tryAgain`));return}L(!0);try{let e=await g.signup({username:E,password:O,email:``,turnstileToken:W});if(e.success&&e.data){if(!(`token`in e.data)){a.error(t(`setup.admin.approvalUnexpected`,`The initial administrator could not be activated. Please try again.`));return}K(e.data.user,e.data.token,e.data.systemInfo),a.success(t(`setup.admin.success`)),h(`encryption-key`)}else a.error(e.message||t(`setup.admin.failed`))}catch(e){T.error(`Admin creation error:`,e),a.error(t(`setup.admin.failed`))}finally{G(``),L(!1)}},te=async()=>{if(R)try{await navigator.clipboard.writeText(R),V(!0),a.success(t(`setup.encryptionKey.copied`)),setTimeout(()=>V(!1),3e3)}catch{a.error(t(`setup.encryptionKey.copyFailed`))}},ne=()=>{if(!H){a.error(t(`setup.encryptionKey.confirmRequired`));return}e?.()},$=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return n===`welcome`?(0,w.jsxs)(`div`,{className:`min-h-screen bg-gray-50 px-4 py-16 dark:bg-dark-50 sm:px-6 lg:flex lg:flex-col lg:justify-center lg:py-20`,children:[(0,w.jsx)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:(0,w.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 text-gray-900 dark:text-gray-100`,children:[(0,w.jsx)(y,{size:`md`,label:null}),(0,w.jsx)(v,{})]})}),(0,w.jsx)(`div`,{className:`mt-10 sm:mx-auto sm:w-full sm:max-w-md`,children:(0,w.jsxs)(`div`,{className:`mx-auto w-full max-w-md rounded-2xl border border-gray-200/80 bg-white/80 p-6 shadow-sm backdrop-blur-xl dark:border-white/10 dark:bg-white/[0.04] sm:p-8`,children:[(0,w.jsxs)(`div`,{className:`mb-7 text-start`,children:[(0,w.jsx)(`h1`,{className:`mb-2 text-2xl font-normal tracking-[-0.03em] text-gray-950 dark:text-dark-950`,children:t(`setup.welcome.subtitle`)}),(0,w.jsx)(`p`,{className:`text-gray-600 dark:text-dark-500`,children:t(`setup.welcome.description`)})]}),(0,w.jsxs)(`div`,{className:`mb-7 divide-y divide-gray-200/70 border-y border-gray-200/70 dark:divide-white/[0.08] dark:border-white/[0.08]`,children:[(0,w.jsxs)(`div`,{className:`flex items-start gap-3 py-4`,children:[(0,w.jsx)(`div`,{className:`flex-shrink-0 mt-1`,children:(0,w.jsx)(s,{className:`h-5 w-5 text-primary-600 dark:text-primary-400`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-gray-900 dark:text-dark-950`,children:t(`setup.welcome.features.secure.title`)}),(0,w.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:t(`setup.welcome.features.secure.description`)})]})]}),(0,w.jsxs)(`div`,{className:`flex items-start gap-3 py-4`,children:[(0,w.jsx)(`div`,{className:`flex-shrink-0 mt-1`,children:(0,w.jsx)(f,{className:`h-5 w-5 text-primary-600 dark:text-primary-400`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-gray-900 dark:text-dark-950`,children:t(`setup.welcome.features.fast.title`)}),(0,w.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:t(`setup.welcome.features.fast.description`)})]})]}),(0,w.jsxs)(`div`,{className:`flex items-start gap-3 py-4`,children:[(0,w.jsx)(`div`,{className:`flex-shrink-0 mt-1`,children:(0,w.jsx)(ee,{className:`h-5 w-5 text-primary-600 dark:text-primary-400`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-gray-900 dark:text-dark-950`,children:t(`setup.welcome.features.openSource.title`)}),(0,w.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:t(`setup.welcome.features.openSource.description`)})]})]})]}),(0,w.jsx)(`button`,{onClick:()=>h(`create-admin`),className:`flex min-h-11 w-full items-center justify-center rounded-xl border border-transparent bg-primary-600 px-4 py-2.5 text-sm font-medium text-white transition-colors duration-200 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2`,children:(0,w.jsxs)(`div`,{className:`flex items-center`,children:[(0,w.jsx)(`span`,{children:t(`setup.welcome.createAdmin`)}),(0,w.jsx)(p,{size:16,className:`ms-2 rtl:rotate-180`})]})})]})})]}):n===`encryption-key`?(0,w.jsxs)(`div`,{className:`min-h-screen bg-gray-50 px-4 py-16 dark:bg-dark-50 sm:px-6 lg:flex lg:flex-col lg:justify-center lg:py-20`,children:[(0,w.jsxs)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 text-gray-900 dark:text-gray-100`,children:[(0,w.jsx)(y,{size:`md`,label:null}),(0,w.jsx)(v,{})]}),(0,w.jsx)(`h2`,{className:`mt-8 text-center text-3xl font-light tracking-[-0.035em] text-gray-950 dark:text-dark-950`,children:t(`setup.encryptionKey.title`)})]}),(0,w.jsx)(`div`,{className:`mt-10 sm:mx-auto sm:w-full sm:max-w-lg`,children:(0,w.jsxs)(`div`,{className:`mx-auto w-full max-w-lg rounded-2xl border border-gray-200/80 bg-white/80 p-6 shadow-sm backdrop-blur-xl dark:border-white/10 dark:bg-white/[0.04] sm:p-8`,children:[(0,w.jsxs)(`div`,{className:`mb-7 text-start`,children:[(0,w.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,w.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-500/10 p-3 dark:border-amber-800/60 dark:bg-amber-900/20`,children:(0,w.jsx)(u,{className:`h-8 w-8 text-amber-600 dark:text-amber-400`})})}),(0,w.jsx)(`h1`,{className:`mb-2 text-2xl font-normal tracking-[-0.03em] text-gray-950 dark:text-dark-950`,children:t(`setup.encryptionKey.subtitle`)}),(0,w.jsx)(`p`,{className:`text-gray-600 dark:text-dark-500`,children:t(`setup.encryptionKey.description`)})]}),(0,w.jsx)(`div`,{className:`mb-6 rounded-xl border border-amber-200 bg-amber-500/10 p-4 dark:border-amber-800/60 dark:bg-amber-900/20`,children:(0,w.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,w.jsx)(c,{className:`h-5 w-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5`}),(0,w.jsxs)(`div`,{className:`text-sm text-ink`,children:[(0,w.jsx)(`p`,{className:`font-medium mb-1`,children:t(`setup.encryptionKey.warning`)}),(0,w.jsx)(`p`,{children:t(`setup.encryptionKey.warningText`)})]})]})}),(0,w.jsxs)(`div`,{className:`mb-6`,children:[(0,w.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-700 mb-2`,children:t(`setup.encryptionKey.label`)}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`div`,{className:`w-full break-all rounded-xl border border-gray-200 bg-gray-50 px-3 py-3 pe-12 font-mono text-sm text-gray-900 dark:border-white/10 dark:bg-white/[0.035] dark:text-dark-800`,children:R||t(`setup.encryptionKey.loading`)}),(0,w.jsx)(`button`,{type:`button`,onClick:te,disabled:!R,className:`absolute end-2 top-1/2 -translate-y-1/2 p-2 text-gray-500 hover:text-gray-700 disabled:opacity-50 dark:text-dark-500 dark:hover:text-dark-700`,title:t(`setup.encryptionKey.copyToClipboard`),children:B?(0,w.jsx)(d,{className:`h-5 w-5 text-green-500`}):(0,w.jsx)(o,{className:`h-5 w-5`})})]}),(0,w.jsx)(`p`,{className:`mt-2 text-xs text-gray-500 dark:text-dark-500`,children:t(`setup.encryptionKey.envNote`)})]}),(0,w.jsx)(`div`,{className:`mb-6`,children:(0,w.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked),className:`mt-1 h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 dark:border-dark-300 rounded`}),(0,w.jsx)(`span`,{className:`text-sm text-gray-700 dark:text-dark-700`,children:t(`setup.encryptionKey.acknowledgment`)})]})}),(0,w.jsx)(`button`,{onClick:ne,disabled:!H,className:`flex min-h-11 w-full items-center justify-center rounded-xl border border-transparent bg-primary-600 px-4 py-2.5 text-sm font-medium text-white transition-colors duration-200 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:(0,w.jsxs)(`div`,{className:`flex items-center`,children:[(0,w.jsx)(`span`,{children:t(`setup.encryptionKey.continue`)}),(0,w.jsx)(p,{size:16,className:`ms-2 rtl:rotate-180`})]})})]})})]}):(0,w.jsxs)(`div`,{className:`min-h-screen bg-gray-50 px-4 py-16 dark:bg-dark-50 sm:px-6 lg:flex lg:flex-col lg:justify-center lg:py-20`,children:[(0,w.jsxs)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-center gap-2.5 text-gray-900 dark:text-gray-100`,children:[(0,w.jsx)(y,{size:`md`,label:null}),(0,w.jsx)(v,{})]}),(0,w.jsx)(`h2`,{className:`mt-8 text-center text-3xl font-light tracking-[-0.035em] text-gray-950 dark:text-dark-950`,children:t(`setup.admin.title`)})]}),(0,w.jsx)(`div`,{className:`mt-10 sm:mx-auto sm:w-full sm:max-w-md`,children:(0,w.jsxs)(`div`,{className:`mx-auto w-full max-w-md rounded-2xl border border-gray-200/80 bg-white/80 p-6 shadow-sm backdrop-blur-xl dark:border-white/10 dark:bg-white/[0.04] sm:p-8`,children:[(0,w.jsxs)(`div`,{className:`mb-7 text-start`,children:[(0,w.jsx)(`h1`,{className:`mb-2 text-2xl font-normal tracking-[-0.03em] text-gray-950 dark:text-dark-950`,children:t(`setup.admin.subtitle`)}),(0,w.jsx)(`p`,{className:`text-gray-600 dark:text-dark-500`,children:t(`setup.admin.description`)})]}),(0,w.jsxs)(`form`,{onSubmit:Q,className:`space-y-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`username`,className:`block text-sm font-medium text-gray-700 dark:text-dark-700 mb-2`,children:t(`auth.login.username`)}),(0,w.jsx)(`input`,{id:`username`,type:`text`,value:E,onChange:e=>D(e.target.value),onKeyDown:$,className:`w-full rounded-xl border border-gray-200 bg-white/80 px-3 py-2.5 text-gray-900 transition-colors duration-200 focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 dark:border-white/10 dark:bg-white/[0.04] dark:text-dark-800`,placeholder:t(`setup.admin.usernamePlaceholder`),required:!0,disabled:I})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`password`,className:`block text-sm font-medium text-gray-700 dark:text-dark-700 mb-2`,children:t(`auth.login.password`)}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`input`,{id:`password`,type:M?`text`:`password`,value:O,onChange:e=>k(e.target.value),onKeyDown:$,className:`w-full rounded-xl border border-gray-200 bg-white/80 px-3 py-2.5 pe-10 text-gray-900 transition-colors duration-200 focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 dark:border-white/10 dark:bg-white/[0.04] dark:text-dark-800`,placeholder:t(`setup.admin.passwordPlaceholder`),required:!0,disabled:I}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>N(!M),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-gray-400 hover:text-gray-600 dark:text-dark-500 dark:hover:text-dark-700`,disabled:I,children:M?(0,w.jsx)(i,{size:20}):(0,w.jsx)(m,{size:20})})]}),(0,w.jsx)(`p`,{className:`mt-1.5 text-xs text-gray-500 dark:text-dark-500`,children:x})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`confirmPassword`,className:`block text-sm font-medium text-gray-700 dark:text-dark-700 mb-2`,children:t(`auth.signup.confirmPassword`)}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`input`,{id:`confirmPassword`,type:P?`text`:`password`,value:A,onChange:e=>j(e.target.value),onKeyDown:$,className:`w-full rounded-xl border border-gray-200 bg-white/80 px-3 py-2.5 pe-10 text-gray-900 transition-colors duration-200 focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-primary-500/20 dark:border-white/10 dark:bg-white/[0.04] dark:text-dark-800`,placeholder:t(`setup.admin.confirmPlaceholder`),required:!0,disabled:I}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>F(!P),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-gray-400 hover:text-gray-600 dark:text-dark-500 dark:hover:text-dark-700`,disabled:I,children:P?(0,w.jsx)(i,{size:20}):(0,w.jsx)(m,{size:20})})]})]}),Y&&J&&(0,w.jsx)(b,{siteKey:J,action:`signup`,disabled:I,errorMessage:t(`auth.signup.tryAgain`),onTokenChange:X}),(0,w.jsxs)(`div`,{className:`flex gap-3`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>h(`welcome`),disabled:I,className:`min-h-11 flex-1 rounded-xl border border-gray-200 bg-transparent px-4 py-2.5 text-sm font-medium text-gray-700 transition-colors duration-200 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/10 dark:text-dark-700 dark:hover:bg-white/[0.06]`,children:t(`common.back`)}),(0,w.jsx)(`button`,{type:`submit`,disabled:Z,className:`flex min-h-11 flex-1 items-center justify-center rounded-xl border border-transparent bg-primary-600 px-4 py-2.5 text-sm font-medium text-white transition-colors duration-200 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:I?(0,w.jsxs)(`div`,{className:`flex items-center`,children:[(0,w.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-white`}),t(`setup.admin.creating`)]}):(0,w.jsxs)(`div`,{className:`flex items-center`,children:[(0,w.jsx)(l,{size:16,className:`me-2`}),t(`setup.admin.createAdmin`)]})})]})]}),(0,w.jsx)(`div`,{className:`mt-6 text-center`,children:(0,w.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:t(`setup.admin.note`)})})]})})]})};export{E as FirstTimeSetup};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{n as r}from"./react-vendor-C5yShNlM.js";import{t as i}from"./useTranslation-C3ei3mJq.js";import{t as a}from"./utils-CuC1beTY.js";import{En as o,Gt as s,Mt as c,T as l,Ut as u,Zt as d,at as f,gt as p,ht as m,lt as h,m as g,n as _,o as v}from"./ui-vendor-D3Ahl1x5.js";import{t as y}from"./logger-DSXjF4ye.js";import{g as b,v as x}from"./api-IzobHGND.js";import{i as ee,n as te,r as S,s as C}from"./imageGenModels-Dx_QMLJQ.js";import{t as ne}from"./appStore-DKwC2vgn.js";import{t as w}from"./Button-BV44cTnj.js";import{n as T,t as E}from"./ui-BHhR3Vok.js";import{C as D,b as O,v as k,w as A,x as re,y as j}from"../assets/index-CUhEG7E2.js";var M=class extends re{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:D(t,n.data),hasPreviousPage:A(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function N(e,t){return j(e,M,t)}var P=e(t(),1),ie=r(),F=n(),I=y(`components:image-generation-panel`);function ae(e,t={}){let n=e.config?.sizes&&e.config.sizes.length>0?e.config.sizes:[t.size||e.config?.default_size||`1024x1024`],r=e.config?.qualities&&e.config.qualities.length>0?e.config.qualities:e.config?.omit_quality_when_empty?[]:[t.quality||e.config?.default_quality||`standard`],i=e.config?.styles&&e.config.styles.length>0?e.config.styles:[];return{pluginId:e.id,model:C(e.models,t.model,void 0,``),size:C(n,t.size,e.config?.default_size,`1024x1024`),quality:r.length>0?C(r,t.quality,e.config?.default_quality,`standard`):``,style:i.length>0?C(i,t.style,e.config?.default_style,i[0]):``,sizes:n,qualities:r,styles:i,maxPromptLength:e.config?.max_prompt_length??null,sizeLabel:e.config?.size_label||``}}var oe=({isOpen:e,onClose:t,onImageGenerated:n})=>{let{t:r}=i(),s=ne(e=>e.preferences.imageGenSettings),c=s?.enabled===!0,[d,f]=(0,P.useState)([]),[p,h]=(0,P.useState)(``),[g,v]=(0,P.useState)(``),[y,b]=(0,P.useState)(``),[C,T]=(0,P.useState)(`1024x1024`),[E,D]=(0,P.useState)(`standard`),[O,k]=(0,P.useState)(``),[A,re]=(0,P.useState)(!1),[j,M]=(0,P.useState)(null),N=(0,P.useRef)(null),[oe,se]=(0,P.useState)([`512x512`,`768x768`,`1024x1024`]),[L,R]=(0,P.useState)([`standard`,`high`]),[z,ce]=(0,P.useState)([]),[B,le]=(0,P.useState)(null),[V,ue]=(0,P.useState)(``),H=P.useId(),U=(0,P.useCallback)((e,t)=>{let n=ae(e,t);h(n.pluginId),v(n.model),T(n.size),D(n.quality),k(n.style),se(n.sizes),R(n.qualities),ce(n.styles),le(n.maxPromptLength),ue(n.sizeLabel)},[]);(0,P.useEffect)(()=>{let t=!1;return e&&c&&(async()=>{try{let e=await x.getPlugins();if(t)return;let n=e.success&&e.data?e.data.filter(e=>e.models.length>0):[];f(n);let r=te(n,s);r?U(r,s):(h(``),v(``))}catch(e){if(t)return;f([]),h(``),v(``),I.error(`Failed to load image generation plugins:`,e)}})(),()=>{t=!0}},[U,c,e,s]),(0,P.useEffect)(()=>{if(!e)return;let n=document.body.style.overflow,r=e=>{e.key===`Escape`&&t()};return document.body.style.overflow=`hidden`,document.addEventListener(`keydown`,r),()=>{document.body.style.overflow=n,document.removeEventListener(`keydown`,r)}},[e,t]),(0,P.useEffect)(()=>()=>{N.current?.abort(),N.current=null},[]),(0,P.useEffect)(()=>{e||N.current?.abort()},[e]);let W=()=>{N.current?.abort(),t()},de=e=>{let t=d.find(t=>t.id===e);t&&U(t,{model:g,size:C,quality:E,style:O})},G=async()=>{if(!c||!p||!g||!y.trim()){o.error(r(`imageGeneration.enterPrompt`));return}if(B&&y.length>B){o.error(r(`imageGeneration.promptTooLong`,{max:B.toLocaleString()}));return}let e=new AbortController;N.current?.abort(),N.current=e,re(!0),M(null);try{let i=await x.generate({model:g,pluginId:p,prompt:y.trim(),size:C,quality:E,...O?{style:O}:{}},e.signal);if(e.signal.aborted)return;if(i.success&&i.data?.images&&i.data.images.length>0){let e=ee(i.data.images[0]);e&&(o.success(r(`imageGeneration.success`)),n?(n(e,y.trim(),g),b(``),M(null),t()):M(e))}else o.error(r(`imageGeneration.failed`))}catch(t){if(e.signal.aborted)return;I.error(`Image generation failed:`,t);let n=t instanceof Error?t.message:r(`imageGeneration.failed`);o.error(n)}finally{N.current===e&&(N.current=null,re(!1))}},fe=()=>{N.current?.abort()},pe=()=>{if(!j)return;let e=document.createElement(`a`);e.href=j,e.download=`generated-image-${Date.now()}.${S(j)}`,document.body.appendChild(e),e.click(),document.body.removeChild(e)};if(!e||!c)return null;let me=d.find(e=>e.id===p);return(0,ie.createPortal)((0,F.jsxs)(`div`,{className:`fixed inset-0 z-[99999] flex items-center justify-center p-3 sm:p-6`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":H,children:[(0,F.jsx)(`div`,{className:`absolute inset-0 bg-black/55 backdrop-blur-sm`,onClick:W}),(0,F.jsxs)(`div`,{className:a(`relative bg-white/95 dark:bg-dark-25/95`,`border border-gray-200/80 dark:border-white/10`,`rounded-3xl shadow-2xl backdrop-blur-xl`,`flex max-h-[92vh] w-full max-w-2xl flex-col overflow-hidden`),onClick:e=>e.stopPropagation(),children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between border-b border-gray-200/70 px-5 py-4 dark:border-white/[0.08] sm:px-6 sm:py-5`,children:[(0,F.jsx)(`div`,{children:(0,F.jsx)(`h2`,{id:H,className:`text-xl font-normal tracking-[-0.025em] text-gray-950 dark:text-dark-950`,children:r(`imageGeneration.title`)})}),(0,F.jsx)(`button`,{onClick:W,className:`rounded-xl p-2 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-dark-500 dark:hover:bg-white/[0.06] dark:hover:text-dark-900`,title:r(`common.close`,{defaultValue:`Close`}),children:(0,F.jsx)(_,{className:`h-5 w-5 text-gray-500 dark:text-gray-400`})})]}),(0,F.jsx)(`div`,{className:`scroll-region min-h-0 flex-1 space-y-5 p-5 scrollbar-thin sm:p-6`,children:me?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:r(`settings.plugins.title`)}),(0,F.jsx)(`select`,{value:p,onChange:e=>de(e.target.value),className:a(`w-full rounded-xl px-3 py-2.5 text-sm`,`bg-white/70 dark:bg-white/[0.035]`,`border border-gray-200/80 dark:border-white/10`,`text-gray-900 dark:text-gray-100`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`),children:d.map(e=>(0,F.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:r(`imageGeneration.model`)}),(0,F.jsx)(`select`,{value:g,onChange:e=>v(e.target.value),className:a(`w-full rounded-xl px-3 py-2.5 text-sm`,`bg-white/70 dark:bg-white/[0.035]`,`border border-gray-200/80 dark:border-white/10`,`text-gray-900 dark:text-gray-100`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`),children:me?.models.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))})]}),z.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:r(`imageGeneration.style`)}),(0,F.jsx)(`select`,{value:O,onChange:e=>k(e.target.value),className:a(`w-full rounded-xl px-3 py-2.5 text-sm`,`bg-white/70 dark:bg-white/[0.035]`,`border border-gray-200/80 dark:border-white/10`,`text-gray-900 dark:text-gray-100`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`),children:z.map(e=>(0,F.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V||r(`imageGeneration.size`)}),(0,F.jsx)(`select`,{value:C,onChange:e=>T(e.target.value),className:a(`w-full rounded-xl px-3 py-2.5 text-sm`,`bg-white/70 dark:bg-white/[0.035]`,`border border-gray-200/80 dark:border-white/10`,`text-gray-900 dark:text-gray-100`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`),children:oe.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))})]}),L.length>0&&(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:r(`imageGeneration.quality`)}),(0,F.jsx)(`select`,{value:E,onChange:e=>D(e.target.value),className:a(`w-full rounded-xl px-3 py-2.5 text-sm`,`bg-white/70 dark:bg-white/[0.035]`,`border border-gray-200/80 dark:border-white/10`,`text-gray-900 dark:text-gray-100`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`),children:L.map(e=>(0,F.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:r(`imageGeneration.prompt`)}),(0,F.jsx)(`textarea`,{value:y,onChange:e=>b(e.target.value),placeholder:r(`imageGeneration.promptPlaceholder`),rows:5,className:a(`w-full resize-none rounded-2xl px-4 py-3 text-sm leading-6`,`bg-white/70 dark:bg-white/[0.035]`,`border border-gray-200/80 dark:border-white/10`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500 dark:placeholder-gray-400`,`focus:outline-none focus:ring-2 focus:ring-primary-500/20`,B&&y.length>B&&`border-red-500 dark:border-red-500`)}),B&&(0,F.jsxs)(`div`,{className:a(`mt-1 text-end text-xs`,y.length>B?`text-red-500`:`text-gray-500 dark:text-gray-400`),children:[y.length.toLocaleString(),` /`,` `,B.toLocaleString()]})]}),j&&(0,F.jsxs)(`div`,{className:`relative overflow-hidden rounded-2xl border border-gray-200/80 dark:border-white/10`,children:[(0,F.jsx)(`img`,{src:j,alt:`Generated`,className:`w-full h-auto`}),(0,F.jsx)(`button`,{onClick:pe,className:a(`absolute bottom-3 end-3 rounded-lg p-2`,`bg-white/90 dark:bg-dark-100/90`,`hover:bg-white dark:hover:bg-dark-100`,`border border-gray-200 dark:border-dark-300`,`transition-colors`),title:r(`imageGallery.download`),children:(0,F.jsx)(u,{className:`h-5 w-5 text-gray-700 dark:text-gray-200`})})]})]}):(0,F.jsxs)(`div`,{className:`text-center py-8`,children:[(0,F.jsx)(m,{className:`h-12 w-12 mx-auto mb-3 text-gray-300 dark:text-gray-600`}),(0,F.jsx)(`p`,{className:`text-gray-500 dark:text-gray-400`,children:r(`imageGeneration.noModels`)}),(0,F.jsx)(`p`,{className:`text-sm text-gray-400 dark:text-gray-500 mt-1`,children:r(`imageGeneration.configurePlugin`)})]})}),me&&(0,F.jsx)(`div`,{className:`border-t border-gray-200/70 p-4 dark:border-white/[0.08] sm:px-6 sm:py-5`,children:(0,F.jsx)(w,{onClick:A?fe:G,disabled:!A&&(!c||!y.trim()||!p||!g),className:a(`w-full py-2.5 rounded-xl font-medium`,`bg-primary-600 dark:bg-primary-600`,`hover:bg-primary-700 dark:hover:bg-primary-500`,`text-white`,`disabled:opacity-50 disabled:cursor-not-allowed`,`transition-colors`),children:A?(0,F.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,F.jsx)(_,{className:`h-4 w-4`}),r(`common.cancel`)]}):(0,F.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,F.jsx)(l,{className:`h-4 w-4`}),r(`imageGeneration.generate`)]})})})]})]}),document.body)},se={video:[],audio:[]};function L({isOpen:e,initialKind:t,onClose:n,onGenerated:r}){let{t:s}=i(),u=O(),[d,f]=(0,P.useState)(t),[p,m]=(0,P.useState)(se),[g,y]=(0,P.useState)(``),[x,ee]=(0,P.useState)(``),[te,S]=(0,P.useState)(``),[C,ne]=(0,P.useState)(!1),[T,E]=(0,P.useState)(null),[D,k]=(0,P.useState)(``),[A,re]=(0,P.useState)(!1),[j,M]=(0,P.useState)(``),[N,I]=(0,P.useState)(!1),[ae,oe]=(0,P.useState)(0),[L,ue]=(0,P.useState)(``),[H,U]=(0,P.useState)(``),[W,de]=(0,P.useState)(``),[G,fe]=(0,P.useState)(!0),[pe,me]=(0,P.useState)(!0),[K,he]=(0,P.useState)(!1),[ge,_e]=(0,P.useState)([]),q=(0,P.useRef)(null),ve=P.useId(),J=()=>{ne(!1),E(null),k(``),re(!1),M(``),I(!1),oe(e=>e+1)},ye=()=>{q.current?.abort(),J(),n()};(0,P.useEffect)(()=>()=>{q.current?.abort(),q.current=null},[]),(0,P.useEffect)(()=>{e||q.current?.abort()},[e]),(0,P.useEffect)(()=>{if(!e)return;let t=!1;return b.getModels().then(e=>{t||!e.success||!e.data||m(e.data)}).catch(()=>{t||o.error(s(`mediaGeneration.loadFailed`))}).finally(()=>{t||me(!1)}),()=>{t=!0}},[e,s]),(0,P.useEffect)(()=>{if(!e)return;let t=!1;return b.listVideoJobs({limit:100,active:!0}).then(e=>{!t&&e.success&&e.data&&_e(e.data.jobs)}).catch(()=>{t||o.error(s(`mediaGeneration.jobsLoadFailed`,{defaultValue:`Failed to load saved video jobs`}))}),()=>{t=!0}},[e,s]);let Y=d===`video`?p.video:p.audio,be=ge.filter(e=>e.status!==`completed`),xe=Y.some(e=>z(e)===g)?g:Y[0]?z(Y[0]):``,X=(0,P.useMemo)(()=>Y.find(e=>z(e)===xe),[xe,Y]),Se=d===`video`?X?.config:void 0,Z=d===`audio`?X:void 0,Ce=!!(Z?.mode===`speech`&&Z.config?.supports_voice_cloning),we=!!Z?.config?.clone_requires_transcript,Q=Ce&&C,Te=!!(Z?.mode!==`speech`||Z.config?.allows_custom_voice!==!1||Z.config?.voices?.length),$=Z?.mode===`speech`?Z.config?.max_characters:void 0,Ee=async(e,t,n,r=0)=>{if(e.status!==`pending`&&e.status!==`in_progress`)return e;n&&await ce(3e4,t.signal);try{let n=await b.resumeVideoJob(e.id,t.signal);if(!n.success||!n.data)throw Error(n.message||s(`mediaGeneration.failed`));let r=n.data;return _e(e=>[r,...e.filter(e=>e.id!==r.id)]),Ee(r,t,!0)}catch(n){if(t.signal.aborted||r>=4)throw n;return Ee(e,t,!0,r+1)}},De=async e=>{let t=new AbortController;q.current?.abort(),q.current=t,he(!0);try{let n=await Ee(e,t,!1);if(t.signal.aborted)return;if(n.status===`failed`)throw Error(n.error||s(`mediaGeneration.failed`));o.success(s(`mediaGeneration.success`)),r()}catch(e){if(t.signal.aborted)return;o.error(e instanceof Error?e.message:s(`mediaGeneration.failed`))}finally{q.current===t&&(q.current=null,he(!1))}},Oe=async e=>{try{let t=await b.cancelVideoJob(e.id);if(!t.success)throw Error(t.message||s(`mediaGeneration.failed`));_e(t=>t.filter(t=>t.id!==e.id)),o.success(s(`mediaGeneration.jobCancelled`,{defaultValue:`Video job cancelled at the provider`}))}catch(e){o.error(e instanceof Error?e.message:s(`mediaGeneration.failed`))}};return e?(0,ie.createPortal)((0,F.jsxs)(`div`,{className:`fixed inset-0 z-[99999] flex items-center justify-center p-3 sm:p-6`,children:[(0,F.jsx)(`button`,{className:`absolute inset-0 bg-black/55 backdrop-blur-sm`,onClick:ye,"aria-label":s(`common.close`)}),(0,F.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":ve,className:`relative flex max-h-[92vh] w-full max-w-2xl flex-col overflow-hidden rounded-2xl border border-gray-200/80 bg-white/95 shadow-2xl backdrop-blur-xl dark:border-white/10 dark:bg-dark-25/95`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between border-b border-gray-200/70 px-4 py-3 dark:border-white/[0.08] sm:px-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h2`,{id:ve,className:`text-xl text-gray-950 dark:text-dark-950`,children:s(`mediaGeneration.title`)}),(0,F.jsx)(`p`,{className:`mt-1 text-sm text-gray-500 dark:text-dark-500`,children:s(`mediaGeneration.description`)})]}),(0,F.jsx)(`button`,{onClick:ye,className:`rounded-xl p-2`,children:(0,F.jsx)(_,{className:`h-5 w-5`})})]}),(0,F.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 space-y-4 p-4 sm:p-5`,children:[(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-2 rounded-xl bg-gray-100 p-1 dark:bg-white/[0.05]`,children:[`video`,`audio`].map(e=>(0,F.jsxs)(`button`,{type:`button`,disabled:K,onClick:()=>{f(e),y(``),S(``),J()},className:a(`flex items-center justify-center gap-2 rounded-xl px-3 py-2 text-sm transition-colors`,e===d?`bg-white text-gray-950 shadow-sm dark:bg-white/10 dark:text-white`:`text-gray-500 dark:text-dark-500`,K&&`cursor-not-allowed opacity-50`),children:[e===`video`?(0,F.jsx)(c,{className:`h-4 w-4`}):(0,F.jsx)(v,{className:`h-4 w-4`}),s(`mediaGeneration.${e}`)]},e))}),d===`video`&&be.length>0&&(0,F.jsxs)(`section`,{className:`space-y-2 rounded-xl border border-gray-200/80 bg-gray-50/80 p-3 dark:border-white/10 dark:bg-white/[0.025]`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:s(`mediaGeneration.savedJobs`,{defaultValue:`Saved video jobs`})}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-gray-500 dark:text-dark-500`,children:s(`mediaGeneration.savedJobsDescription`,{defaultValue:`Closing this panel only stops waiting. Reopen it to resume any provider job listed here.`})})]}),be.map(e=>(0,F.jsxs)(`div`,{"data-testid":`video-job-${e.id}`,className:`flex items-center gap-3 rounded-lg border border-gray-200/70 bg-white/80 p-2.5 dark:border-white/10 dark:bg-dark-50/70`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`p`,{className:`truncate text-sm text-gray-900 dark:text-gray-100`,children:e.prompt||e.model}),(0,F.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:[e.model,` ·`,` `,s(`mediaGeneration.jobStatus.${e.status}`,{defaultValue:e.status.replace(`_`,` `)})]}),e.error&&(0,F.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:e.error})]}),(e.status===`pending`||e.status===`in_progress`)&&(0,F.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,disabled:K,onClick:()=>void De(e),children:s(`mediaGeneration.resumeJob`,{defaultValue:`Resume`})}),e.cancellable&&(0,F.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,disabled:K,onClick:()=>void Oe(e),children:s(`mediaGeneration.cancelJob`,{defaultValue:`Cancel job`})})]},e.id))]}),pe?(0,F.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,F.jsx)(h,{className:`h-7 w-7 animate-spin`})}):Y.length===0?(0,F.jsx)(`div`,{className:`rounded-xl border border-amber-500/25 bg-amber-500/10 p-4 text-sm text-amber-800 dark:text-amber-200`,children:s(`mediaGeneration.noModels`,{kind:s(`mediaGeneration.${d}`)})}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(R,{label:s(`mediaGeneration.model`),children:(0,F.jsx)(`select`,{value:xe,onChange:e=>{y(e.target.value),S(``),J(),ue(``),U(``),de(``),fe(!0)},className:V,children:Y.map(e=>(0,F.jsxs)(`option`,{value:z(e),children:[e.model,` (`,e.plugin,`mode`in e?` · ${s(`mediaGeneration.${e.mode}`)}`:``,`)`]},z(e)))})}),d===`audio`&&!Q&&Te?(0,F.jsx)(R,{label:s(`mediaGeneration.voice`),children:(0,F.jsx)(`input`,{value:te,onChange:e=>S(e.target.value),className:V,placeholder:Z?.config?.default_voice||s(`mediaGeneration.providerDefault`)})}):d===`video`?(0,F.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,F.jsx)(R,{label:s(`mediaGeneration.resolution`),children:(0,F.jsxs)(`select`,{value:L,onChange:e=>ue(e.target.value),className:V,children:[(0,F.jsx)(`option`,{value:``,children:s(`mediaGeneration.providerDefault`)}),Se?.resolutions?.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]})}),(0,F.jsx)(R,{label:s(`mediaGeneration.aspectRatio`),children:(0,F.jsxs)(`select`,{value:H,onChange:e=>U(e.target.value),className:V,children:[(0,F.jsx)(`option`,{value:``,children:s(`mediaGeneration.providerDefault`)}),Se?.aspect_ratios?.map(e=>(0,F.jsx)(`option`,{value:e,children:e},e))]})}),(0,F.jsx)(R,{label:s(`mediaGeneration.duration`),children:(0,F.jsxs)(`select`,{value:W,onChange:e=>de(e.target.value),className:V,children:[(0,F.jsx)(`option`,{value:``,children:s(`mediaGeneration.providerDefault`)}),Se?.durations?.map(e=>(0,F.jsxs)(`option`,{value:e,children:[e,`s`]},e))]})})]}):null,Ce&&(0,F.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-primary-500/20 bg-primary-500/[0.06] p-4`,children:[(0,F.jsxs)(`label`,{className:`flex items-start gap-3 text-sm`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:Q,onChange:e=>{e.target.checked?ne(!0):J()},className:`mt-0.5`}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`block font-medium text-gray-900 dark:text-gray-100`,children:s(`mediaGeneration.cloneVoice`)}),(0,F.jsx)(`span`,{className:`mt-0.5 block text-xs font-normal text-gray-500 dark:text-dark-500`,children:s(`mediaGeneration.cloneVoiceDescription`)})]})]}),Q&&(0,F.jsxs)(`div`,{className:`space-y-3 border-t border-primary-500/15 pt-3`,children:[(0,F.jsx)(R,{label:s(`mediaGeneration.referenceAudio`),children:(0,F.jsx)(`input`,{type:`file`,accept:Z?.config?.clone_audio_mime_types?.join(`,`)||`audio/wav,audio/mpeg,audio/flac,audio/ogg`,onChange:e=>{let t=e.target.files?.[0]||null,n=Z?.config?.clone_max_audio_bytes;if(t&&n&&t.size>n){o.error(s(`mediaGeneration.referenceAudioTooLarge`,{max:le(n)})),e.target.value=``,E(null);return}E(t)},className:a(V,`file:me-3 file:rounded-lg file:border-0 file:bg-primary-500/10 file:px-3 file:py-1 file:text-primary-700 dark:file:text-primary-300`)},ae)}),(0,F.jsx)(R,{label:s(`mediaGeneration.referenceTranscript`),children:(0,F.jsx)(`textarea`,{value:D,onChange:e=>k(e.target.value),rows:3,required:we,className:a(V,`resize-none`),placeholder:s(`mediaGeneration.referenceTranscriptPlaceholder`)})}),(0,F.jsxs)(`label`,{className:`flex items-start gap-3 text-sm`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:A,onChange:e=>{re(e.target.checked),e.target.checked||(M(``),I(!1))},className:`mt-0.5`}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`block font-medium text-gray-900 dark:text-gray-100`,children:s(`mediaGeneration.saveVoiceProfile`,{defaultValue:`Save as a reusable voice`})}),(0,F.jsx)(`span`,{className:`mt-0.5 block text-xs font-normal text-gray-500 dark:text-dark-500`,children:s(`mediaGeneration.saveVoiceProfileDescription`,{defaultValue:`Store this reference recording and transcript securely. Libre WebUI sends them to the selected provider for every Speech batch that uses this voice.`})})]})]}),A&&(0,F.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-primary-500/15 bg-white/60 p-3 dark:bg-dark-100/50`,children:[(0,F.jsx)(R,{label:s(`mediaGeneration.voiceProfileName`,{defaultValue:`Saved voice name`}),children:(0,F.jsx)(`input`,{type:`text`,value:j,onChange:e=>M(e.target.value),maxLength:80,autoComplete:`off`,className:V,placeholder:s(`mediaGeneration.voiceProfileNamePlaceholder`,{defaultValue:`For example, My voice`})})}),(0,F.jsxs)(`label`,{className:`flex items-start gap-3 text-xs text-amber-700 dark:text-amber-300`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:N,onChange:e=>I(e.target.checked),className:`mt-0.5`}),(0,F.jsx)(`span`,{children:s(`mediaGeneration.voiceStorageConsent`,{defaultValue:`I confirm that I have the speaker’s permission to clone and store this voice. The reference stays saved until I delete it.`})})]})]}),!A&&(0,F.jsx)(`p`,{className:`text-xs font-normal text-amber-700 dark:text-amber-300`,children:s(`mediaGeneration.cloneConsent`)})]})]}),d===`video`&&Se?.supports_audio&&(0,F.jsxs)(`label`,{className:`flex items-center gap-3 text-sm`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:G,onChange:e=>fe(e.target.checked)}),s(`mediaGeneration.generateAudio`)]}),(0,F.jsxs)(R,{label:d===`video`||Z?.mode===`sound`?s(`mediaGeneration.prompt`):s(`mediaGeneration.text`),children:[(0,F.jsx)(`textarea`,{value:x,onChange:e=>ee(e.target.value),rows:6,maxLength:$,className:a(V,`resize-none`),placeholder:s(d===`audio`&&Z?.mode===`sound`?`mediaGeneration.soundPlaceholder`:`mediaGeneration.${d}Placeholder`)}),$&&(0,F.jsxs)(`span`,{className:`block text-end text-xs font-normal text-gray-500 dark:text-dark-500`,children:[x.length,` / `,$]})]})]})]}),Y.length>0&&(0,F.jsx)(`div`,{className:`border-t border-gray-200/70 p-4 dark:border-white/[0.08] sm:px-5`,children:(0,F.jsxs)(w,{onClick:K?()=>{q.current?.abort()}:async()=>{if(!X||!x.trim())return;let e=new AbortController;q.current?.abort(),q.current=e,he(!0);try{if(d===`audio`){let t=B(Z?.config?.default_format),n=Q?await b.cloneVoice({model:X.model,pluginId:X.plugin,input:x.trim(),referenceAudio:T,referenceText:D.trim()||void 0,responseFormat:t,saveVoiceName:A?j.trim():void 0,consentToStore:A&&N},e.signal):Z?.mode===`sound`?await b.generateSound({model:X.model,pluginId:X.plugin,prompt:x.trim(),voice:te.trim()||Z?.config?.default_voice||void 0,format:`wav`},e.signal):await b.generateAudio({model:X.model,pluginId:X.plugin,input:x.trim(),voice:te.trim()||Z?.config?.default_voice||void 0,response_format:t},e.signal);if(e.signal.aborted)return;if(!n.success)throw Error(n.message);if(Q&&A&&(await u.invalidateQueries({queryKey:[`tts-voice-profiles`]}),e.signal.aborted))return}else{let t=await b.generateVideo({model:X.model,pluginId:X.plugin,prompt:x.trim(),...W?{duration:Number(W)}:{},...L?{resolution:L}:{},...H?{aspect_ratio:H}:{},...Se?.supports_audio?{generate_audio:G}:{}},e.signal);if(e.signal.aborted)return;if(!t.success||!t.data)throw Error(t.message||s(`mediaGeneration.failed`));let n=t.data;_e(e=>[n,...e.filter(e=>e.id!==n.id)]);let r=await Ee(n,e,!0);if(r.status===`failed`)throw Error(r.error||s(`mediaGeneration.failed`))}if(e.signal.aborted)return;o.success(Q&&A?s(`mediaGeneration.successWithSavedVoice`,{name:j.trim(),defaultValue:`Media generated and “{{name}}” is now available in Speech settings`}):s(`mediaGeneration.success`)),ee(``),J(),r(),n()}catch(t){if(e.signal.aborted)return;o.error(t instanceof Error?t.message:s(`mediaGeneration.failed`))}finally{q.current===e&&(q.current=null,he(!1))}},disabled:K?!1:!X||!x.trim()||!!($&&x.length>$)||Q&&(!T||we&&!D.trim()||A&&(!j.trim()||!N)),className:`w-full gap-2`,children:[K?(0,F.jsx)(_,{className:`h-4 w-4`}):(0,F.jsx)(l,{className:`h-4 w-4`}),K?d===`video`?s(`mediaGeneration.stopWaiting`,{defaultValue:`Stop waiting`}):s(`common.cancel`):s(`mediaGeneration.generate`)]})})]})]}),document.body):null}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`block space-y-1.5 text-sm font-medium text-gray-700 dark:text-gray-300`,children:[(0,F.jsx)(`span`,{children:e}),t]})}function z(e){return`${e.mode||`default`}::${e.plugin}::${e.model}`}function ce(e,t){return t?.aborted?Promise.reject(t.reason):new Promise((n,r)=>{let i=window.setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{window.clearTimeout(i),r(t?.reason)};t?.addEventListener(`abort`,a,{once:!0})})}function B(e){return[`mp3`,`opus`,`aac`,`flac`,`wav`,`pcm`].includes(e||``)?e:`mp3`}function le(e){return e>=1048576?`${Math.ceil(e/1048576)} MB`:`${Math.ceil(e/1024)} KB`}var V=`w-full rounded-xl border border-gray-200/80 bg-white/70 px-3 py-2.5 text-sm text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary-500/20 dark:border-white/10 dark:bg-white/[0.035] dark:text-gray-100`,ue=({image:e,onClose:t,onDelete:n,onDownload:r})=>{let{t:o}=i();return(0,P.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return document.addEventListener(`keydown`,e),document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,e),document.body.style.overflow=``}},[t]),(0,ie.createPortal)((0,F.jsxs)(`div`,{className:`fixed inset-0 z-[99999] flex items-center justify-center`,onClick:t,children:[(0,F.jsx)(`div`,{className:`absolute inset-0 bg-black/90 backdrop-blur-sm`}),(0,F.jsxs)(`div`,{className:`relative flex flex-col lg:flex-row max-w-7xl max-h-[95vh] w-full mx-4 gap-4`,onClick:e=>e.stopPropagation(),children:[(0,F.jsx)(`button`,{onClick:t,className:a(`absolute -top-12 right-0 lg:top-0 lg:-right-12 z-10`,`p-2 rounded-full`,`bg-white/10 hover:bg-white/20`,`transition-colors`),children:(0,F.jsx)(_,{className:`h-6 w-6 text-white`})}),(0,F.jsx)(`div`,{className:`flex-1 flex items-center justify-center min-h-0`,children:(0,F.jsx)(`img`,{src:e.imageData,alt:e.prompt,className:`max-w-full max-h-[70vh] lg:max-h-[90vh] object-contain rounded-lg`})}),(0,F.jsxs)(`div`,{className:a(`w-full lg:w-80 flex-shrink-0`,`bg-white dark:bg-dark-100`,`rounded-xl p-4 lg:p-5`,`overflow-y-auto max-h-[25vh] lg:max-h-[90vh]`),children:[(0,F.jsxs)(`div`,{className:`mb-4`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-gray-500 dark:text-gray-400 mb-1`,children:o(`gallery.prompt`)}),(0,F.jsx)(`p`,{className:`text-gray-900 dark:text-gray-100 text-sm leading-relaxed`,children:e.prompt})]}),(0,F.jsxs)(`div`,{className:`space-y-3 mb-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,F.jsx)(s,{className:`h-4 w-4 text-gray-400 dark:text-gray-500`}),(0,F.jsxs)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:[o(`gallery.model`),`:`]}),(0,F.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:e.model})]}),e.size&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,F.jsx)(f,{className:`h-4 w-4 text-gray-400 dark:text-gray-500`}),(0,F.jsxs)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:[o(`gallery.size`),`:`]}),(0,F.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:e.size})]}),e.quality&&(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,F.jsx)(`span`,{className:`w-4 h-4 flex items-center justify-center text-gray-400 dark:text-gray-500 text-xs font-bold`,children:`Q`}),(0,F.jsxs)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:[o(`gallery.quality`),`:`]}),(0,F.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100 capitalize`,children:e.quality})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,F.jsx)(d,{className:`h-4 w-4 text-gray-400 dark:text-gray-500`}),(0,F.jsxs)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:[o(`gallery.created`),`:`]}),(0,F.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:(e=>new Date(e).toLocaleString(void 0,{year:`numeric`,month:`long`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}))(e.createdAt)})]})]}),(0,F.jsxs)(`div`,{className:`flex gap-2 pt-4 border-t border-gray-200 dark:border-dark-300`,children:[(0,F.jsxs)(`button`,{onClick:()=>{if(r)r(e);else{let t=document.createElement(`a`);t.href=e.imageData,t.download=`generated-${e.id}.${S(e.imageData)}`,document.body.appendChild(t),t.click(),document.body.removeChild(t)}},className:a(`flex-1 flex items-center justify-center gap-2 py-2.5 rounded-lg`,`bg-primary-600 dark:bg-primary-600`,`hover:bg-primary-700 dark:hover:bg-primary-500`,`text-white font-medium text-sm`,`transition-colors`),children:[(0,F.jsx)(u,{className:`h-4 w-4`}),o(`gallery.download`)]}),n&&(0,F.jsx)(`button`,{onClick:()=>n(e.id),className:a(`p-2.5 rounded-lg`,`bg-gray-100 dark:bg-dark-200`,`hover:bg-red-100 dark:hover:bg-red-900/30`,`text-gray-600 dark:text-gray-300`,`hover:text-red-600 dark:hover:text-red-400`,`transition-colors`),title:`Delete image`,children:(0,F.jsx)(g,{className:`h-4 w-4`})})]})]})]})]}),document.body)};function H({kind:e,refreshKey:t,onCountChange:n}){let{t:r}=i(),a=O(),[s,c]=(0,P.useState)(null),[l,d]=(0,P.useState)(null),f=N({queryKey:[`media-gallery`,e||`all`,t||0],queryFn:async({pageParam:t})=>{let n=await b.getGallery({limit:20,offset:t,...e?{kind:e}:{}});if(!n.success||!n.data)throw Error(n.message||r(`imageGallery.loadFailed`));return n.data},initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.media.length,0);return n<e.total?n:void 0}}),m=(0,P.useMemo)(()=>f.data?.pages.flatMap(e=>e.media)||[],[f.data]),_=f.data?.pages[0]?.total||0;(0,P.useEffect)(()=>n?.(_),[n,_]);let v=async e=>{if(!l){d(e.id);try{let t=await b.deleteGalleryItem(e.id);if(!t.success)throw Error(t.message);c(null),await a.invalidateQueries({queryKey:[`media-gallery`]}),o.success(r(`imageGallery.deleteSuccess`))}catch{o.error(r(`imageGallery.deleteFailed`))}finally{d(null)}}},y=async e=>{let t=await b.getGalleryContent(e.id),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`generated-${e.id}.${de(e.mimeType)}`,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)};return f.isLoading?(0,F.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,F.jsx)(h,{className:`h-8 w-8 animate-spin text-gray-400`})}):m.length===0?(0,F.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-2xl border border-dashed border-gray-300 bg-white/30 px-6 py-12 text-center dark:border-white/15 dark:bg-white/[0.02]`,children:[(0,F.jsx)(p,{className:`mb-4 h-10 w-10 text-gray-300 dark:text-gray-600`}),(0,F.jsx)(`h3`,{className:`text-lg font-medium`,children:r(`mediaGallery.empty`)}),(0,F.jsx)(`p`,{className:`mt-2 max-w-sm text-gray-500 dark:text-gray-400`,children:r(`mediaGallery.emptyHint`)})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,children:m.map(e=>(0,F.jsxs)(`article`,{className:`overflow-hidden rounded-2xl border border-gray-200/80 bg-white/70 dark:border-white/10 dark:bg-white/[0.025]`,children:[(0,F.jsx)(U,{item:e,onOpenImage:t=>c(W(e,t))}),(0,F.jsxs)(`div`,{className:`space-y-3 p-3`,children:[(0,F.jsx)(`p`,{className:`line-clamp-2 text-sm text-gray-800 dark:text-gray-200`,children:e.prompt}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate text-xs text-gray-500`,children:e.model}),(0,F.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,F.jsx)(`button`,{onClick:()=>void y(e),className:`rounded-lg p-1.5 hover:bg-gray-100 dark:hover:bg-white/10`,title:r(`imageGallery.download`),children:(0,F.jsx)(u,{className:`h-4 w-4`})}),(0,F.jsx)(`button`,{onClick:()=>void v(e),disabled:l===e.id,className:`rounded-lg p-1.5 hover:bg-red-500/15 hover:text-red-500`,title:r(`imageGallery.delete`),children:l===e.id?(0,F.jsx)(h,{className:`h-4 w-4 animate-spin`}):(0,F.jsx)(g,{className:`h-4 w-4`})})]})]})]})]},e.id))}),f.hasNextPage&&(0,F.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,F.jsx)(w,{variant:`outline`,disabled:f.isFetchingNextPage,onClick:()=>void f.fetchNextPage(),children:f.isFetchingNextPage?r(`common.loading`):r(`imageGallery.loadMore`,{current:m.length,total:_})})}),s&&(0,F.jsx)(ue,{image:s,onClose:()=>c(null),onDelete:e=>{let t=m.find(t=>t.id===e);t&&v(t)},onDownload:e=>{let t=m.find(t=>t.id===e.id);t&&y(t)}})]})}function U({item:e,onOpenImage:t}){let{data:n,isLoading:r}=k({queryKey:[`media-gallery-content`,e.id],queryFn:()=>b.getGalleryContent(e.id),staleTime:3e5}),i=(0,P.useMemo)(()=>n?URL.createObjectURL(n):``,[n]);return(0,P.useEffect)(()=>()=>{i&&URL.revokeObjectURL(i)},[i]),r||!i?(0,F.jsx)(`div`,{className:`flex aspect-video items-center justify-center bg-gray-100 dark:bg-white/[0.03]`,children:(0,F.jsx)(h,{className:`h-6 w-6 animate-spin text-gray-400`})}):e.kind===`image`?(0,F.jsx)(`button`,{className:`block aspect-square w-full overflow-hidden`,onClick:()=>t(i),children:(0,F.jsx)(`img`,{src:i,alt:e.prompt,className:`h-full w-full object-cover`,loading:`lazy`})}):e.kind===`video`?(0,F.jsx)(`div`,{className:`aspect-video bg-black`,children:(0,F.jsx)(`video`,{src:i,controls:!0,preload:`metadata`,className:`h-full w-full object-contain`})}):(0,F.jsxs)(`div`,{className:`flex min-h-40 flex-col items-center justify-center gap-3 bg-gradient-to-br from-primary-500/10 to-cyan-500/10 p-4`,children:[(0,F.jsx)(v,{className:`h-9 w-9 text-primary-500`}),(0,F.jsx)(`audio`,{src:i,controls:!0,preload:`metadata`,className:`w-full`})]})}function W(e,t){return{id:e.id,userId:e.userId,prompt:e.prompt,model:e.model,imageData:t,size:e.size,quality:e.quality,createdAt:e.createdAt}}function de(e){let t=e.split(`/`)[1]?.split(`;`)[0];return t===`mpeg`?e.startsWith(`audio/`)?`mp3`:`mpeg`:t===`svg+xml`?`svg`:t||`bin`}var G=()=>{let{t:e}=i(),[t,n]=(0,P.useState)(null),[r,o]=(0,P.useState)(!1),[s,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(`all`),[f,p]=(0,P.useState)(0),h=ne(e=>e.preferences.imageGenSettings?.enabled===!0),g=(0,P.useCallback)(()=>{p(e=>e+1)},[]);return(0,F.jsxs)(T,{width:`wide`,children:[(0,F.jsx)(E,{title:e(`sidebar.navigation.imagine`),description:e(`gallery.subtitle`),meta:t!==null&&t>0?(0,F.jsx)(`span`,{className:`inline-flex rounded-full border border-gray-200/80 bg-white/60 px-2.5 py-1 text-xs text-gray-500 dark:border-white/10 dark:bg-white/[0.04] dark:text-dark-500`,children:e(`mediaGallery.itemCount`,{count:t})}):null,actions:(0,F.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,F.jsxs)(w,{onClick:()=>{h&&o(!0)},disabled:!h,className:`gap-2 px-4`,children:[(0,F.jsx)(m,{className:`h-4 w-4`,"aria-hidden":`true`}),e(`gallery.generate`)]}),(0,F.jsxs)(w,{variant:`outline`,onClick:()=>l(`video`),className:`gap-2 px-4`,children:[(0,F.jsx)(c,{className:`h-4 w-4`,"aria-hidden":`true`}),e(`mediaGeneration.video`)]}),(0,F.jsxs)(w,{variant:`outline`,onClick:()=>l(`audio`),className:`gap-2 px-4`,children:[(0,F.jsx)(v,{className:`h-4 w-4`,"aria-hidden":`true`}),e(`mediaGeneration.audio`)]})]})}),(0,F.jsx)(`div`,{className:`mb-5 flex flex-wrap gap-2`,children:[`all`,`image`,`video`,`audio`].map(t=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>d(t),className:a(`rounded-full border px-3 py-1.5 text-sm transition-colors`,u===t?`border-gray-950 bg-gray-950 text-white dark:border-white dark:bg-white dark:text-gray-950`:`border-gray-200 text-gray-600 hover:border-gray-400 dark:border-white/10 dark:text-dark-600`),children:e(`mediaGallery.filters.${t}`)},t))}),(0,F.jsx)(H,{kind:u===`all`?void 0:u,refreshKey:f,onCountChange:n}),(0,F.jsx)(oe,{isOpen:r&&h,onClose:()=>o(!1),onImageGenerated:g}),(0,F.jsx)(L,{isOpen:s!==null,initialKind:s||`video`,onClose:()=>l(null),onGenerated:g},s||`closed`)]})};export{G as GalleryPage,G as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{d as t,f as n}from"./markdown-core-DHnR5Hw8.js";import{d as r}from"./router-vendor-Ca9zqOqT.js";import{t as i}from"./useTranslation-CXY69qNk.js";import{a,r as o,t as s}from"./utils-BM0_0iFj.js";import{t as c}from"./chatStore-CDeYWL_q.js";import{Et as l,T as u,Wt as d,Z as f,c as p,dn as m,gn as h,rt as g}from"./ui-vendor-xUzKqAXI.js";import{l as _,n as v}from"./authStore-Dh3beEOq.js";import{a as y,c as b,o as x,s as S,t as C}from"../assets/index-BBpNbfKW.js";import{t as w}from"./work-DVgm81bJ.js";var T=e(n(),1),E=t(),D=e=>e<5?[`home.greeting.night`,`Up late`]:e<12?[`home.greeting.morning`,`Morning`]:e<18?[`home.greeting.afternoon`,`Afternoon`]:[`home.greeting.evening`,`Evening`],O=`mb-2 text-xs font-medium text-gray-500 dark:text-dark-500`,k=`group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-start text-sm text-gray-700 transition-colors hover:bg-white hover:text-gray-950 dark:text-dark-700 dark:hover:bg-dark-200 dark:hover:text-dark-950 outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40`,A=()=>{let{t:e,i18n:t}=i(),n=r(),{user:A,systemInfo:j,canUseWork:M,canUseAgents:N}=v(),P=c(e=>e.sessions),F=_(e=>e.tasks),I=_(e=>e.capabilities),L=_(e=>e.loadTasks),R=_(e=>e.loadCapabilities),z=M(),B=N();(0,T.useEffect)(()=>{z&&(L(!0).catch(()=>{}),R().catch(()=>{}))},[z,L,R]);let[V,H]=D(new Date().getHours()),U=e(V,H),W=A?.username,G=[...P].sort((e,t)=>t.updatedAt-e.updatedAt).slice(0,4),K=[...F].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).slice(0,3),q=I?.activeRuntimes?.user??0,J=a()?`⌘`:`Ctrl`,Y=G.length>0||K.length>0,X=C(j?.version);return(0,E.jsx)(`div`,{"data-testid":`home-page`,className:`h-full overflow-y-auto scrollbar-thin`,children:(0,E.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-xl flex-col justify-center px-6 py-12`,children:[(0,E.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-gray-950 dark:text-dark-950`,children:W?`${U}, ${W}.`:`${U}.`}),(0,E.jsxs)(`p`,{"data-testid":`app-version`,className:`mt-1 font-mono text-xs text-gray-400 dark:text-dark-500`,children:[window.location.host||`Libre WebUI`,X?` · v${X}`:``]}),(0,E.jsxs)(`div`,{className:`mt-8`,children:[(0,E.jsx)(`p`,{className:O,children:e(`home.start`,`Start`)}),(0,E.jsxs)(`div`,{className:`-mx-2.5 flex flex-col`,children:[(0,E.jsxs)(`button`,{type:`button`,"data-testid":`home-new-chat`,className:k,onClick:()=>x(n),children:[(0,E.jsx)(g,{className:`h-4 w-4 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:text-dark-500 dark:group-hover:text-dark-700`}),(0,E.jsx)(`span`,{className:`flex-1`,children:e(`tabs.newChat`,`New Chat`)}),(0,E.jsxs)(`span`,{className:`font-mono text-[10px] tracking-wide text-gray-400 opacity-0 transition-opacity group-hover:opacity-100 dark:text-dark-500`,children:[J,`⇧O`]})]}),(0,E.jsxs)(`button`,{type:`button`,"data-testid":`home-incognito-chat`,className:k,onClick:()=>y(n),children:[(0,E.jsx)(l,{className:`h-4 w-4 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:text-dark-500 dark:group-hover:text-dark-700`}),(0,E.jsx)(`span`,{className:`flex-1`,children:e(`chat.session.incognito`,`Incognito Chat`)})]}),z&&(0,E.jsxs)(`button`,{type:`button`,"data-testid":`home-new-work`,className:k,onClick:()=>S(n),children:[(0,E.jsx)(m,{className:`h-4 w-4 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:text-dark-500 dark:group-hover:text-dark-700`}),(0,E.jsx)(`span`,{className:`flex-1`,children:e(`tabs.newWork`,`New Work`)}),(0,E.jsxs)(`span`,{className:`font-mono text-[10px] tracking-wide text-gray-400 opacity-0 transition-opacity group-hover:opacity-100 dark:text-dark-500`,children:[J,`⇧U`]})]})]})]}),Y&&(0,E.jsxs)(`div`,{className:`mt-8`,children:[(0,E.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,E.jsx)(`p`,{className:s(O,`mb-0`),children:e(`home.continue`,`Continue`)}),z&&q>0&&(0,E.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[10px] text-gray-400 dark:text-dark-500`,children:[(0,E.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse-subtle rounded-full bg-[rgb(48,121,255)]`}),q,` `,e(`home.active`,`active`)]})]}),(0,E.jsxs)(`div`,{className:`-mx-2.5 flex flex-col`,children:[K.map(r=>{let i=b[r.status];return(0,E.jsxs)(`button`,{type:`button`,"data-testid":`home-continue-work`,className:k,onClick:()=>n(`/work/${r.id}`),children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:s(`h-2 w-2 shrink-0 rounded-full ring-1 ring-black/[0.06] dark:ring-white/[0.1]`,i.animated&&`animate-pulse-subtle`),style:{backgroundColor:i.color}}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r.title||e(`work.tasks.untitled`,`Untitled task`)}),r.hostPath&&(0,E.jsx)(`span`,{className:`hidden max-w-[14rem] shrink-0 truncate font-mono text-[10px] text-gray-400 sm:inline dark:text-dark-500`,title:r.hostPath,children:r.hostPath}),(0,E.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-gray-400 dark:text-dark-500`,children:w(r)?e(i.labelKey,i.label):o(new Date(r.updatedAt).getTime(),t.language)})]},r.id)}),G.map(r=>(0,E.jsxs)(`button`,{type:`button`,"data-testid":`home-continue-chat`,className:k,onClick:()=>n(`/c/${r.id}`),children:[(0,E.jsx)(g,{className:`h-4 w-4 shrink-0 text-gray-400 dark:text-dark-500`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r.title||e(`tabs.chat`,`Chat`)}),(0,E.jsx)(`span`,{className:`hidden shrink-0 font-mono text-[10px] text-gray-400 sm:inline dark:text-dark-500`,children:r.model}),(0,E.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-gray-400 dark:text-dark-500`,children:o(r.updatedAt,t.language)})]},r.id))]})]}),(0,E.jsxs)(`div`,{className:`mt-8`,children:[(0,E.jsx)(`p`,{className:O,children:e(`home.explore`,`Explore`)}),(0,E.jsx)(`div`,{className:`-mx-2.5 flex flex-col`,children:[[`/notes`,f,e(`sidebar.navigation.notes`,`Notes`)],[`/models`,d,e(`sidebar.navigation.models`,`Models`)],[`/personas`,p,e(`sidebar.navigation.personas`,`Personas`)],[`/gallery`,u,e(`sidebar.navigation.imagine`,`Imagine`)],...B?[[`/agents`,h,e(`sidebar.navigation.agents`,`Agents`)]]:[]].map(([e,t,r])=>(0,E.jsxs)(`button`,{type:`button`,className:k,onClick:()=>n(e),children:[(0,E.jsx)(t,{className:`h-4 w-4 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:text-dark-500 dark:group-hover:text-dark-700`}),(0,E.jsx)(`span`,{className:`flex-1`,children:r})]},e))})]})]})})};export{A as HomePage,A as default};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{d as r}from"./router-vendor-CbPDks39.js";import{t as i}from"./useTranslation-C3ei3mJq.js";import{a,r as o,t as s}from"./utils-CuC1beTY.js";import{t as c}from"./chatStore-DXGUVLXD.js";import{Et as l,T as u,Wt as d,Z as f,c as p,dn as m,gn as h,rt as g}from"./ui-vendor-D3Ahl1x5.js";import{n as _,u as v}from"./authStore-OaTuapL7.js";import{d as y,f as b,m as x,p as S,t as C}from"../assets/index-CUhEG7E2.js";import{t as w}from"./work-DVgm81bJ.js";var T=e(t(),1),E=n(),D=e=>e<5?[`home.greeting.night`,`Up late`]:e<12?[`home.greeting.morning`,`Morning`]:e<18?[`home.greeting.afternoon`,`Afternoon`]:[`home.greeting.evening`,`Evening`],O=`mb-2 text-xs font-medium text-gray-500 dark:text-dark-500`,k=`group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-start text-sm text-gray-700 transition-colors hover:bg-white hover:text-gray-950 dark:text-dark-700 dark:hover:bg-dark-200 dark:hover:text-dark-950 outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40`,A=()=>{let{t:e,i18n:t}=i(),n=r(),{user:A,systemInfo:j,canUseWork:M,canUseAgents:N}=_(),P=c(e=>e.sessions),F=v(e=>e.tasks),I=v(e=>e.capabilities),L=v(e=>e.loadTasks),R=v(e=>e.loadCapabilities),z=M(),B=N();(0,T.useEffect)(()=>{z&&(L(!0).catch(()=>{}),R().catch(()=>{}))},[z,L,R]);let[V,H]=D(new Date().getHours()),U=e(V,H),W=A?.username,G=[...P].sort((e,t)=>t.updatedAt-e.updatedAt).slice(0,4),K=[...F].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).slice(0,3),q=I?.activeRuntimes?.user??0,J=a()?`⌘`:`Ctrl`,Y=G.length>0||K.length>0,X=C(j?.version);return(0,E.jsx)(`div`,{"data-testid":`home-page`,className:`h-full overflow-y-auto scrollbar-thin`,children:(0,E.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-xl flex-col justify-center px-6 py-12`,children:[(0,E.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-gray-950 dark:text-dark-950`,children:W?`${U}, ${W}.`:`${U}.`}),(0,E.jsxs)(`p`,{"data-testid":`app-version`,className:`mt-1 font-mono text-xs text-gray-400 dark:text-dark-500`,children:[window.location.host||`Libre WebUI`,X?` · v${X}`:``]}),(0,E.jsxs)(`div`,{className:`mt-8`,children:[(0,E.jsx)(`p`,{className:O,children:e(`home.start`,`Start`)}),(0,E.jsxs)(`div`,{className:`-mx-2.5 flex flex-col`,children:[(0,E.jsxs)(`button`,{type:`button`,"data-testid":`home-new-chat`,className:k,onClick:()=>b(n),children:[(0,E.jsx)(g,{className:`h-4 w-4 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:text-dark-500 dark:group-hover:text-dark-700`}),(0,E.jsx)(`span`,{className:`flex-1`,children:e(`tabs.newChat`,`New Chat`)}),(0,E.jsxs)(`span`,{className:`font-mono text-[10px] tracking-wide text-gray-400 opacity-0 transition-opacity group-hover:opacity-100 dark:text-dark-500`,children:[J,`⇧O`]})]}),(0,E.jsxs)(`button`,{type:`button`,"data-testid":`home-incognito-chat`,className:k,onClick:()=>y(n),children:[(0,E.jsx)(l,{className:`h-4 w-4 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:text-dark-500 dark:group-hover:text-dark-700`}),(0,E.jsx)(`span`,{className:`flex-1`,children:e(`chat.session.incognito`,`Incognito Chat`)})]}),z&&(0,E.jsxs)(`button`,{type:`button`,"data-testid":`home-new-work`,className:k,onClick:()=>S(n),children:[(0,E.jsx)(m,{className:`h-4 w-4 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:text-dark-500 dark:group-hover:text-dark-700`}),(0,E.jsx)(`span`,{className:`flex-1`,children:e(`tabs.newWork`,`New Work`)}),(0,E.jsxs)(`span`,{className:`font-mono text-[10px] tracking-wide text-gray-400 opacity-0 transition-opacity group-hover:opacity-100 dark:text-dark-500`,children:[J,`⇧U`]})]})]})]}),Y&&(0,E.jsxs)(`div`,{className:`mt-8`,children:[(0,E.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between`,children:[(0,E.jsx)(`p`,{className:s(O,`mb-0`),children:e(`home.continue`,`Continue`)}),z&&q>0&&(0,E.jsxs)(`span`,{className:`flex items-center gap-1.5 font-mono text-[10px] text-gray-400 dark:text-dark-500`,children:[(0,E.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse-subtle rounded-full bg-[rgb(48,121,255)]`}),q,` `,e(`home.active`,`active`)]})]}),(0,E.jsxs)(`div`,{className:`-mx-2.5 flex flex-col`,children:[K.map(r=>{let i=x[r.status];return(0,E.jsxs)(`button`,{type:`button`,"data-testid":`home-continue-work`,className:k,onClick:()=>n(`/work/${r.id}`),children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:s(`h-2 w-2 shrink-0 rounded-full ring-1 ring-black/[0.06] dark:ring-white/[0.1]`,i.animated&&`animate-pulse-subtle`),style:{backgroundColor:i.color}}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r.title||e(`work.tasks.untitled`,`Untitled task`)}),r.hostPath&&(0,E.jsx)(`span`,{className:`hidden max-w-[14rem] shrink-0 truncate font-mono text-[10px] text-gray-400 sm:inline dark:text-dark-500`,title:r.hostPath,children:r.hostPath}),(0,E.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-gray-400 dark:text-dark-500`,children:w(r)?e(i.labelKey,i.label):o(new Date(r.updatedAt).getTime(),t.language)})]},r.id)}),G.map(r=>(0,E.jsxs)(`button`,{type:`button`,"data-testid":`home-continue-chat`,className:k,onClick:()=>n(`/c/${r.id}`),children:[(0,E.jsx)(g,{className:`h-4 w-4 shrink-0 text-gray-400 dark:text-dark-500`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r.title||e(`tabs.chat`,`Chat`)}),(0,E.jsx)(`span`,{className:`hidden shrink-0 font-mono text-[10px] text-gray-400 sm:inline dark:text-dark-500`,children:r.model}),(0,E.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-gray-400 dark:text-dark-500`,children:o(r.updatedAt,t.language)})]},r.id))]})]}),(0,E.jsxs)(`div`,{className:`mt-8`,children:[(0,E.jsx)(`p`,{className:O,children:e(`home.explore`,`Explore`)}),(0,E.jsx)(`div`,{className:`-mx-2.5 flex flex-col`,children:[[`/notes`,f,e(`sidebar.navigation.notes`,`Notes`)],[`/models`,d,e(`sidebar.navigation.models`,`Models`)],[`/personas`,p,e(`sidebar.navigation.personas`,`Personas`)],[`/gallery`,u,e(`sidebar.navigation.imagine`,`Imagine`)],...B?[[`/agents`,h,e(`sidebar.navigation.agents`,`Agents`)]]:[]].map(([e,t,r])=>(0,E.jsxs)(`button`,{type:`button`,className:k,onClick:()=>n(e),children:[(0,E.jsx)(t,{className:`h-4 w-4 shrink-0 text-gray-400 transition-colors group-hover:text-gray-600 dark:text-dark-500 dark:group-hover:text-dark-700`}),(0,E.jsx)(`span`,{className:`flex-1`,children:r})]},e))})]})]})})};export{A as HomePage,A as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{d as t,f as n}from"./markdown-core-DHnR5Hw8.js";import{n as r}from"./i18next-DgmgtwsV.js";import{a as i,i as a,n as o,o as s,r as c,t as l}from"./useTranslation-CXY69qNk.js";import{c as u,f as d,t as f,u as p}from"./utils-BM0_0iFj.js";import{Cn as m,En as h,K as g,R as _,Tt as v,V as y,Vt as b,Zt as x,gn as S,k as C,lt as w,m as ee,n as T,sn as te,un as ne,v as E,x as re}from"./ui-vendor-xUzKqAXI.js";import{t as D}from"./logger-DSXjF4ye.js";import{h as O}from"./api-CLEmGcEh.js";import{t as k}from"./Button-CTXHujOd.js";import{n as ie,t as A}from"./ui-BnDZpjfc.js";var j={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,"!doctype":!0,"!DOCTYPE":!0},ae=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;function M(e){let t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(j[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){let t=e.indexOf(`-->`);return{type:`comment`,comment:t===-1?``:e.slice(4,t)}}let r=new RegExp(ae),i=null;for(;i=r.exec(e),i!==null;)if(i[0].trim())if(i[1]){let e=i[1].trim(),n=[e,null],a=e.indexOf(`=`);a>-1&&(n=[e.slice(0,a),e.slice(a+1)]),t.attrs[n[0]]=n[1],r.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var N=/<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,P=/<\/?([^\s]+?)[/\s>]/,oe=/^\s*$/,se=/^(script|style)$/i,F=`\0`,ce=Object.create(null);function I(e){e.forEach(function(e){if(e.type===`text`){e.content=e.content.split(F).join(`<`);return}if(e.type===`comment`){e.comment=e.comment.split(F).join(`<`);return}for(let t in e.attrs){let n=e.attrs[t];typeof n==`string`&&n.indexOf(F)>-1&&(e.attrs[t]=n.split(F).join(`<`))}e.children.length&&I(e.children)})}function le(e,t){let n=t&&t.components||ce,r=t&&t.allowedTags,i=!1;if(r){let t=typeof r==`function`?r:function(e){return r.indexOf(e)>-1},n=``,a=0;N.lastIndex=0;let o;for(;o=N.exec(e);){let r=o[0];n+=e.slice(a,o.index);let s=r.match(P);r.startsWith(`<!--`)||s&&t(s[1])?(n+=r,a=o.index+r.length):(i=!0,n+=F,a=o.index+1,N.lastIndex=a)}e=n+e.slice(a)}let a=[],o=[],s,c=-1,l=!1,u=0,d;if(e.indexOf(`<`)!==0){let t=e.indexOf(`<`);a.push({type:`text`,content:t===-1?e:e.substring(0,t)})}let f=[],p;for(;p=N.exec(e);)f.push(p);return f.forEach(function(e,t){let n=e[0];if(!n||n.startsWith(`<!--`))return;let r=0,i=0,a=-1,o=null;for(let e=0;e<n.length;e++){let t=n.charAt(e);o?t===o&&(o=null):t===`"`||t===`'`?o=t:t===`<`?(r++,r===2&&(a=e)):t===`>`&&i++}let s=a>-1&&/[a-zA-Z0-9\-!/]/.test(n.charAt(a+1));if(r>i&&s){let e=n.substring(0,a),r=n.substring(e.length);f[t][0]=r,f[t].index+=e.length}}),f.forEach(function(t,r){let i=t[0];if(!i)return;let p=t.index;if(p<u)return;if(l){if(i!==`</`+s.name+`>`)return;l=!1}let m=i.charAt(1)!==`/`,h=i.startsWith(`<!--`),g=p+i.length,_=e.charAt(g),v=f[r+1],y;if(_===`<`&&v){let t=e.substring(g,v.index);y=t.split(`<`).length>t.split(`>`).length}let b;if(h){let t=M(i);if(c<0)return a.push(t),a;b=o[c],b.children.push(t);let n=e.slice(g,v?v.index:void 0);return n.length>0&&b.children.push({type:`text`,content:n}),a}if(m){c++,s=M(i),s.type===`tag`&&n[s.name]&&(s.type=`component`,l=!0);let t=!1;if(!l&&!s.voidElement&&se.test(s.name)){t=!0,d||(d=e.toLowerCase());let n=d.indexOf(`</`+s.name.toLowerCase()+`>`,g),r=n===-1?e.length:n,i=e.slice(g,r);i&&s.children.push({type:`text`,content:i}),u=r}!s.voidElement&&!l&&!t&&_&&_!==`<`&&s.children.push({type:`text`,content:e.slice(g,v?v.index:void 0)}),c===0&&a.push(s),b=o[c-1],b&&b.children.push(s),o[c]=s}if((!m||s.voidElement)&&(c>-1&&(s.voidElement||s.name===i.slice(2,-1))&&(c--,s=c===-1?a:o[c]),!l&&(_!==`<`||y)&&_)){b=c===-1?a:o[c].children;let t=v?v.index:-1,n=e.slice(g,t===-1?void 0:t);oe.test(n)&&(n=` `),(t>-1&&c+b.length>=0||n!==` `)&&b.push({type:`text`,content:n})}}),i&&I(a),a}function ue(e){let t=[];for(let n in e)e[n]===null?t.push(n):t.push(n+`="`+String(e[n]).replace(/"/g,`&quot;`)+`"`);return t.length?` `+t.join(` `):``}function de(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:{let n=t.voidElement&&t.name.toLowerCase()!==`!doctype`?`/>`:`>`;return e+=`<`+t.name+(t.attrs?ue(t.attrs):``)+n,t.voidElement?e:e+t.children.reduce(de,``)+`</`+t.name+`>`}case`comment`:return e+=`<!--`+t.comment+`-->`,e}}function fe(e){return e.reduce(function(e,t){return e+de(``,t)},``)}var L={parse:le,stringify:fe},R=e(n()),z=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},B=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?V(t):t},pe=e=>Array.isArray(e)&&e.every(R.isValidElement),V=e=>Array.isArray(e)?e:[e],me=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},he=e=>{let t={};if(!e)return t;let n=e=>{V(e).forEach(e=>{a(e)||(z(e)?n(B(e)):c(e)&&!(0,R.isValidElement)(e)&&Object.assign(t,e))})};return n(e),t},H=(e,t,n,r)=>{if(!e)return``;let o=``,s=V(e),l=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return s.forEach((e,s)=>{if(a(e)){o+=`${e}`;return}if((0,R.isValidElement)(e)){let{props:i,type:c}=e,u=Object.keys(i).length,d=l.indexOf(c)>-1,f=i.children;if(!f&&d&&!u){o+=`<${c}/>`;return}if(!f&&(!d||u)||i.i18nIsDynamicList){o+=`<${s}></${s}>`;return}if(d&&u<=1){let e=a(f)?f:H(f,t,n,r);o+=`<${c}>${e}</${c}>`;return}let p=H(f,t,n,r);o+=`<${s}>${p}</${s}>`;return}if(e===null){i(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(c(e)){let{format:t,...a}=e,s=Object.keys(a);if(s.length===1){let e=t?`${s[0]}, ${t}`:s[0];o+=`{{${e}}}`;return}i(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}i(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),o},U=(e,t,n,r,i,o,s)=>{if(n===``)return[];let l=i.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(l.map(e=>`<${e}`).join(`|`)).test(n);if(!e&&!t&&!u&&!s)return[n];let f=t??{},m=e=>{V(e).forEach(e=>{a(e)||(z(e)?m(B(e)):c(e)&&!(0,R.isValidElement)(e)&&Object.assign(f,e))})};m(e);let h=Object.keys(f),g=L.parse(`<0>${n}</0>`,{allowedTags:e=>/^\d+$/.test(e)||l.indexOf(e)>-1||h.indexOf(e)>-1}),_={...f,...o},v=(e,t,n)=>{let r=B(e),i=b(r,t.children,n);return pe(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},y=(e,t,n,r,i)=>{e.dummy?(e.children=t,n.push((0,R.cloneElement)(e,{key:r},i?void 0:t))):n.push(...R.Children.map([e],e=>{if(e.type===R.Fragment||e.props?.i18nIsDynamicList!==void 0){let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t!==`children`&&t!==`i18nIsDynamicList`&&(n[t]=e.props[t])}),(0,R.createElement)(e.type,n,i?null:t)}let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t!==`ref`&&t!==`children`&&(n[t]=e.props[t])}),(0,R.cloneElement)(e,n,i?null:t)}))},b=(e,n,o)=>{let f=V(e),m=V(n),h={};return m.reduce((e,n,m)=>{let g=n.children?.[0]?.content&&r.services.interpolator.interpolate(n.children[0].content,_,r.language);if(n.type===`tag`){let p=f[parseInt(n.name,10)];!p&&t&&(p=t[n.name]),o.length===1&&!p&&(p=o[0][n.name]),p||(p={});let x={...n.attrs};s&&Object.keys(x).forEach(e=>{let t=x[e];a(t)&&(x[e]=d(t))});let S=Object.keys(x).length===0?p:me({props:x},p),C=(0,R.isValidElement)(S),w=C&&z(n,!0)&&!n.voidElement,ee=u&&c(S)&&S.dummy&&!C,T=c(t)&&Object.hasOwnProperty.call(t,n.name);if(a(S)){let t=r.services.interpolator.interpolate(S,_,r.language);e.push(t)}else if(z(S)||w){let t=v(S,n,o);y(S,t,e,m)}else if(ee){let t=b(f,n.children,o);y(S,t,e,m)}else if(Number.isNaN(parseFloat(n.name)))if(T){let t=v(S,n,o);y(S,t,e,m,n.voidElement)}else if(i.transSupportBasicHtmlNodes&&l.indexOf(n.name)>-1)if(n.voidElement)e.push((0,R.createElement)(n.name,{key:`${n.name}-${m}`}));else{let t=h[n.name]||0;h[n.name]=t+1;let r,i=0;for(let e=0;e<f.length;e+=1){let a=f[e];if((0,R.isValidElement)(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let a=r?V(B(r)):f,s=b(a,n.children,o);e.push((0,R.createElement)(n.name,{key:`${n.name}-${m}`},s))}else if(n.voidElement)e.push(`<${n.name} />`);else{let t=b(f,n.children,o);e.push(`<${n.name}>${t}</${n.name}>`)}else if(c(S)&&!C){let t=n.children[0]?g:null;t&&e.push(t)}else y(S,g,e,m,n.children.length!==1||!g)}else if(n.type===`text`){let t=i.transWrapTextNodes,a=typeof i.unescape==`function`?i.unescape:p().unescape,o=s?a(r.services.interpolator.interpolate(n.content,_,r.language)):r.services.interpolator.interpolate(n.content,_,r.language);t?e.push((0,R.createElement)(t,{key:`${n.name}-${m}`},o)):e.push(o)}return e},[])};return B(b([{dummy:!0,children:e||[]}],g,V(e||[]))[0])},W=(e,t,n)=>{let r=e.key||t,i=(0,R.cloneElement)(e,{key:r});if(!i.props||!i.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return i;function a(){return(0,R.createElement)(R.Fragment,null,i)}return(0,R.createElement)(a,{key:r})},G=(e,t)=>e.map((e,n)=>W(e,n,t)),ge=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:W(e[r],r,t)})}),n},_e=(e,t,n,r)=>e?Array.isArray(e)?G(e,t):c(e)?ge(e,t):(s(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,ve=e=>!c(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function ye({children:e,count:t,parent:n,i18nKey:i,context:o,tOptions:c={},values:l,defaults:d,components:f,ns:m,i18n:h,t:g,shouldUnescape:_,...v}){let y=h||u();if(!y)return s(y,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`,{i18nKey:i}),e;let b=g||y.t.bind(y)||(e=>e),x={...p(),...y.options?.react},S=m||b.ns||y.options?.defaultNS;S=a(S)?[S]:S||[`translation`];let{transDefaultProps:C}=x,w=C?.tOptions?{...C.tOptions,...c}:c,ee=_??C?.shouldUnescape,T=C?.values?{...C.values,...l}:l,te=C?.components?{...C.components,...f}:f,ne=H(e,x,y,i),E=d||w?.defaultValue||ne||x.transEmptyNodeValue||(typeof i==`function`?r(i):i),{hashTransKey:re}=x,D=i||(re?re(ne||E):ne||E);l=y.options?.interpolation?.defaultVariables?T&&Object.keys(T).length>0?{...T,...y.options.interpolation.defaultVariables}:{...y.options.interpolation.defaultVariables}:T;let O=he(e);O&&typeof O.count==`number`&&t===void 0&&(t=O.count);let k=l||t!==void 0&&!y.options?.interpolation?.alwaysFormat||!e?w.interpolation:{interpolation:{...w.interpolation,prefix:`#$?`,suffix:`?$#`}},ie={...w,context:o||w.context,count:t,...l,...k,defaultValue:E,ns:S},A=D?b(D,ie):E;A===D&&E&&(A=E);let j=_e(te,A,y,i),ae=j||e,M=null;ve(j)&&(M=j,ae=e);let N=U(ae,M,A,y,x,ie,ee),P=n??x.defaultTransParent;return P?(0,R.createElement)(P,v,N):N}function be({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:s,defaults:c,components:l,ns:d,i18n:f,t:p,shouldUnescape:m,...h}){let{i18n:g,defaultNS:_}=(0,R.useContext)(o)||{},v=f||g||u(),y=p||v?.t.bind(v);return ye({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a,values:s,defaults:c,components:l,ns:d||y?.ns||_||v?.options?.defaultNS,i18n:v,t:p,shouldUnescape:m,...h})}var K=t(),q=D(`pages:libre-claw`),xe={queued:`bg-gray-100 text-gray-700 dark:bg-dark-200 dark:text-dark-700`,running:`bg-primary-100 text-primary-700 dark:bg-primary-900/25 dark:text-primary-300`,blocked:`bg-amber-500/20 text-ink dark:bg-amber-900/30`,done:`bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300`,failed:`bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300`,cancelled:`bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300`},Se={assistant_message:`text-primary-600 dark:text-primary-300`,assistant_delta:`text-primary-600 dark:text-primary-300`,user_message:`text-gray-700 dark:text-dark-700`,permission_request:`text-ink`,permission_response:`text-gray-600 dark:text-dark-600`,tool_call:`text-gray-600 dark:text-dark-600`,tool_result:`text-gray-600 dark:text-dark-600`,usage:`text-gray-600 dark:text-dark-600`,error:`text-red-600 dark:text-red-300`,run_finished:`text-emerald-600 dark:text-emerald-300`},Ce=[[`lobster`,`Lobster`],[`lobster-light`,`Lobster Light`],[`github-dark`,`GitHub Dark`],[`github-light`,`GitHub Light`],[`monokai-pro`,`Monokai Pro`],[`night-owl`,`Night Owl`],[`tokyo-night`,`Tokyo Night`],[`ayu`,`Ayu`],[`dracula`,`Dracula`],[`catppuccin-mocha`,`Catppuccin Mocha`],[`catppuccin-latte`,`Catppuccin Latte`],[`gruvbox-dark`,`Gruvbox Dark`],[`nord`,`Nord`],[`solarized-dark`,`Solarized Dark`],[`solarized-light`,`Solarized Light`],[`one-dark-pro`,`One Dark Pro`],[`rose-pine`,`Rose Pine`],[`kanagawa`,`Kanagawa`],[`matrix`,`Matrix`]],we=()=>{let{t:e}=l(),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)([]),[a,o]=(0,R.useState)([]),[s,c]=(0,R.useState)([]),[u,d]=(0,R.useState)(null),[p,D]=(0,R.useState)(null),[j,ae]=(0,R.useState)(``),[M,N]=(0,R.useState)(null),[P,oe]=(0,R.useState)(!0),[se,F]=(0,R.useState)(!1),[ce,I]=(0,R.useState)(!1),[le,ue]=(0,R.useState)(!1),[de,fe]=(0,R.useState)(!1),[L,z]=(0,R.useState)(``),[B,pe]=(0,R.useState)(`chat`),[V,me]=(0,R.useState)(``),[he,H]=(0,R.useState)(``),[U,W]=(0,R.useState)(``),[G,ge]=(0,R.useState)(``),[_e,ve]=(0,R.useState)(!1),[ye,xe]=(0,R.useState)(`lobster`),[Se,we]=(0,R.useState)(!0),[ke,Ae]=(0,R.useState)(``),[je,Y]=(0,R.useState)(``),[X,Fe]=(0,R.useState)(``),[Ie,Le]=(0,R.useState)(`report`),Z=(0,R.useMemo)(()=>r.find(e=>e.run_id===M)||null,[r,M]),Q=(0,R.useMemo)(()=>{let e=new Set(a.filter(e=>e.type===`permission_response`).map(e=>String(e.data.tool_call_id||``)));return a.filter(t=>{if(t.type!==`permission_request`)return!1;let n=String(t.data.tool_call_id||``);return n&&!e.has(n)})},[a]),Re=(0,R.useMemo)(()=>Pe(a,e),[a,e]),$=(0,R.useCallback)(async()=>{try{let[e,t,r,a,o,s]=await Promise.all([O.status(),O.listRuns(30),O.currentModel(),O.currentFallback(),O.usage(``,100),O.listAutomations(50)]);e.success&&e.data&&n(e.data),t.success&&t.data&&(i(t.data.runs),N(e=>e||t.data?.runs[0]?.run_id||null)),r.success&&r.data&&(d(r.data),W(String(r.data.provider||``)),ge(String(r.data.model||``))),a.success&&a.data&&D(a.data),o.success&&o.data&&ae(String(o.data.text||``)),s.success&&s.data&&c(s.data.automations)}catch(t){q.error(`Failed to load Libre Claw overview:`,t),h.error(e(`libreClaw.toasts.loadStatusFailed`))}finally{oe(!1)}},[e]),ze=(0,R.useCallback)(async(e,t=!1)=>{let n=t?0:a.length>0&&a[a.length-1]?.event_id||0;try{let r=await O.getEvents(e,n);r.success&&r.data&&o(e=>t?r.data?.events||[]:[...e,...r.data?.events||[]])}catch(e){q.error(`Failed to load Libre Claw events:`,e)}},[a]);(0,R.useEffect)(()=>{let e=window.setTimeout(()=>{$()},0);return()=>window.clearTimeout(e)},[$]),(0,R.useEffect)(()=>{if(!M){let e=window.setTimeout(()=>{o([])},0);return()=>window.clearTimeout(e)}let e=M;O.getEvents(e,0).then(e=>{e.success&&e.data&&o(e.data.events)}).catch(e=>{q.error(`Failed to load Libre Claw events:`,e)})},[M]),(0,R.useEffect)(()=>{if(!M||!Z||![`queued`,`running`,`blocked`].includes(Z.state))return;let e=window.setInterval(()=>{ze(M),O.listRuns(30).then(e=>{e.success&&e.data&&i(e.data.runs)})},1500);return()=>window.clearInterval(e)},[ze,Z,M]);let Be=async()=>{if(!L.trim()){h.error(e(`libreClaw.toasts.enterTask`));return}F(!0);try{let t=await O.startRun({message:L,kind:B,provider:V||void 0,model:he||void 0});if(t.success&&t.data){let n=t.data.run;i(e=>[n,...e.filter(e=>e.run_id!==n.run_id)]),N(n.run_id),z(``),h.success(e(`libreClaw.toasts.runStarted`))}else h.error(t.error||e(`libreClaw.toasts.startRunFailed`))}catch(t){q.error(`Failed to start Libre Claw run:`,t),h.error(e(`libreClaw.toasts.startRunFailed`))}finally{F(!1)}},Ve=async t=>{try{await O.cancelRun(t),await $(),h.success(e(`libreClaw.toasts.runCancelled`))}catch(t){q.error(`Failed to cancel Libre Claw run:`,t),h.error(e(`libreClaw.toasts.cancelRunFailed`))}},He=async(t,n)=>{if(!M)return;let r=String(t.data.tool_call_id||``);if(r)try{await O.resolvePermission(M,r,n),await ze(M,!0),h.success(e(n===`deny`?`libreClaw.toasts.denied`:`libreClaw.toasts.approved`))}catch(t){q.error(`Failed to resolve Libre Claw permission:`,t),h.error(e(`libreClaw.toasts.resolvePermissionFailed`))}},Ue=async()=>{if(!U.trim()||!G.trim()){h.error(e(`libreClaw.toasts.providerModelRequired`));return}I(!0);try{let t=await O.updateModel(U,G,_e);t.success&&t.data?(d(t.data),h.success(e(`libreClaw.toasts.modelUpdated`))):h.error(t.error||e(`libreClaw.toasts.updateModelFailed`))}catch(t){q.error(`Failed to update Libre Claw model:`,t),h.error(e(`libreClaw.toasts.updateModelFailed`))}finally{I(!1)}},We=async()=>{ue(!0);try{let t=await O.updateTheme(ye,Se);t.success?h.success(e(`libreClaw.toasts.themeUpdated`)):h.error(t.error||e(`libreClaw.toasts.updateThemeFailed`))}catch(t){q.error(`Failed to update Libre Claw theme:`,t),h.error(e(`libreClaw.toasts.updateThemeFailed`))}finally{ue(!1)}},Ge=async()=>{if(!ke.trim()||!je.trim()||!X.trim()){h.error(e(`libreClaw.toasts.automationRequired`));return}fe(!0);try{let t=await O.createAutomation({name:ke,schedule:je,prompt:X,route:Ie});t.success?(Ae(``),Y(``),Fe(``),await $(),h.success(e(`libreClaw.toasts.automationCreated`))):h.error(t.error||e(`libreClaw.toasts.createAutomationFailed`))}catch(t){q.error(`Failed to create Libre Claw automation:`,t),h.error(e(`libreClaw.toasts.createAutomationFailed`))}finally{fe(!1)}},Ke=async(t,n)=>{try{n===`pause`&&await O.pauseAutomation(t),n===`resume`&&await O.resumeAutomation(t),n===`run`&&await O.runAutomationNow(t),n===`delete`&&await O.deleteAutomation(t),await $(),h.success(e(`libreClaw.toasts.automationUpdated`))}catch(t){q.error(`Failed to update Libre Claw automation:`,t),h.error(e(`libreClaw.toasts.updateAutomationFailed`))}};return(0,K.jsxs)(ie,{width:`wide`,contentClassName:`space-y-6`,children:[(0,K.jsx)(A,{className:`mb-0`,title:e(`libreClaw.title`),description:e(`libreClaw.subtitle`),actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Te,{status:t,t:e}),(0,K.jsxs)(k,{variant:`secondary`,size:`sm`,onClick:$,children:[(0,K.jsx)(_,{className:`h-4 w-4`}),e(`common.refresh`)]}),(0,K.jsxs)(`a`,{href:t?.dashboardUrl||`http://127.0.0.1:8766/dashboard`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-xl border border-gray-200/80 bg-white/70 px-3 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-white dark:border-white/10 dark:bg-white/[0.04] dark:text-dark-700 dark:hover:bg-white/[0.08]`,children:[(0,K.jsx)(b,{className:`h-4 w-4`}),e(`libreClaw.dashboard`)]})]})}),!t?.connected&&!P&&(0,K.jsx)(`section`,{className:`rounded-xl border border-amber-200 bg-amber-500/10 p-4 text-ink dark:border-amber-800 dark:bg-amber-900/20`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(E,{className:`mt-0.5 h-5 w-5 shrink-0 text-amber-500`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{className:`font-semibold`,children:e(`libreClaw.connection.disconnectedTitle`)}),(0,K.jsx)(`p`,{className:`mt-1 text-sm opacity-90`,children:(0,K.jsx)(be,{i18nKey:`libreClaw.connection.disconnectedDescription`,components:{command:(0,K.jsx)(`code`,{}),env:(0,K.jsx)(`code`,{})}})}),t?.error&&(0,K.jsx)(`p`,{className:`mt-2 text-xs opacity-80`,children:t.error})]})]})}),(0,K.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,K.jsx)(J,{title:e(`libreClaw.startRun.title`),icon:(0,K.jsx)(y,{className:`h-4 w-4`}),children:(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`textarea`,{value:L,onChange:e=>z(e.target.value),placeholder:e(`libreClaw.startRun.placeholder`),className:`min-h-32 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm text-gray-900 outline-none transition focus:border-primary-400 focus:ring-2 focus:ring-primary-100 dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800 dark:focus:border-primary-500 dark:focus:ring-primary-900/30`}),(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-4`,children:[(0,K.jsxs)(`select`,{value:B,onChange:e=>pe(e.target.value),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`,children:[(0,K.jsx)(`option`,{value:`chat`,children:e(`libreClaw.startRun.chatRun`)}),(0,K.jsx)(`option`,{value:`goal`,children:e(`libreClaw.startRun.goalMode`)})]}),(0,K.jsx)(`input`,{value:V,onChange:e=>me(e.target.value),placeholder:e(`libreClaw.startRun.providerOverride`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsx)(`input`,{value:he,onChange:e=>H(e.target.value),placeholder:e(`libreClaw.startRun.modelOverride`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsxs)(k,{onClick:Be,loading:se,children:[(0,K.jsx)(S,{className:`h-4 w-4`}),e(`libreClaw.startRun.run`)]})]})]})}),(0,K.jsx)(J,{title:e(`libreClaw.modelRoute.title`),icon:(0,K.jsx)(v,{className:`h-4 w-4`}),children:(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-1`,children:[(0,K.jsx)(`input`,{value:U,onChange:e=>W(e.target.value),placeholder:e(`libreClaw.modelRoute.providerPlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsx)(`input`,{value:G,onChange:e=>ge(e.target.value),placeholder:e(`libreClaw.modelRoute.modelPlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`})]}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-gray-600 dark:text-dark-600`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:_e,onChange:e=>ve(e.target.checked),className:`h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-500`}),e(`libreClaw.modelRoute.persistGlobal`)]}),(0,K.jsx)(k,{variant:`secondary`,onClick:Ue,loading:ce,children:e(`libreClaw.modelRoute.saveModel`)}),(0,K.jsxs)(`div`,{className:`border-t border-gray-100 pt-3 dark:border-dark-200`,children:[(0,K.jsx)(`label`,{className:`mb-1 block text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-500`,children:e(`libreClaw.modelRoute.theme`)}),(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto] lg:grid-cols-1`,children:[(0,K.jsx)(`select`,{value:ye,onChange:e=>xe(e.target.value),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`,children:Ce.map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:t},e))}),(0,K.jsx)(k,{variant:`secondary`,onClick:We,loading:le,children:e(`libreClaw.modelRoute.saveTheme`)})]}),(0,K.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-sm text-gray-600 dark:text-dark-600`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:Se,onChange:e=>we(e.target.checked),className:`h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-500`}),e(`libreClaw.modelRoute.persistGlobal`)]})]}),u&&(0,K.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-lg bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(u,null,2)})]})})]}),(0,K.jsxs)(`section`,{className:`grid gap-4 xl:grid-cols-[360px_minmax(0,1fr)]`,children:[(0,K.jsx)(J,{title:e(`libreClaw.runs.title`),icon:(0,K.jsx)(m,{className:`h-4 w-4`}),children:(0,K.jsxs)(`div`,{className:`space-y-2`,children:[r.length===0&&(0,K.jsx)(Me,{text:e(`libreClaw.runs.empty`)}),r.map(t=>(0,K.jsxs)(`button`,{onClick:()=>N(t.run_id),className:f(`w-full rounded-xl border p-3 text-start transition`,M===t.run_id?`border-primary-300 bg-primary-50 dark:border-primary-700 dark:bg-primary-900/20`:`border-gray-200 bg-white hover:bg-gray-50 dark:border-dark-300 dark:bg-dark-50 dark:hover:bg-dark-100`),children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-sm font-medium text-gray-900 dark:text-dark-900`,children:t.title}),(0,K.jsx)(Ee,{state:t.state,t:e})]}),(0,K.jsxs)(`div`,{className:`mt-1 truncate text-xs text-gray-500 dark:text-dark-500`,children:[t.provider,`:`,t.model]}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-gray-400 dark:text-dark-500`,children:Ne(t.updated_at)})]},t.run_id))]})}),(0,K.jsxs)(J,{title:Z?Z.title:e(`libreClaw.timeline.title`),icon:(0,K.jsx)(x,{className:`h-4 w-4`}),actions:Z&&[`queued`,`running`,`blocked`].includes(Z.state)?(0,K.jsxs)(k,{variant:`danger`,size:`sm`,onClick:()=>Ve(Z.run_id),children:[(0,K.jsx)(re,{className:`h-4 w-4`}),e(`common.cancel`)]}):null,children:[Q.length>0&&(0,K.jsxs)(`div`,{className:`mb-4 space-y-2 rounded-xl border border-amber-200 bg-amber-500/10 p-3 dark:border-amber-800 dark:bg-amber-900/20`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-ink`,children:[(0,K.jsx)(C,{className:`h-4 w-4 text-amber-500`}),e(`libreClaw.approvals.needed`)]}),Q.map(t=>(0,K.jsxs)(`div`,{className:`rounded-lg bg-white/70 p-3 dark:bg-dark-50/70`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:String(t.data.name||e(`libreClaw.fallbacks.tool`))}),(0,K.jsx)(`pre`,{className:`mt-2 max-h-36 overflow-auto rounded bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(t.data.arguments||{},null,2)}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,K.jsxs)(k,{size:`sm`,onClick:()=>He(t,`allow_once`),children:[(0,K.jsx)(te,{className:`h-4 w-4`}),e(`libreClaw.approvals.allowOnce`)]}),(0,K.jsx)(k,{size:`sm`,variant:`secondary`,onClick:()=>He(t,`always_allow_tool`),children:e(`libreClaw.approvals.alwaysAllowTool`)}),(0,K.jsxs)(k,{size:`sm`,variant:`danger`,onClick:()=>He(t,`deny`),children:[(0,K.jsx)(T,{className:`h-4 w-4`}),e(`libreClaw.approvals.deny`)]})]})]},t.event_id))]}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[a.length===0&&(0,K.jsx)(Me,{text:e(`libreClaw.timeline.empty`)}),Re.map(t=>(0,K.jsx)(Oe,{item:t,t:e},t.key))]})]})]}),(0,K.jsxs)(`section`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,K.jsx)(J,{title:e(`libreClaw.automations.title`),icon:(0,K.jsx)(ne,{className:`h-4 w-4`}),children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,K.jsx)(`input`,{value:ke,onChange:e=>Ae(e.target.value),placeholder:e(`libreClaw.automations.namePlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsx)(`input`,{value:je,onChange:e=>Y(e.target.value),placeholder:e(`libreClaw.automations.schedulePlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsxs)(`select`,{value:Ie,onChange:e=>Le(e.target.value),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`,children:[(0,K.jsx)(`option`,{value:`report`,children:e(`libreClaw.automations.routes.report`)}),(0,K.jsx)(`option`,{value:`telegram`,children:e(`libreClaw.automations.routes.telegram`)})]}),(0,K.jsx)(k,{onClick:Ge,loading:de,children:e(`libreClaw.automations.create`)})]}),(0,K.jsx)(`textarea`,{value:X,onChange:e=>Fe(e.target.value),placeholder:e(`libreClaw.automations.promptPlaceholder`),className:`min-h-24 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[s.length===0&&(0,K.jsx)(Me,{text:e(`libreClaw.automations.empty`)}),s.map(t=>(0,K.jsx)(`div`,{className:`rounded-xl border border-gray-200 bg-white p-3 dark:border-dark-300 dark:bg-dark-50`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-medium text-gray-900 dark:text-dark-900`,children:t.name}),(0,K.jsxs)(`div`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:[t.schedule,` ·`,` `,e(`libreClaw.automations.routes.${t.route}`,{defaultValue:t.route}),` `,`·`,` `,e(`libreClaw.automations.status.${t.status}`,{defaultValue:t.status})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,K.jsx)(De,{title:e(`libreClaw.automations.runNow`),onClick:()=>Ke(t.automation_id,`run`),children:(0,K.jsx)(y,{className:`h-4 w-4`})}),(0,K.jsx)(De,{title:t.status===`paused`?e(`libreClaw.automations.resume`):e(`libreClaw.automations.pause`),onClick:()=>Ke(t.automation_id,t.status===`paused`?`resume`:`pause`),children:t.status===`paused`?(0,K.jsx)(y,{className:`h-4 w-4`}):(0,K.jsx)(g,{className:`h-4 w-4`})}),(0,K.jsx)(De,{title:e(`common.delete`),danger:!0,onClick:()=>Ke(t.automation_id,`delete`),children:(0,K.jsx)(ee,{className:`h-4 w-4`})})]})]})},t.automation_id))]})]})}),(0,K.jsx)(J,{title:e(`libreClaw.usageFallback.title`),icon:(0,K.jsx)(m,{className:`h-4 w-4`}),children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-gray-900 dark:text-dark-900`,children:e(`libreClaw.usageFallback.usage`)}),(0,K.jsx)(`pre`,{className:`max-h-52 overflow-auto rounded-xl bg-gray-100 p-3 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:j||e(`libreClaw.usageFallback.noUsage`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-gray-900 dark:text-dark-900`,children:e(`libreClaw.usageFallback.fallbackRoute`)}),(0,K.jsx)(`pre`,{className:`max-h-52 overflow-auto rounded-xl bg-gray-100 p-3 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(p||{},null,2)})]})]})})]}),P&&(0,K.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-white/60 backdrop-blur-sm dark:bg-dark-50/60`,children:(0,K.jsx)(w,{className:`h-7 w-7 animate-spin text-primary-600`})})]})},Te=({status:e,t})=>{let n=!!e?.connected;return(0,K.jsxs)(`span`,{className:f(`inline-flex items-center gap-2 rounded-full px-3 py-1.5 text-sm font-medium`,n?`bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300`:`bg-amber-500/20 text-ink dark:bg-amber-900/30`),children:[(0,K.jsx)(`span`,{className:f(`h-2 w-2 rounded-full`,n?`bg-emerald-500`:`bg-amber-500`)}),t(n?`libreClaw.status.connected`:`libreClaw.status.disconnected`),e?.health?.active_runs!==void 0&&(0,K.jsxs)(`span`,{className:`opacity-70`,children:[`·`,` `,t(`libreClaw.status.activeRuns`,{count:e.health.active_runs})]})]})},Ee=({state:e,t})=>(0,K.jsx)(`span`,{className:f(`rounded-full px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide`,xe[e]||xe.queued),children:t(`libreClaw.states.${e}`,{defaultValue:e})}),J=({title:e,icon:t,actions:n,children:r})=>(0,K.jsxs)(`section`,{className:`rounded-2xl border border-gray-200/80 bg-white/60 dark:border-white/10 dark:bg-white/[0.03]`,children:[(0,K.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-gray-200/70 px-5 py-4 dark:border-white/[0.08]`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-dark-900`,children:[(0,K.jsx)(`span`,{className:`text-primary-600 dark:text-primary-300`,children:t}),e]}),n]}),(0,K.jsx)(`div`,{className:`p-5`,children:r})]}),De=({title:e,danger:t,onClick:n,children:r})=>(0,K.jsx)(`button`,{type:`button`,title:e,onClick:n,className:f(`inline-flex h-8 w-8 items-center justify-center rounded-lg transition-colors`,t?`text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`:`text-gray-500 hover:bg-gray-100 dark:text-dark-500 dark:hover:bg-dark-200`),children:r}),Oe=({item:e,t})=>(0,K.jsxs)(`article`,{className:f(`rounded-xl border p-3 transition-colors`,e.eventType===`assistant_message`?`border-primary-200 bg-primary-50/60 dark:border-primary-900/60 dark:bg-primary-900/10`:(e.eventType,`border-gray-200/80 bg-white/50 dark:border-white/[0.08] dark:bg-white/[0.025]`)),children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:f(`text-xs font-semibold uppercase tracking-wide`,Se[e.eventType]||`text-gray-500 dark:text-dark-500`),children:e.label}),(0,K.jsxs)(`span`,{className:`shrink-0 text-xs text-gray-400 dark:text-dark-500`,children:[Le(e),` · `,Ne(e.timestamp)]})]}),(0,K.jsx)(ke,{item:e,t})]}),ke=({item:e,t})=>{if(e.kind===`assistant_message`)return(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-gray-900 dark:text-dark-900`,children:Fe(e.events)||t(`libreClaw.timeline.streaming`)});let n=e.events[0];return n?n.type===`assistant_delta`?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-gray-800 dark:text-dark-800`,children:String(n.data.text||``)}):n.type===`user_message`?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-gray-800 dark:text-dark-800`,children:String(n.data.content||``)}):n.type===`tool_call`?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:String(n.data.name||t(`libreClaw.fallbacks.tool`))}),(0,K.jsx)(X,{value:n.data.arguments||{}})]}):n.type===`tool_result`?(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:[String(n.data.name||t(`libreClaw.fallbacks.tool`)),` ·`,` `,n.data.is_error?t(`libreClaw.timeline.resultError`):t(`libreClaw.timeline.resultOk`)]}),(0,K.jsx)(`pre`,{className:`mt-2 max-h-56 overflow-auto whitespace-pre-wrap rounded-lg bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:String(n.data.content||``)})]}):n.type===`permission_request`?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:String(n.data.name||t(`libreClaw.approvals.toolApprovalRequested`))}),(0,K.jsx)(X,{value:n.data.arguments||{}})]}):n.type===`permission_response`?(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Y,{label:t(`libreClaw.metrics.tool`),value:String(n.data.name||n.data.tool_call_id||t(`libreClaw.fallbacks.tool`))}),(0,K.jsx)(Y,{label:t(`libreClaw.metrics.resolution`),value:String(n.data.resolution||t(`libreClaw.fallbacks.resolved`))})]}):n.type===`usage`?(0,K.jsx)(Ae,{data:n.data,t}):n.type===`run_finished`?(0,K.jsx)(je,{data:n.data,t}):n.type===`error`?(0,K.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-300`,children:String(n.data.message||t(`libreClaw.fallbacks.unknownError`))}):(0,K.jsx)(X,{value:n.data}):null},Ae=({data:e,t})=>(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Y,{label:t(`libreClaw.metrics.provider`),value:String(e.provider||t(`libreClaw.fallbacks.unknown`))}),(0,K.jsx)(Y,{label:t(`libreClaw.metrics.model`),value:String(e.model||t(`libreClaw.fallbacks.unknown`))}),(0,K.jsx)(Y,{label:t(`libreClaw.metrics.input`),value:t(`libreClaw.metrics.tokens`,{count:Z(e.input_tokens),formatted:Q(e.input_tokens)})}),(0,K.jsx)(Y,{label:t(`libreClaw.metrics.output`),value:t(`libreClaw.metrics.tokens`,{count:Z(e.output_tokens),formatted:Q(e.output_tokens)})}),Z(e.cached_tokens)>0&&(0,K.jsx)(Y,{label:t(`libreClaw.metrics.cached`),value:t(`libreClaw.metrics.tokens`,{count:Z(e.cached_tokens),formatted:Q(e.cached_tokens)})}),Z(e.reasoning_tokens)>0&&(0,K.jsx)(Y,{label:t(`libreClaw.metrics.reasoning`),value:t(`libreClaw.metrics.tokens`,{count:Z(e.reasoning_tokens),formatted:Q(e.reasoning_tokens)})}),(0,K.jsx)(Y,{label:t(`libreClaw.metrics.cost`),value:Re(e.cost)})]}),je=({data:e,t})=>(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Y,{label:t(`libreClaw.metrics.state`),value:t(`libreClaw.states.${String(e.state||`done`)}`,{defaultValue:String(e.state||`done`)})}),e.stop_reason!==void 0&&(0,K.jsx)(Y,{label:t(`libreClaw.metrics.stopReason`),value:String(e.stop_reason)})]}),Y=({label:e,value:t})=>(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-gray-200/80 bg-white/50 px-2.5 py-1 text-xs text-gray-700 dark:border-white/10 dark:bg-white/[0.035] dark:text-dark-700`,children:[(0,K.jsx)(`span`,{className:`font-semibold text-gray-500 dark:text-dark-500`,children:e}),(0,K.jsx)(`span`,{children:t})]}),X=({value:e})=>(0,K.jsx)(`pre`,{className:`mt-2 max-h-56 overflow-auto rounded-lg bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(e,null,2)}),Me=({text:e})=>(0,K.jsx)(`div`,{className:`rounded-xl border border-dashed border-gray-300 bg-white/30 px-4 py-8 text-center text-sm text-gray-500 dark:border-white/15 dark:bg-white/[0.02] dark:text-dark-500`,children:e}),Ne=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},Pe=(e,t)=>{let n=[],r=0;for(;r<e.length;){let i=e[r];if(!i)break;if(i.type===`assistant_delta`){let i=[];for(;e[r]?.type===`assistant_delta`;){let t=e[r];t&&i.push(t),r+=1}let a=i[0],o=i[i.length-1]||a;a&&o&&n.push({key:`assistant-${a.event_id}-${o.event_id}`,kind:`assistant_message`,eventType:`assistant_message`,label:t(`libreClaw.timeline.assistantResponse`),firstEventId:a.event_id,lastEventId:o.event_id,timestamp:a.timestamp,events:i});continue}n.push({key:`${i.type}-${i.event_id}`,kind:`event`,eventType:i.type,label:Ie(i.type,t),firstEventId:i.event_id,lastEventId:i.event_id,timestamp:i.timestamp,events:[i]}),r+=1}return n},Fe=e=>e.map(e=>String(e.data.text||``)).join(``),Ie=(e,t)=>({user_message:t(`libreClaw.timeline.labels.userMessage`),tool_call:t(`libreClaw.timeline.labels.toolCall`),tool_result:t(`libreClaw.timeline.labels.toolResult`),permission_request:t(`libreClaw.timeline.labels.approvalRequest`),permission_response:t(`libreClaw.timeline.labels.approvalResponse`),run_started:t(`libreClaw.timeline.labels.runStarted`),run_finished:t(`libreClaw.timeline.labels.runFinished`),usage:t(`libreClaw.timeline.labels.usage`),error:t(`libreClaw.timeline.labels.error`)})[e]||e.replace(/_/g,` `),Le=e=>e.firstEventId===e.lastEventId?`#${e.firstEventId}`:`#${e.firstEventId}-#${e.lastEventId}`,Z=e=>{let t=Number(e);return Number.isFinite(t)?t:0},Q=e=>new Intl.NumberFormat().format(Z(e)),Re=e=>{let t=Z(e);return t<=0?`$0.00`:t<.01?`$${t.toFixed(6)}`:`$${t.toFixed(4)}`};export{we as default};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{m as t,p as n}from"./markdown-core-BmPPZiuD.js";import{n as r}from"./i18next-DgmgtwsV.js";import{a as i,i as a,n as o,o as s,r as c,t as l}from"./useTranslation-C3ei3mJq.js";import{c as u,f as d,t as f,u as p}from"./utils-CuC1beTY.js";import{B as m,Dn as h,G as g,L as _,Tt as v,Vt as y,Zt as b,gn as x,k as S,lt as C,m as w,n as ee,sn as T,un as te,v as ne,wn as E,x as re}from"./ui-vendor-D3Ahl1x5.js";import{t as D}from"./logger-DSXjF4ye.js";import{_ as O}from"./api-IzobHGND.js";import{t as k}from"./Button-BV44cTnj.js";import{n as ie,t as A}from"./ui-BHhR3Vok.js";var j={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,"!doctype":!0,"!DOCTYPE":!0},ae=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;function M(e){let t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(j[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){let t=e.indexOf(`-->`);return{type:`comment`,comment:t===-1?``:e.slice(4,t)}}let r=new RegExp(ae),i=null;for(;i=r.exec(e),i!==null;)if(i[0].trim())if(i[1]){let e=i[1].trim(),n=[e,null],a=e.indexOf(`=`);a>-1&&(n=[e.slice(0,a),e.slice(a+1)]),t.attrs[n[0]]=n[1],r.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var N=/<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,P=/<\/?([^\s]+?)[/\s>]/,oe=/^\s*$/,se=/^(script|style)$/i,F=`\0`,ce=Object.create(null);function I(e){e.forEach(function(e){if(e.type===`text`){e.content=e.content.split(F).join(`<`);return}if(e.type===`comment`){e.comment=e.comment.split(F).join(`<`);return}for(let t in e.attrs){let n=e.attrs[t];typeof n==`string`&&n.indexOf(F)>-1&&(e.attrs[t]=n.split(F).join(`<`))}e.children.length&&I(e.children)})}function le(e,t){let n=t&&t.components||ce,r=t&&t.allowedTags,i=!1;if(r){let t=typeof r==`function`?r:function(e){return r.indexOf(e)>-1},n=``,a=0;N.lastIndex=0;let o;for(;o=N.exec(e);){let r=o[0];n+=e.slice(a,o.index);let s=r.match(P);r.startsWith(`<!--`)||s&&t(s[1])?(n+=r,a=o.index+r.length):(i=!0,n+=F,a=o.index+1,N.lastIndex=a)}e=n+e.slice(a)}let a=[],o=[],s,c=-1,l=!1,u=0,d;if(e.indexOf(`<`)!==0){let t=e.indexOf(`<`);a.push({type:`text`,content:t===-1?e:e.substring(0,t)})}let f=[],p;for(;p=N.exec(e);)f.push(p);return f.forEach(function(e,t){let n=e[0];if(!n||n.startsWith(`<!--`))return;let r=0,i=0,a=-1,o=null;for(let e=0;e<n.length;e++){let t=n.charAt(e);o?t===o&&(o=null):t===`"`||t===`'`?o=t:t===`<`?(r++,r===2&&(a=e)):t===`>`&&i++}let s=a>-1&&/[a-zA-Z0-9\-!/]/.test(n.charAt(a+1));if(r>i&&s){let e=n.substring(0,a),r=n.substring(e.length);f[t][0]=r,f[t].index+=e.length}}),f.forEach(function(t,r){let i=t[0];if(!i)return;let p=t.index;if(p<u)return;if(l){if(i!==`</`+s.name+`>`)return;l=!1}let m=i.charAt(1)!==`/`,h=i.startsWith(`<!--`),g=p+i.length,_=e.charAt(g),v=f[r+1],y;if(_===`<`&&v){let t=e.substring(g,v.index);y=t.split(`<`).length>t.split(`>`).length}let b;if(h){let t=M(i);if(c<0)return a.push(t),a;b=o[c],b.children.push(t);let n=e.slice(g,v?v.index:void 0);return n.length>0&&b.children.push({type:`text`,content:n}),a}if(m){c++,s=M(i),s.type===`tag`&&n[s.name]&&(s.type=`component`,l=!0);let t=!1;if(!l&&!s.voidElement&&se.test(s.name)){t=!0,d||(d=e.toLowerCase());let n=d.indexOf(`</`+s.name.toLowerCase()+`>`,g),r=n===-1?e.length:n,i=e.slice(g,r);i&&s.children.push({type:`text`,content:i}),u=r}!s.voidElement&&!l&&!t&&_&&_!==`<`&&s.children.push({type:`text`,content:e.slice(g,v?v.index:void 0)}),c===0&&a.push(s),b=o[c-1],b&&b.children.push(s),o[c]=s}if((!m||s.voidElement)&&(c>-1&&(s.voidElement||s.name===i.slice(2,-1))&&(c--,s=c===-1?a:o[c]),!l&&(_!==`<`||y)&&_)){b=c===-1?a:o[c].children;let t=v?v.index:-1,n=e.slice(g,t===-1?void 0:t);oe.test(n)&&(n=` `),(t>-1&&c+b.length>=0||n!==` `)&&b.push({type:`text`,content:n})}}),i&&I(a),a}function ue(e){let t=[];for(let n in e)e[n]===null?t.push(n):t.push(n+`="`+String(e[n]).replace(/"/g,`&quot;`)+`"`);return t.length?` `+t.join(` `):``}function de(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:{let n=t.voidElement&&t.name.toLowerCase()!==`!doctype`?`/>`:`>`;return e+=`<`+t.name+(t.attrs?ue(t.attrs):``)+n,t.voidElement?e:e+t.children.reduce(de,``)+`</`+t.name+`>`}case`comment`:return e+=`<!--`+t.comment+`-->`,e}}function fe(e){return e.reduce(function(e,t){return e+de(``,t)},``)}var L={parse:le,stringify:fe},R=e(t()),z=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},B=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?V(t):t},pe=e=>Array.isArray(e)&&e.every(R.isValidElement),V=e=>Array.isArray(e)?e:[e],me=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},he=e=>{let t={};if(!e)return t;let n=e=>{V(e).forEach(e=>{a(e)||(z(e)?n(B(e)):c(e)&&!(0,R.isValidElement)(e)&&Object.assign(t,e))})};return n(e),t},H=(e,t,n,r)=>{if(!e)return``;let o=``,s=V(e),l=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return s.forEach((e,s)=>{if(a(e)){o+=`${e}`;return}if((0,R.isValidElement)(e)){let{props:i,type:c}=e,u=Object.keys(i).length,d=l.indexOf(c)>-1,f=i.children;if(!f&&d&&!u){o+=`<${c}/>`;return}if(!f&&(!d||u)||i.i18nIsDynamicList){o+=`<${s}></${s}>`;return}if(d&&u<=1){let e=a(f)?f:H(f,t,n,r);o+=`<${c}>${e}</${c}>`;return}let p=H(f,t,n,r);o+=`<${s}>${p}</${s}>`;return}if(e===null){i(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(c(e)){let{format:t,...a}=e,s=Object.keys(a);if(s.length===1){let e=t?`${s[0]}, ${t}`:s[0];o+=`{{${e}}}`;return}i(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}i(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),o},U=(e,t,n,r,i,o,s)=>{if(n===``)return[];let l=i.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(l.map(e=>`<${e}`).join(`|`)).test(n);if(!e&&!t&&!u&&!s)return[n];let f=t??{},m=e=>{V(e).forEach(e=>{a(e)||(z(e)?m(B(e)):c(e)&&!(0,R.isValidElement)(e)&&Object.assign(f,e))})};m(e);let h=Object.keys(f),g=L.parse(`<0>${n}</0>`,{allowedTags:e=>/^\d+$/.test(e)||l.indexOf(e)>-1||h.indexOf(e)>-1}),_={...f,...o},v=(e,t,n)=>{let r=B(e),i=b(r,t.children,n);return pe(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},y=(e,t,n,r,i)=>{e.dummy?(e.children=t,n.push((0,R.cloneElement)(e,{key:r},i?void 0:t))):n.push(...R.Children.map([e],e=>{if(e.type===R.Fragment||e.props?.i18nIsDynamicList!==void 0){let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t!==`children`&&t!==`i18nIsDynamicList`&&(n[t]=e.props[t])}),(0,R.createElement)(e.type,n,i?null:t)}let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t!==`ref`&&t!==`children`&&(n[t]=e.props[t])}),(0,R.cloneElement)(e,n,i?null:t)}))},b=(e,n,o)=>{let f=V(e),m=V(n),h={};return m.reduce((e,n,m)=>{let g=n.children?.[0]?.content&&r.services.interpolator.interpolate(n.children[0].content,_,r.language);if(n.type===`tag`){let p=f[parseInt(n.name,10)];!p&&t&&(p=t[n.name]),o.length===1&&!p&&(p=o[0][n.name]),p||(p={});let x={...n.attrs};s&&Object.keys(x).forEach(e=>{let t=x[e];a(t)&&(x[e]=d(t))});let S=Object.keys(x).length===0?p:me({props:x},p),C=(0,R.isValidElement)(S),w=C&&z(n,!0)&&!n.voidElement,ee=u&&c(S)&&S.dummy&&!C,T=c(t)&&Object.hasOwnProperty.call(t,n.name);if(a(S)){let t=r.services.interpolator.interpolate(S,_,r.language);e.push(t)}else if(z(S)||w){let t=v(S,n,o);y(S,t,e,m)}else if(ee){let t=b(f,n.children,o);y(S,t,e,m)}else if(Number.isNaN(parseFloat(n.name)))if(T){let t=v(S,n,o);y(S,t,e,m,n.voidElement)}else if(i.transSupportBasicHtmlNodes&&l.indexOf(n.name)>-1)if(n.voidElement)e.push((0,R.createElement)(n.name,{key:`${n.name}-${m}`}));else{let t=h[n.name]||0;h[n.name]=t+1;let r,i=0;for(let e=0;e<f.length;e+=1){let a=f[e];if((0,R.isValidElement)(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let a=r?V(B(r)):f,s=b(a,n.children,o);e.push((0,R.createElement)(n.name,{key:`${n.name}-${m}`},s))}else if(n.voidElement)e.push(`<${n.name} />`);else{let t=b(f,n.children,o);e.push(`<${n.name}>${t}</${n.name}>`)}else if(c(S)&&!C){let t=n.children[0]?g:null;t&&e.push(t)}else y(S,g,e,m,n.children.length!==1||!g)}else if(n.type===`text`){let t=i.transWrapTextNodes,a=typeof i.unescape==`function`?i.unescape:p().unescape,o=s?a(r.services.interpolator.interpolate(n.content,_,r.language)):r.services.interpolator.interpolate(n.content,_,r.language);t?e.push((0,R.createElement)(t,{key:`${n.name}-${m}`},o)):e.push(o)}return e},[])};return B(b([{dummy:!0,children:e||[]}],g,V(e||[]))[0])},W=(e,t,n)=>{let r=e.key||t,i=(0,R.cloneElement)(e,{key:r});if(!i.props||!i.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return i;function a(){return(0,R.createElement)(R.Fragment,null,i)}return(0,R.createElement)(a,{key:r})},G=(e,t)=>e.map((e,n)=>W(e,n,t)),ge=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:W(e[r],r,t)})}),n},_e=(e,t,n,r)=>e?Array.isArray(e)?G(e,t):c(e)?ge(e,t):(s(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,ve=e=>!c(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function ye({children:e,count:t,parent:n,i18nKey:i,context:o,tOptions:c={},values:l,defaults:d,components:f,ns:m,i18n:h,t:g,shouldUnescape:_,...v}){let y=h||u();if(!y)return s(y,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`,{i18nKey:i}),e;let b=g||y.t.bind(y)||(e=>e),x={...p(),...y.options?.react},S=m||b.ns||y.options?.defaultNS;S=a(S)?[S]:S||[`translation`];let{transDefaultProps:C}=x,w=C?.tOptions?{...C.tOptions,...c}:c,ee=_??C?.shouldUnescape,T=C?.values?{...C.values,...l}:l,te=C?.components?{...C.components,...f}:f,ne=H(e,x,y,i),E=d||w?.defaultValue||ne||x.transEmptyNodeValue||(typeof i==`function`?r(i):i),{hashTransKey:re}=x,D=i||(re?re(ne||E):ne||E);l=y.options?.interpolation?.defaultVariables?T&&Object.keys(T).length>0?{...T,...y.options.interpolation.defaultVariables}:{...y.options.interpolation.defaultVariables}:T;let O=he(e);O&&typeof O.count==`number`&&t===void 0&&(t=O.count);let k=l||t!==void 0&&!y.options?.interpolation?.alwaysFormat||!e?w.interpolation:{interpolation:{...w.interpolation,prefix:`#$?`,suffix:`?$#`}},ie={...w,context:o||w.context,count:t,...l,...k,defaultValue:E,ns:S},A=D?b(D,ie):E;A===D&&E&&(A=E);let j=_e(te,A,y,i),ae=j||e,M=null;ve(j)&&(M=j,ae=e);let N=U(ae,M,A,y,x,ie,ee),P=n??x.defaultTransParent;return P?(0,R.createElement)(P,v,N):N}function be({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:s,defaults:c,components:l,ns:d,i18n:f,t:p,shouldUnescape:m,...h}){let{i18n:g,defaultNS:_}=(0,R.useContext)(o)||{},v=f||g||u(),y=p||v?.t.bind(v);return ye({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a,values:s,defaults:c,components:l,ns:d||y?.ns||_||v?.options?.defaultNS,i18n:v,t:p,shouldUnescape:m,...h})}var K=n(),q=D(`pages:libre-claw`),xe={queued:`bg-gray-100 text-gray-700 dark:bg-dark-200 dark:text-dark-700`,running:`bg-primary-100 text-primary-700 dark:bg-primary-900/25 dark:text-primary-300`,blocked:`bg-amber-500/20 text-ink dark:bg-amber-900/30`,done:`bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300`,failed:`bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300`,cancelled:`bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300`},Se={assistant_message:`text-primary-600 dark:text-primary-300`,assistant_delta:`text-primary-600 dark:text-primary-300`,user_message:`text-gray-700 dark:text-dark-700`,permission_request:`text-ink`,permission_response:`text-gray-600 dark:text-dark-600`,tool_call:`text-gray-600 dark:text-dark-600`,tool_result:`text-gray-600 dark:text-dark-600`,usage:`text-gray-600 dark:text-dark-600`,error:`text-red-600 dark:text-red-300`,run_finished:`text-emerald-600 dark:text-emerald-300`},Ce=[[`lobster`,`Lobster`],[`lobster-light`,`Lobster Light`],[`github-dark`,`GitHub Dark`],[`github-light`,`GitHub Light`],[`monokai-pro`,`Monokai Pro`],[`night-owl`,`Night Owl`],[`tokyo-night`,`Tokyo Night`],[`ayu`,`Ayu`],[`dracula`,`Dracula`],[`catppuccin-mocha`,`Catppuccin Mocha`],[`catppuccin-latte`,`Catppuccin Latte`],[`gruvbox-dark`,`Gruvbox Dark`],[`nord`,`Nord`],[`solarized-dark`,`Solarized Dark`],[`solarized-light`,`Solarized Light`],[`one-dark-pro`,`One Dark Pro`],[`rose-pine`,`Rose Pine`],[`kanagawa`,`Kanagawa`],[`matrix`,`Matrix`]],we=()=>{let{t:e}=l(),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)([]),[a,o]=(0,R.useState)([]),[s,c]=(0,R.useState)([]),[u,d]=(0,R.useState)(null),[p,D]=(0,R.useState)(null),[j,ae]=(0,R.useState)(``),[M,N]=(0,R.useState)(null),[P,oe]=(0,R.useState)(!0),[se,F]=(0,R.useState)(!1),[ce,I]=(0,R.useState)(!1),[le,ue]=(0,R.useState)(!1),[de,fe]=(0,R.useState)(!1),[L,z]=(0,R.useState)(``),[B,pe]=(0,R.useState)(`chat`),[V,me]=(0,R.useState)(``),[he,H]=(0,R.useState)(``),[U,W]=(0,R.useState)(``),[G,ge]=(0,R.useState)(``),[_e,ve]=(0,R.useState)(!1),[ye,xe]=(0,R.useState)(`lobster`),[Se,we]=(0,R.useState)(!0),[ke,Ae]=(0,R.useState)(``),[je,Y]=(0,R.useState)(``),[X,Fe]=(0,R.useState)(``),[Ie,Le]=(0,R.useState)(`report`),Z=(0,R.useMemo)(()=>r.find(e=>e.run_id===M)||null,[r,M]),Q=(0,R.useMemo)(()=>{let e=new Set(a.filter(e=>e.type===`permission_response`).map(e=>String(e.data.tool_call_id||``)));return a.filter(t=>{if(t.type!==`permission_request`)return!1;let n=String(t.data.tool_call_id||``);return n&&!e.has(n)})},[a]),Re=(0,R.useMemo)(()=>Pe(a,e),[a,e]),$=(0,R.useCallback)(async()=>{try{let[e,t,r,a,o,s]=await Promise.all([O.status(),O.listRuns(30),O.currentModel(),O.currentFallback(),O.usage(``,100),O.listAutomations(50)]);e.success&&e.data&&n(e.data),t.success&&t.data&&(i(t.data.runs),N(e=>e||t.data?.runs[0]?.run_id||null)),r.success&&r.data&&(d(r.data),W(String(r.data.provider||``)),ge(String(r.data.model||``))),a.success&&a.data&&D(a.data),o.success&&o.data&&ae(String(o.data.text||``)),s.success&&s.data&&c(s.data.automations)}catch(t){q.error(`Failed to load Libre Claw overview:`,t),h.error(e(`libreClaw.toasts.loadStatusFailed`))}finally{oe(!1)}},[e]),ze=(0,R.useCallback)(async(e,t=!1)=>{let n=t?0:a.length>0&&a[a.length-1]?.event_id||0;try{let r=await O.getEvents(e,n);r.success&&r.data&&o(e=>t?r.data?.events||[]:[...e,...r.data?.events||[]])}catch(e){q.error(`Failed to load Libre Claw events:`,e)}},[a]);(0,R.useEffect)(()=>{let e=window.setTimeout(()=>{$()},0);return()=>window.clearTimeout(e)},[$]),(0,R.useEffect)(()=>{if(!M){let e=window.setTimeout(()=>{o([])},0);return()=>window.clearTimeout(e)}let e=M;O.getEvents(e,0).then(e=>{e.success&&e.data&&o(e.data.events)}).catch(e=>{q.error(`Failed to load Libre Claw events:`,e)})},[M]),(0,R.useEffect)(()=>{if(!M||!Z||![`queued`,`running`,`blocked`].includes(Z.state))return;let e=window.setInterval(()=>{ze(M),O.listRuns(30).then(e=>{e.success&&e.data&&i(e.data.runs)})},1500);return()=>window.clearInterval(e)},[ze,Z,M]);let Be=async()=>{if(!L.trim()){h.error(e(`libreClaw.toasts.enterTask`));return}F(!0);try{let t=await O.startRun({message:L,kind:B,provider:V||void 0,model:he||void 0});if(t.success&&t.data){let n=t.data.run;i(e=>[n,...e.filter(e=>e.run_id!==n.run_id)]),N(n.run_id),z(``),h.success(e(`libreClaw.toasts.runStarted`))}else h.error(t.error||e(`libreClaw.toasts.startRunFailed`))}catch(t){q.error(`Failed to start Libre Claw run:`,t),h.error(e(`libreClaw.toasts.startRunFailed`))}finally{F(!1)}},Ve=async t=>{try{await O.cancelRun(t),await $(),h.success(e(`libreClaw.toasts.runCancelled`))}catch(t){q.error(`Failed to cancel Libre Claw run:`,t),h.error(e(`libreClaw.toasts.cancelRunFailed`))}},He=async(t,n)=>{if(!M)return;let r=String(t.data.tool_call_id||``);if(r)try{await O.resolvePermission(M,r,n),await ze(M,!0),h.success(e(n===`deny`?`libreClaw.toasts.denied`:`libreClaw.toasts.approved`))}catch(t){q.error(`Failed to resolve Libre Claw permission:`,t),h.error(e(`libreClaw.toasts.resolvePermissionFailed`))}},Ue=async()=>{if(!U.trim()||!G.trim()){h.error(e(`libreClaw.toasts.providerModelRequired`));return}I(!0);try{let t=await O.updateModel(U,G,_e);t.success&&t.data?(d(t.data),h.success(e(`libreClaw.toasts.modelUpdated`))):h.error(t.error||e(`libreClaw.toasts.updateModelFailed`))}catch(t){q.error(`Failed to update Libre Claw model:`,t),h.error(e(`libreClaw.toasts.updateModelFailed`))}finally{I(!1)}},We=async()=>{ue(!0);try{let t=await O.updateTheme(ye,Se);t.success?h.success(e(`libreClaw.toasts.themeUpdated`)):h.error(t.error||e(`libreClaw.toasts.updateThemeFailed`))}catch(t){q.error(`Failed to update Libre Claw theme:`,t),h.error(e(`libreClaw.toasts.updateThemeFailed`))}finally{ue(!1)}},Ge=async()=>{if(!ke.trim()||!je.trim()||!X.trim()){h.error(e(`libreClaw.toasts.automationRequired`));return}fe(!0);try{let t=await O.createAutomation({name:ke,schedule:je,prompt:X,route:Ie});t.success?(Ae(``),Y(``),Fe(``),await $(),h.success(e(`libreClaw.toasts.automationCreated`))):h.error(t.error||e(`libreClaw.toasts.createAutomationFailed`))}catch(t){q.error(`Failed to create Libre Claw automation:`,t),h.error(e(`libreClaw.toasts.createAutomationFailed`))}finally{fe(!1)}},Ke=async(t,n)=>{try{n===`pause`&&await O.pauseAutomation(t),n===`resume`&&await O.resumeAutomation(t),n===`run`&&await O.runAutomationNow(t),n===`delete`&&await O.deleteAutomation(t),await $(),h.success(e(`libreClaw.toasts.automationUpdated`))}catch(t){q.error(`Failed to update Libre Claw automation:`,t),h.error(e(`libreClaw.toasts.updateAutomationFailed`))}};return(0,K.jsxs)(ie,{width:`wide`,contentClassName:`space-y-6`,children:[(0,K.jsx)(A,{className:`mb-0`,title:e(`libreClaw.title`),description:e(`libreClaw.subtitle`),actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Te,{status:t,t:e}),(0,K.jsxs)(k,{variant:`secondary`,size:`sm`,onClick:$,children:[(0,K.jsx)(_,{className:`h-4 w-4`}),e(`common.refresh`)]}),(0,K.jsxs)(`a`,{href:t?.dashboardUrl||`http://127.0.0.1:8766/dashboard`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-xl border border-gray-200/80 bg-white/70 px-3 py-1.5 text-sm font-medium text-gray-700 transition-colors hover:bg-white dark:border-white/10 dark:bg-white/[0.04] dark:text-dark-700 dark:hover:bg-white/[0.08]`,children:[(0,K.jsx)(y,{className:`h-4 w-4`}),e(`libreClaw.dashboard`)]})]})}),!t?.connected&&!P&&(0,K.jsx)(`section`,{className:`rounded-xl border border-amber-200 bg-amber-500/10 p-4 text-ink dark:border-amber-800 dark:bg-amber-900/20`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(ne,{className:`mt-0.5 h-5 w-5 shrink-0 text-amber-500`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{className:`font-semibold`,children:e(`libreClaw.connection.disconnectedTitle`)}),(0,K.jsx)(`p`,{className:`mt-1 text-sm opacity-90`,children:(0,K.jsx)(be,{i18nKey:`libreClaw.connection.disconnectedDescription`,components:{command:(0,K.jsx)(`code`,{}),env:(0,K.jsx)(`code`,{})}})}),t?.error&&(0,K.jsx)(`p`,{className:`mt-2 text-xs opacity-80`,children:t.error})]})]})}),(0,K.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_360px]`,children:[(0,K.jsx)(J,{title:e(`libreClaw.startRun.title`),icon:(0,K.jsx)(m,{className:`h-4 w-4`}),children:(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`textarea`,{value:L,onChange:e=>z(e.target.value),placeholder:e(`libreClaw.startRun.placeholder`),className:`min-h-32 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm text-gray-900 outline-none transition focus:border-primary-400 focus:ring-2 focus:ring-primary-100 dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800 dark:focus:border-primary-500 dark:focus:ring-primary-900/30`}),(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-4`,children:[(0,K.jsxs)(`select`,{value:B,onChange:e=>pe(e.target.value),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`,children:[(0,K.jsx)(`option`,{value:`chat`,children:e(`libreClaw.startRun.chatRun`)}),(0,K.jsx)(`option`,{value:`goal`,children:e(`libreClaw.startRun.goalMode`)})]}),(0,K.jsx)(`input`,{value:V,onChange:e=>me(e.target.value),placeholder:e(`libreClaw.startRun.providerOverride`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsx)(`input`,{value:he,onChange:e=>H(e.target.value),placeholder:e(`libreClaw.startRun.modelOverride`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsxs)(k,{onClick:Be,loading:se,children:[(0,K.jsx)(x,{className:`h-4 w-4`}),e(`libreClaw.startRun.run`)]})]})]})}),(0,K.jsx)(J,{title:e(`libreClaw.modelRoute.title`),icon:(0,K.jsx)(v,{className:`h-4 w-4`}),children:(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2 lg:grid-cols-1`,children:[(0,K.jsx)(`input`,{value:U,onChange:e=>W(e.target.value),placeholder:e(`libreClaw.modelRoute.providerPlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsx)(`input`,{value:G,onChange:e=>ge(e.target.value),placeholder:e(`libreClaw.modelRoute.modelPlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`})]}),(0,K.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-gray-600 dark:text-dark-600`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:_e,onChange:e=>ve(e.target.checked),className:`h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-500`}),e(`libreClaw.modelRoute.persistGlobal`)]}),(0,K.jsx)(k,{variant:`secondary`,onClick:Ue,loading:ce,children:e(`libreClaw.modelRoute.saveModel`)}),(0,K.jsxs)(`div`,{className:`border-t border-gray-100 pt-3 dark:border-dark-200`,children:[(0,K.jsx)(`label`,{className:`mb-1 block text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-500`,children:e(`libreClaw.modelRoute.theme`)}),(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto] lg:grid-cols-1`,children:[(0,K.jsx)(`select`,{value:ye,onChange:e=>xe(e.target.value),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`,children:Ce.map(([e,t])=>(0,K.jsx)(`option`,{value:e,children:t},e))}),(0,K.jsx)(k,{variant:`secondary`,onClick:We,loading:le,children:e(`libreClaw.modelRoute.saveTheme`)})]}),(0,K.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-sm text-gray-600 dark:text-dark-600`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:Se,onChange:e=>we(e.target.checked),className:`h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-500`}),e(`libreClaw.modelRoute.persistGlobal`)]})]}),u&&(0,K.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-lg bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(u,null,2)})]})})]}),(0,K.jsxs)(`section`,{className:`grid gap-4 xl:grid-cols-[360px_minmax(0,1fr)]`,children:[(0,K.jsx)(J,{title:e(`libreClaw.runs.title`),icon:(0,K.jsx)(E,{className:`h-4 w-4`}),children:(0,K.jsxs)(`div`,{className:`space-y-2`,children:[r.length===0&&(0,K.jsx)(Me,{text:e(`libreClaw.runs.empty`)}),r.map(t=>(0,K.jsxs)(`button`,{onClick:()=>N(t.run_id),className:f(`w-full rounded-xl border p-3 text-start transition`,M===t.run_id?`border-primary-300 bg-primary-50 dark:border-primary-700 dark:bg-primary-900/20`:`border-gray-200 bg-white hover:bg-gray-50 dark:border-dark-300 dark:bg-dark-50 dark:hover:bg-dark-100`),children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-sm font-medium text-gray-900 dark:text-dark-900`,children:t.title}),(0,K.jsx)(Ee,{state:t.state,t:e})]}),(0,K.jsxs)(`div`,{className:`mt-1 truncate text-xs text-gray-500 dark:text-dark-500`,children:[t.provider,`:`,t.model]}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-gray-400 dark:text-dark-500`,children:Ne(t.updated_at)})]},t.run_id))]})}),(0,K.jsxs)(J,{title:Z?Z.title:e(`libreClaw.timeline.title`),icon:(0,K.jsx)(b,{className:`h-4 w-4`}),actions:Z&&[`queued`,`running`,`blocked`].includes(Z.state)?(0,K.jsxs)(k,{variant:`danger`,size:`sm`,onClick:()=>Ve(Z.run_id),children:[(0,K.jsx)(re,{className:`h-4 w-4`}),e(`common.cancel`)]}):null,children:[Q.length>0&&(0,K.jsxs)(`div`,{className:`mb-4 space-y-2 rounded-xl border border-amber-200 bg-amber-500/10 p-3 dark:border-amber-800 dark:bg-amber-900/20`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-ink`,children:[(0,K.jsx)(S,{className:`h-4 w-4 text-amber-500`}),e(`libreClaw.approvals.needed`)]}),Q.map(t=>(0,K.jsxs)(`div`,{className:`rounded-lg bg-white/70 p-3 dark:bg-dark-50/70`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:String(t.data.name||e(`libreClaw.fallbacks.tool`))}),(0,K.jsx)(`pre`,{className:`mt-2 max-h-36 overflow-auto rounded bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(t.data.arguments||{},null,2)}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,K.jsxs)(k,{size:`sm`,onClick:()=>He(t,`allow_once`),children:[(0,K.jsx)(T,{className:`h-4 w-4`}),e(`libreClaw.approvals.allowOnce`)]}),(0,K.jsx)(k,{size:`sm`,variant:`secondary`,onClick:()=>He(t,`always_allow_tool`),children:e(`libreClaw.approvals.alwaysAllowTool`)}),(0,K.jsxs)(k,{size:`sm`,variant:`danger`,onClick:()=>He(t,`deny`),children:[(0,K.jsx)(ee,{className:`h-4 w-4`}),e(`libreClaw.approvals.deny`)]})]})]},t.event_id))]}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[a.length===0&&(0,K.jsx)(Me,{text:e(`libreClaw.timeline.empty`)}),Re.map(t=>(0,K.jsx)(Oe,{item:t,t:e},t.key))]})]})]}),(0,K.jsxs)(`section`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,K.jsx)(J,{title:e(`libreClaw.automations.title`),icon:(0,K.jsx)(te,{className:`h-4 w-4`}),children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,K.jsx)(`input`,{value:ke,onChange:e=>Ae(e.target.value),placeholder:e(`libreClaw.automations.namePlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsx)(`input`,{value:je,onChange:e=>Y(e.target.value),placeholder:e(`libreClaw.automations.schedulePlaceholder`),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsxs)(`select`,{value:Ie,onChange:e=>Le(e.target.value),className:`rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`,children:[(0,K.jsx)(`option`,{value:`report`,children:e(`libreClaw.automations.routes.report`)}),(0,K.jsx)(`option`,{value:`telegram`,children:e(`libreClaw.automations.routes.telegram`)})]}),(0,K.jsx)(k,{onClick:Ge,loading:de,children:e(`libreClaw.automations.create`)})]}),(0,K.jsx)(`textarea`,{value:X,onChange:e=>Fe(e.target.value),placeholder:e(`libreClaw.automations.promptPlaceholder`),className:`min-h-24 w-full rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[s.length===0&&(0,K.jsx)(Me,{text:e(`libreClaw.automations.empty`)}),s.map(t=>(0,K.jsx)(`div`,{className:`rounded-xl border border-gray-200 bg-white p-3 dark:border-dark-300 dark:bg-dark-50`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-medium text-gray-900 dark:text-dark-900`,children:t.name}),(0,K.jsxs)(`div`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:[t.schedule,` ·`,` `,e(`libreClaw.automations.routes.${t.route}`,{defaultValue:t.route}),` `,`·`,` `,e(`libreClaw.automations.status.${t.status}`,{defaultValue:t.status})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,K.jsx)(De,{title:e(`libreClaw.automations.runNow`),onClick:()=>Ke(t.automation_id,`run`),children:(0,K.jsx)(m,{className:`h-4 w-4`})}),(0,K.jsx)(De,{title:t.status===`paused`?e(`libreClaw.automations.resume`):e(`libreClaw.automations.pause`),onClick:()=>Ke(t.automation_id,t.status===`paused`?`resume`:`pause`),children:t.status===`paused`?(0,K.jsx)(m,{className:`h-4 w-4`}):(0,K.jsx)(g,{className:`h-4 w-4`})}),(0,K.jsx)(De,{title:e(`common.delete`),danger:!0,onClick:()=>Ke(t.automation_id,`delete`),children:(0,K.jsx)(w,{className:`h-4 w-4`})})]})]})},t.automation_id))]})]})}),(0,K.jsx)(J,{title:e(`libreClaw.usageFallback.title`),icon:(0,K.jsx)(E,{className:`h-4 w-4`}),children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-gray-900 dark:text-dark-900`,children:e(`libreClaw.usageFallback.usage`)}),(0,K.jsx)(`pre`,{className:`max-h-52 overflow-auto rounded-xl bg-gray-100 p-3 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:j||e(`libreClaw.usageFallback.noUsage`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-gray-900 dark:text-dark-900`,children:e(`libreClaw.usageFallback.fallbackRoute`)}),(0,K.jsx)(`pre`,{className:`max-h-52 overflow-auto rounded-xl bg-gray-100 p-3 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(p||{},null,2)})]})]})})]}),P&&(0,K.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-white/60 backdrop-blur-sm dark:bg-dark-50/60`,children:(0,K.jsx)(C,{className:`h-7 w-7 animate-spin text-primary-600`})})]})},Te=({status:e,t})=>{let n=!!e?.connected;return(0,K.jsxs)(`span`,{className:f(`inline-flex items-center gap-2 rounded-full px-3 py-1.5 text-sm font-medium`,n?`bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300`:`bg-amber-500/20 text-ink dark:bg-amber-900/30`),children:[(0,K.jsx)(`span`,{className:f(`h-2 w-2 rounded-full`,n?`bg-emerald-500`:`bg-amber-500`)}),t(n?`libreClaw.status.connected`:`libreClaw.status.disconnected`),e?.health?.active_runs!==void 0&&(0,K.jsxs)(`span`,{className:`opacity-70`,children:[`·`,` `,t(`libreClaw.status.activeRuns`,{count:e.health.active_runs})]})]})},Ee=({state:e,t})=>(0,K.jsx)(`span`,{className:f(`rounded-full px-2 py-0.5 text-[11px] font-semibold uppercase tracking-wide`,xe[e]||xe.queued),children:t(`libreClaw.states.${e}`,{defaultValue:e})}),J=({title:e,icon:t,actions:n,children:r})=>(0,K.jsxs)(`section`,{className:`rounded-2xl border border-gray-200/80 bg-white/60 dark:border-white/10 dark:bg-white/[0.03]`,children:[(0,K.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-gray-200/70 px-5 py-4 dark:border-white/[0.08]`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-dark-900`,children:[(0,K.jsx)(`span`,{className:`text-primary-600 dark:text-primary-300`,children:t}),e]}),n]}),(0,K.jsx)(`div`,{className:`p-5`,children:r})]}),De=({title:e,danger:t,onClick:n,children:r})=>(0,K.jsx)(`button`,{type:`button`,title:e,onClick:n,className:f(`inline-flex h-8 w-8 items-center justify-center rounded-lg transition-colors`,t?`text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`:`text-gray-500 hover:bg-gray-100 dark:text-dark-500 dark:hover:bg-dark-200`),children:r}),Oe=({item:e,t})=>(0,K.jsxs)(`article`,{className:f(`rounded-xl border p-3 transition-colors`,e.eventType===`assistant_message`?`border-primary-200 bg-primary-50/60 dark:border-primary-900/60 dark:bg-primary-900/10`:(e.eventType,`border-gray-200/80 bg-white/50 dark:border-white/[0.08] dark:bg-white/[0.025]`)),children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:f(`text-xs font-semibold uppercase tracking-wide`,Se[e.eventType]||`text-gray-500 dark:text-dark-500`),children:e.label}),(0,K.jsxs)(`span`,{className:`shrink-0 text-xs text-gray-400 dark:text-dark-500`,children:[Le(e),` · `,Ne(e.timestamp)]})]}),(0,K.jsx)(ke,{item:e,t})]}),ke=({item:e,t})=>{if(e.kind===`assistant_message`)return(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6 text-gray-900 dark:text-dark-900`,children:Fe(e.events)||t(`libreClaw.timeline.streaming`)});let n=e.events[0];return n?n.type===`assistant_delta`?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-gray-800 dark:text-dark-800`,children:String(n.data.text||``)}):n.type===`user_message`?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm text-gray-800 dark:text-dark-800`,children:String(n.data.content||``)}):n.type===`tool_call`?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:String(n.data.name||t(`libreClaw.fallbacks.tool`))}),(0,K.jsx)(X,{value:n.data.arguments||{}})]}):n.type===`tool_result`?(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:[String(n.data.name||t(`libreClaw.fallbacks.tool`)),` ·`,` `,n.data.is_error?t(`libreClaw.timeline.resultError`):t(`libreClaw.timeline.resultOk`)]}),(0,K.jsx)(`pre`,{className:`mt-2 max-h-56 overflow-auto whitespace-pre-wrap rounded-lg bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:String(n.data.content||``)})]}):n.type===`permission_request`?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:String(n.data.name||t(`libreClaw.approvals.toolApprovalRequested`))}),(0,K.jsx)(X,{value:n.data.arguments||{}})]}):n.type===`permission_response`?(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Y,{label:t(`libreClaw.metrics.tool`),value:String(n.data.name||n.data.tool_call_id||t(`libreClaw.fallbacks.tool`))}),(0,K.jsx)(Y,{label:t(`libreClaw.metrics.resolution`),value:String(n.data.resolution||t(`libreClaw.fallbacks.resolved`))})]}):n.type===`usage`?(0,K.jsx)(Ae,{data:n.data,t}):n.type===`run_finished`?(0,K.jsx)(je,{data:n.data,t}):n.type===`error`?(0,K.jsx)(`p`,{className:`text-sm text-red-700 dark:text-red-300`,children:String(n.data.message||t(`libreClaw.fallbacks.unknownError`))}):(0,K.jsx)(X,{value:n.data}):null},Ae=({data:e,t})=>(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Y,{label:t(`libreClaw.metrics.provider`),value:String(e.provider||t(`libreClaw.fallbacks.unknown`))}),(0,K.jsx)(Y,{label:t(`libreClaw.metrics.model`),value:String(e.model||t(`libreClaw.fallbacks.unknown`))}),(0,K.jsx)(Y,{label:t(`libreClaw.metrics.input`),value:t(`libreClaw.metrics.tokens`,{count:Z(e.input_tokens),formatted:Q(e.input_tokens)})}),(0,K.jsx)(Y,{label:t(`libreClaw.metrics.output`),value:t(`libreClaw.metrics.tokens`,{count:Z(e.output_tokens),formatted:Q(e.output_tokens)})}),Z(e.cached_tokens)>0&&(0,K.jsx)(Y,{label:t(`libreClaw.metrics.cached`),value:t(`libreClaw.metrics.tokens`,{count:Z(e.cached_tokens),formatted:Q(e.cached_tokens)})}),Z(e.reasoning_tokens)>0&&(0,K.jsx)(Y,{label:t(`libreClaw.metrics.reasoning`),value:t(`libreClaw.metrics.tokens`,{count:Z(e.reasoning_tokens),formatted:Q(e.reasoning_tokens)})}),(0,K.jsx)(Y,{label:t(`libreClaw.metrics.cost`),value:Re(e.cost)})]}),je=({data:e,t})=>(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Y,{label:t(`libreClaw.metrics.state`),value:t(`libreClaw.states.${String(e.state||`done`)}`,{defaultValue:String(e.state||`done`)})}),e.stop_reason!==void 0&&(0,K.jsx)(Y,{label:t(`libreClaw.metrics.stopReason`),value:String(e.stop_reason)})]}),Y=({label:e,value:t})=>(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-gray-200/80 bg-white/50 px-2.5 py-1 text-xs text-gray-700 dark:border-white/10 dark:bg-white/[0.035] dark:text-dark-700`,children:[(0,K.jsx)(`span`,{className:`font-semibold text-gray-500 dark:text-dark-500`,children:e}),(0,K.jsx)(`span`,{children:t})]}),X=({value:e})=>(0,K.jsx)(`pre`,{className:`mt-2 max-h-56 overflow-auto rounded-lg bg-gray-100 p-2 text-xs text-gray-700 dark:bg-dark-200 dark:text-dark-700`,children:JSON.stringify(e,null,2)}),Me=({text:e})=>(0,K.jsx)(`div`,{className:`rounded-xl border border-dashed border-gray-300 bg-white/30 px-4 py-8 text-center text-sm text-gray-500 dark:border-white/15 dark:bg-white/[0.02] dark:text-dark-500`,children:e}),Ne=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()},Pe=(e,t)=>{let n=[],r=0;for(;r<e.length;){let i=e[r];if(!i)break;if(i.type===`assistant_delta`){let i=[];for(;e[r]?.type===`assistant_delta`;){let t=e[r];t&&i.push(t),r+=1}let a=i[0],o=i[i.length-1]||a;a&&o&&n.push({key:`assistant-${a.event_id}-${o.event_id}`,kind:`assistant_message`,eventType:`assistant_message`,label:t(`libreClaw.timeline.assistantResponse`),firstEventId:a.event_id,lastEventId:o.event_id,timestamp:a.timestamp,events:i});continue}n.push({key:`${i.type}-${i.event_id}`,kind:`event`,eventType:i.type,label:Ie(i.type,t),firstEventId:i.event_id,lastEventId:i.event_id,timestamp:i.timestamp,events:[i]}),r+=1}return n},Fe=e=>e.map(e=>String(e.data.text||``)).join(``),Ie=(e,t)=>({user_message:t(`libreClaw.timeline.labels.userMessage`),tool_call:t(`libreClaw.timeline.labels.toolCall`),tool_result:t(`libreClaw.timeline.labels.toolResult`),permission_request:t(`libreClaw.timeline.labels.approvalRequest`),permission_response:t(`libreClaw.timeline.labels.approvalResponse`),run_started:t(`libreClaw.timeline.labels.runStarted`),run_finished:t(`libreClaw.timeline.labels.runFinished`),usage:t(`libreClaw.timeline.labels.usage`),error:t(`libreClaw.timeline.labels.error`)})[e]||e.replace(/_/g,` `),Le=e=>e.firstEventId===e.lastEventId?`#${e.firstEventId}`:`#${e.firstEventId}-#${e.lastEventId}`,Z=e=>{let t=Number(e);return Number.isFinite(t)?t:0},Q=e=>new Intl.NumberFormat().format(Z(e)),Re=e=>{let t=Z(e);return t<=0?`$0.00`:t<.01?`$${t.toFixed(6)}`:`$${t.toFixed(4)}`};export{we as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{d as e,f as t}from"./markdown-core-DHnR5Hw8.js";import{n}from"./react-vendor-DPNXrO-8.js";import{t as r}from"./useTranslation-CXY69qNk.js";import{t as i}from"./utils-BM0_0iFj.js";import{Kt as a,R as o,Rt as s,_ as c,n as l}from"./ui-vendor-xUzKqAXI.js";import{t as u}from"./Button-CTXHujOd.js";t();var d=n(),f=e(),p=({models:e,showDetailsModal:t,setShowDetailsModal:n,selectedModelName:p,selectedModelDetails:m,loadingDetails:h,showCopyModal:g,setShowCopyModal:_,copySource:v,setCopySource:y,copyDestination:b,setCopyDestination:x,copying:S,handleCopyModel:C,showCreateModal:w,setShowCreateModal:T,createModelName:E,setCreateModelName:D,createModelfile:O,setCreateModelfile:k,creating:A,handleCreateModel:j,showEmbeddingsModal:M,setShowEmbeddingsModal:N,embeddingsModel:P,setEmbeddingsModel:F,embeddingsInput:I,setEmbeddingsInput:L,embeddingsResult:R,generatingEmbeddings:z,handleGenerateEmbeddings:B})=>{let{t:V}=r();return(0,f.jsxs)(f.Fragment,{children:[t&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>n(!1)}),(0,f.jsxs)(`div`,{className:i(`relative w-full max-w-2xl max-h-[85vh] overflow-hidden rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:i(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:[V(`modelManager.modals.details.title`),`: `,p]}),(0,f.jsx)(`button`,{onClick:()=>n(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(l,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsx)(`div`,{className:`overflow-y-auto max-h-[calc(85vh-60px)] p-4 space-y-4`,children:h?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,f.jsx)(o,{className:`h-6 w-6 animate-spin text-gray-400`})}):m?(0,f.jsxs)(f.Fragment,{children:[m.details&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.info`)}),(0,f.jsx)(`div`,{className:i(`p-3 rounded-lg text-sm`,`bg-gray-50 dark:bg-dark-50`),children:(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[m.details.family&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.family`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.family})]}),m.details.parameter_size&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.parameters`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.parameter_size})]}),m.details.quantization_level&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.quantization`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.quantization_level})]}),m.details.format&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.format`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.format})]})]})})]}),m.system&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.systemPrompt`)}),(0,f.jsx)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.system})]}),m.template&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.template`)}),(0,f.jsx)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto max-h-40`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.template})]}),m.parameters&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.parameters`)}),(0,f.jsx)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.parameters})]}),m.license&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.license`)}),(0,f.jsx)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto max-h-32`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.license})]}),m.modelfile&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.modelfile`)}),(0,f.jsx)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto max-h-60`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.modelfile})]})]}):(0,f.jsx)(`p`,{className:`text-center text-gray-500`,children:V(`modelManager.modals.details.noDetails`)})})]})]}),document.body),g&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>_(!1)}),(0,f.jsxs)(`div`,{className:i(`relative w-full max-w-md rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:i(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.copy.title`)}),(0,f.jsx)(`button`,{onClick:()=>_(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(l,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.copy.source`)}),(0,f.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),className:i(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`),children:[(0,f.jsx)(`option`,{value:``,children:V(`modelManager.modals.copy.selectModel`)}),e.map(e=>(0,f.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.copy.newName`)}),(0,f.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:V(`modelManager.modals.copy.placeholder`),className:i(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`)})]}),(0,f.jsxs)(u,{onClick:C,disabled:!v.trim()||!b.trim()||S,className:i(`w-full gap-2`,``),children:[S?(0,f.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(a,{className:`h-4 w-4`}),V(S?`modelManager.modals.copy.copying`:`modelManager.modals.copy.button`)]})]})]})]}),document.body),w&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>T(!1)}),(0,f.jsxs)(`div`,{className:i(`relative w-full max-w-lg rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:i(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.create.title`)}),(0,f.jsx)(`button`,{onClick:()=>T(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(l,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.create.name`)}),(0,f.jsx)(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:V(`modelManager.modals.create.namePlaceholder`),className:i(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.create.modelfile`)}),(0,f.jsx)(`textarea`,{value:O,onChange:e=>k(e.target.value),placeholder:V(`modelManager.modals.create.modelfilePlaceholder`),rows:8,className:i(`w-full px-3 py-2 rounded-lg border text-sm font-mono`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`,`resize-none`)}),(0,f.jsxs)(`p`,{className:`mt-1 text-xs text-gray-500`,children:[V(`modelManager.modals.create.see`),` `,(0,f.jsx)(`a`,{href:`https://github.com/ollama/ollama/blob/main/docs/modelfile.md`,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary-600 hover:underline`,children:V(`modelManager.modals.create.docs`)}),` `,V(`modelManager.modals.create.docsLink`)]})]}),(0,f.jsxs)(u,{onClick:j,disabled:!E.trim()||!O.trim()||A,className:i(`w-full gap-2`,``),children:[A?(0,f.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(s,{className:`h-4 w-4`}),V(A?`modelManager.modals.create.creating`:`modelManager.modals.create.button`)]})]})]})]}),document.body),M&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>N(!1)}),(0,f.jsxs)(`div`,{className:i(`relative w-full max-w-lg rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:i(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.embeddings.title`)}),(0,f.jsx)(`button`,{onClick:()=>N(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(l,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.model`)}),(0,f.jsxs)(`select`,{value:P,onChange:e=>F(e.target.value),className:i(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`),children:[(0,f.jsx)(`option`,{value:``,children:V(`modelManager.modals.embeddings.selectModel`)}),e.map(e=>(0,f.jsx)(`option`,{value:e.name,children:e.name},e.name))]}),(0,f.jsx)(`p`,{className:`mt-1 text-xs text-gray-500`,children:V(`modelManager.modals.embeddings.recommended`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.input`)}),(0,f.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:V(`modelManager.modals.embeddings.placeholder`),rows:3,className:i(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`,`resize-none`)})]}),(0,f.jsxs)(u,{onClick:B,disabled:!P.trim()||!I.trim()||z,className:i(`w-full gap-2`,``),children:[z?(0,f.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(c,{className:`h-4 w-4`}),V(z?`modelManager.modals.embeddings.generating`:`modelManager.modals.embeddings.button`)]}),R&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.result`,{count:R.length})}),(0,f.jsxs)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto max-h-32`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:[`[`,R.slice(0,10).join(`, `),R.length>10&&`, ...`,` ]`]})]})]})]})]}),document.body)]})};export{p as ModelManagerModals,p as default};
1
+ import"./rolldown-runtime-hePW80VL.js";import{m as e,p as t}from"./markdown-core-BmPPZiuD.js";import{n}from"./react-vendor-C5yShNlM.js";import{t as r}from"./useTranslation-C3ei3mJq.js";import{t as i}from"./utils-CuC1beTY.js";import{Kt as a,L as o,Rt as s,_ as c,n as l}from"./ui-vendor-D3Ahl1x5.js";import{t as u}from"./Button-BV44cTnj.js";e();var d=n(),f=t(),p=({models:e,showDetailsModal:t,setShowDetailsModal:n,selectedModelName:p,selectedModelDetails:m,loadingDetails:h,showCopyModal:g,setShowCopyModal:_,copySource:v,setCopySource:y,copyDestination:b,setCopyDestination:x,copying:S,handleCopyModel:C,showCreateModal:w,setShowCreateModal:T,createModelName:E,setCreateModelName:D,createModelfile:O,setCreateModelfile:k,creating:A,handleCreateModel:j,showEmbeddingsModal:M,setShowEmbeddingsModal:N,embeddingsModel:P,setEmbeddingsModel:F,embeddingsInput:I,setEmbeddingsInput:L,embeddingsResult:R,generatingEmbeddings:z,handleGenerateEmbeddings:B})=>{let{t:V}=r();return(0,f.jsxs)(f.Fragment,{children:[t&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>n(!1)}),(0,f.jsxs)(`div`,{className:i(`relative w-full max-w-2xl max-h-[85vh] overflow-hidden rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:i(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:[V(`modelManager.modals.details.title`),`: `,p]}),(0,f.jsx)(`button`,{onClick:()=>n(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(l,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsx)(`div`,{className:`overflow-y-auto max-h-[calc(85vh-60px)] p-4 space-y-4`,children:h?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,f.jsx)(o,{className:`h-6 w-6 animate-spin text-gray-400`})}):m?(0,f.jsxs)(f.Fragment,{children:[m.details&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.info`)}),(0,f.jsx)(`div`,{className:i(`p-3 rounded-lg text-sm`,`bg-gray-50 dark:bg-dark-50`),children:(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[m.details.family&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.family`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.family})]}),m.details.parameter_size&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.parameters`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.parameter_size})]}),m.details.quantization_level&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.quantization`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.quantization_level})]}),m.details.format&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`span`,{className:`text-gray-500`,children:[V(`modelManager.modals.details.format`),`:`]}),` `,(0,f.jsx)(`span`,{className:`text-gray-900 dark:text-gray-100`,children:m.details.format})]})]})})]}),m.system&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.systemPrompt`)}),(0,f.jsx)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.system})]}),m.template&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.template`)}),(0,f.jsx)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto max-h-40`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.template})]}),m.parameters&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.parameters`)}),(0,f.jsx)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.parameters})]}),m.license&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.license`)}),(0,f.jsx)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto max-h-32`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.license})]}),m.modelfile&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h4`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300 mb-2`,children:V(`modelManager.modals.details.modelfile`)}),(0,f.jsx)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto max-h-60`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:m.modelfile})]})]}):(0,f.jsx)(`p`,{className:`text-center text-gray-500`,children:V(`modelManager.modals.details.noDetails`)})})]})]}),document.body),g&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>_(!1)}),(0,f.jsxs)(`div`,{className:i(`relative w-full max-w-md rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:i(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.copy.title`)}),(0,f.jsx)(`button`,{onClick:()=>_(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(l,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.copy.source`)}),(0,f.jsxs)(`select`,{value:v,onChange:e=>y(e.target.value),className:i(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`),children:[(0,f.jsx)(`option`,{value:``,children:V(`modelManager.modals.copy.selectModel`)}),e.map(e=>(0,f.jsx)(`option`,{value:e.name,children:e.name},e.name))]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.copy.newName`)}),(0,f.jsx)(`input`,{type:`text`,value:b,onChange:e=>x(e.target.value),placeholder:V(`modelManager.modals.copy.placeholder`),className:i(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`)})]}),(0,f.jsxs)(u,{onClick:C,disabled:!v.trim()||!b.trim()||S,className:i(`w-full gap-2`,``),children:[S?(0,f.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(a,{className:`h-4 w-4`}),V(S?`modelManager.modals.copy.copying`:`modelManager.modals.copy.button`)]})]})]})]}),document.body),w&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>T(!1)}),(0,f.jsxs)(`div`,{className:i(`relative w-full max-w-lg rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:i(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.create.title`)}),(0,f.jsx)(`button`,{onClick:()=>T(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(l,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.create.name`)}),(0,f.jsx)(`input`,{type:`text`,value:E,onChange:e=>D(e.target.value),placeholder:V(`modelManager.modals.create.namePlaceholder`),className:i(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.create.modelfile`)}),(0,f.jsx)(`textarea`,{value:O,onChange:e=>k(e.target.value),placeholder:V(`modelManager.modals.create.modelfilePlaceholder`),rows:8,className:i(`w-full px-3 py-2 rounded-lg border text-sm font-mono`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`,`resize-none`)}),(0,f.jsxs)(`p`,{className:`mt-1 text-xs text-gray-500`,children:[V(`modelManager.modals.create.see`),` `,(0,f.jsx)(`a`,{href:`https://github.com/ollama/ollama/blob/main/docs/modelfile.md`,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary-600 hover:underline`,children:V(`modelManager.modals.create.docs`)}),` `,V(`modelManager.modals.create.docsLink`)]})]}),(0,f.jsxs)(u,{onClick:j,disabled:!E.trim()||!O.trim()||A,className:i(`w-full gap-2`,``),children:[A?(0,f.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(s,{className:`h-4 w-4`}),V(A?`modelManager.modals.create.creating`:`modelManager.modals.create.button`)]})]})]})]}),document.body),M&&(0,d.createPortal)((0,f.jsxs)(`div`,{className:`fixed inset-0 z-[999999] flex items-center justify-center p-4`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:()=>N(!1)}),(0,f.jsxs)(`div`,{className:i(`relative w-full max-w-lg rounded-xl border shadow-2xl`,`bg-white dark:bg-dark-100`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsxs)(`div`,{className:i(`flex items-center justify-between p-4 border-b`,`border-gray-200 dark:border-dark-300`),children:[(0,f.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100`,children:V(`modelManager.modals.embeddings.title`)}),(0,f.jsx)(`button`,{onClick:()=>N(!1),className:`p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,f.jsx)(l,{className:`h-5 w-5 text-gray-500`})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.model`)}),(0,f.jsxs)(`select`,{value:P,onChange:e=>F(e.target.value),className:i(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`),children:[(0,f.jsx)(`option`,{value:``,children:V(`modelManager.modals.embeddings.selectModel`)}),e.map(e=>(0,f.jsx)(`option`,{value:e.name,children:e.name},e.name))]}),(0,f.jsx)(`p`,{className:`mt-1 text-xs text-gray-500`,children:V(`modelManager.modals.embeddings.recommended`)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.input`)}),(0,f.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:V(`modelManager.modals.embeddings.placeholder`),rows:3,className:i(`w-full px-3 py-2 rounded-lg border text-sm`,`bg-gray-50 dark:bg-dark-50`,`border-gray-200 dark:border-dark-300`,`text-gray-900 dark:text-gray-100`,`placeholder-gray-500`,`resize-none`)})]}),(0,f.jsxs)(u,{onClick:B,disabled:!P.trim()||!I.trim()||z,className:i(`w-full gap-2`,``),children:[z?(0,f.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,f.jsx)(c,{className:`h-4 w-4`}),V(z?`modelManager.modals.embeddings.generating`:`modelManager.modals.embeddings.button`)]}),R&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1`,children:V(`modelManager.modals.embeddings.result`,{count:R.length})}),(0,f.jsxs)(`pre`,{className:i(`p-3 rounded-lg text-xs overflow-x-auto max-h-32`,`bg-gray-50 dark:bg-dark-50`,`text-gray-700 dark:text-gray-300`),children:[`[`,R.slice(0,10).join(`, `),R.length>10&&`, ...`,` ]`]})]})]})]})]}),document.body)]})};export{p as ModelManagerModals,p as default};