@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 +1 @@
1
- import{a as Pe,b as Re}from"./chunk-26VREVWU.js";import{a as ce}from"./chunk-CAOUXOL7.js";import{a as Te}from"./chunk-76YLMHR3.js";import"./chunk-2SFSTQS4.js";import{a as Se}from"./chunk-57VX76PR.js";import{b as ke}from"./chunk-BQK2C2Z4.js";import{a as de}from"./chunk-W2JBKQNU.js";import{a as Le}from"./chunk-JURAVSE7.js";import{a as ie}from"./chunk-M3NNNOD5.js";import{a as xe}from"./chunk-CKTKI4IY.js";import{a as be}from"./chunk-TB5N24CM.js";import{b as ve}from"./chunk-KVSQKUWD.js";import"./chunk-4YTSKL4R.js";import"./chunk-ZHPDAJBM.js";import{P as D}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as pe}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as re}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as ye}from"./chunk-5U6757U7.js";import"./chunk-PZ4QDWTI.js";import"./chunk-FUVCG23X.js";import"./chunk-F7JOSNAT.js";import{a as ne}from"./chunk-DZGOHOOE.js";import{c as oe}from"./chunk-4U5PYZLE.js";import{f as ge}from"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as J}from"./chunk-UANVABQG.js";import{a as we,b as Ne,c as Ce,d as se,e as B,f as W}from"./chunk-L4EZAHCD.js";import{d as z,h as ae,i as fe,o as le}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as v,d as te,e as _e,f as Ae,g as Ue,i as j}from"./chunk-R5ZTCHCE.js";var K=te(Ae(),1);var I=te(_e(),1);var r=te(Ue(),1);var me=["trace","debug","log","info","warn","error","fatal"],$e="LOG_ARCHIVE_NOT_CONFIGURED",ze={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},De=v((i,e)=>{switch(e.type){case"append":return{...i,cursor:e.cursor,error:null,loading:!1,rows:[...i.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...i,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...i,error:e.message,loading:!1};default:return i}},"De"),Be=v(i=>{let e=(0,K.c)(33),{row:t}=i,n;e[0]!==t.fields?(n=ce(t.fields),e[0]=t.fields,e[1]=n):n=e[1];let s=n,o=`lg-archive-row-${String(t.ts)}`,c;e[2]!==t.ts?(c=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=c):c=e[3];let f;e[4]!==c?(f=(0,r.jsx)(W,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:c}),e[4]=c,e[5]=f):f=e[5];let m=Pe[t.level],d;e[6]!==t.level||e[7]!==m?(d=(0,r.jsx)(W,{children:(0,r.jsx)(re,{variant:m,children:t.level})}),e[6]=t.level,e[7]=m,e[8]=d):d=e[8];let a;e[9]!==t.functionPath?(a=(0,r.jsx)(W,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=a):a=e[10];let h;e[11]!==t.message?(h=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=h):h=e[12];let l;e[13]!==s?(l=s!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:s,children:s}),e[13]=s,e[14]=l):l=e[14];let u;e[15]!==h||e[16]!==l?(u=(0,r.jsxs)(W,{className:"max-w-md",children:[h,l]}),e[15]=h,e[16]=l,e[17]=u):u=e[17];let g=t.traceId??"\u2014",b;e[18]!==g?(b=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:g}),e[18]=g,e[19]=b):b=e[19];let x=t.shardKey??"\u2014",w;e[20]!==x?(w=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[20]=x,e[21]=w):w=e[21];let N=t.userId??"\u2014",y;e[22]!==N?(y=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:N}),e[22]=N,e[23]=y):y=e[23];let T;return e[24]!==u||e[25]!==b||e[26]!==w||e[27]!==y||e[28]!==o||e[29]!==f||e[30]!==d||e[31]!==a?(T=(0,r.jsxs)(se,{"data-testid":o,children:[f,d,a,u,b,w,y]}),e[24]=u,e[25]=b,e[26]=w,e[27]=y,e[28]=o,e[29]=f,e[30]=d,e[31]=a,e[32]=T):T=e[32],T},"Qe"),We=v(({shardKey:i})=>{let e=ge(),t=z(),[n,s]=(0,I.useState)(""),[o,c]=(0,I.useState)(""),[f,m]=(0,I.useState)(""),[{cursor:d,error:a,loading:h,notConfigured:l,rows:u},g]=(0,I.useReducer)(De,ze),b=ie(n.trim(),400),x=ie(o.trim(),400),w={...b===""?{}:{functionPathPrefix:b},...f===""?{}:{minLevel:f},...i===""?{}:{shardKey:i},...x===""?{}:{userId:x}},N=JSON.stringify(w),y=(0,I.useRef)(N);(0,I.useEffect)(()=>{let p={cancelled:!1};return y.current=N,le((async()=>{g({type:"loading"});try{let C=await e.queryLogArchive(w);p.cancelled||g({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){p.cancelled||g(fe(C)===$e?{type:"notConfigured"}:{message:ae(C),type:"failed"})}})()),()=>{p.cancelled=!0}},[e,N]);let T=v(async()=>{if(d===void 0)return;let p=N;g({type:"loading"});try{let C=await e.queryLogArchive({...w,cursor:d});y.current===p&&g({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){y.current===p&&g({message:ae(C),type:"pageFailed"})}},"T"),R=v(p=>{s(p.target.value)},"R"),k=v(p=>{c(p.target.value)},"N"),L=v(p=>{m(p.target.value)},"L"),S=v(()=>{le(T())},"S");return l?(0,r.jsx)(J,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path\u2026"),value:n}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:k,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:L,value:f,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),me.map(p=>(0,r.jsx)("option",{value:p,children:p},p))]})]}),a!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:a}),h&&u===null&&a===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),u!==null&&u.length===0&&(0,r.jsx)(J,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),u!==null&&u.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(we,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(Ne,{children:(0,r.jsxs)(se,{children:[(0,r.jsx)(B,{children:t("Time")}),(0,r.jsx)(B,{children:t("Level")}),(0,r.jsx)(B,{children:t("Function")}),(0,r.jsx)(B,{children:t("Message")}),(0,r.jsx)(B,{children:t("Trace")}),(0,r.jsx)(B,{children:t("Shard")}),(0,r.jsx)(B,{children:t("User")})]})}),(0,r.jsx)(Ce,{children:u.map((p,C)=>(0,r.jsx)(Be,{row:p},`${String(p.ts)}-${String(C)}`))})]})}),d!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(pe,{"data-testid":"lg-archive-more",disabled:h,onClick:S,size:"sm",variant:"outline",children:t(h?"Loading\u2026":"Load more")})})]})},"ze"),je=v(i=>{let e=(0,K.c)(11),{level:t,onToggle:n,selected:s}=i,o;e[0]!==t||e[1]!==n?(o=v(()=>{n(t)},"o"),e[0]=t,e[1]=n,e[2]=o):o=e[2];let c=o,f=s?"border-border bg-muted font-medium":"border-input text-muted-foreground",m;e[3]!==f?(m=j("rounded-md border px-2 py-1 text-xs",f),e[3]=f,e[4]=m):m=e[4];let d=`logs-level-${t}`,a;return e[5]!==t||e[6]!==c||e[7]!==s||e[8]!==m||e[9]!==d?(a=(0,r.jsx)("button",{"aria-pressed":s,className:m,"data-testid":d,onClick:c,type:"button",children:t}),e[5]=t,e[6]=c,e[7]=s,e[8]=m,e[9]=d,e[10]=a):a=e[10],a},"Ge"),Ve=v(i=>{let e=(0,K.c)(68),{levelFilter:t,onLogPathChange:n,onSearchChange:s,onTimeRangeChange:o,onToggleLevel:c,onToggleSummary:f,pathFilter:m,search:d,showSummary:a,timeRange:h}=i,l=z(),u;e[0]!==l?(u=l("Search messages"),e[0]=l,e[1]=u):u=e[1];let g;e[2]!==l?(g=l("search message"),e[2]=l,e[3]=g):g=e[3];let b;e[4]!==s||e[5]!==d||e[6]!==u||e[7]!==g?(b=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-48","data-testid":"lg-search",onChange:s,placeholder:g,value:d}),e[4]=s,e[5]=d,e[6]=u,e[7]=g,e[8]=b):b=e[8];let x;e[9]!==l?(x=l("Function path"),e[9]=l,e[10]=x):x=e[10];let w;e[11]!==l?(w=l("filter path"),e[11]=l,e[12]=w):w=e[12];let N;e[13]!==n||e[14]!==m||e[15]!==x||e[16]!==w?(N=(0,r.jsx)(D,{"aria-label":x,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:n,placeholder:w,value:m}),e[13]=n,e[14]=m,e[15]=x,e[16]=w,e[17]=N):N=e[17];let y;e[18]!==l?(y=l("Level filter"),e[18]=l,e[19]=y):y=e[19];let T;e[20]!==t||e[21]!==c?(T=me.map(Q=>(0,r.jsx)(je,{level:Q,onToggle:c,selected:t.has(Q)},Q)),e[20]=t,e[21]=c,e[22]=T):T=e[22];let R;e[23]!==y||e[24]!==T?(R=(0,r.jsx)("div",{"aria-label":y,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:T}),e[23]=y,e[24]=T,e[25]=R):R=e[25];let k;e[26]!==l?(k=l("Time range"),e[26]=l,e[27]=k):k=e[27];let L;e[28]!==l?(L=l("All time"),e[28]=l,e[29]=L):L=e[29];let S;e[30]!==L?(S=(0,r.jsx)("option",{value:"all",children:L}),e[30]=L,e[31]=S):S=e[31];let p;e[32]!==l?(p=l("Last 5m"),e[32]=l,e[33]=p):p=e[33];let C;e[34]!==p?(C=(0,r.jsx)("option",{value:"5m",children:p}),e[34]=p,e[35]=C):C=e[35];let q;e[36]!==l?(q=l("Last 15m"),e[36]=l,e[37]=q):q=e[37];let F;e[38]!==q?(F=(0,r.jsx)("option",{value:"15m",children:q}),e[38]=q,e[39]=F):F=e[39];let O;e[40]!==l?(O=l("Last hour"),e[40]=l,e[41]=O):O=e[41];let E;e[42]!==O?(E=(0,r.jsx)("option",{value:"1h",children:O}),e[42]=O,e[43]=E):E=e[43];let M;e[44]!==o||e[45]!==k||e[46]!==S||e[47]!==C||e[48]!==F||e[49]!==E||e[50]!==h?(M=(0,r.jsxs)("select",{"aria-label":k,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:h,children:[S,C,F,E]}),e[44]=o,e[45]=k,e[46]=S,e[47]=C,e[48]=F,e[49]=E,e[50]=h,e[51]=M):M=e[51];let V=a?"border-border bg-muted font-medium":"border-input text-muted-foreground",_;e[52]!==V?(_=j("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=_):_=e[53];let U;e[54]!==a||e[55]!==l?(U=l(a?"List":"Summary"),e[54]=a,e[55]=l,e[56]=U):U=e[56];let A;e[57]!==f||e[58]!==a||e[59]!==_||e[60]!==U?(A=(0,r.jsx)("button",{"aria-pressed":a,className:_,"data-testid":"logs-summary-toggle",onClick:f,type:"button",children:U}),e[57]=f,e[58]=a,e[59]=_,e[60]=U,e[61]=A):A=e[61];let $;return e[62]!==M||e[63]!==A||e[64]!==b||e[65]!==N||e[66]!==R?($=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[b,N,R,M,A]}),e[62]=M,e[63]=A,e[64]=b,e[65]=N,e[66]=R,e[67]=$):$=e[67],$},"He"),Qe=v(i=>{let e=(0,K.c)(53),{onOutcomeChange:t,onPathChange:n,onTableChange:s,onUserChange:o,outcomeFilter:c,pathPrefix:f,tableFilter:m,userIdFilter:d}=i,a=z(),h;e[0]!==a?(h=a("Function path"),e[0]=a,e[1]=h):h=e[1];let l;e[2]!==a?(l=a("file:function"),e[2]=a,e[3]=l):l=e[3];let u;e[4]!==n||e[5]!==f||e[6]!==h||e[7]!==l?(u=(0,r.jsx)(D,{"aria-label":h,className:"h-8 w-44","data-testid":"lg-req-path",onChange:n,placeholder:l,value:f}),e[4]=n,e[5]=f,e[6]=h,e[7]=l,e[8]=u):u=e[8];let g;e[9]!==a?(g=a("User id"),e[9]=a,e[10]=g):g=e[10];let b;e[11]!==a?(b=a("userId"),e[11]=a,e[12]=b):b=e[12];let x;e[13]!==o||e[14]!==g||e[15]!==b||e[16]!==d?(x=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:b,value:d}),e[13]=o,e[14]=g,e[15]=b,e[16]=d,e[17]=x):x=e[17];let w;e[18]!==a?(w=a("Table touched"),e[18]=a,e[19]=w):w=e[19];let N;e[20]!==a?(N=a("table"),e[20]=a,e[21]=N):N=e[21];let y;e[22]!==s||e[23]!==w||e[24]!==N||e[25]!==m?(y=(0,r.jsx)(D,{"aria-label":w,className:"h-8 w-32","data-testid":"lg-req-table",onChange:s,placeholder:N,value:m}),e[22]=s,e[23]=w,e[24]=N,e[25]=m,e[26]=y):y=e[26];let T;e[27]!==a?(T=a("Outcome filter"),e[27]=a,e[28]=T):T=e[28];let R;e[29]!==a?(R=a("all"),e[29]=a,e[30]=R):R=e[30];let k;e[31]!==R?(k=(0,r.jsx)("option",{value:"all",children:R}),e[31]=R,e[32]=k):k=e[32];let L;e[33]!==a?(L=a("ok"),e[33]=a,e[34]=L):L=e[34];let S;e[35]!==L?(S=(0,r.jsx)("option",{value:"ok",children:L}),e[35]=L,e[36]=S):S=e[36];let p;e[37]!==a?(p=a("error"),e[37]=a,e[38]=p):p=e[38];let C;e[39]!==p?(C=(0,r.jsx)("option",{value:"error",children:p}),e[39]=p,e[40]=C):C=e[40];let q;e[41]!==t||e[42]!==c||e[43]!==T||e[44]!==k||e[45]!==S||e[46]!==C?(q=(0,r.jsxs)("select",{"aria-label":T,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:c,children:[k,S,C]}),e[41]=t,e[42]=c,e[43]=T,e[44]=k,e[45]=S,e[46]=C,e[47]=q):q=e[47];let F;return e[48]!==q||e[49]!==u||e[50]!==x||e[51]!==y?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,x,y,q]}),e[48]=q,e[49]=u,e[50]=x,e[51]=y,e[52]=F):F=e[52],F},"We"),Fe=v(i=>{let e=(0,K.c)(7),{bucket:t}=i,n;e[0]!==t.key?(n=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=n):n=e[1];let s;e[2]!==t.count?(s=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"ve"),Ye=v(i=>{let e=(0,K.c)(31),{summary:t}=i,n=z(),s;e[0]!==t.total||e[1]!==n?(s=n("{count} entries",{count:t.total}),e[0]=t.total,e[1]=n,e[2]=s):s=e[2];let o;e[3]!==s?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:s}),e[3]=s,e[4]=o):o=e[4];let c;e[5]!==n?(c=n("By level"),e[5]=n,e[6]=c):c=e[6];let f;e[7]!==c?(f=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c}),e[7]=c,e[8]=f):f=e[8];let m;e[9]!==t.byLevel?(m=t.byLevel.map(Ge),e[9]=t.byLevel,e[10]=m):m=e[10];let d;e[11]!==m?(d=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:m}),e[11]=m,e[12]=d):d=e[12];let a;e[13]!==f||e[14]!==d?(a=(0,r.jsxs)("div",{children:[f,d]}),e[13]=f,e[14]=d,e[15]=a):a=e[15];let h;e[16]!==n?(h=n("By function"),e[16]=n,e[17]=h):h=e[17];let l;e[18]!==h?(l=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[18]=h,e[19]=l):l=e[19];let u;e[20]!==t.byPath?(u=t.byPath.map(He),e[20]=t.byPath,e[21]=u):u=e[21];let g;e[22]!==u?(g=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:u}),e[22]=u,e[23]=g):g=e[23];let b;e[24]!==g||e[25]!==l?(b=(0,r.jsxs)("div",{children:[l,g]}),e[24]=g,e[25]=l,e[26]=b):b=e[26];let x;return e[27]!==b||e[28]!==o||e[29]!==a?(x=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,a,b]}),e[27]=b,e[28]=o,e[29]=a,e[30]=x):x=e[30],x},"Ye");function Ge(i){return(0,r.jsx)(Fe,{bucket:i},i.key)}v(Ge,"je");function He(i){return(0,r.jsx)(Fe,{bucket:i},i.key)}v(He,"Je");var Je=v(i=>{let e=(0,K.c)(46),{liveError:t,onShardKeyChange:n,onShowArchive:s,onShowErrors:o,onShowRequests:c,shardKey:f,view:m}=i,d=z(),a=m==="requests",h=m==="requests"?"bg-muted font-medium":"text-muted-foreground",l;e[0]!==h?(l=j("px-3 py-1 text-sm",h),e[0]=h,e[1]=l):l=e[1];let u;e[2]!==d?(u=d("Requests"),e[2]=d,e[3]=u):u=e[3];let g;e[4]!==c||e[5]!==a||e[6]!==l||e[7]!==u?(g=(0,r.jsx)("button",{"aria-selected":a,className:l,"data-testid":"lg-view-requests",onClick:c,role:"tab",type:"button",children:u}),e[4]=c,e[5]=a,e[6]=l,e[7]=u,e[8]=g):g=e[8];let b=m==="errors",x=m==="errors"?"bg-muted font-medium":"text-muted-foreground",w;e[9]!==x?(w=j("px-3 py-1 text-sm",x),e[9]=x,e[10]=w):w=e[10];let N;e[11]!==d?(N=d("Errors"),e[11]=d,e[12]=N):N=e[12];let y;e[13]!==o||e[14]!==b||e[15]!==w||e[16]!==N?(y=(0,r.jsx)("button",{"aria-selected":b,className:w,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:N}),e[13]=o,e[14]=b,e[15]=w,e[16]=N,e[17]=y):y=e[17];let T=m==="archive",R=m==="archive"?"bg-muted font-medium":"text-muted-foreground",k;e[18]!==R?(k=j("px-3 py-1 text-sm",R),e[18]=R,e[19]=k):k=e[19];let L;e[20]!==d?(L=d("Archive"),e[20]=d,e[21]=L):L=e[21];let S;e[22]!==s||e[23]!==T||e[24]!==k||e[25]!==L?(S=(0,r.jsx)("button",{"aria-selected":T,className:k,"data-testid":"lg-view-archive",onClick:s,role:"tab",type:"button",children:L}),e[22]=s,e[23]=T,e[24]=k,e[25]=L,e[26]=S):S=e[26];let p;e[27]!==y||e[28]!==S||e[29]!==g?(p=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[g,y,S]}),e[27]=y,e[28]=S,e[29]=g,e[30]=p):p=e[30];let C;e[31]!==n||e[32]!==f?(C=(0,r.jsx)(be,{onChange:n,testId:"lg-shard-input",value:f}),e[31]=n,e[32]=f,e[33]=C):C=e[33];let q;e[34]!==t||e[35]!==m?(q=m!=="archive"&&(0,r.jsx)(Le,{message:t,prefix:"lg"}),e[34]=t,e[35]=m,e[36]=q):q=e[36];let F;e[37]!==d?(F=d("Open in Cloudflare"),e[37]=d,e[38]=F):F=e[38];let O;e[39]!==F?(O=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=O):O=e[40];let E;return e[41]!==p||e[42]!==C||e[43]!==q||e[44]!==O?(E=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,C,q,O]}),e[41]=p,e[42]=C,e[43]=q,e[44]=O,e[45]=E):E=e[45],E},"Xe"),ue=400,Xe=36,Ze={height:ue,overflow:"auto"},Oe={left:0,position:"absolute",top:0,width:"100%"},et={error:"destructive",ok:"secondary"},Ee=v(i=>{let e=(0,K.c)(6),{onOpenTrace:t,traceId:n}=i,s=z(),o;e[0]!==t||e[1]!==s||e[2]!==n?(o=n===void 0?null:(0,r.jsx)("button",{className:"text-primary underline-offset-2 hover:underline","data-testid":"lg-trace-link",onClick:v(()=>{t(n)},"onClick"),type:"button",children:s("Trace")}),e[0]=t,e[1]=s,e[2]=n,e[3]=o):o=e[3];let c;return e[4]!==o?(c=(0,r.jsx)("span",{className:"w-16 shrink-0 text-right",role:"gridcell",children:o}),e[4]=o,e[5]=c):c=e[5],c},"xe"),tt=v(i=>{let e=(0,K.c)(13),{entry:t,index:n,measureRef:s,onOpenTrace:o,start:c}=i,f=`translateY(${String(c)}px)`,m;e[0]!==f?(m={...Oe,transform:f},e[0]=f,e[1]=m):m=e[1];let d=m,a;e[2]!==t?(a=(0,r.jsx)(Re,{entry:t}),e[2]=t,e[3]=a):a=e[3];let h;e[4]!==t.traceId||e[5]!==o?(h=(0,r.jsx)(Ee,{onOpenTrace:o,traceId:t.traceId}),e[4]=t.traceId,e[5]=o,e[6]=h):h=e[6];let l;return e[7]!==n||e[8]!==s||e[9]!==d||e[10]!==a||e[11]!==h?(l=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":n,"data-testid":"lg-row",ref:s,role:"row",style:d,children:[a,h]}),e[7]=n,e[8]=s,e[9]=d,e[10]=a,e[11]=h,e[12]=l):l=e[12],l},"rt"),Ie=v(i=>i.length===0?"\u2014":i.join(", "),"ce"),rt=v(i=>{let e=(0,K.c)(41),{entry:t,index:n,measureRef:s,onOpenTrace:o,start:c}=i,f=`translateY(${String(c)}px)`,m;e[0]!==f?(m={...Oe,transform:f},e[0]=f,e[1]=m):m=e[1];let d=m,a;e[2]!==t.ts?(a=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=a):a=e[3];let h;e[4]!==a?(h=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:a}),e[4]=a,e[5]=h):h=e[5];let l=et[t.outcome],u;e[6]!==t.outcome||e[7]!==l?(u=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(re,{variant:l,children:t.outcome})}),e[6]=t.outcome,e[7]=l,e[8]=u):u=e[8];let g;e[9]!==t.functionPath?(g=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=g):g=e[10];let b=t.shardKey??"\u2014",x;e[11]!==b?(x=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b}),e[11]=b,e[12]=x):x=e[12];let w=t.userId??"\u2014",N;e[13]!==w?(N=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:w}),e[13]=w,e[14]=N):N=e[14];let y;e[15]!==t.durationMs?(y=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=y):y=e[16];let T=`${String(y)}ms`,R;e[17]!==T?(R=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:T}),e[17]=T,e[18]=R):R=e[18];let k;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(k=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${Ie(t.tablesRead)} \xB7 w:${Ie(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=k):k=e[23];let L;e[24]!==k?(L=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:k}),e[24]=k,e[25]=L):L=e[25];let S;e[26]!==t.traceId||e[27]!==o?(S=(0,r.jsx)(Ee,{onOpenTrace:o,traceId:t.traceId}),e[26]=t.traceId,e[27]=o,e[28]=S):S=e[28];let p;return e[29]!==n||e[30]!==s||e[31]!==d||e[32]!==N||e[33]!==R||e[34]!==L||e[35]!==S||e[36]!==h||e[37]!==u||e[38]!==g||e[39]!==x?(p=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":n,"data-testid":"lg-req-row",ref:s,role:"row",style:d,children:[h,u,g,x,N,R,L,S]}),e[29]=n,e[30]=s,e[31]=d,e[32]=N,e[33]=R,e[34]=L,e[35]=S,e[36]=h,e[37]=u,e[38]=g,e[39]=x,e[40]=p):p=e[40],p},"st"),qe=v(i=>{let{entries:e}=i??{};return Array.isArray(e)?e:[]},"de"),at=v(i=>{let e={};return i.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=i.functionPathPrefix.trim()),i.userId.trim()!==""&&(e.userId=i.userId.trim()),i.tableTouched.trim()!==""&&(e.tableTouched=i.tableTouched.trim()),(i.outcome==="ok"||i.outcome==="error")&&(e.outcome=i.outcome),e},"lt"),lt={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},ot=v((i,e)=>{let t=e.search.trim().toLowerCase(),n=e.path.trim().toLowerCase(),s=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-lt[e.range];return i.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<s||n!==""&&!(o.functionPath??"").toLowerCase().includes(n)?!1:t===""||o.message.toLowerCase().includes(t)||ce(o.fields).toLowerCase().includes(t))},"at"),nt="\u2014",st=v(i=>{let e=new Map,t=new Map;for(let o of i){e.set(o.level,(e.get(o.level)??0)+1);let c=o.functionPath??nt;t.set(c,(t.get(c)??0)+1)}let n=me.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),s=[...t.entries()].map(([o,c])=>({count:c,key:o})).toSorted((o,c)=>c.count===o.count?o.key.localeCompare(c.key):c.count-o.count);return{byLevel:n,byPath:s,total:i.length}},"it"),qt=v(({initialShardKey:i})=>{let e=z(),[t,n]=(0,I.useState)("requests"),{queryShardKey:s,setShardKey:o,shardKey:c}=xe(i),[f,m]=(0,I.useState)(""),[d,a]=(0,I.useState)(()=>new Set),[h,l]=(0,I.useState)(""),[u,g]=(0,I.useState)("all"),[b,x]=(0,I.useState)(!1),[w,N]=(0,I.useState)(""),[y,T]=(0,I.useState)(""),[R,k]=(0,I.useState)(""),[L,S]=(0,I.useState)("all"),p=at({functionPathPrefix:w,outcome:L,tableTouched:R,userId:y}),C=oe(ne.getRequestLog,p,{enabled:t==="requests",live:!0,shardKey:s}),q=oe(ne.getLogs,{},{enabled:t==="errors",live:!0,shardKey:s}),F=t==="requests"?C:q,{error:O,errorSource:E,isLoading:M,liveError:V}=F,_=Te(s),U=qe(q.data),A=qe(C.data);(0,I.useEffect)(()=>{F.data!==void 0&&ve(s)},[F.data,s]);let $=ot(U,{levels:d,now:Date.now(),path:h,range:u,search:f}),Q=st($),X=t==="requests"?A.length:$.length,Z=t==="errors"&&b,Y=(0,I.useMemo)(()=>O!==null?"error":X===0?M?Z?"summary":"list":"empty":Z?"summary":"list",[X,M,O,Z]),he=(0,I.useRef)(null),G=ke({count:X,estimateSize:v(()=>Xe,"estimateSize"),getScrollElement:v(()=>he.current,"getScrollElement"),initialRect:{height:ue,width:800},observeElementRect:v((P,ee)=>Se(P,ee,ue),"observeElementRect"),overscan:8}),Ke=G.getVirtualItems(),Me={height:G.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Je,{liveError:V,onShardKeyChange:o,onShowArchive:v(()=>{n("archive"),x(!1)},"onShowArchive"),onShowErrors:v(()=>{n("errors"),x(!1)},"onShowErrors"),onShowRequests:v(()=>{n("requests"),x(!1)},"onShowRequests"),shardKey:c,view:t}),t==="errors"&&(0,r.jsx)(Ve,{levelFilter:d,onLogPathChange:v(P=>{l(P.target.value)},"onLogPathChange"),onSearchChange:v(P=>{m(P.target.value)},"onSearchChange"),onTimeRangeChange:v(P=>{g(P.target.value)},"onTimeRangeChange"),onToggleLevel:v(P=>{a(ee=>{let H=new Set(ee);return H.has(P)?H.delete(P):H.add(P),H})},"onToggleLevel"),onToggleSummary:v(()=>{x(P=>!P)},"onToggleSummary"),pathFilter:h,search:f,showSummary:b,timeRange:u}),t==="requests"&&(0,r.jsx)(Qe,{onOutcomeChange:v(P=>{S(P.target.value)},"onOutcomeChange"),onPathChange:v(P=>{N(P.target.value)},"onPathChange"),onTableChange:v(P=>{k(P.target.value)},"onTableChange"),onUserChange:v(P=>{T(P.target.value)},"onUserChange"),outcomeFilter:L,pathPrefix:w,tableFilter:R,userIdFilter:y}),t==="archive"?(0,r.jsx)(We,{shardKey:s}):(0,r.jsxs)(r.Fragment,{children:[Y==="error"&&(0,r.jsx)(ye,{error:E,testId:"lg-error"}),Y==="empty"&&(0,r.jsx)(J,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Y==="summary"&&(0,r.jsx)(Ye,{summary:Q}),Y==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:he,style:Ze,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Me,children:Ke.map(P=>t==="requests"?(0,r.jsx)(rt,{entry:A[P.index],index:P.index,measureRef:G.measureElement,onOpenTrace:_,start:P.start},P.key):(0,r.jsx)(tt,{entry:$[P.index],index:P.index,measureRef:G.measureElement,onOpenTrace:_,start:P.start},P.key))})})]})]})},"Wt");export{qt as LogsPanel,ot as filterLogs,st as summarizeLogs};
1
+ import{a as Pe,b as Re}from"./chunk-SSNHCN4D.js";import{a as ce}from"./chunk-RPQL45FL.js";import{a as Te}from"./chunk-DEJLINCJ.js";import"./chunk-4GTO7FL5.js";import{a as Se}from"./chunk-NPERN4YF.js";import{b as ke}from"./chunk-MNAASONZ.js";import{a as de}from"./chunk-UYEZR3BI.js";import{a as Le}from"./chunk-7QRRR3K6.js";import{a as ie}from"./chunk-QKEJLVC5.js";import{a as xe}from"./chunk-S3CRZLGS.js";import{a as be}from"./chunk-IFLTA2OD.js";import{b as ve}from"./chunk-OGUKYRFM.js";import"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import{P as D}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as pe}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as re}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as ye}from"./chunk-JAZCU2PP.js";import"./chunk-ULIQFBZU.js";import"./chunk-OOESPRIZ.js";import"./chunk-35DM4JJG.js";import{a as ne}from"./chunk-CXNZVJ3S.js";import{c as oe}from"./chunk-ECQTVV2J.js";import{f as ge}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{a as J}from"./chunk-FKVZRPV5.js";import{a as we,b as Ne,c as Ce,d as se,e as B,f as W}from"./chunk-HEAQVSNS.js";import{d as z,h as ae,i as fe,o as le}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as v,d as te,e as _e,f as Ae,g as Ue,i as j}from"./chunk-YKXDMIHQ.js";var K=te(Ae(),1);var I=te(_e(),1);var r=te(Ue(),1);var me=["trace","debug","log","info","warn","error","fatal"],$e="LOG_ARCHIVE_NOT_CONFIGURED",ze={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},De=v((i,e)=>{switch(e.type){case"append":return{...i,cursor:e.cursor,error:null,loading:!1,rows:[...i.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...i,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...i,error:e.message,loading:!1};default:return i}},"De"),Be=v(i=>{let e=(0,K.c)(33),{row:t}=i,n;e[0]!==t.fields?(n=ce(t.fields),e[0]=t.fields,e[1]=n):n=e[1];let s=n,o=`lg-archive-row-${String(t.ts)}`,c;e[2]!==t.ts?(c=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=c):c=e[3];let f;e[4]!==c?(f=(0,r.jsx)(W,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:c}),e[4]=c,e[5]=f):f=e[5];let m=Pe[t.level],d;e[6]!==t.level||e[7]!==m?(d=(0,r.jsx)(W,{children:(0,r.jsx)(re,{variant:m,children:t.level})}),e[6]=t.level,e[7]=m,e[8]=d):d=e[8];let a;e[9]!==t.functionPath?(a=(0,r.jsx)(W,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=a):a=e[10];let h;e[11]!==t.message?(h=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=h):h=e[12];let l;e[13]!==s?(l=s!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:s,children:s}),e[13]=s,e[14]=l):l=e[14];let u;e[15]!==h||e[16]!==l?(u=(0,r.jsxs)(W,{className:"max-w-md",children:[h,l]}),e[15]=h,e[16]=l,e[17]=u):u=e[17];let g=t.traceId??"\u2014",b;e[18]!==g?(b=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:g}),e[18]=g,e[19]=b):b=e[19];let x=t.shardKey??"\u2014",w;e[20]!==x?(w=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[20]=x,e[21]=w):w=e[21];let N=t.userId??"\u2014",y;e[22]!==N?(y=(0,r.jsx)(W,{className:"font-mono text-[11px] text-muted-foreground",children:N}),e[22]=N,e[23]=y):y=e[23];let T;return e[24]!==u||e[25]!==b||e[26]!==w||e[27]!==y||e[28]!==o||e[29]!==f||e[30]!==d||e[31]!==a?(T=(0,r.jsxs)(se,{"data-testid":o,children:[f,d,a,u,b,w,y]}),e[24]=u,e[25]=b,e[26]=w,e[27]=y,e[28]=o,e[29]=f,e[30]=d,e[31]=a,e[32]=T):T=e[32],T},"Qe"),We=v(({shardKey:i})=>{let e=ge(),t=z(),[n,s]=(0,I.useState)(""),[o,c]=(0,I.useState)(""),[f,m]=(0,I.useState)(""),[{cursor:d,error:a,loading:h,notConfigured:l,rows:u},g]=(0,I.useReducer)(De,ze),b=ie(n.trim(),400),x=ie(o.trim(),400),w={...b===""?{}:{functionPathPrefix:b},...f===""?{}:{minLevel:f},...i===""?{}:{shardKey:i},...x===""?{}:{userId:x}},N=JSON.stringify(w),y=(0,I.useRef)(N);(0,I.useEffect)(()=>{let p={cancelled:!1};return y.current=N,le((async()=>{g({type:"loading"});try{let C=await e.queryLogArchive(w);p.cancelled||g({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){p.cancelled||g(fe(C)===$e?{type:"notConfigured"}:{message:ae(C),type:"failed"})}})()),()=>{p.cancelled=!0}},[e,N]);let T=v(async()=>{if(d===void 0)return;let p=N;g({type:"loading"});try{let C=await e.queryLogArchive({...w,cursor:d});y.current===p&&g({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){y.current===p&&g({message:ae(C),type:"pageFailed"})}},"T"),R=v(p=>{s(p.target.value)},"R"),k=v(p=>{c(p.target.value)},"N"),L=v(p=>{m(p.target.value)},"L"),S=v(()=>{le(T())},"S");return l?(0,r.jsx)(J,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path\u2026"),value:n}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:k,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:L,value:f,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),me.map(p=>(0,r.jsx)("option",{value:p,children:p},p))]})]}),a!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:a}),h&&u===null&&a===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),u!==null&&u.length===0&&(0,r.jsx)(J,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),u!==null&&u.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(we,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(Ne,{children:(0,r.jsxs)(se,{children:[(0,r.jsx)(B,{children:t("Time")}),(0,r.jsx)(B,{children:t("Level")}),(0,r.jsx)(B,{children:t("Function")}),(0,r.jsx)(B,{children:t("Message")}),(0,r.jsx)(B,{children:t("Trace")}),(0,r.jsx)(B,{children:t("Shard")}),(0,r.jsx)(B,{children:t("User")})]})}),(0,r.jsx)(Ce,{children:u.map((p,C)=>(0,r.jsx)(Be,{row:p},`${String(p.ts)}-${String(C)}`))})]})}),d!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(pe,{"data-testid":"lg-archive-more",disabled:h,onClick:S,size:"sm",variant:"outline",children:t(h?"Loading\u2026":"Load more")})})]})},"ze"),je=v(i=>{let e=(0,K.c)(11),{level:t,onToggle:n,selected:s}=i,o;e[0]!==t||e[1]!==n?(o=v(()=>{n(t)},"o"),e[0]=t,e[1]=n,e[2]=o):o=e[2];let c=o,f=s?"border-border bg-muted font-medium":"border-input text-muted-foreground",m;e[3]!==f?(m=j("rounded-md border px-2 py-1 text-xs",f),e[3]=f,e[4]=m):m=e[4];let d=`logs-level-${t}`,a;return e[5]!==t||e[6]!==c||e[7]!==s||e[8]!==m||e[9]!==d?(a=(0,r.jsx)("button",{"aria-pressed":s,className:m,"data-testid":d,onClick:c,type:"button",children:t}),e[5]=t,e[6]=c,e[7]=s,e[8]=m,e[9]=d,e[10]=a):a=e[10],a},"Ge"),Ve=v(i=>{let e=(0,K.c)(68),{levelFilter:t,onLogPathChange:n,onSearchChange:s,onTimeRangeChange:o,onToggleLevel:c,onToggleSummary:f,pathFilter:m,search:d,showSummary:a,timeRange:h}=i,l=z(),u;e[0]!==l?(u=l("Search messages"),e[0]=l,e[1]=u):u=e[1];let g;e[2]!==l?(g=l("search message"),e[2]=l,e[3]=g):g=e[3];let b;e[4]!==s||e[5]!==d||e[6]!==u||e[7]!==g?(b=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-48","data-testid":"lg-search",onChange:s,placeholder:g,value:d}),e[4]=s,e[5]=d,e[6]=u,e[7]=g,e[8]=b):b=e[8];let x;e[9]!==l?(x=l("Function path"),e[9]=l,e[10]=x):x=e[10];let w;e[11]!==l?(w=l("filter path"),e[11]=l,e[12]=w):w=e[12];let N;e[13]!==n||e[14]!==m||e[15]!==x||e[16]!==w?(N=(0,r.jsx)(D,{"aria-label":x,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:n,placeholder:w,value:m}),e[13]=n,e[14]=m,e[15]=x,e[16]=w,e[17]=N):N=e[17];let y;e[18]!==l?(y=l("Level filter"),e[18]=l,e[19]=y):y=e[19];let T;e[20]!==t||e[21]!==c?(T=me.map(Q=>(0,r.jsx)(je,{level:Q,onToggle:c,selected:t.has(Q)},Q)),e[20]=t,e[21]=c,e[22]=T):T=e[22];let R;e[23]!==y||e[24]!==T?(R=(0,r.jsx)("div",{"aria-label":y,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:T}),e[23]=y,e[24]=T,e[25]=R):R=e[25];let k;e[26]!==l?(k=l("Time range"),e[26]=l,e[27]=k):k=e[27];let L;e[28]!==l?(L=l("All time"),e[28]=l,e[29]=L):L=e[29];let S;e[30]!==L?(S=(0,r.jsx)("option",{value:"all",children:L}),e[30]=L,e[31]=S):S=e[31];let p;e[32]!==l?(p=l("Last 5m"),e[32]=l,e[33]=p):p=e[33];let C;e[34]!==p?(C=(0,r.jsx)("option",{value:"5m",children:p}),e[34]=p,e[35]=C):C=e[35];let q;e[36]!==l?(q=l("Last 15m"),e[36]=l,e[37]=q):q=e[37];let F;e[38]!==q?(F=(0,r.jsx)("option",{value:"15m",children:q}),e[38]=q,e[39]=F):F=e[39];let O;e[40]!==l?(O=l("Last hour"),e[40]=l,e[41]=O):O=e[41];let E;e[42]!==O?(E=(0,r.jsx)("option",{value:"1h",children:O}),e[42]=O,e[43]=E):E=e[43];let M;e[44]!==o||e[45]!==k||e[46]!==S||e[47]!==C||e[48]!==F||e[49]!==E||e[50]!==h?(M=(0,r.jsxs)("select",{"aria-label":k,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:h,children:[S,C,F,E]}),e[44]=o,e[45]=k,e[46]=S,e[47]=C,e[48]=F,e[49]=E,e[50]=h,e[51]=M):M=e[51];let V=a?"border-border bg-muted font-medium":"border-input text-muted-foreground",_;e[52]!==V?(_=j("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=_):_=e[53];let U;e[54]!==a||e[55]!==l?(U=l(a?"List":"Summary"),e[54]=a,e[55]=l,e[56]=U):U=e[56];let A;e[57]!==f||e[58]!==a||e[59]!==_||e[60]!==U?(A=(0,r.jsx)("button",{"aria-pressed":a,className:_,"data-testid":"logs-summary-toggle",onClick:f,type:"button",children:U}),e[57]=f,e[58]=a,e[59]=_,e[60]=U,e[61]=A):A=e[61];let $;return e[62]!==M||e[63]!==A||e[64]!==b||e[65]!==N||e[66]!==R?($=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[b,N,R,M,A]}),e[62]=M,e[63]=A,e[64]=b,e[65]=N,e[66]=R,e[67]=$):$=e[67],$},"He"),Qe=v(i=>{let e=(0,K.c)(53),{onOutcomeChange:t,onPathChange:n,onTableChange:s,onUserChange:o,outcomeFilter:c,pathPrefix:f,tableFilter:m,userIdFilter:d}=i,a=z(),h;e[0]!==a?(h=a("Function path"),e[0]=a,e[1]=h):h=e[1];let l;e[2]!==a?(l=a("file:function"),e[2]=a,e[3]=l):l=e[3];let u;e[4]!==n||e[5]!==f||e[6]!==h||e[7]!==l?(u=(0,r.jsx)(D,{"aria-label":h,className:"h-8 w-44","data-testid":"lg-req-path",onChange:n,placeholder:l,value:f}),e[4]=n,e[5]=f,e[6]=h,e[7]=l,e[8]=u):u=e[8];let g;e[9]!==a?(g=a("User id"),e[9]=a,e[10]=g):g=e[10];let b;e[11]!==a?(b=a("userId"),e[11]=a,e[12]=b):b=e[12];let x;e[13]!==o||e[14]!==g||e[15]!==b||e[16]!==d?(x=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:b,value:d}),e[13]=o,e[14]=g,e[15]=b,e[16]=d,e[17]=x):x=e[17];let w;e[18]!==a?(w=a("Table touched"),e[18]=a,e[19]=w):w=e[19];let N;e[20]!==a?(N=a("table"),e[20]=a,e[21]=N):N=e[21];let y;e[22]!==s||e[23]!==w||e[24]!==N||e[25]!==m?(y=(0,r.jsx)(D,{"aria-label":w,className:"h-8 w-32","data-testid":"lg-req-table",onChange:s,placeholder:N,value:m}),e[22]=s,e[23]=w,e[24]=N,e[25]=m,e[26]=y):y=e[26];let T;e[27]!==a?(T=a("Outcome filter"),e[27]=a,e[28]=T):T=e[28];let R;e[29]!==a?(R=a("all"),e[29]=a,e[30]=R):R=e[30];let k;e[31]!==R?(k=(0,r.jsx)("option",{value:"all",children:R}),e[31]=R,e[32]=k):k=e[32];let L;e[33]!==a?(L=a("ok"),e[33]=a,e[34]=L):L=e[34];let S;e[35]!==L?(S=(0,r.jsx)("option",{value:"ok",children:L}),e[35]=L,e[36]=S):S=e[36];let p;e[37]!==a?(p=a("error"),e[37]=a,e[38]=p):p=e[38];let C;e[39]!==p?(C=(0,r.jsx)("option",{value:"error",children:p}),e[39]=p,e[40]=C):C=e[40];let q;e[41]!==t||e[42]!==c||e[43]!==T||e[44]!==k||e[45]!==S||e[46]!==C?(q=(0,r.jsxs)("select",{"aria-label":T,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:c,children:[k,S,C]}),e[41]=t,e[42]=c,e[43]=T,e[44]=k,e[45]=S,e[46]=C,e[47]=q):q=e[47];let F;return e[48]!==q||e[49]!==u||e[50]!==x||e[51]!==y?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,x,y,q]}),e[48]=q,e[49]=u,e[50]=x,e[51]=y,e[52]=F):F=e[52],F},"We"),Fe=v(i=>{let e=(0,K.c)(7),{bucket:t}=i,n;e[0]!==t.key?(n=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=n):n=e[1];let s;e[2]!==t.count?(s=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=s):s=e[3];let o;return e[4]!==n||e[5]!==s?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[n,s]}),e[4]=n,e[5]=s,e[6]=o):o=e[6],o},"ve"),Ye=v(i=>{let e=(0,K.c)(31),{summary:t}=i,n=z(),s;e[0]!==t.total||e[1]!==n?(s=n("{count} entries",{count:t.total}),e[0]=t.total,e[1]=n,e[2]=s):s=e[2];let o;e[3]!==s?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:s}),e[3]=s,e[4]=o):o=e[4];let c;e[5]!==n?(c=n("By level"),e[5]=n,e[6]=c):c=e[6];let f;e[7]!==c?(f=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c}),e[7]=c,e[8]=f):f=e[8];let m;e[9]!==t.byLevel?(m=t.byLevel.map(Ge),e[9]=t.byLevel,e[10]=m):m=e[10];let d;e[11]!==m?(d=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:m}),e[11]=m,e[12]=d):d=e[12];let a;e[13]!==f||e[14]!==d?(a=(0,r.jsxs)("div",{children:[f,d]}),e[13]=f,e[14]=d,e[15]=a):a=e[15];let h;e[16]!==n?(h=n("By function"),e[16]=n,e[17]=h):h=e[17];let l;e[18]!==h?(l=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[18]=h,e[19]=l):l=e[19];let u;e[20]!==t.byPath?(u=t.byPath.map(He),e[20]=t.byPath,e[21]=u):u=e[21];let g;e[22]!==u?(g=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:u}),e[22]=u,e[23]=g):g=e[23];let b;e[24]!==g||e[25]!==l?(b=(0,r.jsxs)("div",{children:[l,g]}),e[24]=g,e[25]=l,e[26]=b):b=e[26];let x;return e[27]!==b||e[28]!==o||e[29]!==a?(x=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,a,b]}),e[27]=b,e[28]=o,e[29]=a,e[30]=x):x=e[30],x},"Ye");function Ge(i){return(0,r.jsx)(Fe,{bucket:i},i.key)}v(Ge,"je");function He(i){return(0,r.jsx)(Fe,{bucket:i},i.key)}v(He,"Je");var Je=v(i=>{let e=(0,K.c)(46),{liveError:t,onShardKeyChange:n,onShowArchive:s,onShowErrors:o,onShowRequests:c,shardKey:f,view:m}=i,d=z(),a=m==="requests",h=m==="requests"?"bg-muted font-medium":"text-muted-foreground",l;e[0]!==h?(l=j("px-3 py-1 text-sm",h),e[0]=h,e[1]=l):l=e[1];let u;e[2]!==d?(u=d("Requests"),e[2]=d,e[3]=u):u=e[3];let g;e[4]!==c||e[5]!==a||e[6]!==l||e[7]!==u?(g=(0,r.jsx)("button",{"aria-selected":a,className:l,"data-testid":"lg-view-requests",onClick:c,role:"tab",type:"button",children:u}),e[4]=c,e[5]=a,e[6]=l,e[7]=u,e[8]=g):g=e[8];let b=m==="errors",x=m==="errors"?"bg-muted font-medium":"text-muted-foreground",w;e[9]!==x?(w=j("px-3 py-1 text-sm",x),e[9]=x,e[10]=w):w=e[10];let N;e[11]!==d?(N=d("Errors"),e[11]=d,e[12]=N):N=e[12];let y;e[13]!==o||e[14]!==b||e[15]!==w||e[16]!==N?(y=(0,r.jsx)("button",{"aria-selected":b,className:w,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:N}),e[13]=o,e[14]=b,e[15]=w,e[16]=N,e[17]=y):y=e[17];let T=m==="archive",R=m==="archive"?"bg-muted font-medium":"text-muted-foreground",k;e[18]!==R?(k=j("px-3 py-1 text-sm",R),e[18]=R,e[19]=k):k=e[19];let L;e[20]!==d?(L=d("Archive"),e[20]=d,e[21]=L):L=e[21];let S;e[22]!==s||e[23]!==T||e[24]!==k||e[25]!==L?(S=(0,r.jsx)("button",{"aria-selected":T,className:k,"data-testid":"lg-view-archive",onClick:s,role:"tab",type:"button",children:L}),e[22]=s,e[23]=T,e[24]=k,e[25]=L,e[26]=S):S=e[26];let p;e[27]!==y||e[28]!==S||e[29]!==g?(p=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[g,y,S]}),e[27]=y,e[28]=S,e[29]=g,e[30]=p):p=e[30];let C;e[31]!==n||e[32]!==f?(C=(0,r.jsx)(be,{onChange:n,testId:"lg-shard-input",value:f}),e[31]=n,e[32]=f,e[33]=C):C=e[33];let q;e[34]!==t||e[35]!==m?(q=m!=="archive"&&(0,r.jsx)(Le,{message:t,prefix:"lg"}),e[34]=t,e[35]=m,e[36]=q):q=e[36];let F;e[37]!==d?(F=d("Open in Cloudflare"),e[37]=d,e[38]=F):F=e[38];let O;e[39]!==F?(O=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=O):O=e[40];let E;return e[41]!==p||e[42]!==C||e[43]!==q||e[44]!==O?(E=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,C,q,O]}),e[41]=p,e[42]=C,e[43]=q,e[44]=O,e[45]=E):E=e[45],E},"Xe"),ue=400,Xe=36,Ze={height:ue,overflow:"auto"},Oe={left:0,position:"absolute",top:0,width:"100%"},et={error:"destructive",ok:"secondary"},Ee=v(i=>{let e=(0,K.c)(6),{onOpenTrace:t,traceId:n}=i,s=z(),o;e[0]!==t||e[1]!==s||e[2]!==n?(o=n===void 0?null:(0,r.jsx)("button",{className:"text-primary underline-offset-2 hover:underline","data-testid":"lg-trace-link",onClick:v(()=>{t(n)},"onClick"),type:"button",children:s("Trace")}),e[0]=t,e[1]=s,e[2]=n,e[3]=o):o=e[3];let c;return e[4]!==o?(c=(0,r.jsx)("span",{className:"w-16 shrink-0 text-right",role:"gridcell",children:o}),e[4]=o,e[5]=c):c=e[5],c},"xe"),tt=v(i=>{let e=(0,K.c)(13),{entry:t,index:n,measureRef:s,onOpenTrace:o,start:c}=i,f=`translateY(${String(c)}px)`,m;e[0]!==f?(m={...Oe,transform:f},e[0]=f,e[1]=m):m=e[1];let d=m,a;e[2]!==t?(a=(0,r.jsx)(Re,{entry:t}),e[2]=t,e[3]=a):a=e[3];let h;e[4]!==t.traceId||e[5]!==o?(h=(0,r.jsx)(Ee,{onOpenTrace:o,traceId:t.traceId}),e[4]=t.traceId,e[5]=o,e[6]=h):h=e[6];let l;return e[7]!==n||e[8]!==s||e[9]!==d||e[10]!==a||e[11]!==h?(l=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":n,"data-testid":"lg-row",ref:s,role:"row",style:d,children:[a,h]}),e[7]=n,e[8]=s,e[9]=d,e[10]=a,e[11]=h,e[12]=l):l=e[12],l},"rt"),Ie=v(i=>i.length===0?"\u2014":i.join(", "),"ce"),rt=v(i=>{let e=(0,K.c)(41),{entry:t,index:n,measureRef:s,onOpenTrace:o,start:c}=i,f=`translateY(${String(c)}px)`,m;e[0]!==f?(m={...Oe,transform:f},e[0]=f,e[1]=m):m=e[1];let d=m,a;e[2]!==t.ts?(a=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=a):a=e[3];let h;e[4]!==a?(h=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:a}),e[4]=a,e[5]=h):h=e[5];let l=et[t.outcome],u;e[6]!==t.outcome||e[7]!==l?(u=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(re,{variant:l,children:t.outcome})}),e[6]=t.outcome,e[7]=l,e[8]=u):u=e[8];let g;e[9]!==t.functionPath?(g=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=g):g=e[10];let b=t.shardKey??"\u2014",x;e[11]!==b?(x=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b}),e[11]=b,e[12]=x):x=e[12];let w=t.userId??"\u2014",N;e[13]!==w?(N=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:w}),e[13]=w,e[14]=N):N=e[14];let y;e[15]!==t.durationMs?(y=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=y):y=e[16];let T=`${String(y)}ms`,R;e[17]!==T?(R=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:T}),e[17]=T,e[18]=R):R=e[18];let k;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(k=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${Ie(t.tablesRead)} \xB7 w:${Ie(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=k):k=e[23];let L;e[24]!==k?(L=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:k}),e[24]=k,e[25]=L):L=e[25];let S;e[26]!==t.traceId||e[27]!==o?(S=(0,r.jsx)(Ee,{onOpenTrace:o,traceId:t.traceId}),e[26]=t.traceId,e[27]=o,e[28]=S):S=e[28];let p;return e[29]!==n||e[30]!==s||e[31]!==d||e[32]!==N||e[33]!==R||e[34]!==L||e[35]!==S||e[36]!==h||e[37]!==u||e[38]!==g||e[39]!==x?(p=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":n,"data-testid":"lg-req-row",ref:s,role:"row",style:d,children:[h,u,g,x,N,R,L,S]}),e[29]=n,e[30]=s,e[31]=d,e[32]=N,e[33]=R,e[34]=L,e[35]=S,e[36]=h,e[37]=u,e[38]=g,e[39]=x,e[40]=p):p=e[40],p},"st"),qe=v(i=>{let{entries:e}=i??{};return Array.isArray(e)?e:[]},"de"),at=v(i=>{let e={};return i.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=i.functionPathPrefix.trim()),i.userId.trim()!==""&&(e.userId=i.userId.trim()),i.tableTouched.trim()!==""&&(e.tableTouched=i.tableTouched.trim()),(i.outcome==="ok"||i.outcome==="error")&&(e.outcome=i.outcome),e},"lt"),lt={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},ot=v((i,e)=>{let t=e.search.trim().toLowerCase(),n=e.path.trim().toLowerCase(),s=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-lt[e.range];return i.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<s||n!==""&&!(o.functionPath??"").toLowerCase().includes(n)?!1:t===""||o.message.toLowerCase().includes(t)||ce(o.fields).toLowerCase().includes(t))},"at"),nt="\u2014",st=v(i=>{let e=new Map,t=new Map;for(let o of i){e.set(o.level,(e.get(o.level)??0)+1);let c=o.functionPath??nt;t.set(c,(t.get(c)??0)+1)}let n=me.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),s=[...t.entries()].map(([o,c])=>({count:c,key:o})).toSorted((o,c)=>c.count===o.count?o.key.localeCompare(c.key):c.count-o.count);return{byLevel:n,byPath:s,total:i.length}},"it"),qt=v(({initialShardKey:i})=>{let e=z(),[t,n]=(0,I.useState)("requests"),{queryShardKey:s,setShardKey:o,shardKey:c}=xe(i),[f,m]=(0,I.useState)(""),[d,a]=(0,I.useState)(()=>new Set),[h,l]=(0,I.useState)(""),[u,g]=(0,I.useState)("all"),[b,x]=(0,I.useState)(!1),[w,N]=(0,I.useState)(""),[y,T]=(0,I.useState)(""),[R,k]=(0,I.useState)(""),[L,S]=(0,I.useState)("all"),p=at({functionPathPrefix:w,outcome:L,tableTouched:R,userId:y}),C=oe(ne.getRequestLog,p,{enabled:t==="requests",live:!0,shardKey:s}),q=oe(ne.getLogs,{},{enabled:t==="errors",live:!0,shardKey:s}),F=t==="requests"?C:q,{error:O,errorSource:E,isLoading:M,liveError:V}=F,_=Te(s),U=qe(q.data),A=qe(C.data);(0,I.useEffect)(()=>{F.data!==void 0&&ve(s)},[F.data,s]);let $=ot(U,{levels:d,now:Date.now(),path:h,range:u,search:f}),Q=st($),X=t==="requests"?A.length:$.length,Z=t==="errors"&&b,Y=(0,I.useMemo)(()=>O!==null?"error":X===0?M?Z?"summary":"list":"empty":Z?"summary":"list",[X,M,O,Z]),he=(0,I.useRef)(null),G=ke({count:X,estimateSize:v(()=>Xe,"estimateSize"),getScrollElement:v(()=>he.current,"getScrollElement"),initialRect:{height:ue,width:800},observeElementRect:v((P,ee)=>Se(P,ee,ue),"observeElementRect"),overscan:8}),Ke=G.getVirtualItems(),Me={height:G.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Je,{liveError:V,onShardKeyChange:o,onShowArchive:v(()=>{n("archive"),x(!1)},"onShowArchive"),onShowErrors:v(()=>{n("errors"),x(!1)},"onShowErrors"),onShowRequests:v(()=>{n("requests"),x(!1)},"onShowRequests"),shardKey:c,view:t}),t==="errors"&&(0,r.jsx)(Ve,{levelFilter:d,onLogPathChange:v(P=>{l(P.target.value)},"onLogPathChange"),onSearchChange:v(P=>{m(P.target.value)},"onSearchChange"),onTimeRangeChange:v(P=>{g(P.target.value)},"onTimeRangeChange"),onToggleLevel:v(P=>{a(ee=>{let H=new Set(ee);return H.has(P)?H.delete(P):H.add(P),H})},"onToggleLevel"),onToggleSummary:v(()=>{x(P=>!P)},"onToggleSummary"),pathFilter:h,search:f,showSummary:b,timeRange:u}),t==="requests"&&(0,r.jsx)(Qe,{onOutcomeChange:v(P=>{S(P.target.value)},"onOutcomeChange"),onPathChange:v(P=>{N(P.target.value)},"onPathChange"),onTableChange:v(P=>{k(P.target.value)},"onTableChange"),onUserChange:v(P=>{T(P.target.value)},"onUserChange"),outcomeFilter:L,pathPrefix:w,tableFilter:R,userIdFilter:y}),t==="archive"?(0,r.jsx)(We,{shardKey:s}):(0,r.jsxs)(r.Fragment,{children:[Y==="error"&&(0,r.jsx)(ye,{error:E,testId:"lg-error"}),Y==="empty"&&(0,r.jsx)(J,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Y==="summary"&&(0,r.jsx)(Ye,{summary:Q}),Y==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:he,style:Ze,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Me,children:Ke.map(P=>t==="requests"?(0,r.jsx)(rt,{entry:A[P.index],index:P.index,measureRef:G.measureElement,onOpenTrace:_,start:P.start},P.key):(0,r.jsx)(tt,{entry:$[P.index],index:P.index,measureRef:G.measureElement,onOpenTrace:_,start:P.start},P.key))})})]})]})},"Wt");export{qt as LogsPanel,ot as filterLogs,st as summarizeLogs};
@@ -1 +1 @@
1
- import{a as L}from"./chunk-UANVABQG.js";import{a as O,b as v,c as N,d as E,e as _,f as M}from"./chunk-L4EZAHCD.js";import{a as q}from"./chunk-IYWVSMAY.js";import{d as x,h as T,m as k,o as I}from"./chunk-6ZPTNC34.js";import{c as R}from"./chunk-3KLX63D7.js";import{a as u,d as b,e as Y,f as U,g as W}from"./chunk-R5ZTCHCE.js";var $=b(U(),1);var F="https://api.cloudflare.com/client/v4/accounts",H=6e4,f=class extends R{static{u(this,"r")}constructor(t,p){super("ANALYTICS_SQL_ERROR",`Analytics Engine SQL API returned ${String(t)}: ${p}`,{name:"AnalyticsSqlError",status:t})}},C=u(a=>{let t=a.fetch??globalThis.fetch,p=`${F}/${encodeURIComponent(a.accountId)}/analytics_engine/sql`,m=a.timeoutMs??H;return{query:u(async c=>{let l=new AbortController,r=setTimeout(()=>{l.abort()},m);try{let e=await t(p,{body:c,headers:{Authorization:`Bearer ${a.apiToken}`,"Content-Type":"text/plain"},method:"POST",signal:l.signal});if(!e.ok)throw new f(e.status,await e.text().catch(()=>"<error body unavailable: the request deadline fired before it was read>"));let o;try{o=await e.json()}catch(d){throw l.signal.aborted?d:new f(e.status,"Analytics Engine SQL API returned a non-JSON body.")}let s=o,i=s.data??[];return{columns:s.meta??[],rowCount:s.rows??i.length,rows:i}}catch(e){throw l.signal.aborted&&!(e instanceof f)?new f(504,`query timed out after ${String(m)}ms (AnalyticsSqlConfig.timeoutMs)`):e}finally{clearTimeout(r)}},"query")}},"p");var y=b(Y(),1);var n=b(W(),1);var Q="ANALYTICS",D=[{key:"volume",sql:u(a=>`SELECT blob2 AS fn, count() AS calls FROM ${a} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:u(a=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${a} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:u(a=>`SELECT blob3 AS shard, count() AS calls FROM ${a} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],j={error:null,loading:!0,result:null},G=u(a=>{let t=(0,$.c)(27),{state:p,title:m}=a,c=x(),{error:l,loading:r,result:e}=p,o=`analytics-panel-${m}`,s;t[0]!==c||t[1]!==m?(s=c(m),t[0]=c,t[1]=m,t[2]=s):s=t[2];let i;t[3]!==s?(i=(0,n.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s})}),t[3]=s,t[4]=i):i=t[4];let d;t[5]!==r||t[6]!==c?(d=r&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:c("Loading\u2026")}),t[5]=r,t[6]=c,t[7]=d):d=t[7];let h;t[8]!==l||t[9]!==r?(h=!r&&l!==null&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:l}),t[8]=l,t[9]=r,t[10]=h):h=t[10];let A;t[11]!==l||t[12]!==r||t[13]!==e||t[14]!==c?(A=!r&&l===null&&e!==null&&e.rows.length===0&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:c("No data points yet.")}),t[11]=l,t[12]=r,t[13]=e,t[14]=c,t[15]=A):A=t[15];let g;t[16]!==l||t[17]!==r||t[18]!==e?(g=!r&&l===null&&e!==null&&e.rows.length>0&&(0,n.jsxs)(O,{children:[(0,n.jsx)(v,{children:(0,n.jsx)(E,{children:e.columns.map(V)})}),(0,n.jsx)(N,{children:e.rows.map((B,P)=>(0,n.jsx)(E,{children:e.columns.map(w=>(0,n.jsx)(M,{className:"font-mono text-xs",children:k(B[w.name])},w.name))},P))})]}),t[16]=l,t[17]=r,t[18]=e,t[19]=g):g=t[19];let S;return t[20]!==o||t[21]!==i||t[22]!==d||t[23]!==h||t[24]!==A||t[25]!==g?(S=(0,n.jsxs)(q,{className:"gap-0 py-0","data-testid":o,children:[i,d,h,A,g]}),t[20]=o,t[21]=i,t[22]=d,t[23]=h,t[24]=A,t[25]=g,t[26]=S):S=t[26],S},"H"),ot=u(({config:a,dataset:t=Q,runQuery:p}={})=>{let m=x(),[c,l]=(0,y.useState)({}),r=(0,y.useMemo)(()=>{if(p!==void 0)return p;if(a===void 0)return null;let o=C({accountId:a.accountId,apiToken:a.apiToken});return s=>o.query(s)},[a,p]),e=(0,y.useCallback)(async o=>{if(r!==null)for(let s of D){if(o.cancelled)return;l(i=>({...i,[s.key]:{error:null,loading:!0,result:null}}));try{let i=await r(s.sql(t));o.cancelled||l(d=>({...d,[s.key]:{error:null,loading:!1,result:i}}))}catch(i){o.cancelled||l(d=>({...d,[s.key]:{error:T(i),loading:!1,result:null}}))}}},[r,t]);return(0,y.useEffect)(()=>{let o={cancelled:!1};return I(e(o)),()=>{o.cancelled=!0}},[e]),r===null?(0,n.jsx)(L,{description:m("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,n.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"})}),testId:"analytics-not-configured",title:m("Analytics is not configured.")}):(0,n.jsx)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:D.map(o=>(0,n.jsx)(G,{state:c[o.key]??j,title:o.title},o.key))})},"Q");function V(a){return(0,n.jsx)(_,{children:a.name},a.name)}u(V,"W");export{ot as AnalyticsPanel};
1
+ import{a as L}from"./chunk-FKVZRPV5.js";import{a as O,b as v,c as N,d as E,e as _,f as M}from"./chunk-HEAQVSNS.js";import{a as q}from"./chunk-WUWBZPUK.js";import{d as x,h as T,m as k,o as I}from"./chunk-Y4Q25F6X.js";import{c as R}from"./chunk-T2IE5GKA.js";import{a as u,d as b,e as Y,f as U,g as W}from"./chunk-YKXDMIHQ.js";var $=b(U(),1);var F="https://api.cloudflare.com/client/v4/accounts",H=6e4,f=class extends R{static{u(this,"r")}constructor(t,p){super("ANALYTICS_SQL_ERROR",`Analytics Engine SQL API returned ${String(t)}: ${p}`,{name:"AnalyticsSqlError",status:t})}},C=u(a=>{let t=a.fetch??globalThis.fetch,p=`${F}/${encodeURIComponent(a.accountId)}/analytics_engine/sql`,m=a.timeoutMs??H;return{query:u(async c=>{let l=new AbortController,r=setTimeout(()=>{l.abort()},m);try{let e=await t(p,{body:c,headers:{Authorization:`Bearer ${a.apiToken}`,"Content-Type":"text/plain"},method:"POST",signal:l.signal});if(!e.ok)throw new f(e.status,await e.text().catch(()=>"<error body unavailable: the request deadline fired before it was read>"));let o;try{o=await e.json()}catch(d){throw l.signal.aborted?d:new f(e.status,"Analytics Engine SQL API returned a non-JSON body.")}let s=o,i=s.data??[];return{columns:s.meta??[],rowCount:s.rows??i.length,rows:i}}catch(e){throw l.signal.aborted&&!(e instanceof f)?new f(504,`query timed out after ${String(m)}ms (AnalyticsSqlConfig.timeoutMs)`):e}finally{clearTimeout(r)}},"query")}},"p");var y=b(Y(),1);var n=b(W(),1);var Q="ANALYTICS",D=[{key:"volume",sql:u(a=>`SELECT blob2 AS fn, count() AS calls FROM ${a} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:u(a=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${a} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:u(a=>`SELECT blob3 AS shard, count() AS calls FROM ${a} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],j={error:null,loading:!0,result:null},G=u(a=>{let t=(0,$.c)(27),{state:p,title:m}=a,c=x(),{error:l,loading:r,result:e}=p,o=`analytics-panel-${m}`,s;t[0]!==c||t[1]!==m?(s=c(m),t[0]=c,t[1]=m,t[2]=s):s=t[2];let i;t[3]!==s?(i=(0,n.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s})}),t[3]=s,t[4]=i):i=t[4];let d;t[5]!==r||t[6]!==c?(d=r&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:c("Loading\u2026")}),t[5]=r,t[6]=c,t[7]=d):d=t[7];let h;t[8]!==l||t[9]!==r?(h=!r&&l!==null&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:l}),t[8]=l,t[9]=r,t[10]=h):h=t[10];let A;t[11]!==l||t[12]!==r||t[13]!==e||t[14]!==c?(A=!r&&l===null&&e!==null&&e.rows.length===0&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:c("No data points yet.")}),t[11]=l,t[12]=r,t[13]=e,t[14]=c,t[15]=A):A=t[15];let g;t[16]!==l||t[17]!==r||t[18]!==e?(g=!r&&l===null&&e!==null&&e.rows.length>0&&(0,n.jsxs)(O,{children:[(0,n.jsx)(v,{children:(0,n.jsx)(E,{children:e.columns.map(V)})}),(0,n.jsx)(N,{children:e.rows.map((B,P)=>(0,n.jsx)(E,{children:e.columns.map(w=>(0,n.jsx)(M,{className:"font-mono text-xs",children:k(B[w.name])},w.name))},P))})]}),t[16]=l,t[17]=r,t[18]=e,t[19]=g):g=t[19];let S;return t[20]!==o||t[21]!==i||t[22]!==d||t[23]!==h||t[24]!==A||t[25]!==g?(S=(0,n.jsxs)(q,{className:"gap-0 py-0","data-testid":o,children:[i,d,h,A,g]}),t[20]=o,t[21]=i,t[22]=d,t[23]=h,t[24]=A,t[25]=g,t[26]=S):S=t[26],S},"H"),ot=u(({config:a,dataset:t=Q,runQuery:p}={})=>{let m=x(),[c,l]=(0,y.useState)({}),r=(0,y.useMemo)(()=>{if(p!==void 0)return p;if(a===void 0)return null;let o=C({accountId:a.accountId,apiToken:a.apiToken});return s=>o.query(s)},[a,p]),e=(0,y.useCallback)(async o=>{if(r!==null)for(let s of D){if(o.cancelled)return;l(i=>({...i,[s.key]:{error:null,loading:!0,result:null}}));try{let i=await r(s.sql(t));o.cancelled||l(d=>({...d,[s.key]:{error:null,loading:!1,result:i}}))}catch(i){o.cancelled||l(d=>({...d,[s.key]:{error:T(i),loading:!1,result:null}}))}}},[r,t]);return(0,y.useEffect)(()=>{let o={cancelled:!1};return I(e(o)),()=>{o.cancelled=!0}},[e]),r===null?(0,n.jsx)(L,{description:m("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,n.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"})}),testId:"analytics-not-configured",title:m("Analytics is not configured.")}):(0,n.jsx)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:D.map(o=>(0,n.jsx)(G,{state:c[o.key]??j,title:o.title},o.key))})},"Q");function V(a){return(0,n.jsx)(_,{children:a.name},a.name)}u(V,"W");export{ot as AnalyticsPanel};
@@ -1 +1 @@
1
- import{a as d,d as n,f as c,g as p}from"./chunk-R5ZTCHCE.js";var b=n(c(),1),s=n(p(),1);var y={alignItems:"center",border:"1px solid",borderRadius:4,display:"inline-flex",fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:11,fontWeight:400,gap:6,letterSpacing:"0.06em",lineHeight:1.4,padding:"1px 8px",textTransform:"uppercase"},g={borderRadius:"50%",display:"inline-block",height:7,width:7},h=d((l,e,t,a)=>({badgeStyle:{...y,borderColor:l,color:l},color:l,dotStyle:{...g,backgroundColor:l},hint:a,label:e,title:t}),"i"),S={global:h("var(--royal-amethyst)","Global \xB7 D1","Global table \u2014 a single D1 table shared across all shards","Declared .global() and stored once in Cloudflare D1, shared across every shard and tenant. Auth tables (user, session, \u2026) live here too."),shard:h("var(--sky-sapphire)","Shard-local","Shard-local table \u2014 per-shard SQLite inside a Durable Object","Stored per shard key in a Durable Object's SQLite (.shardBy(...)). You are viewing one shard at a time \u2014 change the shard key to inspect another.")},m=d(l=>{let e=(0,b.c)(9),{tier:t}=l,a=S[t],i=`storage-tier-${t}`,r;e[0]!==a.dotStyle?(r=(0,s.jsx)("span",{"aria-hidden":"true",style:a.dotStyle}),e[0]=a.dotStyle,e[1]=r):r=e[1];let o;return e[2]!==a.badgeStyle||e[3]!==a.label||e[4]!==a.title||e[5]!==i||e[6]!==r||e[7]!==t?(o=(0,s.jsxs)("span",{"data-testid":i,"data-tier":t,style:a.badgeStyle,title:a.title,children:[r,a.label]}),e[2]=a.badgeStyle,e[3]=a.label,e[4]=a.title,e[5]=i,e[6]=r,e[7]=t,e[8]=o):o=e[8],o},"y");export{S as a,m as b};
1
+ import{a as d,d as n,f as c,g as p}from"./chunk-YKXDMIHQ.js";var b=n(c(),1),s=n(p(),1);var y={alignItems:"center",border:"1px solid",borderRadius:4,display:"inline-flex",fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:11,fontWeight:400,gap:6,letterSpacing:"0.06em",lineHeight:1.4,padding:"1px 8px",textTransform:"uppercase"},g={borderRadius:"50%",display:"inline-block",height:7,width:7},h=d((l,e,t,a)=>({badgeStyle:{...y,borderColor:l,color:l},color:l,dotStyle:{...g,backgroundColor:l},hint:a,label:e,title:t}),"i"),S={global:h("var(--royal-amethyst)","Global \xB7 D1","Global table \u2014 a single D1 table shared across all shards","Declared .global() and stored once in Cloudflare D1, shared across every shard and tenant. Auth tables (user, session, \u2026) live here too."),shard:h("var(--sky-sapphire)","Shard-local","Shard-local table \u2014 per-shard SQLite inside a Durable Object","Stored per shard key in a Durable Object's SQLite (.shardBy(...)). You are viewing one shard at a time \u2014 change the shard key to inspect another.")},m=d(l=>{let e=(0,b.c)(9),{tier:t}=l,a=S[t],i=`storage-tier-${t}`,r;e[0]!==a.dotStyle?(r=(0,s.jsx)("span",{"aria-hidden":"true",style:a.dotStyle}),e[0]=a.dotStyle,e[1]=r):r=e[1];let o;return e[2]!==a.badgeStyle||e[3]!==a.label||e[4]!==a.title||e[5]!==i||e[6]!==r||e[7]!==t?(o=(0,s.jsxs)("span",{"data-testid":i,"data-tier":t,style:a.badgeStyle,title:a.title,children:[r,a.label]}),e[2]=a.badgeStyle,e[3]=a.label,e[4]=a.title,e[5]=i,e[6]=r,e[7]=t,e[8]=o):o=e[8],o},"y");export{S as a,m as b};
@@ -1 +1 @@
1
- import{a as e,d as c,e as s}from"./chunk-R5ZTCHCE.js";function d(n,o,r,i){return n.addEventListener(o,r,i),()=>{n.removeEventListener(o,r,i)}}e(d,"addEventListener");var t=c(s(),1);var x=t.createContext(void 0);function f(){return t.useContext(x)?.direction??"ltr"}e(f,"useDirection");export{d as a,f as b};
1
+ import{a as e,d as c,e as s}from"./chunk-YKXDMIHQ.js";function d(n,o,r,i){return n.addEventListener(o,r,i),()=>{n.removeEventListener(o,r,i)}}e(d,"addEventListener");var t=c(s(),1);var x=t.createContext(void 0);function f(){return t.useContext(x)?.direction??"ltr"}e(f,"useDirection");export{d as a,f as b};
@@ -0,0 +1 @@
1
+ import{a as c}from"./chunk-4GTO7FL5.js";import{e}from"./chunk-JVUZEYKQ.js";import{o as m}from"./chunk-Y4Q25F6X.js";import{a as s,d as p,f as n}from"./chunk-YKXDMIHQ.js";var f=p(n(),1);var h=s(r=>{let t=(0,f.c)(3),a=e(),o;return t[0]!==a||t[1]!==r?(o=s(i=>{c({shardKey:r,traceId:i}),m(a({to:"/traces"}))},"e"),t[0]=a,t[1]=r,t[2]=o):o=t[2],o},"u");export{h as a};
@@ -1,4 +1,4 @@
1
- import{a as rt,b as ot}from"./chunk-WSNONR2E.js";import{c as nt}from"./chunk-443UDYWL.js";import{a as tt}from"./chunk-R7S3ICRW.js";import"./chunk-FJ6G6FNE.js";import"./chunk-CP4ZFBVW.js";import"./chunk-CN2AINNY.js";import"./chunk-5JLIP2HH.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import{a as et}from"./chunk-M3NNNOD5.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import"./chunk-EGSG64TS.js";import"./chunk-JV7KTJPY.js";import"./chunk-DPNEFSEC.js";import"./chunk-O5MAFDY2.js";import"./chunk-OG57FC7W.js";import{a as Je}from"./chunk-TB5N24CM.js";import{b as Xe}from"./chunk-KVSQKUWD.js";import{c as Ve,d as qe,e as Le,f as _e,g as Pe}from"./chunk-ZHPDAJBM.js";import{P as Ge}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{a as Ze}from"./chunk-PZ4QDWTI.js";import{a as Ne}from"./chunk-DZGOHOOE.js";import"./chunk-4U5PYZLE.js";import{f as Ee}from"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import"./chunk-L4EZAHCD.js";import{d as ce,f as we,g as ke,h as Ke,o as ue}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as l,d as We,e as vt,f as yt,g as St,i as me}from"./chunk-R5ZTCHCE.js";var G=We(yt(),1);var z=We(vt(),1);var c=We(St(),1);var wt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],kt=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],Me=String.fromCodePoint(0),Nt=new RegExp(`${Me}${String.raw`(\d+)`}${Me}`,"gu"),qt=wt.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Ct=kt.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
1
+ import{a as rt,b as ot}from"./chunk-5PCGB55O.js";import{c as nt}from"./chunk-OOKV3V3X.js";import{a as tt}from"./chunk-2AFIMJPZ.js";import"./chunk-TJRQUJFS.js";import"./chunk-TWTNWOJU.js";import"./chunk-WQYWA7U6.js";import"./chunk-XZMOZFE6.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import{a as et}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-XSLMHPP2.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import"./chunk-5AUOM7FK.js";import"./chunk-I5OKDKON.js";import{a as Je}from"./chunk-IFLTA2OD.js";import{b as Xe}from"./chunk-OGUKYRFM.js";import{c as Ve,d as qe,e as Le,f as _e,g as Pe}from"./chunk-OKG3HWSJ.js";import{P as Ge}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{a as Ze}from"./chunk-ULIQFBZU.js";import{a as Ne}from"./chunk-CXNZVJ3S.js";import"./chunk-ECQTVV2J.js";import{f as Ee}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import"./chunk-HEAQVSNS.js";import{d as ce,f as we,g as ke,h as Ke,o as ue}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as l,d as We,e as vt,f as yt,g as St,i as me}from"./chunk-YKXDMIHQ.js";var G=We(yt(),1);var z=We(vt(),1);var c=We(St(),1);var wt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],kt=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],Me=String.fromCodePoint(0),Nt=new RegExp(`${Me}${String.raw`(\d+)`}${Me}`,"gu"),qt=wt.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Ct=kt.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
2
2
  ${s}`})),Tt=l(s=>{let e=[],n=s.replaceAll(/'(?:[^']|'')*'/gu,t=>(e.push(t),`${Me}${(e.length-1).toString()}${Me}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:t,replacement:o}of qt)n=n.replaceAll(t,o);for(let{pattern:t,replacement:o}of Ct)n=n.replaceAll(t,o);return n=n.replaceAll(Nt,(t,o)=>e[Number(o)]??""),n},"Lt"),je="x",It={'"':'"',"'":"'","[":"]","`":"`"},Rt=l((s,e)=>{let n=e+2;for(;n<s.length&&s[n]!==`
3
3
  `;)n+=1;return n},"qt"),Et=l((s,e)=>{let n=s.indexOf("*/",e+2);return n===-1?-1:n+2},"At"),ct=l(s=>{let e=s.split(""),n=0;for(;n<s.length;){let t=s[n]??"",o=It[t];if(t==="-"&&s[n+1]==="-"){let r=Rt(s,n);e.fill(je,n,r),n=r}else if(t==="/"&&s[n+1]==="*"){let r=Et(s,n);if(r===-1)return;e.fill(je,n,r),n=r}else if(o!==void 0){let r=n+1;for(;r<s.length;)if(s[r]!==o)r+=1;else if(o!=="]"&&s[r+1]===o)r+=2;else break;if(r>=s.length)return;e.fill(je,n,r+1),n=r+1}else n+=1}for(let t=0;t<s.length;t+=1)s[t]===`
4
4
  `&&(e[t]=`
@@ -1 +1 @@
1
- import{a as d,d as o,f as c,g as b,i as s}from"./chunk-R5ZTCHCE.js";var l=o(c(),1);var u=o(b(),1);function p(n){let i=(0,l.c)(8),r,e;i[0]!==n?({className:r,...e}=n,i[0]=n,i[1]=r,i[2]=e):(r=i[1],e=i[2]);let t;i[3]!==r?(t=s("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-xs transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",r),i[3]=r,i[4]=t):t=i[4];let a;return i[5]!==e||i[6]!==t?(a=(0,u.jsx)("textarea",{"data-slot":"textarea",className:t,...e}),i[5]=e,i[6]=t,i[7]=a):a=i[7],a}d(p,"b");export{p as a};
1
+ import{a as d,d as o,f as c,g as b,i as s}from"./chunk-YKXDMIHQ.js";var l=o(c(),1);var u=o(b(),1);function p(n){let i=(0,l.c)(8),r,e;i[0]!==n?({className:r,...e}=n,i[0]=n,i[1]=r,i[2]=e):(r=i[1],e=i[2]);let t;i[3]!==r?(t=s("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-xs transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",r),i[3]=r,i[4]=t):t=i[4];let a;return i[5]!==e||i[6]!==t?(a=(0,u.jsx)("textarea",{"data-slot":"textarea",className:t,...e}),i[5]=e,i[6]=t,i[7]=a):a=i[7],a}d(p,"b");export{p as a};
@@ -1 +1 @@
1
- import{c as l}from"./chunk-74ASA4WU.js";import{j as u}from"./chunk-7PIHTTND.js";import{a as c}from"./chunk-RCZTUWG3.js";import{a as t,d as o,e as h,g as z,i as d}from"./chunk-R5ZTCHCE.js";var p=o(h(),1);var a=p.forwardRef(t(function(e,r){let{render:n,className:k,disabled:s=!1,focusableWhenDisabled:g=!1,nativeButton:f=!0,style:B,...b}=e,{getButtonProps:m,buttonRef:x}=l({disabled:s,focusableWhenDisabled:g,native:f});return u("button",e,{state:{disabled:s},ref:[r,x],props:[b,m]})},"Button"));var v=o(z(),1);var y=c("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",xs:"h-6 gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-md px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",icon:"size-8","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-md","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function W({className:i,variant:e="default",size:r="default",...n}){return(0,v.jsx)(a,{"data-slot":"button",className:d(y({variant:e,size:r,className:i})),...n})}t(W,"v");export{W as a};
1
+ import{c as l}from"./chunk-TGHH7ZFA.js";import{j as u}from"./chunk-25NFR6EB.js";import{a as c}from"./chunk-FSRSK4LY.js";import{a as t,d as o,e as h,g as z,i as d}from"./chunk-YKXDMIHQ.js";var p=o(h(),1);var a=p.forwardRef(t(function(e,r){let{render:n,className:k,disabled:s=!1,focusableWhenDisabled:g=!1,nativeButton:f=!0,style:B,...b}=e,{getButtonProps:m,buttonRef:x}=l({disabled:s,focusableWhenDisabled:g,native:f});return u("button",e,{state:{disabled:s},ref:[r,x],props:[b,m]})},"Button"));var v=o(z(),1);var y=c("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",xs:"h-6 gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-md px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",icon:"size-8","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-md","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function W({className:i,variant:e="default",size:r="default",...n}){return(0,v.jsx)(a,{"data-slot":"button",className:d(y({variant:e,size:r,className:i})),...n})}t(W,"v");export{W as a};
@@ -1 +1 @@
1
- import{b as P,c as v,d as I,f as g}from"./chunk-CG5OTGTR.js";import{f as S,g as q,h as k,o as w}from"./chunk-6ZPTNC34.js";import{a as i,d as D,e as N,f as R}from"./chunk-R5ZTCHCE.js";var _=D(R(),1);var p=D(N(),1);var T=300,d=i(t=>typeof t=="string"?t===""?void 0:t:typeof t=="number"||typeof t=="boolean"?String(t):void 0,"l"),c=i(t=>t.filter(e=>e!==void 0).join(" "),"d"),$={deleteRows:i(t=>c([d(t.table),Array.isArray(t.ids)?`${String(t.ids.length)} rows`:void 0]),"deleteRows"),facetColumn:i(t=>c([d(t.table),d(t.column)]),"facetColumn"),lintSql:i(()=>"sql","lintSql"),readTablePage:i(t=>c([d(t.table),Array.isArray(t.filters)&&t.filters.length>0?`${String(t.filters.length)} filters`:void 0,typeof t.search=="string"&&t.search!==""?"search":void 0,typeof t.limit=="number"?`limit ${String(t.limit)}`:void 0]),"readTablePage"),runMigration:i(t=>c([d(t.id),d(t.direction),t.dryRun===!0?"dry-run":void 0]),"runMigration"),runSql:i(t=>typeof t.sql=="string"?`${String(t.sql.length)} chars`:"","runSql"),schemaVersion:i(t=>typeof t.hash=="string"?t.hash.slice(0,8):"","schemaVersion"),writeRow:i(t=>c([d(t.table),"1 row"]),"writeRow")},E="__lunora_admin__:",F=i((t,e)=>{let r=t.startsWith(E)?t.slice(E.length):t,s=$[r];if(s!==void 0)return s(e);let o=Object.keys(e);return o.length===0?"":o.join(", ")},"j"),C=i(t=>{if(Array.isArray(t))return t.length;if(!(typeof t!="object"||t===null)){for(let e of Object.values(t))if(Array.isArray(e))return e.length}},"x"),A=class{static{i(this,"C")}entries=[];listeners=new Set;nextSeq=1;getSnapshot=i(()=>this.entries,"getSnapshot");subscribe=i(e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),"subscribe");start(e,r,s){return this.append(e,r,s,"call","pending")}startSubscription(e,r,s){return this.append(e,r,s,"subscription","live")}recordPush(e){if(this.listeners.size===0){let r=this.entries.find(s=>s.seq===e);r!==void 0&&(r.pushes=(r.pushes??0)+1);return}this.patch(e,r=>({...r,pushes:(r.pushes??0)+1}))}failSubscription(e,r){this.patch(e,s=>({...s,error:r,status:"error"}))}endSubscription(e){this.patch(e,r=>r.status==="error"?r:{...r,durationMs:Date.now()-r.startedAt,status:"closed"})}lastErrorSeq(){return this.entries.findLast(e=>e.status==="error")?.seq}settle(e,r){this.patch(e,s=>({...s,durationMs:Date.now()-s.startedAt,...r.error===void 0?{resultCount:C(r.result),status:"ok"}:{error:r.error,status:"error"}}))}clear(){this.entries=[],this.emit()}append(e,r,s,o,a){let u=this.nextSeq;this.nextSeq+=1;let l={functionPath:e,kind:o,seq:u,shardKey:s,startedAt:Date.now(),status:a,summary:F(e,r),...o==="subscription"?{pushes:0}:{}},n=[...this.entries,l];return this.entries=n.length>T?n.slice(n.length-T):n,this.emit(),u}patch(e,r){let s=this.entries.findIndex(o=>o.seq===e);s!==-1&&(this.entries=this.entries.with(s,r(this.entries[s])),this.emit())}emit(){for(let e of this.listeners)e()}},f=new A,j=i((t,e,r)=>["lunora-admin",t,e,r.trim()],"w"),x=i((t,e)=>[...t,e],"E");function J(t,e,r={}){let s=g(),{enabled:o=!0,keepPreviousData:a=!1,staleTime:u=0}=r,l=x(t,s.clientIdentifier()),n=I({enabled:o,queryFn:e,placeholderData:a?P:void 0,queryKey:l,staleTime:u});return{data:n.data,error:n.error?k(n.error):n.error,errorSource:n.error??void 0,isLoading:n.isLoading,liveError:void 0,refetch:i(()=>{w(n.refetch())},"refetch")}}i(J,"F");function W(t,e,r={}){let s=g(),o=v(),{enabled:a=!0,keepPreviousData:u=!1,live:l=!1,shardKey:n="",staleTime:K}=r,m=j(t,e,n),L=J(m,()=>s.query(S(t),e,q(n)),{enabled:a,keepPreviousData:u,staleTime:K??(l?Number.POSITIVE_INFINITY:0)}),[O,y]=(0,p.useState)(void 0),Q=JSON.stringify(m);return(0,p.useEffect)(()=>{if(!a||!l)return;y(void 0);let b=f.startSubscription(t,e,n),M=s.subscribe(S(t),e,h=>{f.recordPush(b),y(void 0),o.setQueryData(x(m,s.clientIdentifier()),h)},{...q(n),onError:i(h=>{f.failSubscription(b,h.message),y(h.message)},"onError")});return()=>{f.endSubscription(b),M()}},[Q,a,l]),{...L,liveError:a&&l?O:void 0}}i(W,"J");var Y=i(()=>{let t=(0,_.c)(2),e=v(),r;return t[0]!==e?(r=i((s,o,a)=>{let u=o===void 0?["lunora-admin",s]:j(s,o,a??"");w(e.invalidateQueries({queryKey:u}))},"r"),t[0]=e,t[1]=r):r=t[1],r},"U");export{f as a,J as b,W as c,Y as d};
1
+ import{b as P,c as v,d as I,f as g}from"./chunk-JBIN7W2B.js";import{f as S,g as q,h as k,o as w}from"./chunk-Y4Q25F6X.js";import{a as i,d as D,e as N,f as R}from"./chunk-YKXDMIHQ.js";var _=D(R(),1);var p=D(N(),1);var T=300,d=i(t=>typeof t=="string"?t===""?void 0:t:typeof t=="number"||typeof t=="boolean"?String(t):void 0,"l"),c=i(t=>t.filter(e=>e!==void 0).join(" "),"d"),$={deleteRows:i(t=>c([d(t.table),Array.isArray(t.ids)?`${String(t.ids.length)} rows`:void 0]),"deleteRows"),facetColumn:i(t=>c([d(t.table),d(t.column)]),"facetColumn"),lintSql:i(()=>"sql","lintSql"),readTablePage:i(t=>c([d(t.table),Array.isArray(t.filters)&&t.filters.length>0?`${String(t.filters.length)} filters`:void 0,typeof t.search=="string"&&t.search!==""?"search":void 0,typeof t.limit=="number"?`limit ${String(t.limit)}`:void 0]),"readTablePage"),runMigration:i(t=>c([d(t.id),d(t.direction),t.dryRun===!0?"dry-run":void 0]),"runMigration"),runSql:i(t=>typeof t.sql=="string"?`${String(t.sql.length)} chars`:"","runSql"),schemaVersion:i(t=>typeof t.hash=="string"?t.hash.slice(0,8):"","schemaVersion"),writeRow:i(t=>c([d(t.table),"1 row"]),"writeRow")},E="__lunora_admin__:",F=i((t,e)=>{let r=t.startsWith(E)?t.slice(E.length):t,s=$[r];if(s!==void 0)return s(e);let o=Object.keys(e);return o.length===0?"":o.join(", ")},"j"),C=i(t=>{if(Array.isArray(t))return t.length;if(!(typeof t!="object"||t===null)){for(let e of Object.values(t))if(Array.isArray(e))return e.length}},"x"),A=class{static{i(this,"C")}entries=[];listeners=new Set;nextSeq=1;getSnapshot=i(()=>this.entries,"getSnapshot");subscribe=i(e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),"subscribe");start(e,r,s){return this.append(e,r,s,"call","pending")}startSubscription(e,r,s){return this.append(e,r,s,"subscription","live")}recordPush(e){if(this.listeners.size===0){let r=this.entries.find(s=>s.seq===e);r!==void 0&&(r.pushes=(r.pushes??0)+1);return}this.patch(e,r=>({...r,pushes:(r.pushes??0)+1}))}failSubscription(e,r){this.patch(e,s=>({...s,error:r,status:"error"}))}endSubscription(e){this.patch(e,r=>r.status==="error"?r:{...r,durationMs:Date.now()-r.startedAt,status:"closed"})}lastErrorSeq(){return this.entries.findLast(e=>e.status==="error")?.seq}settle(e,r){this.patch(e,s=>({...s,durationMs:Date.now()-s.startedAt,...r.error===void 0?{resultCount:C(r.result),status:"ok"}:{error:r.error,status:"error"}}))}clear(){this.entries=[],this.emit()}append(e,r,s,o,a){let u=this.nextSeq;this.nextSeq+=1;let l={functionPath:e,kind:o,seq:u,shardKey:s,startedAt:Date.now(),status:a,summary:F(e,r),...o==="subscription"?{pushes:0}:{}},n=[...this.entries,l];return this.entries=n.length>T?n.slice(n.length-T):n,this.emit(),u}patch(e,r){let s=this.entries.findIndex(o=>o.seq===e);s!==-1&&(this.entries=this.entries.with(s,r(this.entries[s])),this.emit())}emit(){for(let e of this.listeners)e()}},f=new A,j=i((t,e,r)=>["lunora-admin",t,e,r.trim()],"w"),x=i((t,e)=>[...t,e],"E");function J(t,e,r={}){let s=g(),{enabled:o=!0,keepPreviousData:a=!1,staleTime:u=0}=r,l=x(t,s.clientIdentifier()),n=I({enabled:o,queryFn:e,placeholderData:a?P:void 0,queryKey:l,staleTime:u});return{data:n.data,error:n.error?k(n.error):n.error,errorSource:n.error??void 0,isLoading:n.isLoading,liveError:void 0,refetch:i(()=>{w(n.refetch())},"refetch")}}i(J,"F");function W(t,e,r={}){let s=g(),o=v(),{enabled:a=!0,keepPreviousData:u=!1,live:l=!1,shardKey:n="",staleTime:K}=r,m=j(t,e,n),L=J(m,()=>s.query(S(t),e,q(n)),{enabled:a,keepPreviousData:u,staleTime:K??(l?Number.POSITIVE_INFINITY:0)}),[O,y]=(0,p.useState)(void 0),Q=JSON.stringify(m);return(0,p.useEffect)(()=>{if(!a||!l)return;y(void 0);let b=f.startSubscription(t,e,n),M=s.subscribe(S(t),e,h=>{f.recordPush(b),y(void 0),o.setQueryData(x(m,s.clientIdentifier()),h)},{...q(n),onError:i(h=>{f.failSubscription(b,h.message),y(h.message)},"onError")});return()=>{f.endSubscription(b),M()}},[Q,a,l]),{...L,liveError:a&&l?O:void 0}}i(W,"J");var Y=i(()=>{let t=(0,_.c)(2),e=v(),r;return t[0]!==e?(r=i((s,o,a)=>{let u=o===void 0?["lunora-admin",s]:j(s,o,a??"");w(e.invalidateQueries({queryKey:u}))},"r"),t[0]=e,t[1]=r):r=t[1],r},"U");export{f as a,J as b,W as c,Y as d};
@@ -1 +1 @@
1
- import{a as y}from"./chunk-R5ZTCHCE.js";var d=y(r=>{let t="";for(let c=0;c<r.length;c+=32768)t+=String.fromCharCode(...r.subarray(c,c+32768));return btoa(t)},"g"),A=y(r=>{let t=atob(r),c=new Uint8Array(t.length);for(let s=0;s<t.length;s+=1)c[s]=t.codePointAt(s)??0;return c},"p"),o="$lunora.wire$",p="__proto__",g={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},w={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},m=y(r=>{if(r===null||typeof r!="object")return!1;let t=Object.getPrototypeOf(r);return t===null||t===Object.prototype},"E"),f=y((r,t=0)=>{if(t>64)throw new RangeError("wire-codec: value nesting exceeds the 64-level limit");if(r===void 0)return[o,"undefined"];if(r===null)return null;let c=typeof r;if(c==="bigint")return[o,"bigint",r.toString()];if(c==="number"){let e=r;return Number.isNaN(e)?[o,"nan"]:e===1/0?[o,"inf"]:e===-1/0?[o,"-inf"]:e}if(c!=="object")return r;if(r instanceof Date)return[o,"date",f(r.getTime(),t+1)];if(r instanceof Error){let e=r,a={};for(let l of Object.keys(e))e[l]!==void 0&&(a[l]=f(e[l],t+1));let i=[o,"error",e.name,e.message,a];return e.cause!==void 0&&i.push(f(e.cause,t+1)),i}if(r instanceof URL)return[o,"url",r.href];if(r instanceof Map)return[o,"map",[...r.entries()].map(([e,a])=>[f(e,t+1),f(a,t+1)])];if(r instanceof Set)return[o,"set",[...r].map(e=>f(e,t+1))];if(r instanceof ArrayBuffer)return[o,"bytes",d(new Uint8Array(r)),"ArrayBuffer"];if(ArrayBuffer.isView(r)){let e=r,a=e.constructor.name,i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return a==="Uint8Array"?[o,"bytes",d(i)]:[o,"bytes",d(i),a]}if(Array.isArray(r)){let e=r.map(a=>f(a,t+1));return e.length>0&&e[0]===o?[o,"arr",e]:e}if(!m(r)){let e=r.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${e} over the Lunora wire \u2014 only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)}let s=r,n={};for(let e of Object.keys(s)){let a=s[e];if(a===void 0)continue;let i=f(a,t+1);e===p?Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[e]=i}return n},"u"),u=y((r,t=0)=>{if(t>64)throw new RangeError("wire-codec: value nesting exceeds the 64-level limit");if(r===null||typeof r!="object")return r;if(Array.isArray(r)){if(r[0]===o)switch(r[1]){case"-inf":return-1/0;case"arr":return r[2].map(n=>u(n,t+1));case"bigint":{let n=r[2];if(typeof n!="string"||n.length>1024||!/^-?\d+$/.test(n))throw new RangeError("wire-codec: invalid or over-long bigint (max 1024 digits)");return BigInt(n)}case"date":return new Date(u(r[2],t+1));case"map":return new Map(r[2].map(([n,e])=>[u(n,t+1),u(e,t+1)]));case"set":return new Set(r[2].map(n=>u(n,t+1)));case"url":return new URL(r[2]);case"error":{let n=r[2],e=r[3],a=(Object.hasOwn(w,n)?w[n]:void 0)??Error,i=new a(e);i.name!==n&&Object.defineProperty(i,"name",{configurable:!0,value:n,writable:!0});let l=u(r[4],t+1);for(let b of Object.keys(l))b===p?Object.defineProperty(i,b,{configurable:!0,enumerable:!0,value:l[b],writable:!0}):i[b]=l[b];return r.length>5&&Object.defineProperty(i,"cause",{configurable:!0,value:u(r[5],t+1),writable:!0}),i}case"bytes":{let n=A(r[2]),e=r[3]??"Uint8Array";if(e==="ArrayBuffer")return n.buffer.byteLength===n.byteLength?n.buffer:n.slice().buffer;let a=Object.hasOwn(g,e)?g[e]:void 0;return a?new a(n.slice().buffer):n}case"inf":return 1/0;case"nan":return Number.NaN;case"undefined":return;default:return r.map(n=>u(n,t+1))}return r.map(n=>u(n,t+1))}let c=r,s={};for(let n of Object.keys(c)){let e=u(c[n],t+1);n===p?Object.defineProperty(s,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):s[n]=e}return s},"f"),h=y(r=>{try{let t=u(JSON.parse(r));return m(t)?t:void 0}catch{return}},"l");export{m as a,f as b,u as c,h as d};
1
+ import{a as y}from"./chunk-YKXDMIHQ.js";var d=y(r=>{let t="";for(let c=0;c<r.length;c+=32768)t+=String.fromCharCode(...r.subarray(c,c+32768));return btoa(t)},"g"),A=y(r=>{let t=atob(r),c=new Uint8Array(t.length);for(let s=0;s<t.length;s+=1)c[s]=t.codePointAt(s)??0;return c},"p"),o="$lunora.wire$",p="__proto__",g={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},w={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},m=y(r=>{if(r===null||typeof r!="object")return!1;let t=Object.getPrototypeOf(r);return t===null||t===Object.prototype},"E"),f=y((r,t=0)=>{if(t>64)throw new RangeError("wire-codec: value nesting exceeds the 64-level limit");if(r===void 0)return[o,"undefined"];if(r===null)return null;let c=typeof r;if(c==="bigint")return[o,"bigint",r.toString()];if(c==="number"){let e=r;return Number.isNaN(e)?[o,"nan"]:e===1/0?[o,"inf"]:e===-1/0?[o,"-inf"]:e}if(c!=="object")return r;if(r instanceof Date)return[o,"date",f(r.getTime(),t+1)];if(r instanceof Error){let e=r,a={};for(let l of Object.keys(e))e[l]!==void 0&&(a[l]=f(e[l],t+1));let i=[o,"error",e.name,e.message,a];return e.cause!==void 0&&i.push(f(e.cause,t+1)),i}if(r instanceof URL)return[o,"url",r.href];if(r instanceof Map)return[o,"map",[...r.entries()].map(([e,a])=>[f(e,t+1),f(a,t+1)])];if(r instanceof Set)return[o,"set",[...r].map(e=>f(e,t+1))];if(r instanceof ArrayBuffer)return[o,"bytes",d(new Uint8Array(r)),"ArrayBuffer"];if(ArrayBuffer.isView(r)){let e=r,a=e.constructor.name,i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return a==="Uint8Array"?[o,"bytes",d(i)]:[o,"bytes",d(i),a]}if(Array.isArray(r)){let e=r.map(a=>f(a,t+1));return e.length>0&&e[0]===o?[o,"arr",e]:e}if(!m(r)){let e=r.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${e} over the Lunora wire \u2014 only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)}let s=r,n={};for(let e of Object.keys(s)){let a=s[e];if(a===void 0)continue;let i=f(a,t+1);e===p?Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[e]=i}return n},"u"),u=y((r,t=0)=>{if(t>64)throw new RangeError("wire-codec: value nesting exceeds the 64-level limit");if(r===null||typeof r!="object")return r;if(Array.isArray(r)){if(r[0]===o)switch(r[1]){case"-inf":return-1/0;case"arr":return r[2].map(n=>u(n,t+1));case"bigint":{let n=r[2];if(typeof n!="string"||n.length>1024||!/^-?\d+$/.test(n))throw new RangeError("wire-codec: invalid or over-long bigint (max 1024 digits)");return BigInt(n)}case"date":return new Date(u(r[2],t+1));case"map":return new Map(r[2].map(([n,e])=>[u(n,t+1),u(e,t+1)]));case"set":return new Set(r[2].map(n=>u(n,t+1)));case"url":return new URL(r[2]);case"error":{let n=r[2],e=r[3],a=(Object.hasOwn(w,n)?w[n]:void 0)??Error,i=new a(e);i.name!==n&&Object.defineProperty(i,"name",{configurable:!0,value:n,writable:!0});let l=u(r[4],t+1);for(let b of Object.keys(l))b===p?Object.defineProperty(i,b,{configurable:!0,enumerable:!0,value:l[b],writable:!0}):i[b]=l[b];return r.length>5&&Object.defineProperty(i,"cause",{configurable:!0,value:u(r[5],t+1),writable:!0}),i}case"bytes":{let n=A(r[2]),e=r[3]??"Uint8Array";if(e==="ArrayBuffer")return n.buffer.byteLength===n.byteLength?n.buffer:n.slice().buffer;let a=Object.hasOwn(g,e)?g[e]:void 0;return a?new a(n.slice().buffer):n}case"inf":return 1/0;case"nan":return Number.NaN;case"undefined":return;default:return r.map(n=>u(n,t+1))}return r.map(n=>u(n,t+1))}let c=r,s={};for(let n of Object.keys(c)){let e=u(c[n],t+1);n===p?Object.defineProperty(s,n,{configurable:!0,enumerable:!0,value:e,writable:!0}):s[n]=e}return s},"f"),h=y(r=>{try{let t=u(JSON.parse(r));return m(t)?t:void 0}catch{return}},"l");export{m as a,f as b,u as c,h as d};
@@ -1 +1 @@
1
- import{a as me}from"./chunk-ZPGNTTQ3.js";import{a as Ft,b as Lt,c as At,d as Kt}from"./chunk-EYGF6TQS.js";import{a as it}from"./chunk-Q7ZPWO67.js";import{a as Ct,b as It,c as Tt,d as Rt,e as je}from"./chunk-VR3UJA7B.js";import{a as Ot}from"./chunk-CAOUXOL7.js";import{a as zt}from"./chunk-76YLMHR3.js";import"./chunk-2SFSTQS4.js";import"./chunk-AFKLFS74.js";import{e as _t}from"./chunk-W2JBKQNU.js";import"./chunk-CP4ZFBVW.js";import{a as $t}from"./chunk-JURAVSE7.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import{a as Ze,b as et,c as tt,d as vt,e as yt,f as rt,g as at,h as Nt,i as St}from"./chunk-EGSG64TS.js";import"./chunk-JV7KTJPY.js";import"./chunk-DPNEFSEC.js";import{a as Mt}from"./chunk-CKTKI4IY.js";import{a as kt}from"./chunk-TB5N24CM.js";import{a as wt,b as qt}from"./chunk-KVSQKUWD.js";import"./chunk-4YTSKL4R.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as Ye}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as Ue}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import"./chunk-F7JOSNAT.js";import{a as Le}from"./chunk-DZGOHOOE.js";import{c as De}from"./chunk-4U5PYZLE.js";import{f as dt}from"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as ht}from"./chunk-UANVABQG.js";import{a as st,b as lt,c as nt,d as Ee,e as de,f as H}from"./chunk-L4EZAHCD.js";import{a as fe,b as Ae,c as Ke,d as ut,e as pe}from"./chunk-IYWVSMAY.js";import{d as ge,f as gt,g as ft,h as pt,i as xt,l as We,o as bt}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as o,d as Xe,e as Qt,f as Jt,g as Bt,i as mt}from"./chunk-R5ZTCHCE.js";var j=Xe(Qt(),1);var xe=Xe(Jt(),1);var t=Xe(Bt(),1);var Ht=/["\\\u0000-\u001F\uD800-\uDFFF]/,Dt=o(s=>Ht.test(s)?JSON.stringify(s):`"${s}"`,"ot"),ct=o(s=>{if(s===void 0)return"null";if(typeof s=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(typeof s=="number"){if(Number.isNaN(s))return"nan";if(s===1/0)return"inf";if(s===-1/0)return"-inf";if(Object.is(s,-0))return"-0"}if(typeof s=="string")return Dt(s);if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s)){let i="[";for(let n=0;n<s.length;n++)n>0&&(i+=","),i+=ct(s[n]);return i+"]"}let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let i=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${i} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}let l=s,a=Object.keys(l).sort(),r="{",u=!0;for(let i of a){let n=l[i];n!==void 0&&(u?u=!1:r+=",",r+=Dt(i),r+=":",r+=ct(n))}return r+"}"},"Ze"),jt=o((s,e,l)=>`${s}:${e}:${ct(l??{})}`,"ht"),Pt=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"gt"),Ut=o((s,e)=>Pt(s,e),"Jt"),Wt=o(s=>Pt(s.kind,s),"Vt"),ot=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"We"),Gt=o(s=>Array.isArray(s?.series)?s.series:[],"Gt"),Vt="FUNCTION_NOT_FOUND",Xt=o(s=>{let e=new Map;if(!Array.isArray(s?.series))return e;for(let l of s.series)e.set(jt(l.kind,l.name,l.attributes),l.points);return e},"Xt"),Yt={counter:"secondary",gauge:"default",histogram:"outline"},Zt=o(s=>{let e=(0,xe.c)(18),{name:l,onOpenTrace:a,traceId:r}=s,u=ge();if(r===void 0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=d):d=e[0],d}let i;e[1]!==r?(i=r.slice(0,8),e[1]=r,e[2]=i):i=e[2];let n=i;if(a===void 0){let d=`mt-instrument-trace-${l}`,g;return e[3]!==n||e[4]!==d||e[5]!==r?(g=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":d,title:r,children:n}),e[3]=n,e[4]=d,e[5]=r,e[6]=g):g=e[6],g}let S=`mt-instrument-trace-${l}`,v;e[7]!==a||e[8]!==r?(v=o(()=>{a(r)},"y"),e[7]=a,e[8]=r,e[9]=v):v=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 h;return e[13]!==n||e[14]!==S||e[15]!==v||e[16]!==w?(h=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":S,onClick:v,title:w,type:"button",children:n}),e[13]=n,e[14]=S,e[15]=v,e[16]=w,e[17]=h):h=e[17],h},"Zt"),er=o(s=>{let e=(0,xe.c)(105),{onOpenTrace:l,shardKey:a}=s,r=ge(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={},e[0]=u):u=e[0];let i;e[1]!==a?(i={live:!0,shardKey:a},e[1]=a,e[2]=i):i=e[2];let{data:n,error:S,errorSource:v}=De(Le.getMetricSeries,u,i),w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w={},e[3]=w):w=e[3];let h;e[4]!==a?(h={live:!0,shardKey:a},e[4]=a,e[5]=h):h=e[5];let{data:d}=De(Le.getMetricHistory,w,h),g,y,q,$,c,p,f,x,k,_,N,I,C;if(e[6]!==n||e[7]!==S||e[8]!==v||e[9]!==d||e[10]!==l||e[11]!==r){x=Symbol.for("react.early_return_sentinel");e:{let L=Gt(n),K=xt(v)===Vt;if(S!==null&&!K){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let E;e[27]!==m?(E=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=E):E=e[28];let Q;e[29]!==S||e[30]!==r?(Q=r("Instruments unavailable: {error}",{error:S}),e[29]=S,e[30]=r,e[31]=Q):Q=e[31];let J;e[32]!==Q?(J=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:Q}),e[32]=Q,e[33]=J):J=e[33];let ce;e[34]!==E||e[35]!==J?(ce=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[E,J]}),e[34]=E,e[35]=J,e[36]=ce):ce=e[36],x=ce;break e}if(L.length===0){x=null;break e}let F=Xt(d),D;e[37]!==r?(D=o(m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),"z"),e[37]=r,e[38]=D):D=e[38];let P=D;c="flex flex-col gap-2",p="mt-instruments";let A;e[39]!==r?(A=r("Instruments"),e[39]=r,e[40]=A):A=e[40],e[41]!==A?(f=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:A}),e[41]=A,e[42]=f):f=e[42],$=fe,C="overflow-hidden py-0",q=pe,I="px-0",y=st,_="mt-instruments-table";let U;e[43]!==r?(U=r("name"),e[43]=r,e[44]=U):U=e[44];let W;e[45]!==U?(W=(0,t.jsx)(de,{children:U}),e[45]=U,e[46]=W):W=e[46];let G;e[47]!==r?(G=r("kind"),e[47]=r,e[48]=G):G=e[48];let V;e[49]!==G?(V=(0,t.jsx)(de,{children:G}),e[49]=G,e[50]=V):V=e[50];let X;e[51]!==r?(X=r("value"),e[51]=r,e[52]=X):X=e[52];let Y;e[53]!==X?(Y=(0,t.jsx)(de,{className:"text-right",children:X}),e[53]=X,e[54]=Y):Y=e[54];let Z;e[55]!==r?(Z=r("count"),e[55]=r,e[56]=Z):Z=e[56];let ee;e[57]!==Z?(ee=(0,t.jsx)(de,{className:"text-right",children:Z}),e[57]=Z,e[58]=ee):ee=e[58];let te;e[59]!==r?(te=r("range"),e[59]=r,e[60]=te):te=e[60];let re;e[61]!==te?(re=(0,t.jsx)(de,{className:"text-right",children:te}),e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==r?(ae=r("trend"),e[63]=r,e[64]=ae):ae=e[64];let se;e[65]!==ae?(se=(0,t.jsx)(de,{children:ae}),e[65]=ae,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ne;e[69]!==le?(ne=(0,t.jsx)(de,{children:le}),e[69]=le,e[70]=ne):ne=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let oe;e[73]!==ie?(oe=(0,t.jsx)(de,{children:ie}),e[73]=ie,e[74]=oe):oe=e[74],e[75]!==W||e[76]!==V||e[77]!==Y||e[78]!==ee||e[79]!==re||e[80]!==se||e[81]!==ne||e[82]!==oe?(N=(0,t.jsx)(lt,{children:(0,t.jsxs)(Ee,{children:[W,V,Y,ee,re,se,ne,oe]})}),e[75]=W,e[76]=V,e[77]=Y,e[78]=ee,e[79]=re,e[80]=se,e[81]=ne,e[82]=oe,e[83]=N):N=e[83],g=nt,k=L.map(m=>{let E=Ot(m.attributes),Q=jt(m.kind,m.name,m.attributes),J=(F.get(Q)??[]).map(ce=>Ut(m.kind,ce));return(0,t.jsxs)(Ee,{"data-testid":`mt-instrument-${m.name}`,children:[(0,t.jsx)(H,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),(0,t.jsx)(H,{children:(0,t.jsx)(Ue,{variant:Yt[m.kind],children:P(m.kind)})}),(0,t.jsx)(H,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:ot(Wt(m))}),(0,t.jsx)(H,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),(0,t.jsx)(H,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"\u2014":`${ot(m.min)}\u2013${ot(m.max)}`}),(0,t.jsx)(H,{children:J.length>=2?(0,t.jsx)(it,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:J,testId:`mt-instrument-trend-${m.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(H,{className:"font-mono text-xs",children:(0,t.jsx)(Zt,{name:m.name,onOpenTrace:l,traceId:m.exemplarTraceId})}),(0,t.jsx)(H,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:E,children:E===""?"\u2014":E})]},Q)})}e[6]=n,e[7]=S,e[8]=v,e[9]=d,e[10]=l,e[11]=r,e[12]=g,e[13]=y,e[14]=q,e[15]=$,e[16]=c,e[17]=p,e[18]=f,e[19]=x,e[20]=k,e[21]=_,e[22]=N,e[23]=I,e[24]=C}else g=e[12],y=e[13],q=e[14],$=e[15],c=e[16],p=e[17],f=e[18],x=e[19],k=e[20],_=e[21],N=e[22],I=e[23],C=e[24];if(x!==Symbol.for("react.early_return_sentinel"))return x;let T;e[84]!==g||e[85]!==k?(T=(0,t.jsx)(g,{children:k}),e[84]=g,e[85]=k,e[86]=T):T=e[86];let M;e[87]!==y||e[88]!==T||e[89]!==_||e[90]!==N?(M=(0,t.jsxs)(y,{"data-testid":_,children:[N,T]}),e[87]=y,e[88]=T,e[89]=_,e[90]=N,e[91]=M):M=e[91];let b;e[92]!==q||e[93]!==M||e[94]!==I?(b=(0,t.jsx)(q,{className:I,children:M}),e[92]=q,e[93]=M,e[94]=I,e[95]=b):b=e[95];let R;e[96]!==$||e[97]!==b||e[98]!==C?(R=(0,t.jsx)($,{className:C,children:b}),e[96]=$,e[97]=b,e[98]=C,e[99]=R):R=e[99];let z;return e[100]!==c||e[101]!==p||e[102]!==f||e[103]!==R?(z=(0,t.jsxs)("section",{className:c,"data-testid":p,children:[f,R]}),e[100]=c,e[101]=p,e[102]=f,e[103]=R,e[104]=z):z=e[104],z},"er"),tr=o(s=>{let e=(0,xe.c)(74),{aggregate:l,shardResults:a}=s,r=ge(),u;e[0]!==r?(u=r("Shards"),e[0]=r,e[1]=u):u=e[1];let i;e[2]!==l.failed||e[3]!==l.reachable||e[4]!==r?(i=l.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:l.failed,reachable:l.reachable}):r("{reachable} reachable",{reachable:l.reachable}),e[2]=l.failed,e[3]=l.reachable,e[4]=r,e[5]=i):i=e[5];let n;e[6]!==u||e[7]!==i?(n=(0,t.jsx)(me,{label:u,testId:"mt-agg-shards",value:i}),e[6]=u,e[7]=i,e[8]=n):n=e[8];let S;e[9]!==r?(S=r("Total requests"),e[9]=r,e[10]=S):S=e[10];let v;e[11]!==l.totalRequests||e[12]!==S?(v=(0,t.jsx)(me,{label:S,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=S,e[13]=v):v=e[13];let w;e[14]!==r?(w=r("Total errors"),e[14]=r,e[15]=w):w=e[15];let h;e[16]!==l.totalErrors||e[17]!==w?(h=(0,t.jsx)(me,{label:w,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=w,e[18]=h):h=e[18];let d;e[19]!==r?(d=r("Total database size"),e[19]=r,e[20]=d):d=e[20];let g;e[21]!==l.totalDatabaseSize?(g=We(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=g):g=e[22];let y;e[23]!==d||e[24]!==g?(y=(0,t.jsx)(me,{label:d,testId:"mt-agg-db-size",value:g}),e[23]=d,e[24]=g,e[25]=y):y=e[25];let q;e[26]!==r?(q=r("Combined cache hit rate"),e[26]=r,e[27]=q):q=e[27];let $;e[28]!==l.hitRate||e[29]!==r?($=l.hitRate===null?r("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=r,e[30]=$):$=e[30];let c;e[31]!==q||e[32]!==$?(c=(0,t.jsx)(me,{label:q,testId:"mt-agg-cache",value:$}),e[31]=q,e[32]=$,e[33]=c):c=e[33];let p;e[34]!==y||e[35]!==c||e[36]!==n||e[37]!==v||e[38]!==h?(p=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,v,h,y,c]}),e[34]=y,e[35]=c,e[36]=n,e[37]=v,e[38]=h,e[39]=p):p=e[39];let f;e[40]!==r?(f=r("shard"),e[40]=r,e[41]=f):f=e[41];let x;e[42]!==f?(x=(0,t.jsx)(de,{children:f}),e[42]=f,e[43]=x):x=e[43];let k;e[44]!==r?(k=r("requests"),e[44]=r,e[45]=k):k=e[45];let _;e[46]!==k?(_=(0,t.jsx)(de,{children:k}),e[46]=k,e[47]=_):_=e[47];let N;e[48]!==r?(N=r("errors"),e[48]=r,e[49]=N):N=e[49];let I;e[50]!==N?(I=(0,t.jsx)(de,{children:N}),e[50]=N,e[51]=I):I=e[51];let C;e[52]!==r?(C=r("db size"),e[52]=r,e[53]=C):C=e[53];let T;e[54]!==C?(T=(0,t.jsx)(de,{children:C}),e[54]=C,e[55]=T):T=e[55];let M;e[56]!==x||e[57]!==_||e[58]!==I||e[59]!==T?(M=(0,t.jsx)(lt,{children:(0,t.jsxs)(Ee,{children:[x,_,I,T]})}),e[56]=x,e[57]=_,e[58]=I,e[59]=T,e[60]=M):M=e[60];let b;if(e[61]!==a||e[62]!==r){let K;e[64]!==r?(K=o(F=>(0,t.jsxs)(Ee,{"data-testid":`mt-agg-row-${F.shard}`,children:[(0,t.jsx)(H,{children:F.shard}),F.metrics===null?(0,t.jsx)(H,{className:"text-destructive",colSpan:3,children:F.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{className:"tabular-nums",children:F.metrics.requests}),(0,t.jsx)(H,{className:"tabular-nums",children:F.metrics.errors}),(0,t.jsx)(H,{className:"tabular-nums",children:We(F.metrics.databaseSize)})]})]},F.shard),"L"),e[64]=r,e[65]=K):K=e[65],b=a.map(K),e[61]=a,e[62]=r,e[63]=b}else b=e[63];let R;e[66]!==b?(R=(0,t.jsx)(nt,{children:b}),e[66]=b,e[67]=R):R=e[67];let z;e[68]!==M||e[69]!==R?(z=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(pe,{className:"px-0",children:(0,t.jsxs)(st,{"data-testid":"mt-agg-table",children:[M,R]})})}),e[68]=M,e[69]=R,e[70]=z):z=e[70];let L;return e[71]!==p||e[72]!==z?(L=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[p,z]}),e[71]=p,e[72]=z,e[73]=L):L=e[73],L},"tr"),rr=o(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return l>0?`${l.toString()}h ${a.toString()}m`:a>0?`${a.toString()}m ${r.toString()}s`:`${r.toString()}s`},"rr"),ar=o((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"sr"),Et=o(s=>s<=0?"\u2014":s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"ct"),sr=o(s=>{let e=(0,xe.c)(75),{currentDelta:l,errorRate:a,history:r,latencyPercentiles:u,metrics:i}=s,n=ge(),S;e[0]!==r||e[1]!==n?(S=r.length>=2?(0,t.jsx)(it,{ariaLabel:n("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:r,testId:"mt-sparkline"}):void 0,e[0]=r,e[1]=n,e[2]=S):S=e[2];let v;e[3]!==l||e[4]!==r.length||e[5]!==n?(v=r.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${l.toLocaleString()}`})," ",n("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:n("collecting samples\u2026")}),e[3]=l,e[4]=r.length,e[5]=n,e[6]=v):v=e[6];let w;e[7]!==n?(w=n("Requests"),e[7]=n,e[8]=w):w=e[8];let h;e[9]!==i.requests||e[10]!==S||e[11]!==v||e[12]!==w?(h=(0,t.jsx)(me,{chart:S,footer:v,label:w,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=S,e[11]=v,e[12]=w,e[13]=h):h=e[13];let d;e[14]!==a||e[15]!==n?(d=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=d):d=e[16];let g;e[17]!==n?(g=n("Errors"),e[17]=n,e[18]=g):g=e[18];let y;e[19]!==a||e[20]!==i.errors?(y=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=y):y=e[21];let q;e[22]!==d||e[23]!==g||e[24]!==y?(q=(0,t.jsx)(me,{footer:d,label:g,testId:"mt-errors",value:y}),e[22]=d,e[23]=g,e[24]=y,e[25]=q):q=e[25];let $;e[26]!==u.p90?($=u.p90>0?`P90 ${Et(u.p90)}`:void 0,e[26]=u.p90,e[27]=$):$=e[27];let c;e[28]!==n?(c=n("P95 latency"),e[28]=n,e[29]=c):c=e[29];let p;e[30]!==u.p95?(p=u.p95>0?Et(u.p95):"\u2014",e[30]=u.p95,e[31]=p):p=e[31];let f;e[32]!==c||e[33]!==p||e[34]!==$?(f=(0,t.jsx)(me,{footer:$,label:c,testId:"mt-p95",value:p}),e[32]=c,e[33]=p,e[34]=$,e[35]=f):f=e[35];let x;e[36]!==i.cache||e[37]!==n?(x=i.cache===null?void 0:`${i.cache.entries.toLocaleString()} ${n("cache entries")}`,e[36]=i.cache,e[37]=n,e[38]=x):x=e[38];let k;e[39]!==n?(k=n("Database size"),e[39]=n,e[40]=k):k=e[40];let _;e[41]!==i.databaseSize?(_=We(i.databaseSize),e[41]=i.databaseSize,e[42]=_):_=e[42];let N;e[43]!==x||e[44]!==k||e[45]!==_?(N=(0,t.jsx)(me,{footer:x,label:k,testId:"mt-db-size",value:_}),e[43]=x,e[44]=k,e[45]=_,e[46]=N):N=e[46];let I;e[47]!==n?(I=n("Shard"),e[47]=n,e[48]=I):I=e[48];let C;e[49]!==i.shard||e[50]!==I?(C=(0,t.jsx)(me,{label:I,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=I,e[51]=C):C=e[51];let T;e[52]!==n?(T=n("Uptime"),e[52]=n,e[53]=T):T=e[53];let M;e[54]!==i.uptimeMs?(M=rr(i.uptimeMs),e[54]=i.uptimeMs,e[55]=M):M=e[55];let b;e[56]!==T||e[57]!==M?(b=(0,t.jsx)(me,{label:T,testId:"mt-uptime",value:M}),e[56]=T,e[57]=M,e[58]=b):b=e[58];let R;e[59]!==n?(R=n("Cache hit rate"),e[59]=n,e[60]=R):R=e[60];let z;e[61]!==i.cache||e[62]!==n?(z=i.cache===null?n("no cache configured"):n("{rate} ({count} entries)",{count:i.cache.entries,rate:ar(i.cache.hits,i.cache.misses)}),e[61]=i.cache,e[62]=n,e[63]=z):z=e[63];let L;e[64]!==R||e[65]!==z?(L=(0,t.jsx)(me,{label:R,testId:"mt-cache",value:z}),e[64]=R,e[65]=z,e[66]=L):L=e[66];let K;return e[67]!==f||e[68]!==N||e[69]!==C||e[70]!==b||e[71]!==L||e[72]!==h||e[73]!==q?(K=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[h,q,f,N,C,b,L]}),e[67]=f,e[68]=N,e[69]=C,e[70]=b,e[71]=L,e[72]=h,e[73]=q,e[74]=K):K=e[74],K},"lr"),Ve=o(s=>s>=100?"critical":s>=50?"warning":"good","Ve"),Pe=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Ae"),Ge=o(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"He"),lr=o(s=>{let e=(0,xe.c)(3),{level:l}=s;if(l==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(Ue,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(l==="warning"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("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 a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("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]=a):a=e[2],a},"ar"),nr=o((s,e)=>{let l=[...s];return l.sort((a,r)=>{switch(e){case"avgTime":return r.avgDurationMs-a.avgDurationMs;case"execCount":return r.execCount-a.execCount;case"rowsRead":return r.rowsRead-a.rowsRead;default:return r.totalDurationMs-a.totalDurationMs}}),l},"ir"),ir=o(s=>{let e=(0,xe.c)(161),{queryStats:l}=s,a=ge(),[r,u]=(0,j.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,S]=(0,j.useState)(i),v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=o(C=>{C!==null&&u(C)},"y"),e[1]=v):v=e[1];let w=v,h,d,g,y,q,$,c,p,f,x;if(e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==a){g=Symbol.for("react.early_return_sentinel");e:{let C=nr(l,r),T;e[16]!==l?(T=l.filter(or),e[16]=l,e[17]=T):T=e[17];let M=T.length,b;e[18]!==l?(b=l.filter(cr),e[18]=l,e[19]=b):b=e[19];let R=b.length,z;e[20]!==l?(z=l.filter(dr),e[20]=l,e[21]=z):z=e[21];let L=z.length,K;e[22]===Symbol.for("react.memo_cache_sentinel")?(K=o(O=>{S(ue=>{let B=new Set(ue);return B.has(O)?B.delete(O):B.add(O),B})},"L"),e[22]=K):K=e[22];let F=K;if(l.length===0){let O;e[23]!==a?(O=a("No query insights yet"),e[23]=a,e[24]=O):O=e[24];let ue;e[25]!==O?(ue=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:O}),e[25]=O,e[26]=ue):ue=e[26];let B;e[27]!==a?(B=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=B):B=e[28];let he;e[29]!==B?(he=(0,t.jsx)("p",{className:"mt-1 text-sm",children:B}),e[29]=B,e[30]=he):he=e[30];let He;e[31]!==ue||e[32]!==he?(He=(0,t.jsx)(fe,{children:(0,t.jsx)(pe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ue,he]})})}),e[31]=ue,e[32]=he,e[33]=He):He=e[33],g=He;break e}c="space-y-4",p="qi-root";let D;e[34]!==a?(D=a("Critical queries"),e[34]=a,e[35]=D):D=e[35];let P;e[36]!==D?(P=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:D})}),e[36]=D,e[37]=P):P=e[37];let A;e[38]!==M?(A=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:M}),e[38]=M,e[39]=A):A=e[39];let U;e[40]!==a?(U=a(">100ms avg execution"),e[40]=a,e[41]=U):U=e[41];let W;e[42]!==U?(W=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:U}),e[42]=U,e[43]=W):W=e[43];let G;e[44]!==A||e[45]!==W?(G=(0,t.jsxs)(pe,{children:[A,W]}),e[44]=A,e[45]=W,e[46]=G):G=e[46];let V;e[47]!==P||e[48]!==G?(V=(0,t.jsxs)(fe,{children:[P,G]}),e[47]=P,e[48]=G,e[49]=V):V=e[49];let X;e[50]!==a?(X=a("Moderate queries"),e[50]=a,e[51]=X):X=e[51];let Y;e[52]!==X?(Y=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:X})}),e[52]=X,e[53]=Y):Y=e[53];let Z;e[54]!==R?(Z=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:R}),e[54]=R,e[55]=Z):Z=e[55];let ee;e[56]!==a?(ee=a("50\u2013100ms avg execution"),e[56]=a,e[57]=ee):ee=e[57];let te;e[58]!==ee?(te=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ee}),e[58]=ee,e[59]=te):te=e[59];let re;e[60]!==Z||e[61]!==te?(re=(0,t.jsxs)(pe,{children:[Z,te]}),e[60]=Z,e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==Y||e[64]!==re?(ae=(0,t.jsxs)(fe,{children:[Y,re]}),e[63]=Y,e[64]=re,e[65]=ae):ae=e[65];let se;e[66]!==a?(se=a("Fast queries"),e[66]=a,e[67]=se):se=e[67];let le;e[68]!==se?(le=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ne;e[70]!==L?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:L}),e[70]=L,e[71]=ne):ne=e[71];let ie;e[72]!==a?(ie=a("<50ms avg execution"),e[72]=a,e[73]=ie):ie=e[73];let oe;e[74]!==ie?(oe=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=oe):oe=e[75];let m;e[76]!==ne||e[77]!==oe?(m=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=m):m=e[78];let E;e[79]!==le||e[80]!==m?(E=(0,t.jsxs)(fe,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=E):E=e[81],e[82]!==V||e[83]!==ae||e[84]!==E?(f=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[V,ae,E]}),e[82]=V,e[83]=ae,e[84]=E,e[85]=f):f=e[85];let Q;e[86]!==a?(Q=a("Query leaderboard"),e[86]=a,e[87]=Q):Q=e[87];let J;e[88]!==Q?(J=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:Q}),e[88]=Q,e[89]=J):J=e[89];let ce;e[90]!==r||e[91]!==a?(ce=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=ce):ce=e[92];let be;e[93]!==ce?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:ce}),e[93]=ce,e[94]=be):be=e[94];let ve;e[95]!==J||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[J,be]}),e[95]=J,e[96]=be,e[97]=ve):ve=e[97];let ye;e[98]!==a?(ye=a("Sort by"),e[98]=a,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==a?(Se=a("Sort queries by"),e[102]=a,e[103]=Se):Se=e[103];let Qe;e[104]===Symbol.for("react.memo_cache_sentinel")?(Qe=(0,t.jsx)(It,{}),e[104]=Qe):Qe=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(Tt,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Qe}),e[105]=Se,e[106]=we):we=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let ke;e[109]!==qe?(ke=(0,t.jsx)(je,{value:"totalTime",children:qe}),e[109]=qe,e[110]=ke):ke=e[110];let Me;e[111]!==a?(Me=a("Avg time"),e[111]=a,e[112]=Me):Me=e[112];let $e;e[113]!==Me?($e=(0,t.jsx)(je,{value:"avgTime",children:Me}),e[113]=Me,e[114]=$e):$e=e[114];let _e;e[115]!==a?(_e=a("Execution count"),e[115]=a,e[116]=_e):_e=e[116];let Ce;e[117]!==_e?(Ce=(0,t.jsx)(je,{value:"execCount",children:_e}),e[117]=_e,e[118]=Ce):Ce=e[118];let Ie;e[119]!==a?(Ie=a("Rows read"),e[119]=a,e[120]=Ie):Ie=e[120];let Te;e[121]!==Ie?(Te=(0,t.jsx)(je,{value:"rowsRead",children:Ie}),e[121]=Ie,e[122]=Te):Te=e[122];let Re;e[123]!==ke||e[124]!==$e||e[125]!==Ce||e[126]!==Te?(Re=(0,t.jsxs)(Rt,{children:[ke,$e,Ce,Te]}),e[123]=ke,e[124]=$e,e[125]=Ce,e[126]=Te,e[127]=Re):Re=e[127];let Oe;e[128]!==r||e[129]!==we||e[130]!==Re?(Oe=(0,t.jsxs)(Ct,{onValueChange:w,value:r,children:[we,Re]}),e[128]=r,e[129]=we,e[130]=Re,e[131]=Oe):Oe=e[131];let ze;e[132]!==Ne||e[133]!==Oe?(ze=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,Oe]}),e[132]=Ne,e[133]=Oe,e[134]=ze):ze=e[134],e[135]!==ve||e[136]!==ze?(x=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,ze]}),e[135]=ve,e[136]=ze,e[137]=x):x=e[137],d=fe;let Fe;e[138]!==a?(Fe=a("Statements"),e[138]=a,e[139]=Fe):Fe=e[139];let Je;e[140]!==Fe?(Je=(0,t.jsx)(Ke,{children:Fe}),e[140]=Fe,e[141]=Je):Je=e[141],$=(0,t.jsxs)(Ae,{children:[Je,(0,t.jsx)(ut,{children:a("{count} tracked statements",{count:C.length})})]}),h=pe,y="space-y-2";let Be;e[142]!==n||e[143]!==a?(Be=o(O=>{let ue=O.normalizedSql,B=n.has(ue),he=Ve(O.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":B,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{F(ue)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(lr,{level:he}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:O.normalizedSql})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Pe(O.totalDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("total")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Pe(O.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),O.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Pe(O.p95DurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("p95")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ge(O.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),B&&(0,t.jsxs)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-2 text-sm font-medium",children:a("Full statement")}),(0,t.jsx)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:O.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[O.p50DurationMs!==void 0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("p50")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Pe(O.p50DurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Exec count")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ge(O.execCount)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Total time")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Pe(O.totalDurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows read")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ge(O.rowsRead)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows written")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ge(O.rowsWritten)})]})]})]})]},ue)},"Ke"),e[142]=n,e[143]=a,e[144]=Be):Be=e[144],q=C.map(Be)}e[2]=n,e[3]=l,e[4]=r,e[5]=a,e[6]=h,e[7]=d,e[8]=g,e[9]=y,e[10]=q,e[11]=$,e[12]=c,e[13]=p,e[14]=f,e[15]=x}else h=e[6],d=e[7],g=e[8],y=e[9],q=e[10],$=e[11],c=e[12],p=e[13],f=e[14],x=e[15];if(g!==Symbol.for("react.early_return_sentinel"))return g;let k;e[145]!==y||e[146]!==q?(k=(0,t.jsx)("div",{className:y,children:q}),e[145]=y,e[146]=q,e[147]=k):k=e[147];let _;e[148]!==h||e[149]!==k?(_=(0,t.jsx)(h,{children:k}),e[148]=h,e[149]=k,e[150]=_):_=e[150];let N;e[151]!==d||e[152]!==_||e[153]!==$?(N=(0,t.jsxs)(d,{children:[$,_]}),e[151]=d,e[152]=_,e[153]=$,e[154]=N):N=e[154];let I;return e[155]!==N||e[156]!==c||e[157]!==p||e[158]!==f||e[159]!==x?(I=(0,t.jsxs)("div",{className:c,"data-testid":p,children:[f,x,N]}),e[155]=N,e[156]=c,e[157]=p,e[158]=f,e[159]=x,e[160]=I):I=e[160],I},"nr");function or(s){return Ve(s.avgDurationMs)==="critical"}o(or,"or");function cr(s){return Ve(s.avgDurationMs)==="warning"}o(cr,"cr");function dr(s){return Ve(s.avgDurationMs)==="good"}o(dr,"dr");var mr=["1m","5m","15m","1h"],ur=o(s=>new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ur"),hr=o(s=>s.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:ur(e.bucketMs)})),"fr"),gr=o(({shardKey:s=""})=>{let e=ge(),[l,a]=(0,j.useState)("15m"),r=De(Le.getQueryInsights,{range:l},{live:!0,shardKey:s}).data,u=hr(r?.buckets??[]);return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:mr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===l,className:mt("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",i===l&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${i}`,onClick:o(()=>{a(i)},"onClick"),type:"button",children:i},i))}),r?.capped===!0&&(0,t.jsx)(Ue,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),u.length===0?(0,t.jsx)(ht,{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.")}):(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),(0,t.jsx)(Ze,{height:140,width:"100%",children:(0,t.jsxs)(St,{data:u,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(yt,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),(0,t.jsx)(Ze,{height:140,width:"100%",children:(0,t.jsxs)(Nt,{data:u,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(vt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(ir,{queryStats:r?.entries??[]})]})},"hr"),fr=gt(Le.getMetrics),pr=o((s,e)=>s?e:"overview","pr"),Er=o(({initialShardKey:s})=>{let e=dt(),l=ge(),{queryShardKey:a,setShardKey:r,shardKey:u}=Mt(s),[i,n]=(0,j.useState)("overview"),[S,v]=(0,j.useState)([]),w=(0,j.useRef)(null),h=(0,j.useRef)(null),d=(0,j.useRef)(!0);(0,j.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let g=zt(a),{data:y,error:q,liveError:$}=De(Le.getMetrics,{},{live:!0,shardKey:a}),c=y??null;(0,j.useEffect)(()=>{if(y===void 0)return;qt(a);let F=y,D=w.current,P=h.current!==null&&h.current!==F.shard;if(h.current=F.shard,w.current=F.requests,P){v([]);return}D!==null&&F.requests>=D&&v(A=>[...A,F.requests-D].slice(-30))},[y,a]);let[p,f]=(0,j.useState)(null),[x,k]=(0,j.useState)(!1),_=o(async()=>{k(!0);let F=Lt(u,wt());try{let D=await Promise.all(F.map(async P=>{try{let A=await e.query(fr,{},ft(P));return{error:null,metrics:A,shard:P===""?A.shard:P}}catch(A){return{error:pt(A),metrics:null,shard:P===""?"__root__":P}}}));d.current&&f(D)}finally{d.current&&k(!1)}},"R"),N=p===null?null:Ft(p),I=c===null||c.requests===0?"\u2014":`${(c.errors/c.requests*100).toFixed(1)}%`,C=S.length>0?S.at(-1):0,T=c?At(c):{p90:0,p95:0},M=(0,j.useMemo)(()=>{if(!c||!("queryStats"in c))return;let F=c.queryStats;if(!(!F||!Array.isArray(F)))return Kt(F)},[c]),b=pr(M!==void 0,i),R=o(()=>{bt(_())},"I"),z=o(()=>{f(null)},"E"),L=o(()=>{n("overview")},"A"),K=o(()=>{n("query-insights")},"L");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(kt,{onChange:r,testId:"mt-shard-input",value:u}),(0,t.jsx)($t,{message:$,prefix:"mt"}),(0,t.jsx)(Ye,{"data-testid":"mt-aggregate",disabled:x,onClick:R,size:"sm",type:"button",variant:"secondary",children:l(x?"Aggregating\u2026":"All shards")}),p!==null&&(0,t.jsx)(Ye,{"data-testid":"mt-aggregate-clear",onClick:z,size:"sm",type:"button",variant:"ghost",children:l("Hide")}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:_t,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")})]}),q!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:q}),M!==void 0&&(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsx)("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:L,type:"button",children:l("Overview")}),(0,t.jsxs)("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:K,type:"button",children:[l("Query insights"),M.length>0&&(0,t.jsx)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:M.length})]})]}),b==="query-insights"&&M!==void 0&&(0,t.jsx)(gr,{shardKey:a}),b==="overview"&&c!==null&&(0,t.jsx)(sr,{currentDelta:C,errorRate:I,history:S,latencyPercentiles:T,metrics:c}),b==="overview"&&c===null&&null,b==="overview"&&(0,t.jsx)(er,{onOpenTrace:g,shardKey:a}),b==="overview"&&N!==null&&p!==null&&(0,t.jsx)(tr,{aggregate:N,shardResults:p})]})},"jr");export{Er as MetricsPanel};
1
+ import{a as me}from"./chunk-F7UC63UN.js";import{a as Ft,b as Lt,c as At,d as Kt}from"./chunk-TQCXJX4I.js";import{a as it}from"./chunk-PKCC4J5W.js";import{a as Ct,b as It,c as Tt,d as Rt,e as je}from"./chunk-YEBHHIAY.js";import{a as Ot}from"./chunk-RPQL45FL.js";import{a as zt}from"./chunk-DEJLINCJ.js";import"./chunk-4GTO7FL5.js";import"./chunk-I52I2DJG.js";import{e as _t}from"./chunk-UYEZR3BI.js";import"./chunk-TWTNWOJU.js";import{a as $t}from"./chunk-7QRRR3K6.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import{a as Ze,b as et,c as tt,d as vt,e as yt,f as rt,g as at,h as Nt,i as St}from"./chunk-XSLMHPP2.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import{a as Mt}from"./chunk-S3CRZLGS.js";import{a as kt}from"./chunk-IFLTA2OD.js";import{a as wt,b as qt}from"./chunk-OGUKYRFM.js";import"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as Ye}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as Ue}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import"./chunk-35DM4JJG.js";import{a as Le}from"./chunk-CXNZVJ3S.js";import{c as De}from"./chunk-ECQTVV2J.js";import{f as dt}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{a as ht}from"./chunk-FKVZRPV5.js";import{a as st,b as lt,c as nt,d as Ee,e as de,f as H}from"./chunk-HEAQVSNS.js";import{a as fe,b as Ae,c as Ke,d as ut,e as pe}from"./chunk-WUWBZPUK.js";import{d as ge,f as gt,g as ft,h as pt,i as xt,l as We,o as bt}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as o,d as Xe,e as Qt,f as Jt,g as Bt,i as mt}from"./chunk-YKXDMIHQ.js";var j=Xe(Qt(),1);var xe=Xe(Jt(),1);var t=Xe(Bt(),1);var Ht=/["\\\u0000-\u001F\uD800-\uDFFF]/,Dt=o(s=>Ht.test(s)?JSON.stringify(s):`"${s}"`,"ot"),ct=o(s=>{if(s===void 0)return"null";if(typeof s=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(typeof s=="number"){if(Number.isNaN(s))return"nan";if(s===1/0)return"inf";if(s===-1/0)return"-inf";if(Object.is(s,-0))return"-0"}if(typeof s=="string")return Dt(s);if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s)){let i="[";for(let n=0;n<s.length;n++)n>0&&(i+=","),i+=ct(s[n]);return i+"]"}let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let i=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${i} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}let l=s,a=Object.keys(l).sort(),r="{",u=!0;for(let i of a){let n=l[i];n!==void 0&&(u?u=!1:r+=",",r+=Dt(i),r+=":",r+=ct(n))}return r+"}"},"Ze"),jt=o((s,e,l)=>`${s}:${e}:${ct(l??{})}`,"ht"),Pt=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"gt"),Ut=o((s,e)=>Pt(s,e),"Jt"),Wt=o(s=>Pt(s.kind,s),"Vt"),ot=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"We"),Gt=o(s=>Array.isArray(s?.series)?s.series:[],"Gt"),Vt="FUNCTION_NOT_FOUND",Xt=o(s=>{let e=new Map;if(!Array.isArray(s?.series))return e;for(let l of s.series)e.set(jt(l.kind,l.name,l.attributes),l.points);return e},"Xt"),Yt={counter:"secondary",gauge:"default",histogram:"outline"},Zt=o(s=>{let e=(0,xe.c)(18),{name:l,onOpenTrace:a,traceId:r}=s,u=ge();if(r===void 0){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=d):d=e[0],d}let i;e[1]!==r?(i=r.slice(0,8),e[1]=r,e[2]=i):i=e[2];let n=i;if(a===void 0){let d=`mt-instrument-trace-${l}`,g;return e[3]!==n||e[4]!==d||e[5]!==r?(g=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":d,title:r,children:n}),e[3]=n,e[4]=d,e[5]=r,e[6]=g):g=e[6],g}let S=`mt-instrument-trace-${l}`,v;e[7]!==a||e[8]!==r?(v=o(()=>{a(r)},"y"),e[7]=a,e[8]=r,e[9]=v):v=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 h;return e[13]!==n||e[14]!==S||e[15]!==v||e[16]!==w?(h=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":S,onClick:v,title:w,type:"button",children:n}),e[13]=n,e[14]=S,e[15]=v,e[16]=w,e[17]=h):h=e[17],h},"Zt"),er=o(s=>{let e=(0,xe.c)(105),{onOpenTrace:l,shardKey:a}=s,r=ge(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u={},e[0]=u):u=e[0];let i;e[1]!==a?(i={live:!0,shardKey:a},e[1]=a,e[2]=i):i=e[2];let{data:n,error:S,errorSource:v}=De(Le.getMetricSeries,u,i),w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w={},e[3]=w):w=e[3];let h;e[4]!==a?(h={live:!0,shardKey:a},e[4]=a,e[5]=h):h=e[5];let{data:d}=De(Le.getMetricHistory,w,h),g,y,q,$,c,p,f,x,k,_,N,I,C;if(e[6]!==n||e[7]!==S||e[8]!==v||e[9]!==d||e[10]!==l||e[11]!==r){x=Symbol.for("react.early_return_sentinel");e:{let L=Gt(n),K=xt(v)===Vt;if(S!==null&&!K){let m;e[25]!==r?(m=r("Instruments"),e[25]=r,e[26]=m):m=e[26];let E;e[27]!==m?(E=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[27]=m,e[28]=E):E=e[28];let Q;e[29]!==S||e[30]!==r?(Q=r("Instruments unavailable: {error}",{error:S}),e[29]=S,e[30]=r,e[31]=Q):Q=e[31];let J;e[32]!==Q?(J=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:Q}),e[32]=Q,e[33]=J):J=e[33];let ce;e[34]!==E||e[35]!==J?(ce=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[E,J]}),e[34]=E,e[35]=J,e[36]=ce):ce=e[36],x=ce;break e}if(L.length===0){x=null;break e}let F=Xt(d),D;e[37]!==r?(D=o(m=>r(m==="counter"?"Counter":m==="gauge"?"Gauge":"Histogram"),"z"),e[37]=r,e[38]=D):D=e[38];let P=D;c="flex flex-col gap-2",p="mt-instruments";let A;e[39]!==r?(A=r("Instruments"),e[39]=r,e[40]=A):A=e[40],e[41]!==A?(f=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:A}),e[41]=A,e[42]=f):f=e[42],$=fe,C="overflow-hidden py-0",q=pe,I="px-0",y=st,_="mt-instruments-table";let U;e[43]!==r?(U=r("name"),e[43]=r,e[44]=U):U=e[44];let W;e[45]!==U?(W=(0,t.jsx)(de,{children:U}),e[45]=U,e[46]=W):W=e[46];let G;e[47]!==r?(G=r("kind"),e[47]=r,e[48]=G):G=e[48];let V;e[49]!==G?(V=(0,t.jsx)(de,{children:G}),e[49]=G,e[50]=V):V=e[50];let X;e[51]!==r?(X=r("value"),e[51]=r,e[52]=X):X=e[52];let Y;e[53]!==X?(Y=(0,t.jsx)(de,{className:"text-right",children:X}),e[53]=X,e[54]=Y):Y=e[54];let Z;e[55]!==r?(Z=r("count"),e[55]=r,e[56]=Z):Z=e[56];let ee;e[57]!==Z?(ee=(0,t.jsx)(de,{className:"text-right",children:Z}),e[57]=Z,e[58]=ee):ee=e[58];let te;e[59]!==r?(te=r("range"),e[59]=r,e[60]=te):te=e[60];let re;e[61]!==te?(re=(0,t.jsx)(de,{className:"text-right",children:te}),e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==r?(ae=r("trend"),e[63]=r,e[64]=ae):ae=e[64];let se;e[65]!==ae?(se=(0,t.jsx)(de,{children:ae}),e[65]=ae,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ne;e[69]!==le?(ne=(0,t.jsx)(de,{children:le}),e[69]=le,e[70]=ne):ne=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let oe;e[73]!==ie?(oe=(0,t.jsx)(de,{children:ie}),e[73]=ie,e[74]=oe):oe=e[74],e[75]!==W||e[76]!==V||e[77]!==Y||e[78]!==ee||e[79]!==re||e[80]!==se||e[81]!==ne||e[82]!==oe?(N=(0,t.jsx)(lt,{children:(0,t.jsxs)(Ee,{children:[W,V,Y,ee,re,se,ne,oe]})}),e[75]=W,e[76]=V,e[77]=Y,e[78]=ee,e[79]=re,e[80]=se,e[81]=ne,e[82]=oe,e[83]=N):N=e[83],g=nt,k=L.map(m=>{let E=Ot(m.attributes),Q=jt(m.kind,m.name,m.attributes),J=(F.get(Q)??[]).map(ce=>Ut(m.kind,ce));return(0,t.jsxs)(Ee,{"data-testid":`mt-instrument-${m.name}`,children:[(0,t.jsx)(H,{className:"font-mono text-xs",title:m.functionPath,children:m.name}),(0,t.jsx)(H,{children:(0,t.jsx)(Ue,{variant:Yt[m.kind],children:P(m.kind)})}),(0,t.jsx)(H,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${m.name}`,children:ot(Wt(m))}),(0,t.jsx)(H,{className:"text-right tabular-nums text-muted-foreground",children:m.count.toLocaleString()}),(0,t.jsx)(H,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:m.min===m.max?"\u2014":`${ot(m.min)}\u2013${ot(m.max)}`}),(0,t.jsx)(H,{children:J.length>=2?(0,t.jsx)(it,{ariaLabel:r("{name} trend",{name:m.name}),className:"h-6 w-24 text-foreground",series:J,testId:`mt-instrument-trend-${m.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(H,{className:"font-mono text-xs",children:(0,t.jsx)(Zt,{name:m.name,onOpenTrace:l,traceId:m.exemplarTraceId})}),(0,t.jsx)(H,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:E,children:E===""?"\u2014":E})]},Q)})}e[6]=n,e[7]=S,e[8]=v,e[9]=d,e[10]=l,e[11]=r,e[12]=g,e[13]=y,e[14]=q,e[15]=$,e[16]=c,e[17]=p,e[18]=f,e[19]=x,e[20]=k,e[21]=_,e[22]=N,e[23]=I,e[24]=C}else g=e[12],y=e[13],q=e[14],$=e[15],c=e[16],p=e[17],f=e[18],x=e[19],k=e[20],_=e[21],N=e[22],I=e[23],C=e[24];if(x!==Symbol.for("react.early_return_sentinel"))return x;let T;e[84]!==g||e[85]!==k?(T=(0,t.jsx)(g,{children:k}),e[84]=g,e[85]=k,e[86]=T):T=e[86];let M;e[87]!==y||e[88]!==T||e[89]!==_||e[90]!==N?(M=(0,t.jsxs)(y,{"data-testid":_,children:[N,T]}),e[87]=y,e[88]=T,e[89]=_,e[90]=N,e[91]=M):M=e[91];let b;e[92]!==q||e[93]!==M||e[94]!==I?(b=(0,t.jsx)(q,{className:I,children:M}),e[92]=q,e[93]=M,e[94]=I,e[95]=b):b=e[95];let R;e[96]!==$||e[97]!==b||e[98]!==C?(R=(0,t.jsx)($,{className:C,children:b}),e[96]=$,e[97]=b,e[98]=C,e[99]=R):R=e[99];let z;return e[100]!==c||e[101]!==p||e[102]!==f||e[103]!==R?(z=(0,t.jsxs)("section",{className:c,"data-testid":p,children:[f,R]}),e[100]=c,e[101]=p,e[102]=f,e[103]=R,e[104]=z):z=e[104],z},"er"),tr=o(s=>{let e=(0,xe.c)(74),{aggregate:l,shardResults:a}=s,r=ge(),u;e[0]!==r?(u=r("Shards"),e[0]=r,e[1]=u):u=e[1];let i;e[2]!==l.failed||e[3]!==l.reachable||e[4]!==r?(i=l.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:l.failed,reachable:l.reachable}):r("{reachable} reachable",{reachable:l.reachable}),e[2]=l.failed,e[3]=l.reachable,e[4]=r,e[5]=i):i=e[5];let n;e[6]!==u||e[7]!==i?(n=(0,t.jsx)(me,{label:u,testId:"mt-agg-shards",value:i}),e[6]=u,e[7]=i,e[8]=n):n=e[8];let S;e[9]!==r?(S=r("Total requests"),e[9]=r,e[10]=S):S=e[10];let v;e[11]!==l.totalRequests||e[12]!==S?(v=(0,t.jsx)(me,{label:S,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=S,e[13]=v):v=e[13];let w;e[14]!==r?(w=r("Total errors"),e[14]=r,e[15]=w):w=e[15];let h;e[16]!==l.totalErrors||e[17]!==w?(h=(0,t.jsx)(me,{label:w,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=w,e[18]=h):h=e[18];let d;e[19]!==r?(d=r("Total database size"),e[19]=r,e[20]=d):d=e[20];let g;e[21]!==l.totalDatabaseSize?(g=We(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=g):g=e[22];let y;e[23]!==d||e[24]!==g?(y=(0,t.jsx)(me,{label:d,testId:"mt-agg-db-size",value:g}),e[23]=d,e[24]=g,e[25]=y):y=e[25];let q;e[26]!==r?(q=r("Combined cache hit rate"),e[26]=r,e[27]=q):q=e[27];let $;e[28]!==l.hitRate||e[29]!==r?($=l.hitRate===null?r("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=r,e[30]=$):$=e[30];let c;e[31]!==q||e[32]!==$?(c=(0,t.jsx)(me,{label:q,testId:"mt-agg-cache",value:$}),e[31]=q,e[32]=$,e[33]=c):c=e[33];let p;e[34]!==y||e[35]!==c||e[36]!==n||e[37]!==v||e[38]!==h?(p=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,v,h,y,c]}),e[34]=y,e[35]=c,e[36]=n,e[37]=v,e[38]=h,e[39]=p):p=e[39];let f;e[40]!==r?(f=r("shard"),e[40]=r,e[41]=f):f=e[41];let x;e[42]!==f?(x=(0,t.jsx)(de,{children:f}),e[42]=f,e[43]=x):x=e[43];let k;e[44]!==r?(k=r("requests"),e[44]=r,e[45]=k):k=e[45];let _;e[46]!==k?(_=(0,t.jsx)(de,{children:k}),e[46]=k,e[47]=_):_=e[47];let N;e[48]!==r?(N=r("errors"),e[48]=r,e[49]=N):N=e[49];let I;e[50]!==N?(I=(0,t.jsx)(de,{children:N}),e[50]=N,e[51]=I):I=e[51];let C;e[52]!==r?(C=r("db size"),e[52]=r,e[53]=C):C=e[53];let T;e[54]!==C?(T=(0,t.jsx)(de,{children:C}),e[54]=C,e[55]=T):T=e[55];let M;e[56]!==x||e[57]!==_||e[58]!==I||e[59]!==T?(M=(0,t.jsx)(lt,{children:(0,t.jsxs)(Ee,{children:[x,_,I,T]})}),e[56]=x,e[57]=_,e[58]=I,e[59]=T,e[60]=M):M=e[60];let b;if(e[61]!==a||e[62]!==r){let K;e[64]!==r?(K=o(F=>(0,t.jsxs)(Ee,{"data-testid":`mt-agg-row-${F.shard}`,children:[(0,t.jsx)(H,{children:F.shard}),F.metrics===null?(0,t.jsx)(H,{className:"text-destructive",colSpan:3,children:F.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{className:"tabular-nums",children:F.metrics.requests}),(0,t.jsx)(H,{className:"tabular-nums",children:F.metrics.errors}),(0,t.jsx)(H,{className:"tabular-nums",children:We(F.metrics.databaseSize)})]})]},F.shard),"L"),e[64]=r,e[65]=K):K=e[65],b=a.map(K),e[61]=a,e[62]=r,e[63]=b}else b=e[63];let R;e[66]!==b?(R=(0,t.jsx)(nt,{children:b}),e[66]=b,e[67]=R):R=e[67];let z;e[68]!==M||e[69]!==R?(z=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(pe,{className:"px-0",children:(0,t.jsxs)(st,{"data-testid":"mt-agg-table",children:[M,R]})})}),e[68]=M,e[69]=R,e[70]=z):z=e[70];let L;return e[71]!==p||e[72]!==z?(L=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[p,z]}),e[71]=p,e[72]=z,e[73]=L):L=e[73],L},"tr"),rr=o(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return l>0?`${l.toString()}h ${a.toString()}m`:a>0?`${a.toString()}m ${r.toString()}s`:`${r.toString()}s`},"rr"),ar=o((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"sr"),Et=o(s=>s<=0?"\u2014":s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"ct"),sr=o(s=>{let e=(0,xe.c)(75),{currentDelta:l,errorRate:a,history:r,latencyPercentiles:u,metrics:i}=s,n=ge(),S;e[0]!==r||e[1]!==n?(S=r.length>=2?(0,t.jsx)(it,{ariaLabel:n("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:r,testId:"mt-sparkline"}):void 0,e[0]=r,e[1]=n,e[2]=S):S=e[2];let v;e[3]!==l||e[4]!==r.length||e[5]!==n?(v=r.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${l.toLocaleString()}`})," ",n("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:n("collecting samples\u2026")}),e[3]=l,e[4]=r.length,e[5]=n,e[6]=v):v=e[6];let w;e[7]!==n?(w=n("Requests"),e[7]=n,e[8]=w):w=e[8];let h;e[9]!==i.requests||e[10]!==S||e[11]!==v||e[12]!==w?(h=(0,t.jsx)(me,{chart:S,footer:v,label:w,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=S,e[11]=v,e[12]=w,e[13]=h):h=e[13];let d;e[14]!==a||e[15]!==n?(d=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=d):d=e[16];let g;e[17]!==n?(g=n("Errors"),e[17]=n,e[18]=g):g=e[18];let y;e[19]!==a||e[20]!==i.errors?(y=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=y):y=e[21];let q;e[22]!==d||e[23]!==g||e[24]!==y?(q=(0,t.jsx)(me,{footer:d,label:g,testId:"mt-errors",value:y}),e[22]=d,e[23]=g,e[24]=y,e[25]=q):q=e[25];let $;e[26]!==u.p90?($=u.p90>0?`P90 ${Et(u.p90)}`:void 0,e[26]=u.p90,e[27]=$):$=e[27];let c;e[28]!==n?(c=n("P95 latency"),e[28]=n,e[29]=c):c=e[29];let p;e[30]!==u.p95?(p=u.p95>0?Et(u.p95):"\u2014",e[30]=u.p95,e[31]=p):p=e[31];let f;e[32]!==c||e[33]!==p||e[34]!==$?(f=(0,t.jsx)(me,{footer:$,label:c,testId:"mt-p95",value:p}),e[32]=c,e[33]=p,e[34]=$,e[35]=f):f=e[35];let x;e[36]!==i.cache||e[37]!==n?(x=i.cache===null?void 0:`${i.cache.entries.toLocaleString()} ${n("cache entries")}`,e[36]=i.cache,e[37]=n,e[38]=x):x=e[38];let k;e[39]!==n?(k=n("Database size"),e[39]=n,e[40]=k):k=e[40];let _;e[41]!==i.databaseSize?(_=We(i.databaseSize),e[41]=i.databaseSize,e[42]=_):_=e[42];let N;e[43]!==x||e[44]!==k||e[45]!==_?(N=(0,t.jsx)(me,{footer:x,label:k,testId:"mt-db-size",value:_}),e[43]=x,e[44]=k,e[45]=_,e[46]=N):N=e[46];let I;e[47]!==n?(I=n("Shard"),e[47]=n,e[48]=I):I=e[48];let C;e[49]!==i.shard||e[50]!==I?(C=(0,t.jsx)(me,{label:I,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=I,e[51]=C):C=e[51];let T;e[52]!==n?(T=n("Uptime"),e[52]=n,e[53]=T):T=e[53];let M;e[54]!==i.uptimeMs?(M=rr(i.uptimeMs),e[54]=i.uptimeMs,e[55]=M):M=e[55];let b;e[56]!==T||e[57]!==M?(b=(0,t.jsx)(me,{label:T,testId:"mt-uptime",value:M}),e[56]=T,e[57]=M,e[58]=b):b=e[58];let R;e[59]!==n?(R=n("Cache hit rate"),e[59]=n,e[60]=R):R=e[60];let z;e[61]!==i.cache||e[62]!==n?(z=i.cache===null?n("no cache configured"):n("{rate} ({count} entries)",{count:i.cache.entries,rate:ar(i.cache.hits,i.cache.misses)}),e[61]=i.cache,e[62]=n,e[63]=z):z=e[63];let L;e[64]!==R||e[65]!==z?(L=(0,t.jsx)(me,{label:R,testId:"mt-cache",value:z}),e[64]=R,e[65]=z,e[66]=L):L=e[66];let K;return e[67]!==f||e[68]!==N||e[69]!==C||e[70]!==b||e[71]!==L||e[72]!==h||e[73]!==q?(K=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[h,q,f,N,C,b,L]}),e[67]=f,e[68]=N,e[69]=C,e[70]=b,e[71]=L,e[72]=h,e[73]=q,e[74]=K):K=e[74],K},"lr"),Ve=o(s=>s>=100?"critical":s>=50?"warning":"good","Ve"),Pe=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Ae"),Ge=o(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"He"),lr=o(s=>{let e=(0,xe.c)(3),{level:l}=s;if(l==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(Ue,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(l==="warning"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("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 a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("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]=a):a=e[2],a},"ar"),nr=o((s,e)=>{let l=[...s];return l.sort((a,r)=>{switch(e){case"avgTime":return r.avgDurationMs-a.avgDurationMs;case"execCount":return r.execCount-a.execCount;case"rowsRead":return r.rowsRead-a.rowsRead;default:return r.totalDurationMs-a.totalDurationMs}}),l},"ir"),ir=o(s=>{let e=(0,xe.c)(161),{queryStats:l}=s,a=ge(),[r,u]=(0,j.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,S]=(0,j.useState)(i),v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=o(C=>{C!==null&&u(C)},"y"),e[1]=v):v=e[1];let w=v,h,d,g,y,q,$,c,p,f,x;if(e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==a){g=Symbol.for("react.early_return_sentinel");e:{let C=nr(l,r),T;e[16]!==l?(T=l.filter(or),e[16]=l,e[17]=T):T=e[17];let M=T.length,b;e[18]!==l?(b=l.filter(cr),e[18]=l,e[19]=b):b=e[19];let R=b.length,z;e[20]!==l?(z=l.filter(dr),e[20]=l,e[21]=z):z=e[21];let L=z.length,K;e[22]===Symbol.for("react.memo_cache_sentinel")?(K=o(O=>{S(ue=>{let B=new Set(ue);return B.has(O)?B.delete(O):B.add(O),B})},"L"),e[22]=K):K=e[22];let F=K;if(l.length===0){let O;e[23]!==a?(O=a("No query insights yet"),e[23]=a,e[24]=O):O=e[24];let ue;e[25]!==O?(ue=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:O}),e[25]=O,e[26]=ue):ue=e[26];let B;e[27]!==a?(B=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=B):B=e[28];let he;e[29]!==B?(he=(0,t.jsx)("p",{className:"mt-1 text-sm",children:B}),e[29]=B,e[30]=he):he=e[30];let He;e[31]!==ue||e[32]!==he?(He=(0,t.jsx)(fe,{children:(0,t.jsx)(pe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ue,he]})})}),e[31]=ue,e[32]=he,e[33]=He):He=e[33],g=He;break e}c="space-y-4",p="qi-root";let D;e[34]!==a?(D=a("Critical queries"),e[34]=a,e[35]=D):D=e[35];let P;e[36]!==D?(P=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:D})}),e[36]=D,e[37]=P):P=e[37];let A;e[38]!==M?(A=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:M}),e[38]=M,e[39]=A):A=e[39];let U;e[40]!==a?(U=a(">100ms avg execution"),e[40]=a,e[41]=U):U=e[41];let W;e[42]!==U?(W=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:U}),e[42]=U,e[43]=W):W=e[43];let G;e[44]!==A||e[45]!==W?(G=(0,t.jsxs)(pe,{children:[A,W]}),e[44]=A,e[45]=W,e[46]=G):G=e[46];let V;e[47]!==P||e[48]!==G?(V=(0,t.jsxs)(fe,{children:[P,G]}),e[47]=P,e[48]=G,e[49]=V):V=e[49];let X;e[50]!==a?(X=a("Moderate queries"),e[50]=a,e[51]=X):X=e[51];let Y;e[52]!==X?(Y=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:X})}),e[52]=X,e[53]=Y):Y=e[53];let Z;e[54]!==R?(Z=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:R}),e[54]=R,e[55]=Z):Z=e[55];let ee;e[56]!==a?(ee=a("50\u2013100ms avg execution"),e[56]=a,e[57]=ee):ee=e[57];let te;e[58]!==ee?(te=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ee}),e[58]=ee,e[59]=te):te=e[59];let re;e[60]!==Z||e[61]!==te?(re=(0,t.jsxs)(pe,{children:[Z,te]}),e[60]=Z,e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==Y||e[64]!==re?(ae=(0,t.jsxs)(fe,{children:[Y,re]}),e[63]=Y,e[64]=re,e[65]=ae):ae=e[65];let se;e[66]!==a?(se=a("Fast queries"),e[66]=a,e[67]=se):se=e[67];let le;e[68]!==se?(le=(0,t.jsx)(Ae,{className:"pb-2",children:(0,t.jsx)(Ke,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ne;e[70]!==L?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:L}),e[70]=L,e[71]=ne):ne=e[71];let ie;e[72]!==a?(ie=a("<50ms avg execution"),e[72]=a,e[73]=ie):ie=e[73];let oe;e[74]!==ie?(oe=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=oe):oe=e[75];let m;e[76]!==ne||e[77]!==oe?(m=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=m):m=e[78];let E;e[79]!==le||e[80]!==m?(E=(0,t.jsxs)(fe,{children:[le,m]}),e[79]=le,e[80]=m,e[81]=E):E=e[81],e[82]!==V||e[83]!==ae||e[84]!==E?(f=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[V,ae,E]}),e[82]=V,e[83]=ae,e[84]=E,e[85]=f):f=e[85];let Q;e[86]!==a?(Q=a("Query leaderboard"),e[86]=a,e[87]=Q):Q=e[87];let J;e[88]!==Q?(J=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:Q}),e[88]=Q,e[89]=J):J=e[89];let ce;e[90]!==r||e[91]!==a?(ce=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=ce):ce=e[92];let be;e[93]!==ce?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:ce}),e[93]=ce,e[94]=be):be=e[94];let ve;e[95]!==J||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[J,be]}),e[95]=J,e[96]=be,e[97]=ve):ve=e[97];let ye;e[98]!==a?(ye=a("Sort by"),e[98]=a,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==a?(Se=a("Sort queries by"),e[102]=a,e[103]=Se):Se=e[103];let Qe;e[104]===Symbol.for("react.memo_cache_sentinel")?(Qe=(0,t.jsx)(It,{}),e[104]=Qe):Qe=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(Tt,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Qe}),e[105]=Se,e[106]=we):we=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let ke;e[109]!==qe?(ke=(0,t.jsx)(je,{value:"totalTime",children:qe}),e[109]=qe,e[110]=ke):ke=e[110];let Me;e[111]!==a?(Me=a("Avg time"),e[111]=a,e[112]=Me):Me=e[112];let $e;e[113]!==Me?($e=(0,t.jsx)(je,{value:"avgTime",children:Me}),e[113]=Me,e[114]=$e):$e=e[114];let _e;e[115]!==a?(_e=a("Execution count"),e[115]=a,e[116]=_e):_e=e[116];let Ce;e[117]!==_e?(Ce=(0,t.jsx)(je,{value:"execCount",children:_e}),e[117]=_e,e[118]=Ce):Ce=e[118];let Ie;e[119]!==a?(Ie=a("Rows read"),e[119]=a,e[120]=Ie):Ie=e[120];let Te;e[121]!==Ie?(Te=(0,t.jsx)(je,{value:"rowsRead",children:Ie}),e[121]=Ie,e[122]=Te):Te=e[122];let Re;e[123]!==ke||e[124]!==$e||e[125]!==Ce||e[126]!==Te?(Re=(0,t.jsxs)(Rt,{children:[ke,$e,Ce,Te]}),e[123]=ke,e[124]=$e,e[125]=Ce,e[126]=Te,e[127]=Re):Re=e[127];let Oe;e[128]!==r||e[129]!==we||e[130]!==Re?(Oe=(0,t.jsxs)(Ct,{onValueChange:w,value:r,children:[we,Re]}),e[128]=r,e[129]=we,e[130]=Re,e[131]=Oe):Oe=e[131];let ze;e[132]!==Ne||e[133]!==Oe?(ze=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,Oe]}),e[132]=Ne,e[133]=Oe,e[134]=ze):ze=e[134],e[135]!==ve||e[136]!==ze?(x=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,ze]}),e[135]=ve,e[136]=ze,e[137]=x):x=e[137],d=fe;let Fe;e[138]!==a?(Fe=a("Statements"),e[138]=a,e[139]=Fe):Fe=e[139];let Je;e[140]!==Fe?(Je=(0,t.jsx)(Ke,{children:Fe}),e[140]=Fe,e[141]=Je):Je=e[141],$=(0,t.jsxs)(Ae,{children:[Je,(0,t.jsx)(ut,{children:a("{count} tracked statements",{count:C.length})})]}),h=pe,y="space-y-2";let Be;e[142]!==n||e[143]!==a?(Be=o(O=>{let ue=O.normalizedSql,B=n.has(ue),he=Ve(O.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":B,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{F(ue)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(lr,{level:he}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:O.normalizedSql})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Pe(O.totalDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("total")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Pe(O.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),O.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Pe(O.p95DurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("p95")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ge(O.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),B&&(0,t.jsxs)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-2 text-sm font-medium",children:a("Full statement")}),(0,t.jsx)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:O.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[O.p50DurationMs!==void 0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("p50")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Pe(O.p50DurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Exec count")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ge(O.execCount)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Total time")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Pe(O.totalDurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows read")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ge(O.rowsRead)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows written")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ge(O.rowsWritten)})]})]})]})]},ue)},"Ke"),e[142]=n,e[143]=a,e[144]=Be):Be=e[144],q=C.map(Be)}e[2]=n,e[3]=l,e[4]=r,e[5]=a,e[6]=h,e[7]=d,e[8]=g,e[9]=y,e[10]=q,e[11]=$,e[12]=c,e[13]=p,e[14]=f,e[15]=x}else h=e[6],d=e[7],g=e[8],y=e[9],q=e[10],$=e[11],c=e[12],p=e[13],f=e[14],x=e[15];if(g!==Symbol.for("react.early_return_sentinel"))return g;let k;e[145]!==y||e[146]!==q?(k=(0,t.jsx)("div",{className:y,children:q}),e[145]=y,e[146]=q,e[147]=k):k=e[147];let _;e[148]!==h||e[149]!==k?(_=(0,t.jsx)(h,{children:k}),e[148]=h,e[149]=k,e[150]=_):_=e[150];let N;e[151]!==d||e[152]!==_||e[153]!==$?(N=(0,t.jsxs)(d,{children:[$,_]}),e[151]=d,e[152]=_,e[153]=$,e[154]=N):N=e[154];let I;return e[155]!==N||e[156]!==c||e[157]!==p||e[158]!==f||e[159]!==x?(I=(0,t.jsxs)("div",{className:c,"data-testid":p,children:[f,x,N]}),e[155]=N,e[156]=c,e[157]=p,e[158]=f,e[159]=x,e[160]=I):I=e[160],I},"nr");function or(s){return Ve(s.avgDurationMs)==="critical"}o(or,"or");function cr(s){return Ve(s.avgDurationMs)==="warning"}o(cr,"cr");function dr(s){return Ve(s.avgDurationMs)==="good"}o(dr,"dr");var mr=["1m","5m","15m","1h"],ur=o(s=>new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"ur"),hr=o(s=>s.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:ur(e.bucketMs)})),"fr"),gr=o(({shardKey:s=""})=>{let e=ge(),[l,a]=(0,j.useState)("15m"),r=De(Le.getQueryInsights,{range:l},{live:!0,shardKey:s}).data,u=hr(r?.buckets??[]);return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:mr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===l,className:mt("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",i===l&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${i}`,onClick:o(()=>{a(i)},"onClick"),type:"button",children:i},i))}),r?.capped===!0&&(0,t.jsx)(Ue,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),u.length===0?(0,t.jsx)(ht,{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.")}):(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),(0,t.jsx)(Ze,{height:140,width:"100%",children:(0,t.jsxs)(St,{data:u,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(yt,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),(0,t.jsx)(Ze,{height:140,width:"100%",children:(0,t.jsxs)(Nt,{data:u,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(vt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(ir,{queryStats:r?.entries??[]})]})},"hr"),fr=gt(Le.getMetrics),pr=o((s,e)=>s?e:"overview","pr"),Er=o(({initialShardKey:s})=>{let e=dt(),l=ge(),{queryShardKey:a,setShardKey:r,shardKey:u}=Mt(s),[i,n]=(0,j.useState)("overview"),[S,v]=(0,j.useState)([]),w=(0,j.useRef)(null),h=(0,j.useRef)(null),d=(0,j.useRef)(!0);(0,j.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let g=zt(a),{data:y,error:q,liveError:$}=De(Le.getMetrics,{},{live:!0,shardKey:a}),c=y??null;(0,j.useEffect)(()=>{if(y===void 0)return;qt(a);let F=y,D=w.current,P=h.current!==null&&h.current!==F.shard;if(h.current=F.shard,w.current=F.requests,P){v([]);return}D!==null&&F.requests>=D&&v(A=>[...A,F.requests-D].slice(-30))},[y,a]);let[p,f]=(0,j.useState)(null),[x,k]=(0,j.useState)(!1),_=o(async()=>{k(!0);let F=Lt(u,wt());try{let D=await Promise.all(F.map(async P=>{try{let A=await e.query(fr,{},ft(P));return{error:null,metrics:A,shard:P===""?A.shard:P}}catch(A){return{error:pt(A),metrics:null,shard:P===""?"__root__":P}}}));d.current&&f(D)}finally{d.current&&k(!1)}},"R"),N=p===null?null:Ft(p),I=c===null||c.requests===0?"\u2014":`${(c.errors/c.requests*100).toFixed(1)}%`,C=S.length>0?S.at(-1):0,T=c?At(c):{p90:0,p95:0},M=(0,j.useMemo)(()=>{if(!c||!("queryStats"in c))return;let F=c.queryStats;if(!(!F||!Array.isArray(F)))return Kt(F)},[c]),b=pr(M!==void 0,i),R=o(()=>{bt(_())},"I"),z=o(()=>{f(null)},"E"),L=o(()=>{n("overview")},"A"),K=o(()=>{n("query-insights")},"L");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(kt,{onChange:r,testId:"mt-shard-input",value:u}),(0,t.jsx)($t,{message:$,prefix:"mt"}),(0,t.jsx)(Ye,{"data-testid":"mt-aggregate",disabled:x,onClick:R,size:"sm",type:"button",variant:"secondary",children:l(x?"Aggregating\u2026":"All shards")}),p!==null&&(0,t.jsx)(Ye,{"data-testid":"mt-aggregate-clear",onClick:z,size:"sm",type:"button",variant:"ghost",children:l("Hide")}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:_t,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")})]}),q!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:q}),M!==void 0&&(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsx)("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:L,type:"button",children:l("Overview")}),(0,t.jsxs)("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:K,type:"button",children:[l("Query insights"),M.length>0&&(0,t.jsx)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:M.length})]})]}),b==="query-insights"&&M!==void 0&&(0,t.jsx)(gr,{shardKey:a}),b==="overview"&&c!==null&&(0,t.jsx)(sr,{currentDelta:C,errorRate:I,history:S,latencyPercentiles:T,metrics:c}),b==="overview"&&c===null&&null,b==="overview"&&(0,t.jsx)(er,{onOpenTrace:g,shardKey:a}),b==="overview"&&N!==null&&p!==null&&(0,t.jsx)(tr,{aggregate:N,shardResults:p})]})},"jr");export{Er as MetricsPanel};
@@ -1 +1 @@
1
- import{a as F,b as O}from"./chunk-BQK2C2Z4.js";import{a as B}from"./chunk-JURAVSE7.js";import{a as V}from"./chunk-CKTKI4IY.js";import{a as T}from"./chunk-TB5N24CM.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as L}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import"./chunk-XQS7KSHL.js";import{b as C}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as j}from"./chunk-5U6757U7.js";import"./chunk-PZ4QDWTI.js";import"./chunk-FUVCG23X.js";import"./chunk-F7JOSNAT.js";import{a as R}from"./chunk-DZGOHOOE.js";import{c as M}from"./chunk-4U5PYZLE.js";import"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as K}from"./chunk-UANVABQG.js";import{a as z,b as A,c as q,d as p,e as n,f as d}from"./chunk-L4EZAHCD.js";import{a as I,e as E}from"./chunk-IYWVSMAY.js";import{d as b,r as k}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as i,d as y,e as ee,g as te}from"./chunk-R5ZTCHCE.js";var o=y(ee(),1);var e=y(te(),1);var D=80,re=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>D?`${t.slice(0,D)}\u2026`:t},"te"),ae=41,J=480,H=5,ie=i((s,t)=>F(s,l=>{t(l.height>0?l:{height:J,width:l.width})}),"ae"),Ne=i(({initialShardKey:s})=>{let t=b(),{queryShardKey:l,setShardKey:P,shardKey:U}=V(s),[m,W]=(0,o.useState)(""),{data:f,error:g,errorSource:Z,isLoading:_,liveError:$}=M(R.getAuditLog,{},{live:!0,shardKey:l}),h=(0,o.useMemo)(()=>f?.entries??[],[f]),c=(0,o.useMemo)(()=>{let a=m.trim().toLowerCase();return a===""?h:h.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[h,m]),x=(0,o.useRef)(null),v=O({count:c.length,estimateSize:i(()=>ae,"estimateSize"),getScrollElement:i(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),G=v.getTotalSize(),N=u[0]?.start??0,w=G-(u.at(-1)?.end??0),Q={height:N},X={height:w},Y=i(a=>{W(a.target.value)},"_");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(T,{onChange:P,testId:"au-shard-input",value:U}),(0,e.jsx)(B,{message:$,prefix:"au"}),(0,e.jsx)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m})]}),g!==null&&(0,e.jsx)(j,{error:Z,testId:"au-error"}),g===null&&!_&&c.length===0&&(0,e.jsx)(K,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),c.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(z,{"data-testid":"au-table",children:[(0,e.jsx)(A,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(n,{children:t("time")}),(0,e.jsx)(n,{children:t("op")}),(0,e.jsx)(n,{children:t("table")}),(0,e.jsx)(n,{children:t("id")}),(0,e.jsx)(n,{children:t("detail")})]})}),(0,e.jsxs)(q,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Q})}),u.map(a=>{let r=c[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:k(r.ts,"\u2014")}),(0,e.jsx)(d,{children:(0,e.jsx)(C,{variant:"secondary",children:r.op})}),(0,e.jsx)(d,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})})]})]})})})]})},"Ne");export{Ne as AuditPanel};
1
+ import{a as F,b as O}from"./chunk-MNAASONZ.js";import{a as B}from"./chunk-7QRRR3K6.js";import{a as V}from"./chunk-S3CRZLGS.js";import{a as T}from"./chunk-IFLTA2OD.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{P as L}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import"./chunk-5GFSKIB2.js";import{b as C}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as j}from"./chunk-JAZCU2PP.js";import"./chunk-ULIQFBZU.js";import"./chunk-OOESPRIZ.js";import"./chunk-35DM4JJG.js";import{a as R}from"./chunk-CXNZVJ3S.js";import{c as M}from"./chunk-ECQTVV2J.js";import"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{a as K}from"./chunk-FKVZRPV5.js";import{a as z,b as A,c as q,d as p,e as n,f as d}from"./chunk-HEAQVSNS.js";import{a as I,e as E}from"./chunk-WUWBZPUK.js";import{d as b,r as k}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as i,d as y,e as ee,g as te}from"./chunk-YKXDMIHQ.js";var o=y(ee(),1);var e=y(te(),1);var D=80,re=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>D?`${t.slice(0,D)}\u2026`:t},"te"),ae=41,J=480,H=5,ie=i((s,t)=>F(s,l=>{t(l.height>0?l:{height:J,width:l.width})}),"ae"),Ne=i(({initialShardKey:s})=>{let t=b(),{queryShardKey:l,setShardKey:P,shardKey:U}=V(s),[m,W]=(0,o.useState)(""),{data:f,error:g,errorSource:Z,isLoading:_,liveError:$}=M(R.getAuditLog,{},{live:!0,shardKey:l}),h=(0,o.useMemo)(()=>f?.entries??[],[f]),c=(0,o.useMemo)(()=>{let a=m.trim().toLowerCase();return a===""?h:h.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[h,m]),x=(0,o.useRef)(null),v=O({count:c.length,estimateSize:i(()=>ae,"estimateSize"),getScrollElement:i(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),G=v.getTotalSize(),N=u[0]?.start??0,w=G-(u.at(-1)?.end??0),Q={height:N},X={height:w},Y=i(a=>{W(a.target.value)},"_");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(T,{onChange:P,testId:"au-shard-input",value:U}),(0,e.jsx)(B,{message:$,prefix:"au"}),(0,e.jsx)(L,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:m})]}),g!==null&&(0,e.jsx)(j,{error:Z,testId:"au-error"}),g===null&&!_&&c.length===0&&(0,e.jsx)(K,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),c.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(z,{"data-testid":"au-table",children:[(0,e.jsx)(A,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(n,{children:t("time")}),(0,e.jsx)(n,{children:t("op")}),(0,e.jsx)(n,{children:t("table")}),(0,e.jsx)(n,{children:t("id")}),(0,e.jsx)(n,{children:t("detail")})]})}),(0,e.jsxs)(q,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Q})}),u.map(a=>{let r=c[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:k(r.ts,"\u2014")}),(0,e.jsx)(d,{children:(0,e.jsx)(C,{variant:"secondary",children:r.op})}),(0,e.jsx)(d,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})})]})]})})})]})},"Ne");export{Ne as AuditPanel};
@@ -1 +1 @@
1
- import{a as w}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as y}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as C}from"./chunk-5U6757U7.js";import"./chunk-PZ4QDWTI.js";import"./chunk-FUVCG23X.js";import"./chunk-F7JOSNAT.js";import{a as h}from"./chunk-DZGOHOOE.js";import{c as u}from"./chunk-4U5PYZLE.js";import"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as T}from"./chunk-UANVABQG.js";import{a as S,b as K,c as $,d as g,e as i,f as o}from"./chunk-L4EZAHCD.js";import{a as A,e as k}from"./chunk-IYWVSMAY.js";import{d as M,r as D}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as d,d as z,e as ae,g as re}from"./chunk-R5ZTCHCE.js";var O=z(ae(),1);var e=z(re(),1);var Q="agent_threads",se="agent_messages",F="agent_run_queue",R=100,ne=250,ie={},oe={filters:[],limit:R,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:Q},l=d((s,t)=>{let r=s[t];return typeof r=="string"?r:void 0},"i"),j=d((s,t)=>{let r=s[t];return typeof r=="number"?r:void 0},"A"),L=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:r}=t;return typeof r=="number"?r:void 0},"U"),de=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(r=>r!==null&&typeof r=="object"?r.name:void 0).filter(r=>typeof r=="string"):[]},"ne"),le=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"oe"),ce=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"de"),Ne=d(({initialShardKey:s=""})=>{let t=M(),[r,I]=(0,O.useState)(void 0),{data:c}=u(h.listTables,ie,{live:!0,shardKey:s}),G=c!==void 0,p=Array.isArray(c)&&c.some(a=>a.name===Q),H=Array.isArray(c)&&c.some(a=>a.name===F),{data:_,error:J,errorSource:V,liveError:W}=u(h.readTablePage,oe,{enabled:p,live:!0,shardKey:s}),X={filters:[{column:"threadKey",operator:"eq",value:r??""}],limit:ne,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:se},{data:q}=u(h.readTablePage,{limit:R,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:F},{enabled:H,live:!0,shardKey:s}),{data:B,error:Y,errorSource:Z}=u(h.readTablePage,X,{enabled:p&&r!==void 0,live:!0,shardKey:s}),v=Array.isArray(_?.rows)?_.rows:[],ee=Array.isArray(q?.rows)?q.rows:[],E=d(a=>ee.filter(n=>l(n,"threadKey")===a).length,"w"),P=Array.isArray(B?.rows)?B.rows:[],U=v.find(a=>l(a,"key")===r),f;return G&&!p?f=(0,e.jsx)(T,{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")}):p&&v.length===0?f=(0,e.jsx)(T,{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")}):f=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(A,{className:"overflow-hidden py-0",children:(0,e.jsx)(k,{className:"px-0",children:(0,e.jsxs)(S,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(i,{children:t("Agent")}),(0,e.jsx)(i,{children:t("Key")}),(0,e.jsx)(i,{children:t("Status")}),(0,e.jsx)(i,{children:t("Queued")}),(0,e.jsx)(i,{children:t("Messages")}),(0,e.jsx)(i,{children:t("Tokens")}),(0,e.jsx)(i,{children:t("Updated")}),(0,e.jsx)(i,{"aria-label":t("Actions")})]})}),(0,e.jsx)($,{children:v.map(a=>{let n=l(a,"key")??"",m=l(a,"status"),x=L(a);return(0,e.jsxs)(g,{"data-active":n===r?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:l(a,"agent")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(o,{children:(0,e.jsx)(y,{"data-testid":`agents-thread-status-${n}`,variant:le(m),children:m??"\u2014"})}),(0,e.jsx)(o,{className:"tabular-nums",children:E(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(y,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:E(n)})}),(0,e.jsx)(o,{className:"tabular-nums",children:j(a,"messageCount")??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums text-muted-foreground",children:x??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:D(j(a,"updatedAt"),"\u2014")}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsx)(w,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{I(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),Y!==null&&(0,e.jsx)(C,{error:Z,testId:"agents-messages-error"}),r!==void 0&&(0,e.jsx)(A,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(k,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",r,U!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",L(U)??0," ",t("Tokens")]})]}),(0,e.jsx)(w,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{I(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),P.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(S,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(i,{children:t("Role")}),(0,e.jsx)(i,{children:t("Content")}),(0,e.jsx)(i,{children:t("Tool")}),(0,e.jsx)(i,{children:t("Approval")})]})}),(0,e.jsx)($,{children:P.map((a,n)=>{let m=l(a,"role")??"\u2014",x=de(a),te=l(a,"toolName"),b=l(a,"status"),N=j(a,"seq")??n;return(0,e.jsxs)(g,{"data-testid":`agents-message-${String(N)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:m}),(0,e.jsx)(o,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:l(a,"content")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:te??(x.length>0?x.join(", "):"\u2014")}),(0,e.jsx)(o,{className:"align-top",children:b===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(y,{"data-testid":`agents-message-approval-${String(N)}`,variant:ce(b),children:b})})]},l(a,"messageKey")??`${m}:${String(N)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[J!==null&&(0,e.jsx)(C,{error:V,testId:"agents-error"}),(0,e.jsx)("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.")}),W!==void 0&&(0,e.jsx)("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.")}),f]})},"be");export{Ne as default};
1
+ import{a as w}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as y}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as C}from"./chunk-JAZCU2PP.js";import"./chunk-ULIQFBZU.js";import"./chunk-OOESPRIZ.js";import"./chunk-35DM4JJG.js";import{a as h}from"./chunk-CXNZVJ3S.js";import{c as u}from"./chunk-ECQTVV2J.js";import"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{a as T}from"./chunk-FKVZRPV5.js";import{a as S,b as K,c as $,d as g,e as i,f as o}from"./chunk-HEAQVSNS.js";import{a as A,e as k}from"./chunk-WUWBZPUK.js";import{d as M,r as D}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as d,d as z,e as ae,g as re}from"./chunk-YKXDMIHQ.js";var O=z(ae(),1);var e=z(re(),1);var Q="agent_threads",se="agent_messages",F="agent_run_queue",R=100,ne=250,ie={},oe={filters:[],limit:R,offset:0,orderBy:{column:"updatedAt",direction:"desc"},skipCount:!0,table:Q},l=d((s,t)=>{let r=s[t];return typeof r=="string"?r:void 0},"i"),j=d((s,t)=>{let r=s[t];return typeof r=="number"?r:void 0},"A"),L=d(s=>{let{usage:t}=s;if(t===null||typeof t!="object")return;let{totalTokens:r}=t;return typeof r=="number"?r:void 0},"U"),de=d(s=>{let{toolCalls:t}=s;return Array.isArray(t)?t.map(r=>r!==null&&typeof r=="object"?r.name:void 0).filter(r=>typeof r=="string"):[]},"ne"),le=d(s=>{switch(s){case"awaiting_input":return"warning";case"cancelled":return"warning";case"error":return"destructive";case"running":return"info";default:return"outline"}},"oe"),ce=d(s=>{switch(s){case"approved":return"success";case"rejected":return"destructive";default:return"warning"}},"de"),Ne=d(({initialShardKey:s=""})=>{let t=M(),[r,I]=(0,O.useState)(void 0),{data:c}=u(h.listTables,ie,{live:!0,shardKey:s}),G=c!==void 0,p=Array.isArray(c)&&c.some(a=>a.name===Q),H=Array.isArray(c)&&c.some(a=>a.name===F),{data:_,error:J,errorSource:V,liveError:W}=u(h.readTablePage,oe,{enabled:p,live:!0,shardKey:s}),X={filters:[{column:"threadKey",operator:"eq",value:r??""}],limit:ne,offset:0,orderBy:{column:"seq",direction:"asc"},skipCount:!0,table:se},{data:q}=u(h.readTablePage,{limit:R,offset:0,orderBy:{column:"position",direction:"asc"},skipCount:!0,table:F},{enabled:H,live:!0,shardKey:s}),{data:B,error:Y,errorSource:Z}=u(h.readTablePage,X,{enabled:p&&r!==void 0,live:!0,shardKey:s}),v=Array.isArray(_?.rows)?_.rows:[],ee=Array.isArray(q?.rows)?q.rows:[],E=d(a=>ee.filter(n=>l(n,"threadKey")===a).length,"w"),P=Array.isArray(B?.rows)?B.rows:[],U=v.find(a=>l(a,"key")===r),f;return G&&!p?f=(0,e.jsx)(T,{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")}):p&&v.length===0?f=(0,e.jsx)(T,{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")}):f=(0,e.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,e.jsx)(A,{className:"overflow-hidden py-0",children:(0,e.jsx)(k,{className:"px-0",children:(0,e.jsxs)(S,{"data-testid":"agents-threads-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(i,{children:t("Agent")}),(0,e.jsx)(i,{children:t("Key")}),(0,e.jsx)(i,{children:t("Status")}),(0,e.jsx)(i,{children:t("Queued")}),(0,e.jsx)(i,{children:t("Messages")}),(0,e.jsx)(i,{children:t("Tokens")}),(0,e.jsx)(i,{children:t("Updated")}),(0,e.jsx)(i,{"aria-label":t("Actions")})]})}),(0,e.jsx)($,{children:v.map(a=>{let n=l(a,"key")??"",m=l(a,"status"),x=L(a);return(0,e.jsxs)(g,{"data-active":n===r?"":void 0,"data-testid":`agents-thread-${n}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:l(a,"agent")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:n}),(0,e.jsx)(o,{children:(0,e.jsx)(y,{"data-testid":`agents-thread-status-${n}`,variant:le(m),children:m??"\u2014"})}),(0,e.jsx)(o,{className:"tabular-nums",children:E(n)===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,e.jsx)(y,{"data-testid":`agents-thread-queued-${n}`,variant:"warning",children:E(n)})}),(0,e.jsx)(o,{className:"tabular-nums",children:j(a,"messageCount")??"\u2014"}),(0,e.jsx)(o,{className:"tabular-nums text-muted-foreground",children:x??"\u2014"}),(0,e.jsx)(o,{className:"text-muted-foreground tabular-nums",children:D(j(a,"updatedAt"),"\u2014")}),(0,e.jsx)(o,{className:"text-right",children:(0,e.jsx)(w,{"data-testid":`agents-thread-open-${n}`,onClick:d(()=>{I(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:t("Timeline")})})]},n)})})]})})}),Y!==null&&(0,e.jsx)(C,{error:Z,testId:"agents-messages-error"}),r!==void 0&&(0,e.jsx)(A,{className:"overflow-hidden py-0","data-testid":"agents-thread-detail",children:(0,e.jsxs)(k,{className:"flex flex-col gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t("Timeline")," \xB7 ",r,U!==void 0&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",t("Usage"),": ",L(U)??0," ",t("Tokens")]})]}),(0,e.jsx)(w,{"data-testid":"agents-thread-detail-close",onClick:d(()=>{I(void 0)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Close")})]}),P.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("This thread has no messages yet.")}):(0,e.jsxs)(S,{"data-testid":"agents-messages-table",children:[(0,e.jsx)(K,{children:(0,e.jsxs)(g,{children:[(0,e.jsx)(i,{children:t("Role")}),(0,e.jsx)(i,{children:t("Content")}),(0,e.jsx)(i,{children:t("Tool")}),(0,e.jsx)(i,{children:t("Approval")})]})}),(0,e.jsx)($,{children:P.map((a,n)=>{let m=l(a,"role")??"\u2014",x=de(a),te=l(a,"toolName"),b=l(a,"status"),N=j(a,"seq")??n;return(0,e.jsxs)(g,{"data-testid":`agents-message-${String(N)}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:m}),(0,e.jsx)(o,{className:"max-w-md font-mono text-xs whitespace-pre-wrap break-words",children:l(a,"content")??"\u2014"}),(0,e.jsx)(o,{className:"font-mono text-xs align-top text-muted-foreground",children:te??(x.length>0?x.join(", "):"\u2014")}),(0,e.jsx)(o,{className:"align-top",children:b===void 0?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,e.jsx)(y,{"data-testid":`agents-message-approval-${String(N)}`,variant:ce(b),children:b})})]},l(a,"messageKey")??`${m}:${String(N)}`)})})]})]})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-agents-panel",children:[J!==null&&(0,e.jsx)(C,{error:V,testId:"agents-error"}),(0,e.jsx)("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.")}),W!==void 0&&(0,e.jsx)("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.")}),f]})},"be");export{Ne as default};
@@ -1 +1 @@
1
- import{a as f}from"./chunk-IYWVSMAY.js";import{a as u,d as x,f as h,g as N}from"./chunk-R5ZTCHCE.js";var b=x(h(),1);var t=x(N(),1);var v=u(g=>{let e=(0,b.c)(16),{chart:c,footer:n,label:i,testId:m,value:p}=g,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i}),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==m||e[3]!==p?(a=(0,t.jsx)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":m,children:p}),e[2]=m,e[3]=p,e[4]=a):a=e[4];let s;e[5]!==c||e[6]!==a?(s=(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[a,c]}),e[5]=c,e[6]=a,e[7]=s):s=e[7];let l;e[8]!==r||e[9]!==s?(l=(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[r,s]}),e[8]=r,e[9]=s,e[10]=l):l=e[10];let o;e[11]!==n?(o=n!=null&&(0,t.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:n}),e[11]=n,e[12]=o):o=e[12];let d;return e[13]!==l||e[14]!==o?(d=(0,t.jsxs)(f,{className:"justify-between gap-0 py-0",children:[l,o]}),e[13]=l,e[14]=o,e[15]=d):d=e[15],d},"j");export{v as a};
1
+ import{a as f}from"./chunk-WUWBZPUK.js";import{a as u,d as x,f as h,g as N}from"./chunk-YKXDMIHQ.js";var b=x(h(),1);var t=x(N(),1);var v=u(g=>{let e=(0,b.c)(16),{chart:c,footer:n,label:i,testId:m,value:p}=g,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i}),e[0]=i,e[1]=r):r=e[1];let a;e[2]!==m||e[3]!==p?(a=(0,t.jsx)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":m,children:p}),e[2]=m,e[3]=p,e[4]=a):a=e[4];let s;e[5]!==c||e[6]!==a?(s=(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[a,c]}),e[5]=c,e[6]=a,e[7]=s):s=e[7];let l;e[8]!==r||e[9]!==s?(l=(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[r,s]}),e[8]=r,e[9]=s,e[10]=l):l=e[10];let o;e[11]!==n?(o=n!=null&&(0,t.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:n}),e[11]=n,e[12]=o):o=e[12];let d;return e[13]!==l||e[14]!==o?(d=(0,t.jsxs)(f,{className:"justify-between gap-0 py-0",children:[l,o]}),e[13]=l,e[14]=o,e[15]=d):d=e[15],d},"j");export{v as a};