libre-webui 0.27.0 → 0.28.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 (311) hide show
  1. package/README.md +57 -29
  2. package/backend/dist/persistence/postgresAutomationWorkTargetMigration.d.ts +9 -0
  3. package/backend/dist/persistence/postgresAutomationWorkTargetMigration.d.ts.map +1 -0
  4. package/backend/dist/persistence/postgresAutomationWorkTargetMigration.js +44 -0
  5. package/backend/dist/persistence/postgresAutomationWorkTargetMigration.js.map +1 -0
  6. package/backend/dist/persistence/postgresMfaPushRecoveryMigration.d.ts.map +1 -1
  7. package/backend/dist/persistence/postgresMfaPushRecoveryMigration.js +4 -4
  8. package/backend/dist/persistence/postgresMfaPushRecoveryMigration.js.map +1 -1
  9. package/backend/dist/persistence/postgresMigrationRegistry.d.ts.map +1 -1
  10. package/backend/dist/persistence/postgresMigrationRegistry.js +6 -0
  11. package/backend/dist/persistence/postgresMigrationRegistry.js.map +1 -1
  12. package/backend/dist/persistence/postgresResourceRepositories.d.ts.map +1 -1
  13. package/backend/dist/persistence/postgresResourceRepositories.js +17 -4
  14. package/backend/dist/persistence/postgresResourceRepositories.js.map +1 -1
  15. package/backend/dist/persistence/postgresSecurityRepositories.d.ts.map +1 -1
  16. package/backend/dist/persistence/postgresSecurityRepositories.js +4 -0
  17. package/backend/dist/persistence/postgresSecurityRepositories.js.map +1 -1
  18. package/backend/dist/persistence/postgresWorkComputerMigration.d.ts +8 -0
  19. package/backend/dist/persistence/postgresWorkComputerMigration.d.ts.map +1 -0
  20. package/backend/dist/persistence/postgresWorkComputerMigration.js +37 -0
  21. package/backend/dist/persistence/postgresWorkComputerMigration.js.map +1 -0
  22. package/backend/dist/persistence/postgresWorkTakeoverMigration.d.ts +9 -0
  23. package/backend/dist/persistence/postgresWorkTakeoverMigration.d.ts.map +1 -0
  24. package/backend/dist/persistence/postgresWorkTakeoverMigration.js +38 -0
  25. package/backend/dist/persistence/postgresWorkTakeoverMigration.js.map +1 -0
  26. package/backend/dist/persistence/resourceTypes.d.ts +5 -0
  27. package/backend/dist/persistence/resourceTypes.d.ts.map +1 -1
  28. package/backend/dist/persistence/resourceTypes.js.map +1 -1
  29. package/backend/dist/persistence/securityTypes.d.ts +1 -0
  30. package/backend/dist/persistence/securityTypes.d.ts.map +1 -1
  31. package/backend/dist/persistence/sqliteMigrations.d.ts +3 -0
  32. package/backend/dist/persistence/sqliteMigrations.d.ts.map +1 -1
  33. package/backend/dist/persistence/sqliteMigrations.js +73 -0
  34. package/backend/dist/persistence/sqliteMigrations.js.map +1 -1
  35. package/backend/dist/persistence/sqliteResourceRepositories.d.ts.map +1 -1
  36. package/backend/dist/persistence/sqliteResourceRepositories.js +17 -7
  37. package/backend/dist/persistence/sqliteResourceRepositories.js.map +1 -1
  38. package/backend/dist/persistence/sqliteSecurityRepositories.d.ts.map +1 -1
  39. package/backend/dist/persistence/sqliteSecurityRepositories.js +6 -0
  40. package/backend/dist/persistence/sqliteSecurityRepositories.js.map +1 -1
  41. package/backend/dist/platform/jobs/domainJobHandlers.d.ts.map +1 -1
  42. package/backend/dist/platform/jobs/domainJobHandlers.js +87 -0
  43. package/backend/dist/platform/jobs/domainJobHandlers.js.map +1 -1
  44. package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts.map +1 -1
  45. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js +7 -3
  46. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js.map +1 -1
  47. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts.map +1 -1
  48. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js +8 -4
  49. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js.map +1 -1
  50. package/backend/dist/platform/workPersistence/types.d.ts +2 -0
  51. package/backend/dist/platform/workPersistence/types.d.ts.map +1 -1
  52. package/backend/dist/platform/workPersistence/types.js.map +1 -1
  53. package/backend/dist/routes/auth.d.ts.map +1 -1
  54. package/backend/dist/routes/auth.js +8 -4
  55. package/backend/dist/routes/auth.js.map +1 -1
  56. package/backend/dist/routes/automations.d.ts.map +1 -1
  57. package/backend/dist/routes/automations.js +5 -0
  58. package/backend/dist/routes/automations.js.map +1 -1
  59. package/backend/dist/routes/work.d.ts.map +1 -1
  60. package/backend/dist/routes/work.js +205 -1
  61. package/backend/dist/routes/work.js.map +1 -1
  62. package/backend/dist/services/authService.d.ts +2 -0
  63. package/backend/dist/services/authService.d.ts.map +1 -1
  64. package/backend/dist/services/authService.js +20 -0
  65. package/backend/dist/services/authService.js.map +1 -1
  66. package/backend/dist/services/automationSchedulerService.d.ts.map +1 -1
  67. package/backend/dist/services/automationSchedulerService.js +24 -0
  68. package/backend/dist/services/automationSchedulerService.js.map +1 -1
  69. package/backend/dist/services/automationService.d.ts +4 -1
  70. package/backend/dist/services/automationService.d.ts.map +1 -1
  71. package/backend/dist/services/automationService.js +27 -0
  72. package/backend/dist/services/automationService.js.map +1 -1
  73. package/backend/dist/services/mfaService.d.ts.map +1 -1
  74. package/backend/dist/services/mfaService.js +2 -3
  75. package/backend/dist/services/mfaService.js.map +1 -1
  76. package/backend/dist/services/webauthnService.d.ts.map +1 -1
  77. package/backend/dist/services/webauthnService.js +1 -0
  78. package/backend/dist/services/webauthnService.js.map +1 -1
  79. package/backend/dist/services/websocketTicketService.d.ts +1 -1
  80. package/backend/dist/services/websocketTicketService.d.ts.map +1 -1
  81. package/backend/dist/services/websocketTicketService.js +3 -1
  82. package/backend/dist/services/websocketTicketService.js.map +1 -1
  83. package/backend/dist/services/workAgentGuidance.d.ts +14 -0
  84. package/backend/dist/services/workAgentGuidance.d.ts.map +1 -1
  85. package/backend/dist/services/workAgentGuidance.js +38 -2
  86. package/backend/dist/services/workAgentGuidance.js.map +1 -1
  87. package/backend/dist/services/workAgentService.d.ts +9 -0
  88. package/backend/dist/services/workAgentService.d.ts.map +1 -1
  89. package/backend/dist/services/workAgentService.js +503 -13
  90. package/backend/dist/services/workAgentService.js.map +1 -1
  91. package/backend/dist/services/workComputerSetupService.d.ts +33 -0
  92. package/backend/dist/services/workComputerSetupService.d.ts.map +1 -0
  93. package/backend/dist/services/workComputerSetupService.js +164 -0
  94. package/backend/dist/services/workComputerSetupService.js.map +1 -0
  95. package/backend/dist/services/workComputerTeachService.d.ts +105 -0
  96. package/backend/dist/services/workComputerTeachService.d.ts.map +1 -0
  97. package/backend/dist/services/workComputerTeachService.js +513 -0
  98. package/backend/dist/services/workComputerTeachService.js.map +1 -0
  99. package/backend/dist/services/workKubernetesDriver.d.ts +8 -0
  100. package/backend/dist/services/workKubernetesDriver.d.ts.map +1 -1
  101. package/backend/dist/services/workKubernetesDriver.js +22 -0
  102. package/backend/dist/services/workKubernetesDriver.js.map +1 -1
  103. package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
  104. package/backend/dist/services/workModelProviderService.js +102 -8
  105. package/backend/dist/services/workModelProviderService.js.map +1 -1
  106. package/backend/dist/services/workPolicyService.d.ts +8 -0
  107. package/backend/dist/services/workPolicyService.d.ts.map +1 -1
  108. package/backend/dist/services/workPolicyService.js +25 -0
  109. package/backend/dist/services/workPolicyService.js.map +1 -1
  110. package/backend/dist/services/workRuntimeDriver.d.ts +32 -0
  111. package/backend/dist/services/workRuntimeDriver.d.ts.map +1 -1
  112. package/backend/dist/services/workRuntimeDriver.js +54 -8
  113. package/backend/dist/services/workRuntimeDriver.js.map +1 -1
  114. package/backend/dist/services/workRuntimeService.d.ts +212 -1
  115. package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
  116. package/backend/dist/services/workRuntimeService.js +1184 -9
  117. package/backend/dist/services/workRuntimeService.js.map +1 -1
  118. package/backend/dist/services/workRuntimeShared.d.ts +11 -1
  119. package/backend/dist/services/workRuntimeShared.d.ts.map +1 -1
  120. package/backend/dist/services/workRuntimeShared.js +24 -1
  121. package/backend/dist/services/workRuntimeShared.js.map +1 -1
  122. package/backend/dist/services/workScreenControlService.d.ts +60 -0
  123. package/backend/dist/services/workScreenControlService.d.ts.map +1 -0
  124. package/backend/dist/services/workScreenControlService.js +201 -0
  125. package/backend/dist/services/workScreenControlService.js.map +1 -0
  126. package/backend/dist/services/workTaskService.d.ts +11 -0
  127. package/backend/dist/services/workTaskService.d.ts.map +1 -1
  128. package/backend/dist/services/workTaskService.js +31 -0
  129. package/backend/dist/services/workTaskService.js.map +1 -1
  130. package/backend/dist/types/index.d.ts +7 -0
  131. package/backend/dist/types/index.d.ts.map +1 -1
  132. package/backend/dist/types/index.js.map +1 -1
  133. package/backend/dist/types/work.d.ts +13 -0
  134. package/backend/dist/types/work.d.ts.map +1 -1
  135. package/backend/dist/utils/webauthn.d.ts +6 -2
  136. package/backend/dist/utils/webauthn.d.ts.map +1 -1
  137. package/backend/dist/utils/webauthn.js +32 -3
  138. package/backend/dist/utils/webauthn.js.map +1 -1
  139. package/backend/dist/websocketServer.d.ts.map +1 -1
  140. package/backend/dist/websocketServer.js +9 -0
  141. package/backend/dist/websocketServer.js.map +1 -1
  142. package/backend/dist/workScreenServer.d.ts +12 -0
  143. package/backend/dist/workScreenServer.d.ts.map +1 -0
  144. package/backend/dist/workScreenServer.js +291 -0
  145. package/backend/dist/workScreenServer.js.map +1 -0
  146. package/backend/package.json +1 -1
  147. package/deploy/work-computer/Dockerfile +48 -0
  148. package/deploy/work-computer/README.md +93 -0
  149. package/deploy/work-computer/fonts/fonts.css +335 -0
  150. package/deploy/work-computer/fonts/v16-aFTR7PB1QTsUX8KYvumzEY2tbYf-Vlh3uA.woff2 +0 -0
  151. package/deploy/work-computer/fonts/v16-aFTR7PB1QTsUX8KYvumzEYOtbYf-Vlg.woff2 +0 -0
  152. package/deploy/work-computer/fonts/v16-aFTU7PB1QTsUX8KYthSQBK6PYK3EXw.woff2 +0 -0
  153. package/deploy/work-computer/fonts/v16-aFTU7PB1QTsUX8KYthqQBK6PYK0.woff2 +0 -0
  154. package/deploy/work-computer/fonts/v20-xn7gYHE41ni1AdIRggOxSvfedN62Zw.woff2 +0 -0
  155. package/deploy/work-computer/fonts/v20-xn7gYHE41ni1AdIRggSxSvfedN62Zw.woff2 +0 -0
  156. package/deploy/work-computer/fonts/v20-xn7gYHE41ni1AdIRggexSvfedN4.woff2 +0 -0
  157. package/deploy/work-computer/fonts/v20-xn7gYHE41ni1AdIRggixSvfedN62Zw.woff2 +0 -0
  158. package/deploy/work-computer/fonts/v20-xn7gYHE41ni1AdIRggmxSvfedN62Zw.woff2 +0 -0
  159. package/deploy/work-computer/fonts/v20-xn7gYHE41ni1AdIRggqxSvfedN62Zw.woff2 +0 -0
  160. package/deploy/work-computer/fonts/v22-V8mDoQDjQSkFtoMM3T6r8E7mPb54C_k3HqUtEw.woff2 +0 -0
  161. package/deploy/work-computer/fonts/v22-V8mDoQDjQSkFtoMM3T6r8E7mPb94C_k3HqUtEw.woff2 +0 -0
  162. package/deploy/work-computer/fonts/v22-V8mDoQDjQSkFtoMM3T6r8E7mPbF4C_k3HqU.woff2 +0 -0
  163. package/deploy/work-computer/start-computer.sh +155 -0
  164. package/deploy/work-computer/start-page.html +251 -0
  165. package/deploy/work-computer/tint2rc +76 -0
  166. package/deploy/work-computer/wallpaper.png +0 -0
  167. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  168. package/frontend/dist/assets/index-DGy6mo0B.js +33 -0
  169. package/frontend/dist/assets/index-DqLJKWF-.css +1 -0
  170. package/frontend/dist/index.html +31 -16
  171. package/frontend/dist/js/{ArtifactContainer-C9zNtCay.js → ArtifactContainer-DvIMxleC.js} +1 -1
  172. package/frontend/dist/js/{ArtifactDemoPage-C-EBFBCt.js → ArtifactDemoPage-BqYskFqc.js} +1 -1
  173. package/frontend/dist/js/{ArtifactSandboxFrame-CTA1j_d1.js → ArtifactSandboxFrame-9wuufHn6.js} +1 -1
  174. package/frontend/dist/js/ArtifactSlideOutPanel-DXESMtPh.js +1 -0
  175. package/frontend/dist/js/AutomationsPage-DByxhIKj.js +1 -0
  176. package/frontend/dist/js/AvatarUpload-DnCGQ46o.js +1 -0
  177. package/frontend/dist/js/{Button-C0r3J9G_.js → Button-CpobxJ2P.js} +1 -1
  178. package/frontend/dist/js/CalendarPage-JywVP-9y.js +1 -0
  179. package/frontend/dist/js/ChannelsPage-B31rcARd.js +1 -0
  180. package/frontend/dist/js/ChatPage-CHXJY8m3.js +14 -0
  181. package/frontend/dist/js/{EvaluationsPage-FWIJu2fI.js → EvaluationsPage-CcmB5wdF.js} +1 -1
  182. package/frontend/dist/js/FirstTimeSetup-DDU7SowM.js +1 -0
  183. package/frontend/dist/js/GalleryPage-XfX_7iCf.js +1 -0
  184. package/frontend/dist/js/HomePage-DAZAkoAV.js +1 -0
  185. package/frontend/dist/js/LibreClawPage-De0gZmbF.js +1 -0
  186. package/frontend/dist/js/Logo-yKM43xGa.js +1 -0
  187. package/frontend/dist/js/LogoMark-PmpKQOre.js +1 -0
  188. package/frontend/dist/js/{ModelManagerModals-BY5TK38_.js → ModelManagerModals-hz2cZZ4a.js} +1 -1
  189. package/frontend/dist/js/ModelSelector-BoFehQy-.js +1 -0
  190. package/frontend/dist/js/NotesPage-BGPI3gG6.js +3 -0
  191. package/frontend/dist/js/OptimizedSyntaxHighlighter-DrejdNUm.js +1 -0
  192. package/frontend/dist/js/OptimizedSyntaxHighlighter-hNqZPLiB.js +1 -0
  193. package/frontend/dist/js/PasswordStrengthMeter-RwModpZ1.js +1 -0
  194. package/frontend/dist/js/PersonasPage-BkNRD2wO.js +13 -0
  195. package/frontend/dist/js/PluginUsagePage-Cqt7V2SQ.js +1 -0
  196. package/frontend/dist/js/RichMessageContent-B2QSyX-l.js +1 -0
  197. package/frontend/dist/js/RichMessageContent-CYEhT6uU.js +3 -0
  198. package/frontend/dist/js/SettingsModal-IbIvVyss.js +19 -0
  199. package/frontend/dist/js/{SettingsToggle-BIVyfGjl.js → SettingsToggle-3GxA96E0.js} +1 -1
  200. package/frontend/dist/js/ShareDialog-BoE4OVhV.js +1 -0
  201. package/frontend/dist/js/{SystemPage-BT07dTMT.js → SystemPage-B5ecz5H3.js} +1 -1
  202. package/frontend/dist/js/TurnstileWidget-DHU9IUM1.js +1 -0
  203. package/frontend/dist/js/UserManagementPage-C0VUfbMk.js +1 -0
  204. package/frontend/dist/js/WorkPage-EweYI5Dx.js +74 -0
  205. package/frontend/dist/js/api-Bbh2AHHN.js +1 -0
  206. package/frontend/dist/js/api-F0CnlVH8.js +14 -0
  207. package/frontend/dist/js/appNavigation-DqV69ohR.js +1 -0
  208. package/frontend/dist/js/appStore-SLLBamo2.js +2 -0
  209. package/frontend/dist/js/appVersion-46bF9UkF.js +1 -0
  210. package/frontend/dist/js/ar-C4yo7x5J.js +2 -0
  211. package/frontend/dist/js/authStore-CcfL8T6T.js +1 -0
  212. package/frontend/dist/js/authStore-DlSQ1TcP.js +4 -0
  213. package/frontend/dist/js/axios-_ZpUYd3e.js +1 -0
  214. package/frontend/dist/js/bn-BeZ6d2qF.js +2 -0
  215. package/frontend/dist/js/chatStore-DI79tEJ-.js +3 -0
  216. package/frontend/dist/js/classPrivateMethodInitSpec-B31Q4d2M.js +1 -0
  217. package/frontend/dist/js/{config-BqZ5304Q.js → config-0QgGZCrI.js} +1 -1
  218. package/frontend/dist/js/cs-9K5LILI5.js +2 -0
  219. package/frontend/dist/js/da-BWbBhLK8.js +2 -0
  220. package/frontend/dist/js/de-BXD9t2uY.js +2 -0
  221. package/frontend/dist/js/es-Dv4wZKlU.js +2 -0
  222. package/frontend/dist/js/{estree-DPkpBuOU.js → estree-WDwviHUZ.js} +1 -1
  223. package/frontend/dist/js/evaluationsApi-wjf0nh5J.js +1 -0
  224. package/frontend/dist/js/fr-BkXGyEei.js +2 -0
  225. package/frontend/dist/js/hi-BS1ldbWk.js +2 -0
  226. package/frontend/dist/js/{html-BpGUXG8E.js → html-Cj0HNcRt.js} +1 -1
  227. package/frontend/dist/js/id-Cr1njx5M.js +2 -0
  228. package/frontend/dist/js/is-BqpNCtDd.js +2 -0
  229. package/frontend/dist/js/{it-AxEMG8Jg.js → it-Dp-iwH27.js} +1 -1
  230. package/frontend/dist/js/ja-_e4v_6Mn.js +2 -0
  231. package/frontend/dist/js/ko-CjXf2pIX.js +2 -0
  232. package/frontend/dist/js/{logger-DSXjF4ye.js → logger-CpCQz3Vi.js} +1 -1
  233. package/frontend/dist/js/{markdown-DCBRWJSK.js → markdown-DTahdtRF.js} +1 -1
  234. package/frontend/dist/js/{messageCodeStyles-BQwf7sSz.js → messageCodeStyles-COJFoq4P.js} +2 -2
  235. package/frontend/dist/js/{ms-BhEwb4b7.js → ms-xpn-zACj.js} +1 -1
  236. package/frontend/dist/js/nl-Baf0a2X0.js +2 -0
  237. package/frontend/dist/js/pl-BEOTrcUv.js +2 -0
  238. package/frontend/dist/js/pt-B5FUaihM.js +2 -0
  239. package/frontend/dist/js/rfb-bJaPz33m.js +5 -0
  240. package/frontend/dist/js/ru-BjzgMmkJ.js +2 -0
  241. package/frontend/dist/js/{standalone-BFrK0R2A.js → standalone-C04jT26m.js} +1 -1
  242. package/frontend/dist/js/sv-DDX_gP1z.js +2 -0
  243. package/frontend/dist/js/teamEventStream-CgUkgjFC.js +8 -0
  244. package/frontend/dist/js/{th-DVnW2yyh.js → th-BXr3KovE.js} +1 -1
  245. package/frontend/dist/js/tr-CdqxHEM8.js +2 -0
  246. package/frontend/dist/js/ttsBatching-BfhNT3c5.js +2 -0
  247. package/frontend/dist/js/{typescript-DYVyvmm_.js → typescript-FtGI7Y5P.js} +1 -1
  248. package/frontend/dist/js/ui-DFa2W4QC.js +2 -0
  249. package/frontend/dist/js/ui-vendor-CRZXLK0Q.js +177 -0
  250. package/frontend/dist/js/{uk-BNPKIZga.js → uk-CotKDP2Q.js} +1 -1
  251. package/frontend/dist/js/useChat-BawGm7ua.js +10 -0
  252. package/frontend/dist/js/useQuery-BboI5V5G.js +1 -0
  253. package/frontend/dist/js/{useTranslation-5b5UhAc9.js → useTranslation-D7uLySn1.js} +1 -1
  254. package/frontend/dist/js/{utils-BGrdX9ie.js → utils-sD-qFh8D.js} +1 -1
  255. package/frontend/dist/js/utils-vendor-DTLgmsuc.js +9 -0
  256. package/frontend/dist/js/vi-F2NC1HaJ.js +2 -0
  257. package/frontend/dist/js/webauthnClient-CPSq528Q.js +1 -0
  258. package/frontend/dist/js/workApi-8mBuh_-J.js +6 -0
  259. package/frontend/dist/js/workApi-DJtLOslf.js +1 -0
  260. package/frontend/dist/js/workStatus-CcO9Fg41.js +1 -0
  261. package/frontend/dist/js/zh-DZ-kpEEA.js +2 -0
  262. package/package.json +4 -2
  263. package/frontend/dist/assets/index-DBAf_VaS.js +0 -47
  264. package/frontend/dist/assets/index-kn_Axjts.css +0 -1
  265. package/frontend/dist/js/ArtifactSlideOutPanel-BOENbOiv.js +0 -1
  266. package/frontend/dist/js/AutomationsPage-C58MQ4te.js +0 -1
  267. package/frontend/dist/js/CalendarPage-BcdAZ292.js +0 -1
  268. package/frontend/dist/js/ChannelsPage-DPr9Yajs.js +0 -1
  269. package/frontend/dist/js/ChatPage-DsbB748s.js +0 -14
  270. package/frontend/dist/js/FirstTimeSetup-Cy-w6xko.js +0 -1
  271. package/frontend/dist/js/GalleryPage-DDAtxM-x.js +0 -1
  272. package/frontend/dist/js/HomePage-DLKwmE7n.js +0 -1
  273. package/frontend/dist/js/LibreClawPage-vKOj-9w9.js +0 -1
  274. package/frontend/dist/js/ModelSelector-CoCS6MZ9.js +0 -1
  275. package/frontend/dist/js/NotesPage-BElIpXgA.js +0 -3
  276. package/frontend/dist/js/OptimizedSyntaxHighlighter-xgyE3dRA.js +0 -1
  277. package/frontend/dist/js/PersonasPage-P40jVbfU.js +0 -13
  278. package/frontend/dist/js/PluginUsagePage-CKUEPCJN.js +0 -1
  279. package/frontend/dist/js/RichMessageContent-Bm2WaEGi.js +0 -3
  280. package/frontend/dist/js/SettingsModal-DxSGzx9A.js +0 -19
  281. package/frontend/dist/js/UserManagementPage-B9Vz5cm3.js +0 -1
  282. package/frontend/dist/js/WorkPage-qoN_e_jK.js +0 -6
  283. package/frontend/dist/js/api-D7Ff5M2Q.js +0 -14
  284. package/frontend/dist/js/appStore-DmV5wqDz.js +0 -2
  285. package/frontend/dist/js/ar-YHHTVP8f.js +0 -2
  286. package/frontend/dist/js/authStore-BYW8-kP6.js +0 -4
  287. package/frontend/dist/js/bn-C8VTxBVl.js +0 -2
  288. package/frontend/dist/js/chatStore-D-NTlArO.js +0 -3
  289. package/frontend/dist/js/cs-CCngB5fC.js +0 -2
  290. package/frontend/dist/js/da-CM2PP2ma.js +0 -2
  291. package/frontend/dist/js/de-BqVkD-dw.js +0 -2
  292. package/frontend/dist/js/es-BtWsWBjZ.js +0 -2
  293. package/frontend/dist/js/evaluationsApi-Dnf2dTd-.js +0 -1
  294. package/frontend/dist/js/fr-C68w9abT.js +0 -2
  295. package/frontend/dist/js/hi-DtBlcyXZ.js +0 -2
  296. package/frontend/dist/js/id-BWzIu8tn.js +0 -2
  297. package/frontend/dist/js/is-yeFwu4dJ.js +0 -2
  298. package/frontend/dist/js/ja-B-VyokB8.js +0 -2
  299. package/frontend/dist/js/ko-CvwzYr9k.js +0 -2
  300. package/frontend/dist/js/nl-Dq-QRx1L.js +0 -2
  301. package/frontend/dist/js/pl-BNEy8mQm.js +0 -2
  302. package/frontend/dist/js/pt-_3Jl3FdY.js +0 -2
  303. package/frontend/dist/js/ru-IhQiJ8ta.js +0 -2
  304. package/frontend/dist/js/sv-DWunXUNz.js +0 -2
  305. package/frontend/dist/js/tr-Do8CFmhR.js +0 -2
  306. package/frontend/dist/js/ui-db9meqAB.js +0 -2
  307. package/frontend/dist/js/ui-vendor-C0DZ8-Cm.js +0 -177
  308. package/frontend/dist/js/utils-vendor-9bQ62WeD.js +0 -9
  309. package/frontend/dist/js/vi-CZMFo9je.js +0 -2
  310. package/frontend/dist/js/workApi-CcprMH_1.js +0 -6
  311. package/frontend/dist/js/zh-Pg0881v0.js +0 -2
@@ -0,0 +1,13 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,g as n}from"./markdown-core-BK7WVOb7.js";import{i as r,t as i}from"./useQuery-BboI5V5G.js";import{t as a}from"./useTranslation-D7uLySn1.js";import{t as o}from"./utils-sD-qFh8D.js";import{t as s}from"./chatStore-DI79tEJ-.js";import{A as c,An as l,At as u,B as d,J as f,L as p,Lt as m,O as h,Q as g,Rt as _,Ut as v,Wn as y,Z as ee,Zn as b,_ as x,bn as S,c as C,dn as te,dr as w,f as T,g as E,gr as D,h as O,k,n as A,t as j,w as M,xn as N,xt as P,yn as F}from"./ui-vendor-CRZXLK0Q.js";import{t as I}from"./logger-CpCQz3Vi.js";import{A as ne,d as L,f as R,h as z,k as B,m as V,p as H,u as U}from"./api-F0CnlVH8.js";import{t as W}from"./appStore-SLLBamo2.js";import{t as G}from"./Button-CpobxJ2P.js";import{a as re,o as K}from"./ui-DFa2W4QC.js";import{t as ie}from"./AvatarUpload-DnCGQ46o.js";import{t as ae}from"./ShareDialog-BoE4OVhV.js";var q=e(t(),1),J=n(),Y=I(`components:persona-card`),oe=({persona:e,onEdit:t,onDelete:n,onDownload:s,onSelect:c,onToggleFavorite:l,isSelected:u=!1,compact:f=!1})=>{let{t:m}=a(),_=r(),[v,y]=(0,q.useState)(!1),[ee,C]=(0,q.useState)(!1),[T,E]=(0,q.useState)(!1),A=!!(e.memory_settings?.enabled||e.mutation_settings?.enabled),{data:I=null}=i({queryKey:[`persona-memory-status`,e.id],queryFn:async()=>{let t=await H.getMemoryStatus(e.id);return t.success&&t.data?t.data:null},enabled:A}),ne=()=>_.invalidateQueries({queryKey:[`persona-memory-status`,e.id]}),L=async()=>{if(confirm(m(`personaCard.wipeConfirm`))){E(!0);try{let t=await H.wipeMemories(e.id);t.success?(D.success(m(`personaCard.wipeSuccess`,{count:t.data?.deleted_count||0})),await ne()):D.error(m(`personaCard.failed`,{action:`wipe memories`}))}catch(e){D.error(m(`personaCard.failed`,{action:`wipe memories`})),Y.error(e)}finally{E(!1),y(!1)}}},R=async()=>{E(!0);try{let t=await H.backupPersona(e.id),n=window.URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e.name.toLowerCase().replace(/\s+/g,`-`)}-backup.json`,document.body.appendChild(r),r.click(),window.URL.revokeObjectURL(n),document.body.removeChild(r),D.success(m(`personaCard.backupSuccess`))}catch(e){D.error(m(`personaCard.failed`,{action:`backup persona`})),Y.error(e)}finally{E(!1),y(!1)}},B=async()=>{E(!0);try{let t=await H.exportPersonaDNA(e.id),n=window.URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e.name.toLowerCase().replace(/\s+/g,`-`)}-dna.json`,document.body.appendChild(r),r.click(),window.URL.revokeObjectURL(n),document.body.removeChild(r),D.success(m(`personaCard.dnaSuccess`))}catch(e){D.error(m(`personaCard.failed`,{action:`export persona DNA`})),Y.error(e)}finally{E(!1),y(!1)}},U=(t=128)=>V(e,t),W=(t=128)=>n=>{z(n.currentTarget,e.name,t)};return f?(0,J.jsxs)(`div`,{className:o(`group relative flex items-center gap-3 p-3 rounded-xl cursor-pointer transition-all duration-200`,`border border-transparent`,`hover:bg-gray-50 dark:hover:bg-dark-100`,u&&[`bg-primary-50 dark:bg-primary-900/20`,`border-primary-200 dark:border-primary-700`]),onClick:()=>c?.(e),children:[(0,J.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,J.jsx)(`img`,{src:U(64),alt:e.name,className:`w-10 h-10 rounded-full object-cover ring-2 ring-white dark:ring-dark-100`,onError:W(64)}),A&&(0,J.jsx)(`div`,{className:`absolute -bottom-0.5 -end-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-primary-600`,children:(0,J.jsx)(k,{className:`h-2.5 w-2.5 text-white`})})]}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`h4`,{className:`font-medium text-sm text-gray-900 dark:text-gray-100 truncate`,children:e.name}),e.is_favorite&&(0,J.jsx)(M,{className:`h-3 w-3 text-amber-500 fill-amber-500 flex-shrink-0`})]}),(0,J.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:e.model})]}),u&&(0,J.jsx)(`div`,{className:`flex-shrink-0`,children:(0,J.jsx)(`div`,{className:`w-6 h-6 rounded-full bg-primary-500 dark:bg-primary-600 flex items-center justify-center`,children:(0,J.jsx)(g,{className:`h-3 w-3 text-white rtl:rotate-180`})})})]}):(0,J.jsxs)(`div`,{className:o(`group relative overflow-hidden rounded-2xl transition-[border-color,background-color] duration-200`,`bg-white/70 dark:bg-white/[0.035]`,`border border-gray-200/80 dark:border-white/10`,`hover:border-gray-300 dark:hover:border-white/20`,u&&[`ring-2 ring-primary-500 dark:ring-primary-400`,`border-primary-300 dark:border-primary-600`]),children:[(0,J.jsxs)(`div`,{className:`relative h-24`,children:[e.background?(0,J.jsx)(`div`,{className:`absolute inset-0 bg-cover bg-center`,style:{backgroundImage:`url(${e.background})`}}):(0,J.jsx)(`div`,{className:`absolute inset-0 bg-gray-200 dark:bg-dark-200`}),e.background&&(0,J.jsx)(`div`,{className:`absolute inset-0 bg-black/15 dark:bg-black/25`}),(0,J.jsxs)(`div`,{className:`absolute inset-x-3 top-3 flex items-start justify-between`,children:[(0,J.jsx)(`button`,{onClick:t=>{t.stopPropagation(),l?.(e)},className:o(`p-1.5 rounded-full transition-all duration-200`,`border border-white/30 bg-black/20 text-white backdrop-blur-sm hover:bg-black/30`,e.is_favorite&&`bg-amber-500/80 hover:bg-amber-500`),children:(0,J.jsx)(M,{className:o(`h-4 w-4`,e.is_favorite?`fill-ink text-ink dark:fill-ink-inverse dark:text-ink-inverse`:`text-white/80 hover:text-white`)})}),A&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1 rounded-full border border-white/30 bg-black/20 px-2 py-1 text-[10px] font-medium text-white backdrop-blur-sm`,children:[(0,J.jsx)(k,{className:`h-3 w-3`}),m(`personaCard.enhanced`)]})]})]}),(0,J.jsx)(`div`,{className:`relative -mt-8 px-4`,children:(0,J.jsxs)(`div`,{className:`relative inline-block`,children:[(0,J.jsx)(`img`,{src:U(128),alt:e.name,className:`h-16 w-16 rounded-xl object-cover ring-4 ring-white dark:ring-dark-100`,onError:W(128)}),A&&(0,J.jsx)(`div`,{className:`absolute -bottom-1 -end-1 flex h-6 w-6 items-center justify-center rounded-lg bg-primary-600 ring-2 ring-white dark:ring-dark-100`,children:(0,J.jsx)(b,{className:`h-3.5 w-3.5 text-white`})})]})}),(0,J.jsxs)(`div`,{className:`px-4 pt-3 pb-4`,children:[(0,J.jsxs)(`div`,{className:`mb-3`,children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-gray-100 leading-tight`,children:e.name}),(0,J.jsxs)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400 flex items-center gap-1.5 mt-0.5`,children:[(0,J.jsx)(d,{className:`h-3.5 w-3.5`}),e.model]})]}),e.description&&(0,J.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 line-clamp-2 mb-3`,children:e.description}),e.parameters.system_prompt&&(0,J.jsxs)(`div`,{className:`mb-3 rounded-xl border border-gray-200/70 bg-gray-50/70 p-2.5 dark:border-white/[0.08] dark:bg-white/[0.025]`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1`,children:[(0,J.jsx)(P,{className:`h-3 w-3 text-gray-400 dark:text-gray-500`}),(0,J.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider font-medium text-gray-400 dark:text-gray-500`,children:m(`personaCard.systemPrompt`)})]}),(0,J.jsxs)(`p`,{className:`line-clamp-2 text-xs leading-5 text-gray-600 dark:text-gray-400`,children:[`“`,e.parameters.system_prompt,`”`]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mb-3`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-lg border border-gray-200/70 px-2 py-1 text-[11px] font-medium text-gray-600 dark:border-white/[0.08] dark:text-gray-400`,children:[(0,J.jsx)(j,{className:`h-3 w-3`}),e.parameters.temperature?.toFixed(1)||`0.7`]}),(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-lg border border-gray-200/70 px-2 py-1 text-[11px] font-medium text-gray-600 dark:border-white/[0.08] dark:text-gray-400`,children:[`Top-P `,e.parameters.top_p?.toFixed(1)||`0.9`]}),(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-lg border border-gray-200/70 px-2 py-1 text-[11px] font-medium text-gray-600 dark:border-white/[0.08] dark:text-gray-400`,children:[(e.parameters.context_window||4096).toLocaleString(),` ctx`]})]}),A&&I&&(0,J.jsx)(`div`,{className:`mb-3 rounded-xl border border-primary-200/70 bg-primary-50/50 p-2.5 dark:border-primary-800/40 dark:bg-primary-900/10`,children:(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(N,{className:`h-4 w-4 text-primary-600 dark:text-primary-400`}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`span`,{className:`text-xs font-medium text-primary-700 dark:text-primary-300`,children:[I.memory_count,` `,m(`personaCard.memories`)]}),(0,J.jsx)(`span`,{className:`ms-2 text-[10px] text-primary-600/70 dark:text-primary-400/70`,children:(e=>e<1?`${(e*1024).toFixed(0)} KB`:`${e.toFixed(1)} MB`)(I.size_mb)})]})]}),I.status&&(0,J.jsx)(`span`,{className:o(`text-[10px] px-1.5 py-0.5 rounded-full font-medium`,I.status===`active`?`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400`:`bg-gray-100 dark:bg-dark-200 text-gray-600 dark:text-gray-400`),children:I.status})]})}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-200/70 pt-3 dark:border-white/[0.08]`,children:[c&&(0,J.jsxs)(G,{onClick:()=>c(e),size:`sm`,className:`px-4`,children:[(0,J.jsx)(g,{className:`me-1.5 h-3.5 w-3.5 rtl:rotate-180`}),m(`personaCard.use`)]}),(0,J.jsxs)(`div`,{className:`ms-auto flex items-center gap-1`,children:[(0,J.jsx)(`button`,{onClick:()=>t(e),className:`p-2 rounded-lg text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-dark-200 transition-colors`,title:m(`personaCard.editTooltip`),children:(0,J.jsx)(h,{className:`h-4 w-4`})}),!e.shared&&(0,J.jsx)(`button`,{onClick:()=>C(!0),className:`p-2 rounded-lg text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-dark-200 transition-colors`,title:m(`personaCard.shareTooltip`),"data-testid":`persona-share`,children:(0,J.jsx)(p,{className:`h-4 w-4`})}),(0,J.jsx)(`button`,{onClick:()=>s(e),className:`p-2 rounded-lg text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-dark-200 transition-colors`,title:m(`personaCard.downloadTooltip`),children:(0,J.jsx)(S,{className:`h-4 w-4`})}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`button`,{onClick:()=>y(!v),className:`p-2 rounded-lg text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-dark-200 transition-colors`,title:m(`common.more`,{defaultValue:`More`}),children:(0,J.jsx)(F,{className:`h-4 w-4`})}),v&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>y(!1)}),(0,J.jsxs)(`div`,{className:`absolute end-0 bottom-full z-20 mb-1 w-44 rounded-xl border border-gray-200 bg-white py-1 shadow-lg dark:border-white/10 dark:bg-dark-100`,children:[A&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{onClick:R,disabled:T,className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-dark-50 disabled:opacity-50`,children:[(0,J.jsx)(w,{className:`h-4 w-4`}),m(`personaCard.backup`)]}),(0,J.jsxs)(`button`,{onClick:B,disabled:T,className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-dark-50 disabled:opacity-50`,children:[(0,J.jsx)(te,{className:`h-4 w-4`}),m(`personaCard.exportDNA`)]}),I&&I.memory_count>0&&(0,J.jsxs)(`button`,{onClick:L,disabled:T,className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 disabled:opacity-50`,children:[(0,J.jsx)(O,{className:`h-4 w-4`}),m(`personaCard.wipeMemories`)]}),(0,J.jsx)(`div`,{className:`my-1 border-t border-gray-100 dark:border-dark-200`})]}),(0,J.jsxs)(`button`,{onClick:()=>{n(e),y(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20`,children:[(0,J.jsx)(x,{className:`h-4 w-4`}),m(`common.delete`)]})]})]})]})]})]})]}),ee&&(0,J.jsx)(ae,{resourceType:`persona`,resourceId:e.id,resourceLabel:e.name,onClose:()=>C(!1)})]})},X={name:``,description:``,model:``,parameters:{temperature:.7,top_p:.9,top_k:40,context_window:4096,max_tokens:1024,system_prompt:``,repeat_penalty:1.1,presence_penalty:0,frequency_penalty:0},avatar:``,background:``,embedding_model:``,memory_settings:{enabled:!1,max_memories:1e3,auto_cleanup:!0,retention_days:90},mutation_settings:{enabled:!1,sensitivity:`medium`,auto_adapt:!0}};function se({embeddingModel:e,embeddingModels:t,onEmbeddingModelChange:n}){let{t:r}=a(),i=t.filter(e=>e.isDetectedEmbedding),o=t.filter(e=>!e.isDetectedEmbedding);return(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsxs)(`div`,{className:`rounded-xl p-5 bg-gradient-to-br from-primary-50 to-primary-100/50 dark:from-primary-900/30 dark:to-primary-800/20 border border-primary-200/50 dark:border-primary-700/30`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,J.jsx)(N,{className:`h-5 w-5 text-primary-600 dark:text-primary-400`}),(0,J.jsx)(`h3`,{className:`font-semibold text-primary-900 dark:text-primary-100`,children:r(`personaForm.advanced.embeddingModel`)})]}),(0,J.jsx)(`p`,{className:`text-xs text-primary-600 dark:text-primary-400 mb-3`,children:r(`personaForm.advanced.embeddingHint`)}),(0,J.jsx)(`select`,{value:e,onChange:e=>n(e.target.value),className:`w-full px-3 py-2.5 border border-primary-200 dark:border-primary-700 rounded-lg bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800 focus:ring-2 focus:ring-primary-500/20`,children:t.length===0?(0,J.jsx)(`option`,{value:``,disabled:!0,children:r(`personaForm.advanced.noModels`)}):(0,J.jsxs)(J.Fragment,{children:[i.length>0&&(0,J.jsx)(`optgroup`,{label:r(`personaForm.advanced.embeddingModels`),children:i.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.name,` - `,e.description]},e.id))}),o.length>0&&(0,J.jsx)(`optgroup`,{label:r(`personaForm.advanced.otherModels`),children:o.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.name,` - `,e.description]},e.id))})]})}),t.length===0&&(0,J.jsx)(`div`,{className:`mt-3 rounded-lg border border-amber-200 bg-amber-500/10 p-3 dark:border-amber-700/50 dark:bg-amber-900/20`,children:(0,J.jsxs)(`p`,{className:`text-sm text-ink`,children:[r(`personaForm.advanced.installHint`),` `,(0,J.jsx)(`code`,{className:`rounded bg-amber-500/20 px-1.5 py-0.5 text-xs dark:bg-amber-900/40`,children:`ollama pull nomic-embed-text`})]})}),(0,J.jsx)(`p`,{className:`text-[10px] text-primary-500 dark:text-primary-500 mt-2`,children:r(`personaForm.advanced.recommended`)})]}),(0,J.jsx)(`div`,{className:`p-4 bg-gray-50 dark:bg-dark-50 rounded-xl border border-gray-200 dark:border-dark-300`,children:(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.jsx)(m,{className:`h-5 w-5 text-gray-400 mt-0.5 flex-shrink-0`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-gray-700 dark:text-gray-300`,children:r(`personaForm.advanced.aboutTitle`)}),(0,J.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:r(`personaForm.advanced.aboutDescription`)})]})]})})]})}var ce=I(`components:persona-background-upload`),le=({value:e,onChange:t,className:n=``})=>{let{t:r}=a(),i=(0,q.useRef)(null),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(!1),u=async e=>{if(!e.type.startsWith(`image/`)){D.error(r(`personaBackground.invalidFile`));return}if(e.size>5242880){D.error(r(`personaBackground.fileTooLarge`));return}s(!0);try{let n=new FileReader;n.onload=e=>{let n=e.target?.result;t(n),D.success(r(`personaBackground.uploaded`))},n.onerror=()=>{D.error(r(`personaBackground.readFailed`))},n.readAsDataURL(e)}catch(e){ce.error(`Failed to upload background:`,e),D.error(r(`personaBackground.uploadFailed`))}finally{s(!1)}};return(0,J.jsx)(`div`,{className:`space-y-4 ${n}`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:r(`personaBackground.label`)}),(0,J.jsxs)(`div`,{className:`space-y-3`,children:[e?(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(`div`,{className:`w-full h-32 rounded-lg bg-cover bg-center border-2 border-gray-300 dark:border-dark-300`,style:{backgroundImage:`url(${e})`}}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-gray-50 dark:bg-dark-200 rounded-lg`,children:[(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:r(`personaBackground.customBackground`)}),(0,J.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:r(`personaBackground.clickToChange`)})]}),(0,J.jsx)(G,{variant:`ghost`,size:`sm`,onClick:()=>{t(``),D.success(r(`personaBackground.removed`))},className:`text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-900/20`,children:(0,J.jsx)(A,{className:`h-4 w-4`})})]})]}):(0,J.jsxs)(`div`,{className:`border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors ${c?`border-primary-500 bg-primary-50 dark:bg-primary-900/20`:`border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500`}`,onDragOver:e=>{e.preventDefault(),l(!0)},onDragLeave:e=>{e.preventDefault(),l(!1)},onDrop:e=>{e.preventDefault(),l(!1);let t=e.dataTransfer.files?.[0];t&&u(t)},onClick:()=>i.current?.click(),children:[(0,J.jsx)(_,{className:`h-12 w-12 mx-auto text-gray-400 dark:text-gray-500 mb-4`}),(0,J.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 mb-2`,children:r(`personaBackground.uploadBackgroundImage`)}),(0,J.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-4`,children:r(`personaBackground.dragAndDrop`)}),(0,J.jsxs)(G,{variant:`outline`,size:`sm`,disabled:o,className:`mx-auto`,children:[(0,J.jsx)(T,{className:`h-4 w-4 mr-2`}),r(o?`personaBackground.uploading`:`personaBackground.chooseImage`)]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1`,children:r(`personaBackground.enterImageUrl`)}),(0,J.jsx)(`input`,{type:`url`,value:e,onChange:e=>t(e.target.value),className:`w-full px-3 py-2 text-sm border border-gray-300 dark:border-dark-300 rounded-md bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800`,placeholder:`https://example.com/background.jpg`})]})]}),(0,J.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,onChange:e=>{let t=e.target.files?.[0];t&&u(t)},className:`hidden`}),(0,J.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-2`,children:r(`personaBackground.supportedFormats`)})]})})};function ue({formData:e,availableModels:t,onFieldChange:n,onParameterChange:r}){let{t:i}=a(),o=(0,q.useMemo)(()=>t.filter(e=>!e.isPlugin),[t]),s=(0,q.useMemo)(()=>{let e=new Map;for(let n of t){if(!n.isPlugin)continue;let t=n.pluginName||n.pluginId||`Provider`,r=e.get(t);r?r.push(n):e.set(t,[n])}return[...e.entries()].sort(([e],[t])=>e.localeCompare(t))},[t]);return(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:[i(`personaForm.basic.name`),` *`]}),(0,J.jsx)(`input`,{type:`text`,value:e.name,onChange:e=>n(`name`,e.target.value),className:`w-full px-3 py-2 border border-gray-300 dark:border-dark-300 rounded-lg bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800 focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 transition-colors`,placeholder:i(`personaForm.basic.namePlaceholder`),required:!0})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:[i(`personaForm.basic.model`),` *`]}),(0,J.jsxs)(`select`,{value:e.model,onChange:e=>n(`model`,e.target.value),className:`w-full px-3 py-2 border border-gray-300 dark:border-dark-300 rounded-lg bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800 focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 transition-colors`,required:!0,children:[(0,J.jsx)(`option`,{value:``,children:i(`personaForm.basic.selectModel`)}),e.model&&!t.some(t=>t.name===e.model)&&(0,J.jsx)(`option`,{value:e.model,children:e.model}),o.length>0&&(0,J.jsx)(`optgroup`,{label:`Ollama`,children:o.map(e=>(0,J.jsx)(`option`,{value:e.name,children:e.name},e.name))}),s.map(([e,t])=>(0,J.jsx)(`optgroup`,{label:e,children:t.map(e=>(0,J.jsx)(`option`,{value:e.name,children:e.name},e.name))},e))]})]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:i(`personaForm.basic.description`)}),(0,J.jsx)(`textarea`,{value:e.description,onChange:e=>n(`description`,e.target.value),className:`w-full px-3 py-2 border border-gray-300 dark:border-dark-300 rounded-lg bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800 focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 transition-colors resize-none`,rows:3,placeholder:i(`personaForm.basic.descriptionPlaceholder`)})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,J.jsx)(ie,{value:e.avatar||``,onChange:e=>n(`avatar`,e)}),(0,J.jsx)(le,{value:e.background||``,onChange:e=>n(`background`,e)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:i(`personaForm.basic.systemPrompt`)}),(0,J.jsx)(`textarea`,{value:e.parameters.system_prompt,onChange:e=>r(`system_prompt`,e.target.value),className:`w-full px-3 py-2 border border-gray-300 dark:border-dark-300 rounded-lg bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800 focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 transition-colors resize-none font-mono text-sm`,rows:6,placeholder:i(`personaForm.basic.systemPromptPlaceholder`)}),(0,J.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-600 mt-2`,children:i(`personaForm.basic.systemPromptHint`)})]})]})}function de({persona:e,submitting:t,saveAndClose:n,lastSaved:r,onCancel:i,onSave:o,onSaveAndClose:s}){let{t:c}=a();return(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(G,{type:`button`,variant:`ghost`,onClick:i,disabled:t,className:`text-gray-600 dark:text-gray-400`,children:c(`personaForm.actions.cancel`)}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[r&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm text-emerald-600 dark:text-emerald-400`,children:[(0,J.jsx)(y,{className:`h-4 w-4`}),(0,J.jsx)(`span`,{children:c(`personaForm.saved`)})]}),(0,J.jsx)(G,{type:`button`,variant:`outline`,onClick:o,disabled:t,children:c(t&&!n?`personaForm.actions.saving`:`personaForm.actions.save`)}),(0,J.jsx)(G,{type:`button`,onClick:s,disabled:t,children:c(t&&n?`personaForm.actions.saving`:e?`personaForm.actions.saveClose`:`personaForm.actions.create`)})]})]})}var fe=I(`components:persona-bindings`),pe=[`web_search`,`search_documents`,`list_documents`,`read_document`,`load_skill`];function me({bindings:e,onChange:t}){let{t:n}=a(),[r,i]=(0,q.useState)([]),[o,s]=(0,q.useState)([]),[c,l]=(0,q.useState)([]),[d,f]=(0,q.useState)([]),[p,m]=(0,q.useState)(!0);(0,q.useEffect)(()=>{let e=!1;return Promise.all([U.listServers(),L.list(),R.list(),B.getCollections()]).then(([t,n,r,a])=>{e||(t.success&&t.data&&i(t.data),n.success&&n.data&&s(n.data),r.success&&r.data&&l(r.data),a.success&&a.data&&f(a.data))}).catch(e=>{fe.error(`Failed to load bindable resources:`,e)}).finally(()=>{e||m(!1)}),()=>{e=!0}},[]);let h=n=>t({...e??{},...n}),g=(t,n)=>{let r=e?.[t]??[];h({[t]:r.includes(n)?r.filter(e=>e!==n):[...r,n]})};return p?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,J.jsx)(u,{className:`h-5 w-5 animate-spin text-gray-400`})}):(0,J.jsxs)(`div`,{className:`space-y-6`,"data-testid":`persona-bindings-tab`,children:[(0,J.jsx)(Z,{title:n(`personaForm.bindings.toolServers`),hint:n(`personaForm.bindings.toolServersHint`),emptyLabel:n(`personaForm.bindings.noToolServers`),options:r.map(e=>({id:e.id,label:e.name,detail:e.description})),selected:e?.tool_server_ids??[],onToggle:e=>g(`tool_server_ids`,e),testId:`persona-binding-tool-servers`}),(0,J.jsx)(Z,{title:n(`personaForm.bindings.builtinTools`),hint:n(`personaForm.bindings.builtinToolsHint`),emptyLabel:n(`personaForm.bindings.noBuiltinTools`),options:pe.map(e=>({id:e,label:n(`personaForm.bindings.builtin.${e}`),detail:e})),selected:e?.builtin_tools??[],onToggle:e=>g(`builtin_tools`,e),testId:`persona-binding-builtin-tools`}),(0,J.jsx)(Z,{title:n(`personaForm.bindings.skills`),hint:n(`personaForm.bindings.skillsHint`),emptyLabel:n(`personaForm.bindings.noSkills`),options:o.map(e=>({id:e.id,label:e.name,detail:`$${e.slug}`})),selected:e?.skill_ids??[],onToggle:e=>g(`skill_ids`,e),testId:`persona-binding-skills`}),(0,J.jsx)(Z,{title:n(`personaForm.bindings.collections`),hint:n(`personaForm.bindings.collectionsHint`),emptyLabel:n(`personaForm.bindings.noCollections`),options:d.map(e=>({id:e.id,label:e.name})),selected:e?.knowledge_collection_ids??[],onToggle:t=>{let n=e?.knowledge_collection_ids??[];h({knowledge_collection_ids:n.includes(t)?n.filter(e=>e!==t):[...n,t]})},testId:`persona-binding-collections`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-gray-900 dark:text-dark-800`,children:n(`personaForm.bindings.prompt`)}),(0,J.jsx)(`p`,{className:`mb-2 mt-1 text-xs text-gray-500 dark:text-dark-600`,children:n(`personaForm.bindings.promptHint`)}),(0,J.jsxs)(`select`,{value:e?.prompt_id??``,onChange:e=>h({prompt_id:e.target.value||void 0}),"data-testid":`persona-binding-prompt`,"aria-label":n(`personaForm.bindings.prompt`),className:`w-full rounded-lg border border-gray-200 bg-white px-3 py-2.5 text-sm text-gray-900 focus:ring-2 focus:ring-primary-500/20 dark:border-dark-300 dark:bg-dark-50 dark:text-dark-800`,children:[(0,J.jsx)(`option`,{value:``,children:n(`personaForm.bindings.noPrompt`)}),c.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,J.jsx)(`p`,{className:`text-xs text-gray-400 dark:text-dark-500`,children:n(`personaForm.bindings.version`,{version:e?.version??0})})]})}function Z({title:e,hint:t,emptyLabel:n,options:r,selected:i,onToggle:a,testId:o}){return(0,J.jsxs)(`div`,{"data-testid":o,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-gray-900 dark:text-dark-800`,children:e}),(0,J.jsx)(`p`,{className:`mb-2 mt-1 text-xs text-gray-500 dark:text-dark-600`,children:t}),r.length===0?(0,J.jsx)(`p`,{className:`rounded-lg border border-dashed border-gray-200 px-3 py-4 text-center text-xs text-gray-400 dark:border-dark-300 dark:text-dark-500`,children:n}):(0,J.jsx)(`div`,{className:`space-y-1`,children:r.map(e=>(0,J.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5 rounded-lg px-2.5 py-1.5 transition-colors hover:bg-gray-50 dark:hover:bg-dark-200`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:i.includes(e.id),onChange:()=>a(e.id),className:`h-4 w-4 rounded border-gray-300 dark:border-dark-400`}),(0,J.jsx)(`span`,{className:`text-sm text-gray-900 dark:text-dark-800`,children:e.label}),e.detail&&(0,J.jsx)(`span`,{className:`truncate text-xs text-gray-400 dark:text-dark-500`,children:e.detail})]},e.id))})]})}var Q=({label:e,value:t,min:n,max:r,step:i,onChange:a,hint:s,format:c=e=>String(e),colorClass:l=`text-gray-700 dark:text-dark-600`})=>{let u=(t-n)/(r-n)*100;return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,J.jsx)(`label`,{className:o(`block text-sm font-medium`,l),children:e}),(0,J.jsx)(`input`,{type:`number`,min:n,max:r,step:i,value:c(t),onChange:e=>{let t=parseFloat(e.target.value);isNaN(t)||a(Math.min(r,Math.max(n,t)))},className:`w-20 px-2 py-1 text-sm text-right bg-gray-100 dark:bg-dark-200 border border-gray-300 dark:border-dark-300 rounded focus:outline-none focus:ring-1 focus:ring-primary-500 dark:text-dark-600`})]}),(0,J.jsx)(`input`,{type:`range`,min:n,max:r,step:i,value:t,onChange:e=>a(parseFloat(e.target.value)),className:`w-full h-2 bg-gray-200 dark:bg-dark-200 rounded-lg appearance-none cursor-pointer slider`,style:{"--progress":`${u}%`}}),s&&(0,J.jsx)(`p`,{className:o(`text-xs mt-1`,l.replace(`700`,`500`).replace(`600`,`400`)),children:s})]})},$=({label:e,checked:t,onChange:n,colorClass:r=`text-gray-700 dark:text-dark-600`})=>(0,J.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer`,children:[(0,J.jsx)(`div`,{className:o(`relative w-10 h-5 rounded-full transition-colors`,t?`bg-primary-500 dark:bg-primary-600`:`bg-gray-300 dark:bg-dark-300`),onClick:()=>n(!t),children:(0,J.jsx)(`div`,{className:o(`absolute top-0.5 start-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform`,t&&`translate-x-5 rtl:-translate-x-5`)})}),(0,J.jsx)(`span`,{className:o(`text-sm font-medium`,r),children:e})]});function he({formData:e,persona:t,memoryStatus:n,loadingMemoryStatus:r,wipingMemories:i,onSettingsChange:s,onWipeMemories:c}){let{t:u}=a();return(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsxs)(`div`,{className:`rounded-xl overflow-hidden border border-emerald-200/50 dark:border-emerald-700/30`,children:[(0,J.jsx)(`div`,{className:`px-5 py-4 bg-gradient-to-r from-emerald-500 to-teal-500 dark:from-emerald-600 dark:to-teal-600`,children:(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-white/20 flex items-center justify-center`,children:(0,J.jsx)(N,{className:`h-5 w-5 text-white`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`font-semibold text-white`,children:u(`personaForm.memory.title`)}),(0,J.jsx)(`p`,{className:`text-xs text-white/80`,children:u(`personaForm.memory.subtitle`)})]})]}),(0,J.jsx)($,{label:``,checked:e.memory_settings?.enabled||!1,onChange:e=>s(`memory_settings`,{enabled:e})})]})}),e.memory_settings?.enabled&&t?.id&&(0,J.jsx)(`div`,{className:`px-5 py-4 bg-emerald-50 dark:bg-emerald-900/20 border-b border-emerald-100 dark:border-emerald-800/30`,children:r?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-emerald-600 dark:text-emerald-400`,children:[(0,J.jsx)(f,{className:`h-4 w-4 animate-spin`}),u(`personaForm.memory.loading`)]}):n?(0,J.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-2xl font-bold text-emerald-700 dark:text-emerald-300`,children:[(0,J.jsx)(N,{className:`h-5 w-5`}),n.memory_count.toLocaleString()]}),(0,J.jsx)(`p`,{className:`text-xs text-emerald-600 dark:text-emerald-400`,children:u(`personaForm.memory.memories`)})]}),(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-2xl font-bold text-emerald-700 dark:text-emerald-300`,children:[(0,J.jsx)(v,{className:`h-5 w-5`}),n.size_mb.toFixed(1)]}),(0,J.jsx)(`p`,{className:`text-xs text-emerald-600 dark:text-emerald-400`,children:u(`personaForm.memory.mbUsed`)})]}),(0,J.jsxs)(`div`,{className:`text-center`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-2xl font-bold text-emerald-700 dark:text-emerald-300`,children:[(0,J.jsx)(l,{className:`h-5 w-5`}),n.last_backup?new Date(n.last_backup).toLocaleDateString():u(`personaForm.memory.never`)]}),(0,J.jsx)(`p`,{className:`text-xs text-emerald-600 dark:text-emerald-400`,children:u(`personaForm.memory.lastBackup`)})]})]}):(0,J.jsx)(`p`,{className:`text-sm text-emerald-600 dark:text-emerald-400`,children:u(`personaForm.memory.noData`)})}),e.memory_settings?.enabled&&(0,J.jsxs)(`div`,{className:`p-5 bg-white dark:bg-dark-100 space-y-4`,children:[(0,J.jsx)(Q,{label:u(`personaForm.memory.maxMemories`),value:e.memory_settings.max_memories,min:100,max:1e4,step:100,hint:u(`personaForm.memory.maxMemoriesHint`),format:e=>e.toLocaleString(),colorClass:`text-emerald-700 dark:text-emerald-300`,onChange:e=>s(`memory_settings`,{max_memories:e})}),(0,J.jsx)(Q,{label:u(`personaForm.memory.retention`),value:e.memory_settings.retention_days,min:7,max:365,step:7,hint:u(`personaForm.memory.retentionHint`),format:e=>`${Math.round(e)} days`,colorClass:`text-emerald-700 dark:text-emerald-300`,onChange:e=>s(`memory_settings`,{retention_days:e})}),(0,J.jsx)($,{label:u(`personaForm.memory.autoCleanup`),checked:e.memory_settings.auto_cleanup,onChange:e=>s(`memory_settings`,{auto_cleanup:e}),colorClass:`text-emerald-700 dark:text-emerald-300`}),t?.id&&n&&n.memory_count>0&&(0,J.jsx)(`div`,{className:`pt-4 border-t border-gray-200 dark:border-dark-300`,children:(0,J.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800/30`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-red-700 dark:text-red-300`,children:u(`personaForm.memory.wipeAll`)}),(0,J.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u(`personaForm.memory.wipeCannot`)})]}),(0,J.jsxs)(`button`,{type:`button`,onClick:c,disabled:i,className:`px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white text-sm font-medium rounded-lg transition-colors disabled:opacity-50 flex items-center gap-1.5`,children:[i?(0,J.jsx)(f,{className:`h-3.5 w-3.5 animate-spin`}):(0,J.jsx)(x,{className:`h-3.5 w-3.5`}),u(i?`personaForm.memory.wiping`:`personaForm.memory.wipeButton`)]})]})})]}),!e.memory_settings?.enabled&&(0,J.jsx)(`div`,{className:`p-5 bg-gray-50 dark:bg-dark-50`,children:(0,J.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400 text-center`,children:u(`personaForm.memory.enableHint`)})})]}),(0,J.jsxs)(`div`,{className:`rounded-xl overflow-hidden border border-primary-200/50 dark:border-primary-700/30`,children:[(0,J.jsx)(`div`,{className:`px-5 py-4 bg-primary-600 dark:bg-primary-600`,children:(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`w-10 h-10 rounded-lg bg-white/20 flex items-center justify-center`,children:(0,J.jsx)(E,{className:`h-5 w-5 text-white`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`font-semibold text-white`,children:u(`personaForm.learning.title`)}),(0,J.jsx)(`p`,{className:`text-xs text-white/80`,children:u(`personaForm.learning.subtitle`)})]})]}),(0,J.jsx)($,{label:``,checked:e.mutation_settings?.enabled||!1,onChange:e=>s(`mutation_settings`,{enabled:e})})]})}),e.mutation_settings?.enabled&&(0,J.jsxs)(`div`,{className:`p-5 bg-white dark:bg-dark-100 space-y-5`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-primary-700 dark:text-primary-300 mb-3`,children:u(`personaForm.learning.speed`)}),(0,J.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:[{level:`low`,icon:j,label:u(`personaForm.learning.slow`),desc:u(`personaForm.learning.slowDesc`)},{level:`medium`,icon:E,label:u(`personaForm.learning.balanced`),desc:u(`personaForm.learning.balancedDesc`)},{level:`high`,icon:k,label:u(`personaForm.learning.fast`),desc:u(`personaForm.learning.fastDesc`)}].map(({level:t,icon:n,label:r,desc:i})=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>s(`mutation_settings`,{sensitivity:t}),className:o(`p-3 rounded-xl text-center transition-all border`,e.mutation_settings?.sensitivity===t?`bg-primary-600 border-primary-600 text-white shadow-lg`:`bg-primary-50 dark:bg-primary-900/20 border-primary-200 dark:border-primary-700/30 text-primary-700 dark:text-primary-300 hover:bg-primary-100 dark:hover:bg-primary-900/30`),children:[(0,J.jsx)(n,{className:`h-5 w-5 mx-auto mb-1`}),(0,J.jsx)(`p`,{className:`text-sm font-medium`,children:r}),(0,J.jsx)(`p`,{className:`text-[10px] opacity-70`,children:i})]},t))})]}),(0,J.jsx)($,{label:u(`personaForm.learning.autoAdapt`),checked:e.mutation_settings.auto_adapt,onChange:e=>s(`mutation_settings`,{auto_adapt:e}),colorClass:`text-primary-700 dark:text-primary-300`}),(0,J.jsxs)(`div`,{className:`p-4 bg-primary-50 dark:bg-primary-900/20 rounded-xl`,children:[(0,J.jsxs)(`p`,{className:`text-xs font-medium text-primary-700 dark:text-primary-300 mb-2 flex items-center gap-1.5`,children:[(0,J.jsx)(b,{className:`h-3.5 w-3.5`}),u(`personaForm.learning.whatLearns`)]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs text-primary-600 dark:text-primary-400`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-primary-400`}),u(`personaForm.learning.conversationTone`)]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-primary-400`}),u(`personaForm.learning.responseStyle`)]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-primary-400`}),u(`personaForm.learning.userPreferences`)]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-primary-400`}),u(`personaForm.learning.topicInterests`)]})]})]})]}),!e.mutation_settings?.enabled&&(0,J.jsx)(`div`,{className:`p-5 bg-gray-50 dark:bg-dark-50`,children:(0,J.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400 text-center`,children:u(`personaForm.learning.enableHint`)})})]})]})}function ge({parameters:e,onParameterChange:t}){let{t:n}=a(),r=(0,q.useMemo)(()=>[{key:`temperature`,label:n(`personaForm.parameters.temperature`),min:0,max:2,step:.1,hint:n(`personaForm.parameters.temperatureHint`),format:e=>e.toFixed(1)},{key:`top_p`,label:n(`personaForm.parameters.topP`),min:0,max:1,step:.1,hint:n(`personaForm.parameters.topPHint`),format:e=>e.toFixed(1)},{key:`top_k`,label:n(`personaForm.parameters.topK`),min:1,max:100,step:1,hint:n(`personaForm.parameters.topKHint`),format:e=>String(Math.round(e))},{key:`context_window`,label:n(`personaForm.parameters.contextWindow`),min:128,max:131072,step:128,hint:n(`personaForm.parameters.contextWindowHint`),format:e=>String(Math.round(e))},{key:`max_tokens`,label:n(`personaForm.parameters.maxTokens`),min:1,max:8192,step:1,hint:n(`personaForm.parameters.maxTokensHint`),format:e=>String(Math.round(e))},{key:`repeat_penalty`,label:n(`personaForm.parameters.repeatPenalty`),min:.5,max:2,step:.1,hint:n(`personaForm.parameters.repeatPenaltyHint`),format:e=>e.toFixed(1)}],[n]);return(0,J.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:r.map(({key:n,label:r,min:i,max:a,step:o,hint:s,format:c})=>(0,J.jsx)(Q,{label:r,value:e[n]||0,min:i,max:a,step:o,hint:s,format:c,onChange:e=>t(n,e)},n))})}var _e=I(`components:persona-form`),ve=({persona:e,onSubmit:t,onCancel:n})=>{let{preferences:l}=W(),{t:u}=a(),[d,f]=(0,q.useState)(X),p=s(e=>e.models),m=s(e=>e.loadModels),h=(0,q.useMemo)(()=>p.filter(e=>!e.isPersona&&!e.isAgent&&!e.isUnavailable&&!e.isLegacySelection),[p]),[g,_]=(0,q.useState)([]),[v,y]=(0,q.useState)(!1),[x,S]=(0,q.useState)(!1),[te,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(null),[O,A]=(0,q.useState)(`basic`),[j,M]=(0,q.useState)(!1),N=(0,q.useRef)(!1),P=(0,q.useCallback)((e,t)=>{f(n=>({...n,[e]:t})),E(null)},[]),F=(0,q.useCallback)((e,t)=>{f(n=>({...n,parameters:{...n.parameters,[e]:t}})),E(null)},[]),I=(0,q.useCallback)((e,t)=>{f(n=>({...n,[e]:{...n[e],...t}})),E(null)},[]),L=(0,q.useCallback)(e=>{let t=e.reduce((e,t)=>(e.find(e=>e.id===t.id)||e.push(t),e),[]);return t.length>0?t:[{id:`nomic-embed-text`,name:`nomic-embed-text`,description:`Ollama - Default embedding model`,provider:`ollama`,dimensions:0,isDetectedEmbedding:!0}]},[]),R=e?.id,z=!!d.memory_settings?.enabled,B=r(),{data:V=null,isLoading:U}=i({queryKey:[`persona-memory-status`,R],queryFn:async()=>{if(!R)return null;let e=await H.getMemoryStatus(R);return e.success&&e.data?e.data:null},enabled:!!R&&z}),G=()=>B.invalidateQueries({queryKey:[`persona-memory-status`,R]}),re=async()=>{if(e?.id&&confirm(u(`personaForm.memory.wipeConfirm`))){M(!0);try{let t=await H.wipeMemories(e.id);t.success?(D.success(u(`personaForm.memory.wipeSuccess`,{count:t.data?.deleted_count||0})),await G()):D.error(u(`personaForm.error.saveFailed`))}catch{D.error(u(`personaForm.error.saveFailed`))}finally{M(!1)}}};(0,q.useEffect)(()=>{N.current||(N.current=!0,(async()=>{y(!0);try{let[t,n]=await Promise.all([ne.getModels(),e?Promise.resolve(null):H.getDefaultParameters(),s.getState().models.length===0?m({quiet:!0}):Promise.resolve()]),r=L(t.success&&t.data?t.data:[]);_(r);let i=r.find(e=>e.id===l.embeddingSettings?.model||e.rawModel===l.embeddingSettings?.model)?.id||r[0]?.id||``,a=r.find(t=>t.id===e?.embedding_model||t.rawModel===e?.embedding_model)?.id||e?.embedding_model||r[0]?.id||``;if(e)f({name:e.name,description:e.description||``,model:e.model,parameters:e.parameters,avatar:e.avatar||``,background:e.background||``,embedding_model:a,memory_settings:e.memory_settings||X.memory_settings,mutation_settings:e.mutation_settings||X.mutation_settings,bindings:e.bindings}),e.embedding_model&&!r.find(t=>t.id===e.embedding_model||t.rawModel===e.embedding_model)&&_(t=>L([...t,{id:e.embedding_model,name:e.embedding_model,description:`Previously selected model (not currently available)`,provider:`openai`,dimensions:0}]));else{let e=n?.success?n.data:{};f(t=>({...t,parameters:{...t.parameters,...e},embedding_model:i}))}}catch(e){_e.error(`Error loading data:`,e)}finally{y(!1)}})())},[e,L,m,l.embeddingSettings?.model]);let K=async n=>{S(!0),w(n);try{let r={name:d.name,description:d.description,model:d.model,parameters:d.parameters,avatar:d.avatar,background:d.background,embedding_model:d.embedding_model,memory_settings:d.memory_settings,mutation_settings:d.mutation_settings,bindings:d.bindings},i=e?await H.updatePersona(e.id,r):await H.createPersona(d);i.success?(D.success(u(e?`personaForm.success.updated`:`personaForm.success.created`)),E(new Date),n&&t()):D.error(`${u(`personaForm.error.saveFailed`)}: ${i.error}`)}catch(e){D.error(`${u(`personaForm.error.saveFailed`)}: ${e instanceof Error?e.message:String(e)}`)}finally{S(!1),w(!1)}},ie=(0,q.useMemo)(()=>[{id:`basic`,label:u(`personaForm.tabs.basic`),icon:C},{id:`parameters`,label:u(`personaForm.tabs.parameters`),icon:c},{id:`memory`,label:u(`personaForm.tabs.memory`),icon:k},{id:`bindings`,label:u(`personaForm.tabs.bindings`),icon:ee},{id:`advanced`,label:u(`personaForm.tabs.advanced`),icon:b}],[u]);return v?(0,J.jsx)(`div`,{className:`flex items-center justify-center p-8`,children:(0,J.jsxs)(`div`,{className:`animate-pulse flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin`}),(0,J.jsx)(`span`,{className:`text-gray-600 dark:text-gray-400`,children:u(`personaForm.loading`)})]})}):(0,J.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,J.jsxs)(`div`,{className:`mb-6`,children:[(0,J.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900 dark:text-dark-800`,children:u(e?`personaForm.title.edit`:`personaForm.title.create`)}),(0,J.jsxs)(`div`,{className:`flex items-center gap-4 mt-1`,children:[(0,J.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600`,children:u(e?`personaForm.subtitle.edit`:`personaForm.subtitle.create`)}),T&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-green-600 dark:text-green-400`,children:[(0,J.jsx)(`div`,{className:`w-2 h-2 bg-green-500 rounded-full`}),u(`personaForm.saved`),` `,T.toLocaleTimeString()]})]})]}),(0,J.jsxs)(`form`,{onSubmit:e=>e.preventDefault(),className:`space-y-6`,children:[(0,J.jsxs)(`div`,{className:`bg-white dark:bg-dark-100 rounded-lg shadow-sm border border-gray-200 dark:border-dark-300`,children:[(0,J.jsx)(`div`,{className:`flex border-b border-gray-200 dark:border-dark-300`,children:ie.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>A(e.id),className:o(`flex items-center gap-2 px-6 py-4 text-sm font-medium transition-colors`,O===e.id?`border-b-2 border-primary-500 text-primary-600 dark:text-primary-400 bg-primary-50 dark:bg-primary-900/20`:`text-gray-500 dark:text-dark-600 hover:text-gray-700 dark:hover:text-dark-800`),children:[(0,J.jsx)(e.icon,{className:`h-4 w-4`}),e.label]},e.id))}),(0,J.jsxs)(`div`,{className:`p-6`,children:[O===`basic`&&(0,J.jsx)(ue,{formData:d,availableModels:h,onFieldChange:P,onParameterChange:F}),O===`parameters`&&(0,J.jsx)(ge,{parameters:d.parameters,onParameterChange:F}),O===`memory`&&(0,J.jsx)(he,{formData:d,persona:e,memoryStatus:V,loadingMemoryStatus:U,wipingMemories:j,onSettingsChange:I,onWipeMemories:re}),O===`bindings`&&(0,J.jsx)(me,{bindings:d.bindings,onChange:e=>P(`bindings`,e)}),O===`advanced`&&(0,J.jsx)(se,{embeddingModel:d.embedding_model,embeddingModels:g,onEmbeddingModelChange:e=>P(`embedding_model`,e)})]})]}),(0,J.jsx)(de,{persona:e,submitting:x,saveAndClose:te,lastSaved:T,onCancel:n,onSave:()=>K(!1),onSaveAndClose:()=>K(!0)})]})]})},ye=I(`components:persona-import-export`),be=({personas:e,onImport:t,onClose:n})=>{let{t:r}=a(),[i,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(``),l=async e=>{try{let t=await H.exportPersona(e.id),n=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(n),a=document.createElement(`a`);a.href=i,a.download=`${e.name}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i),D.success(r(`personaImportExport.exportSuccess`,{name:e.name}))}catch(e){let t=e instanceof Error?e.message:String(e);D.error(r(`personaImportExport.exportFailed`)+`: `+t)}};return(0,J.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,J.jsxs)(`div`,{className:`mb-6`,children:[(0,J.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900 dark:text-dark-800`,children:r(`personaImportExport.title`)}),(0,J.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 mt-1`,children:r(`personaImportExport.description`)})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,J.jsxs)(`div`,{className:`bg-white dark:bg-dark-100 rounded-lg p-6 shadow-sm border border-gray-200 dark:border-dark-300`,children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800 mb-4`,children:r(`personaImportExport.exportPersonas`)}),e.length===0?(0,J.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 text-center py-8`,children:r(`personaImportExport.noPersonasToExport`)}):(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,J.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-600`,children:r(`personaImportExport.personasAvailable`,{count:e.length})}),(0,J.jsx)(G,{onClick:async()=>{try{let t=e.map(e=>H.exportPersona(e.id)),n=await Promise.all(t),i={personas:n,exportedAt:Date.now(),version:`1.0.0`,count:n.length},a=new Blob([JSON.stringify(i,null,2)],{type:`application/json`}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=`personas-export-${new Date().toISOString().split(`T`)[0]}.json`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o),D.success(r(`personaImportExport.exportAllSuccess`,{count:e.length}))}catch(e){let t=e instanceof Error?e.message:String(e);D.error(r(`personaImportExport.exportAllFailed`)+`: `+t)}},variant:`outline`,size:`sm`,className:`px-3 py-1`,children:r(`personaImportExport.exportAll`)})]}),(0,J.jsx)(`div`,{className:`space-y-2 max-h-80 overflow-y-auto`,children:e.map(e=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-gray-50 dark:bg-dark-200 rounded-md`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`img`,{src:V(e,32),alt:e.name,className:`w-8 h-8 rounded-full`,onError:t=>z(t.currentTarget,e.name,32)}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`font-medium text-gray-900 dark:text-dark-800`,children:e.name}),(0,J.jsx)(`div`,{className:`text-sm text-gray-500 dark:text-dark-500`,children:e.model})]})]}),(0,J.jsx)(G,{onClick:()=>l(e),variant:`outline`,size:`sm`,className:`px-3 py-1`,children:r(`common.export`)})]},e.id))})]})]}),(0,J.jsxs)(`div`,{className:`bg-white dark:bg-dark-100 rounded-lg p-6 shadow-sm border border-gray-200 dark:border-dark-300`,children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800 mb-4`,children:r(`personaImportExport.importPersonas`)}),(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-700 mb-2`,children:r(`personaImportExport.uploadJsonFile`)}),(0,J.jsx)(`input`,{type:`file`,accept:`.json`,onChange:e=>{let t=e.target.files?.[0];if(t){let e=new FileReader;e.onload=e=>{let t=e.target?.result;typeof t==`string`&&c(t)},e.readAsText(t)}},className:`w-full px-3 py-2 border border-gray-300 dark:border-dark-300 rounded-md bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-700`})]}),(0,J.jsx)(`div`,{className:`text-center text-gray-500 dark:text-dark-500`,children:r(`common.or`).toUpperCase()}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-700 mb-2`,children:r(`personaImportExport.pasteJsonLabel`)}),(0,J.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),className:`w-full px-3 py-2 border border-gray-300 dark:border-dark-300 rounded-md bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-700`,rows:8,placeholder:r(`personaImportExport.pasteJsonPlaceholder`)})]}),(0,J.jsx)(G,{onClick:async()=>{if(!s.trim()){D.error(r(`personaImportExport.pasteJsonData`));return}o(!0);try{let e=JSON.parse(s);if(e.personas&&Array.isArray(e.personas)){let t=0,n=0;for(let r of e.personas)try{await H.importPersona(r),t++}catch(e){n++,ye.error(`Failed to import persona:`,e)}t>0?(D.success(r(`personaImportExport.importMultipleSuccess`,{count:t})),n>0&&D.error(r(`personaImportExport.importMultipleFailed`,{count:n}))):D.error(r(`personaImportExport.importNoneFailed`))}else await H.importPersona(e),D.success(r(`personaImportExport.importSuccess`));c(``),t()}catch(e){let t=e instanceof Error?e.message:String(e);D.error(r(`personaImportExport.importFailed`)+`: `+t)}finally{o(!1)}},disabled:!s.trim()||i,className:`w-full`,children:r(i?`personaImportExport.importing`:`personaImportExport.importButton`)})]})]})]}),(0,J.jsxs)(`div`,{className:`mt-6 bg-gray-50 dark:bg-dark-200 rounded-lg p-4`,children:[(0,J.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-dark-800 mb-2`,children:r(`personaImportExport.expectedFormat`)}),(0,J.jsx)(`pre`,{className:`text-xs text-gray-600 dark:text-dark-600 overflow-x-auto`,children:`{
2
+ "name": "Assistant Name",
3
+ "description": "Brief description of the assistant's personality",
4
+ "model": "model-name:version",
5
+ "params": {
6
+ "temperature": 0.8,
7
+ "top_p": 0.9,
8
+ "context_window": 4096,
9
+ "system_prompt": "You are a helpful assistant with specific traits..."
10
+ },
11
+ "avatar": "/path/to/avatar.png",
12
+ "background": "/path/to/background.png"
13
+ }`})]}),(0,J.jsx)(`div`,{className:`mt-6 flex justify-end`,children:(0,J.jsx)(G,{onClick:n,variant:`outline`,children:r(`common.close`)})})]})},xe=()=>{let{t:e}=a(),t=r(),[n,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(!1),{data:d=[],isLoading:f,refetch:p}=i({queryKey:[`personas`],queryFn:async()=>{let e=await H.getPersonas();if(!e.success)throw Error(e.error||`Failed to load personas`);return e.data||[]}}),m=async()=>{await t.invalidateQueries({queryKey:[`personas`]}),await p()},h=()=>{c(null),o(!0)},g=e=>{c(e),o(!0)},_=async t=>{if(confirm(e(`personaManager.deleteConfirm`,{name:t.name})))try{let n=await H.deletePersona(t.id);n.success?(D.success(e(`personaManager.deleteSuccess`,{name:t.name})),await m()):D.error(e(`personaManager.failed`,{action:`delete`})+`: `+n.error)}catch(t){let n=t instanceof Error?t.message:String(t);D.error(e(`personaManager.failed`,{action:`delete`})+`: `+n)}},v=async t=>{try{await H.downloadPersona(t.id,t.name),D.success(e(`personaManager.downloadSuccess`,{name:t.name}))}catch(t){let n=t instanceof Error?t.message:String(t);D.error(e(`personaManager.failed`,{action:`download`})+`: `+n)}};return f?(0,J.jsx)(`div`,{className:`flex items-center justify-center p-8`,children:(0,J.jsx)(`div`,{className:`text-gray-600 dark:text-dark-600`,children:e(`personaManager.loading`)})}):n?(0,J.jsx)(ve,{persona:s,onSubmit:async()=>{o(!1),c(null),await m()},onCancel:()=>{o(!1),c(null)}}):l?(0,J.jsx)(be,{personas:d,onImport:m,onClose:()=>u(!1)}):(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,J.jsxs)(`div`,{className:`text-sm text-gray-500 dark:text-dark-500`,children:[(0,J.jsx)(`span`,{className:`font-medium text-gray-900 dark:text-dark-800`,children:e(`personaManager.stats.title`)}),` `,`· `,e(`personaManager.stats.count`,{count:d.length})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsx)(G,{onClick:()=>u(!0),variant:`outline`,className:`px-4`,children:e(`personaManager.importExport`)}),(0,J.jsx)(G,{onClick:h,className:`px-4`,children:e(`personaManager.createButton`)})]})]}),d.length===0?(0,J.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-gray-300 bg-white/40 p-12 text-center dark:border-white/15 dark:bg-white/[0.025]`,children:[(0,J.jsx)(`div`,{className:`text-gray-400 dark:text-dark-500 mb-4`,children:(0,J.jsx)(`svg`,{className:`w-16 h-16 mx-auto`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,J.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z`})})}),(0,J.jsx)(`h3`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800 mb-2`,children:e(`personaManager.empty.title`)}),(0,J.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 mb-6`,children:e(`personaManager.empty.description`)}),(0,J.jsx)(G,{onClick:h,className:`px-6 py-2`,children:e(`personaManager.empty.button`)})]}):(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3`,children:d.map(e=>(0,J.jsx)(oe,{persona:e,onEdit:g,onDelete:_,onDownload:v},e.id))})]})},Se=()=>{let{t:e}=a();return(0,J.jsxs)(K,{children:[(0,J.jsx)(re,{title:e(`personaManager.title`),description:e(`personaManager.subtitle`)}),(0,J.jsx)(xe,{})]})};export{Se as PersonasPage,Se as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,g as n}from"./markdown-core-BK7WVOb7.js";import{t as r}from"./useQuery-BboI5V5G.js";import{t as i}from"./useTranslation-D7uLySn1.js";import{t as a}from"./utils-sD-qFh8D.js";import{At as o,Fn as s,J as c,X as l,_ as u,bn as d,en as f,h as p,hr as m,jn as h,pr as g,s as _,tr as v}from"./ui-vendor-CRZXLK0Q.js";import{n as y}from"./workApi-8mBuh_-J.js";import{l as b}from"./api-F0CnlVH8.js";import{t as x}from"./Button-CpobxJ2P.js";import{a as S,o as C}from"./ui-DFa2W4QC.js";var w=e(t(),1),T={getAnalytics:e=>y.get(`/costs/analytics`,{params:{days:e}}).then(e=>e.data),listTariffs:()=>y.get(`/costs/tariffs`).then(e=>e.data),createTariff:e=>y.post(`/costs/tariffs`,e).then(e=>e.data),deleteTariff:e=>y.delete(`/costs/tariffs/${encodeURIComponent(e)}`).then(()=>void 0),listBudgets:()=>y.get(`/costs/budgets`).then(e=>e.data),createBudget:e=>y.post(`/costs/budgets`,e).then(e=>e.data),deleteBudget:e=>y.delete(`/costs/budgets/${encodeURIComponent(e)}`).then(()=>void 0),exportUrl:e=>`/api/costs/export?days=${e}`,exportCsv:e=>y.get(`/costs/export`,{params:{days:e},responseType:`blob`}).then(e=>e.data)},E=n(),D=e=>new Intl.NumberFormat(void 0,{style:`currency`,currency:`USD`,maximumFractionDigits:e<1?4:2}).format(e),O=`w-full rounded-lg border border-gray-300 bg-white px-2 py-1.5 text-sm dark:border-dark-300 dark:bg-dark-50`,k=({days:e})=>{let{t}=i(),[n,r]=(0,w.useState)(null),[a,s]=(0,w.useState)([]),[c,f]=(0,w.useState)([]),[p,h]=(0,w.useState)(!0),[g,_]=(0,w.useState)(0),[v,y]=(0,w.useState)({pluginId:``,model:``,inputPerMillion:``,outputPerMillion:``,unitPrice:``}),[b,S]=(0,w.useState)({name:``,principalType:`instance`,principalId:``,period:`monthly`,amountUsd:``,mode:`soft`});(0,w.useEffect)(()=>{let n=!1;return Promise.all([T.getAnalytics(e),T.listTariffs(),T.listBudgets()]).then(([e,t,i])=>{n||(e.success&&e.data&&r(e.data),t.success&&t.data&&s(t.data),i.success&&i.data&&f(i.data))}).catch(()=>m.error(t(`costs.loadFailed`))).finally(()=>{n||h(!1)}),()=>{n=!0}},[e,g,t]);let C=e=>{if(!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0},k=async()=>{try{let e=await T.createTariff({pluginId:v.pluginId.trim(),model:v.model.trim()||void 0,inputPerMillion:C(v.inputPerMillion),outputPerMillion:C(v.outputPerMillion),unitPrice:C(v.unitPrice)});if(!e.success)throw Error(e.message);m.success(t(`costs.tariffSaved`)),y({pluginId:``,model:``,inputPerMillion:``,outputPerMillion:``,unitPrice:``}),_(e=>e+1)}catch(e){m.error(e instanceof Error?e.message:t(`costs.saveFailed`))}},A=async()=>{try{let e=await T.createBudget({name:b.name.trim(),principalType:b.principalType,principalId:b.principalType===`instance`?void 0:b.principalId.trim(),period:b.period,amountUsd:Number(b.amountUsd),mode:b.mode});if(!e.success)throw Error(e.message);m.success(t(`costs.budgetSaved`)),S({name:``,principalType:`instance`,principalId:``,period:`monthly`,amountUsd:``,mode:`soft`}),_(e=>e+1)}catch(e){m.error(e instanceof Error?e.message:t(`costs.saveFailed`))}},j=async()=>{try{let t=await T.exportCsv(e),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`libre-webui-costs.csv`,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}catch{m.error(t(`costs.exportFailed`))}};return p&&!n?(0,E.jsx)(`div`,{className:`flex justify-center rounded-lg border border-gray-200 bg-white p-6 dark:border-dark-300 dark:bg-dark-100`,children:(0,E.jsx)(o,{className:`h-5 w-5 animate-spin text-gray-400`})}):(0,E.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-gray-200 bg-white p-4 dark:border-dark-300 dark:bg-dark-100`,"data-testid":`cost-governance-panel`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h3`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:t(`costs.title`)}),(0,E.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:t(`costs.description`)})]}),(0,E.jsxs)(x,{size:`sm`,variant:`outline`,onClick:()=>void j(),children:[(0,E.jsx)(d,{className:`mr-1 h-3.5 w-3.5`}),t(`costs.exportCsv`)]})]}),n&&(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,E.jsxs)(`div`,{className:`rounded-lg bg-gray-50 p-3 dark:bg-dark-50`,children:[(0,E.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`costs.totalSpend`)}),(0,E.jsx)(`p`,{className:`text-lg font-semibold`,children:D(n.totalUsd)})]}),(0,E.jsxs)(`div`,{className:`rounded-lg bg-gray-50 p-3 dark:bg-dark-50`,children:[(0,E.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`costs.meteredEvents`)}),(0,E.jsx)(`p`,{className:`text-lg font-semibold`,children:n.meteredEvents})]}),(0,E.jsxs)(`div`,{className:`rounded-lg bg-gray-50 p-3 dark:bg-dark-50`,children:[(0,E.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`costs.unmeteredEvents`)}),(0,E.jsx)(`p`,{className:`text-lg font-semibold`,children:n.unmeteredEvents})]}),(0,E.jsxs)(`div`,{className:`rounded-lg bg-gray-50 p-3 dark:bg-dark-50`,children:[(0,E.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`costs.topModel`)}),(0,E.jsx)(`p`,{className:`truncate text-sm font-medium`,children:n.byModel[0]?`${n.byModel[0].model} (${D(n.byModel[0].usd)})`:`—`})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-gray-500`,children:t(`costs.budgets`)}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[n?.budgets.map(e=>{let n=Math.min(1,e.spentUsd/e.amountUsd);return(0,E.jsxs)(`div`,{className:`rounded-lg border border-gray-200 p-2 dark:border-dark-300`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm`,children:[(0,E.jsxs)(`span`,{className:`min-w-0 truncate font-medium`,children:[e.name,(0,E.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-gray-500`,children:[t(`costs.mode.${e.mode}`),` ·`,` `,t(`costs.period.${e.period}`),` ·`,` `,e.principalType===`instance`?t(`costs.scope.instance`):`${t(`costs.scope.${e.principalType}`)}: ${e.principalId}`]})]}),(0,E.jsxs)(`span`,{className:`shrink-0 text-xs text-gray-600 dark:text-gray-300`,children:[D(e.spentUsd),` / `,D(e.amountUsd)]}),(0,E.jsx)(`button`,{onClick:()=>{T.deleteBudget(e.id).then(()=>_(e=>e+1)).catch(()=>m.error(t(`costs.saveFailed`)))},className:`shrink-0 rounded p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-950/30`,"aria-label":t(`costs.deleteBudget`),children:(0,E.jsx)(u,{className:`h-3.5 w-3.5`})})]}),(0,E.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded bg-gray-200 dark:bg-dark-300`,children:(0,E.jsx)(`div`,{className:n>=1?`h-full bg-red-500`:n>=.8?`h-full bg-amber-500`:`h-full bg-emerald-500`,style:{width:`${Math.round(n*100)}%`}})})]},e.id)}),c.length===0&&(0,E.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`costs.noBudgets`)})]}),(0,E.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 sm:grid-cols-6`,children:[(0,E.jsx)(`input`,{className:O,placeholder:t(`costs.budgetName`),value:b.name,onChange:e=>S({...b,name:e.target.value})}),(0,E.jsxs)(`select`,{className:O,value:b.principalType,onChange:e=>S({...b,principalType:e.target.value}),children:[(0,E.jsx)(`option`,{value:`instance`,children:t(`costs.scope.instance`)}),(0,E.jsx)(`option`,{value:`user`,children:t(`costs.scope.user`)}),(0,E.jsx)(`option`,{value:`group`,children:t(`costs.scope.group`)})]}),(0,E.jsx)(`input`,{className:O,placeholder:t(`costs.principalId`),value:b.principalId,disabled:b.principalType===`instance`,onChange:e=>S({...b,principalId:e.target.value})}),(0,E.jsxs)(`select`,{className:O,value:b.period,onChange:e=>S({...b,period:e.target.value}),children:[(0,E.jsx)(`option`,{value:`daily`,children:t(`costs.period.daily`)}),(0,E.jsx)(`option`,{value:`weekly`,children:t(`costs.period.weekly`)}),(0,E.jsx)(`option`,{value:`monthly`,children:t(`costs.period.monthly`)})]}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(`input`,{className:O,placeholder:`USD`,inputMode:`decimal`,value:b.amountUsd,onChange:e=>S({...b,amountUsd:e.target.value})}),(0,E.jsxs)(`select`,{className:O,value:b.mode,onChange:e=>S({...b,mode:e.target.value}),children:[(0,E.jsx)(`option`,{value:`observe`,children:t(`costs.mode.observe`)}),(0,E.jsx)(`option`,{value:`soft`,children:t(`costs.mode.soft`)}),(0,E.jsx)(`option`,{value:`hard`,children:t(`costs.mode.hard`)})]})]}),(0,E.jsxs)(x,{size:`sm`,onClick:()=>void A(),children:[(0,E.jsx)(l,{className:`mr-1 h-3.5 w-3.5`}),t(`costs.addBudget`)]})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-gray-500`,children:t(`costs.tariffs`)}),(0,E.jsx)(`div`,{className:`overflow-x-auto`,children:(0,E.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,E.jsx)(`thead`,{className:`text-gray-500`,children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{className:`py-1 pr-2`,children:t(`costs.plugin`)}),(0,E.jsx)(`th`,{className:`py-1 pr-2`,children:t(`costs.model`)}),(0,E.jsx)(`th`,{className:`py-1 pr-2`,children:t(`costs.inputPerMillion`)}),(0,E.jsx)(`th`,{className:`py-1 pr-2`,children:t(`costs.outputPerMillion`)}),(0,E.jsx)(`th`,{className:`py-1 pr-2`,children:t(`costs.unitPrice`)}),(0,E.jsx)(`th`,{className:`py-1 pr-2`,children:t(`costs.effectiveFrom`)}),(0,E.jsx)(`th`,{})]})}),(0,E.jsxs)(`tbody`,{children:[a.map(e=>(0,E.jsxs)(`tr`,{className:`border-t border-gray-100 dark:border-dark-300`,children:[(0,E.jsx)(`td`,{className:`py-1 pr-2`,children:e.plugin_id}),(0,E.jsx)(`td`,{className:`py-1 pr-2`,children:e.model??t(`costs.allModels`)}),(0,E.jsx)(`td`,{className:`py-1 pr-2`,children:e.input_per_million===null?`—`:D(e.input_per_million)}),(0,E.jsx)(`td`,{className:`py-1 pr-2`,children:e.output_per_million===null?`—`:D(e.output_per_million)}),(0,E.jsx)(`td`,{className:`py-1 pr-2`,children:e.unit_price===null?`—`:D(e.unit_price)}),(0,E.jsx)(`td`,{className:`py-1 pr-2`,children:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}).format(e.effective_from)}),(0,E.jsx)(`td`,{className:`py-1`,children:(0,E.jsx)(`button`,{onClick:()=>{T.deleteTariff(e.id).then(()=>_(e=>e+1)).catch(()=>m.error(t(`costs.saveFailed`)))},className:`rounded p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-950/30`,"aria-label":t(`costs.deleteTariff`),children:(0,E.jsx)(u,{className:`h-3.5 w-3.5`})})})]},e.id)),a.length===0&&(0,E.jsx)(`tr`,{children:(0,E.jsx)(`td`,{colSpan:7,className:`py-2 text-gray-500`,children:t(`costs.noTariffs`)})})]})]})}),(0,E.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 sm:grid-cols-6`,children:[(0,E.jsx)(`input`,{className:O,placeholder:t(`costs.plugin`),value:v.pluginId,onChange:e=>y({...v,pluginId:e.target.value})}),(0,E.jsx)(`input`,{className:O,placeholder:t(`costs.modelOptional`),value:v.model,onChange:e=>y({...v,model:e.target.value})}),(0,E.jsx)(`input`,{className:O,placeholder:t(`costs.inputPerMillion`),inputMode:`decimal`,value:v.inputPerMillion,onChange:e=>y({...v,inputPerMillion:e.target.value})}),(0,E.jsx)(`input`,{className:O,placeholder:t(`costs.outputPerMillion`),inputMode:`decimal`,value:v.outputPerMillion,onChange:e=>y({...v,outputPerMillion:e.target.value})}),(0,E.jsx)(`input`,{className:O,placeholder:t(`costs.unitPrice`),inputMode:`decimal`,value:v.unitPrice,onChange:e=>y({...v,unitPrice:e.target.value})}),(0,E.jsxs)(x,{size:`sm`,onClick:()=>void k(),children:[(0,E.jsx)(l,{className:`mr-1 h-3.5 w-3.5`}),t(`costs.addTariff`)]})]})]})]})},A=new Intl.NumberFormat(void 0,{maximumFractionDigits:0}),j=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}),M=e=>e>=1e4?j.format(e):A.format(e),N=e=>e?e<1e3?`${A.format(e)} ms`:`${(e/1e3).toFixed(+(e<1e4))} s`:`—`,P=(e,t)=>e===0?0:(e-t)/e*100,F=({analytics:e,metric:t,onMetricChange:n})=>{let{t:r}=i(),o={top:22,right:18,bottom:42,left:52},s=e.series.map(e=>e[t]),c=Math.max(1,...s),l=960-o.left-o.right,u=280-o.top-o.bottom,d=t=>o.left+(e.series.length<=1?l/2:t/(e.series.length-1)*l),f=e=>o.top+u-e/c*u,p=e.series.map((e,n)=>({x:d(n),y:f(e[t]),point:e})),m=p.map(({x:e,y:t},n)=>`${n===0?`M`:`L`} ${e} ${t}`).join(` `),h=p.length?`${m} L ${p[p.length-1].x} ${o.top+u} L ${p[0].x} ${o.top+u} Z`:``,g=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,timeZone:`UTC`}),_=Array.from(new Set([0,Math.floor((e.series.length-1)/2),e.series.length-1])).filter(e=>e>=0);return(0,E.jsxs)(`div`,{"data-testid":`plugin-usage-chart`,className:`overflow-hidden rounded-2xl border border-gray-200/80 bg-white/80 shadow-subtle backdrop-blur-md dark:border-white/[0.08] dark:bg-dark-100/75`,children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-gray-200/70 px-4 py-3 dark:border-white/[0.07] sm:flex-row sm:items-center sm:justify-between sm:px-5`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-sm font-medium text-gray-950 dark:text-dark-950`,children:r(`usageAnalytics.activity.title`)}),(0,E.jsx)(`p`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:r(t===`calls`?`usageAnalytics.activity.callsDescription`:`usageAnalytics.activity.tokensDescription`)})]}),(0,E.jsx)(`div`,{className:`inline-flex w-fit rounded-xl bg-gray-100 p-1 dark:bg-dark-200/80`,children:[`calls`,`tokens`].map(e=>(0,E.jsx)(`button`,{type:`button`,"aria-pressed":t===e,className:a(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,t===e?`bg-white text-gray-950 shadow-sm dark:bg-dark-300 dark:text-dark-950`:`text-gray-500 hover:text-gray-800 dark:text-dark-500 dark:hover:text-dark-800`),onClick:()=>n(e),children:r(`usageAnalytics.metrics.${e}`)},e))})]}),(0,E.jsx)(`div`,{className:`px-2 pb-3 pt-4 sm:px-5 sm:pt-6`,children:(0,E.jsxs)(`svg`,{viewBox:`0 0 960 280`,className:`h-auto w-full overflow-visible`,role:`img`,"aria-label":r(`usageAnalytics.activity.chartLabel`,{metric:r(`usageAnalytics.metrics.${t}`)}),children:[(0,E.jsx)(`defs`,{children:(0,E.jsxs)(`linearGradient`,{id:`plugin-usage-area`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,E.jsx)(`stop`,{offset:`0%`,stopColor:`rgb(var(--color-primary-500))`,stopOpacity:`0.28`}),(0,E.jsx)(`stop`,{offset:`100%`,stopColor:`rgb(var(--color-primary-500))`,stopOpacity:`0.015`})]})}),[0,.25,.5,.75,1].map(e=>{let t=o.top+u*e,n=Math.round(c*(1-e));return(0,E.jsxs)(`g`,{children:[(0,E.jsx)(`line`,{x1:o.left,x2:960-o.right,y1:t,y2:t,className:`stroke-gray-200 dark:stroke-white/[0.07]`,strokeDasharray:e===1?void 0:`4 8`}),(0,E.jsx)(`text`,{x:o.left-12,y:t+4,textAnchor:`end`,className:`fill-gray-400 text-[11px] dark:fill-dark-500`,children:M(n)})]},e)}),h&&(0,E.jsx)(`path`,{d:h,fill:`url(#plugin-usage-area)`}),m&&(0,E.jsx)(`path`,{d:m,fill:`none`,className:`stroke-primary-500 dark:stroke-primary-400`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`}),(e.series.length<=31?p:[]).map(({x:e,y:n,point:i})=>(0,E.jsx)(`circle`,{cx:e,cy:n,r:`4`,className:`fill-white stroke-primary-500 dark:fill-dark-100 dark:stroke-primary-400`,strokeWidth:`2.5`,children:(0,E.jsx)(`title`,{children:`${g.format(i.timestamp)}: ${M(i[t])} ${r(`usageAnalytics.metrics.${t}`).toLocaleLowerCase()}`})},i.timestamp)),_.map(t=>{let n=e.series[t];if(!n)return null;let r=t===0?`start`:t===e.series.length-1?`end`:`middle`;return(0,E.jsx)(`text`,{x:d(t),y:270,textAnchor:r,className:`fill-gray-500 text-[12px] dark:fill-dark-500`,children:g.format(n.timestamp)},n.timestamp)})]})})]})},I=864e5,L=10,R=12,z=30,B=16,V=[`fill-blue-500`,`fill-emerald-500 dark:fill-emerald-600`,`fill-amber-500 dark:fill-amber-600`,`fill-violet-500`,`fill-rose-500`],H=[`bg-blue-500`,`bg-emerald-500 dark:bg-emerald-600`,`bg-amber-500 dark:bg-amber-600`,`bg-violet-500`,`bg-rose-500`],U=`fill-gray-400 dark:fill-gray-500`,W=`bg-gray-400 dark:bg-gray-500`,G=`fill-gray-950/[0.06] dark:fill-white/[0.07]`,K=[0,.35,.55,.75,1],q=({heatmap:e})=>{let{t,i18n:n}=i(),[r,o]=(0,w.useState)(null),{weeks:s,firstColStart:c,cellsByDay:l,maxCalls:u,modelRank:d,totalCalls:f}=(0,w.useMemo)(()=>{let t=new Map(e.cells.map(e=>[e.timestamp,e])),n=e.from,r=e.from+(e.days-1)*I,i=n-new Date(n).getUTCDay()*I;return{weeks:Math.ceil((r-i+I)/(7*I)),firstColStart:i,cellsByDay:t,maxCalls:Math.max(1,...e.cells.map(e=>e.calls)),modelRank:new Map(e.models.map((e,t)=>[e,t])),totalCalls:e.cells.reduce((e,t)=>e+t.calls,0)}},[e]),p=new Intl.DateTimeFormat(n.language,{month:`short`,timeZone:`UTC`}),m=new Intl.DateTimeFormat(n.language,{weekday:`short`,timeZone:`UTC`}),h=new Intl.DateTimeFormat(n.language,{dateStyle:`medium`,timeZone:`UTC`}),g=e.from,_=e.from+(e.days-1)*I,v=z+s*R,y=[],b=-1;for(let e=0;e<s;e++){let t=c+e*7*I,n=Math.max(t,g),r=new Date(n).getUTCMonth();r!==b&&t>=g-6*I&&((b!==-1||t>=g)&&y.push({x:z+e*R,label:p.format(n)}),b=r)}let x=e=>e<=0?0:Math.min(4,Math.max(1,Math.ceil(e/u*4))),S=e=>{let t=e.models[0]?.model,n=t===void 0?void 0:d.get(t);return n===void 0?U:V[n]},C=(e,t,n)=>{let r=e.currentTarget.closest(`[data-heatmap-wrapper]`);if(!r)return;let i=r.getBoundingClientRect(),a=e.currentTarget.getBoundingClientRect(),s=a.left-i.left+a.width/2;o({x:Math.min(Math.max(s,96),Math.max(i.width-96,96)),y:a.top-i.top,timestamp:t,calls:n.calls,models:n.models})};return(0,E.jsxs)(`section`,{"data-testid":`usage-heatmap`,className:`overflow-hidden rounded-2xl border border-gray-200/80 bg-white/80 shadow-subtle backdrop-blur-md dark:border-white/[0.08] dark:bg-dark-100/75`,children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-gray-200/70 px-4 py-3 dark:border-white/[0.07] sm:flex-row sm:items-center sm:justify-between sm:px-5`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-sm font-medium text-gray-950 dark:text-dark-950`,children:t(`usageAnalytics.heatmap.title`)}),(0,E.jsx)(`p`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:t(`usageAnalytics.heatmap.description`)})]}),(0,E.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-gray-500 dark:text-dark-500`,children:t(`usageAnalytics.heatmap.yearTotal`,{count:f,formatted:M(f)})})]}),(0,E.jsxs)(`div`,{className:`relative p-4 sm:px-5`,"data-heatmap-wrapper":!0,children:[(0,E.jsx)(`div`,{className:`overflow-x-auto`,children:(0,E.jsxs)(`svg`,{viewBox:`0 0 ${v} 100`,className:`h-auto w-full min-w-[640px]`,role:`img`,"aria-label":t(`usageAnalytics.heatmap.title`),onMouseLeave:()=>o(null),children:[y.map(({x:e,label:t})=>(0,E.jsx)(`text`,{x:e,y:10,className:`fill-gray-400 text-[8px] dark:fill-dark-500`,children:t},`${e}-${t}`)),[1,3,5].map(e=>(0,E.jsx)(`text`,{x:0,y:B+e*R+L-2,className:`fill-gray-400 text-[8px] dark:fill-dark-500`,children:m.format(new Date(Date.UTC(2023,0,1+e)))},e)),Array.from({length:s},(e,t)=>Array.from({length:7},(e,n)=>{let i=c+(t*7+n)*I;if(i<g||i>_)return null;let o=l.get(i),s=o?.calls??0,u=x(s);return(0,E.jsx)(`rect`,{x:z+t*R,y:B+n*R,width:L,height:L,rx:2,fillOpacity:u===0?1:K[u],strokeWidth:+(r?.timestamp===i),className:a(`transition-opacity`,u===0||!o?G:S(o),r?.timestamp===i?`stroke-gray-500 dark:stroke-white/60`:`stroke-transparent`),onMouseEnter:e=>C(e,i,{calls:s,models:o?.models??[]}),children:(0,E.jsx)(`title`,{children:`${h.format(i)} — ${M(s)}`})},i)}))]})}),r&&(0,E.jsxs)(`div`,{className:`pointer-events-none absolute z-10 min-w-[10rem] -translate-x-1/2 -translate-y-full rounded-lg border border-gray-200/80 bg-white/95 px-3 py-2 shadow-card backdrop-blur-md dark:border-white/[0.1] dark:bg-dark-100/95`,style:{left:r.x,top:r.y-6},children:[(0,E.jsx)(`div`,{className:`text-[11px] font-medium text-gray-900 dark:text-dark-900`,children:h.format(r.timestamp)}),(0,E.jsx)(`div`,{className:`mt-0.5 text-[11px] text-gray-500 dark:text-dark-500`,children:r.calls===0?t(`usageAnalytics.heatmap.noCalls`):`${M(r.calls)} ${t(`usageAnalytics.heatmap.calls`)}`}),r.models.slice(0,3).map(e=>(0,E.jsxs)(`div`,{className:`mt-1 flex items-center justify-between gap-3 text-[11px]`,children:[(0,E.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,E.jsx)(`span`,{className:a(`h-2 w-2 shrink-0 rounded-[3px]`,d.has(e.model)?H[d.get(e.model)]:W)}),(0,E.jsx)(`span`,{className:`truncate font-mono text-gray-700 dark:text-dark-700`,dir:`ltr`,children:e.model})]}),(0,E.jsx)(`span`,{className:`tabular-nums text-gray-500 dark:text-dark-500`,children:M(e.calls)})]},e.model))]}),(0,E.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5`,children:[e.models.map((e,t)=>(0,E.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] text-gray-600 dark:text-dark-600`,children:[(0,E.jsx)(`span`,{className:a(`h-2.5 w-2.5 rounded-[3px]`,H[t])}),(0,E.jsx)(`span`,{className:`font-mono`,dir:`ltr`,children:e})]},e)),(0,E.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] text-gray-600 dark:text-dark-600`,children:[(0,E.jsx)(`span`,{className:a(`h-2.5 w-2.5 rounded-[3px]`,W)}),t(`usageAnalytics.heatmap.other`)]})]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-gray-500 dark:text-dark-500`,children:[t(`usageAnalytics.heatmap.less`),(0,E.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-[3px] bg-gray-950/[0.06] dark:bg-white/[0.07]`}),K.slice(1).map(e=>(0,E.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-[3px] bg-primary-500`,style:{opacity:e}},e)),t(`usageAnalytics.heatmap.more`)]})]})]})]})},J=()=>{let{t:e}=i(),[t,n]=(0,w.useState)(30),[l,u]=(0,w.useState)(`calls`),{data:d,error:m,isLoading:y,isFetching:T,refetch:D}=r({queryKey:[`plugin-usage`,t],queryFn:async()=>{let n=await b.getUsage(t);if(!n.success||!n.data)throw Error(n.error||e(`usageAnalytics.loadFailed`));return n.data}}),O=m?m instanceof Error?m.message:e(`usageAnalytics.loadFailed`):null,A=d?.totals,j=(0,w.useMemo)(()=>[{label:e(`usageAnalytics.cards.calls`),value:M(A?.calls??0),detail:e(`usageAnalytics.cards.callsDetail`,{count:A?.uniqueUsers??0}),icon:g},{label:e(`usageAnalytics.cards.tokens`),value:M(A?.reportedTokens??0),detail:e(`usageAnalytics.cards.tokensDetail`,{count:A?.meteredCalls??0}),icon:f},{label:e(`usageAnalytics.cards.success`),value:`${P(A?.calls??0,(A?.failedCalls??0)+(A?.cancelledCalls??0)).toFixed(1)}%`,detail:e(`usageAnalytics.cards.successDetail`,{count:A?.failedCalls??0}),icon:s},{label:e(`usageAnalytics.cards.latency`),value:N(A?.averageLatencyMs??0),detail:e(`usageAnalytics.cards.latencyDetail`),icon:h}],[e,A]);return y&&!d?(0,E.jsx)(C,{width:`wide`,children:(0,E.jsx)(`div`,{className:`flex min-h-[50vh] items-center justify-center`,children:(0,E.jsx)(o,{className:`h-7 w-7 animate-spin text-primary-500`})})}):(0,E.jsxs)(C,{width:`wide`,children:[(0,E.jsx)(S,{eyebrow:e(`usageAnalytics.eyebrow`),title:e(`usageAnalytics.title`),description:e(`usageAnalytics.description`),actions:(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`div`,{className:`inline-flex rounded-xl border border-gray-200 bg-white/70 p-1 dark:border-white/[0.08] dark:bg-dark-100/70`,children:[7,30,90].map(r=>(0,E.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-3 py-1.5 text-xs font-medium transition-colors`,t===r?`bg-gray-950 text-white dark:bg-white dark:text-gray-950`:`text-gray-500 hover:text-gray-900 dark:text-dark-500 dark:hover:text-dark-900`),onClick:()=>n(r),children:e(`usageAnalytics.days`,{count:r})},r))}),(0,E.jsxs)(x,{variant:`outline`,size:`sm`,onClick:()=>void D(),disabled:T,children:[(0,E.jsx)(c,{className:a(`h-4 w-4`,T&&`animate-spin`)}),(0,E.jsx)(`span`,{className:`sr-only`,children:e(`usageAnalytics.refresh`)})]})]})}),O&&(0,E.jsxs)(`div`,{className:`mb-6 flex items-center gap-3 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:[(0,E.jsx)(p,{className:`h-4 w-4 shrink-0`}),(0,E.jsx)(`span`,{children:O})]}),(0,E.jsx)(`div`,{className:`mb-6`,children:(0,E.jsx)(k,{days:t})}),d&&(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:j.map(e=>{let t=e.icon;return(0,E.jsxs)(`section`,{className:`rounded-2xl border border-gray-200/80 bg-white/75 p-4 shadow-subtle backdrop-blur-md dark:border-white/[0.08] dark:bg-dark-100/70`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-[0.12em] text-gray-500 dark:text-dark-500`,children:e.label}),(0,E.jsx)(t,{className:`h-4 w-4 text-primary-500 dark:text-primary-400`})]}),(0,E.jsx)(`div`,{className:`mt-2 text-2xl font-normal tracking-[-0.04em] text-gray-950 dark:text-dark-950`,children:e.value}),(0,E.jsx)(`p`,{className:`mt-1.5 text-xs text-gray-500 dark:text-dark-500`,children:e.detail})]},e.label)})}),d.heatmap&&d.heatmap.cells.length>0&&(0,E.jsx)(q,{heatmap:d.heatmap}),(0,E.jsx)(F,{analytics:d,metric:l,onMetricChange:u}),d.totals.calls===0?(0,E.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-gray-300 px-6 py-10 text-center dark:border-white/[0.12]`,children:[(0,E.jsx)(v,{className:`mx-auto h-8 w-8 text-gray-400 dark:text-dark-500`}),(0,E.jsx)(`h2`,{className:`mt-4 text-base font-medium text-gray-900 dark:text-dark-900`,children:e(`usageAnalytics.empty.title`)}),(0,E.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-gray-500 dark:text-dark-500`,children:e(`usageAnalytics.empty.description`)})]}):(0,E.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.15fr_0.85fr]`,children:[(0,E.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-gray-200/80 bg-white/80 shadow-subtle backdrop-blur-md dark:border-white/[0.08] dark:bg-dark-100/75`,children:[(0,E.jsxs)(`div`,{className:`border-b border-gray-200/70 px-4 py-3 dark:border-white/[0.07] sm:px-5`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-medium text-gray-950 dark:text-dark-950`,children:e(`usageAnalytics.models.title`)}),(0,E.jsx)(`p`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:e(`usageAnalytics.models.description`)})]}),(0,E.jsx)(`div`,{className:`overflow-x-auto`,children:(0,E.jsxs)(`table`,{className:`w-full min-w-[620px] text-start text-sm`,children:[(0,E.jsx)(`thead`,{className:`text-[11px] uppercase tracking-[0.1em] text-gray-400 dark:text-dark-500`,children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{className:`px-5 py-2 text-start font-medium`,children:e(`usageAnalytics.models.model`)}),(0,E.jsx)(`th`,{className:`px-4 py-2 text-end font-medium`,children:e(`usageAnalytics.metrics.calls`)}),(0,E.jsx)(`th`,{className:`px-4 py-2 text-end font-medium`,children:e(`usageAnalytics.metrics.tokens`)}),(0,E.jsx)(`th`,{className:`px-4 py-2 text-end font-medium`,children:e(`usageAnalytics.models.success`)}),(0,E.jsx)(`th`,{className:`px-5 py-2 text-end font-medium`,children:e(`usageAnalytics.models.latency`)})]})}),(0,E.jsx)(`tbody`,{className:`divide-y divide-gray-100 dark:divide-white/[0.06]`,children:d.models.slice(0,12).map(e=>(0,E.jsxs)(`tr`,{children:[(0,E.jsxs)(`td`,{className:`px-5 py-2.5`,children:[(0,E.jsx)(`div`,{className:`max-w-[260px] truncate font-medium text-gray-900 dark:text-dark-900`,title:e.model,children:e.model}),(0,E.jsx)(`div`,{className:`mt-0.5 text-xs text-gray-500 dark:text-dark-500`,children:e.pluginName})]}),(0,E.jsx)(`td`,{className:`px-4 py-2.5 text-end tabular-nums text-gray-700 dark:text-dark-700`,children:M(e.calls)}),(0,E.jsx)(`td`,{className:`px-4 py-2.5 text-end tabular-nums text-gray-700 dark:text-dark-700`,children:e.tokens?M(e.tokens):`—`}),(0,E.jsxs)(`td`,{className:`px-4 py-2.5 text-end tabular-nums text-gray-700 dark:text-dark-700`,children:[P(e.calls,e.errors).toFixed(1),`%`]}),(0,E.jsx)(`td`,{className:`px-5 py-2.5 text-end tabular-nums text-gray-500 dark:text-dark-500`,children:N(e.averageLatencyMs)})]},`${e.pluginId}:${e.model}`))})]})})]}),(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`section`,{className:`rounded-2xl border border-gray-200/80 bg-white/80 p-4 shadow-subtle backdrop-blur-md dark:border-white/[0.08] dark:bg-dark-100/75 sm:p-5`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-medium text-gray-950 dark:text-dark-950`,children:e(`usageAnalytics.providers.title`)}),(0,E.jsx)(`div`,{className:`mt-5 space-y-4`,children:d.plugins.slice(0,8).map(t=>{let n=d.totals.calls?t.calls/d.totals.calls*100:0;return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-sm`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`div`,{className:`truncate font-medium text-gray-900 dark:text-dark-900`,children:t.pluginName}),(0,E.jsxs)(`div`,{className:`mt-0.5 text-xs text-gray-500 dark:text-dark-500`,children:[M(t.tokens),` `,e(`usageAnalytics.metrics.tokens`).toLocaleLowerCase()]})]}),(0,E.jsx)(`span`,{className:`shrink-0 tabular-nums text-gray-600 dark:text-dark-600`,children:M(t.calls)})]}),(0,E.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-gray-100 dark:bg-dark-300`,children:(0,E.jsx)(`div`,{className:`h-full rounded-full bg-primary-500 dark:bg-primary-400`,style:{width:`${Math.max(2,n)}%`}})})]},t.pluginId)})})]}),(0,E.jsxs)(`section`,{className:`rounded-2xl border border-gray-200/80 bg-white/80 p-4 shadow-subtle backdrop-blur-md dark:border-white/[0.08] dark:bg-dark-100/75 sm:p-5`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(_,{className:`h-4 w-4 text-primary-500 dark:text-primary-400`}),(0,E.jsx)(`h2`,{className:`text-sm font-medium text-gray-950 dark:text-dark-950`,children:e(`usageAnalytics.capabilities.title`)})]}),(0,E.jsx)(`div`,{className:`mt-5 grid grid-cols-2 gap-3`,children:d.capabilities.map(t=>(0,E.jsxs)(`div`,{className:`rounded-xl bg-gray-50 px-3 py-2.5 dark:bg-dark-200/70`,children:[(0,E.jsx)(`div`,{className:`text-xs font-medium capitalize text-gray-500 dark:text-dark-500`,children:t.capability}),(0,E.jsx)(`div`,{className:`mt-1 text-xl text-gray-950 dark:text-dark-950`,children:M(t.calls)}),(0,E.jsx)(`div`,{className:`mt-1 text-[11px] text-gray-500 dark:text-dark-500`,children:t.capability===`tts`?e(`usageAnalytics.capabilities.characters`,{count:M(t.inputUnits)}):t.capability===`stt`?e(`usageAnalytics.capabilities.bytes`,{count:M(t.inputUnits)}):t.capability===`image`?e(`usageAnalytics.capabilities.images`,{count:M(t.outputUnits)}):t.capability===`video`?e(`usageAnalytics.capabilities.jobs`,{count:M(t.calls)}):t.capability===`embedding`?e(`usageAnalytics.capabilities.inputs`,{count:M(t.inputUnits)}):e(`usageAnalytics.capabilities.reportedTokens`,{count:M(t.tokens)})})]},t.capability))})]})]})]}),(0,E.jsx)(`p`,{className:`px-1 text-xs leading-5 text-gray-500 dark:text-dark-500`,children:e(`usageAnalytics.privacyNote`)})]})]})};export{J as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./RichMessageContent-CYEhT6uU.js";export{e as RichMessageContent,e as default};
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/OptimizedSyntaxHighlighter-DrejdNUm.js","js/OptimizedSyntaxHighlighter-hNqZPLiB.js","js/rolldown-runtime-hePW80VL.js","js/markdown-core-BK7WVOb7.js","js/syntax-highlight-P2zo9o06.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,g as n,l as r,n as i,o as a,r as o,t as s}from"./markdown-core-BK7WVOb7.js";import{a as c}from"./router-vendor-CbexJIsv.js";import{t as l}from"./utils-sD-qFh8D.js";import{t as u}from"./appStore-SLLBamo2.js";import{a as d,i as f,n as p,r as m,s as h,t as g}from"./messageCodeStyles-COJFoq4P.js";import{n as _,t as v}from"./markdown-math-e1ByS3KY.js";var y=e(t(),1),b=`clipPath.clipRule.d.dominantBaseline.fill.fillOpacity.fillRule.fontFamily.fontSize.fontStyle.fontWeight.letterSpacing.markerEnd.markerMid.markerStart.mask.opacity.paintOrder.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.textAnchor.transform.vectorEffect`.split(`.`),x=Object.fromEntries(Object.entries({svg:[`viewBox`,`xmlns`,`preserveAspectRatio`,`role`,`ariaLabel`],g:[],defs:[],symbol:[`viewBox`,`preserveAspectRatio`],use:[`href`,`x`,`y`],title:[],desc:[],path:[`pathLength`],circle:[`cx`,`cy`,`r`],ellipse:[`cx`,`cy`,`rx`,`ry`],rect:[`x`,`y`,`rx`,`ry`],line:[`x1`,`y1`,`x2`,`y2`],polyline:[`points`],polygon:[`points`],text:[`x`,`y`,`dx`,`dy`,`rotate`,`textLength`],tspan:[`x`,`y`,`dx`,`dy`,`rotate`],linearGradient:[`x1`,`y1`,`x2`,`y2`,`gradientUnits`,`gradientTransform`,`spreadMethod`,`href`],radialGradient:[`cx`,`cy`,`r`,`fx`,`fy`,`gradientUnits`,`gradientTransform`,`spreadMethod`,`href`],stop:[`offset`,`stopColor`,`stopOpacity`],clipPath:[`clipPathUnits`],mask:[`maskUnits`,`maskContentUnits`,`x`,`y`],pattern:[`patternUnits`,`patternContentUnits`,`patternTransform`,`viewBox`,`x`,`y`],marker:[`markerWidth`,`markerHeight`,`markerUnits`,`refX`,`refY`,`orient`,`viewBox`]}).map(([e,t])=>[e,[...b,...t]])),S={...i,clobberPrefix:``,tagNames:[...i.tagNames??[],...Object.keys(x)],attributes:{...i.attributes,...x,code:[[`className`,/^language-./,`math-inline`,`math-display`]]},protocols:{...i.protocols,href:[...i.protocols?.href??[]]}},C=n(),w=y.lazy(()=>c(()=>import(`./OptimizedSyntaxHighlighter-DrejdNUm.js`),__vite__mapDeps([0,1,2,3,4])));function T({children:e,className:t}){return(0,C.jsx)(`pre`,{dir:`ltr`,className:l(m,`rounded-lg`,t),children:(0,C.jsx)(`code`,{children:e})})}var E=({content:e,className:t,allowHtml:n=!1})=>{let i=u(e=>e.theme.mode!==`light`),c=y.useMemo(()=>h(e),[e]),m=y.useMemo(()=>n?[o,[s,S],v]:[v],[n]);return(0,C.jsx)(`div`,{dir:`auto`,className:l(`prose prose-sm max-w-none dark:prose-invert prose-gray`,`[&_.katex-display]:overflow-x-auto [&_.katex-display]:overflow-y-hidden [&_.katex-display]:py-2`,`[&_.katex]:text-inherit`,t),children:(0,C.jsx)(r,{remarkPlugins:[a,_],rehypePlugins:m,components:{code({className:e,children:t,node:n,...r}){let a=/language-([^\s]+)/.exec(e||``),o=String(t),s=o.replace(/\n$/,``),c=a?a[1]:null;return c||o.includes(`
3
+ `)?(0,C.jsx)(d,{code:s,language:c,state:`complete`,children:(0,C.jsx)(`div`,{className:`overflow-x-auto`,children:(0,C.jsx)(y.Suspense,{fallback:(0,C.jsx)(T,{className:`!m-0 !rounded-none !border-none`,children:s}),children:(0,C.jsx)(w,{language:c||`text`,isDark:i,codeTheme:`night`,backgroundColor:i?g:p,borderRadius:0,customStyle:f,className:`!m-0 !rounded-none !border-none`,showLineNumbers:!0,children:s})})})}):(0,C.jsx)(`code`,{dir:`ltr`,className:l(`px-1.5 py-0.5 rounded-md bg-gray-100 dark:bg-dark-200 text-gray-800 dark:text-dark-800`,`font-mono text-[0.85em] border border-gray-200 dark:border-dark-300`,e),...r,children:t})},pre({children:e}){return(0,C.jsx)(C.Fragment,{children:e})},p({children:e,...t}){return(0,C.jsx)(`div`,{dir:`auto`,className:`mb-2.5 last:mb-0 leading-relaxed`,...t,children:e})},ul({children:e,...t}){return(0,C.jsx)(`ul`,{dir:`auto`,className:`list-disc list-inside mb-2.5 space-y-1 ps-4`,...t,children:e})},ol({children:e,...t}){return(0,C.jsx)(`ol`,{dir:`auto`,className:`list-decimal list-inside mb-2.5 space-y-1 ps-4`,...t,children:e})},li({children:e,...t}){return(0,C.jsx)(`li`,{dir:`auto`,className:`text-gray-700 dark:text-dark-700 leading-relaxed`,...t,children:e})},blockquote({children:e,...t}){return(0,C.jsx)(`blockquote`,{dir:`auto`,className:`border-s-2 border-primary-400 dark:border-primary-500 bg-primary-25 dark:bg-primary-950/30 ps-3 py-2 my-3 rounded-e-lg italic text-gray-700 dark:text-dark-700`,...t,children:e})},h1({children:e,...t}){return(0,C.jsx)(`h1`,{dir:`auto`,className:`text-xl font-bold mb-3 mt-5 first:mt-0 text-gray-900 dark:text-dark-800 border-b border-gray-200 dark:border-dark-300 pb-1.5`,...t,children:e})},h2({children:e,...t}){return(0,C.jsx)(`h2`,{dir:`auto`,className:`text-lg font-semibold mb-2 mt-5 first:mt-0 text-gray-900 dark:text-dark-800`,...t,children:e})},h3({children:e,...t}){return(0,C.jsx)(`h3`,{dir:`auto`,className:`text-base font-medium mb-2 mt-4 first:mt-0 text-gray-900 dark:text-dark-800`,...t,children:e})},table({children:e,node:t,...n}){return(0,C.jsx)(`div`,{className:l(`my-4 w-full overflow-x-auto rounded-xl border border-line bg-surface shadow-subtle`,`focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40`),tabIndex:0,children:(0,C.jsx)(`table`,{dir:`auto`,className:`w-full min-w-[42rem] border-separate border-spacing-0 text-start text-sm`,...n,children:e})})},thead({children:e,node:t,...n}){return(0,C.jsx)(`thead`,{className:`bg-surface-subtle`,...n,children:e})},tbody({children:e,node:t,...n}){return(0,C.jsx)(`tbody`,{...n,children:e})},tr({children:e,node:t,...n}){return(0,C.jsx)(`tr`,{className:`transition-colors hover:bg-black/[0.025] last:[&>td]:border-b-0 dark:hover:bg-white/[0.025]`,...n,children:e})},th({align:e,children:t,node:n,...r}){return(0,C.jsx)(`th`,{className:l(`border-b border-e border-line-strong px-3 py-2.5 align-bottom font-semibold text-ink last:border-e-0`,e===`center`?`text-center`:e===`right`?`text-right`:e===`left`?`text-left`:`text-start`),...r,children:t})},td({align:e,children:t,node:n,...r}){return(0,C.jsx)(`td`,{className:l(`min-w-40 border-b border-e border-line px-3 py-2.5 align-top leading-relaxed text-ink last:border-e-0`,e===`center`?`text-center`:e===`right`?`text-right`:e===`left`?`text-left`:`text-start`),...r,children:t})}},children:c})})};export{E as t};