@lunora/studio 1.0.0-alpha.136 → 1.0.0-alpha.138

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 (361) hide show
  1. package/dist/index.d.mts +1515 -0
  2. package/dist/index.d.ts +20 -7
  3. package/dist/index.mjs +1 -0
  4. package/dist/mount.d.mts +21 -0
  5. package/dist/mount.mjs +1 -0
  6. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
  7. package/dist/packem_chunks/ApiTab.mjs +1 -0
  8. package/dist/packem_chunks/AuditPanel.mjs +1 -0
  9. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
  10. package/dist/packem_chunks/{ExportImportPanel.js → ExportImportPanel.mjs} +1 -1
  11. package/dist/packem_chunks/{FileBrowser.js → FileBrowser.mjs} +1 -1
  12. package/dist/packem_chunks/FunctionRunner.mjs +1 -0
  13. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
  14. package/dist/packem_chunks/HealthPanel.mjs +1 -0
  15. package/dist/packem_chunks/InsightsPanel.mjs +1 -0
  16. package/dist/packem_chunks/LogsPanel.mjs +1 -0
  17. package/dist/packem_chunks/MailPanel.mjs +2 -0
  18. package/dist/packem_chunks/MetricsPanel.mjs +1 -0
  19. package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
  20. package/dist/packem_chunks/PitrPanel.mjs +1 -0
  21. package/dist/packem_chunks/SchemaViewer.mjs +1 -0
  22. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
  23. package/dist/packem_chunks/SettingsPanel.mjs +1 -0
  24. package/dist/packem_chunks/{SqlEditorPanel.js → SqlEditorPanel.mjs} +1 -1
  25. package/dist/packem_chunks/TableEditor.mjs +1 -0
  26. package/dist/packem_chunks/agents-panel.mjs +1 -0
  27. package/dist/packem_chunks/analytics-panel.mjs +1 -0
  28. package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
  29. package/dist/packem_chunks/auth-config-panel.mjs +1 -0
  30. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
  31. package/dist/packem_chunks/containers-panel.mjs +1 -0
  32. package/dist/packem_chunks/dashboards-panel.mjs +1 -0
  33. package/dist/packem_chunks/evals-panel.mjs +1 -0
  34. package/dist/packem_chunks/fanout-panel.mjs +1 -0
  35. package/dist/packem_chunks/flags-panel.mjs +1 -0
  36. package/dist/packem_chunks/issues-panel.mjs +1 -0
  37. package/dist/packem_chunks/kv-browser.mjs +1 -0
  38. package/dist/packem_chunks/{log-drains-panel.js → log-drains-panel.mjs} +1 -1
  39. package/dist/packem_chunks/migrations-route.mjs +1 -0
  40. package/dist/packem_chunks/organizations-panel.mjs +1 -0
  41. package/dist/packem_chunks/payments-panel.mjs +1 -0
  42. package/dist/packem_chunks/permissions-panel.mjs +1 -0
  43. package/dist/packem_chunks/queues-panel.mjs +1 -0
  44. package/dist/packem_chunks/reactors-panel.mjs +1 -0
  45. package/dist/packem_chunks/rls-panel.mjs +1 -0
  46. package/dist/packem_chunks/schedule-panel.mjs +1 -0
  47. package/dist/packem_chunks/sparkline.mjs +1 -0
  48. package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
  49. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  50. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  51. package/dist/packem_chunks/traces-panel.mjs +1 -0
  52. package/dist/packem_chunks/users-panel.mjs +1 -0
  53. package/dist/packem_chunks/vector-browser.mjs +1 -0
  54. package/dist/packem_chunks/workflows-panel.mjs +1 -0
  55. package/dist/packem_shared/{ApiDocsPanel-Du1L7Ysj.js → ApiDocsPanel-BOxViKDM.mjs} +1 -1
  56. package/dist/packem_shared/ApiReferencePanel--YThTzHb.mjs +1 -0
  57. package/dist/packem_shared/CommandPalette-C4UrhLxv.mjs +1 -0
  58. package/dist/packem_shared/ConfirmButton-DU4p72Er.mjs +1 -0
  59. package/dist/packem_shared/ConnectionBadge-B_8fcft2.mjs +1 -0
  60. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  61. package/dist/packem_shared/{DataBrowser-W5TxvLB8.js → DataBrowser-CDzwqq4b.mjs} +1 -1
  62. package/dist/packem_shared/GlobalDataBrowser-BKm77TNC.mjs +1 -0
  63. package/dist/packem_shared/HomePanel-T_fBZTEM.mjs +1 -0
  64. package/dist/packem_shared/MigrationsPanel-CYe0ygT8.mjs +1 -0
  65. package/dist/packem_shared/OpenRpcReferencePanel-Bn5UVD7s.mjs +1 -0
  66. package/dist/packem_shared/ScheduledJobs-DN0yQoo6.mjs +1 -0
  67. package/dist/packem_shared/ShardInput-C6mjgAh4.mjs +1 -0
  68. package/dist/packem_shared/Studio-CHCAslfi.mjs +1 -0
  69. package/dist/packem_shared/StudioApp-DVl_E-VZ.mjs +1 -0
  70. package/dist/packem_shared/StudioI18nProvider-fVsCSs5L.mjs +1 -0
  71. package/dist/packem_shared/advisor-view-5mZH6453.mjs +1 -0
  72. package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
  73. package/dist/packem_shared/app.d-D1bPR8FO.d.mts +252 -0
  74. package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
  75. package/dist/packem_shared/{bar-chart-B6gzp_f9.js → bar-chart-BCsEIQoQ.mjs} +1 -1
  76. package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
  77. package/dist/packem_shared/card--2hKx4L2.mjs +1 -0
  78. package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
  79. package/dist/packem_shared/data-grid-BqNXJ9PF.mjs +1 -0
  80. package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
  81. package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
  82. package/dist/packem_shared/error-alert-CczbAfst.mjs +1 -0
  83. package/dist/packem_shared/{grid-features-jBzZGauv.js → grid-features-D8w5isjt.mjs} +1 -1
  84. package/dist/packem_shared/home-panel-CSENDmoB.mjs +3 -0
  85. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  86. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  87. package/dist/packem_shared/live-status-BuJdUZFU.mjs +1 -0
  88. package/dist/packem_shared/log-line-Dzg4YZ-K.mjs +1 -0
  89. package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
  90. package/dist/packem_shared/recording-client-BEZ6tVgo.mjs +1 -0
  91. package/dist/packem_shared/{reference-view-BU2dNK9Z.js → reference-view-CZxBZSRo.mjs} +1 -1
  92. package/dist/packem_shared/schema-diagram-DU83ObYH.mjs +2 -0
  93. package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
  94. package/dist/packem_shared/select-Cx8-CokP.mjs +2 -0
  95. package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
  96. package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
  97. package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
  98. package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
  99. package/dist/packem_shared/sql-result-table-DysT8h5P.mjs +1 -0
  100. package/dist/packem_shared/stat-card-D0Fe04cX.mjs +1 -0
  101. package/dist/packem_shared/studio-DRHuKwbt.mjs +2 -0
  102. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  103. package/dist/packem_shared/table-list-sidebar-BxZm3sBJ.mjs +1 -0
  104. package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
  105. package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
  106. package/dist/packem_shared/use-admin-query-Cbj2GuHu.mjs +1 -0
  107. package/dist/packem_shared/use-async-submit-DAKymxcP.mjs +1 -0
  108. package/dist/packem_shared/use-auth-config-gxJL0E1r.mjs +1 -0
  109. package/dist/packem_shared/use-open-trace-B5LJ96_0.mjs +1 -0
  110. package/dist/packem_shared/use-sql-assistant-CFRzdA9E.mjs +1 -0
  111. package/dist/standalone/{chunk-7PIHTTND.js → chunk-25NFR6EB.js} +1 -1
  112. package/dist/standalone/{chunk-R7S3ICRW.js → chunk-2AFIMJPZ.js} +1 -1
  113. package/dist/standalone/{chunk-ENLQ6CZE.js → chunk-2DO5EQCU.js} +1 -1
  114. package/dist/standalone/{chunk-XZBLPJZN.js → chunk-2QSOSRNW.js} +1 -1
  115. package/dist/standalone/{chunk-F7JOSNAT.js → chunk-35DM4JJG.js} +1 -1
  116. package/dist/standalone/{chunk-EHQU74ST.js → chunk-3FFEVZUV.js} +1 -1
  117. package/dist/standalone/{chunk-OE4KGVJW.js → chunk-3ILVYCWG.js} +1 -1
  118. package/dist/standalone/{chunk-TRS5ABTX.js → chunk-3PKWDMXA.js} +1 -1
  119. package/dist/standalone/{chunk-2KR32476.js → chunk-3ZKYTFKY.js} +1 -1
  120. package/dist/standalone/{chunk-XLU6W4LI.js → chunk-43Y54D7O.js} +1 -1
  121. package/dist/standalone/{chunk-AOAJGSYZ.js → chunk-46ZJ3TM4.js} +1 -1
  122. package/dist/standalone/{chunk-2SFSTQS4.js → chunk-4GTO7FL5.js} +1 -1
  123. package/dist/standalone/{chunk-TFMQSCGC.js → chunk-4L4WTGN5.js} +1 -1
  124. package/dist/standalone/{chunk-HOQ2PFO6.js → chunk-56AFJWER.js} +1 -1
  125. package/dist/standalone/chunk-5AUOM7FK.js +1 -0
  126. package/dist/standalone/{chunk-XQS7KSHL.js → chunk-5GFSKIB2.js} +1 -1
  127. package/dist/standalone/{chunk-JV7KTJPY.js → chunk-5JDWLCSH.js} +1 -1
  128. package/dist/standalone/{chunk-WSNONR2E.js → chunk-5PCGB55O.js} +1 -1
  129. package/dist/standalone/{chunk-MCLM2QJI.js → chunk-5WJXVZMZ.js} +1 -1
  130. package/dist/standalone/{chunk-WUW4ZHRL.js → chunk-66UGPQVC.js} +1 -1
  131. package/dist/standalone/{chunk-QHQTOESO.js → chunk-7EYQVAUQ.js} +1 -1
  132. package/dist/standalone/{chunk-AVBOVXQK.js → chunk-7QMV55PO.js} +1 -1
  133. package/dist/standalone/{chunk-JURAVSE7.js → chunk-7QRRR3K6.js} +1 -1
  134. package/dist/standalone/{chunk-EDHW2EEG.js → chunk-7RIRJD2P.js} +1 -1
  135. package/dist/standalone/{chunk-ITNXWR5K.js → chunk-B5FXTB7H.js} +1 -1
  136. package/dist/standalone/{chunk-NNJW6LZK.js → chunk-BFXBBUU6.js} +1 -1
  137. package/dist/standalone/{chunk-DBMUPDVJ.js → chunk-BX3F7MXP.js} +1 -1
  138. package/dist/standalone/{chunk-ZSOLGJFC.js → chunk-C3TOZ4LG.js} +1 -1
  139. package/dist/standalone/{chunk-54TELYX4.js → chunk-C5L4BSYY.js} +1 -1
  140. package/dist/standalone/{chunk-U5D3ABAW.js → chunk-CKZQXAZE.js} +1 -1
  141. package/dist/standalone/{chunk-7SROZWKL.js → chunk-CSUROWL2.js} +1 -1
  142. package/dist/standalone/{chunk-DUDQV6XJ.js → chunk-D27D4UUI.js} +1 -1
  143. package/dist/standalone/chunk-DEJLINCJ.js +1 -0
  144. package/dist/standalone/{chunk-KZ5V7F4W.js → chunk-DQHYNFE4.js} +1 -1
  145. package/dist/standalone/{chunk-METRMDIQ.js → chunk-EA2JKR5D.js} +1 -1
  146. package/dist/standalone/{chunk-BWEXJENB.js → chunk-EBWXFG4H.js} +1 -1
  147. package/dist/standalone/{chunk-4U5PYZLE.js → chunk-ECQTVV2J.js} +1 -1
  148. package/dist/standalone/{chunk-JUWOEHDD.js → chunk-EG6XHY7N.js} +1 -1
  149. package/dist/standalone/{chunk-MOVUB3HI.js → chunk-EIKBBMM4.js} +1 -1
  150. package/dist/standalone/{chunk-5BEXGGHV.js → chunk-EILTQDXX.js} +1 -1
  151. package/dist/standalone/{chunk-XYD65F6K.js → chunk-ERWZGAOA.js} +1 -1
  152. package/dist/standalone/{chunk-ZPGNTTQ3.js → chunk-F7UC63UN.js} +1 -1
  153. package/dist/standalone/{chunk-UANVABQG.js → chunk-FKVZRPV5.js} +1 -1
  154. package/dist/standalone/{chunk-DKSLOJDQ.js → chunk-FO26ZU7E.js} +1 -1
  155. package/dist/standalone/{chunk-RCZTUWG3.js → chunk-FSRSK4LY.js} +1 -1
  156. package/dist/standalone/{chunk-IS2BTYON.js → chunk-GD3ZRVZH.js} +1 -1
  157. package/dist/standalone/{chunk-L4EZAHCD.js → chunk-HEAQVSNS.js} +1 -1
  158. package/dist/standalone/{chunk-GD4GUF75.js → chunk-HODZXHVK.js} +1 -1
  159. package/dist/standalone/chunk-HPUOZHDA.js +1 -0
  160. package/dist/standalone/{chunk-AFKLFS74.js → chunk-I52I2DJG.js} +1 -1
  161. package/dist/standalone/{chunk-OG57FC7W.js → chunk-I5OKDKON.js} +1 -1
  162. package/dist/standalone/{chunk-TB5N24CM.js → chunk-IFLTA2OD.js} +1 -1
  163. package/dist/standalone/{chunk-NXXGISFB.js → chunk-IMOHEGMV.js} +1 -1
  164. package/dist/standalone/{chunk-5U6757U7.js → chunk-JAZCU2PP.js} +1 -1
  165. package/dist/standalone/{chunk-CG5OTGTR.js → chunk-JBIN7W2B.js} +1 -1
  166. package/dist/standalone/{chunk-BA6TK2PS.js → chunk-JHEUUNXM.js} +1 -1
  167. package/dist/standalone/chunk-JJA7KHJK.js +1 -0
  168. package/dist/standalone/{chunk-4YTSKL4R.js → chunk-JVUZEYKQ.js} +1 -1
  169. package/dist/standalone/{chunk-INFALEU6.js → chunk-JYMXJUJ2.js} +1 -1
  170. package/dist/standalone/chunk-K7AJEMKE.js +1 -0
  171. package/dist/standalone/{chunk-ZZBE7O77.js → chunk-KDWJAKFX.js} +1 -1
  172. package/dist/standalone/{chunk-EQFBG7TB.js → chunk-KEZZGUYY.js} +1 -1
  173. package/dist/standalone/{chunk-6DAH3SMG.js → chunk-KTTYWH6A.js} +1 -1
  174. package/dist/standalone/{chunk-LVZKEWNM.js → chunk-LC3XGRNU.js} +1 -1
  175. package/dist/standalone/{chunk-LJFIXPDF.js → chunk-LJC5BM3X.js} +1 -1
  176. package/dist/standalone/{chunk-6XME7G3Q.js → chunk-LWYAZ2H7.js} +1 -1
  177. package/dist/standalone/{chunk-B3QSXX4O.js → chunk-M6MCQSPI.js} +1 -1
  178. package/dist/standalone/{chunk-AFH3KSFW.js → chunk-MIVYBFY3.js} +1 -1
  179. package/dist/standalone/{chunk-BQK2C2Z4.js → chunk-MNAASONZ.js} +1 -1
  180. package/dist/standalone/{chunk-BGOEMFLU.js → chunk-MRJNT4OH.js} +1 -1
  181. package/dist/standalone/{chunk-OQOBY6X3.js → chunk-N6KHKQJH.js} +1 -1
  182. package/dist/standalone/{chunk-V6QPVFDL.js → chunk-NBC6NJFJ.js} +1 -1
  183. package/dist/standalone/{chunk-SPDZUX4P.js → chunk-NCCAMFB6.js} +1 -1
  184. package/dist/standalone/{chunk-NGQTRDBQ.js → chunk-NE7AR3N3.js} +1 -1
  185. package/dist/standalone/chunk-NPERN4YF.js +1 -0
  186. package/dist/standalone/{chunk-YNZQSHFG.js → chunk-O2FV34ZD.js} +1 -1
  187. package/dist/standalone/{chunk-KVSQKUWD.js → chunk-OGUKYRFM.js} +1 -1
  188. package/dist/standalone/{chunk-ZHPDAJBM.js → chunk-OKG3HWSJ.js} +1 -1
  189. package/dist/standalone/{chunk-FUVCG23X.js → chunk-OOESPRIZ.js} +1 -1
  190. package/dist/standalone/{chunk-443UDYWL.js → chunk-OOKV3V3X.js} +1 -1
  191. package/dist/standalone/{chunk-ATES7QMQ.js → chunk-PAUQAU23.js} +1 -1
  192. package/dist/standalone/{chunk-Q7ZPWO67.js → chunk-PKCC4J5W.js} +1 -1
  193. package/dist/standalone/{chunk-DPNEFSEC.js → chunk-PYT4RZJH.js} +1 -1
  194. package/dist/standalone/{chunk-W7ETXRN4.js → chunk-Q3HF6P2M.js} +1 -1
  195. package/dist/standalone/{chunk-TPAZM36C.js → chunk-Q4CAKBWN.js} +1 -1
  196. package/dist/standalone/{chunk-M3NNNOD5.js → chunk-QKEJLVC5.js} +1 -1
  197. package/dist/standalone/{chunk-U6RNLNVU.js → chunk-QSOJFV42.js} +1 -1
  198. package/dist/standalone/{chunk-K6O3UDLX.js → chunk-RK3WWWTT.js} +1 -1
  199. package/dist/standalone/{chunk-XJSWM47N.js → chunk-RLLKECZT.js} +1 -1
  200. package/dist/standalone/{chunk-CAOUXOL7.js → chunk-RPQL45FL.js} +1 -1
  201. package/dist/standalone/{chunk-CKTKI4IY.js → chunk-S3CRZLGS.js} +1 -1
  202. package/dist/standalone/{chunk-L6DNHL3L.js → chunk-S63ID2FC.js} +1 -1
  203. package/dist/standalone/{chunk-VZCS5GXZ.js → chunk-SB35BJ7A.js} +1 -1
  204. package/dist/standalone/{chunk-26VREVWU.js → chunk-SSNHCN4D.js} +1 -1
  205. package/dist/standalone/{chunk-3KLX63D7.js → chunk-T2IE5GKA.js} +1 -1
  206. package/dist/standalone/{chunk-74ASA4WU.js → chunk-TGHH7ZFA.js} +1 -1
  207. package/dist/standalone/{chunk-FJ6G6FNE.js → chunk-TJRQUJFS.js} +1 -1
  208. package/dist/standalone/{chunk-EYGF6TQS.js → chunk-TQCXJX4I.js} +1 -1
  209. package/dist/standalone/{chunk-EYENA7HZ.js → chunk-TRL7AHZK.js} +1 -1
  210. package/dist/standalone/{chunk-CP4ZFBVW.js → chunk-TWTNWOJU.js} +1 -1
  211. package/dist/standalone/{chunk-UUO257GV.js → chunk-TZI3JW3Q.js} +1 -1
  212. package/dist/standalone/{chunk-M3PFFLSD.js → chunk-UBVWMMQG.js} +1 -1
  213. package/dist/standalone/{chunk-CYX3OHJ3.js → chunk-UDCVU3Z5.js} +1 -1
  214. package/dist/standalone/{chunk-BNNRPK47.js → chunk-UKL4FSKP.js} +1 -1
  215. package/dist/standalone/{chunk-PZ4QDWTI.js → chunk-ULIQFBZU.js} +1 -1
  216. package/dist/standalone/{chunk-XVJIEJ5R.js → chunk-USC5APTS.js} +1 -1
  217. package/dist/standalone/{chunk-QO645HJU.js → chunk-UWDFH35E.js} +1 -1
  218. package/dist/standalone/{chunk-YN4VXWMW.js → chunk-VPPKG2IW.js} +1 -1
  219. package/dist/standalone/{chunk-NIX2QSSN.js → chunk-VVOVVU53.js} +1 -1
  220. package/dist/standalone/{chunk-BSACLUQK.js → chunk-WLGZOFKE.js} +2 -2
  221. package/dist/standalone/{chunk-CN2AINNY.js → chunk-WQYWA7U6.js} +1 -1
  222. package/dist/standalone/{chunk-ZJK2XCP3.js → chunk-WR675JUF.js} +1 -1
  223. package/dist/standalone/{chunk-IYWVSMAY.js → chunk-WUWBZPUK.js} +1 -1
  224. package/dist/standalone/{chunk-K76OQSTQ.js → chunk-X43AA6RX.js} +1 -1
  225. package/dist/standalone/{chunk-EGSG64TS.js → chunk-XSLMHPP2.js} +1 -1
  226. package/dist/standalone/{chunk-5JLIP2HH.js → chunk-XZMOZFE6.js} +1 -1
  227. package/dist/standalone/{chunk-6ZPTNC34.js → chunk-Y4Q25F6X.js} +1 -1
  228. package/dist/standalone/{chunk-INQICZYC.js → chunk-Y6CXU7T4.js} +1 -1
  229. package/dist/standalone/{chunk-VR3UJA7B.js → chunk-YEBHHIAY.js} +1 -1
  230. package/dist/standalone/{chunk-MSXT3KG5.js → chunk-YFLOZILV.js} +1 -1
  231. package/dist/standalone/{chunk-MIGH67EO.js → chunk-YFPU55K4.js} +1 -1
  232. package/dist/standalone/{chunk-2I2F6IEF.js → chunk-ZE2Q22OK.js} +1 -1
  233. package/dist/standalone/studio.js +1 -1
  234. package/package.json +11 -9
  235. package/dist/index.js +0 -1
  236. package/dist/mount.js +0 -1
  237. package/dist/packem_chunks/AdvisorHealthPanel.js +0 -1
  238. package/dist/packem_chunks/ApiTab.js +0 -1
  239. package/dist/packem_chunks/AuditPanel.js +0 -1
  240. package/dist/packem_chunks/DeploymentHealthPanel.js +0 -1
  241. package/dist/packem_chunks/FunctionRunner.js +0 -1
  242. package/dist/packem_chunks/FunctionStatsPanel.js +0 -1
  243. package/dist/packem_chunks/HealthPanel.js +0 -1
  244. package/dist/packem_chunks/InsightsPanel.js +0 -1
  245. package/dist/packem_chunks/LogsPanel.js +0 -1
  246. package/dist/packem_chunks/MailPanel.js +0 -2
  247. package/dist/packem_chunks/MetricsPanel.js +0 -1
  248. package/dist/packem_chunks/NotificationsPanel.js +0 -1
  249. package/dist/packem_chunks/PitrPanel.js +0 -1
  250. package/dist/packem_chunks/SchemaViewer.js +0 -1
  251. package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -1
  252. package/dist/packem_chunks/SettingsPanel.js +0 -1
  253. package/dist/packem_chunks/TableEditor.js +0 -1
  254. package/dist/packem_chunks/agents-panel.js +0 -1
  255. package/dist/packem_chunks/analytics-panel.js +0 -1
  256. package/dist/packem_chunks/auth-audit-panel.js +0 -1
  257. package/dist/packem_chunks/auth-config-panel.js +0 -1
  258. package/dist/packem_chunks/auth-sessions-panel.js +0 -1
  259. package/dist/packem_chunks/containers-panel.js +0 -1
  260. package/dist/packem_chunks/dashboards-panel.js +0 -1
  261. package/dist/packem_chunks/evals-panel.js +0 -1
  262. package/dist/packem_chunks/fanout-panel.js +0 -1
  263. package/dist/packem_chunks/flags-panel.js +0 -1
  264. package/dist/packem_chunks/issues-panel.js +0 -1
  265. package/dist/packem_chunks/kv-browser.js +0 -1
  266. package/dist/packem_chunks/migrations-route.js +0 -1
  267. package/dist/packem_chunks/organizations-panel.js +0 -1
  268. package/dist/packem_chunks/payments-panel.js +0 -1
  269. package/dist/packem_chunks/permissions-panel.js +0 -1
  270. package/dist/packem_chunks/queues-panel.js +0 -1
  271. package/dist/packem_chunks/reactors-panel.js +0 -1
  272. package/dist/packem_chunks/rls-panel.js +0 -1
  273. package/dist/packem_chunks/schedule-panel.js +0 -1
  274. package/dist/packem_chunks/sparkline.js +0 -1
  275. package/dist/packem_chunks/storage-rules-panel.js +0 -1
  276. package/dist/packem_chunks/subscriptions-panel.js +0 -1
  277. package/dist/packem_chunks/sync-client-panel.js +0 -1
  278. package/dist/packem_chunks/traces-panel.js +0 -1
  279. package/dist/packem_chunks/users-panel.js +0 -1
  280. package/dist/packem_chunks/vector-browser.js +0 -1
  281. package/dist/packem_chunks/workflows-panel.js +0 -1
  282. package/dist/packem_shared/ApiReferencePanel-uGgGOBYj.js +0 -1
  283. package/dist/packem_shared/CommandPalette-HqiXrWIm.js +0 -1
  284. package/dist/packem_shared/ConfirmButton-Cj2SOapE.js +0 -1
  285. package/dist/packem_shared/ConnectionBadge-Bh16X9-u.js +0 -1
  286. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js +0 -1
  287. package/dist/packem_shared/GlobalDataBrowser-LFznuyGe.js +0 -1
  288. package/dist/packem_shared/HomePanel-DmB0EKjl.js +0 -1
  289. package/dist/packem_shared/MigrationsPanel-BDNt136v.js +0 -1
  290. package/dist/packem_shared/OpenRpcReferencePanel-DgrpASYD.js +0 -1
  291. package/dist/packem_shared/ScheduledJobs-CiO3eXgI.js +0 -1
  292. package/dist/packem_shared/ShardInput-CdawpUiS.js +0 -1
  293. package/dist/packem_shared/Studio-CkNE_tEy.js +0 -1
  294. package/dist/packem_shared/StudioApp-BZP_0E2n.js +0 -1
  295. package/dist/packem_shared/StudioI18nProvider-Bl547evf.js +0 -1
  296. package/dist/packem_shared/advisor-view-C1KFTXSH.js +0 -1
  297. package/dist/packem_shared/alert-C2SEhYS9.js +0 -1
  298. package/dist/packem_shared/badge-cAk9Di1Q.js +0 -1
  299. package/dist/packem_shared/button-BOPLD1un.js +0 -1
  300. package/dist/packem_shared/card-BGlQzQY-.js +0 -1
  301. package/dist/packem_shared/checkbox-C5w53W-E.js +0 -1
  302. package/dist/packem_shared/data-grid-BFTQnkXq.js +0 -1
  303. package/dist/packem_shared/dropdown-menu-U7Tjg1Nb.js +0 -2
  304. package/dist/packem_shared/empty-state-B939z6K2.js +0 -1
  305. package/dist/packem_shared/error-alert-TYdKetJd.js +0 -1
  306. package/dist/packem_shared/home-panel-DHOa3sxt.js +0 -3
  307. package/dist/packem_shared/input-CY5W3wzv.js +0 -1
  308. package/dist/packem_shared/label-BOUo-DP0.js +0 -1
  309. package/dist/packem_shared/live-status-Bf7rR8o8.js +0 -1
  310. package/dist/packem_shared/log-line-UnE93Ovi.js +0 -1
  311. package/dist/packem_shared/modal-shell-wGW4CKEW.js +0 -1
  312. package/dist/packem_shared/recording-client-CKn4-vUx.js +0 -1
  313. package/dist/packem_shared/schema-diagram-DOaIh1y6.js +0 -2
  314. package/dist/packem_shared/scroll-area-DSJftwu_.js +0 -2
  315. package/dist/packem_shared/select-BPISLTcv.js +0 -2
  316. package/dist/packem_shared/shard-history-DU5b3QDI.js +0 -1
  317. package/dist/packem_shared/shortcuts-lH4Vaqjc.js +0 -1
  318. package/dist/packem_shared/skeleton-DFBBaJU6.js +0 -1
  319. package/dist/packem_shared/sparkline-CYbJzfA1.js +0 -1
  320. package/dist/packem_shared/sql-result-table-CqlZo2QN.js +0 -1
  321. package/dist/packem_shared/stat-card-B9uIvAHg.js +0 -1
  322. package/dist/packem_shared/studio-CXai1O2K.js +0 -2
  323. package/dist/packem_shared/table-BMsuYFhk.js +0 -2
  324. package/dist/packem_shared/table-list-sidebar-BWq_-gtu.js +0 -1
  325. package/dist/packem_shared/textarea-DpO3i-Qo.js +0 -1
  326. package/dist/packem_shared/trace-handoff-z9sy89Ci.js +0 -1
  327. package/dist/packem_shared/use-admin-query-P0RJrjsD.js +0 -1
  328. package/dist/packem_shared/use-async-submit-DdLd0MdK.js +0 -1
  329. package/dist/packem_shared/use-auth-config-z3KRWAqD.js +0 -1
  330. package/dist/packem_shared/use-open-trace-4mqqFWrn.js +0 -1
  331. package/dist/packem_shared/use-sql-assistant-D1K2LqpO.js +0 -1
  332. package/dist/standalone/chunk-35O3VETX.js +0 -1
  333. package/dist/standalone/chunk-57VX76PR.js +0 -1
  334. package/dist/standalone/chunk-76YLMHR3.js +0 -1
  335. package/dist/standalone/chunk-N5OS5NUG.js +0 -1
  336. package/dist/standalone/chunk-O5MAFDY2.js +0 -1
  337. package/dist/standalone/chunk-TNKECJW4.js +0 -1
  338. /package/dist/packem_shared/{ADMIN_FUNCTIONS-B6z7VLYt.js → ADMIN_FUNCTIONS-B6z7VLYt.mjs} +0 -0
  339. /package/dist/packem_shared/{DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js → DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs} +0 -0
  340. /package/dist/packem_shared/{DEFAULT_LOCALE-A1Yg5ORA.js → DEFAULT_LOCALE-A1Yg5ORA.mjs} +0 -0
  341. /package/dist/packem_shared/{DataFilters-3nbW0uax.js → DataFilters-3nbW0uax.mjs} +0 -0
  342. /package/dist/packem_shared/{ErrorBoundary-BWNF98VF.js → ErrorBoundary-BWNF98VF.mjs} +0 -0
  343. /package/dist/packem_shared/{STUDIO_ROOT_CLASS-C6MccdVk.js → STUDIO_ROOT_CLASS-C6MccdVk.mjs} +0 -0
  344. /package/dist/packem_shared/{aggregateMetrics-A-Y7OH6R.js → aggregateMetrics-A-Y7OH6R.mjs} +0 -0
  345. /package/dist/packem_shared/{browser-storage-BH1MxLZs.js → browser-storage-BH1MxLZs.mjs} +0 -0
  346. /package/dist/packem_shared/{cf-links-CBJ5SywP.js → cf-links-CBJ5SywP.mjs} +0 -0
  347. /package/dist/packem_shared/{control-button-BOZ5K-FC.js → control-button-BOZ5K-FC.mjs} +0 -0
  348. /package/dist/packem_shared/{data-view-params-qoSTqjAj.js → data-view-params-qoSTqjAj.mjs} +0 -0
  349. /package/dist/packem_shared/{internal-CwaF9YNk.js → internal-CwaF9YNk.mjs} +0 -0
  350. /package/dist/packem_shared/{log-fields-SBxKyBug.js → log-fields-SBxKyBug.mjs} +0 -0
  351. /package/dist/packem_shared/{operation-console-provider-DoloEvon.js → operation-console-provider-DoloEvon.mjs} +0 -0
  352. /package/dist/packem_shared/{quote-identifier-CGiYFBvY.js → quote-identifier-CGiYFBvY.mjs} +0 -0
  353. /package/dist/packem_shared/{storage-tier-C2mKwYRj.js → storage-tier-C2mKwYRj.mjs} +0 -0
  354. /package/dist/packem_shared/{use-shard-key-BsP3o5wT.js → use-shard-key-BsP3o5wT.mjs} +0 -0
  355. /package/dist/packem_shared/{useDebounced-DVeQ5-oW.js → useDebounced-DVeQ5-oW.mjs} +0 -0
  356. /package/dist/packem_shared/{utils-bhneXptQ.js → utils-bhneXptQ.mjs} +0 -0
  357. /package/dist/packem_shared/{virtual-rect-D_j7aLxX.js → virtual-rect-D_j7aLxX.mjs} +0 -0
  358. /package/dist/packem_shared/{wire-codec-Dl3VeNrd.js → wire-codec-Dl3VeNrd.mjs} +0 -0
  359. /package/dist/standalone/{chunk-DZGOHOOE.js → chunk-CXNZVJ3S.js} +0 -0
  360. /package/dist/standalone/{chunk-W2JBKQNU.js → chunk-UYEZR3BI.js} +0 -0
  361. /package/dist/standalone/{chunk-R5ZTCHCE.js → chunk-YKXDMIHQ.js} +0 -0
@@ -1 +0,0 @@
1
- import{useLunora as pt}from"@lunora/react";import{useState as pe,useRef as Ge,useEffect as tt,useMemo as xt}from"react";import{L as bt}from"../packem_shared/live-status-Bf7rR8o8.js";import{ShardInput as yt}from"../packem_shared/ShardInput-CdawpUiS.js";import{B as rt}from"../packem_shared/button-BOPLD1un.js";import{u as Ue}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{u as vt}from"../packem_shared/use-open-trace-4mqqFWrn.js";import{u as Nt}from"../packem_shared/use-shard-key-BsP3o5wT.js";import{useT as xe}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as Oe}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{c as St}from"../packem_shared/cf-links-CBJ5SywP.js";import{m as wt,l as Xe,f as qt,d as Tt,b as _t,c as Ct}from"../packem_shared/internal-CwaF9YNk.js";import{r as Rt,l as kt}from"../packem_shared/shard-history-DU5b3QDI.js";import{c as Fe}from"react/compiler-runtime";import{f as $t}from"../packem_shared/log-fields-SBxKyBug.js";import{B as et}from"../packem_shared/badge-cAk9Di1Q.js";import{C as he,a as ge,c as Be,d as Mt,b as je}from"../packem_shared/card-BGlQzQY-.js";import{b as Je,e as oe,T as dt,c as de,a as mt,d as ut}from"../packem_shared/table-BMsuYFhk.js";import{S as ft}from"../packem_shared/sparkline-CYbJzfA1.js";import{jsxs as o,jsx as t,Fragment as Ye}from"react/jsx-runtime";import{aggregateMetrics as It,computeLatencyPercentiles as Dt,enrichQueryStats as Et,shardsToAggregate as Ft}from"../packem_shared/aggregateMetrics-A-Y7OH6R.js";import{S as me}from"../packem_shared/stat-card-B9uIvAHg.js";import{ResponsiveContainer as st,AreaChart as At,CartesianGrid as lt,XAxis as at,YAxis as it,Tooltip as nt,Area as Ot,LineChart as Lt,Line as zt}from"recharts";import{E as Kt}from"../packem_shared/empty-state-B939z6K2.js";import{c as Pt}from"../packem_shared/utils-bhneXptQ.js";import{S as Bt,a as jt,c as Qe,b as Qt,d as Ht}from"../packem_shared/select-BPISLTcv.js";const Ut=/["\\\u0000-\u001F\uD800-\uDFFF]/,ot=l=>Ut.test(l)?JSON.stringify(l):`"${l}"`,Ze=l=>{if(l===void 0)return"null";if(typeof l=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key — pass it as a string, or use stableWireKey");if(typeof l=="number"){if(Number.isNaN(l))return"nan";if(l===1/0)return"inf";if(l===-1/0)return"-inf";if(Object.is(l,-0))return"-0"}if(typeof l=="string")return ot(l);if(l===null||typeof l!="object")return JSON.stringify(l);if(Array.isArray(l)){let n="[";for(let a=0;a<l.length;a++)a>0&&(n+=","),n+=Ze(l[a]);return n+"]"}const e=Object.getPrototypeOf(l);if(e!==null&&e!==Object.prototype){const n=l.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${n} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}const i=l,s=Object.keys(i).sort();let r="{",u=!0;for(const n of s){const a=i[n];a!==void 0&&(u?u=!1:r+=",",r+=ot(n),r+=":",r+=Ze(a))}return r+"}"},ht=(l,e,i)=>`${l}:${e}:${Ze(i??{})}`,gt=(l,e)=>l==="gauge"?e.last:l==="histogram"?e.sum/Math.max(1,e.count):e.sum,Jt=(l,e)=>gt(l,e),Vt=l=>gt(l.kind,l),We=l=>Number.isInteger(l)?l.toLocaleString():l.toLocaleString(void 0,{maximumFractionDigits:2}),Gt=l=>Array.isArray(l?.series)?l.series:[],Wt="FUNCTION_NOT_FOUND",Xt=l=>{const e=new Map;if(!Array.isArray(l?.series))return e;for(const i of l.series)e.set(ht(i.kind,i.name,i.attributes),i.points);return e},Yt={counter:"secondary",gauge:"default",histogram:"outline"},Zt=l=>{const e=Fe(18),{name:i,onOpenTrace:s,traceId:r}=l,u=xe();if(r===void 0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=t("span",{className:"text-muted-foreground",children:"—"}),e[0]=d):d=e[0],d}let n;e[1]!==r?(n=r.slice(0,8),e[1]=r,e[2]=n):n=e[2];const a=n;if(s===void 0){const d=`mt-instrument-trace-${i}`;let h;return e[3]!==a||e[4]!==d||e[5]!==r?(h=t("span",{className:"text-muted-foreground","data-testid":d,title:r,children:a}),e[3]=a,e[4]=d,e[5]=r,e[6]=h):h=e[6],h}const S=`mt-instrument-trace-${i}`;let y;e[7]!==s||e[8]!==r?(y=()=>{s(r)},e[7]=s,e[8]=r,e[9]=y):y=e[9];let w;e[10]!==u||e[11]!==r?(w=u("Open the exemplar trace {trace}",{trace:r}),e[10]=u,e[11]=r,e[12]=w):w=e[12];let f;return e[13]!==a||e[14]!==S||e[15]!==y||e[16]!==w?(f=t("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":S,onClick:y,title:w,type:"button",children:a}),e[13]=a,e[14]=S,e[15]=y,e[16]=w,e[17]=f):f=e[17],f},er=l=>{const e=Fe(105),{onOpenTrace:i,shardKey:s}=l,r=xe();let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={},e[0]=u):u=e[0];let n;e[1]!==s?(n={live:!0,shardKey:s},e[1]=s,e[2]=n):n=e[2];const{data:a,error:S,errorSource:y}=Ue(Oe.getMetricSeries,u,n);let w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w={},e[3]=w):w=e[3];let f;e[4]!==s?(f={live:!0,shardKey:s},e[4]=s,e[5]=f):f=e[5];const{data:d}=Ue(Oe.getMetricHistory,w,f);let h,v,q,C,c,p,g,x,T,R,N,$,k;if(e[6]!==a||e[7]!==S||e[8]!==y||e[9]!==d||e[10]!==i||e[11]!==r){x=Symbol.for("react.early_return_sentinel");e:{const A=Gt(a),L=wt(y)===Wt;if(S!==null&&!L){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let K;e[27]!==m?(K=t("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=K):K=e[28];let B;e[29]!==S||e[30]!==r?(B=r("Instruments unavailable: {error}",{error:S}),e[29]=S,e[30]=r,e[31]=B):B=e[31];let j;e[32]!==B?(j=t("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:B}),e[32]=B,e[33]=j):j=e[33];let Q;e[34]!==K||e[35]!==j?(Q=o("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[K,j]}),e[34]=K,e[35]=j,e[36]=Q):Q=e[36],x=Q;break e}if(A.length===0){x=null;break e}const F=Xt(d);let z;e[37]!==r?(z=m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),e[37]=r,e[38]=z):z=e[38];const P=z;c="flex flex-col gap-2",p="mt-instruments";let O;e[39]!==r?(O=r("Instruments"),e[39]=r,e[40]=O):O=e[40],e[41]!==O?(g=t("h3",{className:"text-sm font-semibold text-foreground",children:O}),e[41]=O,e[42]=g):g=e[42],C=he,k="overflow-hidden py-0",q=ge,$="px-0",v=dt,R="mt-instruments-table";let U;e[43]!==r?(U=r("name"),e[43]=r,e[44]=U):U=e[44];let J;e[45]!==U?(J=t(de,{children:U}),e[45]=U,e[46]=J):J=e[46];let V;e[47]!==r?(V=r("kind"),e[47]=r,e[48]=V):V=e[48];let G;e[49]!==V?(G=t(de,{children:V}),e[49]=V,e[50]=G):G=e[50];let W;e[51]!==r?(W=r("value"),e[51]=r,e[52]=W):W=e[52];let X;e[53]!==W?(X=t(de,{className:"text-right",children:W}),e[53]=W,e[54]=X):X=e[54];let Y;e[55]!==r?(Y=r("count"),e[55]=r,e[56]=Y):Y=e[56];let Z;e[57]!==Y?(Z=t(de,{className:"text-right",children:Y}),e[57]=Y,e[58]=Z):Z=e[58];let ee;e[59]!==r?(ee=r("range"),e[59]=r,e[60]=ee):ee=e[60];let te;e[61]!==ee?(te=t(de,{className:"text-right",children:ee}),e[61]=ee,e[62]=te):te=e[62];let re;e[63]!==r?(re=r("trend"),e[63]=r,e[64]=re):re=e[64];let se;e[65]!==re?(se=t(de,{children:re}),e[65]=re,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ae;e[69]!==le?(ae=t(de,{children:le}),e[69]=le,e[70]=ae):ae=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let ne;e[73]!==ie?(ne=t(de,{children:ie}),e[73]=ie,e[74]=ne):ne=e[74],e[75]!==J||e[76]!==G||e[77]!==X||e[78]!==Z||e[79]!==te||e[80]!==se||e[81]!==ae||e[82]!==ne?(N=t(mt,{children:o(Je,{children:[J,G,X,Z,te,se,ae,ne]})}),e[75]=J,e[76]=G,e[77]=X,e[78]=Z,e[79]=te,e[80]=se,e[81]=ae,e[82]=ne,e[83]=N):N=e[83],h=ut,T=A.map(m=>{const K=$t(m.attributes),B=ht(m.kind,m.name,m.attributes),Q=(F.get(B)??[]).map(ue=>Jt(m.kind,ue));return o(Je,{"data-testid":`mt-instrument-${m.name}`,children:[t(oe,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),t(oe,{children:t(et,{variant:Yt[m.kind],children:P(m.kind)})}),t(oe,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:We(Vt(m))}),t(oe,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),t(oe,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"—":`${We(m.min)}–${We(m.max)}`}),t(oe,{children:Q.length>=2?t(ft,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:Q,testId:`mt-instrument-trend-${m.name}`}):t("span",{className:"text-xs text-muted-foreground",children:"—"})}),t(oe,{className:"font-mono text-xs",children:t(Zt,{name:m.name,onOpenTrace:i,traceId:m.exemplarTraceId})}),t(oe,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:K,children:K===""?"—":K})]},B)})}e[6]=a,e[7]=S,e[8]=y,e[9]=d,e[10]=i,e[11]=r,e[12]=h,e[13]=v,e[14]=q,e[15]=C,e[16]=c,e[17]=p,e[18]=g,e[19]=x,e[20]=T,e[21]=R,e[22]=N,e[23]=$,e[24]=k}else h=e[12],v=e[13],q=e[14],C=e[15],c=e[16],p=e[17],g=e[18],x=e[19],T=e[20],R=e[21],N=e[22],$=e[23],k=e[24];if(x!==Symbol.for("react.early_return_sentinel"))return x;let M;e[84]!==h||e[85]!==T?(M=t(h,{children:T}),e[84]=h,e[85]=T,e[86]=M):M=e[86];let _;e[87]!==v||e[88]!==M||e[89]!==R||e[90]!==N?(_=o(v,{"data-testid":R,children:[N,M]}),e[87]=v,e[88]=M,e[89]=R,e[90]=N,e[91]=_):_=e[91];let b;e[92]!==q||e[93]!==_||e[94]!==$?(b=t(q,{className:$,children:_}),e[92]=q,e[93]=_,e[94]=$,e[95]=b):b=e[95];let I;e[96]!==C||e[97]!==b||e[98]!==k?(I=t(C,{className:k,children:b}),e[96]=C,e[97]=b,e[98]=k,e[99]=I):I=e[99];let E;return e[100]!==c||e[101]!==p||e[102]!==g||e[103]!==I?(E=o("section",{className:c,"data-testid":p,children:[g,I]}),e[100]=c,e[101]=p,e[102]=g,e[103]=I,e[104]=E):E=e[104],E},tr=l=>{const e=Fe(74),{aggregate:i,shardResults:s}=l,r=xe();let u;e[0]!==r?(u=r("Shards"),e[0]=r,e[1]=u):u=e[1];let n;e[2]!==i.failed||e[3]!==i.reachable||e[4]!==r?(n=i.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:i.failed,reachable:i.reachable}):r("{reachable} reachable",{reachable:i.reachable}),e[2]=i.failed,e[3]=i.reachable,e[4]=r,e[5]=n):n=e[5];let a;e[6]!==u||e[7]!==n?(a=t(me,{label:u,testId:"mt-agg-shards",value:n}),e[6]=u,e[7]=n,e[8]=a):a=e[8];let S;e[9]!==r?(S=r("Total requests"),e[9]=r,e[10]=S):S=e[10];let y;e[11]!==i.totalRequests||e[12]!==S?(y=t(me,{label:S,testId:"mt-agg-requests",value:i.totalRequests}),e[11]=i.totalRequests,e[12]=S,e[13]=y):y=e[13];let w;e[14]!==r?(w=r("Total errors"),e[14]=r,e[15]=w):w=e[15];let f;e[16]!==i.totalErrors||e[17]!==w?(f=t(me,{label:w,testId:"mt-agg-errors",value:i.totalErrors}),e[16]=i.totalErrors,e[17]=w,e[18]=f):f=e[18];let d;e[19]!==r?(d=r("Total database size"),e[19]=r,e[20]=d):d=e[20];let h;e[21]!==i.totalDatabaseSize?(h=Xe(i.totalDatabaseSize),e[21]=i.totalDatabaseSize,e[22]=h):h=e[22];let v;e[23]!==d||e[24]!==h?(v=t(me,{label:d,testId:"mt-agg-db-size",value:h}),e[23]=d,e[24]=h,e[25]=v):v=e[25];let q;e[26]!==r?(q=r("Combined cache hit rate"),e[26]=r,e[27]=q):q=e[27];let C;e[28]!==i.hitRate||e[29]!==r?(C=i.hitRate===null?r("no cache configured"):`${(i.hitRate*100).toFixed(1)}%`,e[28]=i.hitRate,e[29]=r,e[30]=C):C=e[30];let c;e[31]!==q||e[32]!==C?(c=t(me,{label:q,testId:"mt-agg-cache",value:C}),e[31]=q,e[32]=C,e[33]=c):c=e[33];let p;e[34]!==v||e[35]!==c||e[36]!==a||e[37]!==y||e[38]!==f?(p=o("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[a,y,f,v,c]}),e[34]=v,e[35]=c,e[36]=a,e[37]=y,e[38]=f,e[39]=p):p=e[39];let g;e[40]!==r?(g=r("shard"),e[40]=r,e[41]=g):g=e[41];let x;e[42]!==g?(x=t(de,{children:g}),e[42]=g,e[43]=x):x=e[43];let T;e[44]!==r?(T=r("requests"),e[44]=r,e[45]=T):T=e[45];let R;e[46]!==T?(R=t(de,{children:T}),e[46]=T,e[47]=R):R=e[47];let N;e[48]!==r?(N=r("errors"),e[48]=r,e[49]=N):N=e[49];let $;e[50]!==N?($=t(de,{children:N}),e[50]=N,e[51]=$):$=e[51];let k;e[52]!==r?(k=r("db size"),e[52]=r,e[53]=k):k=e[53];let M;e[54]!==k?(M=t(de,{children:k}),e[54]=k,e[55]=M):M=e[55];let _;e[56]!==x||e[57]!==R||e[58]!==$||e[59]!==M?(_=t(mt,{children:o(Je,{children:[x,R,$,M]})}),e[56]=x,e[57]=R,e[58]=$,e[59]=M,e[60]=_):_=e[60];let b;if(e[61]!==s||e[62]!==r){let L;e[64]!==r?(L=F=>o(Je,{"data-testid":`mt-agg-row-${F.shard}`,children:[t(oe,{children:F.shard}),F.metrics===null?t(oe,{className:"text-destructive",colSpan:3,children:F.error??r("unreachable")}):o(Ye,{children:[t(oe,{className:"tabular-nums",children:F.metrics.requests}),t(oe,{className:"tabular-nums",children:F.metrics.errors}),t(oe,{className:"tabular-nums",children:Xe(F.metrics.databaseSize)})]})]},F.shard),e[64]=r,e[65]=L):L=e[65],b=s.map(L),e[61]=s,e[62]=r,e[63]=b}else b=e[63];let I;e[66]!==b?(I=t(ut,{children:b}),e[66]=b,e[67]=I):I=e[67];let E;e[68]!==_||e[69]!==I?(E=t(he,{className:"overflow-hidden py-0",children:t(ge,{className:"px-0",children:o(dt,{"data-testid":"mt-agg-table",children:[_,I]})})}),e[68]=_,e[69]=I,e[70]=E):E=e[70];let A;return e[71]!==p||e[72]!==E?(A=o("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[p,E]}),e[71]=p,e[72]=E,e[73]=A):A=e[73],A},rr=l=>{const e=Math.floor(l/1e3),i=Math.floor(e/3600),s=Math.floor(e%3600/60),r=e%60;return i>0?`${i.toString()}h ${s.toString()}m`:s>0?`${s.toString()}m ${r.toString()}s`:`${r.toString()}s`},sr=(l,e)=>{const i=l+e;return i===0?"—":`${(l/i*100).toFixed(1)}%`},ct=l=>l<=0?"—":l<1?`${(l*1e3).toFixed(0)}μs`:l<1e3?`${l.toFixed(1)}ms`:`${(l/1e3).toFixed(2)}s`,lr=l=>{const e=Fe(75),{currentDelta:i,errorRate:s,history:r,latencyPercentiles:u,metrics:n}=l,a=xe();let S;e[0]!==r||e[1]!==a?(S=r.length>=2?t(ft,{ariaLabel:a("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:r,testId:"mt-sparkline"}):void 0,e[0]=r,e[1]=a,e[2]=S):S=e[2];let y;e[3]!==i||e[4]!==r.length||e[5]!==a?(y=r.length>=2?o(Ye,{children:[t("span",{className:"font-semibold text-foreground",children:`+${i.toLocaleString()}`})," ",a("last interval")]}):t("span",{"data-testid":"mt-sparkline-empty",children:a("collecting samples…")}),e[3]=i,e[4]=r.length,e[5]=a,e[6]=y):y=e[6];let w;e[7]!==a?(w=a("Requests"),e[7]=a,e[8]=w):w=e[8];let f;e[9]!==n.requests||e[10]!==S||e[11]!==y||e[12]!==w?(f=t(me,{chart:S,footer:y,label:w,testId:"mt-requests",value:n.requests}),e[9]=n.requests,e[10]=S,e[11]=y,e[12]=w,e[13]=f):f=e[13];let d;e[14]!==s||e[15]!==a?(d=a("{rate} error rate",{rate:s}),e[14]=s,e[15]=a,e[16]=d):d=e[16];let h;e[17]!==a?(h=a("Errors"),e[17]=a,e[18]=h):h=e[18];let v;e[19]!==s||e[20]!==n.errors?(v=o(Ye,{children:[n.errors," (",s,")"]}),e[19]=s,e[20]=n.errors,e[21]=v):v=e[21];let q;e[22]!==d||e[23]!==h||e[24]!==v?(q=t(me,{footer:d,label:h,testId:"mt-errors",value:v}),e[22]=d,e[23]=h,e[24]=v,e[25]=q):q=e[25];let C;e[26]!==u.p90?(C=u.p90>0?`P90 ${ct(u.p90)}`:void 0,e[26]=u.p90,e[27]=C):C=e[27];let c;e[28]!==a?(c=a("P95 latency"),e[28]=a,e[29]=c):c=e[29];let p;e[30]!==u.p95?(p=u.p95>0?ct(u.p95):"—",e[30]=u.p95,e[31]=p):p=e[31];let g;e[32]!==c||e[33]!==p||e[34]!==C?(g=t(me,{footer:C,label:c,testId:"mt-p95",value:p}),e[32]=c,e[33]=p,e[34]=C,e[35]=g):g=e[35];let x;e[36]!==n.cache||e[37]!==a?(x=n.cache===null?void 0:`${n.cache.entries.toLocaleString()} ${a("cache entries")}`,e[36]=n.cache,e[37]=a,e[38]=x):x=e[38];let T;e[39]!==a?(T=a("Database size"),e[39]=a,e[40]=T):T=e[40];let R;e[41]!==n.databaseSize?(R=Xe(n.databaseSize),e[41]=n.databaseSize,e[42]=R):R=e[42];let N;e[43]!==x||e[44]!==T||e[45]!==R?(N=t(me,{footer:x,label:T,testId:"mt-db-size",value:R}),e[43]=x,e[44]=T,e[45]=R,e[46]=N):N=e[46];let $;e[47]!==a?($=a("Shard"),e[47]=a,e[48]=$):$=e[48];let k;e[49]!==n.shard||e[50]!==$?(k=t(me,{label:$,testId:"mt-shard",value:n.shard}),e[49]=n.shard,e[50]=$,e[51]=k):k=e[51];let M;e[52]!==a?(M=a("Uptime"),e[52]=a,e[53]=M):M=e[53];let _;e[54]!==n.uptimeMs?(_=rr(n.uptimeMs),e[54]=n.uptimeMs,e[55]=_):_=e[55];let b;e[56]!==M||e[57]!==_?(b=t(me,{label:M,testId:"mt-uptime",value:_}),e[56]=M,e[57]=_,e[58]=b):b=e[58];let I;e[59]!==a?(I=a("Cache hit rate"),e[59]=a,e[60]=I):I=e[60];let E;e[61]!==n.cache||e[62]!==a?(E=n.cache===null?a("no cache configured"):a("{rate} ({count} entries)",{count:n.cache.entries,rate:sr(n.cache.hits,n.cache.misses)}),e[61]=n.cache,e[62]=a,e[63]=E):E=e[63];let A;e[64]!==I||e[65]!==E?(A=t(me,{label:I,testId:"mt-cache",value:E}),e[64]=I,e[65]=E,e[66]=A):A=e[66];let L;return e[67]!==g||e[68]!==N||e[69]!==k||e[70]!==b||e[71]!==A||e[72]!==f||e[73]!==q?(L=o("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[f,q,g,N,k,b,A]}),e[67]=g,e[68]=N,e[69]=k,e[70]=b,e[71]=A,e[72]=f,e[73]=q,e[74]=L):L=e[74],L},Ve=l=>l>=100?"critical":l>=50?"warning":"good",Ae=l=>l<1?`${(l*1e3).toFixed(0)}μs`:l<1e3?`${l.toFixed(1)}ms`:`${(l/1e3).toFixed(2)}s`,He=l=>l>=1e9?`${(l/1e9).toFixed(1)}B`:l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:l.toLocaleString(),ar=l=>{const e=Fe(3),{level:i}=l;if(i==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t(et,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(i==="warning"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:"Moderate"}),e[1]=r):r=e[1],r}let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=t("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:"Fast"}),e[2]=s):s=e[2],s},ir=(l,e)=>{const i=[...l];return i.sort((s,r)=>{switch(e){case"avgTime":return r.avgDurationMs-s.avgDurationMs;case"execCount":return r.execCount-s.execCount;case"rowsRead":return r.rowsRead-s.rowsRead;default:return r.totalDurationMs-s.totalDurationMs}}),i},nr=l=>{const e=Fe(161),{queryStats:i}=l,s=xe(),[r,u]=pe("totalTime");let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=new Set,e[0]=n):n=e[0];const[a,S]=pe(n);let y;e[1]===Symbol.for("react.memo_cache_sentinel")?(y=k=>{k!==null&&u(k)},e[1]=y):y=e[1];const w=y;let f,d,h,v,q,C,c,p,g,x;if(e[2]!==a||e[3]!==i||e[4]!==r||e[5]!==s){h=Symbol.for("react.early_return_sentinel");e:{const k=ir(i,r);let M;e[16]!==i?(M=i.filter(or),e[16]=i,e[17]=M):M=e[17];const _=M.length;let b;e[18]!==i?(b=i.filter(cr),e[18]=i,e[19]=b):b=e[19];const I=b.length;let E;e[20]!==i?(E=i.filter(dr),e[20]=i,e[21]=E):E=e[21];const A=E.length;let L;e[22]===Symbol.for("react.memo_cache_sentinel")?(L=D=>{S(ce=>{const H=new Set(ce);return H.has(D)?H.delete(D):H.add(D),H})},e[22]=L):L=e[22];const F=L;if(i.length===0){let D;e[23]!==s?(D=s("No query insights yet"),e[23]=s,e[24]=D):D=e[24];let ce;e[25]!==D?(ce=t("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:D}),e[25]=D,e[26]=ce):ce=e[26];let H;e[27]!==s?(H=s("Query insights appear once statements are executed against this shard."),e[27]=s,e[28]=H):H=e[28];let fe;e[29]!==H?(fe=t("p",{className:"mt-1 text-sm",children:H}),e[29]=H,e[30]=fe):fe=e[30];let Pe;e[31]!==ce||e[32]!==fe?(Pe=t(he,{children:t(ge,{className:"py-12",children:o("div",{className:"text-center text-muted-foreground",children:[ce,fe]})})}),e[31]=ce,e[32]=fe,e[33]=Pe):Pe=e[33],h=Pe;break e}c="space-y-4",p="qi-root";let z;e[34]!==s?(z=s("Critical queries"),e[34]=s,e[35]=z):z=e[35];let P;e[36]!==z?(P=t(Be,{className:"pb-2",children:t(je,{className:"text-sm font-medium",children:z})}),e[36]=z,e[37]=P):P=e[37];let O;e[38]!==_?(O=t("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:_}),e[38]=_,e[39]=O):O=e[39];let U;e[40]!==s?(U=s(">100ms avg execution"),e[40]=s,e[41]=U):U=e[41];let J;e[42]!==U?(J=t("p",{className:"text-xs text-muted-foreground",children:U}),e[42]=U,e[43]=J):J=e[43];let V;e[44]!==O||e[45]!==J?(V=o(ge,{children:[O,J]}),e[44]=O,e[45]=J,e[46]=V):V=e[46];let G;e[47]!==P||e[48]!==V?(G=o(he,{children:[P,V]}),e[47]=P,e[48]=V,e[49]=G):G=e[49];let W;e[50]!==s?(W=s("Moderate queries"),e[50]=s,e[51]=W):W=e[51];let X;e[52]!==W?(X=t(Be,{className:"pb-2",children:t(je,{className:"text-sm font-medium",children:W})}),e[52]=W,e[53]=X):X=e[53];let Y;e[54]!==I?(Y=t("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:I}),e[54]=I,e[55]=Y):Y=e[55];let Z;e[56]!==s?(Z=s("50–100ms avg execution"),e[56]=s,e[57]=Z):Z=e[57];let ee;e[58]!==Z?(ee=t("p",{className:"text-xs text-muted-foreground",children:Z}),e[58]=Z,e[59]=ee):ee=e[59];let te;e[60]!==Y||e[61]!==ee?(te=o(ge,{children:[Y,ee]}),e[60]=Y,e[61]=ee,e[62]=te):te=e[62];let re;e[63]!==X||e[64]!==te?(re=o(he,{children:[X,te]}),e[63]=X,e[64]=te,e[65]=re):re=e[65];let se;e[66]!==s?(se=s("Fast queries"),e[66]=s,e[67]=se):se=e[67];let le;e[68]!==se?(le=t(Be,{className:"pb-2",children:t(je,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ae;e[70]!==A?(ae=t("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:A}),e[70]=A,e[71]=ae):ae=e[71];let ie;e[72]!==s?(ie=s("<50ms avg execution"),e[72]=s,e[73]=ie):ie=e[73];let ne;e[74]!==ie?(ne=t("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=ne):ne=e[75];let m;e[76]!==ae||e[77]!==ne?(m=o(ge,{children:[ae,ne]}),e[76]=ae,e[77]=ne,e[78]=m):m=e[78];let K;e[79]!==le||e[80]!==m?(K=o(he,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=K):K=e[81],e[82]!==G||e[83]!==re||e[84]!==K?(g=o("div",{className:"grid gap-4 md:grid-cols-3",children:[G,re,K]}),e[82]=G,e[83]=re,e[84]=K,e[85]=g):g=e[85];let B;e[86]!==s?(B=s("Query leaderboard"),e[86]=s,e[87]=B):B=e[87];let j;e[88]!==B?(j=t("h3",{className:"text-lg font-semibold",children:B}),e[88]=B,e[89]=j):j=e[89];let Q;e[90]!==r||e[91]!==s?(Q=s("Slow queries sorted by {sortField}",{sortField:s(r)}),e[90]=r,e[91]=s,e[92]=Q):Q=e[92];let ue;e[93]!==Q?(ue=t("p",{className:"text-sm text-muted-foreground",children:Q}),e[93]=Q,e[94]=ue):ue=e[94];let be;e[95]!==j||e[96]!==ue?(be=o("div",{children:[j,ue]}),e[95]=j,e[96]=ue,e[97]=be):be=e[97];let ye;e[98]!==s?(ye=s("Sort by"),e[98]=s,e[99]=ye):ye=e[99];let ve;e[100]!==ye?(ve=t("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=ve):ve=e[101];let Ne;e[102]!==s?(Ne=s("Sort queries by"),e[102]=s,e[103]=Ne):Ne=e[103];let Le;e[104]===Symbol.for("react.memo_cache_sentinel")?(Le=t(Bt,{}),e[104]=Le):Le=e[104];let Se;e[105]!==Ne?(Se=t(jt,{"aria-label":Ne,className:"w-[140px]","data-testid":"qi-sort",children:Le}),e[105]=Ne,e[106]=Se):Se=e[106];let we;e[107]!==s?(we=s("Total time"),e[107]=s,e[108]=we):we=e[108];let qe;e[109]!==we?(qe=t(Qe,{value:"totalTime",children:we}),e[109]=we,e[110]=qe):qe=e[110];let Te;e[111]!==s?(Te=s("Avg time"),e[111]=s,e[112]=Te):Te=e[112];let _e;e[113]!==Te?(_e=t(Qe,{value:"avgTime",children:Te}),e[113]=Te,e[114]=_e):_e=e[114];let Ce;e[115]!==s?(Ce=s("Execution count"),e[115]=s,e[116]=Ce):Ce=e[116];let Re;e[117]!==Ce?(Re=t(Qe,{value:"execCount",children:Ce}),e[117]=Ce,e[118]=Re):Re=e[118];let ke;e[119]!==s?(ke=s("Rows read"),e[119]=s,e[120]=ke):ke=e[120];let $e;e[121]!==ke?($e=t(Qe,{value:"rowsRead",children:ke}),e[121]=ke,e[122]=$e):$e=e[122];let Me;e[123]!==qe||e[124]!==_e||e[125]!==Re||e[126]!==$e?(Me=o(Qt,{children:[qe,_e,Re,$e]}),e[123]=qe,e[124]=_e,e[125]=Re,e[126]=$e,e[127]=Me):Me=e[127];let Ie;e[128]!==r||e[129]!==Se||e[130]!==Me?(Ie=o(Ht,{onValueChange:w,value:r,children:[Se,Me]}),e[128]=r,e[129]=Se,e[130]=Me,e[131]=Ie):Ie=e[131];let De;e[132]!==ve||e[133]!==Ie?(De=o("div",{className:"flex items-center gap-2",children:[ve,Ie]}),e[132]=ve,e[133]=Ie,e[134]=De):De=e[134],e[135]!==be||e[136]!==De?(x=o("div",{className:"flex items-center justify-between",children:[be,De]}),e[135]=be,e[136]=De,e[137]=x):x=e[137],d=he;let Ee;e[138]!==s?(Ee=s("Statements"),e[138]=s,e[139]=Ee):Ee=e[139];let ze;e[140]!==Ee?(ze=t(je,{children:Ee}),e[140]=Ee,e[141]=ze):ze=e[141],C=o(Be,{children:[ze,t(Mt,{children:s("{count} tracked statements",{count:k.length})})]}),f=ge,v="space-y-2";let Ke;e[142]!==a||e[143]!==s?(Ke=D=>{const ce=D.normalizedSql,H=a.has(ce),fe=Ve(D.avgDurationMs);return o("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[o("button",{"aria-expanded":H,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:()=>{F(ce)},type:"button",children:[o("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[t(ar,{level:fe}),t("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:D.normalizedSql})]}),o("div",{className:"flex shrink-0 items-center gap-4",children:[o("div",{className:"text-right",children:[t("div",{className:"text-sm font-medium",children:Ae(D.totalDurationMs)}),t("div",{className:"text-xs text-muted-foreground",children:s("total")})]}),o("div",{className:"text-right",children:[t("div",{className:"text-sm font-medium",children:Ae(D.avgDurationMs)}),t("div",{className:"text-xs text-muted-foreground",children:s("avg")})]}),D.p95DurationMs!==void 0&&o("div",{className:"text-right",children:[t("div",{className:"text-sm font-medium",children:Ae(D.p95DurationMs)}),t("div",{className:"text-xs text-muted-foreground",children:s("p95")})]}),o("div",{className:"text-right",children:[t("div",{className:"text-sm font-medium",children:He(D.execCount)}),t("div",{className:"text-xs text-muted-foreground",children:s("calls")})]})]})]}),H&&o("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[o("div",{children:[t("p",{className:"mb-2 text-sm font-medium",children:s("Full statement")}),t("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:D.normalizedSql})]}),o("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[D.p50DurationMs!==void 0&&o("div",{children:[t("span",{className:"text-muted-foreground",children:s("p50")}),t("span",{className:"block font-medium tabular-nums",children:Ae(D.p50DurationMs)})]}),o("div",{children:[t("span",{className:"text-muted-foreground",children:s("Exec count")}),t("span",{className:"block font-medium tabular-nums",children:He(D.execCount)})]}),o("div",{children:[t("span",{className:"text-muted-foreground",children:s("Total time")}),t("span",{className:"block font-medium tabular-nums",children:Ae(D.totalDurationMs)})]}),o("div",{children:[t("span",{className:"text-muted-foreground",children:s("Rows read")}),t("span",{className:"block font-medium tabular-nums",children:He(D.rowsRead)})]}),o("div",{children:[t("span",{className:"text-muted-foreground",children:s("Rows written")}),t("span",{className:"block font-medium tabular-nums",children:He(D.rowsWritten)})]})]})]})]},ce)},e[142]=a,e[143]=s,e[144]=Ke):Ke=e[144],q=k.map(Ke)}e[2]=a,e[3]=i,e[4]=r,e[5]=s,e[6]=f,e[7]=d,e[8]=h,e[9]=v,e[10]=q,e[11]=C,e[12]=c,e[13]=p,e[14]=g,e[15]=x}else f=e[6],d=e[7],h=e[8],v=e[9],q=e[10],C=e[11],c=e[12],p=e[13],g=e[14],x=e[15];if(h!==Symbol.for("react.early_return_sentinel"))return h;let T;e[145]!==v||e[146]!==q?(T=t("div",{className:v,children:q}),e[145]=v,e[146]=q,e[147]=T):T=e[147];let R;e[148]!==f||e[149]!==T?(R=t(f,{children:T}),e[148]=f,e[149]=T,e[150]=R):R=e[150];let N;e[151]!==d||e[152]!==R||e[153]!==C?(N=o(d,{children:[C,R]}),e[151]=d,e[152]=R,e[153]=C,e[154]=N):N=e[154];let $;return e[155]!==N||e[156]!==c||e[157]!==p||e[158]!==g||e[159]!==x?($=o("div",{className:c,"data-testid":p,children:[g,x,N]}),e[155]=N,e[156]=c,e[157]=p,e[158]=g,e[159]=x,e[160]=$):$=e[160],$};function or(l){return Ve(l.avgDurationMs)==="critical"}function cr(l){return Ve(l.avgDurationMs)==="warning"}function dr(l){return Ve(l.avgDurationMs)==="good"}const mr=["1m","5m","15m","1h"],ur=l=>new Date(l).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),fr=l=>l.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:ur(e.bucketMs)})),hr=({shardKey:l=""})=>{const e=xe(),[i,s]=pe("15m"),u=Ue(Oe.getQueryInsights,{range:i},{live:!0,shardKey:l}).data,n=fr(u?.buckets??[]);return o("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[o("div",{className:"flex flex-wrap items-center gap-2",children:[t("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:mr.map(a=>t("button",{"aria-pressed":a===i,className:Pt("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",a===i&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${a}`,onClick:()=>{s(a)},type:"button",children:a},a))}),u?.capped===!0&&t(et,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),n.length===0?t(Kt,{description:e("Statements executed in the selected window appear here, with throughput and latency over time."),testId:"qi-empty",title:e("No queries in this window.")}):o("div",{className:"grid gap-4 lg:grid-cols-2",children:[o("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[t("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),t(st,{height:140,width:"100%",children:o(At,{data:n,children:[t(lt,{strokeDasharray:"3 3",vertical:!1}),t(at,{dataKey:"label",fontSize:10,tickLine:!1}),t(it,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),t(nt,{}),t(Ot,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),o("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[t("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),t(st,{height:140,width:"100%",children:o(Lt,{data:n,children:[t(lt,{strokeDasharray:"3 3",vertical:!1}),t(at,{dataKey:"label",fontSize:10,tickLine:!1}),t(it,{fontSize:10,tickLine:!1,width:32}),t(nt,{}),t(zt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),t(nr,{queryStats:u?.entries??[]})]})},gr=Ct(Oe.getMetrics),pr=(l,e)=>l?e:"overview",jr=({initialShardKey:l})=>{const e=pt(),i=xe(),{queryShardKey:s,setShardKey:r,shardKey:u}=Nt(l),[n,a]=pe("overview"),[S,y]=pe([]),w=Ge(null),f=Ge(null),d=Ge(!0);tt(()=>(d.current=!0,()=>{d.current=!1}),[]);const h=vt(s),{data:v,error:q,liveError:C}=Ue(Oe.getMetrics,{},{live:!0,shardKey:s}),c=v??null;tt(()=>{if(v===void 0)return;Rt(s);const F=v,z=w.current,P=f.current!==null&&f.current!==F.shard;if(f.current=F.shard,w.current=F.requests,P){y([]);return}z!==null&&F.requests>=z&&y(O=>[...O,F.requests-z].slice(-30))},[v,s]);const[p,g]=pe(null),[x,T]=pe(!1),R=async()=>{T(!0);const F=Ft(u,kt());try{const z=await Promise.all(F.map(async P=>{try{const O=await e.query(gr,{},Tt(P));return{error:null,metrics:O,shard:P===""?O.shard:P}}catch(O){return{error:_t(O),metrics:null,shard:P===""?"__root__":P}}}));d.current&&g(z)}finally{d.current&&T(!1)}},N=p===null?null:It(p),$=c===null||c.requests===0?"—":`${(c.errors/c.requests*100).toFixed(1)}%`,k=S.length>0?S.at(-1):0,M=c?Dt(c):{p90:0,p95:0},_=xt(()=>{if(!c||!("queryStats"in c))return;const F=c.queryStats;if(!(!F||!Array.isArray(F)))return Et(F)},[c]),b=pr(_!==void 0,n),I=()=>{qt(R())},E=()=>{g(null)},A=()=>{a("overview")},L=()=>{a("query-insights")};return o("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[o("div",{className:"flex flex-wrap items-center gap-2",children:[t(yt,{onChange:r,testId:"mt-shard-input",value:u}),t(bt,{message:C,prefix:"mt"}),t(rt,{"data-testid":"mt-aggregate",disabled:x,onClick:I,size:"sm",type:"button",variant:"secondary",children:i(x?"Aggregating…":"All shards")}),p!==null&&t(rt,{"data-testid":"mt-aggregate-clear",onClick:E,size:"sm",type:"button",variant:"ghost",children:i("Hide")}),t("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:St,rel:"noreferrer",target:"_blank",children:i("Open in Cloudflare")})]}),q!==null&&t("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:q}),_!==void 0&&o("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[t("button",{className:`pb-2 text-sm font-medium transition-colors ${b==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:A,type:"button",children:i("Overview")}),o("button",{className:`pb-2 text-sm font-medium transition-colors ${b==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:L,type:"button",children:[i("Query insights"),_.length>0&&t("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:_.length})]})]}),b==="query-insights"&&_!==void 0&&t(hr,{shardKey:s}),b==="overview"&&c!==null&&t(lr,{currentDelta:k,errorRate:$,history:S,latencyPercentiles:M,metrics:c}),b==="overview"&&c===null&&null,b==="overview"&&t(er,{onOpenTrace:h,shardKey:s}),b==="overview"&&N!==null&&p!==null&&t(tr,{aggregate:N,shardResults:p})]})};export{jr as MetricsPanel};
@@ -1 +0,0 @@
1
- import{c as D}from"react/compiler-runtime";import{useState as j}from"react";import{E as K}from"../packem_shared/error-alert-TYdKetJd.js";import{B as L}from"../packem_shared/badge-cAk9Di1Q.js";import{B as F}from"../packem_shared/button-BOPLD1un.js";import{C as O,a as Q}from"../packem_shared/card-BGlQzQY-.js";import{E as U}from"../packem_shared/empty-state-B939z6K2.js";import{I as q}from"../packem_shared/input-CY5W3wzv.js";import{T as G,a as J,b as H,c as h,d as X,e as u}from"../packem_shared/table-BMsuYFhk.js";import{u as Y}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useT as Z}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as _}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{i as ee}from"../packem_shared/internal-CwaF9YNk.js";import{jsx as t,jsxs as x}from"react/jsx-runtime";const te=e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary",M=e=>e.endpoint??e.id,ge=()=>{const e=D(38),r=Z(),[a,P]=j("all"),[n,V]=j("");let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const{data:T,error:i,errorSource:p,isLoading:v,refetch:g}=Y(_.listPushSubscriptions,b);let N;if(e[1]!==T?.subscriptions||e[2]!==i||e[3]!==p||e[4]!==v||e[5]!==a||e[6]!==g||e[7]!==n||e[8]!==r){const I=T?.subscriptions??[],$=n.trim().toLowerCase(),A=I.filter(s=>a!=="all"&&s.kind!==a?!1:$===""?!0:`${M(s)} ${s.userId??""}`.toLowerCase().includes($));let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=s=>{V(s.target.value)},e[10]=w):w=e[10];const z=w;let y;e[11]!==g?(y=()=>{g()},e[11]=g,e[12]=y):y=e[12];const B=y;let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=["all","web-push","fcm"],e[13]=C):C=e[13];const W=C;let o;e[14]!==a||e[15]!==r?(o=t("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:W.map(s=>t(F,{"aria-selected":a===s,"data-testid":`nt-kind-${s}`,onClick:()=>{P(s)},role:"tab",size:"sm",type:"button",variant:a===s?"secondary":"ghost",children:s==="all"?r("All"):s},s))}),e[14]=a,e[15]=r,e[16]=o):o=e[16];let l;e[17]!==r?(l=r("Filter devices"),e[17]=r,e[18]=l):l=e[18];let d;e[19]!==r?(d=r("filter endpoint, user"),e[19]=r,e[20]=d):d=e[20];let c;e[21]!==n||e[22]!==l||e[23]!==d?(c=t(q,{"aria-label":l,className:"h-8 w-56","data-testid":"nt-search",onChange:z,placeholder:d,value:n}),e[21]=n,e[22]=l,e[23]=d,e[24]=c):c=e[24];let m;e[25]!==r?(m=r("Refresh"),e[25]=r,e[26]=m):m=e[26];let f;e[27]!==B||e[28]!==m?(f=t(F,{className:"ml-auto","data-testid":"nt-refresh",onClick:B,size:"sm",type:"button",variant:"outline",children:m}),e[27]=B,e[28]=m,e[29]=f):f=e[29];const E=I.length>0&&t(L,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:I.length})});let k;e[30]!==f||e[31]!==E||e[32]!==o||e[33]!==c?(k=x("div",{className:"flex flex-wrap items-center gap-2",children:[o,c,f,E]}),e[30]=f,e[31]=E,e[32]=o,e[33]=c,e[34]=k):k=e[34];let S;e[35]!==i||e[36]!==p?(S=i!==null&&t(K,{error:p,testId:"nt-error"}),e[35]=i,e[36]=p,e[37]=S):S=e[37],N=x("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[k,S,i===null&&!v&&A.length===0&&t(U,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),A.length>0&&t(O,{className:"overflow-hidden py-0",children:t(Q,{className:"max-h-[30rem] overflow-auto px-0",children:x(G,{"data-testid":"nt-table",children:[t(J,{children:x(H,{children:[t(h,{children:r("kind")}),t(h,{children:r("endpoint")}),t(h,{children:r("user")}),t(h,{children:r("last seen")}),t(h,{children:r("status")}),t(h,{children:r("error")})]})}),t(X,{children:A.map(s=>{const R=M(s);return x(H,{"data-testid":"nt-row",children:[t(u,{children:t(L,{variant:"outline",children:s.kind})}),t(u,{className:"max-w-[28ch] truncate font-mono text-xs",title:R,children:R}),t(u,{className:"max-w-[16ch] truncate font-mono text-xs",children:s.userId??t("span",{className:"text-muted-foreground",children:"—"})}),t(u,{className:"text-muted-foreground tabular-nums",children:ee(s.lastSeenAt,"—")}),t(u,{children:t(L,{"data-testid":`nt-status-${s.id}`,variant:te(s.lastStatus),children:s.lastStatus??r("n/a")})}),t(u,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:s.lastError??void 0,children:s.lastError??t("span",{className:"text-muted-foreground",children:"—"})})]},s.id)})})]})})})]}),e[1]=T?.subscriptions,e[2]=i,e[3]=p,e[4]=v,e[5]=a,e[6]=g,e[7]=n,e[8]=r,e[9]=N}else N=e[9];return N};export{ge as default};
@@ -1 +0,0 @@
1
- import{useLunora as D}from"@lunora/react";import{useState as s,useCallback as G,useEffect as Z}from"react";import{ConfirmButton as B}from"../packem_shared/ConfirmButton-Cj2SOapE.js";import{B as H}from"../packem_shared/badge-cAk9Di1Q.js";import{B as J}from"../packem_shared/button-BOPLD1un.js";import{I as _}from"../packem_shared/input-CY5W3wzv.js";import{L as g}from"../packem_shared/label-BOUo-DP0.js";import{useAutoRefresh as Q}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{useT as V}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as T}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{d as u,b as v,f as p,c as I}from"../packem_shared/internal-CwaF9YNk.js";import{jsxs as o,jsx as r}from"react/jsx-runtime";const N=I(T.getPitrBookmark),W=I(T.pitrRestore),de=({initialShardKey:O})=>{const c=D(),t=V(),n=O??"",[P,f]=s(null),[i,F]=s(""),[y,w]=s(null),[m,E]=s(""),[h,L]=s(!1),[a,S]=s(null),[R,l]=s(null),[x,d]=s(!1),k=G(async()=>{d(!0),l(null);try{const e=await c.query(N,{},u(n));f(e.current)}catch(e){l(v(e))}d(!1)},[c,n]);Z(()=>{p(k())},[k]),Q(()=>{p((async()=>{try{const e=await c.query(N,{},u(n));f(e.current)}catch{}})())},!0);const A=e=>{F(e.target.value)},U=e=>{E(e.target.value)},q=e=>{L(e.target.checked)},K=()=>{i.trim()!==""&&p((async()=>{d(!0),l(null);try{const e=await c.query(N,{time:i.trim()},u(n));w(e.forTime??null),f(e.current)}catch(e){w(null),l(v(e))}d(!1)})())},C=e=>{p((async()=>{d(!0),l(null);try{const b=await c.mutation(W,e,u(n));S(b),await k()}catch(b){l(v(b))}d(!1)})())},M=m.trim()!==""||i.trim()!=="",j=()=>{const e=h?{restart:!0}:{};m.trim()===""?e.time=i.trim():e.bookmark=m.trim(),C(e)},z=()=>{a!==null&&C(h?{bookmark:a.undoBookmark,restart:!0}:{bookmark:a.undoBookmark})};return o("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[r("div",{className:"flex flex-wrap items-center gap-3",children:o("span",{className:"text-xs text-muted-foreground",children:[t("Shard"),": ",r("span",{className:"font-mono",children:n===""?t("root"):n})]})}),r("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:t("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier.")}),R!==null&&r("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:R}),o("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[r("h3",{className:"mb-2 text-sm font-semibold",children:t("Current bookmark")}),r("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:P??r("span",{className:"text-muted-foreground",children:"—"})})]}),o("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[r("h3",{className:"text-sm font-semibold",children:t("Restore")}),o("div",{className:"flex flex-col gap-1",children:[r(g,{htmlFor:"pitr-time",children:t("Time (ISO or epoch-ms, last 30 days)")}),o("div",{className:"flex items-center gap-2",children:[r(_,{"data-testid":"pitr-time",id:"pitr-time",onChange:A,placeholder:"2026-06-01T00:00:00.000Z",value:i}),r(J,{"data-testid":"pitr-preview",disabled:x||i.trim()==="",onClick:K,size:"sm",type:"button",variant:"outline",children:t("Preview")})]}),y!==null&&o("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[t("Bookmark for that time"),": ",y]})]}),o("div",{className:"flex flex-col gap-1",children:[r(g,{htmlFor:"pitr-bookmark",children:t("Or an explicit bookmark (wins over time)")}),r(_,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:U,placeholder:t("bookmark string"),value:m})]}),o(g,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[r("input",{checked:h,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:q,type:"checkbox"}),t("Restart the shard now so recovery applies immediately")]}),r("div",{children:r(B,{confirmLabel:t("Confirm restore"),disabled:x||!M,onConfirm:j,testId:"pitr-restore",children:t("Restore")})})]}),a!==null&&o("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[o("div",{className:"flex items-center gap-2",children:[r("h3",{className:"text-sm font-semibold",children:t("Restore armed")}),r(H,{variant:a.restarted?"destructive":"secondary",children:a.restarted?t("restarted now"):t("on next restart")})]}),o("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[t("Restored to"),": ",a.restoredTo]}),o("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[t("Undo bookmark"),": ",a.undoBookmark]}),r("div",{children:r(B,{confirmLabel:t("Confirm undo"),disabled:x,onConfirm:z,testId:"pitr-undo",children:t("Undo restore")})})]})]})};export{de as PitrPanel};
@@ -1 +0,0 @@
1
- import{c as Ne}from"react/compiler-runtime";import{ShardInput as We}from"../packem_shared/ShardInput-CdawpUiS.js";import{S as Re,T as Pe}from"../packem_shared/storage-tier-C2mKwYRj.js";import{B as Fe}from"../packem_shared/badge-cAk9Di1Q.js";import{b as ze,d as qe,c as Be,a as De,C as je}from"../packem_shared/card-BGlQzQY-.js";import{E as Qe}from"../packem_shared/empty-state-B939z6K2.js";import{I as ke}from"../packem_shared/input-CY5W3wzv.js";import{useT as Le}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{c as Oe,d as Ae,b as $e,f as be}from"../packem_shared/internal-CwaF9YNk.js";import{c as Je}from"../packem_shared/utils-bhneXptQ.js";import{useLunora as Ze}from"@lunora/react";import{useState as E,useEffect as Ge,useRef as et}from"react";import{u as tt}from"../packem_shared/use-shard-key-BsP3o5wT.js";import{ADMIN_FUNCTIONS as Me}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{r as lt}from"../packem_shared/shard-history-DU5b3QDI.js";import{S as st}from"../packem_shared/schema-diagram-DOaIh1y6.js";import{useNavigate as at}from"@tanstack/react-router";import{B as ge}from"../packem_shared/button-BOPLD1un.js";import{L as _e}from"../packem_shared/label-BOUo-DP0.js";import{jsx as l,jsxs as p,Fragment as Ke}from"react/jsx-runtime";const nt=Oe(Me.listTables),ot=Oe(Me.listTableIndexes),it=Oe(Me.readTablePage),rt=Oe(Me.describeTables),dt={},Ue=[],ct=n=>{const e=Ne(74),{initialShardKey:m,initialTable:a}=n,t=Ze(),[s,c]=E("graph"),{queryShardKey:d,setShardKey:r,shardKey:b}=tt(m),[o,f]=E(""),[i,v]=E(null),[h,G]=E(null);let w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];const[B,y]=E(w);let z;e[1]===Symbol.for("react.memo_cache_sentinel")?(z={},e[1]=z):z=e[1];const[F,D]=E(z),[S,C]=E(null);let A;e[2]===Symbol.for("react.memo_cache_sentinel")?(A={},e[2]=A):A=e[2];const[L,me]=E(A);let W;e[3]===Symbol.for("react.memo_cache_sentinel")?(W={},e[3]=W):W=e[3];const[I,q]=E(W),[_,ue]=E(null),[j,ie]=E(null);let Q;e[4]===Symbol.for("react.memo_cache_sentinel")?(Q={},e[4]=Q):Q=e[4];const[Y,xe]=E(Q),[H,re]=E(null);let ve;e[5]!==t?(ve=async u=>{G(null);try{const N=await t.query(nt,{},Ae(u));lt(u),v(N),y({}),D({}),C(null),me(x=>Object.fromEntries(Object.entries(x).filter(P=>{const[k]=P;return k!==u}))),q(x=>Object.fromEntries(Object.entries(x).filter(P=>{const[k]=P;return k!==u})))}catch(N){const x=N;v(null),G($e(x))}},e[5]=t,e[6]=ve):ve=e[6];const O=ve;let Z;e[7]!==t?(Z=async()=>{ie(null);try{ue(await t.listGlobalTables())}catch(u){const N=u;ue(null),ie($e(N))}},e[7]=t,e[8]=Z):Z=e[8];const ee=Z;let de,R;e[9]!==d||e[10]!==O||e[11]!==ee?(de=()=>{be(O(d)),be(ee())},R=[O,ee,d],e[9]=d,e[10]=O,e[11]=ee,e[12]=de,e[13]=R):(de=e[12],R=e[13]),Ge(de,R);let te;e[14]!==t||e[15]!==B||e[16]!==S||e[17]!==d?(te=async u=>{if(S===u){C(null);return}C(u);const N=`${d}:${u}`;if(B[N]!==void 0)return;const[x,P]=await Promise.allSettled([t.query(it,{limit:1,offset:0,table:u},Ae(d)),t.query(ot,{table:u},Ae(d))]);x.status==="fulfilled"?y(k=>({...k,[N]:x.value.columns})):G($e(x.reason)),P.status==="fulfilled"&&D(k=>({...k,[N]:P.value.indexes}))},e[14]=t,e[15]=B,e[16]=S,e[17]=d,e[18]=te):te=e[18];const M=te;let ye;e[19]!==t||e[20]!==Y||e[21]!==H?(ye=async u=>{if(H===u){re(null);return}if(re(u),Y[u]===void 0)try{const N=await t.readGlobalTablePage({limit:1,offset:0,table:u});xe(x=>({...x,[u]:N.columns}))}catch(N){ie($e(N))}},e[19]=t,e[20]=Y,e[21]=H,e[22]=ye):ye=e[22];const ce=ye,fe=et(void 0);let K,X;e[23]!==a||e[24]!==i||e[25]!==M?(K=()=>{a===void 0||i===null||fe.current===a||i.some(u=>u.name===a)&&(fe.current=a,be(M(a)))},X=[a,i,M],e[23]=a,e[24]=i,e[25]=M,e[26]=K,e[27]=X):(K=e[26],X=e[27]),Ge(K,X);let U;e[28]!==t?(U=async(u,N,x)=>{const[P,k]=await Promise.all([Promise.allSettled([t.query(rt,{tables:[...N,...x]},Ae(u))]),Promise.all(x.map(async T=>{const pe=await Promise.allSettled([t.readGlobalTablePage({limit:1,offset:0,table:T})]),Ie=pe[0].status==="fulfilled"?pe[0].value:void 0;return{columns:Ie?.columns??[],refs:Ie?.refs??{},table:T}}))]),Te=P[0].status==="fulfilled"?P[0].value?.columnsByTable??{}:{},Se=P[0].status==="rejected",we=new Map(k.map(mt)),Ee=[...N,...x].map(T=>{const pe=Te[T]??[];return[T,pe.length>0?pe:we.get(T)??[]]});me(T=>({...T,[u]:Object.fromEntries(Ee)})),q(T=>({...T,[u]:Se}))},e[28]=t,e[29]=U):U=e[29];const le=U;let V,se;e[30]!==j||e[31]!==_||e[32]!==le||e[33]!==d||e[34]!==L||e[35]!==i||e[36]!==s?(V=()=>{s!=="graph"||i===null||_===null&&j===null||L[d]!==void 0||be(le(d,i.map(ut),(_??[]).map(ft)))},se=[s,i,_,j,d,L,le],e[30]=j,e[31]=_,e[32]=le,e[33]=d,e[34]=L,e[35]=i,e[36]=s,e[37]=V,e[38]=se):(V=e[37],se=e[38]),Ge(V,se);const $=L[d]??dt;let ae;if(e[39]!==$||e[40]!==_||e[41]!==i){let u;e[43]!==$?(u=k=>({columns:$[k.name]??Ue,name:k.name,tier:"shard"}),e[43]=$,e[44]=u):u=e[44];const N=(i??[]).map(u);let x;e[45]!==$?(x=k=>({columns:$[k.name]??Ue,name:k.name,tier:"global"}),e[45]=$,e[46]=x):x=e[46];const P=(_??[]).map(x);ae=[...N,...P],e[39]=$,e[40]=_,e[41]=i,e[42]=ae}else ae=e[42];const ne=ae;let g;if(e[47]!==o||e[48]!==i){const u=o.trim().toLowerCase();g=(i??[]).filter(N=>N.name.toLowerCase().includes(u)),e[47]=o,e[48]=i,e[49]=g}else g=e[49];const oe=g;let J;if(e[50]!==_||e[51]!==o){const u=o.trim().toLowerCase();J=(_??[]).filter(N=>N.name.toLowerCase().includes(u)),e[50]=_,e[51]=o,e[52]=J}else J=e[52];const Ce=J;let he;return e[53]!==B||e[54]!==ne||e[55]!==h||e[56]!==S||e[57]!==Ce||e[58]!==oe||e[59]!==Y||e[60]!==j||e[61]!==H||e[62]!==_||e[63]!==F||e[64]!==O||e[65]!==r||e[66]!==I||e[67]!==b||e[68]!==o||e[69]!==i||e[70]!==M||e[71]!==ce||e[72]!==s?(he={columns:B,diagramTables:ne,error:h,expanded:S,filteredGlobalTables:Ce,filteredTables:oe,globalColumns:Y,globalError:j,globalExpanded:H,globalTables:_,indexes:F,refresh:O,setShardKey:r,setTableFilter:f,setView:c,shardColumnsError:I,shardKey:b,tableFilter:o,tables:i,toggle:M,toggleGlobal:ce,view:s},e[53]=B,e[54]=ne,e[55]=h,e[56]=S,e[57]=Ce,e[58]=oe,e[59]=Y,e[60]=j,e[61]=H,e[62]=_,e[63]=F,e[64]=O,e[65]=r,e[66]=I,e[67]=b,e[68]=o,e[69]=i,e[70]=M,e[71]=ce,e[72]=s,e[73]=he):he=e[73],he};function mt(n){const{columns:e,refs:m,table:a}=n;return[a,e.map(t=>{const s=m[t];return s===void 0?{name:t,optional:!1,type:""}:{name:t,optional:!1,ref:s,type:"id"}})]}function ut(n){return n.name}function ft(n){return n.name}const ht="/__lunora/schema-edit",pt=async n=>{const e=await fetch(ht,{body:JSON.stringify(n),headers:{"Content-Type":"application/json","X-Lunora-Studio":"1"},method:"POST"}),m=await e.json();return m.needsMigration===!0?{kind:"needs-migration",message:m.message??"This edit needs a migration."}:e.ok&&m.tables!==void 0?{diagnostics:m.diagnostics??[],kind:"ok",tables:m.tables}:{kind:"error",message:m.error??`schema edit failed (${String(e.status)})`}},gt=n=>{const e=Ne(32),{hasTables:m,mode:a,onAddColumn:t,onAddIndex:s,onAddTable:c,onDestructive:d}=n,r=Le(),b=a==="addTable"?"default":"outline";let o;e[0]!==r?(o=r("Add table"),e[0]=r,e[1]=o):o=e[1];let f;e[2]!==c||e[3]!==b||e[4]!==o?(f=l(ge,{"data-testid":"sc-editor-add-table",onClick:c,size:"xs",type:"button",variant:b,children:o}),e[2]=c,e[3]=b,e[4]=o,e[5]=f):f=e[5];const i=!m,v=a==="addColumn"?"default":"outline";let h;e[6]!==r?(h=r("Add column"),e[6]=r,e[7]=h):h=e[7];let G;e[8]!==t||e[9]!==i||e[10]!==v||e[11]!==h?(G=l(ge,{"data-testid":"sc-editor-add-column",disabled:i,onClick:t,size:"xs",type:"button",variant:v,children:h}),e[8]=t,e[9]=i,e[10]=v,e[11]=h,e[12]=G):G=e[12];const w=!m,B=a==="addIndex"?"default":"outline";let y;e[13]!==r?(y=r("Add index"),e[13]=r,e[14]=y):y=e[14];let z;e[15]!==s||e[16]!==y||e[17]!==w||e[18]!==B?(z=l(ge,{"data-testid":"sc-editor-add-index",disabled:w,onClick:s,size:"xs",type:"button",variant:B,children:y}),e[15]=s,e[16]=y,e[17]=w,e[18]=B,e[19]=z):z=e[19];const F=!m,D=a==="destructive"?"default":"ghost";let S;e[20]!==r?(S=r("Rename / drop / change type…"),e[20]=r,e[21]=S):S=e[21];let C;e[22]!==d||e[23]!==F||e[24]!==D||e[25]!==S?(C=l(ge,{"data-testid":"sc-editor-destructive",disabled:F,onClick:d,size:"xs",type:"button",variant:D,children:S}),e[22]=d,e[23]=F,e[24]=D,e[25]=S,e[26]=C):C=e[26];let A;return e[27]!==z||e[28]!==C||e[29]!==f||e[30]!==G?(A=p("div",{className:"flex flex-wrap gap-2",children:[f,G,z,C]}),e[27]=z,e[28]=C,e[29]=f,e[30]=G,e[31]=A):A=e[31],A},bt=n=>{const e=Ne(28),{onOpenMigrations:m,result:a}=n,t=Le();if(a===null){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=l(Ke,{}),e[0]=o):o=e[0],o}if(a.kind==="error"){let o;return e[1]!==a.message?(o=l("p",{className:"mt-3 text-sm text-destructive","data-testid":"sc-editor-error",role:"alert",children:a.message}),e[1]=a.message,e[2]=o):o=e[2],o}if(a.kind==="needs-migration"){let o;e[3]!==a.message||e[4]!==t?(o=a.message===""?t("This edit changes stored data and must go through a migration. Review the migration before applying."):a.message,e[3]=a.message,e[4]=t,e[5]=o):o=e[5];let f;e[6]!==o?(f=l("p",{className:"text-sm text-warning",role:"alert",children:o}),e[6]=o,e[7]=f):f=e[7];let i;e[8]!==t?(i=t("Open Migrations"),e[8]=t,e[9]=i):i=e[9];let v;e[10]!==m||e[11]!==i?(v=l(ge,{className:"self-start","data-testid":"sc-editor-open-migrations",onClick:m,size:"xs",type:"button",variant:"outline",children:i}),e[10]=m,e[11]=i,e[12]=v):v=e[12];let h;return e[13]!==f||e[14]!==v?(h=p("div",{className:"mt-3 flex flex-col gap-2","data-testid":"sc-editor-needs-migration",children:[f,v]}),e[13]=f,e[14]=v,e[15]=h):h=e[15],h}if(a.diagnostics.length===0){let o;return e[16]===Symbol.for("react.memo_cache_sentinel")?(o=l(Ke,{}),e[16]=o):o=e[16],o}let s;e[17]!==t?(s=t("Codegen reported diagnostics:"),e[17]=t,e[18]=s):s=e[18];let c;e[19]!==s?(c=l("p",{className:"text-sm text-destructive",role:"alert",children:s}),e[19]=s,e[20]=c):c=e[20];let d;e[21]!==a.diagnostics?(d=a.diagnostics.map(xt),e[21]=a.diagnostics,e[22]=d):d=e[22];let r;e[23]!==d?(r=l("ul",{className:"flex flex-col gap-0.5",children:d}),e[23]=d,e[24]=r):r=e[24];let b;return e[25]!==c||e[26]!==r?(b=p("div",{className:"mt-3 flex flex-col gap-1","data-testid":"sc-editor-diagnostics",children:[c,r]}),e[25]=c,e[26]=r,e[27]=b):b=e[27],b};function xt(n){return l("li",{className:"font-mono text-[11px] text-destructive",children:n},n)}const vt=[{label:"string",validator:"v.string()"},{label:"number",validator:"v.number()"},{label:"boolean",validator:"v.boolean()"},{label:"bigint",validator:"v.int64()"},{label:"bytes",validator:"v.bytes()"},{label:"any",validator:"v.any()"}],yt="v.string()",Ct=n=>n.split(",").map(e=>e.trim()).filter(e=>e!==""),Nt=n=>{const e=Ne(83),{onApplied:m,tableNames:a}=n,t=Le(),s=at(),[c,d]=E(null),[r,b]=E(!1),[o,f]=E(null),[i,v]=E(""),[h,G]=E(""),[w,B]=E(yt),[y,z]=E(a[0]??""),[F,D]=E(""),[S,C]=E(""),[A,L]=E(!1);let me;e[0]===Symbol.for("react.memo_cache_sentinel")?(me=()=>{d(null),v(""),G(""),D(""),C(""),L(!1)},e[0]=me):me=e[0];const W=me;let I;e[1]!==m?(I=async T=>{b(!0),f(null);try{const pe=await pt(T);f(pe),pe.kind==="ok"&&(m(pe.tables),W())}catch(pe){const Ie=pe;f({kind:"error",message:Ie instanceof Error?Ie.message:String(Ie)})}b(!1)},e[1]=m,e[2]=I):I=e[2];const q=I;let _;e[3]!==q||e[4]!==i?(_=()=>{be(q({kind:"addTable",table:i.trim()}))},e[3]=q,e[4]=i,e[5]=_):_=e[5];const ue=_;let j;e[6]!==h||e[7]!==q||e[8]!==y||e[9]!==w?(j=()=>{be(q({column:h.trim(),kind:"addOptionalColumn",table:y,validator:w}))},e[6]=h,e[7]=q,e[8]=y,e[9]=w,e[10]=j):j=e[10];const ie=j;let Q;e[11]!==S||e[12]!==F||e[13]!==q||e[14]!==y||e[15]!==A?(Q=()=>{be(q({fields:Ct(S),kind:"addIndex",name:F.trim(),table:y,unique:A}))},e[11]=S,e[12]=F,e[13]=q,e[14]=y,e[15]=A,e[16]=Q):Q=e[16];const Y=Q;let xe;e[17]===Symbol.for("react.memo_cache_sentinel")?(xe=()=>{f(null),d("addTable")},e[17]=xe):xe=e[17];const H=xe;let re;e[18]===Symbol.for("react.memo_cache_sentinel")?(re=()=>{f(null),d("addColumn")},e[18]=re):re=e[18];const ve=re;let O;e[19]===Symbol.for("react.memo_cache_sentinel")?(O=()=>{f(null),d("addIndex")},e[19]=O):O=e[19];const Z=O;let ee;e[20]!==t?(ee=()=>{d("destructive"),f({kind:"needs-migration",message:t("This edit changes stored data and must go through a migration. Review the migration before applying.")})},e[20]=t,e[21]=ee):ee=e[21];const de=ee;let R;e[22]===Symbol.for("react.memo_cache_sentinel")?(R=T=>{v(T.target.value)},e[22]=R):R=e[22];const te=R;let M;e[23]===Symbol.for("react.memo_cache_sentinel")?(M=T=>{G(T.target.value)},e[23]=M):M=e[23];const ye=M;let ce;e[24]===Symbol.for("react.memo_cache_sentinel")?(ce=T=>{B(T.target.value)},e[24]=ce):ce=e[24];const fe=ce;let K;e[25]===Symbol.for("react.memo_cache_sentinel")?(K=T=>{z(T.target.value)},e[25]=K):K=e[25];const X=K;let U;e[26]===Symbol.for("react.memo_cache_sentinel")?(U=T=>{D(T.target.value)},e[26]=U):U=e[26];const le=U;let V;e[27]===Symbol.for("react.memo_cache_sentinel")?(V=T=>{C(T.target.value)},e[27]=V):V=e[27];const se=V;let $;e[28]===Symbol.for("react.memo_cache_sentinel")?($=T=>{L(T.target.checked)},e[28]=$):$=e[28];const ae=$;let ne;e[29]!==s?(ne=()=>{be(s({to:"/migrations"}))},e[29]=s,e[30]=ne):ne=e[30];const g=ne;let oe;e[31]!==t?(oe=t("Edit schema"),e[31]=t,e[32]=oe):oe=e[32];let J;e[33]!==oe?(J=l(ze,{children:oe}),e[33]=oe,e[34]=J):J=e[34];let Ce;e[35]!==t?(Ce=t("Adds a table, column, or index to lunora/schema.ts and reruns codegen."),e[35]=t,e[36]=Ce):Ce=e[36];let he;e[37]!==Ce?(he=l(qe,{children:Ce}),e[37]=Ce,e[38]=he):he=e[38];let u;e[39]!==J||e[40]!==he?(u=p(Be,{children:[J,he]}),e[39]=J,e[40]=he,e[41]=u):u=e[41];const N=a.length>0;let x;e[42]!==c||e[43]!==de||e[44]!==N?(x=l(gt,{hasTables:N,mode:c,onAddColumn:ve,onAddIndex:Z,onAddTable:H,onDestructive:de}),e[42]=c,e[43]=de,e[44]=N,e[45]=x):x=e[45];let P;e[46]!==r||e[47]!==c||e[48]!==ue||e[49]!==t||e[50]!==i?(P=c==="addTable"&&p("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-table-form",children:[p("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-table-name",children:t("Table name")}),l(ke,{"data-testid":"sc-editor-table-name",id:"sc-editor-table-name",onChange:te,value:i})]}),l(ge,{"data-testid":"sc-editor-table-apply",disabled:r||i.trim()==="",onClick:ue,size:"xs",type:"button",children:t(r?"Applying…":"Apply")}),l(ge,{onClick:W,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[46]=r,e[47]=c,e[48]=ue,e[49]=t,e[50]=i,e[51]=P):P=e[51];let k;e[52]!==r||e[53]!==h||e[54]!==c||e[55]!==ie||e[56]!==t||e[57]!==a||e[58]!==y||e[59]!==w?(k=c==="addColumn"&&p("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-column-form",children:[p("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-column-table",children:t("Table name")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-table",id:"sc-editor-column-table",onChange:X,value:y,children:a.map(Tt)})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-column-name",children:t("Column name")}),l(ke,{"data-testid":"sc-editor-column-name",id:"sc-editor-column-name",onChange:ye,value:h})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-column-type",children:t("Column type")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-column-type",id:"sc-editor-column-type",onChange:fe,value:w,children:vt.map(St)})]}),l("span",{className:"text-[11px] text-muted-foreground",children:t("Optional")}),l(ge,{"data-testid":"sc-editor-column-apply",disabled:r||h.trim()===""||y==="",onClick:ie,size:"xs",type:"button",children:t(r?"Applying…":"Apply")}),l(ge,{onClick:W,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[52]=r,e[53]=h,e[54]=c,e[55]=ie,e[56]=t,e[57]=a,e[58]=y,e[59]=w,e[60]=k):k=e[60];let Te;e[61]!==r||e[62]!==S||e[63]!==F||e[64]!==c||e[65]!==Y||e[66]!==t||e[67]!==a||e[68]!==y||e[69]!==A?(Te=c==="addIndex"&&p("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"sc-editor-index-form",children:[p("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-index-table",children:t("Table name")}),l("select",{className:"h-8 rounded-md border border-input bg-transparent px-2 text-xs","data-testid":"sc-editor-index-table",id:"sc-editor-index-table",onChange:X,value:y,children:a.map(wt)})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-index-name",children:t("Index name")}),l(ke,{"data-testid":"sc-editor-index-name",id:"sc-editor-index-name",onChange:le,value:F})]}),p("div",{className:"flex flex-col gap-1 text-xs",children:[l(_e,{htmlFor:"sc-editor-index-fields",children:t("Index fields (comma-separated)")}),l(ke,{"data-testid":"sc-editor-index-fields",id:"sc-editor-index-fields",onChange:se,value:S})]}),p(_e,{className:"flex items-center gap-1 text-xs",htmlFor:"sc-editor-index-unique",children:[l("input",{checked:A,"data-testid":"sc-editor-index-unique",id:"sc-editor-index-unique",onChange:ae,type:"checkbox"}),l("span",{className:"text-muted-foreground",children:t("Unique")})]}),l(ge,{"data-testid":"sc-editor-index-apply",disabled:r||F.trim()===""||S.trim()==="",onClick:Y,size:"xs",type:"button",children:t(r?"Applying…":"Apply")}),l(ge,{onClick:W,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[61]=r,e[62]=S,e[63]=F,e[64]=c,e[65]=Y,e[66]=t,e[67]=a,e[68]=y,e[69]=A,e[70]=Te):Te=e[70];let Se;e[71]!==g||e[72]!==o?(Se=l(bt,{onOpenMigrations:g,result:o}),e[71]=g,e[72]=o,e[73]=Se):Se=e[73];let we;e[74]!==x||e[75]!==P||e[76]!==k||e[77]!==Te||e[78]!==Se?(we=p(De,{children:[x,P,k,Te,Se]}),e[74]=x,e[75]=P,e[76]=k,e[77]=Te,e[78]=Se,e[79]=we):we=e[79];let Ee;return e[80]!==u||e[81]!==we?(Ee=p(je,{"data-testid":"sc-editor",size:"sm",children:[u,we]}),e[80]=u,e[81]=we,e[82]=Ee):Ee=e[82],Ee};function Tt(n){return l("option",{value:n,children:n},n)}function St(n){return l("option",{value:n.validator,children:n.label},n.validator)}function wt(n){return l("option",{value:n,children:n},n)}const Ve=[],_t=n=>{const e=Ne(5),{open:m}=n,a=m&&"rotate-90";let t;e[0]!==a?(t=Je("size-3.5 shrink-0 text-muted-foreground transition-transform duration-150",a),e[0]=a,e[1]=t):t=e[1];let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=l("path",{d:"m9 6 6 6-6 6"}),e[2]=s):s=e[2];let c;return e[3]!==t?(c=l("svg",{"aria-hidden":"true",className:t,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:s}),e[3]=t,e[4]=c):c=e[4],c},Ye=n=>{const e=Ne(20),{children:m,expanded:a,name:t,onToggle:s,rowCount:c,rowTestId:d,toggleTestId:r}=n;let b;e[0]!==a?(b=l(_t,{open:a}),e[0]=a,e[1]=b):b=e[1];let o;e[2]!==t?(o=l("span",{className:"truncate font-mono text-xs text-foreground",title:t,children:t}),e[2]=t,e[3]=o):o=e[3];let f;e[4]!==c?(f=p("span",{className:"ms-auto shrink-0 text-xs text-muted-foreground tabular-nums",children:["(",c,")"]}),e[4]=c,e[5]=f):f=e[5];let i;e[6]!==a||e[7]!==s||e[8]!==b||e[9]!==o||e[10]!==f||e[11]!==r?(i=p("button",{"aria-expanded":a,className:"flex w-full items-center gap-2 px-3 py-2 text-start transition-colors hover:bg-muted/50 aria-expanded:bg-muted/40","data-testid":r,onClick:s,type:"button",children:[b,o," ",f]}),e[6]=a,e[7]=s,e[8]=b,e[9]=o,e[10]=f,e[11]=r,e[12]=i):i=e[12];let v;e[13]!==m||e[14]!==a?(v=a&&l("div",{className:"px-3 pb-3 ps-8",children:m}),e[13]=m,e[14]=a,e[15]=v):v=e[15];let h;return e[16]!==d||e[17]!==i||e[18]!==v?(h=p("li",{className:"border-t border-border/60 first:border-t-0","data-testid":d,children:[i,v]}),e[16]=d,e[17]=i,e[18]=v,e[19]=h):h=e[19],h},He=n=>{const e=Ne(5),{columns:m,testId:a}=n;let t;e[0]!==m?(t=m.map(It),e[0]=m,e[1]=t):t=e[1];let s;return e[2]!==t||e[3]!==a?(s=l("ul",{className:"flex flex-wrap gap-1.5 pt-1","data-testid":a,children:t}),e[2]=t,e[3]=a,e[4]=s):s=e[4],s},Et=n=>{const e=Ne(10),{heading:m,indexes:a,testId:t}=n;let s;e[0]!==m?(s=l("p",{className:"mb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:m}),e[0]=m,e[1]=s):s=e[1];let c;e[2]!==a?(c=a.map(kt),e[2]=a,e[3]=c):c=e[3];let d;e[4]!==c||e[5]!==t?(d=l("ul",{className:"flex flex-col gap-1","data-testid":t,children:c}),e[4]=c,e[5]=t,e[6]=d):d=e[6];let r;return e[7]!==s||e[8]!==d?(r=p("div",{className:"pt-3",children:[s,d]}),e[7]=s,e[8]=d,e[9]=r):r=e[9],r},Xe=n=>Je("border-b-2 px-3 py-2 font-mono text-[11px] tracking-widest uppercase outline-none transition-colors",n?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),Wt=n=>{const e=Ne(85),{initialShardKey:m,initialTable:a,schemaEditable:t}=n,s=Le();let c;e[0]!==m||e[1]!==a?(c={initialShardKey:m,initialTable:a},e[0]=m,e[1]=a,e[2]=c):c=e[2];const{columns:d,diagramTables:r,error:b,expanded:o,filteredGlobalTables:f,filteredTables:i,globalColumns:v,globalError:h,globalExpanded:G,globalTables:w,indexes:B,refresh:y,setShardKey:z,setTableFilter:F,setView:D,shardColumnsError:S,shardKey:C,tableFilter:A,tables:L,toggle:me,toggleGlobal:W,view:I}=ct(c);let q;e[3]!==D?(q=()=>{D("list")},e[3]=D,e[4]=q):q=e[4];const _=q;let ue;e[5]!==D?(ue=()=>{D("graph")},e[5]=D,e[6]=ue):ue=e[6];const j=ue;let ie;e[7]!==F?(ie=g=>{F(g.target.value)},e[7]=F,e[8]=ie):ie=e[8];const Q=ie;let Y;e[9]!==y||e[10]!==C?(Y=g=>{be(y(C))},e[9]=y,e[10]=C,e[11]=Y):Y=e[11];const xe=Y;let H;e[12]!==L?(H=L??[],e[12]=L,e[13]=H):H=e[13];let re;e[14]!==H?(re=H.map(At),e[14]=H,e[15]=re):re=e[15];const ve=re;let O;e[16]!==z||e[17]!==C?(O=l(We,{onChange:z,testId:"sc-shard-input",value:C}),e[16]=z,e[17]=C,e[18]=O):O=e[18];let Z;e[19]!==s?(Z=s("Schema view"),e[19]=s,e[20]=Z):Z=e[20];const ee=I==="graph",de=I==="graph";let R;e[21]!==de?(R=Xe(de),e[21]=de,e[22]=R):R=e[22];let te;e[23]!==s?(te=s("Graph"),e[23]=s,e[24]=te):te=e[24];let M;e[25]!==j||e[26]!==ee||e[27]!==R||e[28]!==te?(M=l("button",{"aria-selected":ee,className:R,"data-testid":"sc-view-graph",onClick:j,role:"tab",type:"button",children:te}),e[25]=j,e[26]=ee,e[27]=R,e[28]=te,e[29]=M):M=e[29];const ye=I==="list",ce=I==="list";let fe;e[30]!==ce?(fe=Xe(ce),e[30]=ce,e[31]=fe):fe=e[31];let K;e[32]!==s?(K=s("Table list"),e[32]=s,e[33]=K):K=e[33];let X;e[34]!==_||e[35]!==ye||e[36]!==fe||e[37]!==K?(X=l("button",{"aria-selected":ye,className:fe,"data-testid":"sc-view-list",onClick:_,role:"tab",type:"button",children:K}),e[34]=_,e[35]=ye,e[36]=fe,e[37]=K,e[38]=X):X=e[38];let U;e[39]!==M||e[40]!==X||e[41]!==Z?(U=p("div",{"aria-label":Z,className:"flex items-center gap-1","data-testid":"sc-view-toggle",role:"tablist",children:[M,X]}),e[39]=M,e[40]=X,e[41]=Z,e[42]=U):U=e[42];let le;e[43]!==U||e[44]!==O?(le=p("div",{className:"flex flex-wrap items-center gap-3",children:[O,U]}),e[43]=U,e[44]=O,e[45]=le):le=e[45];let V;e[46]!==xe||e[47]!==t||e[48]!==ve?(V=t===!0&&l(Nt,{onApplied:xe,tableNames:ve}),e[46]=xe,e[47]=t,e[48]=ve,e[49]=V):V=e[49];let se;e[50]!==Q||e[51]!==s||e[52]!==A||e[53]!==I?(se=I==="list"&&l(ke,{"aria-label":s("Filter tables"),className:"h-8 max-w-xs","data-testid":"sc-filter",onChange:Q,placeholder:s("Filter tables"),value:A}),e[50]=Q,e[51]=s,e[52]=A,e[53]=I,e[54]=se):se=e[54];let $;e[55]!==r||e[56]!==b||e[57]!==h||e[58]!==S||e[59]!==C||e[60]!==I?($=I==="graph"&&p("div",{className:"flex flex-col gap-2","data-testid":"sc-graph-view",children:[b!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:b}),h!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:h}),l(st,{columnsError:S[C]===!0,tables:r,testIdPrefix:"sc-graph"})]}),e[55]=r,e[56]=b,e[57]=h,e[58]=S,e[59]=C,e[60]=I,e[61]=$):$=e[61];let ae;e[62]!==d||e[63]!==b||e[64]!==o||e[65]!==f||e[66]!==i||e[67]!==v||e[68]!==h||e[69]!==G||e[70]!==w||e[71]!==B||e[72]!==C||e[73]!==s||e[74]!==L||e[75]!==me||e[76]!==W||e[77]!==I?(ae=I==="list"&&p("div",{className:"flex flex-col gap-4",children:[p(je,{"data-testid":"sc-shard-section",size:"sm",children:[p(Be,{children:[p("div",{className:"flex items-center gap-2",children:[l(Re,{tier:"shard"}),l(ze,{children:s("Shard tables")}),L!==null&&l(Fe,{className:"ms-auto tabular-nums",variant:"outline",children:i.length})]}),l(qe,{children:Pe.shard.hint})]}),p(De,{children:[b!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-error",role:"alert",children:b}),L!==null&&L.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-empty",children:s("No tables in this shard.")}),L!==null&&L.length>0&&i.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-no-match",children:s("No tables match your filter.")}),i.length>0&&l("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-table-list",children:i.map(g=>{const oe=`${C}:${g.name}`,J=B[oe]??[];return p(Ye,{expanded:o===g.name,name:g.name,onToggle:()=>{be(me(g.name))},rowCount:g.rowCount,rowTestId:`sc-table-${g.name}`,toggleTestId:`sc-toggle-${g.name}`,children:[l(He,{columns:d[oe]??Ve,testId:`sc-columns-${g.name}`}),J.length>0&&l(Et,{heading:s("Indexes"),indexes:J,testId:`sc-indexes-${g.name}`})]},g.name)})})]})]}),p(je,{"data-testid":"sc-global-section",size:"sm",children:[p(Be,{children:[p("div",{className:"flex items-center gap-2",children:[l(Re,{tier:"global"}),l(ze,{children:s("Global tables (D1)")}),w!==null&&l(Fe,{className:"ms-auto tabular-nums",variant:"outline",children:f.length})]}),l(qe,{children:Pe.global.hint})]}),p(De,{children:[h!==null&&l("p",{className:"text-sm text-destructive","data-testid":"sc-global-error",role:"alert",children:h}),w!==null&&w.length===0&&l(Qe,{description:Pe.global.hint,testId:"sc-global-empty",title:s("No global tables.")}),w!==null&&w.length>0&&f.length===0&&l("p",{className:"text-sm text-muted-foreground","data-testid":"sc-global-no-match",children:s("No tables match your filter.")}),f.length>0&&l("ul",{className:"-mx-3 overflow-hidden border-t border-border","data-testid":"sc-global-table-list",children:f.map(g=>l(Ye,{expanded:G===g.name,name:g.name,onToggle:()=>{be(W(g.name))},rowCount:g.rowCount,rowTestId:`sc-global-table-${g.name}`,toggleTestId:`sc-global-toggle-${g.name}`,children:l(He,{columns:v[g.name]??Ve,testId:`sc-global-columns-${g.name}`})},g.name))})]})]})]}),e[62]=d,e[63]=b,e[64]=o,e[65]=f,e[66]=i,e[67]=v,e[68]=h,e[69]=G,e[70]=w,e[71]=B,e[72]=C,e[73]=s,e[74]=L,e[75]=me,e[76]=W,e[77]=I,e[78]=ae):ae=e[78];let ne;return e[79]!==le||e[80]!==V||e[81]!==se||e[82]!==$||e[83]!==ae?(ne=p("div",{className:"flex flex-col gap-4","data-testid":"lunora-schema",children:[le,V,se,$,ae]}),e[79]=le,e[80]=V,e[81]=se,e[82]=$,e[83]=ae,e[84]=ne):ne=e[84],ne};function It(n){return l("li",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:n},n)}function kt(n){return p("li",{className:"flex flex-wrap items-center gap-1.5 text-xs",children:[l("span",{className:"font-mono",children:n.name}),l(Fe,{variant:"outline",children:n.type}),n.unique===!0&&l(Fe,{variant:"secondary",children:"unique"}),l("span",{className:"text-muted-foreground",children:n.fields.join(", ")})]},`${n.type}:${n.name}`)}function At(n){return n.name}export{Wt as SchemaViewer};
@@ -1 +0,0 @@
1
- import{c as u}from"react/compiler-runtime";import{u as m}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useT as h}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as p}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{A as R}from"../packem_shared/advisor-view-C1KFTXSH.js";import{jsx as g}from"react/jsx-runtime";const f=(e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("Live admin subscriptions are ungated")})[s.kind],k=e=>Array.isArray(e.findings)?e.findings:[],S=e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],A=(e,s)=>({"admin-token-weak":e("Your admin token is {length} characters — use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters — use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed — browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: live admin subscriptions need no credential. Set it to gate them like the HTTP admin RPCs.")})[s.kind],y=()=>{const e=u(8),s=h();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];const{data:r,error:n,errorSource:d}=m(p.getSecurityAudit,i);let a;if(e[1]!==r||e[2]!==s){const l=r===void 0?null:k(r);a=l===null?null:l.map(t=>({description:A(s,t),entity:S(t),issueType:f(s,t),key:t.kind,level:t.level})),e[1]=r,e[2]=s,e[3]=a}else a=e[3];const c=a;let o;return e[4]!==n||e[5]!==d||e[6]!==c?(o=g(R,{error:n,errorSource:d,rows:c,testId:"lunora-security-advisor"}),e[4]=n,e[5]=d,e[6]=c,e[7]=o):o=e[7],o};export{y as default};
@@ -1 +0,0 @@
1
- import{c as G}from"react/compiler-runtime";import{E as X}from"../packem_shared/error-alert-TYdKetJd.js";import{B as Y}from"../packem_shared/badge-cAk9Di1Q.js";import{C as M,a as P}from"../packem_shared/card-BGlQzQY-.js";import{T as Z,a as ee,b as J,c as Q,d as te,e as W}from"../packem_shared/table-BMsuYFhk.js";import{u as re}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useT as se}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as le}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{C as ne}from"../packem_shared/cf-links-CBJ5SywP.js";import{r as ae,u as ie,s as oe}from"../packem_shared/shortcuts-lH4Vaqjc.js";import{jsxs as d,jsx as r}from"react/jsx-runtime";const de={binding:"outline",secret:"destructive",var:"secondary"},ce=(s,e)=>{if(s===void 0)return[];const u=[];return s.workerUrl!==void 0&&u.push({label:e("URL"),value:s.workerUrl}),s.environment!==void 0&&u.push({label:e("Environment"),value:s.environment}),s.deploymentId!==void 0&&u.push({label:e("Deployment"),value:s.deploymentId}),s.versionTag!==void 0&&u.push({label:e("Version"),value:s.versionTag}),u},z=s=>{const e=G(18),{modifier:u,name:t,label:p}=s,F=ie();let b;e[0]!==t?(b=a=>{if(!["Escape","Tab"].includes(a.key)){if(a.shiftKey){a.preventDefault();return}a.preventDefault(),oe(t,a.key)}},e[0]=t,e[1]=b):b=e[1];const c=b,m=`set-shortcut-${t}`;let f;e[2]!==p?(f=r("dt",{className:"text-muted-foreground",children:p}),e[2]=p,e[3]=f):f=e[3];let h;e[4]!==u?(h=r("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:u}),e[4]=u,e[5]=h):h=e[5];const n=`set-shortcut-input-${t}`,x=F[t];let i;e[6]!==p||e[7]!==c||e[8]!==n||e[9]!==x?(i=r("input",{"aria-label":p,className:"h-7 w-12 rounded-md border border-border bg-background text-center font-mono text-xs uppercase outline-none focus-visible:border-ring","data-testid":n,onKeyDown:c,readOnly:!0,value:x}),e[6]=p,e[7]=c,e[8]=n,e[9]=x,e[10]=i):i=e[10];let l;e[11]!==h||e[12]!==i?(l=d("dd",{className:"flex items-center gap-1.5",children:[h,i]}),e[11]=h,e[12]=i,e[13]=l):l=e[13];let o;return e[14]!==m||e[15]!==f||e[16]!==l?(o=d("div",{className:"contents","data-testid":m,children:[f,l]}),e[14]=m,e[15]=f,e[16]=l,e[17]=o):o=e[17],o},Ce=s=>{const e=G(85),{initialShardKey:u}=s,t=se();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];const F=u??"";let b;e[1]!==F?(b={shardKey:F},e[1]=F,e[2]=b):b=e[2];const{data:c,error:m,errorSource:f,isLoading:h}=re(le.getSettings,p,b);let n,x,i,l,o,a,g;if(e[3]!==m||e[4]!==f||e[5]!==c?.deploy||e[6]!==c?.settings||e[7]!==t){const q=ce(c?.deploy,t);let H;e[15]!==c?.settings?(H=c?.settings??[],e[15]=c?.settings,e[16]=H):H=e[16],n=H,x="flex flex-col gap-4",i="lunora-settings";let j;e[17]!==t?(j=t("Open in Cloudflare"),e[17]=t,e[18]=j):j=e[18],e[19]!==j?(l=r("div",{className:"flex flex-wrap items-center gap-3",children:r("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:ne,rel:"noreferrer",target:"_blank",children:j})}),e[19]=j,e[20]=l):l=e[20];let B;e[21]!==t?(B=t("View-only — values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=t,e[22]=B):B=e[22],e[23]!==B?(o=r("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:B}),e[23]=B,e[24]=o):o=e[24],e[25]!==m||e[26]!==f?(a=m!==null&&r(X,{error:f,testId:"set-error"}),e[25]=m,e[26]=f,e[27]=a):a=e[27],g=q.length>0&&d(M,{className:"py-0","data-testid":"set-deploy",children:[r("header",{className:"border-b border-border px-4 py-3",children:r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")})}),r(P,{className:"py-3",children:r("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:q.map(me)})})]}),e[3]=m,e[4]=f,e[5]=c?.deploy,e[6]=c?.settings,e[7]=t,e[8]=n,e[9]=x,e[10]=i,e[11]=l,e[12]=o,e[13]=a,e[14]=g}else n=e[8],x=e[9],i=e[10],l=e[11],o=e[12],a=e[13],g=e[14];let N;e[28]!==t?(N=t("Keyboard shortcuts"),e[28]=t,e[29]=N):N=e[29];let v;e[30]!==N?(v=r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:N}),e[30]=N,e[31]=v):v=e[31];let y;e[32]!==t?(y=t("Reset"),e[32]=t,e[33]=y):y=e[33];let k;e[34]!==y?(k=r("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"set-shortcut-reset",onClick:ae,type:"button",children:y}),e[34]=y,e[35]=k):k=e[35];let w;e[36]!==v||e[37]!==k?(w=d("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[v,k]}),e[36]=v,e[37]=k,e[38]=w):w=e[38];let C;e[39]!==t?(C=t("Command palette"),e[39]=t,e[40]=C):C=e[40];let T;e[41]!==C?(T=r(z,{label:C,modifier:"⌘/Ctrl",name:"palette"}),e[41]=C,e[42]=T):T=e[42];let S;e[43]!==t?(S=t("Operation console"),e[43]=t,e[44]=S):S=e[44];let R;e[45]!==S?(R=r(z,{label:S,modifier:"Ctrl",name:"console"}),e[45]=S,e[46]=R):R=e[46];let _;e[47]!==T||e[48]!==R?(_=d("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[T,R]}),e[47]=T,e[48]=R,e[49]=_):_=e[49];let D;e[50]!==t?(D=t("Stored in this browser. Focus a box and press a key to rebind it."),e[50]=t,e[51]=D):D=e[51];let E;e[52]!==D?(E=r("p",{className:"pt-3 text-xs text-muted-foreground",children:D}),e[52]=D,e[53]=E):E=e[53];let I;e[54]!==_||e[55]!==E?(I=d(P,{className:"py-3",children:[_,E]}),e[54]=_,e[55]=E,e[56]=I):I=e[56];let K;e[57]!==w||e[58]!==I?(K=d(M,{className:"py-0","data-testid":"set-preferences",children:[w,I]}),e[57]=w,e[58]=I,e[59]=K):K=e[59];let A;e[60]!==t?(A=t("Environment & bindings"),e[60]=t,e[61]=A):A=e[61];let O;e[62]!==A?(O=r("header",{className:"border-b border-border px-4 py-3",children:r("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:A})}),e[62]=A,e[63]=O):O=e[63];let U;e[64]!==m||e[65]!==h||e[66]!==n.length||e[67]!==t?(U=m===null&&!h&&n.length===0&&r("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")}),e[64]=m,e[65]=h,e[66]=n.length,e[67]=t,e[68]=U):U=e[68];let L;e[69]!==n||e[70]!==t?(L=n.length>0&&r(P,{className:"px-0 py-0",children:d(Z,{"data-testid":"set-table",children:[r(ee,{children:d(J,{children:[r(Q,{children:t("name")}),r(Q,{children:t("kind")}),r(Q,{children:t("value")})]})}),r(te,{children:n.map(fe)})]})}),e[69]=n,e[70]=t,e[71]=L):L=e[71];let $;e[72]!==O||e[73]!==U||e[74]!==L?($=d(M,{className:"py-0",children:[O,U,L]}),e[72]=O,e[73]=U,e[74]=L,e[75]=$):$=e[75];let V;return e[76]!==K||e[77]!==$||e[78]!==x||e[79]!==i||e[80]!==l||e[81]!==o||e[82]!==a||e[83]!==g?(V=d("div",{className:x,"data-testid":i,children:[l,o,a,g,K,$]}),e[76]=K,e[77]=$,e[78]=x,e[79]=i,e[80]=l,e[81]=o,e[82]=a,e[83]=g,e[84]=V):V=e[84],V};function me(s){return d("div",{className:"contents","data-testid":"set-deploy-row",children:[r("dt",{className:"text-muted-foreground",children:s.label}),r("dd",{className:"truncate font-mono text-xs",title:s.value,children:s.value})]},s.label)}function fe(s){return d(J,{"data-testid":"set-row",children:[r(W,{className:"font-mono text-xs font-medium",children:s.name}),r(W,{children:r(Y,{variant:de[s.kind],children:s.bindingType??s.kind})}),r(W,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:s.value??r("span",{className:"text-muted-foreground",children:"—"})})]},s.name)}export{Ce as SettingsPanel};
@@ -1 +0,0 @@
1
- import{c as V}from"react/compiler-runtime";import{useLunora as k}from"@lunora/react";import{useNavigate as F,useRouter as L,useSearch as M}from"@tanstack/react-router";import{useState as Q,useEffect as A}from"react";import{T as w}from"../packem_shared/storage-tier-C2mKwYRj.js";import{u as P}from"../packem_shared/table-list-sidebar-BWq_-gtu.js";import{useT as q}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{s as J,d as D}from"../packem_shared/data-view-params-qoSTqjAj.js";import{f}from"../packem_shared/internal-CwaF9YNk.js";import{l as K,s as O}from"../packem_shared/browser-storage-BH1MxLZs.js";import{DataBrowser as I}from"../packem_shared/DataBrowser-W5TxvLB8.js";import{GlobalDataBrowser as X}from"../packem_shared/GlobalDataBrowser-LFznuyGe.js";import{jsx as v,jsxs as E}from"react/jsx-runtime";const N="lunora-studio-saved-queries",Y=50,$=r=>r!==null&&typeof r=="object"&&typeof r.name=="string"&&typeof r.view=="object"&&r.view!==null,S=()=>K(N).filter($),B=r=>{O(N,r)},z=(r,e)=>{const s=r.trim();if(s==="")return S();const o=[{name:s,view:e},...S().filter(b=>b.name!==s)].slice(0,Y);return B(o),o},H=r=>{const e=S().filter(s=>s.name!==r);return B(e),e},U=r=>{const e=V(15),{onChange:s,tier:o}=r,b=q();let d;e[0]!==s?(d=y=>{s(y.target.value)},e[0]=s,e[1]=d):d=e[1];const l=d;let h;e[2]!==b?(h=b("Storage tier"),e[2]=b,e[3]=h):h=e[3];let i;e[4]!==h?(i=v("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:h}),e[4]=h,e[5]=i):i=e[5];const m=w[o];let n,g;e[6]===Symbol.for("react.memo_cache_sentinel")?(n=v("option",{value:"shard",children:w.shard.label}),g=v("option",{value:"global",children:w.global.label}),e[6]=n,e[7]=g):(n=e[6],g=e[7]);let c;e[8]!==l||e[9]!==m.title||e[10]!==o?(c=E("select",{className:"h-8 w-full rounded-md border border-border bg-background px-2 text-sm outline-none focus-visible:border-ring","data-testid":"table-editor-schema",id:"table-editor-schema",onChange:l,title:m.title,value:o,children:[n,g]}),e[8]=l,e[9]=m.title,e[10]=o,e[11]=c):c=e[11];let u;return e[12]!==i||e[13]!==c?(u=E("label",{className:"flex w-full flex-col gap-1",htmlFor:"table-editor-schema",children:[i,c]}),e[12]=i,e[13]=c,e[14]=u):u=e[14],u},W=()=>{try{f(globalThis.navigator.clipboard.writeText(globalThis.location.href))}catch{}},pe=({editable:r=!1,initialShardKey:e})=>{const s=k(),o=F(),b=L(),d=M({strict:!1}),l=J(d),h=P(d),i=()=>b.state.location.pathname.split("/").findLast(Boolean)==="data",m=l.tier??"shard",n=l.table,[g,c]=Q(()=>S()),[u,y]=Q(()=>new Set);A(()=>{f((async()=>{try{const a=await s.listGlobalTables();y(new Set(a.map(t=>t.name)))}catch{}})())},[s]),A(()=>{m==="shard"&&n!==void 0&&u.has(n)&&f(o({replace:!0,search:a=>({...a,schema:"global"}),to:"/data"}))},[u,o,n,m]);const R=a=>{f(o({search:t=>({...t,schema:a==="global"?"global":void 0,table:void 0}),to:"/data"}))},T=(a,t)=>{i()&&f(o({search:p=>({schema:p.schema,search:t?.search,shard:p.shard,table:a}),to:"/data"}))},C=a=>{f(o({search:t=>({...t,schema:"global",table:a}),to:"/data"}))},G=a=>{const t=D(a),{current:p}=h;(p.filters??void 0)===t.filters&&(p.order??void 0)===t.order&&(p.search??void 0)===t.search&&(p.shard??void 0)===t.shard||!i()||f(o({replace:!0,search:j=>({...j,filters:t.filters,order:t.order,search:t.search,shard:t.shard}),to:"/data"}))},_={onApplyQuery:a=>{const t=D(a.view);f(o({search:()=>({filters:t.filters,order:t.order,schema:t.schema,search:t.search,shard:t.shard,table:t.table}),to:"/data"}))},onCopyLink:W,onDeleteQuery:a=>{c(H(a))},onSaveQuery:(a,t)=>{c(z(a,t))},saved:g},x=v(U,{onChange:R,tier:m});return m==="global"?v(X,{initialTable:n,onSelectTable:T,schemaSwitch:x}):v(I,{editable:r,globalTableNames:u,initialFilters:l.filters,initialOrderBy:l.orderBy,initialPins:d.pins,initialSearch:l.search,initialShardKey:l.shard??e,onNavigateToGlobal:C,onSelectTable:T,onViewChange:G,queryBar:_,schemaSwitch:x,tableParam:n})};export{pe as TableEditor};
@@ -1 +0,0 @@
1
- import{useState as Y}from"react";import{E as I}from"../packem_shared/error-alert-TYdKetJd.js";import{B as N}from"../packem_shared/badge-cAk9Di1Q.js";import{B as q}from"../packem_shared/button-BOPLD1un.js";import{C as R,a as $}from"../packem_shared/card-BGlQzQY-.js";import{E as j}from"../packem_shared/empty-state-B939z6K2.js";import{T as K,a as L,b as p,c as o,d as P,e as d}from"../packem_shared/table-BMsuYFhk.js";import{u as f}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useT as Z}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as x}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{i as ee}from"../packem_shared/internal-CwaF9YNk.js";import{jsx as e,jsxs as l}from"react/jsx-runtime";const D="agent_threads",te="agent_messages",M="agent_run_queue",H=100,ae=250,se={},re={filters:[],limit:H,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:D},i=(r,t)=>{const s=r[t];return typeof s=="string"?s:void 0},A=(r,t)=>{const s=r[t];return typeof s=="number"?s:void 0},U=r=>{const{usage:t}=r;if(t===null||typeof t!="object")return;const{totalTokens:s}=t;return typeof s=="number"?s:void 0},ne=r=>{const{toolCalls:t}=r;return Array.isArray(t)?t.map(s=>s!==null&&typeof s=="object"?s.name:void 0).filter(s=>typeof s=="string"):[]},oe=r=>{switch(r){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},de=r=>{switch(r){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},be=({initialShardKey:r=""})=>{const t=Z(),[s,T]=Y(void 0),{data:c}=f(x.listTables,se,{live:!0,shardKey:r}),G=c!==void 0,m=Array.isArray(c)&&c.some(a=>a.name===D),Q=Array.isArray(c)&&c.some(a=>a.name===M),{data:E,error:_,errorSource:z,liveError:O}=f(x.readTablePage,re,{enabled:m,live:!0,shardKey:r}),V={filters:[{column:"threadKey",operator:"eq",value:s??""}],limit:ae,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:te},{data:S}=f(x.readTablePage,{limit:H,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:M},{enabled:Q,live:!0,shardKey:r}),{data:k,error:F,errorSource:J}=f(x.readTablePage,V,{enabled:m&&s!==void 0,live:!0,shardKey:r}),v=Array.isArray(E?.rows)?E.rows:[],W=Array.isArray(S?.rows)?S.rows:[],w=a=>W.filter(n=>i(n,"threadKey")===a).length,C=Array.isArray(k?.rows)?k.rows:[],B=v.find(a=>i(a,"key")===s);let h;return G&&!m?h=e(j,{description:t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),testId:"agents-unconfigured",title:t("No agents configured")}):m&&v.length===0?h=e(j,{description:t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),testId:"agents-empty",title:t("No agent threads yet")}):h=l("div",{className:"flex flex-col gap-6",children:[e(R,{className:"overflow-hidden py-0",children:e($,{className:"px-0",children:l(K,{"data-testid":"agents-threads-table",children:[e(L,{children:l(p,{children:[e(o,{children:t("Agent")}),e(o,{children:t("Key")}),e(o,{children:t("Status")}),e(o,{children:t("Queued")}),e(o,{children:t("Messages")}),e(o,{children:t("Tokens")}),e(o,{children:t("Updated")}),e(o,{"aria-label":t("Actions")})]})}),e(P,{children:v.map(a=>{const n=i(a,"key")??"",u=i(a,"status"),g=U(a);return l(p,{"data-active":n===s?"":void 0,"data-testid":`agents-thread-${n}`,children:[e(d,{className:"font-mono text-xs",children:i(a,"agent")??"—"}),e(d,{className:"font-mono text-xs text-muted-foreground",children:n}),e(d,{children:e(N,{"data-testid":`agents-thread-status-${n}`,variant:oe(u),children:u??"—"})}),e(d,{className:"tabular-nums",children:w(n)===0?e("span",{className:"text-muted-foreground",children:"—"}):e(N,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:w(n)})}),e(d,{className:"tabular-nums",children:A(a,"messageCount")??"—"}),e(d,{className:"tabular-nums text-muted-foreground",children:g??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:ee(A(a,"updatedAt"),"—")}),e(d,{className:"text-right",children:e(q,{"data-testid":`agents-thread-open-${n}`,onClick:()=>{T(n)},size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),F!==null&&e(I,{error:J,testId:"agents-messages-error"}),s!==void 0&&e(R,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:l($,{className:"flex flex-col gap-3 px-4 py-3",children:[l("div",{className:"flex items-center justify-between gap-2",children:[l("span",{className:"font-mono text-xs",children:[t("Timeline")," · ",s,B!==void 0&&l("span",{className:"text-muted-foreground",children:[" · ",t("Usage"),": ",U(B)??0," ",t("Tokens")]})]}),e(q,{"data-testid":"agents-thread-detail-close",onClick:()=>{T(void 0)},size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),C.length===0?e("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):l(K,{"data-testid":"agents-messages-table",children:[e(L,{children:l(p,{children:[e(o,{children:t("Role")}),e(o,{children:t("Content")}),e(o,{children:t("Tool")}),e(o,{children:t("Approval")})]})}),e(P,{children:C.map((a,n)=>{const u=i(a,"role")??"—",g=ne(a),X=i(a,"toolName"),y=i(a,"status"),b=A(a,"seq")??n;return l(p,{"data-testid":`agents-message-${String(b)}`,children:[e(d,{className:"font-mono text-xs align-top text-muted-foreground",children:u}),e(d,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:i(a,"content")??"—"}),e(d,{className:"font-mono text-xs align-top text-muted-foreground",children:X??(g.length>0?g.join(", "):"—")}),e(d,{className:"align-top",children:y===void 0?e("span",{className:"text-xs text-muted-foreground",children:"—"}):e(N,{"data-testid":`agents-message-approval-${String(b)}`,variant:de(y),children:y})})]},i(a,"messageKey")??`${u}:${String(b)}`)})})]})]})})]}),l("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[_!==null&&e(I,{error:z,testId:"agents-error"}),e("p",{className:"text-sm text-muted-foreground",children:t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")}),O!==void 0&&e("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"agents-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")}),h]})};export{be as default};
@@ -1 +0,0 @@
1
- import{c as g}from"react/compiler-runtime";import{createAnalyticsSqlClient as L}from"@lunora/bindings/analytics";import{useState as C,useMemo as I,useCallback as k,useEffect as N}from"react";import{C as _}from"../packem_shared/card-BGlQzQY-.js";import{E as v}from"../packem_shared/empty-state-B939z6K2.js";import{T as O,a as D,b,d as M,e as q,c as w}from"../packem_shared/table-BMsuYFhk.js";import{useT as x}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{b as B,f as P,h as U}from"../packem_shared/internal-CwaF9YNk.js";import{jsx as n,jsxs as A}from"react/jsx-runtime";const F="ANALYTICS",T=[{key:"volume",sql:r=>`SELECT blob2 AS fn, count() AS calls FROM ${r} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,title:"Request volume per function"},{key:"latency",sql:r=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${r} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,title:"Latency p50 / p95 per function"},{key:"hotShards",sql:r=>`SELECT blob3 AS shard, count() AS calls FROM ${r} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,title:"Hot shards"}],Y={error:null,loading:!0,result:null},H=r=>{const e=g(27),{state:h,title:u}=r,c=x(),{error:a,loading:t,result:s}=h,l=`analytics-panel-${u}`;let o;e[0]!==c||e[1]!==u?(o=c(u),e[0]=c,e[1]=u,e[2]=o):o=e[2];let i;e[3]!==o?(i=n("header",{className:"border-b border-border px-4 py-3",children:n("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[3]=o,e[4]=i):i=e[4];let d;e[5]!==t||e[6]!==c?(d=t&&n("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:c("Loading…")}),e[5]=t,e[6]=c,e[7]=d):d=e[7];let m;e[8]!==a||e[9]!==t?(m=!t&&a!==null&&n("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:a}),e[8]=a,e[9]=t,e[10]=m):m=e[10];let p;e[11]!==a||e[12]!==t||e[13]!==s||e[14]!==c?(p=!t&&a===null&&s!==null&&s.rows.length===0&&n("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:c("No data points yet.")}),e[11]=a,e[12]=t,e[13]=s,e[14]=c,e[15]=p):p=e[15];let f;e[16]!==a||e[17]!==t||e[18]!==s?(f=!t&&a===null&&s!==null&&s.rows.length>0&&A(O,{children:[n(D,{children:n(b,{children:s.columns.map(W)})}),n(M,{children:s.rows.map((S,R)=>n(b,{children:s.columns.map(E=>n(q,{className:"font-mono text-xs",children:U(S[E.name])},E.name))},R))})]}),e[16]=a,e[17]=t,e[18]=s,e[19]=f):f=e[19];let y;return e[20]!==l||e[21]!==i||e[22]!==d||e[23]!==m||e[24]!==p||e[25]!==f?(y=A(_,{className:"gap-0 py-0","data-testid":l,children:[i,d,m,p,f]}),e[20]=l,e[21]=i,e[22]=d,e[23]=m,e[24]=p,e[25]=f,e[26]=y):y=e[26],y},Q=({config:r,dataset:e=F,runQuery:h}={})=>{const u=x(),[c,a]=C({}),t=I(()=>{if(h!==void 0)return h;if(r===void 0)return null;const l=L({accountId:r.accountId,apiToken:r.apiToken});return o=>l.query(o)},[r,h]),s=k(async l=>{if(t!==null)for(const o of T){if(l.cancelled)return;a(i=>({...i,[o.key]:{error:null,loading:!0,result:null}}));try{const i=await t(o.sql(e));l.cancelled||a(d=>({...d,[o.key]:{error:null,loading:!1,result:i}}))}catch(i){l.cancelled||a(d=>({...d,[o.key]:{error:B(i),loading:!1,result:null}}))}}},[t,e]);return N(()=>{const l={cancelled:!1};return P(s(l)),()=>{l.cancelled=!0}},[s]),t===null?n(v,{description:u("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:n("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:n("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"})}),testId:"analytics-not-configured",title:u("Analytics is not configured.")}):n("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:T.map(l=>n(H,{state:c[l.key]??Y,title:l.title},l.key))})};function W(r){return n(w,{children:r.name},r.name)}export{Q as AnalyticsPanel};
@@ -1 +0,0 @@
1
- import{c as R}from"react/compiler-runtime";import{useState as k}from"react";import{E as q}from"../packem_shared/error-alert-TYdKetJd.js";import{B as j}from"../packem_shared/badge-cAk9Di1Q.js";import{B as z}from"../packem_shared/button-BOPLD1un.js";import{C as D,a as M}from"../packem_shared/card-BGlQzQY-.js";import{E as O}from"../packem_shared/empty-state-B939z6K2.js";import{I as Q}from"../packem_shared/input-CY5W3wzv.js";import{T as U,a as $,b as F,c as N,d as G,e as w}from"../packem_shared/table-BMsuYFhk.js";import{u as J}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useT as K}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as V}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{i as W}from"../packem_shared/internal-CwaF9YNk.js";import{jsx as a,jsxs as l}from"react/jsx-runtime";const ne=()=>{const e=R(39),t=K(),[o,H]=k("");let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];const{data:L,error:i,errorSource:S,isLoading:E,refetch:B}=J(V.getAuthAuditLog,b);let A;if(e[1]!==L?.entries||e[2]!==o){const r=L?.entries??[],x=o.trim().toLowerCase();A=x===""?r:r.filter(C=>C.event.toLowerCase().includes(x)||(C.actorId??"").toLowerCase().includes(x)||(C.actorEmail??"").toLowerCase().includes(x)||(C.ip??"").toLowerCase().includes(x)||C.outcome.toLowerCase().includes(x)),e[1]=L?.entries,e[2]=o,e[3]=A}else A=e[3];const s=A;let I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I=r=>{H(r.target.value)},e[4]=I):I=e[4];const P=I;let c;e[5]!==t?(c=t("Filter security events"),e[5]=t,e[6]=c):c=e[6];let n;e[7]!==t?(n=t("filter event, actor, IP"),e[7]=t,e[8]=n):n=e[8];let d;e[9]!==o||e[10]!==c||e[11]!==n?(d=a(Q,{"aria-label":c,className:"h-8 w-56","data-testid":"aa-search",onChange:P,placeholder:n,value:o}),e[9]=o,e[10]=c,e[11]=n,e[12]=d):d=e[12];let m;e[13]!==B?(m=()=>{B()},e[13]=B,e[14]=m):m=e[14];let u;e[15]!==t?(u=t("Refresh"),e[15]=t,e[16]=u):u=e[16];let h;e[17]!==m||e[18]!==u?(h=a(z,{"data-testid":"aa-refresh",onClick:m,size:"xs",type:"button",variant:"ghost",children:u}),e[17]=m,e[18]=u,e[19]=h):h=e[19];let f;e[20]!==d||e[21]!==h?(f=l("div",{className:"flex flex-wrap items-center gap-2",children:[d,h]}),e[20]=d,e[21]=h,e[22]=f):f=e[22];let p;e[23]!==i||e[24]!==S?(p=i!==null&&a(q,{error:S,testId:"aa-error"}),e[23]=i,e[24]=S,e[25]=p):p=e[25];let g;e[26]!==i||e[27]!==s.length||e[28]!==E||e[29]!==t?(g=i===null&&!E&&s.length===0&&a(O,{description:t("Authentication and security events are recorded here."),testId:"aa-empty",title:t("No security events.")}),e[26]=i,e[27]=s.length,e[28]=E,e[29]=t,e[30]=g):g=e[30];let v;e[31]!==s||e[32]!==t?(v=s.length>0&&a(D,{className:"overflow-hidden py-0",children:a(M,{className:"max-h-[30rem] overflow-auto px-0",children:l(U,{"data-testid":"aa-table",children:[a($,{children:l(F,{children:[a(N,{children:t("time")}),a(N,{children:t("event")}),a(N,{children:t("actor")}),a(N,{children:t("ip / user agent")}),a(N,{children:t("outcome")})]})}),a(G,{children:s.map(r=>l(F,{"data-testid":"aa-row",children:[a(w,{className:"text-muted-foreground tabular-nums",children:W(r.ts,"—")}),a(w,{children:a(j,{variant:"secondary",children:r.event})}),a(w,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??a("span",{className:"text-muted-foreground",children:"—"})}),l(w,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??a("span",{className:"text-muted-foreground",children:"—"}),r.userAgent!==void 0&&l("span",{className:"ml-1 opacity-70",children:["· ",r.userAgent]})]}),a(w,{children:a(j,{variant:r.outcome==="failure"?"destructive":"outline",children:t(r.outcome)})})]},r.seq))})]})})}),e[31]=s,e[32]=t,e[33]=v):v=e[33];let T;return e[34]!==p||e[35]!==g||e[36]!==v||e[37]!==f?(T=l("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[f,p,g,v]}),e[34]=p,e[35]=g,e[36]=v,e[37]=f,e[38]=T):T=e[38],T};export{ne as default};
@@ -1 +0,0 @@
1
- import{c as N}from"react/compiler-runtime";import{useLunora as C}from"@lunora/react";import{B as x}from"../packem_shared/badge-cAk9Di1Q.js";import{C as w,a as I}from"../packem_shared/card-BGlQzQY-.js";import{b as A}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useT as $}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{jsx as t,jsxs as d,Fragment as y}from"react/jsx-runtime";const S=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=e=>{if(e===void 0)return"—";const i=[[86400,"d"],[3600,"h"],[60,"m"]];for(const[a,o]of i)if(e>=a&&e%a===0)return`${String(e/a)}${o}`;return`${String(e)}s`},h=e=>{const i=N(8),{children:a,heading:o,testId:r}=e;let l;i[0]!==o?(l=t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),i[0]=o,i[1]=l):l=i[1];let s;i[2]!==a?(s=t(I,{className:"p-3",children:a}),i[2]=a,i[3]=s):s=i[3];let u;return i[4]!==l||i[5]!==s||i[6]!==r?(u=d(w,{className:"gap-0 py-0","data-testid":r,children:[l,s]}),i[4]=l,i[5]=s,i[6]=r,i[7]=u):u=i[7],u},c=e=>{const i=N(7),{label:a,value:o}=e;let r;i[0]!==a?(r=t("span",{className:"text-sm",children:a}),i[0]=a,i[1]=r):r=i[1];let l;i[2]!==o?(l=t("span",{className:"text-sm text-muted-foreground tabular-nums",children:o}),i[2]=o,i[3]=l):l=i[3];let s;return i[4]!==r||i[5]!==l?(s=d("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[r,l]}),i[4]=r,i[5]=l,i[6]=s):s=i[6],s},O=()=>{const e=N(20),i=C(),a=$();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-auth-config"],e[0]=o):o=e[0];let r;e[1]!==i?(r=()=>i.getAuthConfig(),e[1]=i,e[2]=r):r=e[2];const{data:l,error:s}=A(o,r);let u;e[3]!==a?(u=n=>t(x,{variant:n?"success":"outline",children:a(n?"Enabled":"Disabled")}),e[3]=a,e[4]=u):u=e[4];const m=u;let f;e[5]!==s?(f=s!==null&&t("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=f):f=e[6];let g;e[7]!==l||e[8]!==s||e[9]!==a?(g=s===null&&l===void 0&&t("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:a("Loading auth configuration…")}),e[7]=l,e[8]=s,e[9]=a,e[10]=g):g=e[10];let p;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==a?(p=s===null&&l!==void 0&&d(y,{children:[t(h,{heading:a("Enabled capabilities"),testId:"auth-config-capabilities",children:t("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:S.map(n=>{const k=l.capabilities[n.key];return d("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${n.key}`,children:[t("span",{className:"text-sm",children:a(n.label)}),m(k)]},n.key)})})}),t(h,{heading:a("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?t("p",{className:"text-sm text-muted-foreground",children:a("No plugins enabled.")}):t("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(P)})}),t(h,{heading:a("Sign-in methods"),testId:"auth-config-signin",children:d("div",{className:"flex flex-col gap-2",children:[t(c,{label:a("Email & password"),value:m(l.emailAndPassword)}),t(c,{label:a("Social providers"),value:l.socialProviders.length===0?a("None"):t("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(z)})})]})}),l.organization.enabled&&t(h,{heading:a("Organizations"),testId:"auth-config-org",children:d("div",{className:"flex flex-col gap-2",children:[t(c,{label:a("Teams"),value:m(l.organization.teams)}),t(c,{label:a("Custom roles"),value:m(l.organization.roles)})]})}),t(h,{heading:a("Session policy"),testId:"auth-config-session",children:d("div",{className:"flex flex-col gap-2",children:[t(c,{label:a("Expires in"),value:v(l.session.expiresIn)}),t(c,{label:a("Refresh after"),value:v(l.session.updateAge)}),t(c,{label:a("Fresh window"),value:v(l.session.freshAge)}),t(c,{label:a("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),t(h,{heading:a("Rate limit"),testId:"auth-config-ratelimit",children:d("div",{className:"flex flex-col gap-2",children:[t(c,{label:a("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&d(y,{children:[t(c,{label:a("Max requests"),value:l.rateLimit.max??"—"}),t(c,{label:a("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&t(h,{heading:a("Plugin user fields"),testId:"auth-config-user-fields",children:t("ul",{className:"flex flex-col gap-2",children:l.userFields.map(n=>d("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${n.name}`,children:[d("span",{className:"flex flex-col",children:[t("span",{className:"font-mono text-xs",children:n.name}),n.plugin!==void 0&&t("span",{className:"text-[11px] text-muted-foreground",children:n.plugin})]}),d("span",{className:"flex items-center gap-1",children:[t(x,{variant:"outline",children:n.type}),n.required&&t(x,{variant:"secondary",children:a("required")}),n.unique&&t(x,{variant:"secondary",children:a("unique")})]})]},n.name))})}),t(w,{className:"gap-0 py-0",children:t("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:a("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.")})})]}),e[11]=l,e[12]=s,e[13]=m,e[14]=a,e[15]=p):p=e[15];let b;return e[16]!==f||e[17]!==g||e[18]!==p?(b=d("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[f,g,p]}),e[16]=f,e[17]=g,e[18]=p,e[19]=b):b=e[19],b};function P(e){return t(x,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}function z(e){return t(x,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}export{O as default};
@@ -1 +0,0 @@
1
- import{c as A}from"react/compiler-runtime";import{useLunora as g}from"@lunora/react";import{B as S}from"../packem_shared/button-BOPLD1un.js";import{C,a as k}from"../packem_shared/card-BGlQzQY-.js";import{E as w}from"../packem_shared/empty-state-B939z6K2.js";import{T as I,a as B,b as T,c,d as R,e as m}from"../packem_shared/table-BMsuYFhk.js";import{b as E}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useAutoRefresh as _}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{useT as $}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{i as j,f as H}from"../packem_shared/internal-CwaF9YNk.js";import{jsx as t,jsxs as y}from"react/jsx-runtime";const v=200,K=()=>{const e=A(21),i=g(),s=$();let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=["lunora-auth-sessions",v],e[0]=h):h=e[0];let u;e[1]!==i?(u=()=>i.listAuthSessions({limit:v}),e[1]=i,e[2]=u):u=e[2];const l=E(h,u),{error:f}=l,r=l.data?.rows??null;let p;e[3]!==l?(p=()=>{l.refetch()},e[3]=l,e[4]=p):p=e[4],_(p,!0);let x;e[5]!==i||e[6]!==l?(x=a=>{H((async()=>{await i.revokeAuthSession({sessionId:a}),l.refetch()})())},e[5]=i,e[6]=l,e[7]=x):x=e[7];const N=x;let o;e[8]!==f?(o=f!==null&&t("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:f}),e[8]=f,e[9]=o):o=e[9];let n;e[10]!==r||e[11]!==s?(n=r!==null&&r.length===0&&t(w,{testId:"auth-sessions-empty",title:s("No active sessions.")}),e[10]=r,e[11]=s,e[12]=n):n=e[12];let d;e[13]!==N||e[14]!==r||e[15]!==s?(d=r!==null&&r.length>0&&t(C,{className:"overflow-hidden py-0",children:t(k,{className:"px-0",children:y(I,{"data-testid":"auth-sessions-table",children:[t(B,{children:y(T,{children:[t(c,{children:s("user")}),t(c,{children:s("expires")}),t(c,{children:s("ip")}),t(c,{children:s("user agent")}),t(c,{children:s("impersonated by")}),t(c,{"aria-label":s("Actions")})]})}),t(R,{children:r.map(a=>y(T,{"data-testid":`auth-session-${a.id}`,children:[t(m,{className:"font-mono text-xs",children:a.userId}),t(m,{className:"text-muted-foreground tabular-nums",children:j(a.expiresAt)}),t(m,{children:a.ipAddress??""}),t(m,{className:"max-w-40 truncate",children:a.userAgent??""}),t(m,{className:"font-mono text-xs",children:a.impersonatedBy??""}),t(m,{children:t(S,{"data-testid":`auth-session-revoke-${a.id}`,onClick:()=>{N(a.id)},size:"xs",type:"button",variant:"ghost",children:s("Revoke")})})]},a.id))})]})})}),e[13]=N,e[14]=r,e[15]=s,e[16]=d):d=e[16];let b;return e[17]!==o||e[18]!==n||e[19]!==d?(b=y("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[o,n,d]}),e[17]=o,e[18]=n,e[19]=d,e[20]=b):b=e[20],b};export{K as default};
@@ -1 +0,0 @@
1
- import{c as C}from"react/compiler-runtime";import{L as T}from"../packem_shared/live-status-Bf7rR8o8.js";import{B as b}from"../packem_shared/badge-cAk9Di1Q.js";import{C as E,a as A}from"../packem_shared/card-BGlQzQY-.js";import{E as I}from"../packem_shared/empty-state-B939z6K2.js";import{T as S,a as _,b as y,c as l,d as L,e as d}from"../packem_shared/table-BMsuYFhk.js";import{u as O}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useT as $}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as k}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{jsxs as h,jsx as n}from"react/jsx-runtime";const g="container:",R={error:"error",sleep:"sleeping",start:"running",stop:"stopped"},B=e=>{const t=e.indexOf(":");if(t===-1)return{event:e.trim()};const a=e.slice(t+1).trim(),s=e.slice(0,t).trim();return a===""?{event:s}:{detail:a,event:s}},D=e=>{const t=new Map;for(const a of e){const s=a.functionPath??"";if(!s.startsWith(g))continue;const i=s.slice(g.length);if(i==="")continue;const r=JSON.stringify([i,a.instance??""]),o=t.get(r);if(o!==void 0&&o.timestamp>=a.timestamp)continue;const{detail:u,event:c}=B(a.message);t.set(r,{detail:u,event:c,exitCode:a.exitCode,instance:a.instance,level:a.level,name:i,state:R[c]??"unknown",timestamp:a.timestamp})}return[...t.values()].toSorted((a,s)=>a.name.localeCompare(s.name)||(a.instance??"").localeCompare(s.instance??""))},M={error:"destructive",running:"success",sleeping:"info",stopped:"outline",unknown:"secondary"},P=e=>{const{entries:t}=e??{};return Array.isArray(t)?t:[]},q=()=>{const e=C(19),t=$();let a,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},s={live:!0,shardKey:""},e[0]=a,e[1]=s):(a=e[0],s=e[1]);const{data:i,error:r,liveError:o}=O(k.getLogs,a,s),u=i!==void 0;let c;if(e[2]!==i||e[3]!==r||e[4]!==o||e[5]!==u||e[6]!==t){const N=D(P(i));let x;e[8]!==r?(x=r!==null&&n("p",{className:"text-sm text-destructive","data-testid":"containers-error",role:"alert",children:r}),e[8]=r,e[9]=x):x=e[9];let m;e[10]!==t?(m=t("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per instance — ports and health checks aren't carried in that stream."),e[10]=t,e[11]=m):m=e[11];let f;e[12]!==m?(f=n("p",{className:"text-sm text-muted-foreground",children:m}),e[12]=m,e[13]=f):f=e[13];let p;e[14]!==o?(p=n(T,{message:o,prefix:"containers"}),e[14]=o,e[15]=p):p=e[15];let v;e[16]!==f||e[17]!==p?(v=h("div",{className:"flex flex-wrap items-center gap-2",children:[f,p]}),e[16]=f,e[17]=p,e[18]=v):v=e[18],c=h("div",{className:"flex flex-col gap-6","data-testid":"lunora-containers-panel",children:[x,v,u&&N.length===0?n(I,{description:t("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),testId:"containers-empty",title:t("No container activity")}):n(E,{className:"overflow-hidden py-0",children:n(A,{className:"px-0",children:h(S,{"data-testid":"containers-table",children:[n(_,{children:h(y,{children:[n(l,{children:t("Container")}),n(l,{children:t("Instance")}),n(l,{children:t("State")}),n(l,{children:t("Last event")}),n(l,{children:t("Detail")}),n(l,{children:t("Exit")}),n(l,{children:t("When")})]})}),n(L,{children:N.map(j)})]})})})]}),e[2]=i,e[3]=r,e[4]=o,e[5]=u,e[6]=t,e[7]=c}else c=e[7];return c};function j(e){return h(y,{"data-testid":`containers-row-${e.name}${e.instance===void 0?"":`-${e.instance}`}`,children:[n(d,{className:"font-mono text-xs",children:e.name}),n(d,{className:"max-w-40 truncate font-mono text-xs text-muted-foreground",title:e.instance,children:e.instance??"—"}),n(d,{children:n(b,{variant:M[e.state],children:e.state})}),n(d,{className:"font-mono text-xs text-muted-foreground",children:e.event}),n(d,{className:"max-w-64 truncate text-xs text-muted-foreground",title:e.detail,children:e.detail??"—"}),n(d,{className:"font-mono text-xs tabular-nums text-muted-foreground",children:e.exitCode??"—"}),n(d,{className:"text-xs tabular-nums text-muted-foreground",children:new Date(e.timestamp).toLocaleString()})]},`${e.name}/${e.instance??""}`)}export{q as default};
@@ -1 +0,0 @@
1
- import{c as J}from"react/compiler-runtime";import{useState as X,useEffect as fe,useRef as ue}from"react";import{A as ne}from"../packem_shared/alert-C2SEhYS9.js";import{B as Y}from"../packem_shared/button-BOPLD1un.js";import{b as he,c as ge,a as re,C as ae}from"../packem_shared/card-BGlQzQY-.js";import{E as me}from"../packem_shared/empty-state-B939z6K2.js";import{useT as te}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{u as be,n as ve}from"../packem_shared/browser-storage-BH1MxLZs.js";import{c as pe,d as xe,b as Ce,f as de,h as ke}from"../packem_shared/internal-CwaF9YNk.js";import{u as ye}from"../packem_shared/use-sql-assistant-D1K2LqpO.js";import{S as we,a as Se}from"../packem_shared/sql-result-table-CqlZo2QN.js";import{useLunora as Ne}from"@lunora/react";import{ADMIN_FUNCTIONS as Ke}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{jsx as d,jsxs as Z}from"react/jsx-runtime";const Re=pe(Ke.runSql),Le=(b,e)=>{const t=J(11),n=Ne(),[r,s]=X(void 0),[a,o]=X(void 0),[c,v]=X(!0);let h;t[0]!==n||t[1]!==e||t[2]!==b?(h=async f=>{v(!0);try{const y=await n.query(Re,{sql:b},xe(e));f.cancelled||(s(y),o(void 0))}catch(y){const x=y;f.cancelled||(s(void 0),o(Ce(x)))}f.cancelled||v(!1)},t[0]=n,t[1]=e,t[2]=b,t[3]=h):h=t[3];const i=h;let l,g;t[4]!==i?(l=()=>{const f={cancelled:!1};return de(i(f)),()=>{f.cancelled=!0}},g=[i],t[4]=i,t[5]=l,t[6]=g):(l=t[5],g=t[6]),fe(l,g);let N;return t[7]!==a||t[8]!==c||t[9]!==r?(N={error:a,loading:c,result:r},t[7]=a,t[8]=c,t[9]=r,t[10]=N):N=t[10],N},Me=b=>{b.preventDefault()},le=b=>b.kind??"chart",ce=b=>{const e=J(80),{actions:t,children:n,draggedRef:r,first:s,last:a,onEdit:o,onMove:c,onRemove:v,onReorder:h,widget:i}=b,l=te();let g;e[0]!==c||e[1]!==i.id?(g=()=>{c(i.id,-1)},e[0]=c,e[1]=i.id,e[2]=g):g=e[2];const N=g;let f;e[3]!==c||e[4]!==i.id?(f=()=>{c(i.id,1)},e[3]=c,e[4]=i.id,e[5]=f):f=e[5];const y=f;let x;e[6]!==o||e[7]!==i.id?(x=()=>{o(i.id)},e[6]=o,e[7]=i.id,e[8]=x):x=e[8];const q=x;let O;e[9]!==v||e[10]!==i.id?(O=()=>{v(i.id)},e[9]=v,e[10]=i.id,e[11]=O):O=e[11];const E=O;let z;e[12]!==r||e[13]!==i.id?(z=()=>{r.current=i.id},e[12]=r,e[13]=i.id,e[14]=z):z=e[14];const C=z;let K;e[15]!==r||e[16]!==h||e[17]!==i.id?(K=()=>{const se=r.current;r.current=null,se!==null&&se!==i.id&&h(se,i.id)},e[15]=r,e[16]=h,e[17]=i.id,e[18]=K):K=e[18];const W=K,S=`dashboards-widget-${i.id}`;let k;e[19]!==i.title?(k=d(he,{className:"min-w-0 cursor-grab truncate",title:i.title,children:i.title}),e[19]=i.title,e[20]=k):k=e[20];let w;e[21]!==l?(w=l("Move widget up"),e[21]=l,e[22]=w):w=e[22];const _=`dashboards-move-up-${i.id}`;let Q;e[23]!==l?(Q=l("Move widget up"),e[23]=l,e[24]=Q):Q=e[24];let B;e[25]===Symbol.for("react.memo_cache_sentinel")?(B=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m6 15 6-6 6 6"})}),e[25]=B):B=e[25];let I;e[26]!==s||e[27]!==N||e[28]!==_||e[29]!==Q||e[30]!==w?(I=d(Y,{"aria-label":w,"data-testid":_,disabled:s,onClick:N,size:"icon-xs",title:Q,type:"button",variant:"ghost",children:B}),e[26]=s,e[27]=N,e[28]=_,e[29]=Q,e[30]=w,e[31]=I):I=e[31];let R;e[32]!==l?(R=l("Move widget down"),e[32]=l,e[33]=R):R=e[33];const $=`dashboards-move-down-${i.id}`;let L;e[34]!==l?(L=l("Move widget down"),e[34]=l,e[35]=L):L=e[35];let A;e[36]===Symbol.for("react.memo_cache_sentinel")?(A=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m6 9 6 6 6-6"})}),e[36]=A):A=e[36];let M;e[37]!==a||e[38]!==y||e[39]!==R||e[40]!==$||e[41]!==L?(M=d(Y,{"aria-label":R,"data-testid":$,disabled:a,onClick:y,size:"icon-xs",title:L,type:"button",variant:"ghost",children:A}),e[37]=a,e[38]=y,e[39]=R,e[40]=$,e[41]=L,e[42]=M):M=e[42];let D;e[43]!==l?(D=l("Edit widget"),e[43]=l,e[44]=D):D=e[44];const j=`dashboards-widget-edit-${i.id}`;let T;e[45]!==l?(T=l("Edit widget"),e[45]=l,e[46]=T):T=e[46];let p;e[47]===Symbol.for("react.memo_cache_sentinel")?(p=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"})}),e[47]=p):p=e[47];let m;e[48]!==q||e[49]!==D||e[50]!==j||e[51]!==T?(m=d(Y,{"aria-label":D,"data-testid":j,onClick:q,size:"icon-xs",title:T,type:"button",variant:"ghost",children:p}),e[48]=q,e[49]=D,e[50]=j,e[51]=T,e[52]=m):m=e[52];let u;e[53]!==l?(u=l("Remove widget"),e[53]=l,e[54]=u):u=e[54];const F=`dashboards-widget-remove-${i.id}`;let U;e[55]!==l?(U=l("Remove widget"),e[55]=l,e[56]=U):U=e[56];let V;e[57]===Symbol.for("react.memo_cache_sentinel")?(V=d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[57]=V):V=e[57];let H;e[58]!==E||e[59]!==u||e[60]!==F||e[61]!==U?(H=d(Y,{"aria-label":u,"data-testid":F,onClick:E,size:"icon-xs",title:U,type:"button",variant:"ghost",children:V}),e[58]=E,e[59]=u,e[60]=F,e[61]=U,e[62]=H):H=e[62];let P;e[63]!==t||e[64]!==I||e[65]!==M||e[66]!==m||e[67]!==H?(P=Z("div",{className:"flex shrink-0 items-center gap-1",children:[t,I,M,m,H]}),e[63]=t,e[64]=I,e[65]=M,e[66]=m,e[67]=H,e[68]=P):P=e[68];let G;e[69]!==P||e[70]!==k?(G=Z(ge,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[k,P]}),e[69]=P,e[70]=k,e[71]=G):G=e[71];let ee;e[72]!==n?(ee=d(re,{className:"min-h-32 py-2",children:n}),e[72]=n,e[73]=ee):ee=e[73];let ie;return e[74]!==C||e[75]!==W||e[76]!==G||e[77]!==ee||e[78]!==S?(ie=Z(ae,{"data-testid":S,draggable:!0,onDragOver:Me,onDragStart:C,onDrop:W,children:[G,ee]}),e[74]=C,e[75]=W,e[76]=G,e[77]=ee,e[78]=S,e[79]=ie):ie=e[79],ie},qe=b=>{const e=J(10),{result:t}=b,n=te(),r=t.columns[0],s=r===void 0?void 0:t.rows[0]?.[r];let a;e[0]!==s||e[1]!==n?(a=s===void 0?n("—"):ke(s),e[0]=s,e[1]=n,e[2]=a):a=e[2];let o;e[3]!==a?(o=d("p",{className:"truncate font-mono text-3xl font-semibold text-foreground",children:a}),e[3]=a,e[4]=o):o=e[4];let c;e[5]!==r?(c=r!==void 0&&d("p",{className:"truncate text-xs text-muted-foreground",children:r}),e[5]=r,e[6]=c):c=e[6];let v;return e[7]!==o||e[8]!==c?(v=Z("div",{className:"flex h-full flex-col justify-center gap-1 p-4","data-testid":"dashboards-kpi",children:[o,c]}),e[7]=o,e[8]=c,e[9]=v):v=e[9],v},Ee=b=>{const e=J(12),{draggedRef:t,first:n,last:r,onEdit:s,onMove:a,onRemove:o,onReorder:c,widget:v}=b,h=v.text??"";let i;e[0]!==h?(i=d("p",{className:"p-2 text-sm whitespace-pre-wrap text-muted-foreground","data-testid":"dashboards-text",children:h}),e[0]=h,e[1]=i):i=e[1];let l;return e[2]!==t||e[3]!==n||e[4]!==r||e[5]!==s||e[6]!==a||e[7]!==o||e[8]!==c||e[9]!==i||e[10]!==v?(l=d(ce,{draggedRef:t,first:n,last:r,onEdit:s,onMove:a,onRemove:o,onReorder:c,widget:v,children:i}),e[2]=t,e[3]=n,e[4]=r,e[5]=s,e[6]=a,e[7]=o,e[8]=c,e[9]=i,e[10]=v,e[11]=l):l=e[11],l},Ae=b=>{const e=J(52),{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}=b,l=te(),{error:g,loading:N,result:f}=Le(i.sql,i.shardKey??"");let y;e[0]!==i?(y=le(i),e[0]=i,e[1]=y):y=e[1];const x=y;let q;e[2]!==h||e[3]!==f||e[4]!==i.id?(q=()=>{f!==void 0&&h?.(i.id,f)},e[2]=h,e[3]=f,e[4]=i.id,e[5]=q):q=e[5];const O=q;let E;e[6]!==r||e[7]!==x||e[8]!==h||e[9]!==O||e[10]!==f||e[11]!==l||e[12]!==i.id?(E=x==="chart"&&h!==void 0&&f!==void 0?d(Y,{"aria-label":l("Suggest chart"),"data-testid":`dashboards-widget-suggest-${i.id}`,disabled:r,onClick:O,size:"icon-xs",title:l(r?"Suggesting…":"Suggest chart"),type:"button",variant:"ghost",children:d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"m12 3 1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3ZM18 15l.9 2.1 2.1.9-2.1.9L18 21l-.9-2.1-2.1-.9 2.1-.9L18 15Z"})})}):void 0,e[6]=r,e[7]=x,e[8]=h,e[9]=O,e[10]=f,e[11]=l,e[12]=i.id,e[13]=E):E=e[13];const z=E;let C;e[14]!==g||e[15]!==i.id?(C=g!==void 0&&d(ne,{className:"font-mono text-xs",testId:`dashboards-widget-error-${i.id}`,variant:"destructive",children:g}),e[14]=g,e[15]=i.id,e[16]=C):C=e[16];let K;e[17]!==g||e[18]!==N||e[19]!==f||e[20]!==l||e[21]!==i.id?(K=g===void 0&&N&&f===void 0&&d("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${i.id}`,children:l("Running…")}),e[17]=g,e[18]=N,e[19]=f,e[20]=l,e[21]=i.id,e[22]=K):K=e[22];let W;e[23]!==g||e[24]!==x||e[25]!==f||e[26]!==i.chartAxes||e[27]!==i.chartKind?(W=g===void 0&&f!==void 0&&x==="chart"&&d(we,{axes:i.chartAxes,kind:i.chartKind,result:f}),e[23]=g,e[24]=x,e[25]=f,e[26]=i.chartAxes,e[27]=i.chartKind,e[28]=W):W=e[28];let S;e[29]!==g||e[30]!==x||e[31]!==f?(S=g===void 0&&f!==void 0&&x==="kpi"&&d(qe,{result:f}),e[29]=g,e[30]=x,e[31]=f,e[32]=S):S=e[32];let k;e[33]!==g||e[34]!==x||e[35]!==f?(k=g===void 0&&f!==void 0&&x==="table"&&d("div",{className:"max-h-72 overflow-auto",children:d(Se,{result:f})}),e[33]=g,e[34]=x,e[35]=f,e[36]=k):k=e[36];let w;return e[37]!==t||e[38]!==n||e[39]!==s||e[40]!==a||e[41]!==o||e[42]!==c||e[43]!==v||e[44]!==z||e[45]!==C||e[46]!==K||e[47]!==W||e[48]!==S||e[49]!==k||e[50]!==i?(w=Z(ce,{actions:z,draggedRef:t,first:n,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,widget:i,children:[C,K,W,S,k]}),e[37]=t,e[38]=n,e[39]=s,e[40]=a,e[41]=o,e[42]=c,e[43]=v,e[44]=z,e[45]=C,e[46]=K,e[47]=W,e[48]=S,e[49]=k,e[50]=i,e[51]=w):w=e[51],w},Te=b=>{const e=J(11),{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}=b;let l;return e[0]!==t||e[1]!==n||e[2]!==r||e[3]!==s||e[4]!==a||e[5]!==o||e[6]!==c||e[7]!==v||e[8]!==h||e[9]!==i?(l=le(i)==="text"?d(Ee,{draggedRef:t,first:n,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,widget:i}):d(Ae,{draggedRef:t,first:n,inferring:r,last:s,onEdit:a,onMove:o,onRemove:c,onReorder:v,onSuggest:h,widget:i}),e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=a,e[5]=o,e[6]=c,e[7]=v,e[8]=h,e[9]=i,e[10]=l):l=e[10],l},We=["bar","line","area"],Ie=["chart","kpi","table","text"],$e="lunora-studio-dashboards",oe={chartKind:"bar",kind:"chart",shardKey:"",sql:"",text:"",title:""},De=(b,e)=>t=>t.map(n=>n.id===b?{...n,chartAxes:e,chartKind:e.kind}:n),je=(b,e)=>t=>{const n=t.find(a=>a.id===b),r=t.filter(a=>a.id!==b),s=r.findIndex(a=>a.id===e);return n===void 0||s===-1?t:[...r.slice(0,s),n,...r.slice(s)]},ze=(b,e)=>e(b==="line"?"Line":b==="area"?"Area":"Bar"),Be=(b,e)=>e(b==="kpi"?"Single value":b==="table"?"Table":b==="text"?"Text":"Chart"),Fe=b=>{const e=J(82),{draft:t,editing:n,onCancel:r,onChange:s,onSubmit:a}=b,o=te();let c;e[0]!==t||e[1]!==s?(c=u=>{s({...t,title:u.target.value})},e[0]=t,e[1]=s,e[2]=c):c=e[2];const v=c;let h;e[3]!==t||e[4]!==s?(h=u=>{s({...t,sql:u.target.value})},e[3]=t,e[4]=s,e[5]=h):h=e[5];const i=h;let l;e[6]!==t||e[7]!==s?(l=u=>{s({...t,text:u.target.value})},e[6]=t,e[7]=s,e[8]=l):l=e[8];const g=l;let N;e[9]!==t||e[10]!==s?(N=u=>{s({...t,shardKey:u.target.value})},e[9]=t,e[10]=s,e[11]=N):N=e[11];const f=N;let y;e[12]!==t||e[13]!==s?(y=u=>{s({...t,chartKind:u.target.value})},e[12]=t,e[13]=s,e[14]=y):y=e[14];const x=y;let q;e[15]!==t||e[16]!==s?(q=u=>{s({...t,kind:u.target.value})},e[15]=t,e[16]=s,e[17]=q):q=e[17];const O=q;let E;e[18]!==a?(E=()=>{a()},e[18]=a,e[19]=E):E=e[19];const z=E,C=t.kind==="text";let K;e[20]!==t.sql||e[21]!==t.text||e[22]!==t.title||e[23]!==C?(K=t.title.trim()!==""&&(C?t.text.trim()!=="":t.sql.trim()!==""),e[20]=t.sql,e[21]=t.text,e[22]=t.title,e[23]=C,e[24]=K):K=e[24];const W=K;let S;e[25]!==o?(S=o("Widget title"),e[25]=o,e[26]=S):S=e[26];let k;e[27]!==o?(k=o("Widget title"),e[27]=o,e[28]=k):k=e[28];let w;e[29]!==t.title||e[30]!==v||e[31]!==k||e[32]!==S?(w=d("input",{"aria-label":S,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:v,placeholder:k,type:"text",value:t.title}),e[29]=t.title,e[30]=v,e[31]=k,e[32]=S,e[33]=w):w=e[33];let _;e[34]!==o?(_=o("Widget type"),e[34]=o,e[35]=_):_=e[35];const Q=t.kind;let B;e[36]!==o?(B=Ie.map(u=>d("option",{value:u,children:Be(u,o)},u)),e[36]=o,e[37]=B):B=e[37];let I;e[38]!==t.kind||e[39]!==O||e[40]!==_||e[41]!==B?(I=d("select",{"aria-label":_,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-widget-kind",onChange:O,value:Q,children:B}),e[38]=t.kind,e[39]=O,e[40]=_,e[41]=B,e[42]=I):I=e[42];let R;e[43]!==t.sql||e[44]!==t.text||e[45]!==C||e[46]!==i||e[47]!==g||e[48]!==o?(R=C?d("textarea",{"aria-label":o("Text"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-text",onChange:g,placeholder:o("Notes for whoever reads this dashboard."),value:t.text}):d("textarea",{"aria-label":o("SQL query"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:i,placeholder:"SELECT author, COUNT(*) AS messages FROM …",spellCheck:!1,value:t.sql}),e[43]=t.sql,e[44]=t.text,e[45]=C,e[46]=i,e[47]=g,e[48]=o,e[49]=R):R=e[49];let $;e[50]!==t.chartKind||e[51]!==t.kind||e[52]!==x||e[53]!==o?($=t.kind==="chart"&&d("select",{"aria-label":o("Chart type"),className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-kind",onChange:x,value:t.chartKind,children:We.map(u=>d("option",{value:u,children:ze(u,o)},u))}),e[50]=t.chartKind,e[51]=t.kind,e[52]=x,e[53]=o,e[54]=$):$=e[54];let L;e[55]!==t.shardKey||e[56]!==C||e[57]!==f||e[58]!==o?(L=!C&&d("input",{"aria-label":o("Shard key (optional)"),className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:f,placeholder:o("Shard key (optional)"),type:"text",value:t.shardKey}),e[55]=t.shardKey,e[56]=C,e[57]=f,e[58]=o,e[59]=L):L=e[59];let A;e[60]!==o?(A=o("Cancel"),e[60]=o,e[61]=A):A=e[61];let M;e[62]!==r||e[63]!==A?(M=d(Y,{"data-testid":"dashboards-form-cancel",onClick:r,size:"sm",type:"button",variant:"outline",children:A}),e[62]=r,e[63]=A,e[64]=M):M=e[64];const D=!W;let j;e[65]!==n||e[66]!==o?(j=o(n?"Save widget":"Add widget"),e[65]=n,e[66]=o,e[67]=j):j=e[67];let T;e[68]!==z||e[69]!==D||e[70]!==j?(T=d(Y,{"data-testid":"dashboards-form-save",disabled:D,onClick:z,size:"sm",type:"button",children:j}),e[68]=z,e[69]=D,e[70]=j,e[71]=T):T=e[71];let p;e[72]!==M||e[73]!==T?(p=Z("div",{className:"flex items-center justify-end gap-2",children:[M,T]}),e[72]=M,e[73]=T,e[74]=p):p=e[74];let m;return e[75]!==w||e[76]!==I||e[77]!==R||e[78]!==$||e[79]!==L||e[80]!==p?(m=d(ae,{"data-testid":"dashboards-form",children:Z(re,{className:"flex flex-col gap-3 py-4",children:[w,I,R,$,L,p]})}),e[75]=w,e[76]=I,e[77]=R,e[78]=$,e[79]=L,e[80]=p,e[81]=m):m=e[81],m},it=b=>{const e=J(53),{initialShardKey:t}=b,n=te(),[r,s]=be($e),[a,o]=X(oe),[c,v]=X(null),[h,i]=X(!1),l=ye(t??""),[g,N]=X(null),f=ue(null);let y;e[0]!==t?(y=()=>{v(null),o({...oe,shardKey:t??""}),i(!0)},e[0]=t,e[1]=y):y=e[1];const x=y;let q;e[2]===Symbol.for("react.memo_cache_sentinel")?(q=()=>{i(!1),v(null),o(oe)},e[2]=q):q=e[2];const O=q;let E;e[3]!==r?(E=p=>{const m=r.find(u=>u.id===p);m!==void 0&&(v(p),o({chartKind:m.chartKind??"bar",kind:le(m),shardKey:m.shardKey??"",sql:m.sql,text:m.text??"",title:m.title}),i(!0))},e[3]=r,e[4]=E):E=e[4];const z=E;let C;e[5]!==l||e[6]!==s?(C=(p,m)=>{N(p),de((async()=>{const F=await l.inferChart({columns:m.columns,rowCount:m.rowCount});F!==void 0&&s(De(p,F))})().finally(()=>{N(F=>F===p?null:F)}))},e[5]=l,e[6]=s,e[7]=C):C=e[7];const K=C;let W;e[8]!==s?(W=p=>{s(m=>m.filter(u=>u.id!==p))},e[8]=s,e[9]=W):W=e[9];const S=W;let k;e[10]!==s?(k=(p,m)=>{s(je(p,m))},e[10]=s,e[11]=k):k=e[11];const w=k;let _;e[12]!==s?(_=(p,m)=>{s(u=>{const F=u.findIndex(G=>G.id===p),U=F+m;if(F===-1||U<0||U>=u.length)return u;const V=[...u],H=V[F],P=V[U];return H===void 0||P===void 0?u:(V[F]=P,V[U]=H,V)})},e[12]=s,e[13]=_):_=e[13];const Q=_;let B;e[14]!==a||e[15]!==c||e[16]!==s?(B=()=>{const p=a.title.trim(),m=a.sql.trim(),u=a.text.trim(),{chartKind:F,kind:U}=a;if(p===""||(U==="text"?u==="":m===""))return;const V={chartKind:F,kind:U,shardKey:a.shardKey.trim(),sql:m,text:u,title:p};s(c===null?H=>[...H,{...V,id:ve("w")}]:H=>H.map(P=>P.id===c?{...P,...V}:P)),O()},e[14]=a,e[15]=c,e[16]=s,e[17]=B):B=e[17];const I=B;let R;e[18]!==n?(R=n("Charts, values, tables, and notes. Drag a tile to reorder."),e[18]=n,e[19]=R):R=e[19];let $;e[20]!==R?($=d("p",{className:"text-sm text-muted-foreground",children:R}),e[20]=R,e[21]=$):$=e[21];let L;e[22]!==h||e[23]!==x||e[24]!==n?(L=!h&&d(Y,{"data-testid":"dashboards-add",onClick:x,size:"sm",type:"button",children:n("Add widget")}),e[22]=h,e[23]=x,e[24]=n,e[25]=L):L=e[25];let A;e[26]!==$||e[27]!==L?(A=Z("div",{className:"flex items-center justify-between",children:[$,L]}),e[26]=$,e[27]=L,e[28]=A):A=e[28];let M;e[29]!==l||e[30]!==n?(M=l.reason("chart")!==void 0&&d(ne,{className:"text-xs",testId:"dashboards-suggest-error",variant:"destructive",children:n("Could not suggest a chart for that result.")}),e[29]=l,e[30]=n,e[31]=M):M=e[31];let D;e[32]!==a||e[33]!==c||e[34]!==h||e[35]!==I?(D=h&&d(Fe,{draft:a,editing:c!==null,onCancel:O,onChange:o,onSubmit:I}),e[32]=a,e[33]=c,e[34]=h,e[35]=I,e[36]=D):D=e[36];let j;e[37]!==l.unavailable||e[38]!==h||e[39]!==g||e[40]!==z||e[41]!==Q||e[42]!==S||e[43]!==w||e[44]!==K||e[45]!==n||e[46]!==r?(j=r.length===0&&!h?d(me,{description:n("Add a chart, a single value, a table, or a note. Everything is saved on this browser."),testId:"dashboards-empty",title:n("No widgets yet")}):d("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:r.map((p,m)=>d(Te,{draggedRef:f,first:m===0,inferring:g===p.id,last:m===r.length-1,onEdit:z,onMove:Q,onRemove:S,onReorder:w,onSuggest:l.unavailable?void 0:K,widget:p},p.id))}),e[37]=l.unavailable,e[38]=h,e[39]=g,e[40]=z,e[41]=Q,e[42]=S,e[43]=w,e[44]=K,e[45]=n,e[46]=r,e[47]=j):j=e[47];let T;return e[48]!==A||e[49]!==M||e[50]!==D||e[51]!==j?(T=Z("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[A,M,D,j]}),e[48]=A,e[49]=M,e[50]=D,e[51]=j,e[52]=T):T=e[52],T};export{it as default};
@@ -1 +0,0 @@
1
- import{c as I}from"react/compiler-runtime";import{E as K}from"../packem_shared/error-alert-TYdKetJd.js";import{ShardInput as O}from"../packem_shared/ShardInput-CdawpUiS.js";import{B as w}from"../packem_shared/badge-cAk9Di1Q.js";import{C as M,a as $}from"../packem_shared/card-BGlQzQY-.js";import{E as j}from"../packem_shared/empty-state-B939z6K2.js";import{u as T}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{u as A}from"../packem_shared/use-open-trace-4mqqFWrn.js";import{u as k}from"../packem_shared/use-shard-key-BsP3o5wT.js";import{useT as C}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as E}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{i as R}from"../packem_shared/internal-CwaF9YNk.js";import{S as B}from"../packem_shared/sparkline-CYbJzfA1.js";import{jsxs as g,jsx as c}from"react/jsx-runtime";const F=n=>n.length===0?void 0:{max:Math.max(...n),mean:n.reduce((e,t)=>e+t,0)/n.length,min:Math.min(...n)},_=/^gen_ai\.evaluation\.(.+)\.score$/u,q=n=>{const e=[];for(const t of n)for(const r of t.spans)for(const[a,l]of Object.entries(r.attributes??{})){const o=_.exec(a);if(!o||typeof l!="number")continue;const i=o[1],m=r.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof m=="string"?{label:m}:{},name:i,score:l,spanName:r.name,startTs:t.startTs+r.offsetMs,traceId:t.traceId})}return e.toSorted((t,r)=>r.startTs-t.startTs)},D=n=>{const e=[];for(const t of n?.series??[]){const r=_.exec(t.name);r&&e.push({name:r[1],points:t.points})}return e},H=(n,e)=>{const t=new Set([...n.map(a=>a.name),...e.map(a=>a.name)]),r=[];for(const a of t){const l=n.filter(s=>s.name===a),o=e.find(s=>s.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,m=o.length>0?{max:Math.max(...o.map(s=>s.max)),mean:o.reduce((s,d)=>s+d.sum,0)/o.reduce((s,d)=>s+d.count,0),min:Math.min(...o.map(s=>s.min))}:F(l.map(s=>s.score));r.push({...i===void 0?{}:{latest:i},...m,name:a,points:o,runs:l})}return r.toSorted((a,l)=>a.name.localeCompare(l.name))},L=n=>Array.isArray(n?.traces)?n.traces:[],y=n=>n===void 0?"—":n.toFixed(2),P=n=>{const e=I(34),{card:t,onOpenTrace:r}=n,a=C();let l;e[0]!==t.name?(l=c("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=y(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=c("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let m;e[6]!==l||e[7]!==i?(m=g("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=m):m=e[8];let s;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(s=a("min {min} · mean {mean} · max {max}",{max:y(t.max),mean:y(t.mean),min:y(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=s):s=e[13];let d;e[14]!==s?(d=c("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:s}),e[14]=s,e[15]=d):d=e[15];let f;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(f=t.points.length>1?c(B,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(Q),testId:"ev-trend"}):c("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet — pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=f):f=e[19];let u;if(e[20]!==t.runs||e[21]!==r||e[22]!==a){let x;e[24]!==r||e[25]!==a?(x=p=>g("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[g("span",{className:"truncate text-muted-foreground",children:[R(p.startTs)," · ",p.spanName]}),g("span",{className:"flex items-center gap-2",children:[p.label===void 0?null:c(w,{variant:"outline",children:p.label}),c("span",{className:"text-foreground",children:y(p.score)}),r===void 0?null:c("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:()=>{r(p.traceId)},title:a("Open the trace {trace}",{trace:p.traceId}),type:"button",children:p.traceId.slice(0,8)})]})]},`${p.traceId}:${p.spanName}`),e[24]=r,e[25]=a,e[26]=x):x=e[26],u=t.runs.slice(0,5).map(x),e[20]=t.runs,e[21]=r,e[22]=a,e[23]=u}else u=e[23];let h;e[27]!==u?(h=c("div",{className:"flex flex-col gap-1",children:u}),e[27]=u,e[28]=h):h=e[28];let v;return e[29]!==m||e[30]!==d||e[31]!==f||e[32]!==h?(v=c(M,{"data-testid":"ev-card",children:g($,{className:"flex flex-col gap-3 p-4",children:[m,d,f,h]})}),e[29]=m,e[30]=d,e[31]=f,e[32]=h,e[33]=v):v=e[33],v},re=n=>{const e=I(19),{initialShardKey:t}=n,r=C(),{queryShardKey:a,setShardKey:l,shardKey:o}=k(t),i=A(a);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={},e[0]=m):m=e[0];let s;e[1]!==a?(s={live:!0,shardKey:a},e[1]=a,e[2]=s):s=e[2];const{data:d,error:f}=T(E.getTraces,m,s);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let h;e[4]!==a?(h={live:!0,shardKey:a},e[4]=a,e[5]=h):h=e[5];const{data:v}=T(E.getMetricHistory,u,h);let x;if(e[6]!==d||e[7]!==f||e[8]!==v||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==r){const p=H(q(L(d)),D(v));let N;e[14]!==l||e[15]!==o?(N=c(O,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=N):N=e[16];let b;e[17]!==f?(b=f===null?null:c(K,{error:f,testId:"ev-error"}),e[17]=f,e[18]=b):b=e[18],x=g("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[N,b,p.length===0?c(j,{description:r("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:r("No evals recorded")}):c("div",{className:"grid gap-3 md:grid-cols-2",children:p.map(S=>c(P,{card:S,onOpenTrace:i},S.name))})]}),e[6]=d,e[7]=f,e[8]=v,e[9]=i,e[10]=l,e[11]=o,e[12]=r,e[13]=x}else x=e[13];return x};function Q(n){return n.last}export{re as default};
@@ -1 +0,0 @@
1
- import{c as R}from"react/compiler-runtime";import{E as B}from"../packem_shared/error-alert-TYdKetJd.js";import{ShardInput as E}from"../packem_shared/ShardInput-CdawpUiS.js";import{S as I}from"../packem_shared/stat-card-B9uIvAHg.js";import{B as M}from"../packem_shared/badge-cAk9Di1Q.js";import{C as _}from"../packem_shared/card-BGlQzQY-.js";import{E as j}from"../packem_shared/empty-state-B939z6K2.js";import{T as G,a as H,b as A,c as w,d as L,e as K}from"../packem_shared/table-BMsuYFhk.js";import{u as Q}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useAutoRefresh as W}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{u as q}from"../packem_shared/use-shard-key-BsP3o5wT.js";import{useT as O}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as U}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{jsxs as m,jsx as l,Fragment as z}from"react/jsx-runtime";const D=d=>`${d.toString()} ms`,J=d=>d.totalConnections===0&&d.shapePoke.passes===0&&d.whisper.passes===0&&d.shapeProbe.run===0&&d.shapeProbe.served===0&&d.globalPoll.drains===0&&d.globalPoll.pairsSkipped===0,F=d=>{const e=R(48),{counters:o,includeTiming:t,prefix:r,t:a,title:u}=d,c=`${r}-section`;let n;e[0]!==u?(n=l("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];const s=`${r}-stats`;let i;e[2]!==a?(i=a("Passes"),e[2]=a,e[3]=i):i=e[3];const f=`${r}-passes`;let N;e[4]!==o.passes||e[5]!==i||e[6]!==f?(N=l(I,{label:i,testId:f,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=f,e[7]=N):N=e[7];let g;e[8]!==a?(g=a("Sockets iterated"),e[8]=a,e[9]=g):g=e[9];const k=`${r}-iterated`;let p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==k?(p=l(I,{label:g,testId:k,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=k,e[13]=p):p=e[13];let h;e[14]!==a?(h=a("Delivered"),e[14]=a,e[15]=h):h=e[15];const y=`${r}-delivered`;let b;e[16]!==o.socketsDelivered||e[17]!==h||e[18]!==y?(b=l(I,{label:h,testId:y,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=h,e[18]=y,e[19]=b):b=e[19];let x;e[20]!==a?(x=a("Peak width"),e[20]=a,e[21]=x):x=e[21];const S=`${r}-peak`;let v;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==S?(v=l(I,{label:x,testId:S,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=S,e[25]=v):v=e[25];let C;e[26]!==o.totalMs||e[27]!==t||e[28]!==r||e[29]!==a?(C=t&&l(I,{label:a("Total time"),testId:`${r}-total-ms`,value:D(o.totalMs)}),e[26]=o.totalMs,e[27]=t,e[28]=r,e[29]=a,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==t||e[33]!==r||e[34]!==a?(P=t&&l(I,{label:a("Max time"),testId:`${r}-max-ms`,value:D(o.maxMs)}),e[31]=o.maxMs,e[32]=t,e[33]=r,e[34]=a,e[35]=P):P=e[35];let $;e[36]!==b||e[37]!==v||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==N||e[42]!==p?($=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[N,p,b,v,C,P]}),e[36]=b,e[37]=v,e[38]=C,e[39]=P,e[40]=s,e[41]=N,e[42]=p,e[43]=$):$=e[43];let T;return e[44]!==c||e[45]!==$||e[46]!==n?(T=m("section",{className:"flex flex-col gap-2","data-testid":c,children:[n,$]}),e[44]=c,e[45]=$,e[46]=n,e[47]=T):T=e[47],T},V=d=>{const e=R(20),{counters:o,t}=d;let r;e[0]!==t?(r=t("Membership probes"),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==r?(a=l("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let u;e[4]!==t?(u=t("Queries run"),e[4]=t,e[5]=u):u=e[5];let c;e[6]!==o.run||e[7]!==u?(c=l(I,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=c):c=e[8];let n;e[9]!==t?(n=t("Shared from cache"),e[9]=t,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=l(I,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==c||e[15]!==s?(i=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[c,s]}),e[14]=c,e[15]=s,e[16]=i):i=e[16];let f;return e[17]!==a||e[18]!==i?(f=m("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[a,i]}),e[17]=a,e[18]=i,e[19]=f):f=e[19],f},X=d=>{const e=R(20),{counters:o,t}=d;let r;e[0]!==t?(r=t("Global shape polls"),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==r?(a=l("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let u;e[4]!==t?(u=t("Global reads"),e[4]=t,e[5]=u):u=e[5];let c;e[6]!==o.drains||e[7]!==u?(c=l(I,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=c):c=e[8];let n;e[9]!==t?(n=t("Pairs skipped"),e[9]=t,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=l(I,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==c||e[15]!==s?(i=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[c,s]}),e[14]=c,e[15]=s,e[16]=i):i=e[16];let f;return e[17]!==a||e[18]!==i?(f=m("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[a,i]}),e[17]=a,e[18]=i,e[19]=f):f=e[19],f},me=d=>{const e=R(31),{initialShardKey:o}=d,t=O(),{queryShardKey:r,setShardKey:a,shardKey:u}=q(o);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];const{data:s,error:i,errorSource:f,refetch:N}=Q(U.getFanoutMetrics,c,n);W(N,!0);let g;e[3]!==s?(g=s!==void 0&&J(s),e[3]=s,e[4]=g):g=e[4];const k=g;let p;e[5]!==a||e[6]!==u?(p=l(E,{onChange:a,testId:"fanout-shard-input",value:u}),e[5]=a,e[6]=u,e[7]=p):p=e[7];let h;e[8]!==s||e[9]!==t?(h=s!==void 0&&m("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&l(M,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?t("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):t("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),l(M,{variant:"secondary",children:t("{count} connections",{count:s.totalConnections})}),l(M,{variant:"secondary",children:t("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=t,e[10]=h):h=e[10];let y;e[11]!==p||e[12]!==h?(y=m("div",{className:"flex flex-wrap items-center gap-2",children:[p,h]}),e[11]=p,e[12]=h,e[13]=y):y=e[13];let b;e[14]!==i||e[15]!==f?(b=i!==null&&l(B,{error:f,testId:"fanout-error"}),e[14]=i,e[15]=f,e[16]=b):b=e[16];let x;e[17]!==i||e[18]!==k||e[19]!==t?(x=i===null&&k&&l(j,{description:t("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:l("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:t("No fan-out activity yet.")}),e[17]=i,e[18]=k,e[19]=t,e[20]=x):x=e[20];let S;e[21]!==i||e[22]!==k||e[23]!==s||e[24]!==t?(S=i===null&&s!==void 0&&!k&&m(z,{children:[s.topics.length>0&&m("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[l("h3",{className:"text-sm font-medium text-foreground",children:t("Hot topics")}),l(_,{className:"overflow-hidden py-0",children:m(G,{"data-testid":"fanout-topics-table",children:[l(H,{children:m(A,{children:[l(w,{children:t("Topic")}),l(w,{children:t("Kind")}),l(w,{className:"text-right",children:t("Subscribers")})]})}),l(L,{children:s.topics.map(Y)})]})})]}),m("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[l("h2",{className:"text-sm font-medium text-muted-foreground",children:t("Fan-out cost since this instance woke")}),l(F,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t,title:t("Shape pokes")}),l(F,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t,title:t("Whisper broadcasts")}),l(V,{counters:s.shapeProbe,t}),l(X,{counters:s.globalPoll,t})]})]}),e[21]=i,e[22]=k,e[23]=s,e[24]=t,e[25]=S):S=e[25];let v;return e[26]!==y||e[27]!==b||e[28]!==x||e[29]!==S?(v=m("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,b,x,S]}),e[26]=y,e[27]=b,e[28]=x,e[29]=S,e[30]=v):v=e[30],v};function Y(d){return m(A,{"data-testid":"fanout-topic-row",children:[l(K,{className:"font-mono text-xs",children:d.topic}),l(K,{children:l(M,{variant:"outline",children:d.kind})}),l(K,{className:"text-right font-medium tabular-nums",children:d.subscribers})]},`${d.kind}:${d.topic}`)}export{me as default};
@@ -1 +0,0 @@
1
- import{useState as C}from"react";import{E as S}from"../packem_shared/error-alert-TYdKetJd.js";import{B as w}from"../packem_shared/badge-cAk9Di1Q.js";import{C as A,a as k}from"../packem_shared/card-BGlQzQY-.js";import{E as g}from"../packem_shared/empty-state-B939z6K2.js";import{L as E}from"../packem_shared/label-BOUo-DP0.js";import{T as O,a as F,b as x,c as s,d as j,e as n}from"../packem_shared/table-BMsuYFhk.js";import{T as I}from"../packem_shared/textarea-DpO3i-Qo.js";import{u as J}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useT as L}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as B}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{jsx as e,jsxs as l}from"react/jsx-runtime";const H=a=>{const t=a.trim();if(t.length===0)return{context:void 0,error:null};try{const o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},K='{ "targetingKey": "user-123", "plan": "premium" }',R=a=>a.type==="object"?JSON.stringify(a.value):String(a.value),W=({initialShardKey:a=""})=>{const t=L(),[o,p]=C(""),{context:c,error:f}=H(o),h=c===void 0?{}:{context:c},{data:i,error:y,errorSource:v,liveError:N}=J(B.listFlags,h,{live:!0,shardKey:a}),m=i!==void 0,b=i?.configured??!1,u=Array.isArray(i?.flags)?[...i.flags].toSorted((r,T)=>r.key.localeCompare(T.key)):[];let d;return m&&!b?d=e(g,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")}):m&&u.length===0?d=e(g,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")}):d=e(A,{className:"overflow-hidden py-0",children:e(k,{className:"px-0",children:l(O,{"data-testid":"flags-table",children:[e(F,{children:l(x,{children:[e(s,{children:t("Key")}),e(s,{children:t("Type")}),e(s,{children:t("Value")}),e(s,{children:t("Reason")}),e(s,{children:t("Variant")})]})}),e(j,{children:u.map(r=>l(x,{"data-testid":`flags-row-${r.key}`,children:[e(n,{className:"font-mono text-xs",children:r.key}),e(n,{className:"font-mono text-xs text-muted-foreground",children:r.type}),e(n,{className:"font-mono text-xs",children:R(r)}),e(n,{children:r.errorCode===void 0?e("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"—"}):e(w,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode})}),e(n,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"—"})]},r.key))})]})})}),l("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[y!==null&&e(S,{error:v,testId:"flags-error"}),e("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')}),l("div",{className:"flex flex-col gap-2",children:[e(E,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")}),e(I,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:r=>{p(r.target.value)},placeholder:K,rows:3,value:o}),f!==null&&e("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(f)}),N!==void 0&&e("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")})]}),d]})};export{W as default};
@@ -1 +0,0 @@
1
- import{c as xe}from"react/compiler-runtime";import{findIssueSolution as we,flattenHint as Ee}from"@lunora/errors";import{useLunora as Ne}from"@lunora/react";import{useState as ne}from"react";import{L as Te}from"../packem_shared/live-status-Bf7rR8o8.js";import{ShardInput as $e}from"../packem_shared/ShardInput-CdawpUiS.js";import{B as pe}from"../packem_shared/badge-cAk9Di1Q.js";import{B as oe}from"../packem_shared/button-BOPLD1un.js";import{C as Ae,a as Ce}from"../packem_shared/card-BGlQzQY-.js";import{E as _e}from"../packem_shared/empty-state-B939z6K2.js";import{I as ke}from"../packem_shared/input-CY5W3wzv.js";import{S as Me,a as Re,b as Ke,c as be,d as Le}from"../packem_shared/select-BPISLTcv.js";import{T as Ve,a as Oe,b as ye,c as F,d as Ue,e as B}from"../packem_shared/table-BMsuYFhk.js";import{u as Be}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{u as Fe}from"../packem_shared/use-async-submit-DdLd0MdK.js";import{u as ze}from"../packem_shared/use-shard-key-BsP3o5wT.js";import{useT as ve}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as ie}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{i as He,f as re,c as de,d as Ie,b as je}from"../packem_shared/internal-CwaF9YNk.js";import{jsx as s,jsxs as w,Fragment as De}from"react/jsx-runtime";const ge="none",qe=["all","open","resolved","ignored"],Ge=["critical","high","medium","low"],Pe=de(ie.resolveIssue),We=de(ie.ignoreIssue),Se=de(ie.assignIssue),Ye=de(ie.setIssueSeverity),Qe=de(ie.explainIssue),Xe=n=>Array.isArray(n?.issues)?n.issues:[],Je=n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning",Ze=n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary",et=n=>{const e=xe(44),{expanded:h,issue:t,shardKey:E}=n,i=Ne(),r=ve(),[a,o]=ne(void 0),{busy:R,error:A,run:L}=Fe();let C;e[0]!==i||e[1]!==t||e[2]!==L||e[3]!==E?(C=()=>{o(void 0),L(async()=>{const f={culprit:t.culprit,sampleMessage:t.sampleMessage,title:t.title},I=await i.query(Qe,f,Ie(E));o(I)})},e[0]=i,e[1]=t,e[2]=L,e[3]=E,e[4]=C):C=e[4];const K=C;if(!h)return null;let T;if(e[5]!==t.sampleMessage){const f=we(t.sampleMessage);T=f===void 0?void 0:Ee(f.body),e[5]=t.sampleMessage,e[6]=T}else T=e[6];const _=T,M=`issues-detail-${t.hash}`;let d;e[7]!==t.sampleMessage?(d=s("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:t.sampleMessage}),e[7]=t.sampleMessage,e[8]=d):d=e[8];let g;e[9]!==r?(g=r("Suggested fix"),e[9]=r,e[10]=g):g=e[10];let $;e[11]!==g?($=s("div",{className:"text-xs font-medium text-muted-foreground",children:g}),e[11]=g,e[12]=$):$=e[12];let x;e[13]!==_||e[14]!==t.hash||e[15]!==r?(x=_===void 0?s("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${t.hash}`,children:r("No known fix for this error yet.")}):s("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${t.hash}`,children:_}),e[13]=_,e[14]=t.hash,e[15]=r,e[16]=x):x=e[16];let y;e[17]!==$||e[18]!==x?(y=w("div",{children:[$,x]}),e[17]=$,e[18]=x,e[19]=y):y=e[19];const S=`issues-explain-${t.hash}`;let N;e[20]!==R||e[21]!==r?(N=r(R?"Explaining…":"Explain in plain language"),e[20]=R,e[21]=r,e[22]=N):N=e[22];let u;e[23]!==R||e[24]!==K||e[25]!==N||e[26]!==S?(u=s("div",{children:s(oe,{"data-testid":S,disabled:R,onClick:K,size:"sm",type:"button",variant:"outline",children:N})}),e[23]=R,e[24]=K,e[25]=N,e[26]=S,e[27]=u):u=e[27];let p;e[28]!==A||e[29]!==t.hash?(p=A!==null&&s("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${t.hash}`,role:"alert",children:A}),e[28]=A,e[29]=t.hash,e[30]=p):p=e[30];let m;e[31]!==a||e[32]!==t.hash||e[33]!==r?(m=a!==void 0&&(a.degraded?s("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${t.hash}`,children:a.reason==="no-ai-binding"?r("No AI binding is configured. Wire an AI binding to enable plain-language explanations — the suggested fix above is always available."):r("The AI model could not explain this error right now. The suggested fix above still applies.")}):w("div",{"data-testid":`issues-explanation-${t.hash}`,children:[s("div",{className:"text-xs font-medium text-muted-foreground",children:r("AI explanation")}),s("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&s("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${t.hash}`,children:r("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),s("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:r("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=t.hash,e[33]=r,e[34]=m):m=e[34];let c;e[35]!==u||e[36]!==p||e[37]!==m||e[38]!==d||e[39]!==y?(c=s(B,{className:"bg-muted/30",colSpan:7,children:w("div",{className:"flex flex-col gap-3 py-1",children:[d,y,u,p,m]})}),e[35]=u,e[36]=p,e[37]=m,e[38]=d,e[39]=y,e[40]=c):c=e[40];let b;return e[41]!==c||e[42]!==M?(b=s(ye,{"data-testid":M,children:c}),e[41]=c,e[42]=M,e[43]=b):b=e[43],b},tt=n=>{const e=xe(119),{busy:h,issue:t,rowError:E,runTriage:i,shardKey:r}=n,a=ve(),[o,R]=ne(!1);let A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{R(st)},e[0]=A):A=e[0];const L=A;let C;e[1]!==t.hash||e[2]!==i?(C=ae=>{const he=ae===null||ae===ge?null:ae;re(i(t.hash,Ye,{severity:he}))},e[1]=t.hash,e[2]=i,e[3]=C):C=e[3];const K=C;let T;e[4]!==t.hash||e[5]!==i?(T=ae=>{if(ae.key!=="Enter")return;const he=ae.currentTarget.value.trim();re(i(t.hash,Se,{assignee:he===""?null:he}))},e[4]=t.hash,e[5]=i,e[6]=T):T=e[6];const _=T,M=`issues-row-${t.hash}`;let d;e[7]!==a?(d=a("Toggle issue details"),e[7]=a,e[8]=d):d=e[8];const g=`issues-toggle-${t.hash}`,$=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`;let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s("path",{d:"m9 6 6 6-6 6"}),e[9]=x):x=e[9];let y;e[10]!==$?(y=s("svg",{"aria-hidden":"true",className:$,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:x}),e[10]=$,e[11]=y):y=e[11];let S;e[12]!==t.title?(S=s("span",{className:"block truncate font-medium",title:t.title,children:t.title}),e[12]=t.title,e[13]=S):S=e[13];let N;e[14]!==t.culprit?(N=s("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:t.culprit,children:t.culprit}),e[14]=t.culprit,e[15]=N):N=e[15];let u;e[16]!==S||e[17]!==N?(u=w("span",{className:"min-w-0",children:[S,N]}),e[16]=S,e[17]=N,e[18]=u):u=e[18];let p;e[19]!==o||e[20]!==u||e[21]!==d||e[22]!==g||e[23]!==y?(p=w("button",{"aria-expanded":o,"aria-label":d,className:"flex w-full items-start gap-2 text-left","data-testid":g,onClick:L,type:"button",children:[y,u]}),e[19]=o,e[20]=u,e[21]=d,e[22]=g,e[23]=y,e[24]=p):p=e[24];let m;e[25]!==t.hash||e[26]!==E?(m=E!==void 0&&s("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${t.hash}`,role:"alert",children:E}),e[25]=t.hash,e[26]=E,e[27]=m):m=e[27];let c;e[28]!==p||e[29]!==m?(c=w(B,{className:"max-w-80",children:[p,m]}),e[28]=p,e[29]=m,e[30]=c):c=e[30];const b=`issues-status-${t.hash}`;let f;e[31]!==t.status?(f=Je(t.status),e[31]=t.status,e[32]=f):f=e[32];let I;e[33]!==t.status||e[34]!==b||e[35]!==f?(I=s(B,{children:s(pe,{"data-testid":b,variant:f,children:t.status})}),e[33]=t.status,e[34]=b,e[35]=f,e[36]=I):I=e[36];const V=t.severity??ge;let l;e[37]!==a?(l=a("Set severity"),e[37]=a,e[38]=l):l=e[38];const le=`issues-severity-${t.hash}`;let O;e[39]!==a?(O=a("—"),e[39]=a,e[40]=O):O=e[40];let v;e[41]!==t.severity||e[42]!==a?(v=t.severity===void 0?s("span",{className:"text-muted-foreground",children:a("—")}):s(pe,{variant:Ze(t.severity),children:t.severity}),e[41]=t.severity,e[42]=a,e[43]=v):v=e[43];let k;e[44]!==O||e[45]!==v?(k=s(Me,{placeholder:O,children:v}),e[44]=O,e[45]=v,e[46]=k):k=e[46];let U;e[47]!==l||e[48]!==le||e[49]!==k?(U=s(Re,{"aria-label":l,className:"h-7 w-[110px]","data-testid":le,children:k}),e[47]=l,e[48]=le,e[49]=k,e[50]=U):U=e[50];let z;e[51]===Symbol.for("react.memo_cache_sentinel")?(z=Ge.map(at),e[51]=z):z=e[51];let H;e[52]!==a?(H=a("Clear"),e[52]=a,e[53]=H):H=e[53];let j;e[54]!==H?(j=w(Ke,{children:[z,s(be,{value:ge,children:H})]}),e[54]=H,e[55]=j):j=e[55];let D;e[56]!==h||e[57]!==K||e[58]!==V||e[59]!==U||e[60]!==j?(D=s(B,{children:w(Le,{disabled:h,onValueChange:K,value:V,children:[U,j]})}),e[56]=h,e[57]=K,e[58]=V,e[59]=U,e[60]=j,e[61]=D):D=e[61];let q;e[62]!==a?(q=a("Assignee"),e[62]=a,e[63]=q):q=e[63];const ue=`issues-assignee-${t.hash}`,me=t.assignee??"",fe=t.assignee??"";let G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let P;e[66]!==h||e[67]!==_||e[68]!==q||e[69]!==ue||e[70]!==me||e[71]!==fe||e[72]!==G?(P=s(B,{children:s(ke,{"aria-label":q,className:"h-7 w-32","data-testid":ue,defaultValue:me,disabled:h,onKeyDown:_,placeholder:G},fe)}),e[66]=h,e[67]=_,e[68]=q,e[69]=ue,e[70]=me,e[71]=fe,e[72]=G,e[73]=P):P=e[73];let W;e[74]!==t.count?(W=s(B,{className:"text-right",children:s(pe,{variant:"secondary",children:t.count})}),e[74]=t.count,e[75]=W):W=e[75];let Y;e[76]!==t.lastSeen?(Y=He(t.lastSeen),e[76]=t.lastSeen,e[77]=Y):Y=e[77];let Q;e[78]!==Y?(Q=s(B,{className:"text-xs tabular-nums text-muted-foreground",children:Y}),e[78]=Y,e[79]=Q):Q=e[79];let X;e[80]!==h||e[81]!==t.hash||e[82]!==t.status||e[83]!==i||e[84]!==a?(X=t.status!=="resolved"&&s(oe,{"data-testid":`issues-resolve-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,Pe,{}))},size:"xs",variant:"outline",children:a("Resolve")}),e[80]=h,e[81]=t.hash,e[82]=t.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let J;e[86]!==h||e[87]!==t.hash||e[88]!==t.status||e[89]!==i||e[90]!==a?(J=t.status!=="ignored"&&s(oe,{"data-testid":`issues-ignore-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,We,{}))},size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=h,e[87]=t.hash,e[88]=t.status,e[89]=i,e[90]=a,e[91]=J):J=e[91];let Z;e[92]!==h||e[93]!==t.assignee||e[94]!==t.hash||e[95]!==t.status||e[96]!==i||e[97]!==a?(Z=t.status!=="open"&&s(oe,{"data-testid":`issues-reopen-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,Se,{assignee:t.assignee??null}))},size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=h,e[93]=t.assignee,e[94]=t.hash,e[95]=t.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==J||e[101]!==Z?(ee=s(B,{className:"text-right",children:w("div",{className:"flex justify-end gap-1",children:[X,J,Z]})}),e[99]=X,e[100]=J,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==c||e[104]!==I||e[105]!==D||e[106]!==P||e[107]!==W||e[108]!==Q||e[109]!==M||e[110]!==ee?(te=w(ye,{"data-testid":M,children:[c,I,D,P,W,Q,ee]}),e[103]=c,e[104]=I,e[105]=D,e[106]=P,e[107]=W,e[108]=Q,e[109]=M,e[110]=ee,e[111]=te):te=e[111];let se;e[112]!==o||e[113]!==t||e[114]!==r?(se=s(et,{expanded:o,issue:t,shardKey:r},t.sampleMessage),e[112]=o,e[113]=t,e[114]=r,e[115]=se):se=e[115];let ce;return e[116]!==te||e[117]!==se?(ce=w(De,{children:[te,se]}),e[116]=te,e[117]=se,e[118]=ce):ce=e[118],ce},Tt=n=>{const e=xe(38),{initialShardKey:h}=n,t=ve(),E=Ne(),{queryShardKey:i,setShardKey:r,shardKey:a}=ze(h),[o,R]=ne("all"),[A,L]=ne(it),[C,K]=ne(lt);let T;e[0]!==o?(T=o==="all"?{}:{status:o},e[0]=o,e[1]=T):T=e[1];let _;e[2]!==i?(_={live:!0,shardKey:i},e[2]=i,e[3]=_):_=e[3];const{data:M,error:d,liveError:g}=Be(ie.getIssues,T,_),$=M!==void 0;let x;if(e[4]!==C||e[5]!==A||e[6]!==E||e[7]!==M||e[8]!==d||e[9]!==g||e[10]!==$||e[11]!==i||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==t){const y=Xe(M);let S;e[17]!==E||e[18]!==i?(S=async(l,le,O)=>{K(v=>{if(!v.has(l))return v;const k=new Map(v);return k.delete(l),k}),L(v=>new Set(v).add(l));try{await E.query(le,{...O,hash:l},Ie(i))}catch(v){const U=je(v);K(z=>new Map(z).set(l,U))}L(v=>{const k=new Set(v);return k.delete(l),k})},e[17]=E,e[18]=i,e[19]=S):S=e[19];const N=S;let u;e[20]!==t?(u=l=>t(l==="all"?"All":l==="open"?"Open":l==="resolved"?"Resolved":"Ignored"),e[20]=t,e[21]=u):u=e[21];const p=u;let m;e[22]!==d?(m=d!==null&&s("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:d}),e[22]=d,e[23]=m):m=e[23];let c;e[24]!==r||e[25]!==a?(c=s($e,{onChange:r,testId:"issues-shard-input",value:a}),e[24]=r,e[25]=a,e[26]=c):c=e[26];let b;e[27]!==g?(b=s(Te,{message:g,prefix:"issues"}),e[27]=g,e[28]=b):b=e[28];let f;e[29]!==o||e[30]!==p?(f=qe.map(l=>s(oe,{"data-active":o===l?"":void 0,"data-testid":`issues-filter-${l}`,onClick:()=>{R(l)},size:"xs",variant:o===l?"default":"outline",children:p(l)},l)),e[29]=o,e[30]=p,e[31]=f):f=e[31];let I;e[32]!==f?(I=s("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:f}),e[32]=f,e[33]=I):I=e[33];let V;e[34]!==I||e[35]!==c||e[36]!==b?(V=w("div",{className:"flex flex-wrap items-center gap-2",children:[c,b,I]}),e[34]=I,e[35]=c,e[36]=b,e[37]=V):V=e[37],x=w("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[m,V,$&&y.length===0?s(_e,{description:t("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:t("No issues")}):s(Ae,{className:"overflow-hidden py-0",children:s(Ce,{className:"px-0",children:w(Ve,{"data-testid":"issues-table",children:[s(Oe,{children:w(ye,{children:[s(F,{children:t("Issue")}),s(F,{children:t("Status")}),s(F,{children:t("Severity")}),s(F,{children:t("Assignee")}),s(F,{className:"text-right",children:t("Events")}),s(F,{children:t("Last seen")}),s(F,{className:"text-right",children:t("Actions")})]})}),s(Ue,{children:y.map(l=>s(tt,{busy:A.has(l.hash),issue:l,rowError:C.get(l.hash),runTriage:N,shardKey:i},l.hash))})]})})})]}),e[4]=C,e[5]=A,e[6]=E,e[7]=M,e[8]=d,e[9]=g,e[10]=$,e[11]=i,e[12]=r,e[13]=a,e[14]=o,e[15]=t,e[16]=x}else x=e[16];return x};function st(n){return!n}function at(n){return s(be,{value:n,children:n},n)}function it(){return new Set}function lt(){return new Map}export{Tt as default};
@@ -1 +0,0 @@
1
- import{useLunora as ee}from"@lunora/react";import{useState as Z,useReducer as le,useEffect as ae}from"react";import{C as ve,a as fe}from"../packem_shared/card-BGlQzQY-.js";import{E as Ee}from"../packem_shared/empty-state-B939z6K2.js";import{T as pe,a as he,b as X,c as q,d as ye,e as Q}from"../packem_shared/table-BMsuYFhk.js";import{useT as G}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{f as H,b as R,l as Fe,g as se}from"../packem_shared/internal-CwaF9YNk.js";import{B as P}from"../packem_shared/button-BOPLD1un.js";import{C as ne}from"../packem_shared/checkbox-C5w53W-E.js";import{I as re}from"../packem_shared/input-CY5W3wzv.js";import{b as ie,c as de,d as oe,e as ce}from"../packem_shared/studio-CXai1O2K.js";import{c as te}from"react/compiler-runtime";import{L as W}from"../packem_shared/label-BOUo-DP0.js";import{T as ke}from"../packem_shared/textarea-DpO3i-Qo.js";import{c as Ke,S as Ve,a as Ie,b as _e,d as Me}from"../packem_shared/select-BPISLTcv.js";import{jsx as r,jsxs as w,Fragment as be}from"react/jsx-runtime";import{B as Le}from"../packem_shared/badge-cAk9Di1Q.js";const Be=a=>{const e=a.trim();if(e==="")return;const n=Number(e);return Number.isFinite(n)&&n>0?Math.floor(n):void 0},Oe=a=>a===void 0?"—":new Date(a*1e3).toISOString(),Ae=a=>new TextEncoder().encode(a).length,ge=a=>{if(a.trim()!=="")try{return JSON.stringify(JSON.parse(a),void 0,2)}catch{return}},xe=a=>{if(a.trim()==="")return!0;try{return JSON.parse(a),!0}catch{return!1}},Ne=[{key:"seconds",seconds:1},{key:"minutes",seconds:60},{key:"hours",seconds:3600},{key:"days",seconds:86400}],ue=(a,e)=>{const n=a.trim();if(n==="")return"";const c=Number(n),i=Ne.find(m=>m.key===e)?.seconds??1;return Number.isFinite(c)&&c>0?String(Math.round(c*i)):n},Ce=a=>{const e=a.trim();if(e==="")return!0;const n=Number(e);return Number.isInteger(n)&&n>=60},Se=(a,e,n,c)=>{const i=Be(a.ttl);return{expiration:i===void 0?c:void 0,expirationTtl:i,key:e,metadata:a.metadata.trim()===""?void 0:JSON.parse(a.metadata),namespace:n,value:a.value}},we=a=>{const e=te(60),{helper:n,id:c,invalid:i,onChange:m,testId:d}=a,t=G(),[l,v]=Z(""),[o,g]=Z("seconds");let k;e[0]!==m||e[1]!==o?(k=b=>{v(b.target.value),m(ue(b.target.value,o))},e[0]=m,e[1]=o,e[2]=k):k=e[2];const M=k;let K;e[3]!==l||e[4]!==m?(K=b=>{b!==null&&(g(b),m(ue(l,b)))},e[3]=l,e[4]=m,e[5]=K):K=e[5];const L=K;let f;e[6]!==t?(f=t("days"),e[6]=t,e[7]=f):f=e[7];let u;e[8]!==t?(u=t("hours"),e[8]=t,e[9]=u):u=e[9];let p;e[10]!==t?(p=t("minutes"),e[10]=t,e[11]=p):p=e[11];let x;e[12]!==t?(x=t("seconds"),e[12]=t,e[13]=x):x=e[13];let N;e[14]!==f||e[15]!==u||e[16]!==p||e[17]!==x?(N={days:f,hours:u,minutes:p,seconds:x},e[14]=f,e[15]=u,e[16]=p,e[17]=x,e[18]=N):N=e[18];const C=N;let y;e[19]!==t?(y=t("Expires after"),e[19]=t,e[20]=y):y=e[20];let S;e[21]!==c||e[22]!==y?(S=r(W,{className:"text-xs",htmlFor:c,children:y}),e[21]=c,e[22]=y,e[23]=S):S=e[23];let F;e[24]!==t?(F=t("No expiration"),e[24]=t,e[25]=F):F=e[25];let O;e[26]!==l||e[27]!==c||e[28]!==i||e[29]!==M||e[30]!==F||e[31]!==d?(O=r(re,{"aria-invalid":i,className:"flex-1","data-testid":d,id:c,inputMode:"numeric",onChange:M,placeholder:F,value:l}),e[26]=l,e[27]=c,e[28]=i,e[29]=M,e[30]=F,e[31]=d,e[32]=O):O=e[32];let V;e[33]!==t?(V=t("TTL unit"),e[33]=t,e[34]=V):V=e[34];const D=`${d}-unit`;let A;e[35]===Symbol.for("react.memo_cache_sentinel")?(A=r(Ve,{}),e[35]=A):A=e[35];let I;e[36]!==V||e[37]!==D?(I=r(Ie,{"aria-label":V,className:"w-[7.5rem]","data-testid":D,children:A}),e[36]=V,e[37]=D,e[38]=I):I=e[38];let s;e[39]!==C?(s=Ne.map(b=>r(Ke,{value:b.key,children:C[b.key]},b.key)),e[39]=C,e[40]=s):s=e[40];let h;e[41]!==s?(h=r(_e,{children:s}),e[41]=s,e[42]=h):h=e[42];let T;e[43]!==L||e[44]!==I||e[45]!==h||e[46]!==o?(T=w(Me,{onValueChange:L,value:o,children:[I,h]}),e[43]=L,e[44]=I,e[45]=h,e[46]=o,e[47]=T):T=e[47];let _;e[48]!==O||e[49]!==T?(_=w("div",{className:"flex gap-2",children:[O,T]}),e[48]=O,e[49]=T,e[50]=_):_=e[50];let E;e[51]!==n||e[52]!==i||e[53]!==t||e[54]!==d?(E=i?r("p",{className:"text-xs text-destructive","data-testid":`${d}-invalid`,children:t("TTL must be at least 60 seconds.")}):n!==void 0&&r("p",{className:"text-xs text-muted-foreground",children:n}),e[51]=n,e[52]=i,e[53]=t,e[54]=d,e[55]=E):E=e[55];let B;return e[56]!==_||e[57]!==E||e[58]!==S?(B=w("div",{className:"mb-3 grid gap-1",children:[S,_,E]}),e[56]=_,e[57]=E,e[58]=S,e[59]=B):B=e[59],B},Te=a=>{const e=te(36),{id:n,invalidTestId:c,onChange:i,testId:m,valid:d,value:t}=a,l=G();let v;e[0]!==t?(v=ge(t),e[0]=t,e[1]=v):v=e[1];const o=v;let g;e[2]!==l?(g=l("Metadata (JSON)"),e[2]=l,e[3]=g):g=e[3];let k;e[4]!==n||e[5]!==g?(k=r(W,{className:"text-xs",htmlFor:n,children:g}),e[4]=n,e[5]=g,e[6]=k):k=e[6];const M=`${m}-format`,K=o===void 0;let L;e[7]!==o||e[8]!==i?(L=()=>{o!==void 0&&i(o)},e[7]=o,e[8]=i,e[9]=L):L=e[9];let f;e[10]!==l?(f=l("Format JSON"),e[10]=l,e[11]=f):f=e[11];let u;e[12]!==M||e[13]!==K||e[14]!==L||e[15]!==f?(u=r(P,{"data-testid":M,disabled:K,onClick:L,size:"sm",variant:"outline",children:f}),e[12]=M,e[13]=K,e[14]=L,e[15]=f,e[16]=u):u=e[16];let p;e[17]!==k||e[18]!==u?(p=w("div",{className:"flex items-center justify-between gap-2",children:[k,u]}),e[17]=k,e[18]=u,e[19]=p):p=e[19];const x=!d;let N;e[20]!==i?(N=F=>{i(F.target.value)},e[20]=i,e[21]=N):N=e[21];let C;e[22]!==n||e[23]!==x||e[24]!==N||e[25]!==m||e[26]!==t?(C=r(ke,{"aria-invalid":x,className:"min-h-[4rem] font-mono text-xs","data-testid":m,id:n,onChange:N,value:t}),e[22]=n,e[23]=x,e[24]=N,e[25]=m,e[26]=t,e[27]=C):C=e[27];let y;e[28]!==c||e[29]!==l||e[30]!==d?(y=!d&&r("p",{className:"text-xs text-destructive","data-testid":c,children:l("Metadata must be valid JSON.")}),e[28]=c,e[29]=l,e[30]=d,e[31]=y):y=e[31];let S;return e[32]!==C||e[33]!==y||e[34]!==p?(S=w("div",{className:"mb-3 grid gap-1",children:[p,C,y]}),e[32]=C,e[33]=y,e[34]=p,e[35]=S):S=e[35],S},De={busy:!1,error:null,metadata:"",name:"",ttl:"",value:""},Je=(a,e)=>{switch(e.type){case"setField":return{...a,[e.field]:e.value};case"submitFailed":return{...a,busy:!1,error:e.error};case"submitStart":return{...a,busy:!0,error:null};default:return a}},Pe=a=>{const e=te(73),{namespace:n,onCancel:c,onCreated:i}=a,m=ee(),d=G(),[t,l]=le(Je,De);let v;e[0]!==t.metadata?(v=xe(t.metadata),e[0]=t.metadata,e[1]=v):v=e[1];const o=v;let g;e[2]!==t.ttl?(g=Ce(t.ttl),e[2]=t.ttl,e[3]=g):g=e[3];const k=g;let M;e[4]!==o||e[5]!==t.busy||e[6]!==t.name||e[7]!==k?(M=t.name.trim()!==""&&o&&k&&!t.busy,e[4]=o,e[5]=t.busy,e[6]=t.name,e[7]=k,e[8]=M):M=e[8];const K=M;let L;e[9]!==K||e[10]!==m||e[11]!==n||e[12]!==i||e[13]!==t.metadata||e[14]!==t.name||e[15]!==t.ttl||e[16]!==t.value?(L=()=>{K&&(l({type:"submitStart"}),H((async()=>{try{await m.putKvValue(Se({metadata:t.metadata,ttl:t.ttl,value:t.value},t.name,n)),i()}catch($){l({error:R($),type:"submitFailed"})}})()))},e[9]=K,e[10]=m,e[11]=n,e[12]=i,e[13]=t.metadata,e[14]=t.name,e[15]=t.ttl,e[16]=t.value,e[17]=L):L=e[17];const f=L;let u;e[18]!==d?(u=d("Key name"),e[18]=d,e[19]=u):u=e[19];let p;e[20]!==u?(p=r(W,{className:"text-xs",htmlFor:"kv-create-name",children:u}),e[20]=u,e[21]=p):p=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=$=>{l({field:"name",type:"setField",value:$.target.value})},e[22]=x):x=e[22];let N;e[23]!==d?(N=d("Key name"),e[23]=d,e[24]=N):N=e[24];let C;e[25]!==t.name||e[26]!==N?(C=r(re,{autoFocus:!0,"data-testid":"kv-create-name",id:"kv-create-name",onChange:x,placeholder:N,value:t.name}),e[25]=t.name,e[26]=N,e[27]=C):C=e[27];let y;e[28]!==p||e[29]!==C?(y=w("div",{className:"grid gap-1",children:[p,C]}),e[28]=p,e[29]=C,e[30]=y):y=e[30];let S;e[31]!==d?(S=d("Value"),e[31]=d,e[32]=S):S=e[32];let F;e[33]!==S?(F=r(W,{className:"text-xs",htmlFor:"kv-create-value",children:S}),e[33]=S,e[34]=F):F=e[34];let O;e[35]===Symbol.for("react.memo_cache_sentinel")?(O=$=>{l({field:"value",type:"setField",value:$.target.value})},e[35]=O):O=e[35];let V;e[36]!==t.value?(V=r(ke,{className:"min-h-[6rem] font-mono text-xs","data-testid":"kv-create-value",id:"kv-create-value",onChange:O,value:t.value}),e[36]=t.value,e[37]=V):V=e[37];let D;e[38]!==F||e[39]!==V?(D=w("div",{className:"grid gap-1",children:[F,V]}),e[38]=F,e[39]=V,e[40]=D):D=e[40];const A=!k;let I;e[41]===Symbol.for("react.memo_cache_sentinel")?(I=$=>{l({field:"ttl",type:"setField",value:$})},e[41]=I):I=e[41];let s;e[42]!==A?(s=r(we,{id:"kv-create-ttl",invalid:A,onChange:I,testId:"kv-create-ttl"}),e[42]=A,e[43]=s):s=e[43];let h;e[44]===Symbol.for("react.memo_cache_sentinel")?(h=$=>{l({field:"metadata",type:"setField",value:$})},e[44]=h):h=e[44];let T;e[45]!==o||e[46]!==t.metadata?(T=r(Te,{id:"kv-create-metadata",invalidTestId:"kv-create-metadata-invalid",onChange:h,testId:"kv-create-metadata",valid:o,value:t.metadata}),e[45]=o,e[46]=t.metadata,e[47]=T):T=e[47];const _=!K;let E;e[48]!==t.busy||e[49]!==d?(E=t.busy?d("Creating…"):d("Create key"),e[48]=t.busy,e[49]=d,e[50]=E):E=e[50];let B;e[51]!==f||e[52]!==_||e[53]!==E?(B=r(P,{"data-testid":"kv-create-submit",disabled:_,onClick:f,children:E}),e[51]=f,e[52]=_,e[53]=E,e[54]=B):B=e[54];const b=t.busy;let J;e[55]!==d?(J=d("Cancel"),e[55]=d,e[56]=J):J=e[56];let j;e[57]!==c||e[58]!==t.busy||e[59]!==J?(j=r(P,{"data-testid":"kv-create-cancel",disabled:b,onClick:c,variant:"outline",children:J}),e[57]=c,e[58]=t.busy,e[59]=J,e[60]=j):j=e[60];let z;e[61]!==B||e[62]!==j?(z=w("div",{className:"flex flex-wrap gap-2",children:[B,j]}),e[61]=B,e[62]=j,e[63]=z):z=e[63];let U;e[64]!==t.error?(U=t.error!==null&&r("p",{className:"text-sm text-destructive","data-testid":"kv-create-error",role:"alert",children:t.error}),e[64]=t.error,e[65]=U):U=e[65];let Y;return e[66]!==y||e[67]!==D||e[68]!==s||e[69]!==T||e[70]!==z||e[71]!==U?(Y=w("div",{className:"grid gap-3 px-4 pb-4","data-testid":"kv-create-form",children:[y,D,s,T,z,U]}),e[66]=y,e[67]=D,e[68]=s,e[69]=T,e[70]=z,e[71]=U,e[72]=Y):Y=e[72],Y},$e={busy:"",editedMetadata:"",editedTtl:"",editedValue:"",loadError:null,loading:!0,value:null,writeError:null},je=(a,e)=>{switch(e.type){case"deleteStart":return{...a,busy:"deleting",writeError:null};case"editMetadata":return{...a,editedMetadata:e.value};case"editTtl":return{...a,editedTtl:e.value};case"editValue":return{...a,editedValue:e.value};case"loaded":return{...a,editedMetadata:e.metadata===null||e.metadata===void 0?"":JSON.stringify(e.metadata,null,2),editedValue:e.value??"",loading:!1,value:e.value};case"loadFailed":return{...a,loadError:e.error,loading:!1};case"saveOk":return{...a,busy:"",value:a.editedValue};case"saveStart":return{...a,busy:"saving",writeError:null};case"writeFailed":return{...a,busy:"",writeError:e.error};default:return a}},He=a=>{const e=te(67),{expiration:n,keyName:c,namespace:i,onDeleted:m}=a,d=ee(),t=G(),[l,v]=le(je,$e);let o,g;e[0]!==d||e[1]!==c||e[2]!==i?(o=()=>{const b={cancelled:!1};return H((async()=>{try{const J=await d.getKvValue({key:c,namespace:i});b.cancelled||v({metadata:J.metadata,type:"loaded",value:J.value})}catch(J){const j=J;b.cancelled||v({error:R(j),type:"loadFailed"})}})()),()=>{b.cancelled=!0}},g=[d,i,c],e[0]=d,e[1]=c,e[2]=i,e[3]=o,e[4]=g):(o=e[3],g=e[4]),ae(o,g);let k;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=b=>{v({type:"editValue",value:b.target.value})},e[5]=k):k=e[5];const M=k;let K;e[6]===Symbol.for("react.memo_cache_sentinel")?(K=b=>{v({type:"editMetadata",value:b})},e[6]=K):K=e[6];const L=K;let f;e[7]!==l.editedValue?(f=ge(l.editedValue),e[7]=l.editedValue,e[8]=f):f=e[8];const u=f;let p;e[9]!==l.editedMetadata?(p=xe(l.editedMetadata),e[9]=l.editedMetadata,e[10]=p):p=e[10];const x=p;let N;e[11]!==l.editedTtl?(N=Ce(l.editedTtl),e[11]=l.editedTtl,e[12]=N):N=e[12];const C=N;let y;e[13]!==u?(y=()=>{u!==void 0&&v({type:"editValue",value:u})},e[13]=u,e[14]=y):y=e[14];const S=y;let F;e[15]!==d||e[16]!==n||e[17]!==c||e[18]!==x||e[19]!==i||e[20]!==l.editedMetadata||e[21]!==l.editedTtl||e[22]!==l.editedValue||e[23]!==t?(F=()=>{if(!x){v({error:t("Metadata must be valid JSON."),type:"writeFailed"});return}v({type:"saveStart"}),H((async()=>{try{await d.putKvValue(Se({metadata:l.editedMetadata,ttl:l.editedTtl,value:l.editedValue},c,i,n)),v({type:"saveOk"})}catch(b){v({error:R(b),type:"writeFailed"})}})())},e[15]=d,e[16]=n,e[17]=c,e[18]=x,e[19]=i,e[20]=l.editedMetadata,e[21]=l.editedTtl,e[22]=l.editedValue,e[23]=t,e[24]=F):F=e[24];const O=F;let V;e[25]!==d||e[26]!==c||e[27]!==i||e[28]!==m?(V=()=>{v({type:"deleteStart"}),H((async()=>{try{await d.deleteKvKey({key:c,namespace:i}),m(c)}catch(b){v({error:R(b),type:"writeFailed"})}})())},e[25]=d,e[26]=c,e[27]=i,e[28]=m,e[29]=V):V=e[29];const D=V;let A;e[30]!==c?(A=()=>{se(c)},e[30]=c,e[31]=A):A=e[31];let I;e[32]!==t?(I=t("Copy key"),e[32]=t,e[33]=I):I=e[33];let s;e[34]!==A||e[35]!==I?(s=r("div",{className:"mb-2 flex justify-end",children:r(P,{"data-testid":"kv-copy-key-btn",onClick:A,size:"sm",variant:"outline",children:I})}),e[34]=A,e[35]=I,e[36]=s):s=e[36];let h;e[37]!==l.loadError?(h=l.loadError!==null&&r("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-value-error",role:"alert",children:l.loadError}),e[37]=l.loadError,e[38]=h):h=e[38];let T;e[39]!==l.loading||e[40]!==t?(T=l.loading&&r("p",{className:"text-sm text-muted-foreground","data-testid":"kv-value-loading",children:t("Loading…")}),e[39]=l.loading,e[40]=t,e[41]=T):T=e[41];let _;e[42]!==u||e[43]!==x||e[44]!==D||e[45]!==S||e[46]!==O||e[47]!==l.busy||e[48]!==l.editedMetadata||e[49]!==l.editedValue||e[50]!==l.loading||e[51]!==l.value||e[52]!==l.writeError||e[53]!==t||e[54]!==C?(_=!l.loading&&l.value!==null&&w(be,{children:[w("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[r(W,{className:"text-xs",htmlFor:"kv-value-editor",children:t("Value")}),u!==void 0&&r(Le,{variant:"secondary",children:t("JSON")}),r("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground","data-testid":"kv-value-size",children:Fe(Ae(l.editedValue))})]}),r("textarea",{"aria-label":t("KV value"),className:"mb-2 min-h-[8rem] w-full rounded border border-border bg-muted/30 p-2 font-mono text-xs","data-testid":"kv-value-editor",id:"kv-value-editor",onChange:M,value:l.editedValue}),w("div",{className:"mb-3 flex flex-wrap gap-2",children:[r(P,{"data-testid":"kv-format-btn",disabled:u===void 0,onClick:S,size:"sm",variant:"outline",children:t("Format JSON")}),r(P,{"data-testid":"kv-copy-value-btn",onClick:()=>{se(l.editedValue)},size:"sm",variant:"outline",children:t("Copy value")})]}),r(we,{helper:t("Leave blank to keep the current expiration."),id:"kv-ttl-input",invalid:!C,onChange:b=>{v({type:"editTtl",value:b})},testId:"kv-ttl-input"}),r(Te,{id:"kv-metadata-editor",invalidTestId:"kv-metadata-invalid",onChange:L,testId:"kv-metadata-editor",valid:x,value:l.editedMetadata}),w("div",{className:"flex flex-wrap gap-2",children:[r(P,{"data-testid":"kv-save-btn",disabled:l.busy!==""||!x||!C,onClick:O,children:l.busy==="saving"?t("Saving…"):t("Save")}),r(P,{"data-testid":"kv-delete-btn",disabled:l.busy!=="",onClick:D,variant:"destructive",children:l.busy==="deleting"?t("Deleting…"):t("Delete")})]}),l.writeError!==null&&r("p",{className:"mt-2 text-sm text-destructive","data-testid":"kv-save-error",role:"alert",children:l.writeError})]}),e[42]=u,e[43]=x,e[44]=D,e[45]=S,e[46]=O,e[47]=l.busy,e[48]=l.editedMetadata,e[49]=l.editedValue,e[50]=l.loading,e[51]=l.value,e[52]=l.writeError,e[53]=t,e[54]=C,e[55]=_):_=e[55];let E;e[56]!==l.loadError||e[57]!==l.loading||e[58]!==l.value||e[59]!==t?(E=!l.loading&&l.value===null&&l.loadError===null&&r("p",{className:"text-sm text-muted-foreground","data-testid":"kv-absent",children:t("Key is absent or has no value.")}),e[56]=l.loadError,e[57]=l.loading,e[58]=l.value,e[59]=t,e[60]=E):E=e[60];let B;return e[61]!==s||e[62]!==h||e[63]!==T||e[64]!==_||e[65]!==E?(B=w("div",{className:"px-4 pb-4","data-testid":"kv-value-section",children:[s,h,T,_,E]}),e[61]=s,e[62]=h,e[63]=T,e[64]=_,e[65]=E,e[66]=B):B=e[66],B},me=100,Re={appliedPrefix:"",bulk:[],bulkBusy:!1,bulkError:null,cursor:null,keys:null,listComplete:!1,loadError:null,loading:!1,prefixInput:"",reloadNonce:0,selectedKey:null},ze=(a,e)=>{switch(e.type){case"appendPage":return{...a,cursor:e.cursor,keys:[...a.keys??[],...e.keys],listComplete:e.listComplete,loading:!1};case"applyFilter":return{...a,appliedPrefix:a.prefixInput,bulk:[],bulkError:null,cursor:null,keys:null,listComplete:!1,selectedKey:null};case"bulkDeleted":{const n=new Set(e.deleted);return{...a,bulk:a.bulk.filter(c=>!n.has(c)),bulkBusy:!1,bulkError:e.error,keys:a.keys===null?null:a.keys.filter(c=>!n.has(c.name)),selectedKey:a.selectedKey!==null&&n.has(a.selectedKey)?null:a.selectedKey}}case"bulkDeleteStart":return{...a,bulkBusy:!0,bulkError:null};case"firstPage":return{...a,cursor:e.cursor,keys:e.keys,listComplete:e.listComplete,loading:!1};case"keyDeleted":return{...a,bulk:a.bulk.filter(n=>n!==e.name),keys:a.keys===null?null:a.keys.filter(n=>n.name!==e.name),selectedKey:null};case"loadFailed":return{...a,loadError:e.error,loading:!1};case"loadStart":return{...a,loadError:null,loading:!0};case"prefixInput":return{...a,prefixInput:e.value};case"reload":return{...a,bulk:[],bulkError:null,reloadNonce:a.reloadNonce+1,selectedKey:null};case"selectKey":return{...a,selectedKey:e.name};case"toggleAllBulk":return{...a,bulk:e.names};case"toggleBulk":return{...a,bulk:a.bulk.includes(e.name)?a.bulk.filter(n=>n!==e.name):[...a.bulk,e.name]};default:return a}},Ue=({namespace:a})=>{const e=ee(),n=G(),[c,i]=le(ze,Re),{appliedPrefix:m,bulk:d,bulkBusy:t,bulkError:l,cursor:v,keys:o,listComplete:g,loadError:k,loading:M,prefixInput:K,reloadNonce:L,selectedKey:f}=c,[u,p]=Z(!1);ae(()=>{const s={cancelled:!1};return H((async()=>{i({type:"loadStart"});try{const h=await e.listKvKeys({limit:me,namespace:a,prefix:m===""?void 0:m});s.cancelled||i({cursor:h.cursor??null,keys:h.keys,listComplete:h.listComplete,type:"firstPage"})}catch(h){s.cancelled||i({error:R(h),type:"loadFailed"})}})()),()=>{s.cancelled=!0}},[e,a,m,L]);const x=s=>{i({type:"prefixInput",value:s.target.value})},N=()=>{i({type:"applyFilter"})},C=s=>{i({name:s.currentTarget.dataset.key??null,type:"selectKey"})},y=()=>{v!==null&&(i({type:"loadStart"}),H((async()=>{try{const s=await e.listKvKeys({cursor:v,limit:me,namespace:a,prefix:m===""?void 0:m});i({cursor:s.cursor??null,keys:s.keys,listComplete:s.listComplete,type:"appendPage"})}catch(s){i({error:R(s),type:"loadFailed"})}})()))},S=s=>{i({name:s,type:"keyDeleted"})},F=s=>{i({name:s,type:"toggleBulk"})},O=s=>{i({names:s&&o!==null?o.map(h=>h.name):[],type:"toggleAllBulk"})},V=()=>{if(d.length===0)return;const s=[...d];i({type:"bulkDeleteStart"}),H((async()=>{const h=await Promise.allSettled(s.map(E=>e.deleteKvKey({key:E,namespace:a}))),T=s.filter((E,B)=>h[B]?.status==="fulfilled"),_=s.length-T.length;i({deleted:T,error:_>0?n("Failed to delete {count} keys.",{count:_}):null,type:"bulkDeleted"})})())},D=()=>{p(!1),i({type:"reload"})},A=o!==null&&o.length>0&&d.length===o.length,I=new Set(d);return w(be,{children:[w("section",{className:"border border-border bg-card p-3","data-testid":"kv-keys-section",children:[w("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[r(re,{"aria-label":n("Filter keys by prefix"),className:"min-w-[16rem] flex-1","data-testid":"kv-prefix-input",onChange:x,placeholder:n("Filter by prefix…"),value:K}),r(P,{"data-testid":"kv-filter-btn",disabled:M,onClick:N,children:n("Filter")}),r(P,{"data-testid":"kv-new-key-btn",onClick:()=>{p(s=>!s)},variant:"outline",children:n("New key")}),d.length>0&&r(P,{"data-testid":"kv-bulk-delete-btn",disabled:t,onClick:V,variant:"destructive",children:t?n("Deleting…"):n("Delete {count}",{count:d.length})})]}),l!==null&&r("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-bulk-error",role:"alert",children:l}),k!==null&&r("p",{className:"text-sm text-destructive","data-testid":"kv-keys-error",role:"alert",children:k}),o!==null&&o.length===0&&!M&&r("p",{className:"text-sm text-muted-foreground","data-testid":"kv-no-keys",children:n("No keys.")}),o!==null&&o.length>0&&r(ve,{className:"overflow-hidden py-0",children:r(fe,{className:"px-0",children:w(pe,{"data-testid":"kv-key-table",children:[r(he,{children:w(X,{children:[r(q,{className:"w-10",children:r(ne,{"aria-label":n("Select all"),checked:A,"data-testid":"kv-select-all",onCheckedChange:O})}),r(q,{children:n("Key")}),r(q,{children:n("Expiration")})]})}),r(ye,{children:o.map(s=>w(X,{className:s.name===f?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-key":s.name,"data-testid":`kv-key-row-${s.name}`,onClick:C,children:[r(Q,{onClick:h=>{h.stopPropagation()},children:r(ne,{"aria-label":n("Select {name}",{name:s.name}),checked:I.has(s.name),"data-testid":`kv-select-${s.name}`,onCheckedChange:()=>{F(s.name)}})}),r(Q,{className:"font-mono text-xs",children:s.name}),r(Q,{className:"tabular-nums text-xs",children:Oe(s.expiration)})]},s.name))})]})})}),!g&&v!==null&&r("div",{className:"mt-2",children:r(P,{"data-testid":"kv-load-more",disabled:M,onClick:y,variant:"outline",children:n(M?"Loading…":"Load more")})})]}),r(ie,{onOpenChange:s=>{s||p(!1)},open:u,children:w(de,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-create-sheet",side:"right",children:[r(oe,{children:r(ce,{children:n("New key")})}),r(Pe,{namespace:a,onCancel:()=>{p(!1)},onCreated:D})]})}),r(ie,{onOpenChange:s=>{s||i({name:null,type:"selectKey"})},open:f!==null,children:w(de,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-editor-sheet",side:"right",children:[r(oe,{children:r(ce,{className:"truncate font-mono text-xs",children:f})}),f!==null&&r(He,{expiration:o?.find(s=>s.name===f)?.expiration,keyName:f,namespace:a,onDeleted:S},`${a}:${f}`)]})})]})},ut=({loadNamespaces:a}={})=>{const e=ee(),n=G(),[c,i]=Z(null),[m,d]=Z(null),[t,l]=Z(null);ae(()=>{const o={cancelled:!1};return H((async()=>{try{const g=await(a??(()=>e.listKvNamespaces()))();o.cancelled||(i(g),d(null),l(k=>k??g[0]?.binding??null))}catch(g){o.cancelled||(i(null),d(R(g)))}})()),()=>{o.cancelled=!0}},[e,a]);const v=o=>{l(o.currentTarget.dataset.ns??null)};return w("div",{className:"flex flex-col gap-4","data-testid":"lunora-kv-browser",children:[m!==null&&r("p",{className:"text-sm text-destructive","data-testid":"kv-ns-error",role:"alert",children:m}),c!==null&&c.length===0&&r(Ee,{description:n("Add a kv_namespaces binding to wrangler.jsonc — it appears here automatically, no wiring needed."),icon:r("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r("path",{d:"M5 5h14v4H5V5Zm0 5h14v4H5v-4Zm0 5h14v4H5v-4Z"})}),testId:"kv-empty",title:n("No KV namespaces.")}),c!==null&&c.length>0&&r(ve,{className:"overflow-hidden py-0",children:r(fe,{className:"px-0",children:w(pe,{"data-testid":"kv-namespace-table",children:[r(he,{children:r(X,{children:r(q,{children:n("Namespace")})})}),r(ye,{children:c.map(o=>r(X,{className:o.binding===t?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-ns":o.binding,"data-testid":`kv-ns-row-${o.binding}`,onClick:v,children:r(Q,{className:"font-mono text-xs",children:o.binding})},o.binding))})]})})}),t!==null&&r(Ue,{namespace:t},t)]})};export{ut as KvBrowser};