@lunora/studio 1.0.0-alpha.39 → 1.0.0-alpha.390

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 (491) hide show
  1. package/LICENSE.md +201 -104
  2. package/README.md +7 -7
  3. package/dist/index.d.mts +1647 -0
  4. package/dist/index.d.ts +1039 -809
  5. package/dist/index.mjs +1 -0
  6. package/dist/mount.d.mts +23 -0
  7. package/dist/mount.d.ts +13 -11
  8. package/dist/mount.mjs +1 -0
  9. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
  10. package/dist/packem_chunks/ApiTab.mjs +1 -0
  11. package/dist/packem_chunks/AuditPanel.mjs +1 -0
  12. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
  13. package/dist/packem_chunks/ExportImportPanel.mjs +10 -0
  14. package/dist/packem_chunks/FileBrowser.mjs +4 -0
  15. package/dist/packem_chunks/FunctionRunner.mjs +1 -0
  16. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
  17. package/dist/packem_chunks/HealthPanel.mjs +1 -0
  18. package/dist/packem_chunks/InsightsPanel.mjs +1 -0
  19. package/dist/packem_chunks/LogsPanel.mjs +1 -0
  20. package/dist/packem_chunks/MailPanel.mjs +2 -0
  21. package/dist/packem_chunks/MetricsPanel.mjs +1 -0
  22. package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
  23. package/dist/packem_chunks/PitrPanel.mjs +1 -0
  24. package/dist/packem_chunks/SchemaViewer.mjs +1 -0
  25. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
  26. package/dist/packem_chunks/SettingsPanel.mjs +1 -0
  27. package/dist/packem_chunks/SqlEditorPanel.mjs +26 -0
  28. package/dist/packem_chunks/TableEditor.mjs +1 -0
  29. package/dist/packem_chunks/agents-panel.mjs +1 -0
  30. package/dist/packem_chunks/ai-knowledge.mjs +1 -0
  31. package/dist/packem_chunks/ai-usage-panel.mjs +1 -0
  32. package/dist/packem_chunks/analytics-panel.mjs +1 -0
  33. package/dist/packem_chunks/architecture-panel.mjs +1 -0
  34. package/dist/packem_chunks/assistant-panel.mjs +3 -0
  35. package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
  36. package/dist/packem_chunks/auth-config-panel.mjs +1 -0
  37. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
  38. package/dist/packem_chunks/containers-panel.mjs +1 -0
  39. package/dist/packem_chunks/dashboards-panel.mjs +1 -0
  40. package/dist/packem_chunks/evals-panel.mjs +1 -0
  41. package/dist/packem_chunks/fanout-panel.mjs +1 -0
  42. package/dist/packem_chunks/flags-panel.mjs +1 -0
  43. package/dist/packem_chunks/issues-panel.mjs +1 -0
  44. package/dist/packem_chunks/kv-browser.mjs +1 -0
  45. package/dist/packem_chunks/log-drains-panel.mjs +4 -0
  46. package/dist/packem_chunks/migrations-route.mjs +1 -0
  47. package/dist/packem_chunks/organizations-panel.mjs +1 -0
  48. package/dist/packem_chunks/payments-panel.mjs +1 -0
  49. package/dist/packem_chunks/permissions-panel.mjs +1 -0
  50. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -0
  51. package/dist/packem_chunks/queues-panel.mjs +1 -0
  52. package/dist/packem_chunks/reactors-panel.mjs +1 -0
  53. package/dist/packem_chunks/rls-panel.mjs +1 -0
  54. package/dist/packem_chunks/schedule-panel.mjs +1 -0
  55. package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
  56. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  57. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  58. package/dist/packem_chunks/theme-indicator.mjs +1 -0
  59. package/dist/packem_chunks/traces-panel.mjs +1 -0
  60. package/dist/packem_chunks/users-panel.mjs +1 -0
  61. package/dist/packem_chunks/vector-browser.mjs +1 -0
  62. package/dist/packem_chunks/workflows-panel.mjs +1 -0
  63. package/dist/packem_shared/ADMIN_FUNCTIONS-DAHZ35kM.mjs +1 -0
  64. package/dist/packem_shared/ApiDocsPanel-CgjWqkBr.mjs +2 -0
  65. package/dist/packem_shared/ApiReferencePanel-DDvLw7c1.mjs +1 -0
  66. package/dist/packem_shared/CommandPalette-BjHFgNA6.mjs +1 -0
  67. package/dist/packem_shared/ConfirmButton-CIXYF6Mg.mjs +1 -0
  68. package/dist/packem_shared/ConnectionBadge-BfcoN-VE.mjs +1 -0
  69. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-jK7srdI4.mjs +1 -0
  70. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  71. package/dist/packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs +1 -0
  72. package/dist/packem_shared/DataBrowser-Dp8ayK1S.mjs +4 -0
  73. package/dist/packem_shared/DataFilters--ocFTVT2.mjs +1 -0
  74. package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
  75. package/dist/packem_shared/GlobalDataBrowser-VehUMwUK.mjs +1 -0
  76. package/dist/packem_shared/HomePanel-D5-wWLAj.mjs +1 -0
  77. package/dist/packem_shared/MigrationsPanel-CTd2YSSk.mjs +1 -0
  78. package/dist/packem_shared/OpenRpcReferencePanel-dXFl95w8.mjs +1 -0
  79. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
  80. package/dist/packem_shared/ScheduledJobs-DPQHuiy6.mjs +1 -0
  81. package/dist/packem_shared/ShardInput-CoySruKZ.mjs +1 -0
  82. package/dist/packem_shared/Studio-CrfDOmdv.mjs +1 -0
  83. package/dist/packem_shared/StudioApp-DKBDIF7N.mjs +1 -0
  84. package/dist/packem_shared/StudioI18nProvider-CGXCPnQn.mjs +1 -0
  85. package/dist/packem_shared/advisor-view-C6C3kmZj.mjs +5 -0
  86. package/dist/packem_shared/aggregateMetrics-DKFJc-o5.mjs +1 -0
  87. package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
  88. package/dist/packem_shared/app.d-QqDN78r1.d.mts +374 -0
  89. package/dist/packem_shared/app.d-QqDN78r1.d.ts +374 -0
  90. package/dist/packem_shared/assistant-provider-b2GtJb5K.mjs +1 -0
  91. package/dist/packem_shared/assistant-reason-D6EwMCxT.mjs +1 -0
  92. package/dist/packem_shared/auth-pager-DW77WeZw.mjs +1 -0
  93. package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
  94. package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
  95. package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
  96. package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
  97. package/dist/packem_shared/card-By2O8ULa.mjs +1 -0
  98. package/dist/packem_shared/cf-links-BPy1pJRO.mjs +1 -0
  99. package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
  100. package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
  101. package/dist/packem_shared/data-grid-GQLHcpMI.mjs +1 -0
  102. package/dist/packem_shared/data-view-params-C-_G-biH.mjs +1 -0
  103. package/dist/packem_shared/diagram-export-panel-miFPsocM.mjs +2 -0
  104. package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
  105. package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
  106. package/dist/packem_shared/error-alert-BxCd81tw.mjs +6 -0
  107. package/dist/packem_shared/grid-features-Cdy2nWxA.mjs +6 -0
  108. package/dist/packem_shared/grid-pagination-DY2erU65.mjs +1 -0
  109. package/dist/packem_shared/home-panel-BlvQ0xK2.mjs +3 -0
  110. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  111. package/dist/packem_shared/internal-BT5tH08j.mjs +2 -0
  112. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  113. package/dist/packem_shared/live-status-D1GasNsH.mjs +1 -0
  114. package/dist/packem_shared/log-fields-CV-9O0nh.mjs +8 -0
  115. package/dist/packem_shared/log-line-BmYn49u1.mjs +1 -0
  116. package/dist/packem_shared/metrics-format-1sNGG47R.mjs +1 -0
  117. package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
  118. package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
  119. package/dist/packem_shared/recording-client-D_-eNapT.mjs +1 -0
  120. package/dist/packem_shared/reference-view-CRtrtDMy.mjs +13 -0
  121. package/dist/packem_shared/schema-diagram-Dbs7-jSJ.mjs +2 -0
  122. package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
  123. package/dist/packem_shared/select-DPyS18Vy.mjs +2 -0
  124. package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
  125. package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
  126. package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
  127. package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
  128. package/dist/packem_shared/sql-result-table-BuOHHoFG.mjs +1 -0
  129. package/dist/packem_shared/stat-card-BAv73QtB.mjs +1 -0
  130. package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
  131. package/dist/packem_shared/studio-CwelGawN.mjs +2 -0
  132. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  133. package/dist/packem_shared/table-list-sidebar-Cw7ll9yK.mjs +1 -0
  134. package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
  135. package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
  136. package/dist/packem_shared/use-admin-query-DMnTt_hg.mjs +1 -0
  137. package/dist/packem_shared/use-admin-spec-Cokw73Ks.mjs +1 -0
  138. package/dist/packem_shared/use-assistant-rpc-DLsuqTPB.mjs +1 -0
  139. package/dist/packem_shared/use-async-submit-CBFJevkc.mjs +1 -0
  140. package/dist/packem_shared/use-auth-config-xzSMjhOV.mjs +1 -0
  141. package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
  142. package/dist/packem_shared/use-open-trace-trRfFb77.mjs +1 -0
  143. package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
  144. package/dist/packem_shared/use-studio-client-DCA50tF2.mjs +1 -0
  145. package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
  146. package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
  147. package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
  148. package/dist/standalone/chunk-23MMGFHI.js +1 -0
  149. package/dist/standalone/chunk-2CDROYSG.js +1 -0
  150. package/dist/standalone/chunk-2D4WBSDO.js +3 -0
  151. package/dist/standalone/chunk-2KTN53PK.js +1 -0
  152. package/dist/standalone/chunk-2M37OAK3.js +1 -0
  153. package/dist/standalone/chunk-2NUCBQFU.js +1 -0
  154. package/dist/standalone/chunk-2OSZRVNW.js +1 -0
  155. package/dist/standalone/chunk-2YDK4MZM.js +1 -0
  156. package/dist/standalone/chunk-2ZJJH4YN.js +33 -0
  157. package/dist/standalone/chunk-375GZTYC.js +14 -0
  158. package/dist/standalone/chunk-3OVQC66W.js +1 -0
  159. package/dist/standalone/chunk-3WYPRZY3.js +1 -0
  160. package/dist/standalone/chunk-3YCWRKSW.js +1 -0
  161. package/dist/standalone/chunk-4AG356VE.js +1 -0
  162. package/dist/standalone/chunk-4KPATTV6.js +1 -0
  163. package/dist/standalone/chunk-4MFQ4XEJ.js +1 -0
  164. package/dist/standalone/chunk-4SY2N2RS.js +1 -0
  165. package/dist/standalone/chunk-4YVCKOYF.js +1 -0
  166. package/dist/standalone/chunk-5EIGSLIK.js +1 -0
  167. package/dist/standalone/chunk-5PEAXTYQ.js +1 -0
  168. package/dist/standalone/chunk-6K4F727K.js +1 -0
  169. package/dist/standalone/chunk-7ASIMMZY.js +1 -0
  170. package/dist/standalone/chunk-7WGZSDRS.js +2 -0
  171. package/dist/standalone/chunk-A6TVTNKO.js +1 -0
  172. package/dist/standalone/chunk-ADABTCDI.js +1 -0
  173. package/dist/standalone/chunk-ADS4BJ7K.js +1 -0
  174. package/dist/standalone/chunk-AFLNQEZ5.js +1 -0
  175. package/dist/standalone/chunk-APCHI5CD.js +1 -0
  176. package/dist/standalone/chunk-AQG5OGO4.js +5 -0
  177. package/dist/standalone/chunk-ATBPQT7F.js +1 -0
  178. package/dist/standalone/chunk-AXB32N5O.js +1 -0
  179. package/dist/standalone/chunk-AXDXIMCN.js +1 -0
  180. package/dist/standalone/chunk-BHUWAGFN.js +1 -0
  181. package/dist/standalone/chunk-BRPLE2Z6.js +4 -0
  182. package/dist/standalone/chunk-BU5VWXRR.js +1 -0
  183. package/dist/standalone/chunk-BWBECJFT.js +1 -0
  184. package/dist/standalone/chunk-BWHVY6L6.js +1 -0
  185. package/dist/standalone/chunk-CBTPJPCZ.js +1 -0
  186. package/dist/standalone/chunk-CFQQHZYU.js +1 -0
  187. package/dist/standalone/chunk-CL3JOU6F.js +1 -0
  188. package/dist/standalone/chunk-CO6R6GCX.js +1 -0
  189. package/dist/standalone/chunk-CP3LCFFM.js +8 -0
  190. package/dist/standalone/chunk-CQDENTSP.js +1 -0
  191. package/dist/standalone/chunk-CVJDEN5L.js +1 -0
  192. package/dist/standalone/chunk-CVSIFPI5.js +1 -0
  193. package/dist/standalone/chunk-CXXCVBMK.js +1 -0
  194. package/dist/standalone/chunk-CY45AO5T.js +1 -0
  195. package/dist/standalone/chunk-DA2CAFXI.js +1 -0
  196. package/dist/standalone/chunk-DRHZZ7IN.js +1 -0
  197. package/dist/standalone/chunk-DZV6YFWZ.js +1 -0
  198. package/dist/standalone/chunk-EDL46BPM.js +1 -0
  199. package/dist/standalone/chunk-EKXAE4PS.js +1 -0
  200. package/dist/standalone/chunk-ELPLRD4S.js +1 -0
  201. package/dist/standalone/chunk-EMZ7RPR3.js +4 -0
  202. package/dist/standalone/chunk-EOFWXI3T.js +1 -0
  203. package/dist/standalone/chunk-ERUKFS3I.js +1 -0
  204. package/dist/standalone/chunk-EYSF4DHD.js +1 -0
  205. package/dist/standalone/chunk-EZMAQE3T.js +59 -0
  206. package/dist/standalone/chunk-FKAOFBS3.js +1 -0
  207. package/dist/standalone/chunk-FWM5Z6CH.js +1 -0
  208. package/dist/standalone/chunk-FYAUOSTX.js +1 -0
  209. package/dist/standalone/chunk-H6VTIXVB.js +1 -0
  210. package/dist/standalone/chunk-HCK62XWB.js +1 -0
  211. package/dist/standalone/chunk-HJOXP6C3.js +2 -0
  212. package/dist/standalone/chunk-HLBZ7OAO.js +10 -0
  213. package/dist/standalone/chunk-HMMALUXM.js +1 -0
  214. package/dist/standalone/chunk-HUL247LG.js +1 -0
  215. package/dist/standalone/chunk-I6YVDNKQ.js +1 -0
  216. package/dist/standalone/chunk-IL64HWFW.js +1 -0
  217. package/dist/standalone/chunk-IQ5CIBXJ.js +1 -0
  218. package/dist/standalone/chunk-IXCSVK2Z.js +3 -0
  219. package/dist/standalone/chunk-JNWK5MJC.js +1 -0
  220. package/dist/standalone/chunk-JQBVRWFN.js +1 -0
  221. package/dist/standalone/chunk-JZN3MNJX.js +6 -0
  222. package/dist/standalone/chunk-K2LXQ3LS.js +1 -0
  223. package/dist/standalone/chunk-K5W5C237.js +1 -0
  224. package/dist/standalone/chunk-KGQPMSNY.js +1 -0
  225. package/dist/standalone/chunk-KIQ34774.js +1 -0
  226. package/dist/standalone/chunk-KZXSJF7K.js +1 -0
  227. package/dist/standalone/chunk-L27FKJTG.js +1 -0
  228. package/dist/standalone/chunk-L6VJTINV.js +1 -0
  229. package/dist/standalone/chunk-L7TFQUD7.js +1 -0
  230. package/dist/standalone/chunk-LJLNIVUA.js +8 -0
  231. package/dist/standalone/chunk-LLD7TMBV.js +1 -0
  232. package/dist/standalone/chunk-LLSK6QBX.js +1 -0
  233. package/dist/standalone/chunk-LMCBMC2V.js +1 -0
  234. package/dist/standalone/chunk-LOEVTOKP.js +6 -0
  235. package/dist/standalone/chunk-LRUYEVHH.js +1 -0
  236. package/dist/standalone/chunk-LYVYUTQY.js +1 -0
  237. package/dist/standalone/chunk-LYWT6GTX.js +1 -0
  238. package/dist/standalone/chunk-MHZNDDGI.js +1 -0
  239. package/dist/standalone/chunk-MNN3YCKF.js +1 -0
  240. package/dist/standalone/chunk-N7FOBAV3.js +1 -0
  241. package/dist/standalone/chunk-NAGIOR23.js +1 -0
  242. package/dist/standalone/chunk-NFI2TNKU.js +1 -0
  243. package/dist/standalone/chunk-NP6CBOPK.js +1 -0
  244. package/dist/standalone/chunk-O5QATFN3.js +159 -0
  245. package/dist/standalone/chunk-O66HDCZT.js +1 -0
  246. package/dist/standalone/chunk-ODEIAS3V.js +1 -0
  247. package/dist/standalone/chunk-OJR7BDKC.js +1 -0
  248. package/dist/standalone/chunk-OQTMT64P.js +5 -0
  249. package/dist/standalone/chunk-OWCTA7GY.js +1 -0
  250. package/dist/standalone/chunk-OWRWDDJT.js +1 -0
  251. package/dist/standalone/chunk-OZID3UYF.js +1 -0
  252. package/dist/standalone/chunk-P3ML7HGE.js +1 -0
  253. package/dist/standalone/chunk-PBXRUYD3.js +1 -0
  254. package/dist/standalone/chunk-PDBW6GTJ.js +1 -0
  255. package/dist/standalone/chunk-QF743FSL.js +1 -0
  256. package/dist/standalone/chunk-QFN62JQJ.js +7 -0
  257. package/dist/standalone/chunk-QHVUXMRV.js +1 -0
  258. package/dist/standalone/chunk-QLZGKBOW.js +1 -0
  259. package/dist/standalone/chunk-QTWNCDLK.js +1 -0
  260. package/dist/standalone/chunk-R3RIZDUS.js +1 -0
  261. package/dist/standalone/chunk-R6NJ4ER6.js +1 -0
  262. package/dist/standalone/chunk-RIAOZECW.js +1 -0
  263. package/dist/standalone/chunk-RJJRUUTE.js +1 -0
  264. package/dist/standalone/chunk-SCTYLLJT.js +1 -0
  265. package/dist/standalone/chunk-SGIEXE5J.js +1 -0
  266. package/dist/standalone/chunk-T7UKRA6J.js +1 -0
  267. package/dist/standalone/chunk-U5UEDY4E.js +1 -0
  268. package/dist/standalone/chunk-U7NVTULW.js +1 -0
  269. package/dist/standalone/chunk-UFS6UP4Z.js +1 -0
  270. package/dist/standalone/chunk-UL5XVKGR.js +1 -0
  271. package/dist/standalone/chunk-V3DOKU22.js +1 -0
  272. package/dist/standalone/chunk-V4B7ZPEG.js +1 -0
  273. package/dist/standalone/chunk-V5TGDG6U.js +1 -0
  274. package/dist/standalone/chunk-VQQEDEHH.js +1 -0
  275. package/dist/standalone/chunk-W5BTAOHO.js +1 -0
  276. package/dist/standalone/chunk-W7CLOQOU.js +1 -0
  277. package/dist/standalone/chunk-WEPANQGT.js +1 -0
  278. package/dist/standalone/chunk-WXZ334CL.js +1 -0
  279. package/dist/standalone/chunk-XV2XEUUB.js +1 -0
  280. package/dist/standalone/chunk-Y2AKO63C.js +31 -0
  281. package/dist/standalone/{chunk-BJGBHGK3.js → chunk-Y2YLTUMD.js} +1 -1
  282. package/dist/standalone/chunk-Y5QMX4YG.js +1 -0
  283. package/dist/standalone/chunk-Y6OVSHPH.js +1 -0
  284. package/dist/standalone/chunk-YLC2ZYCL.js +1 -0
  285. package/dist/standalone/chunk-YNCZVYCO.js +1 -0
  286. package/dist/standalone/chunk-YYJGL32M.js +1 -0
  287. package/dist/standalone/chunk-ZADOHFZB.js +3 -0
  288. package/dist/standalone/chunk-ZJIYJZ6F.js +1 -0
  289. package/dist/standalone/chunk-ZP453BM4.js +1 -0
  290. package/dist/standalone/chunk-ZPQBVYNN.js +1 -0
  291. package/dist/standalone/studio.js +9 -214
  292. package/dist/styles.css +2 -2
  293. package/package.json +28 -23
  294. package/dist/index.js +0 -41
  295. package/dist/mount.js +0 -27
  296. package/dist/packem_chunks/ApiTab.js +0 -251
  297. package/dist/packem_chunks/AuditPanel.js +0 -200
  298. package/dist/packem_chunks/ExportImportPanel.js +0 -198
  299. package/dist/packem_chunks/FileBrowser.js +0 -2932
  300. package/dist/packem_chunks/FunctionRunner.js +0 -343
  301. package/dist/packem_chunks/FunctionStatsPanel.js +0 -377
  302. package/dist/packem_chunks/HealthPanel.js +0 -648
  303. package/dist/packem_chunks/InsightsPanel.js +0 -462
  304. package/dist/packem_chunks/LogsPanel.js +0 -827
  305. package/dist/packem_chunks/MailPanel.js +0 -353
  306. package/dist/packem_chunks/MetricsPanel.js +0 -1344
  307. package/dist/packem_chunks/MigrationsPanel.js +0 -239
  308. package/dist/packem_chunks/PitrPanel.js +0 -252
  309. package/dist/packem_chunks/SchemaViewer.js +0 -2513
  310. package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -95
  311. package/dist/packem_chunks/SettingsPanel.js +0 -391
  312. package/dist/packem_chunks/SqlEditorPanel.js +0 -2333
  313. package/dist/packem_chunks/TableEditor.js +0 -313
  314. package/dist/packem_chunks/analytics-panel.js +0 -261
  315. package/dist/packem_chunks/auth-config-panel.js +0 -365
  316. package/dist/packem_chunks/auth-sessions-panel.js +0 -175
  317. package/dist/packem_chunks/containers-panel.js +0 -247
  318. package/dist/packem_chunks/dashboards-panel.js +0 -780
  319. package/dist/packem_chunks/fanout-panel.js +0 -482
  320. package/dist/packem_chunks/flags-panel.js +0 -176
  321. package/dist/packem_chunks/kv-browser.js +0 -1896
  322. package/dist/packem_chunks/log-drains-panel.js +0 -273
  323. package/dist/packem_chunks/organizations-panel.js +0 -3178
  324. package/dist/packem_chunks/payments-panel.js +0 -186
  325. package/dist/packem_chunks/permissions-panel.js +0 -805
  326. package/dist/packem_chunks/queues-panel.js +0 -1075
  327. package/dist/packem_chunks/rls-panel.js +0 -315
  328. package/dist/packem_chunks/schedule-panel.js +0 -831
  329. package/dist/packem_chunks/sparkline.js +0 -79
  330. package/dist/packem_chunks/storage-rules-panel.js +0 -140
  331. package/dist/packem_chunks/subscriptions-panel.js +0 -238
  332. package/dist/packem_chunks/users-panel.js +0 -1731
  333. package/dist/packem_chunks/vector-browser.js +0 -281
  334. package/dist/packem_chunks/workflows-panel.js +0 -562
  335. package/dist/packem_shared/ADMIN_FUNCTIONS-BHHJi3Gb.js +0 -52
  336. package/dist/packem_shared/ApiDocsPanel-CBma-lnp.js +0 -842
  337. package/dist/packem_shared/ApiReferencePanel-CQM3pPN7.js +0 -230
  338. package/dist/packem_shared/CommandPalette-X2tkbyHk.js +0 -373
  339. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  340. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  341. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  342. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  343. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  344. package/dist/packem_shared/DataBrowser-D2ywrdId.js +0 -4493
  345. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  346. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  347. package/dist/packem_shared/GlobalDataBrowser-BkTPLzAY.js +0 -289
  348. package/dist/packem_shared/HomePanel-D1Q9LZgK.js +0 -14
  349. package/dist/packem_shared/OpenRpcReferencePanel-Dno-hfDb.js +0 -192
  350. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  351. package/dist/packem_shared/ScheduledJobs-Ctw4jYtU.js +0 -262
  352. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  353. package/dist/packem_shared/Studio-lJhzDAze.js +0 -16
  354. package/dist/packem_shared/StudioApp-DiMkupvZ.js +0 -648
  355. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  356. package/dist/packem_shared/advisor-view-BX8OhG0w.js +0 -159
  357. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  358. package/dist/packem_shared/alert-CdAET2K_.js +0 -68
  359. package/dist/packem_shared/app.d-CNLRTrWw.d.ts +0 -300
  360. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  361. package/dist/packem_shared/bar-chart-DSwcWIRy.js +0 -3246
  362. package/dist/packem_shared/browser-storage-BTrX4y3B.js +0 -215
  363. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  364. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  365. package/dist/packem_shared/cf-links-BZfRdxSE.js +0 -8
  366. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  367. package/dist/packem_shared/data-grid-CdXztApG.js +0 -183
  368. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
  369. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  370. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  371. package/dist/packem_shared/error-alert-CXjqyGw9.js +0 -114
  372. package/dist/packem_shared/grid-features-BF-KBDFz.js +0 -808
  373. package/dist/packem_shared/home-panel-TFcRf9Ui.js +0 -1889
  374. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  375. package/dist/packem_shared/internal-CYcbqMjX.js +0 -109
  376. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  377. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  378. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
  379. package/dist/packem_shared/reference-view-DUiJcILV.js +0 -2141
  380. package/dist/packem_shared/scroll-area-DLhcy-ml.js +0 -93
  381. package/dist/packem_shared/select-UkNYCT3s.js +0 -273
  382. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  383. package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
  384. package/dist/packem_shared/sparkline-BnA1kC9X.js +0 -93
  385. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  386. package/dist/packem_shared/studio-Dh9UlaF_.js +0 -4015
  387. package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
  388. package/dist/packem_shared/table-list-sidebar-UVIXQJdU.js +0 -832
  389. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  390. package/dist/packem_shared/use-admin-query-CfHYWx5n.js +0 -106
  391. package/dist/packem_shared/use-async-submit-DJQiPc-_.js +0 -91
  392. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  393. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  394. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
  395. package/dist/standalone/chunk-23C4TCRO.js +0 -1
  396. package/dist/standalone/chunk-2K47A3P6.js +0 -1
  397. package/dist/standalone/chunk-2NGUNNGW.js +0 -1
  398. package/dist/standalone/chunk-3CJW6NWG.js +0 -4
  399. package/dist/standalone/chunk-3OA7PECS.js +0 -6
  400. package/dist/standalone/chunk-4QHKBC77.js +0 -1
  401. package/dist/standalone/chunk-5OIBXYZM.js +0 -1
  402. package/dist/standalone/chunk-5ZAA2PVR.js +0 -1
  403. package/dist/standalone/chunk-676HEBIR.js +0 -3
  404. package/dist/standalone/chunk-6VO23MMW.js +0 -4
  405. package/dist/standalone/chunk-7RE5UW27.js +0 -8
  406. package/dist/standalone/chunk-7TJJXVSE.js +0 -1
  407. package/dist/standalone/chunk-7YXOPTWI.js +0 -1
  408. package/dist/standalone/chunk-AAVIFQ4Y.js +0 -2
  409. package/dist/standalone/chunk-AHILM3ZP.js +0 -1
  410. package/dist/standalone/chunk-AJFQ3LNM.js +0 -1
  411. package/dist/standalone/chunk-AJULNB46.js +0 -4
  412. package/dist/standalone/chunk-BGXOXASQ.js +0 -1
  413. package/dist/standalone/chunk-BKW7FFEO.js +0 -1
  414. package/dist/standalone/chunk-BOXSWNXZ.js +0 -1
  415. package/dist/standalone/chunk-BXOYVWJR.js +0 -13
  416. package/dist/standalone/chunk-C7WTJLC3.js +0 -1
  417. package/dist/standalone/chunk-CACB34RQ.js +0 -1
  418. package/dist/standalone/chunk-CICVBMEN.js +0 -1
  419. package/dist/standalone/chunk-CKSHCYGC.js +0 -2
  420. package/dist/standalone/chunk-CWEAJUHW.js +0 -1
  421. package/dist/standalone/chunk-DC72CQY4.js +0 -76
  422. package/dist/standalone/chunk-DECHEGIC.js +0 -1
  423. package/dist/standalone/chunk-DWDILV2E.js +0 -1
  424. package/dist/standalone/chunk-E75ANNWX.js +0 -19
  425. package/dist/standalone/chunk-ERJNDIXC.js +0 -1
  426. package/dist/standalone/chunk-FKACHRWO.js +0 -1
  427. package/dist/standalone/chunk-FSGCANAU.js +0 -1
  428. package/dist/standalone/chunk-GLUNBZRI.js +0 -1
  429. package/dist/standalone/chunk-GMSGZDDH.js +0 -13
  430. package/dist/standalone/chunk-GTM65MVX.js +0 -1
  431. package/dist/standalone/chunk-H6RKXQZU.js +0 -1
  432. package/dist/standalone/chunk-HV7G6DFP.js +0 -5
  433. package/dist/standalone/chunk-HZTGDL4L.js +0 -1
  434. package/dist/standalone/chunk-I7ZZRM7I.js +0 -1
  435. package/dist/standalone/chunk-IXDH4GL5.js +0 -1
  436. package/dist/standalone/chunk-J46WXQYL.js +0 -1
  437. package/dist/standalone/chunk-J6J54MBP.js +0 -1
  438. package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
  439. package/dist/standalone/chunk-JVODY4EP.js +0 -1
  440. package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
  441. package/dist/standalone/chunk-KJJ3WM6H.js +0 -4
  442. package/dist/standalone/chunk-KSKXW5PX.js +0 -1
  443. package/dist/standalone/chunk-KZ6INM5M.js +0 -1
  444. package/dist/standalone/chunk-L7SK4ZZD.js +0 -1
  445. package/dist/standalone/chunk-LAK5VSPI.js +0 -1
  446. package/dist/standalone/chunk-LNZIB2MD.js +0 -1
  447. package/dist/standalone/chunk-LYB5L53X.js +0 -1
  448. package/dist/standalone/chunk-MJWVMKQ4.js +0 -6
  449. package/dist/standalone/chunk-MT2J3H7O.js +0 -3
  450. package/dist/standalone/chunk-N746FOQP.js +0 -1
  451. package/dist/standalone/chunk-NC6MBMSI.js +0 -1
  452. package/dist/standalone/chunk-NN27EDQB.js +0 -1
  453. package/dist/standalone/chunk-NY6GDADQ.js +0 -1
  454. package/dist/standalone/chunk-O3NAGRTR.js +0 -1
  455. package/dist/standalone/chunk-OY3HD7BJ.js +0 -4
  456. package/dist/standalone/chunk-P5HJXCZS.js +0 -1
  457. package/dist/standalone/chunk-PTS5TW3J.js +0 -1
  458. package/dist/standalone/chunk-Q52CHOSY.js +0 -1
  459. package/dist/standalone/chunk-QAFAJBAW.js +0 -1
  460. package/dist/standalone/chunk-QBAT52GB.js +0 -1
  461. package/dist/standalone/chunk-QDBOPDJ7.js +0 -1
  462. package/dist/standalone/chunk-QHFTGJPS.js +0 -4
  463. package/dist/standalone/chunk-RRCPZMC2.js +0 -22
  464. package/dist/standalone/chunk-SEU5V7I6.js +0 -1
  465. package/dist/standalone/chunk-SG3ALJJU.js +0 -1
  466. package/dist/standalone/chunk-SSI4G2MY.js +0 -1
  467. package/dist/standalone/chunk-TAD43CG5.js +0 -1
  468. package/dist/standalone/chunk-TBMYIZIO.js +0 -1
  469. package/dist/standalone/chunk-TH45YG6Q.js +0 -1
  470. package/dist/standalone/chunk-TQ36RWOP.js +0 -1
  471. package/dist/standalone/chunk-UGUEC6BC.js +0 -1
  472. package/dist/standalone/chunk-UK64ZSUW.js +0 -1
  473. package/dist/standalone/chunk-UKDJ4H7I.js +0 -1
  474. package/dist/standalone/chunk-V6IWFYAQ.js +0 -1
  475. package/dist/standalone/chunk-V7SRH36W.js +0 -1
  476. package/dist/standalone/chunk-VLXV72QE.js +0 -1
  477. package/dist/standalone/chunk-VON7JUPG.js +0 -1
  478. package/dist/standalone/chunk-WI7GWFEG.js +0 -1
  479. package/dist/standalone/chunk-WPNXY7IS.js +0 -1
  480. package/dist/standalone/chunk-X33MSJPP.js +0 -1
  481. package/dist/standalone/chunk-XNJNSCLM.js +0 -1
  482. package/dist/standalone/chunk-XRNXOIVZ.js +0 -1
  483. package/dist/standalone/chunk-YAECF5LW.js +0 -1
  484. package/dist/standalone/chunk-YBGC4PPD.js +0 -1
  485. package/dist/standalone/chunk-YNZ7ARWW.js +0 -1
  486. package/dist/standalone/chunk-YTO65GHS.js +0 -1
  487. package/dist/standalone/chunk-ZE6FT5Z3.js +0 -1
  488. package/dist/standalone/chunk-ZHVTQ37P.js +0 -1
  489. package/dist/standalone/chunk-ZIGWVHCS.js +0 -1
  490. package/dist/standalone/chunk-ZPP2KOR4.js +0 -1
  491. package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as g}from"./chunk-2ZJJH4YN.js";import{a as y}from"./chunk-A6TVTNKO.js";import{a as x}from"./chunk-ADABTCDI.js";import{a,d as b}from"./chunk-5PEAXTYQ.js";var k=b(y(),1),n=b(x(),1);var _=a(function(o,d,s){let t=(0,k.c)(15),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c={kind:"loading"},t[0]=c):c=t[0];let[h,E]=(0,n.useState)(c),r;t[1]!==d?(r=a(async()=>d(),"f"),t[1]=d,t[2]=r):r=t[2];let p=(0,n.useEffectEvent)(r),f;t[3]!==s?(f=a(e=>s(e),"m"),t[3]=s,t[4]=f):f=t[4];let v=(0,n.useEffectEvent)(f),i;t[5]!==v||t[6]!==p||t[7]!==o?(i=a(()=>{if(o!==void 0)return;let e=!1;return p().then(l=>(e||E(v(l)),l)).catch(l=>{e||E({kind:"error",message:g(l)})}),()=>{e=!0}},"u"),t[5]=v,t[6]=p,t[7]=o,t[8]=i):i=t[8];let m;t[9]!==o?(m=[o],t[9]=o,t[10]=m):m=t[10],(0,n.useEffect)(i,m);let u;return t[11]!==s||t[12]!==h||t[13]!==o?(u=o===void 0?h:s(o),t[11]=s,t[12]=h,t[13]=o,t[14]=u):u=t[14],u},"$");export{_ as a};
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-5PEAXTYQ.js";var e=i(t=>{let r=Math.floor(t/1e3),o=Math.floor(r/3600),n=Math.floor(r%3600/60),a=r%60;return o>0?`${o.toString()}h ${n.toString()}m`:n>0?`${n.toString()}m ${a.toString()}s`:`${a.toString()}s`},"e"),m=i((t,r)=>{let o=t+r;return o===0?"\u2014":`${(t/o*100).toFixed(1)}%`},"a"),s=i(t=>t<=0?"\u2014":t<1?`${(t*1e3).toFixed(0)}\u03BCs`:t<1e3?`${t.toFixed(1)}ms`:`${(t/1e3).toFixed(2)}s`,"s"),c=i((t,r)=>new Intl.NumberFormat(r,t===0||Math.abs(t)>=1?{currency:"USD",maximumFractionDigits:2,minimumFractionDigits:2,style:"currency"}:{currency:"USD",maximumSignificantDigits:3,style:"currency"}).format(t),"c"),u=i((t,r)=>new Intl.NumberFormat(r,{maximumFractionDigits:0}).format(t),"m");export{e as a,m as b,s as c,c as d,u as e};
@@ -0,0 +1 @@
1
+ import{a as $e}from"./chunk-DZV6YFWZ.js";import{g as Le}from"./chunk-RJJRUUTE.js";import"./chunk-AFLNQEZ5.js";import"./chunk-ZADOHFZB.js";import"./chunk-CL3JOU6F.js";import{a as ae}from"./chunk-ERUKFS3I.js";import"./chunk-IQ5CIBXJ.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import"./chunk-Y5QMX4YG.js";import"./chunk-2NUCBQFU.js";import{a as ge}from"./chunk-2KTN53PK.js";import{a as be}from"./chunk-YLC2ZYCL.js";import"./chunk-EDL46BPM.js";import"./chunk-DA2CAFXI.js";import{a as ue}from"./chunk-W5BTAOHO.js";import"./chunk-4KPATTV6.js";import"./chunk-7WGZSDRS.js";import"./chunk-N7FOBAV3.js";import{i as Je}from"./chunk-2D4WBSDO.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as ce}from"./chunk-CBTPJPCZ.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as se}from"./chunk-HMMALUXM.js";import{b as oe}from"./chunk-BHUWAGFN.js";import"./chunk-L27FKJTG.js";import{a as ee,b as te,c as re,d as z,e as L,f as K}from"./chunk-ZJIYJZ6F.js";import"./chunk-NFI2TNKU.js";import"./chunk-EOFWXI3T.js";import{a as me}from"./chunk-LYVYUTQY.js";import{b as ne,c as ve}from"./chunk-LRUYEVHH.js";import{a as Z,e as H}from"./chunk-XV2XEUUB.js";import{l as je,n as de}from"./chunk-QFN62JQJ.js";import"./chunk-ZPQBVYNN.js";import{B as V,h as fe,i as Ae,j as ie,k as xe,s as Y,w as le,x as Ie}from"./chunk-2ZJJH4YN.js";import"./chunk-PDBW6GTJ.js";import{a as Ce}from"./chunk-A6TVTNKO.js";import{a as we,b as Se}from"./chunk-ADABTCDI.js";import{a as y,d as he}from"./chunk-5PEAXTYQ.js";var G=he(Ce(),1),Q=he(we(),1);var t=he(Se(),1);var Fe=he(Ce(),1),pe=he(we(),1);var D=he(Se(),1);var Me=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","X"),Ke=y(r=>r.toSorted((e,o)=>e.scheduledFor-o.scheduledFor),"F"),Be=y((r,e,o)=>e!==void 0?e:o===void 0?n=>r.cancelScheduledJob(n):void 0,"Y"),Te=y(r=>{let e=(0,Fe.c)(16),{cancelJob:o,loadJobs:n}=r===void 0?{}:r,l=de(),s=V(),a=n===void 0,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["lunora-scheduled-jobs"],e[0]=i):i=e[0];let c=ne(i,async()=>{let x=await(n??(()=>l.listScheduledJobs()))();return Ke(x)}),[N,p]=(0,pe.useState)(void 0),[h,m]=(0,pe.useState)(void 0),k,f;e[1]!==l||e[2]!==a?(k=y(()=>{if(a)return l.subscribeScheduledJobs(x=>{m(void 0),p(Ke(x))})},"v"),f=[a,l],e[1]=l,e[2]=a,e[3]=k,e[4]=f):(k=e[3],f=e[4]),(0,pe.useEffect)(k,f);let d;e[5]!==c?(d=y(()=>c.poll(),"y"),e[5]=c,e[6]=d):d=e[6],ae(d,!a);let u=Be(l,o,n),v=N??c.data,b=h??c.error,S=y(async x=>{if(u!==void 0){m(void 0);try{await u(x),a||c.refetch()}catch(A){m(ie(A))}}},"E"),I="flex flex-col gap-3",w="lunora-scheduled-jobs",C;e[7]!==b?(C=b!==null&&(0,D.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:b}),e[7]=b,e[8]=C):C=e[8];let J;e[9]!==v?.length||e[10]!==s?(J=v?.length===0&&(0,D.jsx)(se,{description:s("Jobs queued with runAfter / runAt will appear here."),icon:(0,D.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,D.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,D.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:s("No scheduled jobs.")}),e[9]=v?.length,e[10]=s,e[11]=J):J=e[11];let $=v!==void 0&&v.length>0&&(0,D.jsx)(Z,{className:"overflow-hidden py-0",children:(0,D.jsx)(H,{className:"px-0",children:(0,D.jsxs)(ee,{"data-testid":"sj-table",children:[(0,D.jsx)(te,{children:(0,D.jsxs)(z,{children:[(0,D.jsx)(L,{children:s("function")}),(0,D.jsx)(L,{children:s("scheduled for")}),(0,D.jsx)(L,{children:s("pool")}),(0,D.jsx)(L,{children:s("attempts")}),(0,D.jsx)(L,{children:s("shard")}),(0,D.jsx)(L,{children:s("id")}),u!==void 0&&(0,D.jsx)(L,{"aria-label":s("Actions")})]})}),(0,D.jsx)(re,{children:v.map(x=>(0,D.jsxs)(z,{"data-testid":`sj-row-${x.id}`,children:[(0,D.jsx)(K,{className:"font-mono text-xs",children:x.workflow??x.functionPath}),(0,D.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Me(x.scheduledFor)}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.pool??""}),(0,D.jsx)(K,{className:"tabular-nums",children:x.attempts??0}),(0,D.jsx)(K,{children:x.shardKey??""}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.id}),u!==void 0&&(0,D.jsx)(K,{className:"text-right",children:(0,D.jsx)(ue,{confirmLabel:s("Cancel job?"),onConfirm:y(()=>{Y(S(x.id))},"onConfirm"),testId:`sj-cancel-${x.id}`,children:s("Cancel")})})]},x.id))})]})})}),j;return e[12]!==$||e[13]!==C||e[14]!==J?(j=(0,D.jsxs)("div",{className:I,"data-testid":w,children:[C,J,$]}),e[12]=$,e[13]=C,e[14]=J,e[15]=j):j=e[15],j},"he");var _e={failed:"destructive",skipped:"warning",succeeded:"success"},Re=25,Pe=y(r=>r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(1)} s`,"Ee"),Oe=y(r=>{let e=(0,G.c)(39),{inFlight:o,last:n}=r,l=V();if(o!==void 0){let u;e[0]!==l?(u=l("running"),e[0]=l,e[1]=u):u=e[1];let v;e[2]!==u?(v=(0,t.jsx)(oe,{variant:"info",children:u}),e[2]=u,e[3]=v):v=e[3];let b;e[4]!==o.startedAt?(b=le(o.startedAt,"\u2014"),e[4]=o.startedAt,e[5]=b):b=e[5];let S;e[6]!==b?(S=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[6]=b,e[7]=S):S=e[7];let I;e[8]!==o.skipped||e[9]!==l?(I=o.skipped>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("{count} ticks skipped",{count:o.skipped})}),e[8]=o.skipped,e[9]=l,e[10]=I):I=e[10];let w;return e[11]!==v||e[12]!==S||e[13]!==I?(w=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[v,S,I]}),e[11]=v,e[12]=S,e[13]=I,e[14]=w):w=e[14],w}if(n===void 0){let u;e[15]!==l?(u=l("never"),e[15]=l,e[16]=u):u=e[16];let v;return e[17]!==u?(v=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[17]=u,e[18]=v):v=e[18],v}let s;e[19]!==l?(s=l("failed"),e[19]=l,e[20]=s):s=e[20];let a;e[21]!==l?(a=l("skipped"),e[21]=l,e[22]=a):a=e[22];let i;e[23]!==l?(i=l("succeeded"),e[23]=l,e[24]=i):i=e[24];let c;e[25]!==s||e[26]!==a||e[27]!==i?(c={failed:s,skipped:a,succeeded:i},e[25]=s,e[26]=a,e[27]=i,e[28]=c):c=e[28];let N=c,p=_e[n.status],h=N[n.status],m;e[29]!==p||e[30]!==h?(m=(0,t.jsx)(oe,{variant:p,children:h}),e[29]=p,e[30]=h,e[31]=m):m=e[31];let k;e[32]!==n.startedAt?(k=le(n.startedAt,"\u2014"),e[32]=n.startedAt,e[33]=k):k=e[33];let f;e[34]!==k?(f=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:k}),e[34]=k,e[35]=f):f=e[35];let d;return e[36]!==m||e[37]!==f?(d=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[m,f]}),e[36]=m,e[37]=f,e[38]=d):d=e[38],d},"Re"),Ee=y(r=>{let e=(0,G.c)(80),{runs:o}=r,n=V();if(o.length===0)return;let l,s,a,i,c,N,p,h,m,k,f;if(e[0]!==o||e[1]!==n){let I=o.toSorted(Ue).slice(0,Re),w;e[13]!==n?(w=n("failed"),e[13]=n,e[14]=w):w=e[14];let C;e[15]!==n?(C=n("skipped"),e[15]=n,e[16]=C):C=e[16];let J;e[17]!==n?(J=n("succeeded"),e[17]=n,e[18]=J):J=e[18];let $;e[19]!==J||e[20]!==w||e[21]!==C?($={failed:w,skipped:C,succeeded:J},e[19]=J,e[20]=w,e[21]=C,e[22]=$):$=e[22];let j=$;m="flex flex-col gap-2",k="cron-run-history";let x;e[23]!==n?(x=n("Recent runs"),e[23]=n,e[24]=x):x=e[24],e[25]!==x?(f=(0,t.jsx)("h3",{className:"text-sm font-medium",children:x}),e[25]=x,e[26]=f):f=e[26],i=Z,h="overflow-hidden py-0",a=H,p="px-0",s=ee;let A;e[27]!==n?(A=n("name"),e[27]=n,e[28]=A):A=e[28];let g;e[29]!==A?(g=(0,t.jsx)(L,{children:A}),e[29]=A,e[30]=g):g=e[30];let F;e[31]!==n?(F=n("status"),e[31]=n,e[32]=F):F=e[32];let _;e[33]!==F?(_=(0,t.jsx)(L,{children:F}),e[33]=F,e[34]=_):_=e[34];let T;e[35]!==n?(T=n("started"),e[35]=n,e[36]=T):T=e[36];let M;e[37]!==T?(M=(0,t.jsx)(L,{children:T}),e[37]=T,e[38]=M):M=e[38];let R;e[39]!==n?(R=n("duration"),e[39]=n,e[40]=R):R=e[40];let W;e[41]!==R?(W=(0,t.jsx)(L,{children:R}),e[41]=R,e[42]=W):W=e[42];let B;e[43]!==n?(B=n("skipped"),e[43]=n,e[44]=B):B=e[44];let E;e[45]!==B?(E=(0,t.jsx)(L,{children:B}),e[45]=B,e[46]=E):E=e[46];let U;e[47]!==n?(U=n("error"),e[47]=n,e[48]=U):U=e[48];let P;e[49]!==U?(P=(0,t.jsx)(L,{children:U}),e[49]=U,e[50]=P):P=e[50],e[51]!==g||e[52]!==_||e[53]!==M||e[54]!==W||e[55]!==E||e[56]!==P?(N=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[g,_,M,W,E,P]})}),e[51]=g,e[52]=_,e[53]=M,e[54]=W,e[55]=E,e[56]=P,e[57]=N):N=e[57],l=re;let X;e[58]!==j?(X=y(q=>(0,t.jsxs)(z,{"data-testid":`cron-run-row-${q.runId}`,children:[(0,t.jsx)(K,{children:q.name}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{variant:_e[q.status],children:j[q.status]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(q.startedAt,"\u2014")}),(0,t.jsx)(K,{className:"tabular-nums",children:q.status==="skipped"?"":Pe(q.durationMs)}),(0,t.jsx)(K,{className:"tabular-nums",children:q.skipped>0?q.skipped:""}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:q.error??""})]},q.runId),"W"),e[58]=j,e[59]=X):X=e[59],c=I.map(X),e[0]=o,e[1]=n,e[2]=l,e[3]=s,e[4]=a,e[5]=i,e[6]=c,e[7]=N,e[8]=p,e[9]=h,e[10]=m,e[11]=k,e[12]=f}else l=e[2],s=e[3],a=e[4],i=e[5],c=e[6],N=e[7],p=e[8],h=e[9],m=e[10],k=e[11],f=e[12];let d;e[60]!==l||e[61]!==c?(d=(0,t.jsx)(l,{children:c}),e[60]=l,e[61]=c,e[62]=d):d=e[62];let u;e[63]!==s||e[64]!==N||e[65]!==d?(u=(0,t.jsxs)(s,{children:[N,d]}),e[63]=s,e[64]=N,e[65]=d,e[66]=u):u=e[66];let v;e[67]!==a||e[68]!==p||e[69]!==u?(v=(0,t.jsx)(a,{className:p,children:u}),e[67]=a,e[68]=p,e[69]=u,e[70]=v):v=e[70];let b;e[71]!==i||e[72]!==v||e[73]!==h?(b=(0,t.jsx)(i,{className:h,children:v}),e[71]=i,e[72]=v,e[73]=h,e[74]=b):b=e[74];let S;return e[75]!==b||e[76]!==m||e[77]!==k||e[78]!==f?(S=(0,t.jsxs)("div",{className:m,"data-testid":k,children:[f,b]}),e[75]=b,e[76]=m,e[77]=k,e[78]=f,e[79]=S):S=e[79],S},"Le");function Ue(r,e){return e.startedAt-r.startedAt}y(Ue,"Oe");var We=y(()=>{let r=(0,G.c)(50),e=V(),o=$e(""),[n,l]=(0,Q.useState)(""),[s,a]=(0,Q.useState)(void 0),[i,c]=(0,Q.useState)(!1);if(o.unavailable)return null;let N;r[0]!==o?(N=o.pending("cron"),r[0]=o,r[1]=N):N=r[1];let p=N,h;r[2]!==o?(h=o.reason("cron"),r[2]=o,r[3]=h):h=r[3];let m=h,k;r[4]!==n||r[5]!==o?(k=y(()=>{let T=n.trim();T!==""&&Y((async()=>{let M=await o.suggestCron(T);c(!1),a(M)})())},"y"),r[4]=n,r[5]=o,r[6]=k):k=r[6];let f=k,d;r[7]!==s?(d=y(()=>{let T="navigator"in globalThis?globalThis.navigator.clipboard:void 0;T===void 0||s===void 0||Y((async()=>{try{await T.writeText(s),c(!0)}catch{c(!1)}})())},"d"),r[7]=s,r[8]=d):d=r[8];let u=d,v;r[9]!==e?(v=e("Describe a schedule"),r[9]=e,r[10]=v):v=r[10];let b;r[11]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{l(T.target.value)},"b"),r[11]=b):b=r[11];let S;r[12]!==f?(S=y(T=>{T.key==="Enter"&&(T.preventDefault(),f())},"w"),r[12]=f,r[13]=S):S=r[13];let I;r[14]!==e?(I=e("Describe a schedule"),r[14]=e,r[15]=I):I=r[15];let w;r[16]!==p||r[17]!==n||r[18]!==v||r[19]!==S||r[20]!==I?(w=(0,t.jsx)(Je,{"aria-label":v,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:p,onChange:b,onKeyDown:S,placeholder:I,value:n}),r[16]=p,r[17]=n,r[18]=v,r[19]=S,r[20]=I,r[21]=w):w=r[21];let C=p&&"opacity-60",J;r[22]!==C?(J=Ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",C),r[22]=C,r[23]=J):J=r[23];let $;r[24]!==p||r[25]!==n?($=p||n.trim()==="",r[24]=p,r[25]=n,r[26]=$):$=r[26];let j;r[27]!==p||r[28]!==e?(j=e(p?"Thinking\u2026":"Suggest schedule"),r[27]=p,r[28]=e,r[29]=j):j=r[29];let x;r[30]!==f||r[31]!==J||r[32]!==$||r[33]!==j?(x=(0,t.jsx)("button",{className:J,"data-testid":"cron-assistant-generate",disabled:$,onClick:f,type:"button",children:j}),r[30]=f,r[31]=J,r[32]=$,r[33]=j,r[34]=x):x=r[34];let A;r[35]!==x||r[36]!==w?(A=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w,x]}),r[35]=x,r[36]=w,r[37]=A):A=r[37];let g;r[38]!==i||r[39]!==u||r[40]!==s||r[41]!==e?(g=s!==void 0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:s}),(0,t.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:u,type:"button",children:e(i?"Copied":"Copy")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),r[38]=i,r[39]=u,r[40]=s,r[41]=e,r[42]=g):g=r[42];let F;r[43]!==m||r[44]!==e?(F=m!==void 0&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(m==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),r[43]=m,r[44]=e,r[45]=F):F=r[45];let _;return r[46]!==A||r[47]!==g||r[48]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[A,g,F]}),r[46]=A,r[47]=g,r[48]=F,r[49]=_):_=r[49],_},"Ke"),ze={kind:"idle"},qe="SCHEDULER_NOT_CONFIGURED",ye={inFlight:[],runs:[]},Ve=y((r,e,o)=>o!==void 0?o:e===void 0?n=>r.runCronJob(n):void 0,"Fe"),Ge=y(({loadCronJobs:r,loadCronRuns:e,runCronJob:o}={})=>{let n=de(),l=V(),[s,a]=(0,Q.useState)({}),i=ne(["lunora-cron-jobs",r?"custom":"default"],()=>(r??(()=>n.getCronJobs()))()),{data:c,error:N}=i,p=e??(r===void 0?()=>n.listCronRuns():void 0),h=ne(["lunora-cron-runs",e?"custom":"default"],async()=>p===void 0?ye:p().catch(d=>{if(xe(d)===qe)return ye;throw d})),m=h.data??ye;ae(()=>h.poll(),p!==void 0);let k=Ve(n,r,o),f=y(async d=>{if(k!==void 0){a(u=>({...u,[d]:{kind:"running"}}));try{await k(d),a(u=>({...u,[d]:{kind:"ok"}})),i.refetch(),h.refetch()}catch(u){a(v=>({...v,[d]:{kind:"error",message:ie(u)}}))}}},"p");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,t.jsx)(We,{}),N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:h.error}),c?.length===0&&(0,t.jsx)(se,{description:l("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:l("No cron triggers.")}),c!==void 0&&c.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"cron-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:l("name")}),(0,t.jsx)(L,{children:l("schedule")}),(0,t.jsx)(L,{children:l("target")}),(0,t.jsx)(L,{children:l("shard")}),(0,t.jsx)(L,{children:l("last run")}),k!==void 0&&(0,t.jsx)(L,{"aria-label":l("Actions")})]})}),(0,t.jsx)(re,{children:c.map(d=>{let u=s[d.name]??ze;return(0,t.jsxs)(z,{"data-testid":`cron-row-${d.name}`,children:[(0,t.jsx)(K,{children:d.name}),(0,t.jsx)(K,{className:"font-mono text-xs tabular-nums",children:d.cron}),(0,t.jsx)(K,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d.workflow===void 0?(0,t.jsx)(oe,{variant:"outline",children:l("function")}):(0,t.jsx)(oe,{variant:"secondary",children:l("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:d.workflow??d.functionPath})]})}),(0,t.jsx)(K,{children:d.shardKey??""}),(0,t.jsx)(K,{"data-testid":`cron-last-run-${d.name}`,children:(0,t.jsx)(Oe,{inFlight:m.inFlight.find(v=>v.name===d.name),last:m.runs.find(v=>v.name===d.name)})}),k!==void 0&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[u.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${d.name}`,children:l("ran")}),u.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${d.name}`,role:"alert",children:u.message}),(0,t.jsx)(ue,{confirmLabel:l("Run now?"),disabled:u.kind==="running",onConfirm:y(()=>{Y(f(d.name))},"onConfirm"),testId:`cron-run-${d.name}`,children:u.kind==="running"?l("Running\u2026"):l("Run now")})]})})]},`${d.cron}:${d.name}`)})})]})})}),(0,t.jsx)(Ee,{runs:m.runs})]})},"Je"),Qe=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","Me"),Xe=y(r=>{let e=(0,G.c)(34),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n,removeJob:l,retryJob:s}=o,a=de(),i=V(),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-dead-jobs"],e[2]=c):c=e[2];let N;e[3]!==a||e[4]!==n?(N=y(async()=>(await(n??(()=>a.listDeadJobs()))()).toSorted(Ye),"v"),e[3]=a,e[4]=n,e[5]=N):N=e[5];let p=ne(c,N),h=p.data,[m,k]=(0,Q.useState)(void 0),f=p.error??m,d=n===void 0,u;e[6]!==a||e[7]!==d||e[8]!==s?(u=s??(d?g=>a.retryDeadJob(g):void 0),e[6]=a,e[7]=d,e[8]=s,e[9]=u):u=e[9];let v=u,b;e[10]!==a||e[11]!==d||e[12]!==l?(b=l??(d?g=>a.removeDeadJob(g):void 0),e[10]=a,e[11]=d,e[12]=l,e[13]=b):b=e[13];let S=b,I;e[14]!==p?(I=y(()=>p.poll(),"S"),e[14]=p,e[15]=I):I=e[15],ae(I,!0);let w;e[16]!==p?(w=y(async g=>{k(void 0);try{await g,p.refetch()}catch(F){k(ie(F))}},"N"),e[16]=p,e[17]=w):w=e[17];let C=w,J=v!==void 0||S!==void 0,$;e[18]!==f?($=f!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:f}),e[18]=f,e[19]=$):$=e[19];let j;e[20]!==h?.length||e[21]!==i?(j=h?.length===0&&(0,t.jsx)(se,{description:i("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:i("No dead-letter jobs.")}),e[20]=h?.length,e[21]=i,e[22]=j):j=e[22];let x;e[23]!==C||e[24]!==J||e[25]!==h||e[26]!==S||e[27]!==v||e[28]!==i?(x=h!==void 0&&h.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"dlq-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:i("function")}),(0,t.jsx)(L,{children:i("attempts")}),(0,t.jsx)(L,{children:i("last tried")}),(0,t.jsx)(L,{children:i("pool")}),(0,t.jsx)(L,{children:i("shard")}),(0,t.jsx)(L,{children:i("id")}),J&&(0,t.jsx)(L,{"aria-label":i("Actions")})]})}),(0,t.jsx)(re,{children:h.map(g=>(0,t.jsxs)(z,{"data-testid":`dlq-row-${g.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:g.workflow??g.functionPath}),(0,t.jsx)(K,{className:"tabular-nums",children:g.attempts??0}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Qe(g.scheduledFor)}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.pool??""}),(0,t.jsx)(K,{children:g.shardKey??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.id}),J&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&(0,t.jsx)(ce,{"data-testid":`dlq-retry-${g.id}`,onClick:y(()=>{Y(C(v(g.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Retry")}),S!==void 0&&(0,t.jsx)(ue,{confirmLabel:i("Drop job?"),onConfirm:y(()=>{Y(C(S(g.id)))},"onConfirm"),testId:`dlq-remove-${g.id}`,children:i("Drop")})]})})]},g.id))})]})})}),e[23]=C,e[24]=J,e[25]=h,e[26]=S,e[27]=v,e[28]=i,e[29]=x):x=e[29];let A;return e[30]!==x||e[31]!==$||e[32]!==j?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,j,x]}),e[30]=x,e[31]=$,e[32]=j,e[33]=A):A=e[33],A},"Pe");function Ye(r,e){return(e.attempts??0)-(r.attempts??0)}y(Ye,"qe");var Ze={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},He=y(r=>{let e=(0,G.c)(47),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n}=o,l=de(),s=V(),a;e[2]!==l||e[3]!==n?(a=n??(async O=>l.listScheduledHistory(O===void 0?{}:{cursor:O})),e[2]=l,e[3]=n,e[4]=a):a=e[4];let i=a,c=n?"custom":"default",N;e[5]!==c?(N=["lunora-job-history",c],e[5]=c,e[6]=N):N=e[6];let p;e[7]!==i?(p=y(async()=>i(),"f"),e[7]=i,e[8]=p):p=e[8];let h=ne(N,p),[m,k]=(0,Q.useState)(void 0),[f,d]=(0,Q.useState)(!1),[u,v]=(0,Q.useState)(void 0),b=h.data?.records,S;e[9]!==b?(S=new Set(b?.map(et)),e[9]=b,e[10]=S):S=e[10];let I=S,w=b===void 0?void 0:[...b,...(m?.records??[]).filter(O=>!I.has(O.id))],C=m===void 0?h.data?.cursor:m.cursor,J;e[11]!==i||e[12]!==C?(J=y(async()=>{d(!0),v(void 0);try{let O=await i(C);k(De=>({cursor:O.cursor,records:[...De?.records??[],...O.records]})),d(!1)}catch(O){v(ie(O)),d(!1)}},"L"),e[11]=i,e[12]=C,e[13]=J):J=e[13];let $=J,j;e[14]!==s?(j=s("canceled"),e[14]=s,e[15]=j):j=e[15];let x;e[16]!==s?(x=s("failed"),e[16]=s,e[17]=x):x=e[17];let A;e[18]!==s?(A=s("pending"),e[18]=s,e[19]=A):A=e[19];let g;e[20]!==s?(g=s("running"),e[20]=s,e[21]=g):g=e[21];let F;e[22]!==s?(F=s("succeeded"),e[22]=s,e[23]=F):F=e[23];let _;e[24]!==A||e[25]!==g||e[26]!==F||e[27]!==j||e[28]!==x?(_={canceled:j,failed:x,pending:A,running:g,succeeded:F},e[24]=A,e[25]=g,e[26]=F,e[27]=j,e[28]=x,e[29]=_):_=e[29];let T=_,M;e[30]!==h?(M=y(()=>h.poll(),"_"),e[30]=h,e[31]=M):M=e[31],ae(M,m===void 0);let R="flex flex-col gap-3",W="lunora-job-history",B;e[32]!==h.error?(B=h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:h.error}),e[32]=h.error,e[33]=B):B=e[33];let E=w?.length===0&&(0,t.jsx)(se,{description:s("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:s("No finished jobs.")}),U=w!==void 0&&w.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"job-history-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:s("function")}),(0,t.jsx)(L,{children:s("state")}),(0,t.jsx)(L,{children:s("finished")}),(0,t.jsx)(L,{children:s("error")}),(0,t.jsx)(L,{children:s("id")})]})}),(0,t.jsx)(re,{children:w.map(O=>(0,t.jsxs)(z,{"data-testid":`job-history-row-${O.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:O.workflow??O.functionPath}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{"data-testid":`job-history-state-${O.id}`,variant:Ze[O.state],children:T[O.state]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(O.completedAt,"\u2014")}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:O.error??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:O.id})]},O.id))})]})})}),P;e[34]!==u?(P=u!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:u}),e[34]=u,e[35]=P):P=e[35];let X;e[36]!==f||e[37]!==C||e[38]!==$||e[39]!==s?(X=C!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(ce,{"data-testid":"job-history-load-more",disabled:f,onClick:y(()=>{Y($())},"onClick"),variant:"outline",children:s(f?"Loading\u2026":"Load more")})}),e[36]=f,e[37]=C,e[38]=$,e[39]=s,e[40]=X):X=e[40];let q;return e[41]!==B||e[42]!==E||e[43]!==U||e[44]!==P||e[45]!==X?(q=(0,t.jsxs)("div",{className:R,"data-testid":W,children:[B,E,U,P,X]}),e[41]=B,e[42]=E,e[43]=U,e[44]=P,e[45]=X,e[46]=q):q=e[46],q},"Be");function et(r){return r.id}y(et,"He");var tt=fe(me.dropOutboxEntry),rt=fe(me.retryOutboxEntry),lt=y(()=>{let r=(0,G.c)(8),e=V(),o;r[0]!==e?(o=e("Jobs whose mutation committed but that the scheduler has not accepted yet wait here."),r[0]=e,r[1]=o):o=r[1];let n;r[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 4h16v12H4zM4 16l4 4h8l4-4"})}),r[2]=n):n=r[2];let l;r[3]!==e?(l=e("Nothing is waiting for the scheduler."),r[3]=e,r[4]=l):l=r[4];let s;return r[5]!==o||r[6]!==l?(s=(0,t.jsx)(se,{description:o,icon:n,testId:"outbox-empty",title:l}),r[5]=o,r[6]=l,r[7]=s):s=r[7],s},"ze"),at=y(r=>{let e=(0,G.c)(58),{entry:o,onAct:n}=r,l=V(),s=`outbox-row-${o.id}`,a;e[0]!==o.target||e[1]!==l?(a=o.target??l("unreadable"),e[0]=o.target,e[1]=l,e[2]=a):a=e[2];let i;e[3]!==a?(i=(0,t.jsx)(K,{className:"font-mono text-xs",children:a}),e[3]=a,e[4]=i):i=e[4];let c=o.parked?"destructive":"secondary",N;e[5]!==o.parked||e[6]!==l?(N=o.parked?l("parked"):l("retrying"),e[5]=o.parked,e[6]=l,e[7]=N):N=e[7];let p;e[8]!==c||e[9]!==N?(p=(0,t.jsx)(oe,{variant:c,children:N}),e[8]=c,e[9]=N,e[10]=p):p=e[10];let h;e[11]!==o.forever||e[12]!==l?(h=o.forever&&(0,t.jsx)(oe,{variant:"outline",children:l("forever")}),e[11]=o.forever,e[12]=l,e[13]=h):h=e[13];let m;e[14]!==p||e[15]!==h?(m=(0,t.jsx)(K,{children:(0,t.jsxs)("div",{className:"flex gap-1",children:[p,h]})}),e[14]=p,e[15]=h,e[16]=m):m=e[16];let k;e[17]!==o.attempts?(k=(0,t.jsx)(K,{className:"tabular-nums",children:o.attempts}),e[17]=o.attempts,e[18]=k):k=e[18];let f;e[19]!==o.nextAttemptAt||e[20]!==o.parked?(f=o.parked?"\u2014":le(o.nextAttemptAt,"\u2014"),e[19]=o.nextAttemptAt,e[20]=o.parked,e[21]=f):f=e[21];let d;e[22]!==f?(d=(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:f}),e[22]=f,e[23]=d):d=e[23];let u;e[24]!==o.id?(u=(0,t.jsx)(K,{className:"font-mono text-xs",children:o.id}),e[24]=o.id,e[25]=u):u=e[25];let v=`outbox-retry-${o.id}`,b;e[26]!==o.id||e[27]!==n?(b=y(()=>{Y(n(rt,o.id))},"b"),e[26]=o.id,e[27]=n,e[28]=b):b=e[28];let S;e[29]!==l?(S=l("Retry now"),e[29]=l,e[30]=S):S=e[30];let I;e[31]!==v||e[32]!==b||e[33]!==S?(I=(0,t.jsx)(ce,{"data-testid":v,onClick:b,size:"sm",type:"button",variant:"outline",children:S}),e[31]=v,e[32]=b,e[33]=S,e[34]=I):I=e[34];let w;e[35]!==l?(w=l("Drop job?"),e[35]=l,e[36]=w):w=e[36];let C;e[37]!==o.id||e[38]!==n?(C=y(()=>{Y(n(tt,o.id))},"T"),e[37]=o.id,e[38]=n,e[39]=C):C=e[39];let J=`outbox-drop-${o.id}`,$;e[40]!==l?($=l("Drop"),e[40]=l,e[41]=$):$=e[41];let j;e[42]!==w||e[43]!==C||e[44]!==J||e[45]!==$?(j=(0,t.jsx)(ue,{confirmLabel:w,onConfirm:C,testId:J,children:$}),e[42]=w,e[43]=C,e[44]=J,e[45]=$,e[46]=j):j=e[46];let x;e[47]!==I||e[48]!==j?(x=(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[I,j]})}),e[47]=I,e[48]=j,e[49]=x):x=e[49];let A;return e[50]!==s||e[51]!==d||e[52]!==u||e[53]!==x||e[54]!==i||e[55]!==m||e[56]!==k?(A=(0,t.jsxs)(z,{"data-testid":s,children:[i,m,k,d,u,x]}),e[50]=s,e[51]=d,e[52]=u,e[53]=x,e[54]=i,e[55]=m,e[56]=k,e[57]=A):A=e[57],A},"We"),ot=y(r=>{let e=(0,G.c)(41),{entries:o,onAct:n}=r,l=V(),s;e[0]!==l?(s=l("function"),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==s?(a=(0,t.jsx)(L,{children:s}),e[2]=s,e[3]=a):a=e[3];let i;e[4]!==l?(i=l("state"),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,t.jsx)(L,{children:i}),e[6]=i,e[7]=c):c=e[7];let N;e[8]!==l?(N=l("attempts"),e[8]=l,e[9]=N):N=e[9];let p;e[10]!==N?(p=(0,t.jsx)(L,{children:N}),e[10]=N,e[11]=p):p=e[11];let h;e[12]!==l?(h=l("next attempt"),e[12]=l,e[13]=h):h=e[13];let m;e[14]!==h?(m=(0,t.jsx)(L,{children:h}),e[14]=h,e[15]=m):m=e[15];let k;e[16]!==l?(k=l("id"),e[16]=l,e[17]=k):k=e[17];let f;e[18]!==k?(f=(0,t.jsx)(L,{children:k}),e[18]=k,e[19]=f):f=e[19];let d;e[20]!==l?(d=l("Actions"),e[20]=l,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,t.jsx)(L,{"aria-label":d}),e[22]=d,e[23]=u):u=e[23];let v;e[24]!==f||e[25]!==u||e[26]!==a||e[27]!==c||e[28]!==p||e[29]!==m?(v=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[a,c,p,m,f,u]})}),e[24]=f,e[25]=u,e[26]=a,e[27]=c,e[28]=p,e[29]=m,e[30]=v):v=e[30];let b;if(e[31]!==o||e[32]!==n){let w;e[34]!==n?(w=y(C=>(0,t.jsx)(at,{entry:C,onAct:n},C.id),"N"),e[34]=n,e[35]=w):w=e[35],b=o.map(w),e[31]=o,e[32]=n,e[33]=b}else b=e[33];let S;e[36]!==b?(S=(0,t.jsx)(re,{children:b}),e[36]=b,e[37]=S):S=e[37];let I;return e[38]!==v||e[39]!==S?(I=(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"outbox-table",children:[v,S]})})}),e[38]=v,e[39]=S,e[40]=I):I=e[40],I},"Ge"),nt=y(r=>{let e=(0,G.c)(11),{cursor:o,nextCursor:n,onFirst:l,onNext:s}=r,a=V();if(o===void 0&&n===void 0)return;let i;e[0]!==o||e[1]!==l||e[2]!==a?(i=o!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-first-page",onClick:l,size:"sm",type:"button",variant:"outline",children:a("First page")}),e[0]=o,e[1]=l,e[2]=a,e[3]=i):i=e[3];let c;e[4]!==n||e[5]!==s||e[6]!==a?(c=n!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-next-page",onClick:y(()=>{s(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Next page")}),e[4]=n,e[5]=s,e[6]=a,e[7]=c):c=e[7];let N;return e[8]!==i||e[9]!==c?(N=(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[i,c]}),e[8]=i,e[9]=c,e[10]=N):N=e[10],N},"Ye"),st=y(r=>{let e=(0,G.c)(38),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n}=o,l=je(),s=V(),{queryShardKey:a,setShardKey:i,shardKey:c}=ge(n),N;e[2]!==a?(N={cursor:void 0,shardKey:a},e[2]=a,e[3]=N):N=e[3];let[p,h]=(0,Q.useState)(N);p.shardKey!==a&&h({cursor:void 0,shardKey:a});let m=p.shardKey===a?p.cursor:void 0,k=c.trim()!==a,f;e[4]!==m?(f=m===void 0?{}:{cursor:m},e[4]=m,e[5]=f):f=e[5];let d;e[6]!==a?(d={shardKey:a},e[6]=a,e[7]=d):d=e[7];let{data:u,error:v,poll:b,refetch:S}=ve(me.getScheduleOutbox,f,d),I=k?void 0:u?.entries,w=k?void 0:u?.nextCursor,[C,J]=(0,Q.useState)(void 0),$=v??(C?.shardKey===a?C.message:void 0);ae(b,!0);let j;e[8]!==l||e[9]!==a||e[10]!==S||e[11]!==s?(j=y(async(B,E)=>{J(void 0);try{(await l.query(B,{id:E},Ae(a))).retried===!1&&J({message:s("That job is no longer in the outbox."),shardKey:a}),S()}catch(U){J({message:ie(U),shardKey:a})}},"A"),e[8]=l,e[9]=a,e[10]=S,e[11]=s,e[12]=j):j=e[12];let x=j,A;e[13]!==i||e[14]!==c?(A=(0,t.jsx)(be,{onChange:i,testId:"outbox-shard-input",value:c}),e[13]=i,e[14]=c,e[15]=A):A=e[15];let g;e[16]!==$?(g=$!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"outbox-error",role:"alert",children:$}),e[16]=$,e[17]=g):g=e[17];let F;e[18]!==m||e[19]!==I?.length?(F=I?.length===0&&m===void 0&&(0,t.jsx)(lt,{}),e[18]=m,e[19]=I?.length,e[20]=F):F=e[20];let _;e[21]!==x||e[22]!==I?(_=I!==void 0&&I.length>0&&(0,t.jsx)(ot,{entries:I,onAct:x}),e[21]=x,e[22]=I,e[23]=_):_=e[23];let T,M;e[24]!==a?(T=y(()=>{h({cursor:void 0,shardKey:a})},"E"),M=y(B=>{h({cursor:B,shardKey:a})},"_"),e[24]=a,e[25]=T,e[26]=M):(T=e[25],M=e[26]);let R;e[27]!==m||e[28]!==w||e[29]!==T||e[30]!==M?(R=(0,t.jsx)(nt,{cursor:m,nextCursor:w,onFirst:T,onNext:M}),e[27]=m,e[28]=w,e[29]=T,e[30]=M,e[31]=R):R=e[31];let W;return e[32]!==R||e[33]!==A||e[34]!==g||e[35]!==F||e[36]!==_?(W=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-schedule-outbox",children:[A,g,F,_,R]}),e[32]=R,e[33]=A,e[34]=g,e[35]=F,e[36]=_,e[37]=W):W=e[37],W},"je"),it="scheduler.lag_ms",Ne=y(r=>{let e=r.attributes?.function;return typeof e=="string"?e:r.functionPath},"he"),ke=y(r=>{let e=(0,G.c)(8),{label:o,testId:n,value:l}=r,s;e[0]!==o?(s=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=s):s=e[1];let a;e[2]!==n||e[3]!==l?(a=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":n,children:l}),e[2]=n,e[3]=l,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=(0,t.jsx)(Z,{className:"flex-1 py-0",children:(0,t.jsxs)(H,{className:"flex flex-col gap-1 p-4",children:[s,a]})}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i},"fe"),dt=y(r=>{let e=(0,G.c)(65),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadStatus:l}=o,s=de(),a=V(),i=l===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let N;e[4]!==s||e[5]!==l?(N=y(async()=>{let B=await(l??(()=>s.schedulerStatus()))();return{...B,pools:B.pools.toSorted(ct)}},"v"),e[4]=s,e[5]=l,e[6]=N):N=e[6];let p=ne(c,N),{data:h,error:m}=p,{queryShardKey:k,setShardKey:f,shardKey:d}=ge(n),u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u={},e[7]=u):u=e[7];let v;e[8]!==k?(v={shardKey:k},e[8]=k,e[9]=v):v=e[9];let b=ve(me.getMetricSeries,u,v),{data:S,errorSource:I}=b,w;e[10]!==I||e[11]!==b.error?(w=xe(I)==="FUNCTION_NOT_FOUND"?null:b.error,e[10]=I,e[11]=b.error,e[12]=w):w=e[12];let C=w,J;e[13]!==p?(J=y(()=>p.poll(),"L"),e[13]=p,e[14]=J):J=e[14],ae(J,!0);let $;e[15]!==b?($=y(()=>b.poll(),"$"),e[15]=b,e[16]=$):$=e[16],ae($,!0);let j,x,A,g,F,_,T,M;if(e[17]!==m||e[18]!==S||e[19]!==C||e[20]!==f||e[21]!==d||e[22]!==h||e[23]!==a){let B=(Array.isArray(S?.series)?S.series:[]).filter(ht).toSorted(ut);j="flex flex-col gap-3",x="lunora-scheduler-pools",e[32]!==m?(A=m!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m}),e[32]=m,e[33]=A):A=e[33],e[34]!==h||e[35]!==a?(g=h!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(ke,{label:a("backlog"),testId:"pools-backlog",value:h.backlog}),(0,t.jsx)(ke,{label:a("in flight"),testId:"pools-inflight",value:h.inFlight}),(0,t.jsx)(ke,{label:a("pools"),testId:"pools-count",value:h.pools.length})]}),e[34]=h,e[35]=a,e[36]=g):g=e[36],e[37]!==h?.pools.length||e[38]!==a?(F=h?.pools.length===0&&(0,t.jsx)(se,{description:a("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:a("No workpools.")}),e[37]=h?.pools.length,e[38]=a,e[39]=F):F=e[39];let E;e[40]!==f||e[41]!==d?(E=(0,t.jsx)(be,{onChange:f,testId:"lag-shard-input",value:d}),e[40]=f,e[41]=d,e[42]=E):E=e[42];let U;e[43]!==a?(U=a("Start lag per job on this shard since it last woke; the series reset when the shard hibernates."),e[43]=a,e[44]=U):U=e[44];let P;e[45]!==U?(P=(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"lag-scope",children:U}),e[45]=U,e[46]=P):P=e[46],e[47]!==E||e[48]!==P?(_=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[E,P]}),e[47]=E,e[48]=P,e[49]=_):_=e[49],e[50]!==C?(T=C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"lag-error",role:"alert",children:C}),e[50]=C,e[51]=T):T=e[51],M=C===null&&B.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"lag-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("function")}),(0,t.jsx)(L,{children:a("runs")}),(0,t.jsx)(L,{children:a("mean lag (ms)")}),(0,t.jsx)(L,{children:a("max lag (ms)")}),(0,t.jsx)(L,{children:a("last lag (ms)")})]})}),(0,t.jsx)(re,{children:B.map(mt)})]})})}),e[17]=m,e[18]=S,e[19]=C,e[20]=f,e[21]=d,e[22]=h,e[23]=a,e[24]=j,e[25]=x,e[26]=A,e[27]=g,e[28]=F,e[29]=_,e[30]=T,e[31]=M}else j=e[24],x=e[25],A=e[26],g=e[27],F=e[28],_=e[29],T=e[30],M=e[31];let R;e[52]!==h||e[53]!==a?(R=h!==void 0&&h.pools.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"pools-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("pool")}),(0,t.jsx)(L,{children:a("queued")}),(0,t.jsx)(L,{children:a("in flight")}),(0,t.jsx)(L,{children:a("max concurrency")})]})}),(0,t.jsx)(re,{children:h.pools.map(pt)})]})})}),e[52]=h,e[53]=a,e[54]=R):R=e[54];let W;return e[55]!==j||e[56]!==x||e[57]!==A||e[58]!==g||e[59]!==F||e[60]!==_||e[61]!==T||e[62]!==M||e[63]!==R?(W=(0,t.jsxs)("div",{className:j,"data-testid":x,children:[A,g,F,_,T,M,R]}),e[55]=j,e[56]=x,e[57]=A,e[58]=g,e[59]=F,e[60]=_,e[61]=T,e[62]=M,e[63]=R,e[64]=W):W=e[64],W},"Ze");function ct(r,e){return e.queued-r.queued}y(ct,"et");function ht(r){return r.name===it&&r.kind==="histogram"&&r.count>0}y(ht,"tt");function ut(r,e){return e.max-r.max}y(ut,"st");function mt(r){return(0,t.jsxs)(z,{"data-testid":`lag-row-${Ne(r)}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:Ne(r)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.count}),(0,t.jsx)(K,{className:"tabular-nums",children:Math.round(r.sum/r.count)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.max}),(0,t.jsx)(K,{className:"tabular-nums",children:r.last})]},Ne(r))}y(mt,"lt");function pt(r){return(0,t.jsxs)(z,{"data-testid":`pools-row-${r.name}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:r.name}),(0,t.jsx)(K,{className:"tabular-nums",children:r.queued}),(0,t.jsxs)(K,{className:"tabular-nums",children:[r.inFlight," / ",r.maxConcurrency]}),(0,t.jsx)(K,{className:"tabular-nums",children:r.maxConcurrency})]},r.name)}y(pt,"rt");var ft=["jobs","outbox","history","dead","pools","cron"],Vt=y(r=>{let e=(0,G.c)(55),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadCronJobs:l,scheduledCancel:s,scheduledLoad:a}=o,i=V(),[c,N]=(0,Q.useState)("jobs"),p;e[2]!==i?(p=i("Cron triggers"),e[2]=i,e[3]=p):p=e[3];let h;e[4]!==i?(h=i("Dead letter"),e[4]=i,e[5]=h):h=e[5];let m;e[6]!==i?(m=i("History"),e[6]=i,e[7]=m):m=e[7];let k;e[8]!==i?(k=i("Scheduled jobs"),e[8]=i,e[9]=k):k=e[9];let f;e[10]!==i?(f=i("Outbox"),e[10]=i,e[11]=f):f=e[11];let d;e[12]!==i?(d=i("Pools"),e[12]=i,e[13]=d):d=e[13];let u;e[14]!==p||e[15]!==h||e[16]!==m||e[17]!==k||e[18]!==f||e[19]!==d?(u={cron:p,dead:h,history:m,jobs:k,outbox:f,pools:d},e[14]=p,e[15]=h,e[16]=m,e[17]=k,e[18]=f,e[19]=d,e[20]=u):u=e[20];let v=u,b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{N(T.currentTarget.dataset.view)},"b"),e[21]=b):b=e[21];let S=b,I;e[22]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(Le,{}),e[22]=I):I=e[22];let w;e[23]!==i?(w=i("Schedule view"),e[23]=i,e[24]=w):w=e[24];let C;e[25]!==c||e[26]!==v?(C=ft.map(T=>(0,t.jsx)(ce,{"aria-selected":c===T,"data-testid":`schedule-view-${T}`,"data-view":T,onClick:S,role:"tab",size:"sm",type:"button",variant:c===T?"default":"outline",children:v[T]},T)),e[25]=c,e[26]=v,e[27]=C):C=e[27];let J;e[28]!==w||e[29]!==C?(J=(0,t.jsx)("div",{"aria-label":w,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:C}),e[28]=w,e[29]=C,e[30]=J):J=e[30];let $;e[31]!==s||e[32]!==a||e[33]!==c?($=c==="jobs"&&(0,t.jsx)(Te,{cancelJob:s,loadJobs:a}),e[31]=s,e[32]=a,e[33]=c,e[34]=$):$=e[34];let j;e[35]!==c?(j=c==="outbox"&&(0,t.jsx)(st,{}),e[35]=c,e[36]=j):j=e[36];let x;e[37]!==c?(x=c==="history"&&(0,t.jsx)(He,{}),e[37]=c,e[38]=x):x=e[38];let A;e[39]!==c?(A=c==="dead"&&(0,t.jsx)(Xe,{}),e[39]=c,e[40]=A):A=e[40];let g;e[41]!==n||e[42]!==c?(g=c==="pools"&&(0,t.jsx)(dt,{initialShardKey:n}),e[41]=n,e[42]=c,e[43]=g):g=e[43];let F;e[44]!==l||e[45]!==c?(F=c==="cron"&&(0,t.jsx)(Ge,{loadCronJobs:l}),e[44]=l,e[45]=c,e[46]=F):F=e[46];let _;return e[47]!==J||e[48]!==$||e[49]!==j||e[50]!==x||e[51]!==A||e[52]!==g||e[53]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,J,$,j,x,A,g,F]}),e[47]=J,e[48]=$,e[49]=j,e[50]=x,e[51]=A,e[52]=g,e[53]=F,e[54]=_):_=e[54],_},"It");export{Vt as SchedulePanel};
@@ -0,0 +1 @@
1
+ import{b as e}from"./chunk-R3RIZDUS.js";import{a as c}from"./chunk-A6TVTNKO.js";import{b as p}from"./chunk-ADABTCDI.js";import{a,d as r}from"./chunk-5PEAXTYQ.js";var i=r(c(),1);var m=r(p(),1);var u={bounce:.1,duration:.45,type:"spring"},d=a(n=>{let t=(0,i.c)(2),{className:s}=n,o;return t[0]!==s?(o=(0,m.jsx)(e.span,{className:s,layoutId:"studio-theme-active",transition:u}),t[0]=s,t[1]=o):o=t[1],o},"u");export{d as default};
@@ -0,0 +1 @@
1
+ import{a as ee}from"./chunk-Y5QMX4YG.js";import{a as ne}from"./chunk-HMMALUXM.js";import{b as Z}from"./chunk-BHUWAGFN.js";import"./chunk-L27FKJTG.js";import{a as O}from"./chunk-XV2XEUUB.js";import{i as se,n as X}from"./chunk-QFN62JQJ.js";import"./chunk-ZPQBVYNN.js";import{B as re,w as le,x as Y}from"./chunk-2ZJJH4YN.js";import"./chunk-PDBW6GTJ.js";import{a as ce}from"./chunk-A6TVTNKO.js";import{b as me}from"./chunk-ADABTCDI.js";import{a as k,d as ae}from"./chunk-5PEAXTYQ.js";var te=ae(ce(),1);var a=ae(me(),1);var pe="/_lunora/health",he="/_lunora/health/ready",ue=k((r,e)=>(r.endsWith("/")?r.slice(0,-1):r)+e,"me"),fe=k(()=>{let r=X();return async e=>{let w=e==="ready"?he:pe,t=r.getAuthToken(),y=ue(r.url,w);try{let i=await fetch(y,{headers:t===null?{}:{authorization:`Bearer ${t}`}}),p=null;try{p=await i.json()}catch{p=null}return{body:p,ok:i.ok,status:i.status}}catch(i){return{body:null,error:i instanceof Error?i.message:String(i),ok:!1,status:0}}}},"pe"),ge={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},ye=k(r=>r==="unhealthy"?"crit":r==="degraded"?"warn":"ok","fe"),ie=k(r=>{let e=(0,te.c)(13),{label:w,level:t,testId:y,value:i}=r,p=ge[t],d;e[0]!==p?(d=Y("size-1.5 shrink-0 rounded-full",p),e[0]=p,e[1]=d):d=e[1];let o;e[2]!==d?(o=(0,a.jsx)("span",{"aria-hidden":"true",className:d}),e[2]=d,e[3]=o):o=e[3];let c;e[4]!==w||e[5]!==o?(c=(0,a.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[o,w]}),e[4]=w,e[5]=o,e[6]=c):c=e[6];let h;e[7]!==y||e[8]!==i?(h=(0,a.jsx)("span",{className:"text-lg font-semibold text-foreground","data-testid":y,children:i}),e[7]=y,e[8]=i,e[9]=h):h=e[9];let C;return e[10]!==c||e[11]!==h?(C=(0,a.jsx)(O,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[c,h]})}),e[10]=c,e[11]=h,e[12]=C):C=e[12],C},"Z"),Ie=k(r=>{let e=(0,te.c)(107),{probe:w}=r,t=re(),y=X(),i=fe(),p=w??i,d;e[0]!==p?(d=k(async()=>{let[s,n]=await Promise.all([p("live"),p("ready")]);return{live:s,ready:n}},"o"),e[0]=p,e[1]=d):d=e[1];let o;e[2]!==y?(o=y.clientIdentifier(),e[2]=y,e[3]=o):o=e[3];let c;e[4]!==o?(c=["deployment-health",o],e[4]=o,e[5]=c):c=e[5];let h;e[6]!==d||e[7]!==c?(h={queryFn:d,queryKey:c},e[6]=d,e[7]=c,e[8]=h):h=e[8];let{data:C,isPending:de}=se(h),Q=C?.live??null,oe=C?.ready??null;if(de){let s;return e[9]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"deployment-health-loading",children:[(0,a.jsx)(ee,{className:"h-16 w-full"}),(0,a.jsx)(ee,{className:"h-40 w-full"})]}),e[9]=s):s=e[9],s}let l=Q?.body??null;if(l===null){let s=Q?.status===403,n;e[10]!==s||e[11]!==Q?.error||e[12]!==t?(n=s?t("The health endpoint is in the admin posture. Paste a valid admin token in the connect popover, or set its auth to public."):t("Couldn't reach the health endpoint: {message}",{message:Q?.error??t("no response")}),e[10]=s,e[11]=Q?.error,e[12]=t,e[13]=n):n=e[13];let m;e[14]!==t?(m=t("Health endpoint unavailable"),e[14]=t,e[15]=m):m=e[15];let f;return e[16]!==n||e[17]!==m?(f=(0,a.jsx)(ne,{description:n,testId:"deployment-health-error",title:m}),e[16]=n,e[17]=m,e[18]=f):f=e[18],f}let J;e[19]!==l.status?(J=ye(l.status),e[19]=l.status,e[20]=J):J=e[20];let W=J,u;if(l.status==="unhealthy"){let s;e[21]!==t?(s=t("Unhealthy"),e[21]=t,e[22]=s):s=e[22],u=s}else if(l.status==="degraded"){let s;e[23]!==t?(s=t("Degraded"),e[23]=t,e[24]=s):s=e[24],u=s}else{let s;e[25]!==t?(s=t("Healthy"),e[25]=t,e[26]=s):s=e[26],u=s}let _=oe?.ok??!1,G=_?"ok":"crit",j,H,I,x,N,v,S,V,b,P;if(e[27]!==l.appName||e[28]!==l.appVersion||e[29]!==l.checks||e[30]!==l.timestamp||e[31]!==W||e[32]!==G||e[33]!==_||e[34]!==u||e[35]!==t){let s=[...l.checks].toSorted(xe);H="flex flex-col gap-6",I="deployment-health";let n;e[46]!==t?(n=t("Live liveness, readiness, and per-binding health from the deployment's /_lunora/health endpoint \u2014 wire an uptime monitor or a Cloudflare Health Check at it."),e[46]=t,e[47]=n):n=e[47],e[48]!==n?(x=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:n}),e[48]=n,e[49]=x):x=e[49];let m;e[50]!==u?(m=(0,a.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"dh-status",children:u}),e[50]=u,e[51]=m):m=e[51];let f;e[52]!==l.appName||e[53]!==l.appVersion?(f=(0,a.jsxs)("span",{className:"font-mono text-[13px] text-muted-foreground","data-testid":"dh-app",children:[l.appName," \xB7 ",l.appVersion]}),e[52]=l.appName,e[53]=l.appVersion,e[54]=f):f=e[54];let D;e[55]!==m||e[56]!==f?(D=(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsxs)("div",{className:"grid leading-tight",children:[m,f]})}),e[55]=m,e[56]=f,e[57]=D):D=e[57];let T;e[58]!==t?(T=t("Checked"),e[58]=t,e[59]=T):T=e[59];let $;e[60]!==T?($=(0,a.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:T}),e[60]=T,e[61]=$):$=e[61];let q;e[62]!==l.timestamp?(q=le(l.timestamp),e[62]=l.timestamp,e[63]=q):q=e[63];let B;e[64]!==q?(B=(0,a.jsx)("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:q}),e[64]=q,e[65]=B):B=e[65];let E;e[66]!==$||e[67]!==B?(E=(0,a.jsxs)("div",{className:"text-end",children:[$,B]}),e[66]=$,e[67]=B,e[68]=E):E=e[68],e[69]!==D||e[70]!==E?(N=(0,a.jsx)(O,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[D,E]})}),e[69]=D,e[70]=E,e[71]=N):N=e[71];let L;e[72]!==t?(L=t("Liveness"),e[72]=t,e[73]=L):L=e[73];let R;e[74]!==W||e[75]!==u||e[76]!==L?(R=(0,a.jsx)(ie,{label:L,level:W,testId:"dh-liveness",value:u}),e[74]=W,e[75]=u,e[76]=L,e[77]=R):R=e[77];let U;e[78]!==t?(U=t("Readiness"),e[78]=t,e[79]=U):U=e[79];let A;e[80]!==_||e[81]!==t?(A=t(_?"Ready":"Not ready"),e[80]=_,e[81]=t,e[82]=A):A=e[82];let F;e[83]!==G||e[84]!==U||e[85]!==A?(F=(0,a.jsx)(ie,{label:U,level:G,testId:"dh-readiness",value:A}),e[83]=G,e[84]=U,e[85]=A,e[86]=F):F=e[86],e[87]!==R||e[88]!==F?(v=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2","data-testid":"dh-probes",children:[R,F]}),e[87]=R,e[88]=F,e[89]=v):v=e[89],j=O,S="gap-0 py-0",V="dh-checks";let K;e[90]!==t?(K=t("Subsystem checks"),e[90]=t,e[91]=K):K=e[91],e[92]!==K?(b=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:K})}),e[92]=K,e[93]=b):b=e[93],P=s.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"dh-checks-empty",children:t("No checks reported.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:s.map(g=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs","data-testid":`dh-check-${g.name}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:Y("size-1.5 shrink-0 rounded-full",g.status==="up"?"bg-success":"bg-destructive")}),(0,a.jsx)("span",{className:"font-mono text-foreground",children:g.name}),g.critical&&(0,a.jsx)(Z,{variant:"outline",children:t("Critical")})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[g.message!==void 0&&(0,a.jsx)("span",{className:"text-muted-foreground",children:g.message}),(0,a.jsx)(Z,{"data-testid":`dh-check-status-${g.name}`,variant:g.status==="up"?"secondary":"destructive",children:g.status==="up"?t("Up"):t("Down")})]})]},g.name))}),e[27]=l.appName,e[28]=l.appVersion,e[29]=l.checks,e[30]=l.timestamp,e[31]=W,e[32]=G,e[33]=_,e[34]=u,e[35]=t,e[36]=j,e[37]=H,e[38]=I,e[39]=x,e[40]=N,e[41]=v,e[42]=S,e[43]=V,e[44]=b,e[45]=P}else j=e[36],H=e[37],I=e[38],x=e[39],N=e[40],v=e[41],S=e[42],V=e[43],b=e[44],P=e[45];let z;e[94]!==j||e[95]!==S||e[96]!==V||e[97]!==b||e[98]!==P?(z=(0,a.jsxs)(j,{className:S,"data-testid":V,children:[b,P]}),e[94]=j,e[95]=S,e[96]=V,e[97]=b,e[98]=P,e[99]=z):z=e[99];let M;return e[100]!==H||e[101]!==I||e[102]!==x||e[103]!==N||e[104]!==v||e[105]!==z?(M=(0,a.jsxs)("div",{className:H,"data-testid":I,children:[x,N,v,z]}),e[100]=H,e[101]=I,e[102]=x,e[103]=N,e[104]=v,e[105]=z,e[106]=M):M=e[106],M},"_e");function xe(r,e){return r.name.localeCompare(e.name)}k(xe,"he");export{Ie as DeploymentHealthPanel};
@@ -0,0 +1,2 @@
1
+ import{a as fe}from"./chunk-BWHVY6L6.js";import"./chunk-T7UKRA6J.js";import{a as ie}from"./chunk-LMCBMC2V.js";import{a as de}from"./chunk-ERUKFS3I.js";import"./chunk-OWRWDDJT.js";import{i as me}from"./chunk-2D4WBSDO.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as b}from"./chunk-CBTPJPCZ.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as he}from"./chunk-HMMALUXM.js";import{b as ue}from"./chunk-BHUWAGFN.js";import"./chunk-L27FKJTG.js";import{a as pe}from"./chunk-JZN3MNJX.js";import"./chunk-EYSF4DHD.js";import"./chunk-ELPLRD4S.js";import"./chunk-NFI2TNKU.js";import"./chunk-EOFWXI3T.js";import{a as H}from"./chunk-LYVYUTQY.js";import{c as oe}from"./chunk-LRUYEVHH.js";import{n as se}from"./chunk-QFN62JQJ.js";import"./chunk-ZPQBVYNN.js";import{B as ce,h as Z,i as ee,j as te,s as ae,v as le,w as re,x as ne}from"./chunk-2ZJJH4YN.js";import"./chunk-PDBW6GTJ.js";import{a as ve}from"./chunk-A6TVTNKO.js";import{a as ge,b as Ne}from"./chunk-ADABTCDI.js";import{a as l,d as Y}from"./chunk-5PEAXTYQ.js";var t=Y(Ne(),1);var be=Y(ve(),1),v=Y(ge(),1);function ye({className:a,orientation:e="horizontal",...s}){return(0,t.jsx)(ie,{"data-slot":"separator",orientation:e,className:ne("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...s})}l(ye,"ge");var we=/https?:\/\/[^\s"'<>)]+/i,xe=l(a=>a===void 0?void 0:we.exec(a)?.[0],"re"),N=l(a=>a===void 0?"":Array.isArray(a)?a.join(", "):a,"v"),Ce=/<a\s(?:[^>]*?\s)?href\s*=\s*["'](https?:\/\/[^"'\s]+)["']/iu,ke=/&(?:amp|#0*38|#x0*26);/giu,Se=l(a=>a===void 0?void 0:((a.html===void 0?void 0:Ce.exec(a.html)?.[1])??xe(a.text)??xe(a.html))?.replaceAll(ke,"&"),"ye"),Te=l((a,e)=>{let s=e.trim().toLowerCase();return s===""?a:a.filter(o=>`${o.subject} ${N(o.to)} ${N(o.cc)}`.toLowerCase().includes(s))},"Ce"),je=l((a,e)=>{if(a.length!==0)return a.find(s=>s.id===e)??a[0]},"Se"),Le=Z(H.clearCapturedMail),_e=Z(H.sendTestMail),Me=l(a=>{let e=(0,be.c)(36),{limit:s}=a,o=se(),p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];let{data:I,error:y,errorSource:w,isLoading:g,poll:P,refetch:c}=oe(H.getCapturedMail,p),[C,f]=(0,v.useState)(null),[q,k]=(0,v.useState)(null),[i,u]=(0,v.useState)("html"),[x,B]=(0,v.useState)(""),r=I?.entries??[],m=y??C,D=y===null?C:w,S;e[2]!==o||e[3]!==c?(S=l(async()=>{f(null);try{await o.query(Le,{},ee("")),k(null),c()}catch(d){f(te(d))}},"S"),e[2]=o,e[3]=c,e[4]=S):S=e[4];let R=S,T;e[5]!==o||e[6]!==c?(T=l(async()=>{f(null);try{await o.query(_e,{},ee("")),c()}catch(d){f(te(d))}},"T"),e[5]=o,e[6]=c,e[7]=T):T=e[7];let Q=T;de(P,!0);let j;e[8]!==R?(j=l(()=>{ae(R())},"k"),e[8]=R,e[9]=j):j=e[9];let U=j,L;e[10]!==Q?(L=l(()=>{ae(Q())},"A"),e[10]=Q,e[11]=L):L=e[11];let W=L,_;e[12]===Symbol.for("react.memo_cache_sentinel")?(_=l(d=>{B(d.currentTarget.value)},"E"),e[12]=_):_=e[12];let G=_,M;e[13]===Symbol.for("react.memo_cache_sentinel")?(M=l(d=>{let{id:h}=d.currentTarget.dataset;h!==void 0&&k(h)},"_"),e[13]=M):M=e[13];let J=M,z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=l(d=>{let h=d.currentTarget.dataset.tab;(h==="headers"||h==="html"||h==="text")&&u(h)},"L"),e[14]=z):z=e[14];let K=z,$=Te(r,x),A=je($,q),n=Se(A),O;e[15]!==n?(O=l(()=>{n!==void 0&&le(n)},"j"),e[15]=n,e[16]=O):O=e[16];let V=O,F;e[17]!==n?(F=l(()=>{n!==void 0&&"window"in globalThis&&globalThis.window.open(n,"_blank","noopener")},"$"),e[17]=n,e[18]=F):F=e[18];let X=F,E;return e[19]!==r||e[20]!==m||e[21]!==D||e[22]!==x||e[23]!==g||e[24]!==n||e[25]!==U||e[26]!==V||e[27]!==G||e[28]!==X||e[29]!==J||e[30]!==K||e[31]!==W||e[32]!==A||e[33]!==i||e[34]!==$?(E={entries:r,error:m,errorSource:D,filter:x,isLoading:g,link:n,onClear:U,onCopyLink:V,onFilterChange:G,onOpenLink:X,onSelectMessage:J,onSelectTab:K,onSendTest:W,selected:A,tab:i,visible:$},e[19]=r,e[20]=m,e[21]=D,e[22]=x,e[23]=g,e[24]=n,e[25]=U,e[26]=V,e[27]=G,e[28]=X,e[29]=J,e[30]=K,e[31]=W,e[32]=A,e[33]=i,e[34]=$,e[35]=E):E=e[35],E},"Ae"),ze=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,$e=l(a=>`${ze}${a}`,"_e"),Ke=l(({limit:a=100})=>{let e=ce(),{entries:s,error:o,errorSource:p,filter:I,isLoading:y,link:w,onClear:g,onCopyLink:P,onFilterChange:c,onOpenLink:C,onSelectMessage:f,onSelectTab:q,onSendTest:k,selected:i,tab:u,visible:x}=Me({limit:a}),B=l(r=>e(r==="html"?"HTML":r==="text"?"Plain text":"Headers"),"H");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(b,{"data-testid":"mail-send-test",onClick:k,size:"sm",type:"button",variant:"outline",children:e("Send test")}),(0,t.jsx)(b,{"data-testid":"mail-clear",disabled:s.length===0,onClick:g,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&(0,t.jsx)(ue,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&(0,t.jsx)(pe,{error:p,testId:"mail-error"}),o===null&&!y&&s.length===0&&(0,t.jsx)(he,{description:e("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M4 5h16v14H4z"}),(0,t.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(me,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:c,placeholder:e("Filter messages"),type:"search",value:I}),(0,t.jsx)(fe,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,t.jsx)("ul",{className:"divide-y",children:x.map(r=>{let m=r.id===i?.id;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${m?"bg-muted":""}`,"data-active":m,"data-id":r.id,"data-testid":"mail-list-item",onClick:f,type:"button",children:[(0,t.jsx)("span",{className:"w-full truncate font-medium",children:r.subject||e("(no subject)")}),(0,t.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:N(r.to)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:re(r.capturedAt,"\u2014")})]})},r.id)})})})]}),i!==void 0&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:i.subject||e("(no subject)")}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,t.jsx)("dt",{children:e("From")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:i.from??"\u2014"}),(0,t.jsx)("dt",{children:e("To")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:N(i.to)}),i.cc!==void 0&&i.cc.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dt",{children:e("Cc")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:N(i.cc)})]}),(0,t.jsx)("dt",{children:e("Sent")}),(0,t.jsx)("dd",{className:"tabular-nums",children:re(i.capturedAt,"\u2014")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,t.jsx)(b,{"data-testid":"mail-copy-link",disabled:w===void 0,onClick:P,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),(0,t.jsx)(b,{"data-testid":"mail-open-link",disabled:w===void 0,onClick:C,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),(0,t.jsx)(ye,{}),(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(r=>(0,t.jsx)(b,{"aria-selected":u===r,"data-tab":r,"data-testid":`mail-tab-${r}`,onClick:q,role:"tab",size:"sm",type:"button",variant:u===r?"secondary":"ghost",children:B(r)},r))}),(0,t.jsxs)("div",{className:"min-h-[12rem]",children:[u==="html"&&(i.html===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):(0,t.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:$e(i.html),title:e("Email preview")})),u==="text"&&(i.text===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:i.text})),u==="headers"&&(i.headers===void 0||Object.keys(i.headers).length===0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(i.headers).map(([r,m])=>`${r}: ${m}`).join(`
2
+ `)}))]})]})]})]})},"Qe");export{Ke as MailPanel};
@@ -0,0 +1,10 @@
1
+ import{a as Ie,b as Te,c as $e,d as je,e as Ee}from"./chunk-JQBVRWFN.js";import"./chunk-T7UKRA6J.js";import{c as Se}from"./chunk-LOEVTOKP.js";import"./chunk-UL5XVKGR.js";import{a as Ce}from"./chunk-MNN3YCKF.js";import"./chunk-CQDENTSP.js";import"./chunk-LMCBMC2V.js";import"./chunk-QF743FSL.js";import"./chunk-IQ5CIBXJ.js";import"./chunk-YNCZVYCO.js";import"./chunk-OWRWDDJT.js";import"./chunk-QHVUXMRV.js";import"./chunk-2NUCBQFU.js";import{a as ke}from"./chunk-YLC2ZYCL.js";import{b as he}from"./chunk-EDL46BPM.js";import{a as Ne}from"./chunk-W5BTAOHO.js";import"./chunk-4KPATTV6.js";import"./chunk-N7FOBAV3.js";import"./chunk-2D4WBSDO.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as se}from"./chunk-CBTPJPCZ.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import"./chunk-L27FKJTG.js";import{a as Q}from"./chunk-LYVYUTQY.js";import{c as xe,d as ve}from"./chunk-LRUYEVHH.js";import{a as pe,e as fe}from"./chunk-XV2XEUUB.js";import{c as oe,d as be,n as ye}from"./chunk-QFN62JQJ.js";import"./chunk-ZPQBVYNN.js";import{B as re,b as Y,h as te,i as B,j as U,s as le}from"./chunk-2ZJJH4YN.js";import"./chunk-PDBW6GTJ.js";import{a as Je}from"./chunk-A6TVTNKO.js";import{a as Pe,b as Ve}from"./chunk-ADABTCDI.js";import{a,d as me}from"./chunk-5PEAXTYQ.js";var ce=me(Je(),1);var E=me(Pe(),1);var m=me(Ve(),1);var We=a(t=>`${JSON.stringify({end:!0,rows:t})}
2
+ `,"Ue"),ze=a(t=>{if(t===null||typeof t!="object"||Array.isArray(t))return;let e=t;if(!(e.end!==!0||e.table!==void 0))return typeof e.rows=="number"&&Number.isSafeInteger(e.rows)&&e.rows>=0?e.rows:Number.NaN},"Ve"),He=a(()=>{let t=0,e;return{problem:a(()=>e===void 0?'the export has no end marker: it was written before exports carried an end marker, or it was cut short. If you have checked that the file is complete, append {"end":true,"rows":N} as its last line, N being its exact row count':e===t?void 0:`the export's end marker declares ${String(e)} row(s) but ${String(t)} were read`,"problem"),read:a(r=>{if(e!==void 0)throw new Error("the export continues after its end marker");let n=ze(r);return n===void 0?(t+=1,!0):(e=n,!1)},"read")}},"Xe"),_=class extends Error{static{a(this,"Z")}problem;constructor(e){super(e.kind),this.name="CsvFormatError",this.problem=e}},Ze="\uFEFF",Ge=a(()=>{let t=[],e=1,r=!1,n=!1,o="start",l="",i=a(()=>{t.push(o==="closing"||l!==""?l:void 0),o="start",l=""},"l"),c=a(s=>{i(),t.some(p=>p!==void 0)&&s.push({cells:t,number:e}),t=[],e+=1},"c"),u=a((s,p)=>{let f=r;if(r=!1,!(f&&s===`
3
+ `)){if(o==="quoted"){s==='"'?o="closing":l+=s;return}if(o==="closing"&&s==='"'){l+=s,o="quoted";return}if(s===","){i();return}if(s==="\r"){c(p),r=!0;return}if(s===`
4
+ `){c(p);return}if(o==="closing")throw new _({kind:"text-after-quote",record:e});if(o==="start"&&s==='"'){o="quoted";return}o="unquoted",l+=s}},"d");return{finish:a(()=>{if(o==="quoted")throw new _({kind:"unterminated-quote",record:e});let s=[];return c(s),s},"finish"),push:a(s=>{let p=[],f=0;for(!n&&s!==""&&(n=!0,f=s.startsWith(Ze)?1:0);f<s.length;f+=1)u(s.charAt(f),p);return p},"push")}},"He"),Oe=a(async function*(t){let e=Ge();for await(let r of t)yield*e.push(r);yield*e.finish()},"be"),ie=a((t,e,r)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0})},"ne"),Ae=a(t=>{let e=[],r=new Set;return t.forEach((n,o)=>{let l=(n??"").trim();if(l==="")throw new _({column:o+1,kind:"empty-header"});if(r.has(l))throw new _({kind:"duplicate-header",name:l});r.add(l),e.push(l)}),e},"Ne"),Ke=a(({cells:t,number:e},r,n)=>{if(t.length!==r.length)throw new _({expected:r.length,found:t.length,kind:"ragged",record:e});let o={};return r.forEach((l,i)=>{let c=t[i];c!==void 0?ie(o,l,c):n.has(l)&&ie(o,l,null)}),{doc:o,record:e}},"Ce"),Qe=/^-?\d+$/u,Xe=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/iu,Ye=/^-?\d{11,}$/u,et=/^(\d{4})-(\d{2})-(\d{2})$/u,tt=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/u,rt=/\.(\d+)/u,nt=/[1-9]/u,ot=/^[+-]?(\d*)(?:\.(\d*))?(?:e([+-]?\d+))?$/iu,Le=a(t=>{let[,e="",r="",n="0"]=ot.exec(t)??[],o=`${e}${r}`,l=0,i=o.length;for(;l<i&&o.charAt(l)==="0";)l+=1;for(;i>l&&o.charAt(i-1)==="0";)i-=1;return l===i?{digits:"",exponent:0}:{digits:o.slice(l,i),exponent:Number(n)-r.length+(o.length-i)}},"he"),lt=a((t,e)=>{let r=Le(t),n=Le(e.toExponential());return r.digits===n.digits&&r.exponent===n.exponent?!0:r.digits!==""&&r.exponent>=0&&Number.isInteger(e)&&BigInt(r.digits)*10n**BigInt(r.exponent)===BigInt(Math.abs(e))},"rt"),st=a(t=>{let e=t.trim();if(!Xe.test(e))return;let r=Number(e);if(Number.isFinite(r))return lt(e,r)?{number:r}:{inexact:!0}},"nt"),at=a((t,e,r)=>{let n=new Date(0);return n.setUTCFullYear(t,e-1,r),n.getUTCMonth()===e-1&&n.getUTCDate()===r},"ot"),it=a((t,e,r,n)=>Number(t)<=23&&Number(e)<=59&&Number(r)<=59&&(n==="Z"||Number(n.slice(1,3))<=23&&Number(n.slice(4,6))<=59),"st"),dt=a(t=>{let[e="",r,...n]=t.split("T"),o=et.exec(e),l=r===void 0?void 0:tt.exec(r);if(o===null||n.length>0||r!==void 0&&l===null)return;let[,i="",c="",u=""]=o;if(!at(Number(i),Number(c),Number(u)))return;let[,s="0",p="0",f="0",w]=l??[];if(!it(s,p,f,w??"Z"))return;let g=rt.exec(r??"")?.[1]??"";if(nt.test(g.slice(3)))return;let x=Date.parse(l!==void 0&&w===void 0?`${t}Z`:t);return Number.isFinite(x)?x:void 0},"it"),ct=a(t=>{let e=st(t);return e===void 0?{expected:"number",kind:"rejected"}:"number"in e?{kind:"ok",value:e.number}:{expected:"number",inexact:!0,kind:"rejected"}},"lt"),ut=a(t=>{let e=t.trim(),r=dt(e);return r===void 0&&Ye.test(e)&&(r=Number(e)),r===void 0||!Number.isFinite(new Date(r).getTime())?{expected:"date",kind:"rejected"}:{kind:"ok",value:r}},"at"),mt=a(t=>{try{return oe(t),!0}catch{return!1}},"ct"),pt=a((t,e)=>{if(e==="bigint"){let r=t.trim();if(!Qe.test(r))return{expected:"bigint",kind:"rejected"};let n=BigInt(r);return mt(n)?{kind:"ok",value:n}:{expected:"bigint",kind:"rejected",tooLong:!0}}if(e==="boolean"){let r=t.trim().toLowerCase();return r==="true"||r==="false"?{kind:"ok",value:r==="true"}:{expected:"boolean",kind:"rejected"}}return e==="number"?ct(t):e==="date"||e==="timestamp"?ut(t):{kind:"ok",value:t}},"dt"),De=a(({doc:t,record:e},r)=>{let n={};for(let[o,l]of Object.entries(t)){if(l===null){ie(n,o,null);continue}let i=pt(l,r.get(o));if(i.kind==="rejected")throw new _({column:o,expected:i.expected,...i.inexact===!0&&{inexact:!0},kind:"cell-type",record:e,...i.tooLong===!0&&{tooLong:!0},value:l});ie(n,o,i.value)}return{doc:n,record:e}},"ke"),ft=a(async function*(t,e,r){let n;for await(let o of Oe(t))n===void 0?n=Ae(o.cells):yield De(Ke(o,n,r),e)},"ut"),ht=a(t=>new Set(t.filter(e=>e.nullable===!0&&!e.optional).map(e=>e.name)),"ft"),qe=a(t=>{if(t instanceof _)return t;throw t},"we"),wt=a(async(t,e,r,n)=>{let o,l,i;for await(let u of Oe(t)){if(o===void 0){try{o=Ae(u.cells)}catch(p){l=qe(p),o=[]}continue}let s;try{s=De(Ke(u,o,r),e)}catch(p){i??=qe(p);continue}n(s)}let c=l??i;if(c!==void 0)throw c},"mt"),Be=te(Q.exportShard),ne=te(Q.importShard),gt=te(Q.listTables),bt=te(Q.describeTable),yt={},xt=a(t=>t.map(e=>JSON.stringify(oe(e))).join(`
5
+ `),"gt"),vt=a((t,e)=>{let r=be(t);if(typeof r!="object"||r===null)throw new Y("INTERNAL",`line ${e.toString()}: expected a { table, doc } object`);let n=r;if(typeof n.table!="string"||typeof n.doc!="object"||n.doc===null||Array.isArray(n.doc))throw new Y("INTERNAL",`line ${e.toString()}: expected a { table, doc } object`);return n},"yt"),Fe=1024*1024,we=a(async function*(t){let e=new TextDecoder("utf-8",{fatal:!0});for(let n=0;n<t.size;n+=Fe){let o=await t.slice(n,n+Fe).arrayBuffer();yield e.decode(o,{stream:!0})}let r=e.decode();r!==""&&(yield r)},"fe"),Nt=a(async function*(t){let e="",r=0;for await(let n of we(t)){let o=`${e}${n}`.split(`
6
+ `);e=o.pop()??"";for(let l of o)r+=1,yield{line:l,lineNumber:r}}e!==""&&(yield{line:e,lineNumber:r+1})},"xt"),kt=a(async function*(t){let e=He();for await(let{line:n,lineNumber:o}of Nt(t)){let l=n.trim();if(l==="")continue;let i=JSON.parse(l);e.read(i)&&(yield{line:o,row:vt(i,o)})}let r=e.problem();if(r!==void 0)throw new Y("INTERNAL",r)},"vt"),Ct=a(async function*(t,e,r,n){for await(let{doc:o,record:l}of ft(we(t),r,n))yield{line:l,row:{doc:o,table:e}}},"bt"),St=a(async(t,e,r,n)=>{try{let{columns:o}=await t.query(bt,{table:n},B(r));return{kinds:new Map(o.map(l=>[l.name,l.type])),nullOnEmpty:ht(o)}}catch(o){return{failure:e("Couldn't read the columns of {table}: {message}",{message:U(o),table:n})}}},"Nt"),Re=50,It=500,ue=9e5,ge=a(t=>new TextEncoder().encode(JSON.stringify(oe(t))).byteLength,"me"),ae="application/x-ndjson",_e=a(t=>new Y("INTERNAL",`line ${t.toString()}: a single row is over the ${ue.toString()}-byte import limit`),"Ie"),Tt=a(async t=>{let e=0;for await(let{line:r,row:n}of t){if(ge(n)>ue)throw _e(r);e+=1}return e},"kt"),$t=a(async(t,e,r,n)=>{let o={rows:0};if(await wt(we(t),r,n,({doc:l,record:i})=>{o.rows+=1,o.wide===void 0&&ge({doc:l,table:e})>ue&&(o.wide=i)}),o.wide!==void 0)throw _e(o.wide);return o.rows},"St"),de=a(async(t,e)=>{let r=[],n=0,o=0,l=0;for await(let{line:i,row:c}of t){let u=ge(c),s=i!==l+1;r.length>0&&(s||r.length===It||n+u>ue)&&(await e(r,o),r=[],n=0),r.length===0&&(o=i),r.push(c),n+=u,l=i}r.length>0&&await e(r,o)},"oe"),jt=/\.csv$/iu,Et=a(t=>jt.test(t.name)||t.type==="text/csv","Et"),Lt=a((t,e)=>t.expected==="boolean"?e("line {line}: column \u201C{column}\u201D must be true or false, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.tooLong===!0?e("line {line}: column \u201C{column}\u201D holds an integer longer than the import can send.",{column:t.column,line:t.record}):t.expected==="bigint"?e("line {line}: column \u201C{column}\u201D must be an integer, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.expected==="date"?e("line {line}: column \u201C{column}\u201D must be an ISO-8601 date or epoch milliseconds of at least 11 digits, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.inexact===!0?e("line {line}: column \u201C{column}\u201D holds \u201C{value}\u201D, which a number column cannot store exactly. Store a whole number past 9007199254740991 in a bigint column.",{column:t.column,line:t.record,value:t.value}):e("line {line}: column \u201C{column}\u201D must be a number, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}),"Tt"),qt=a((t,e)=>t.kind==="duplicate-header"?e("The header \u201C{name}\u201D appears more than once.",{name:t.name}):t.kind==="empty-header"?e("Header column {column} is empty.",{column:t.column}):t.kind==="ragged"?e("line {line}: expected {expected} cells, found {found}.",{expected:t.expected,found:t.found,line:t.record}):t.kind==="cell-type"?Lt(t,e):t.kind==="text-after-quote"?e("line {line}: text follows a closing quote.",{line:t.record}):e("line {line}: a quoted field is never closed.",{line:t.record}),"Rt"),Ft=a((t,e,r)=>{let n=e instanceof _?qt(e.problem,r):U(e);return t===null?r("Invalid NDJSON: {message}",{message:n}):r("Invalid CSV: {message}",{message:n})},"_t"),Rt=a(t=>{let e=(0,ce.c)(31),{onChange:r,shardKey:n,value:o}=t,l=re(),i;e[0]!==n?(i={shardKey:n},e[0]=n,e[1]=i):i=e[1];let{data:c}=xe(Q.listTables,yt,i),u;e[2]!==r?(u=a(j=>{r(j??"")},"d"),e[2]=r,e[3]=u):u=e[3];let s;e[4]!==l?(s=l("Target table"),e[4]=l,e[5]=s):s=e[5];let p;e[6]!==l?(p=l("Choose a table"),e[6]=l,e[7]=p):p=e[7];let f;e[8]!==p?(f=(0,m.jsx)(Te,{placeholder:p}),e[8]=p,e[9]=f):f=e[9];let w;e[10]!==s||e[11]!==f?(w=(0,m.jsx)($e,{"aria-label":s,className:"w-56","data-testid":"ei-csv-table",children:f}),e[10]=s,e[11]=f,e[12]=w):w=e[12];let g;e[13]!==c?(g=c??[],e[13]=c,e[14]=g):g=e[14];let x;e[15]!==g?(x=g.map(Vt),e[15]=g,e[16]=x):x=e[16];let C;e[17]!==x?(C=(0,m.jsx)(je,{children:x}),e[17]=x,e[18]=C):C=e[18];let d;e[19]!==u||e[20]!==w||e[21]!==C||e[22]!==o?(d=(0,m.jsxs)(Ie,{onValueChange:u,value:o,children:[w,C]}),e[19]=u,e[20]=w,e[21]=C,e[22]=o,e[23]=d):d=e[23];let b;e[24]!==l?(b=l("CSV rows have no table column, so choose the table they go into."),e[24]=l,e[25]=b):b=e[25];let y;e[26]!==b?(y=(0,m.jsx)("p",{className:"text-xs text-muted-foreground",children:b}),e[26]=b,e[27]=y):y=e[27];let N;return e[28]!==d||e[29]!==y?(N=(0,m.jsxs)("div",{className:"flex flex-col gap-1.5",children:[d,y]}),e[28]=d,e[29]=y,e[30]=N):N=e[30],N},"Ft"),Me=a(t=>Object.values(t).reduce((e,r)=>e+r,0),"Ee"),Ue=a(t=>t.map((e,r)=>({line:r+1,row:e})),"Te"),Ot=a(async t=>{let e=new Map;for await(let{row:r}of t){let n=e.get(r.table)??{duplicates:0,ids:new Set,rows:0,unkeyed:0},o=r.doc._id;e.set(r.table,n),n.rows+=1,typeof o=="string"?(n.ids.has(o)&&(n.duplicates+=1),n.ids.add(o)):n.unkeyed+=1}return e},"$t"),At=a(async(t,e,r,n)=>{let o=await Ot(r),l=n==="replace"?[...o].find(([,s])=>s.unkeyed>0):void 0;if(l!==void 0)throw new Y("INTERNAL",`Replace needs every row to carry an _id: ${l[1].unkeyed.toString()} row(s) of ${l[0]} have none`);let i=[],c=[],u=[];for(let[s,p]of[...o].toSorted(([f],[w])=>f.localeCompare(w))){let{rows:f}=await t.query(Be,{tables:[s]},B(e)),w=p.rows-p.duplicates,g=p.duplicates,x=0;for(let C of f){let d=C.doc._id;typeof d=="string"&&p.ids.has(d)?(g+=1,w-=1):n==="replace"&&typeof d=="string"&&(x+=1,i.push({doc:{_id:d},op:"delete",table:s}))}u.push({stored:f.length,table:s}),c.push(`${s}: ${p.rows.toString()} in file, ${f.length.toString()} stored \u2014 ${w.toString()} to add, ${g.toString()} existing, ${x.toString()} to delete`)}return{deletions:i,lines:c,tables:u}},"Lt"),Kt=a(async t=>{let{client:e,mode:r,onConflict:n,planOnly:o,shardKey:l,source:i,t:c}=t;if(r!=="replace"&&r!=="require-empty"&&!o)return{deletions:[]};let u;try{u=await At(e,l,i(),r)}catch(f){return{failure:{message:U(f),rows:0}}}let s=u.tables.find(f=>f.stored>0);if(r==="require-empty"&&s!==void 0)return{failure:{message:c("Nothing was sent: --mode require-empty needs the file's tables to hold no rows, and {table} already holds {count}.",{count:s.stored,table:s.table}),rows:0},plan:u.lines};let p={conflicts:0,errors:[],inserted:{}};if(!o&&u.deletions.length>0){try{await de(Ue(u.deletions),async(f,w)=>{let g=await e.query(ne,{deletes:!0,dryRun:!0,onConflict:n,rows:f,startLine:w},B(l));p.errors.push(...g.errors)})}catch(f){return{failure:{message:U(f),rows:0}}}if(p.errors.length>0)return{failure:{message:c("Nothing was written, because some deletes would be refused. Fix the rows listed below and import again."),rows:0},total:p}}return{deletions:u.deletions,plan:u.lines}},"Ot"),Dt=a(async t=>{let{client:e,deletions:r,onConflict:n,onProgress:o,shardKey:l,t:i,total:c}=t;if(await de(Ue(r),async(u,s)=>{o(i("Deleting {count} stored rows the file lacks\u2026",{count:r.length}));let p=await e.query(ne,{deletes:!0,dryRun:!1,onConflict:n,rows:u,startLine:s},B(l));c.deleted=(c.deleted??0)+(p.deleted??0),c.errors.push(...p.errors)}),c.errors.length>0)throw new Error(c.errors[0]?.message??"a delete was refused")},"At"),Bt=a((t,e)=>e(t==="replace"?"Import (overwrites rows and may delete rows)?":t==="upsert"?"Import (overwrites rows)?":"Import (writes rows)?"),"jt"),_t=a((t,e,r,n)=>t.dryRun!==!0?n("This shard predates import checks, so it would write the file while checking it. Nothing was sent. Update the app and import again."):r==="replace"&&typeof t.replaced!="number"?n("This shard cannot overwrite existing rows. Nothing was sent. Update the app and import again."):e==="replace"&&typeof t.deleted!="number"?n("This shard cannot delete rows. Nothing was sent. Update the app and import again."):void 0,"Dt"),Mt=a((t,e,r)=>t===void 0?{result:e}:t.unknownFrom===void 0&&(t.refused===!0||t.rows===0)?{error:t.message,...e.errors.length>0?{result:e}:{}}:t.unknownFrom===void 0?{error:r("Import stopped after {rows} rows: {message}. The counts below cover those rows. Rows from line {line} onward were not sent: do not import the whole file again, import from that line onward, or delete the written rows first and then import the whole file.",{line:t.nextLine,message:t.message,rows:t.rows}),result:e}:{error:r("Import stopped after {rows} rows: {message}. The counts below cover completed chunks only. The chunk from line {line} may have written rows: check the table for rows from line {line} onward before importing again, or delete the written rows first and then import the whole file.",{line:t.unknownFrom,message:t.message,rows:t.rows}),result:e},"qt"),Ut=a(async(t,e,r,n,o,l,i,c)=>{let u=i==="upsert"||i==="replace"?"replace":"skip",s={conflicts:0,deleted:0,errors:[],inserted:{},replaced:0},p,f=l===null?{kinds:new Map,nullOnEmpty:new Set}:await St(t,e,r,l);if("failure"in f)return{failure:{message:f.failure,rows:0},total:s};let{kinds:w,nullOnEmpty:g}=f;try{if(l===null){let h=a(()=>kt(o),"p");p={rows:await Tt(h()),source:h}}else p={rows:await $t(o,l,w,g),source:a(()=>Ct(o,l,w,g),"source")}}catch(h){return{failure:{message:Ft(l,h,e),rows:0},total:s}}let{rows:x,source:C}=p;if(l!==null&&x===0)return{failure:{message:e("The CSV has no data rows after the header."),rows:0},total:s};let d={conflicts:0,errors:[],inserted:{}};n(e("Checking {total} rows before writing\u2026",{total:x}));try{let h=await t.query(ne,{dryRun:!0,onConflict:u,rows:[],startLine:1},B(r)),S=_t(h,i,u,e);if(S!==void 0)return{failure:{message:S,rows:0},total:s};await de(C(),async(v,I)=>{let F=await t.query(ne,{dryRun:!0,onConflict:u,rows:v,startLine:I},B(r));d.errors.push(...F.errors)})}catch(h){return{failure:{message:U(h),rows:0},total:s}}if(d.errors.length>0)return{failure:{message:e("Nothing was written, because some rows would be refused. Fix the rows listed below and import again."),rows:0},total:d};let b=await Kt({client:t,mode:i,onConflict:u,planOnly:c,shardKey:r,source:C,t:e});if("failure"in b)return{failure:b.failure,plan:b.plan,total:b.total??s};if(c)return{failure:void 0,plan:b.plan,total:s};let{deletions:y}=b,N=0,j=1,A={},L={},q=a(async(h,S)=>{n(e("Importing rows {from}\u2013{to} of {total}\u2026",{from:N+1,to:N+h.length,total:x})),L.startLine=S;let v=await t.query(ne,{dryRun:!1,onConflict:u,rows:h,startLine:S},B(r));L.startLine=void 0,s.conflicts+=v.conflicts,s.deleted=(s.deleted??0)+(v.deleted??0),s.replaced=(s.replaced??0)+(v.replaced??0),s.errors.push(...v.errors);for(let[I,F]of Object.entries(v.inserted))s.inserted[I]=(s.inserted[I]??0)+F;if(N+=h.length,j=S+h.length,v.errors.length>0){let I=Me(s.inserted)+(s.replaced??0);throw A.refused=!0,new Error(I===0?e("The shard refused {count} rows, so the rest of the file was not sent. Nothing was written. Fix the rows listed below and import again.",{count:v.errors.length}):e("The shard refused {count} rows, so the rest of the file was not sent. {written} rows were already written, so do not import the whole file again. Import the refused rows and any rows from line {line} onward, or delete the written rows first and then import the whole file.",{count:v.errors.length,line:S+h.length,written:I}))}},"F");try{await de(C(),q);try{await Dt({client:t,deletions:y,onConflict:u,onProgress:n,shardKey:r,t:e,total:s})}catch(h){return{failure:{message:e("Every file row is written, but removing the stored rows the file lacks failed: {message}. Import again to finish the deletes.",{message:U(h)}),refused:!0,rows:N},total:s}}return{failure:void 0,total:s}}catch(h){return{failure:{message:U(h),nextLine:j,rows:N,unknownFrom:L.startLine,...A},total:s}}},"Pt"),Pt=a(t=>{let e=(0,ce.c)(15),{result:r}=t,n=re(),o=r.deleted??0,l;e[0]!==r.conflicts||e[1]!==r.errors.length||e[2]!==r.inserted||e[3]!==r.replaced||e[4]!==n||e[5]!==o?(l=n("Inserted {inserted}, replaced {replaced}, deleted {deleted}, {conflicts} conflicts, {errors} errors.",{conflicts:r.conflicts,deleted:o,errors:r.errors.length,inserted:Me(r.inserted),replaced:r.replaced??0}),e[0]=r.conflicts,e[1]=r.errors.length,e[2]=r.inserted,e[3]=r.replaced,e[4]=n,e[5]=o,e[6]=l):l=e[6];let i;e[7]!==l?(i=(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:l}),e[7]=l,e[8]=i):i=e[8];let c;e[9]!==r.errors||e[10]!==n?(c=r.errors.length>0&&(0,m.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:r.errors.map(s=>(0,m.jsx)("li",{className:"text-xs text-destructive",children:n("line {line} ({table}): {message}",{line:s.line,message:s.message,table:s.table})},`${s.table}-${s.line.toString()}`))}),e[9]=r.errors,e[10]=n,e[11]=c):c=e[11];let u;return e[12]!==i||e[13]!==c?(u=(0,m.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[i,c]}),e[12]=i,e[13]=c,e[14]=u):u=e[14],u},"Bt"),Jt=a(t=>{let e=(0,ce.c)(79),{busy:r,csvFile:n,csvTarget:o,importReady:l,importResult:i,mode:c,onCsvTableChange:u,onFileChange:s,onModeChange:p,plan:f,progress:w,runImport:g,runPlan:x,shardKey:C}=t,d=re(),b;e[0]!==d?(b=d("Import"),e[0]=d,e[1]=b):b=e[1];let y;e[2]!==b?(y=(0,m.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,m.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:b})}),e[2]=b,e[3]=y):y=e[3];let N;e[4]!==d?(N=d("Import file"),e[4]=d,e[5]=N):N=e[5];let j;e[6]!==s||e[7]!==N?(j=(0,m.jsx)("input",{accept:".ndjson,.jsonl,.csv,application/x-ndjson,text/csv","aria-label":N,className:"text-sm","data-testid":"ei-file",onChange:s,type:"file"}),e[6]=s,e[7]=N,e[8]=j):j=e[8];let A;e[9]!==n||e[10]!==o||e[11]!==u||e[12]!==C?(A=n&&(0,m.jsx)(Rt,{onChange:u,shardKey:C,value:o}),e[9]=n,e[10]=o,e[11]=u,e[12]=C,e[13]=A):A=e[13];let L;e[14]!==d?(L=d("Import mode"),e[14]=d,e[15]=L):L=e[15];let q;e[16]!==d?(q=d("Append: rows whose _id already exists are left unchanged and counted as conflicts"),e[16]=d,e[17]=q):q=e[17];let h;e[18]!==q?(h=(0,m.jsx)("option",{value:"append",children:q}),e[18]=q,e[19]=h):h=e[19];let S;e[20]!==d?(S=d("Upsert: new _id values are inserted, rows whose _id already exists are overwritten, nothing is deleted"),e[20]=d,e[21]=S):S=e[21];let v;e[22]!==S?(v=(0,m.jsx)("option",{value:"upsert",children:S}),e[22]=S,e[23]=v):v=e[23];let I;e[24]!==d?(I=d("Replace: overwrite, then delete this shard's rows of the file's tables that the file lacks"),e[24]=d,e[25]=I):I=e[25];let F;e[26]!==I?(F=(0,m.jsx)("option",{value:"replace",children:I}),e[26]=I,e[27]=F):F=e[27];let M;e[28]!==d?(M=d("Require empty: refuse unless the file's tables hold no rows in this shard"),e[28]=d,e[29]=M):M=e[29];let P;e[30]!==M?(P=(0,m.jsx)("option",{value:"require-empty",children:M}),e[30]=M,e[31]=P):P=e[31];let J;e[32]!==c||e[33]!==p||e[34]!==v||e[35]!==F||e[36]!==P||e[37]!==h?(J=(0,m.jsxs)("select",{className:"rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground","data-testid":"ei-mode",id:"ei-mode",onChange:p,value:c,children:[h,v,F,P]}),e[32]=c,e[33]=p,e[34]=v,e[35]=F,e[36]=P,e[37]=h,e[38]=J):J=e[38];let V;e[39]!==J||e[40]!==L?(V=(0,m.jsxs)(Ce,{className:"flex flex-col gap-1 text-xs font-normal text-muted-foreground",htmlFor:"ei-mode",children:[L,J]}),e[39]=J,e[40]=L,e[41]=V):V=e[41];let W;e[42]!==c||e[43]!==d?(W=Bt(c,d),e[42]=c,e[43]=d,e[44]=W):W=e[44];let z=r||!l,H;e[45]!==d?(H=d("Import"),e[45]=d,e[46]=H):H=e[46];let Z;e[47]!==g||e[48]!==W||e[49]!==z||e[50]!==H?(Z=(0,m.jsx)(Ne,{confirmLabel:W,disabled:z,onConfirm:g,testId:"ei-import",children:H}),e[47]=g,e[48]=W,e[49]=z,e[50]=H,e[51]=Z):Z=e[51];let ee=r||!l,G;e[52]!==d?(G=d("Show plan"),e[52]=d,e[53]=G):G=e[53];let k;e[54]!==x||e[55]!==ee||e[56]!==G?(k=(0,m.jsx)(se,{"data-testid":"ei-plan",disabled:ee,onClick:x,type:"button",variant:"outline",children:G}),e[54]=x,e[55]=ee,e[56]=G,e[57]=k):k=e[57];let R;e[58]!==Z||e[59]!==k?(R=(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[Z,k]}),e[58]=Z,e[59]=k,e[60]=R):R=e[60];let T;e[61]!==w?(T=w!==null&&(0,m.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-progress",role:"status",children:w}),e[61]=w,e[62]=T):T=e[62];let O;e[63]!==f||e[64]!==d?(O=f!==null&&(0,m.jsx)("pre",{className:"whitespace-pre-wrap text-xs text-muted-foreground","data-testid":"ei-plan-result",children:[d("Import plan"),...f.map(Wt)].join(`
7
+ `)}),e[63]=f,e[64]=d,e[65]=O):O=e[65];let $;e[66]!==i?($=i!==null&&(0,m.jsx)(Pt,{result:i}),e[66]=i,e[67]=$):$=e[67];let K;e[68]!==V||e[69]!==R||e[70]!==T||e[71]!==O||e[72]!==$||e[73]!==j||e[74]!==A?(K=(0,m.jsxs)(fe,{className:"flex flex-col gap-3 p-4",children:[j,A,V,R,T,O,$]}),e[68]=V,e[69]=R,e[70]=T,e[71]=O,e[72]=$,e[73]=j,e[74]=A,e[75]=K):K=e[75];let D;return e[76]!==y||e[77]!==K?(D=(0,m.jsxs)(pe,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[y,K]}),e[76]=y,e[77]=K,e[78]=D):D=e[78],D},"Mt"),ir=a(({initialShardKey:t})=>{let e=ye(),r=ve(),n=re(),[o,l]=(0,E.useState)(t??""),[i,c]=(0,E.useState)(null),[u,s]=(0,E.useState)(null),[p,f]=(0,E.useState)(!1),[w,g]=(0,E.useState)(null),[x,C]=(0,E.useState)(null),[d,b]=(0,E.useState)(null),[y,N]=(0,E.useState)(null),[j,A]=(0,E.useState)("append"),[L,q]=(0,E.useState)(null),h=(0,E.useRef)(0),S=i!==null&&Et(i),v=u!==null&&u.shardKey===o?u.table:"",I=i!==null&&(!S||v!==""),F=a(async()=>{let k=o;f(!0),g(null),C(null),N(null);try{let R=await e.query(gt,{},B(k)),T=new Blob([],{type:ae}),O=0,$=[];for(let{name:K}of R){let{rows:D}=await e.query(Be,{tables:[K]},B(k));if(D.length===0)continue;let X=xt(D);T=new Blob([T,`${X}
8
+ `],{type:ae}),O+=D.length,$.length<Re&&$.push(...X.split(`
9
+ `).slice(0,Re-$.length))}T=new Blob([T,We(O)],{type:ae}),he(k),N({blob:T,count:O,preview:$.join(`
10
+ `),shardKey:k})}catch(R){g(U(R))}},"$"),M=a(async(k,R,T=!1)=>{f(!0),g(null),C(null),N(null),q(null);let O=h.current,{failure:$,plan:K,total:D}=await Ut(e,n,o,b,k,R,j,T);if(K!==void 0&&O===h.current&&q(K),$===void 0&&T)return;$===void 0&&he(o);let X=Mt($,D,n);X.result!==void 0&&C(X.result),X.error!==void 0&&g(X.error),r(Q.readTablePage),r(Q.listTables)},"P"),P=a(()=>{le(F().finally(()=>{f(!1)}))},"M"),J=a(()=>{i!==null&&I&&le(M(i,S?v:null).finally(()=>{b(null),f(!1)}))},"K"),V=a(()=>{i!==null&&I&&le(M(i,S?v:null,!0).finally(()=>{b(null),f(!1)}))},"U"),W=a(()=>{y!==null&&Se(`${y.shardKey.trim()===""?"shard":y.shardKey.trim()}.ndjson`,y.blob,ae)},"V"),z=a(()=>{h.current+=1,q(null)},"X"),H=a(k=>{c(k.target.files?.[0]??null),z(),s(null)},"J"),Z=a(k=>{s({shardKey:o,table:k}),z()},"H"),ee=a(k=>{A(k.target.value),z()},"Q"),G=a(k=>{l(k),z()},"W");return(0,m.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-export-import",children:[(0,m.jsxs)(pe,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,m.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,m.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Export")})}),(0,m.jsxs)(fe,{className:"flex flex-col gap-3 p-4",children:[(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,m.jsx)(ke,{onChange:G,testId:"ei-shard-input",value:o}),(0,m.jsx)(se,{"data-testid":"ei-export",disabled:p,onClick:P,type:"button",children:n("Export")})]}),y!==null&&(0,m.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,m.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,m.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:n("Exported {count} rows.",{count:y.count})}),(0,m.jsx)(se,{"data-testid":"ei-download",onClick:W,size:"sm",type:"button",variant:"outline",children:n("Download")})]}),y.preview!==""&&(0,m.jsx)("pre",{className:"max-h-60 overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"ei-preview",children:y.preview})]})]})]}),(0,m.jsx)(Jt,{busy:p,csvFile:S,csvTarget:v,importReady:I,importResult:x,mode:j,onCsvTableChange:Z,onFileChange:H,onModeChange:ee,plan:L,progress:d,runImport:J,runPlan:V,shardKey:o}),w!==null&&(0,m.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:w})]})},"ar");function Vt(t){return(0,m.jsx)(Ee,{value:t.name,children:t.name},t.name)}a(Vt,"Kt");function Wt(t){return` ${t}`}a(Wt,"Ut");export{ir as ExportImportPanel};
@@ -0,0 +1 @@
1
+ import{x as h}from"./chunk-2ZJJH4YN.js";import{a as b}from"./chunk-A6TVTNKO.js";import{b as j}from"./chunk-ADABTCDI.js";import{a as u,d as g}from"./chunk-5PEAXTYQ.js";var v=g(b(),1);var t=g(j(),1);var z=u(N=>{let e=(0,v.c)(19),{action:a,className:x,description:c,icon:m,testId:f,title:p}=N,s;e[0]!==x?(s=h("flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border px-6 py-14 text-center",x),e[0]=x,e[1]=s):s=e[1];let r;e[2]!==m?(r=m!==void 0&&(0,t.jsx)("span",{className:"flex size-10 items-center justify-center rounded-lg bg-muted text-muted-foreground [&_svg]:size-5",children:m}),e[2]=m,e[3]=r):r=e[3];let d;e[4]!==p?(d=(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:p}),e[4]=p,e[5]=d):d=e[5];let l;e[6]!==c?(l=c!==void 0&&(0,t.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:c}),e[6]=c,e[7]=l):l=e[7];let o;e[8]!==d||e[9]!==l?(o=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[d,l]}),e[8]=d,e[9]=l,e[10]=o):o=e[10];let i;e[11]!==a?(i=a!==void 0&&(0,t.jsx)("div",{className:"mt-1 flex items-center gap-2",children:a}),e[11]=a,e[12]=i):i=e[12];let n;return e[13]!==s||e[14]!==r||e[15]!==o||e[16]!==i||e[17]!==f?(n=(0,t.jsxs)("div",{className:s,"data-testid":f,children:[r,o,i]}),e[13]=s,e[14]=r,e[15]=o,e[16]=i,e[17]=f,e[18]=n):n=e[18],n},"y");export{z as a};
@@ -0,0 +1 @@
1
+ import{c as Me}from"./chunk-V5TGDG6U.js";import{c as ve}from"./chunk-LJLNIVUA.js";import{b as ye,c as we}from"./chunk-QLZGKBOW.js";import{a as xe}from"./chunk-ATBPQT7F.js";import{a as Ne}from"./chunk-NAGIOR23.js";import"./chunk-QHVUXMRV.js";import"./chunk-2NUCBQFU.js";import{a as be}from"./chunk-2KTN53PK.js";import{a as fe}from"./chunk-YLC2ZYCL.js";import{b as he}from"./chunk-EDL46BPM.js";import"./chunk-4KPATTV6.js";import{i as ue}from"./chunk-2D4WBSDO.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as pe}from"./chunk-HMMALUXM.js";import{b as ce}from"./chunk-BHUWAGFN.js";import"./chunk-L27FKJTG.js";import{a as ge}from"./chunk-JZN3MNJX.js";import"./chunk-EYSF4DHD.js";import"./chunk-ELPLRD4S.js";import"./chunk-NFI2TNKU.js";import"./chunk-EOFWXI3T.js";import{a as ie}from"./chunk-LYVYUTQY.js";import{c as de}from"./chunk-LRUYEVHH.js";import"./chunk-QFN62JQJ.js";import"./chunk-ZPQBVYNN.js";import{B as U,p as me,w as oe,x as te}from"./chunk-2ZJJH4YN.js";import"./chunk-PDBW6GTJ.js";import{a as Le}from"./chunk-A6TVTNKO.js";import{a as Ce,b as Te}from"./chunk-ADABTCDI.js";import{a as m,d as le}from"./chunk-5PEAXTYQ.js";var O=le(Le(),1),A=le(Ce(),1);var s=le(Te(),1);var Pe=.5,Ie=4,Se=m(n=>Math.min(100,Math.max(0,n)),"ce"),Ke=m((n,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};let t=Se(n.offsetMs/e*100),a=n.durationMs/e*100,l=Math.max(Pe,Math.min(Se(a),100-t));return{leftPercent:t,widthPercent:l}},"Ce"),De=m((n,e,t=!1)=>{let a=e.trim().toLowerCase(),l=t?n.filter(r=>!r.ok):n;return a===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(a)||r.functionPath.toLowerCase().includes(a)||r.traceId.toLowerCase().includes(a)||r.spans.some(o=>o.name.toLowerCase().includes(a)||o.spanId.toLowerCase().includes(a)))},"Ee"),G=m(n=>Number.isFinite(n)?n>0&&n<1?`${n.toFixed(2)}ms`:`${String(Math.round(n))}ms`:"\u2014","q"),je=m(n=>!Number.isFinite(n)||n<=0?[]:Array.from({length:Ie},(e,t)=>{let a=(t+1)/Ie;return{label:G(n*a),percent:a*100}}),"Pe"),ke=m(n=>{if(typeof n=="string")return n;try{return JSON.stringify(n,me)}catch{return String(n)}},"ue"),ee=m(n=>{let e=(0,O.c)(7),{label:t,value:a}=n,l;e[0]!==t?(l=(0,s.jsx)("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==a?(r=(0,s.jsx)("dd",{className:"min-w-0 break-all",children:a}),e[2]=a,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=(0,s.jsxs)("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},"Y"),Fe=m(n=>{let e=(0,O.c)(68),{span:t}=n,a=U(),l,r,o,d,i,u;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==a){let $=Object.entries(t.attributes??{}),_;e[15]!==t.events?(_=t.events??[],e[15]=t.events,e[16]=_):_=e[16],l=_,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let y;e[17]!==a?(y=a("Span ID"),e[17]=a,e[18]=y):y=e[18];let w;e[19]!==t.spanId||e[20]!==y?(w=(0,s.jsx)(ee,{label:y,value:t.spanId}),e[19]=t.spanId,e[20]=y,e[21]=w):w=e[21];let M;e[22]!==a?(M=a("Parent span ID"),e[22]=a,e[23]=M):M=e[23];let p;e[24]!==t.parentSpanId||e[25]!==a?(p=t.parentSpanId===""?a("\u2014 (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=a,e[26]=p):p=e[26];let h;e[27]!==p||e[28]!==M?(h=(0,s.jsx)(ee,{label:M,value:p}),e[27]=p,e[28]=M,e[29]=h):h=e[29];let b;e[30]!==a?(b=a("Kind"),e[30]=a,e[31]=b):b=e[31];let C=t.kind??"internal",S;e[32]!==b||e[33]!==C?(S=(0,s.jsx)(ee,{label:b,value:C}),e[32]=b,e[33]=C,e[34]=S):S=e[34];let I;e[35]!==a?(I=a("Started at"),e[35]=a,e[36]=I):I=e[36];let g;e[37]!==t.offsetMs||e[38]!==a?(g=a("+{offset}",{offset:G(t.offsetMs)}),e[37]=t.offsetMs,e[38]=a,e[39]=g):g=e[39];let x;e[40]!==I||e[41]!==g?(x=(0,s.jsx)(ee,{label:I,value:g}),e[40]=I,e[41]=g,e[42]=x):x=e[42];let k;e[43]!==a?(k=a("Duration"),e[43]=a,e[44]=k):k=e[44];let f;e[45]!==t.durationMs?(f=G(t.durationMs),e[45]=t.durationMs,e[46]=f):f=e[46];let N;e[47]!==k||e[48]!==f?(N=(0,s.jsx)(ee,{label:k,value:f}),e[47]=k,e[48]=f,e[49]=N):N=e[49],e[50]!==h||e[51]!==S||e[52]!==x||e[53]!==N||e[54]!==w?(d=(0,s.jsxs)("dl",{className:"flex flex-col gap-1",children:[w,h,S,x,N]}),e[50]=h,e[51]=S,e[52]=x,e[53]=N,e[54]=w,e[55]=d):d=e[55],e[56]!==t.error?(i=t.error!==void 0&&(0,s.jsxs)("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[(0,s.jsx)("span",{className:"font-semibold text-destructive",children:t.error.type}),(0,s.jsx)("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=i):i=e[57],u=$.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Attributes")}),(0,s.jsx)("dl",{className:"flex flex-col gap-1",children:$.map(Ee)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=a,e[9]=l,e[10]=r,e[11]=o,e[12]=d,e[13]=i,e[14]=u}else l=e[9],r=e[10],o=e[11],d=e[12],i=e[13],u=e[14];let c;e[58]!==l||e[59]!==a?(c=l.length>0&&(0,s.jsxs)("div",{className:"mt-2","data-testid":"tr-detail-events",children:[(0,s.jsx)("p",{className:"mb-1 text-muted-foreground",children:a("Events")}),(0,s.jsx)("ul",{className:"flex flex-col gap-1",children:l.map(Oe)})]}),e[58]=l,e[59]=a,e[60]=c):c=e[60];let v;return e[61]!==r||e[62]!==o||e[63]!==d||e[64]!==i||e[65]!==u||e[66]!==c?(v=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,i,u,c]}),e[61]=r,e[62]=o,e[63]=d,e[64]=i,e[65]=u,e[66]=c,e[67]=v):v=e[67],v},"Ke");function Ee(n){let[e,t]=n;return(0,s.jsx)(ee,{label:e,value:ke(t)},e)}m(Ee,"Fe");function Ae(n){let[e,t]=n;return`${e}=${ke(t)}`}m(Ae,"Re");function Oe(n){return(0,s.jsxs)("li",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:oe(n.ts)}),(0,s.jsx)(ce,{variant:"secondary",children:n.name}),(0,s.jsx)("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(n.attributes??{}).map(Ae).join(" ")})]},`${n.name}:${String(n.ts)}`)}m(Oe,"Ae");var Be=14,_e="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",We=m(n=>{let e=(0,O.c)(17),{traceDurationMs:t}=n,a,l,r,o,d,i;if(e[0]!==t){i=Symbol.for("react.early_return_sentinel");e:{let v=je(t);if(v.length===0){i=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=te(_e,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsx)("span",{}),e[8]=d):d=e[8],a="relative h-3",l=v.map(Je)}e[0]=t,e[1]=a,e[2]=l,e[3]=r,e[4]=o,e[5]=d,e[6]=i}else a=e[1],l=e[2],r=e[3],o=e[4],d=e[5],i=e[6];if(i!==Symbol.for("react.early_return_sentinel"))return i;let u;e[9]!==a||e[10]!==l?(u=(0,s.jsx)("span",{className:a,children:l}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==d||e[15]!==u?(c=(0,s.jsxs)("div",{className:r,"data-testid":o,children:[d,u]}),e[12]=r,e[13]=o,e[14]=d,e[15]=u,e[16]=c):c=e[16],c},"je"),qe=m(n=>{let e=(0,O.c)(60),{span:t,traceDurationMs:a}=n,l=U(),[r,o]=(0,A.useState)(!1),d;e[0]!==t||e[1]!==a?(d=Ke(t,a),e[0]=t,e[1]=a,e[2]=d):d=e[2];let{leftPercent:i,widthPercent:u}=d,c;e[3]!==t.attributes?(c=ve(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];let v=c,$=t.depth*Be,_;e[5]!==$?(_={paddingLeft:$},e[5]=$,e[6]=_):_=e[6];let y=_,w=`${String(i)}%`,M=`${String(u)}%`,p;e[7]!==w||e[8]!==M?(p={left:w,width:M},e[7]=w,e[8]=M,e[9]=p):p=e[9];let h=p,b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=m(()=>{o(Ue)},"h"),e[10]=b):b=e[10];let C=b,S=t.depth,I=`tr-span-detail-${t.spanId}`,g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:G(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:G(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=te(_e,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=x):x=e[17];let k=`tr-span-toggle-${t.spanId}`,f;e[18]!==t.ok?(f=t.ok?null:(0,s.jsx)("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"\u25CF"}),e[18]=t.ok,e[19]=f):f=e[19];let N;e[20]!==y||e[21]!==t.name||e[22]!==f?(N=(0,s.jsxs)("span",{className:"truncate",style:y,title:t.name,children:[f,t.name]}),e[20]=y,e[21]=t.name,e[22]=f,e[23]=N):N=e[23];let B=t.ok?"bg-primary/70":"bg-destructive",L;e[24]!==B?(L=te("absolute inset-y-0 rounded-sm",B),e[24]=B,e[25]=L):L=e[25];let E;e[26]!==h||e[27]!==i||e[28]!==L||e[29]!==u?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:(0,s.jsx)("span",{className:L,"data-left":i,"data-testid":"tr-span-bar","data-width":u,style:h})}),e[26]=h,e[27]=i,e[28]=L,e[29]=u,e[30]=E):E=e[30];let W;e[31]!==t.durationMs?(W=G(t.durationMs),e[31]=t.durationMs,e[32]=W):W=e[32];let D;e[33]!==W?(D=(0,s.jsx)("span",{className:"text-right tabular-nums text-muted-foreground",children:W}),e[33]=W,e[34]=D):D=e[34];let q;e[35]!==t.error?(q=t.error===void 0?null:(0,s.jsx)("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=q):q=e[36];let T;e[37]!==q?(T=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:q}),e[37]=q,e[38]=T):T=e[38];let z;e[39]!==v?(z=v===""?null:(0,s.jsx)("span",{"data-testid":"tr-span-attributes",title:v,children:v}),e[39]=v,e[40]=z):z=e[40];let P;e[41]!==z?(P=(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:z}),e[41]=z,e[42]=P):P=e[42];let J;e[43]!==r||e[44]!==I||e[45]!==g||e[46]!==k||e[47]!==N||e[48]!==E||e[49]!==D||e[50]!==T||e[51]!==P?(J=(0,s.jsxs)("button",{"aria-controls":I,"aria-expanded":r,"aria-label":g,className:x,"data-testid":k,onClick:C,type:"button",children:[N,E,D,T,P]}),e[43]=r,e[44]=I,e[45]=g,e[46]=k,e[47]=N,e[48]=E,e[49]=D,e[50]=T,e[51]=P,e[52]=J):J=e[52];let j;e[53]!==r||e[54]!==t?(j=r&&(0,s.jsx)("div",{id:`tr-span-detail-${t.spanId}`,children:(0,s.jsx)(Fe,{span:t})}),e[53]=r,e[54]=t,e[55]=j):j=e[55];let K;return e[56]!==t.depth||e[57]!==J||e[58]!==j?(K=(0,s.jsxs)("li",{"data-depth":S,"data-testid":"tr-span-row",children:[J,j]}),e[56]=t.depth,e[57]=J,e[58]=j,e[59]=K):K=e[59],K},"Be"),ze=m(n=>{let e=(0,O.c)(15),{durationMs:t,spans:a}=n,l=U(),r;e[0]!==t?(r=(0,s.jsx)(We,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let d;if(e[4]!==t||e[5]!==a){let c;e[7]!==t?(c=m(v=>(0,s.jsx)(qe,{span:v,traceDurationMs:t},v.spanId),"c"),e[7]=t,e[8]=c):c=e[8],d=a.map(c),e[4]=t,e[5]=a,e[6]=d}else d=e[6];let i;e[9]!==o||e[10]!==d?(i=(0,s.jsx)("ul",{"aria-label":o,children:d}),e[9]=o,e[10]=d,e[11]=i):i=e[11];let u;return e[12]!==r||e[13]!==i?(u=(0,s.jsxs)(s.Fragment,{children:[r,i]}),e[12]=r,e[13]=i,e[14]=u):u=e[14],u},"Oe");function Je(n){return(0,s.jsx)("span",{className:te("absolute inset-y-0 border-l border-border/70",n.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(n.percent)}%`},children:n.label},n.percent)}m(Je,"We");function Ue(n){return!n}m(Ue,"Ue");var Ge=m(n=>Array.isArray(n?.traces)?n.traces:[],"qe"),He=m(n=>{let e=(0,O.c)(12),{entries:t}=n,a=U(),l;e[0]!==t.length||e[1]!==a?(l=a("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=a,e[2]=l):l=e[2];let r;e[3]!==l?(r=(0,s.jsx)("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(Ve),e[5]=t,e[6]=o):o=e[6];let d;e[7]!==o?(d=(0,s.jsx)("div",{role:"grid",children:o}),e[7]=o,e[8]=d):d=e[8];let i;return e[9]!==r||e[10]!==d?(i=(0,s.jsxs)("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,d]}),e[9]=r,e[10]=d,e[11]=i):i=e[11],i},"ze"),Qe=m(n=>{let e=(0,O.c)(50),{expanded:t,logs:a,onToggle:l,trace:r}=n,o=U(),d;e[0]!==l||e[1]!==r.traceId?(d=m(()=>{l(r.traceId)},"i"),e[0]=l,e[1]=r.traceId,e[2]=d):d=e[2];let i=d,u=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,v=`tr-toggle-${r.traceId}`,$=t?"\u25BE":"\u25B8",_;e[3]!==$?(_=(0,s.jsx)("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=_):_=e[4];let y;e[5]!==r.rootName?(y=(0,s.jsx)("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=y):y=e[6];let w;e[7]!==r.functionPath?(w=(0,s.jsx)("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=w):w=e[8];let M;e[9]!==r.durationMs?(M=G(r.durationMs),e[9]=r.durationMs,e[10]=M):M=e[10];let p;e[11]!==M?(p=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:M}),e[11]=M,e[12]=p):p=e[12];let h;e[13]!==o||e[14]!==r.spans.length?(h=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=h):h=e[15];let b;e[16]!==h?(b=(0,s.jsx)("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:h}),e[16]=h,e[17]=b):b=e[17];let C=r.ok?"secondary":"destructive",S;e[18]!==o||e[19]!==r.ok?(S=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=S):S=e[20];let I;e[21]!==C||e[22]!==S?(I=(0,s.jsx)("span",{className:"shrink-0",children:(0,s.jsx)(ce,{variant:C,children:S})}),e[21]=C,e[22]=S,e[23]=I):I=e[23];let g;e[24]!==r.startTs?(g=oe(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let x;e[26]!==g?(x=(0,s.jsx)("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let k;e[28]!==t||e[29]!==i||e[30]!==p||e[31]!==b||e[32]!==I||e[33]!==x||e[34]!==c||e[35]!==v||e[36]!==_||e[37]!==y||e[38]!==w?(k=(0,s.jsxs)("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":v,onClick:i,type:"button",children:[_,y,w,p,b,I,x]}),e[28]=t,e[29]=i,e[30]=p,e[31]=b,e[32]=I,e[33]=x,e[34]=c,e[35]=v,e[36]=_,e[37]=y,e[38]=w,e[39]=k):k=e[39];let f;e[40]!==t||e[41]!==a||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(f=t&&(0,s.jsxs)("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[(0,s.jsx)(ze,{durationMs:r.durationMs,spans:r.spans}),a.length>0&&(0,s.jsx)(He,{entries:a})]}),e[40]=t,e[41]=a,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=f):f=e[45];let N;return e[46]!==k||e[47]!==f||e[48]!==u?(N=(0,s.jsxs)("div",{className:"border-b border-border last:border-b-0","data-testid":u,children:[k,f]}),e[46]=k,e[47]=f,e[48]=u,e[49]=N):N=e[49],N},"Ge"),bt=m(n=>{let e=(0,O.c)(60),{initialShardKey:t}=n,a=U(),[l]=(0,A.useState)(ye),{queryShardKey:r,setShardKey:o,shardKey:d}=be(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[i,u]=(0,A.useState)(l?.traceId??""),[c,v]=(0,A.useState)(!1),[$,_]=(0,A.useState)(Xe),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y=[],e[0]=y):y=e[0],(0,A.useEffect)(Ye,y);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={},e[1]=w):w=e[1];let M;e[2]!==r?(M={live:!0,shardKey:r},e[2]=r,e[3]=M):M=e[3];let{data:p,error:h,errorSource:b,isLoading:C,liveError:S}=de(ie.getTraces,w,M),I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I={},e[4]=I):I=e[4];let g=$.size>0,x;e[5]!==r||e[6]!==g?(x={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=x):x=e[7];let{data:k}=de(ie.getLogs,I,x),f,N;e[8]!==p||e[9]!==r?(f=m(()=>{p!==void 0&&he(r)},"p"),N=[p,r],e[8]=p,e[9]=r,e[10]=f,e[11]=N):(f=e[10],N=e[11]),(0,A.useEffect)(f,N);let B;if(e[12]!==p||e[13]!==h||e[14]!==b||e[15]!==$||e[16]!==C||e[17]!==S||e[18]!==k?.entries||e[19]!==c||e[20]!==r||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==a){let L=Ge(p),E=p?.total??L.length,W=E>L.length,D=De(L,i,c),q=Map.groupBy((k?.entries??[]).toReversed(),Ze),T;e[26]===Symbol.for("react.memo_cache_sentinel")?(T=m(F=>{u(F.target.value)},"C"),e[26]=T):T=e[26];let z=T,P;e[27]===Symbol.for("react.memo_cache_sentinel")?(P=m(F=>{_($e=>{let ne=new Set($e);return ne.has(F)?ne.delete(F):ne.add(F),ne})},"E"),e[27]=P):P=e[27];let J=P,j=h===null&&D.length===0&&!C,K;e[28]!==o||e[29]!==d?(K=(0,s.jsx)(fe,{onChange:o,testId:"tr-shard-input",value:d}),e[28]=o,e[29]=d,e[30]=K):K=e[30];let H;e[31]!==a?(H=a("Search traces"),e[31]=a,e[32]=H):H=e[32];let Q;e[33]!==a?(Q=a("search trace, span, or function"),e[33]=a,e[34]=Q):Q=e[34];let V;e[35]!==i||e[36]!==H||e[37]!==Q?(V=(0,s.jsx)(ue,{"aria-label":H,className:"h-8 w-56","data-testid":"tr-search",onChange:z,placeholder:Q,value:i}),e[35]=i,e[36]=H,e[37]=Q,e[38]=V):V=e[38];let X;e[39]!==c?(X=(0,s.jsx)(xe,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:v}),e[39]=c,e[40]=X):X=e[40];let Y;e[41]!==a?(Y=a("Errors only"),e[41]=a,e[42]=Y):Y=e[42];let Z;e[43]!==X||e[44]!==Y?(Z=(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[X,Y]}),e[43]=X,e[44]=Y,e[45]=Z):Z=e[45];let R;e[46]!==S?(R=(0,s.jsx)(Ne,{message:S,prefix:"tr"}),e[46]=S,e[47]=R):R=e[47];let re;e[48]!==K||e[49]!==V||e[50]!==Z||e[51]!==R?(re=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[K,V,Z,R]}),e[48]=K,e[49]=V,e[50]=Z,e[51]=R,e[52]=re):re=e[52];let ae;e[53]!==h||e[54]!==b||e[55]!==r?(ae=h!==null&&(0,s.jsx)(ge,{error:b,shardKey:r,testId:"tr-error"}),e[53]=h,e[54]=b,e[55]=r,e[56]=ae):ae=e[56];let se;e[57]!==j||e[58]!==a?(se=j&&(0,s.jsx)(pe,{description:a("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:(0,s.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:a("No traces")}),e[57]=j,e[58]=a,e[59]=se):se=e[59],B=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[re,ae,se,h===null&&W&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:a("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:E})}),h===null&&D.length>0&&(0,s.jsx)("div",{"aria-label":a("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:D.map(F=>(0,s.jsx)(Qe,{expanded:$.has(F.traceId),logs:q.get(F.traceId)??[],onToggle:J,trace:F},F.traceId))})]}),e[12]=p,e[13]=h,e[14]=b,e[15]=$,e[16]=C,e[17]=S,e[18]=k?.entries,e[19]=c,e[20]=r,e[21]=i,e[22]=o,e[23]=d,e[24]=a,e[25]=B}else B=e[25];return B},"bt");function Ve(n,e){return(0,s.jsx)("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:(0,s.jsx)(Me,{entry:n})},n.id??`${String(e)}:${String(n.timestamp)}`)}m(Ve,"He");function Xe(){return new Set}m(Xe,"Je");function Ye(){we()}m(Ye,"Qe");function Ze(n){return n.traceId}m(Ze,"Ve");export{bt as default};
@@ -0,0 +1 @@
1
+ import{a as qe}from"./chunk-5EIGSLIK.js";import{a as Je}from"./chunk-O66HDCZT.js";import{a as Ge}from"./chunk-APCHI5CD.js";import{a as Ze}from"./chunk-ATBPQT7F.js";import"./chunk-WXZ334CL.js";import{a as He}from"./chunk-UL5XVKGR.js";import{a as W}from"./chunk-MNN3YCKF.js";import{a as Xe}from"./chunk-DRHZZ7IN.js";import{a as We}from"./chunk-ERUKFS3I.js";import"./chunk-QHVUXMRV.js";import"./chunk-2NUCBQFU.js";import{i as q}from"./chunk-2D4WBSDO.js";import"./chunk-4SY2N2RS.js";import"./chunk-4AG356VE.js";import{a as K}from"./chunk-CBTPJPCZ.js";import"./chunk-SCTYLLJT.js";import"./chunk-OZID3UYF.js";import{a as Me}from"./chunk-HMMALUXM.js";import{b as X}from"./chunk-BHUWAGFN.js";import"./chunk-L27FKJTG.js";import{a as Pe,b as Re,c as Be,d as Q,e as _,f as U}from"./chunk-ZJIYJZ6F.js";import{b as je}from"./chunk-LRUYEVHH.js";import{a as ie,e as ne}from"./chunk-XV2XEUUB.js";import{n as le}from"./chunk-QFN62JQJ.js";import"./chunk-ZPQBVYNN.js";import{B as J,j as Ee,r as ee,s as te,u as Qe,w as ae}from"./chunk-2ZJJH4YN.js";import"./chunk-PDBW6GTJ.js";import{a as it}from"./chunk-A6TVTNKO.js";import{a as lt,b as nt}from"./chunk-ADABTCDI.js";import{a as r,d as Te}from"./chunk-5PEAXTYQ.js";var w=Te(lt(),1);var Z=Te(it(),1);var t=Te(nt(),1);var st=r(()=>{let h=(0,Z.c)(3),{config:e,ready:n}=qe(),l;return h[0]!==e.capabilities||h[1]!==n?(l={capabilities:e.capabilities,ready:n},h[0]=e.capabilities,h[1]=n,h[2]=l):l=h[2],l},"lt"),rt=r((h,e)=>typeof h.acceptedAt=="number"?"spent":typeof h.expiresAt=="number"&&h.expiresAt<=e?"expired":"pending","it"),et=500,dt=r((h,e)=>{if(!URL.canParse(h.trim()))return null;let n=new URL(h.trim());return n.searchParams.set("email",e.email),n.searchParams.set("invite",e.token),n.toString()},"at"),ot=r(h=>{let e=(0,Z.c)(34),{issued:n,onSignUpPageChange:l,signUpPage:d}=h,a=J(),[u,i]=(0,w.useState)(null),s;e[0]!==n||e[1]!==d?(s=dt(d,n),e[0]=n,e[1]=d,e[2]=s):s=e[2];let c=s,f;e[3]!==c?(f=r(()=>{let L="navigator"in globalThis?globalThis.navigator.clipboard:void 0;c===null||L===void 0||te(L.writeText(c).then(()=>(i(c),!0)))},"p"),e[3]=c,e[4]=f):f=e[4];let N=f,b;e[5]!==a?(b=a("Send this link to the invitee. It is shown once and cannot be recovered."),e[5]=a,e[6]=b):b=e[6];let F;e[7]!==b?(F=(0,t.jsx)("p",{className:"text-sm",children:b}),e[7]=b,e[8]=F):F=e[8];let C=c===null,v;e[9]!==a?(v=a("Your app's sign-up page"),e[9]=a,e[10]=v):v=e[10];let m;e[11]!==l?(m=r(L=>{l(L.target.value)},"u"),e[11]=l,e[12]=m):m=e[12];let p;e[13]!==d||e[14]!==C||e[15]!==v||e[16]!==m?(p=(0,t.jsx)(q,{"aria-invalid":C,"aria-label":v,"data-testid":"sign-up-invitation-page",onChange:m,value:d}),e[13]=d,e[14]=C,e[15]=v,e[16]=m,e[17]=p):p=e[17];let x=c??"",y;e[18]!==x?(y=(0,t.jsx)(q,{"data-testid":"sign-up-invitation-link",readOnly:!0,value:x}),e[18]=x,e[19]=y):y=e[19];let k;e[20]!==u||e[21]!==c||e[22]!==a?(k=a(u!==null&&u===c?"Copied":"Copy"),e[20]=u,e[21]=c,e[22]=a,e[23]=k):k=e[23];let g;e[24]!==N||e[25]!==k?(g=(0,t.jsx)(K,{"data-testid":"sign-up-invitation-copy",onClick:N,type:"button",children:k}),e[24]=N,e[25]=k,e[26]=g):g=e[26];let o;e[27]!==y||e[28]!==g?(o=(0,t.jsxs)("div",{className:"flex gap-2",children:[y,g]}),e[27]=y,e[28]=g,e[29]=o):o=e[29];let S;return e[30]!==o||e[31]!==F||e[32]!==p?(S=(0,t.jsx)(ie,{children:(0,t.jsxs)(ne,{className:"flex flex-col gap-2 p-4",children:[F,p,o]})}),e[30]=o,e[31]=F,e[32]=p,e[33]=S):S=e[33],S},"rt"),ct=r(()=>{let h=le(),e=J(),[n,l]=(0,w.useState)(""),[d,a]=(0,w.useState)(null),[u,i]=(0,w.useState)(null),[s,c]=(0,w.useState)(()=>`${Qe(h.url)}/sign-up`),f=je(["lunora-auth-sign-up-invitations",et],()=>h.listAuthSignUpInvitations({limit:et})),N=f.data?.rows??null,b=f.data?.total??0,F=r(()=>{let v=n.trim();v!==""&&(a(null),te((async()=>{try{let m=await h.createAuthSignUpInvitation({email:v}),p=typeof m.token=="string"?m.token:void 0;i(p===void 0?null:{email:v,token:p}),l(""),f.refetch()}catch(m){a(m instanceof Error?m.message:String(m))}})()))},"F"),C=r(v=>{a(null),te((async()=>{try{await h.revokeAuthSignUpInvitation({email:v}),f.refetch()}catch(m){a(m instanceof Error?m.message:String(m))}})())},"C");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"sign-up-invitations",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-base font-medium",children:e("Sign-up invitations")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Only invited addresses can create an account. Nothing is emailed \u2014 send the invitee the one-time link yourself.")})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(q,{"aria-label":e("Email address to invite"),"data-testid":"sign-up-invitation-email",onChange:r(v=>{l(v.target.value)},"onChange"),placeholder:e("ada@example.com"),type:"email",value:n}),(0,t.jsx)(K,{"data-testid":"sign-up-invitation-submit",onClick:F,type:"button",children:e("Invite")})]}),u!==null&&(0,t.jsx)(ot,{issued:u,onSignUpPageChange:c,signUpPage:s},u.token),(d??f.error)!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sign-up-invitations-error",role:"alert",children:d??f.error}),N!==null&&N.length===0&&(0,t.jsx)(Me,{testId:"sign-up-invitations-empty",title:e("Nobody has been invited yet.")}),N!==null&&b>N.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sign-up-invitations-truncated",children:e("Showing the most recent invitations. Query the signUpInvitation table directly to see the rest.")}),N!==null&&N.length>0&&(0,t.jsx)(ie,{children:(0,t.jsx)(ne,{className:"p-0",children:(0,t.jsxs)(Pe,{children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(Q,{children:[(0,t.jsx)(_,{children:e("Email")}),(0,t.jsx)(_,{children:e("Status")}),(0,t.jsx)(_,{children:e("Expires")}),(0,t.jsx)(_,{children:e("Invited by")}),(0,t.jsx)(_,{})]})}),(0,t.jsx)(Be,{children:N.map(v=>{let m=rt(v,Date.now()),p=v.email??"";return(0,t.jsxs)(Q,{"data-testid":`sign-up-invitation-${p}`,children:[(0,t.jsx)(U,{children:p}),(0,t.jsxs)(U,{"data-testid":`sign-up-invitation-status-${p}`,children:[m==="spent"&&e("Accepted"),m==="expired"&&e("Expired"),m==="pending"&&e("Pending")]}),(0,t.jsx)(U,{children:typeof v.expiresAt=="number"?ae(v.expiresAt):"\u2014"}),(0,t.jsx)(U,{children:v.invitedBy??"\u2014"}),(0,t.jsx)(U,{className:"text-right",children:(0,t.jsx)(K,{onClick:r(()=>{C(p)},"onClick"),type:"button",variant:"ghost",children:e("Revoke")})})]},v.id)})})]})})})]})},"ot"),ut={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},mt=r((h,e)=>h.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:h.type!=="number"||!Number.isNaN(Number(e.trim())),"ct"),ht=r((h,e)=>{if(h.type==="boolean")return e===!0?{value:!0}:h.required?{value:!1}:void 0;let n=typeof e=="string"?e.trim():"";if(n!==""){if(h.type==="number"){let l=Number(n);return Number.isNaN(l)?void 0:{value:l}}return{value:n}}},"ut"),pt=r(h=>{let e=(0,Z.c)(105),{onClose:n,onCreated:l}=h,d=le(),a=J(),{config:u}=qe(),{busy:i,error:s,run:c}=Je(),[f,N]=(0,w.useState)(""),[b,F]=(0,w.useState)(""),[C,v]=(0,w.useState)(""),[m,p]=(0,w.useState)(""),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let[y,k]=(0,w.useState)(x),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=r(A=>{N(A.target.value)},"g"),e[1]=g):g=e[1];let o=g,S;e[2]===Symbol.for("react.memo_cache_sentinel")?(S=r(A=>{F(A.target.value)},"S"),e[2]=S):S=e[2];let L=S,E;e[3]===Symbol.for("react.memo_cache_sentinel")?(E=r(A=>{v(A.target.value)},"z"),e[3]=E):E=e[3];let H=E,j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=r(A=>{p(A.target.value)},"M"),e[4]=j):j=e[4];let Y=j,B;e[5]===Symbol.for("react.memo_cache_sentinel")?(B=r((A,M)=>{k(se=>({...se,[A]:M}))},"D"),e[5]=B):B=e[5];let O=B,T;e[6]!==y?(T=r(A=>y[A.name]??(A.type==="boolean"?!1:""),"O"),e[6]=y,e[7]=T):T=e[7];let z=T,$;if(e[8]!==u.userFields||e[9]!==z){let A;e[11]!==z?(A=r(M=>!M.required||mt(M,z(M)),"A"),e[11]=z,e[12]=A):A=e[12],$=u.userFields.every(A),e[8]=u.userFields,e[9]=z,e[10]=$}else $=e[10];let I=$,P;e[13]!==i||e[14]!==f||e[15]!==b||e[16]!==I?(P=!i&&f.trim()!==""&&b.trim()!==""&&I,e[13]=i,e[14]=f,e[15]=b,e[16]=I,e[17]=P):P=e[17];let V=P,G;e[18]!==u.userFields||e[19]!==z?(G=r(()=>{let A={};for(let M of u.userFields){let se=ht(M,z(M));se!==void 0&&(A[M.name]=se.value)}return Object.keys(A).length===0?void 0:A},"Q"),e[18]=u.userFields,e[19]=z,e[20]=G):G=e[20];let R=G,D;e[21]!==R||e[22]!==d||e[23]!==f||e[24]!==b||e[25]!==n||e[26]!==l||e[27]!==C||e[28]!==m||e[29]!==c?(D=r(()=>{c(async()=>{await d.createAuthUser({data:R(),email:f.trim(),name:b.trim(),password:C===""?void 0:C,role:m.trim()===""?void 0:m.trim()}),l(),n()})},"L"),e[21]=R,e[22]=d,e[23]=f,e[24]=b,e[25]=n,e[26]=l,e[27]=C,e[28]=m,e[29]=c,e[30]=D):D=e[30];let Oe=D,re;e[31]!==a?(re=a("Create user"),e[31]=a,e[32]=re):re=e[32];let de;e[33]!==a?(de=a("Create user"),e[33]=a,e[34]=de):de=e[34];let oe;e[35]!==de?(oe=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:de}),e[35]=de,e[36]=oe):oe=e[36];let ce;e[37]!==a?(ce=a("email"),e[37]=a,e[38]=ce):ce=e[38];let ue;e[39]!==ce?(ue=(0,t.jsx)(W,{htmlFor:"uc-email",children:ce}),e[39]=ce,e[40]=ue):ue=e[40];let me;e[41]!==f?(me=(0,t.jsx)(q,{"data-testid":"uc-email",id:"uc-email",onChange:o,type:"email",value:f}),e[41]=f,e[42]=me):me=e[42];let he;e[43]!==ue||e[44]!==me?(he=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[ue,me]}),e[43]=ue,e[44]=me,e[45]=he):he=e[45];let pe;e[46]!==a?(pe=a("name"),e[46]=a,e[47]=pe):pe=e[47];let fe;e[48]!==pe?(fe=(0,t.jsx)(W,{htmlFor:"uc-name",children:pe}),e[48]=pe,e[49]=fe):fe=e[49];let ve;e[50]!==b?(ve=(0,t.jsx)(q,{"data-testid":"uc-name",id:"uc-name",onChange:L,value:b}),e[50]=b,e[51]=ve):ve=e[51];let ge;e[52]!==fe||e[53]!==ve?(ge=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[fe,ve]}),e[52]=fe,e[53]=ve,e[54]=ge):ge=e[54];let ye;e[55]!==a?(ye=a("Password (optional)"),e[55]=a,e[56]=ye):ye=e[56];let be;e[57]!==ye?(be=(0,t.jsx)(W,{htmlFor:"uc-password",children:ye}),e[57]=ye,e[58]=be):be=e[58];let xe;e[59]!==C?(xe=(0,t.jsx)(q,{"data-testid":"uc-password",id:"uc-password",onChange:H,type:"password",value:C}),e[59]=C,e[60]=xe):xe=e[60];let Ne;e[61]!==be||e[62]!==xe?(Ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[be,xe]}),e[61]=be,e[62]=xe,e[63]=Ne):Ne=e[63];let ke;e[64]!==a?(ke=a("Role (optional)"),e[64]=a,e[65]=ke):ke=e[65];let we;e[66]!==ke?(we=(0,t.jsx)(W,{htmlFor:"uc-role",children:ke}),e[66]=ke,e[67]=we):we=e[67];let Ce;e[68]!==m?(Ce=(0,t.jsx)(q,{"data-testid":"uc-role",id:"uc-role",onChange:Y,value:m}),e[68]=m,e[69]=Ce):Ce=e[69];let Ie;e[70]!==we||e[71]!==Ce?(Ie=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[we,Ce]}),e[70]=we,e[71]=Ce,e[72]=Ie):Ie=e[72];let Ae;e[73]!==u.userFields||e[74]!==z||e[75]!==a?(Ae=u.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),u.userFields.map(A=>{let M=`uc-field-${A.name}`,se=A.required?"":` (${a("optional")})`;if(A.type==="boolean"){let Le=z(A)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:M,children:[(0,t.jsx)(Ze,{checked:Le,"data-testid":M,id:M,onCheckedChange:r(at=>{O(A.name,at)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[A.name,se]})]},A.name)}let Ve=z(A);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(W,{htmlFor:M,children:[A.name,se]}),(0,t.jsx)(q,{"data-testid":M,id:M,onChange:r(Le=>{O(A.name,Le.target.value)},"onChange"),type:ut[A.type],value:typeof Ve=="string"?Ve:""})]},A.name)})]}),e[73]=u.userFields,e[74]=z,e[75]=a,e[76]=Ae):Ae=e[76];let Se;e[77]!==s?(Se=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:s}),e[77]=s,e[78]=Se):Se=e[78];let Fe;e[79]!==a?(Fe=a("Cancel"),e[79]=a,e[80]=Fe):Fe=e[80];let Ue;e[81]!==n||e[82]!==Fe?(Ue=(0,t.jsx)(K,{"data-testid":"uc-cancel",onClick:n,size:"sm",type:"button",variant:"outline",children:Fe}),e[81]=n,e[82]=Fe,e[83]=Ue):Ue=e[83];let De=!V,ze;e[84]!==i||e[85]!==a?(ze=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=ze):ze=e[86];let Ke;e[87]!==Oe||e[88]!==De||e[89]!==ze?(Ke=(0,t.jsx)(K,{"data-testid":"uc-submit",disabled:De,onClick:Oe,size:"sm",type:"button",children:ze}),e[87]=Oe,e[88]=De,e[89]=ze,e[90]=Ke):Ke=e[90];let _e;e[91]!==Ue||e[92]!==Ke?(_e=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[Ue,Ke]}),e[91]=Ue,e[92]=Ke,e[93]=_e):_e=e[93];let $e;return e[94]!==n||e[95]!==re||e[96]!==oe||e[97]!==he||e[98]!==ge||e[99]!==Ne||e[100]!==Ie||e[101]!==Ae||e[102]!==Se||e[103]!==_e?($e=(0,t.jsxs)(He,{label:re,onClose:n,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[oe,he,ge,Ne,Ie,Ae,Se,_e]}),e[94]=n,e[95]=re,e[96]=oe,e[97]=he,e[98]=ge,e[99]=Ne,e[100]=Ie,e[101]=Ae,e[102]=Se,e[103]=_e,e[104]=$e):$e=e[104],$e},"mt"),Ye=r(h=>{let e=(0,Z.c)(2),{children:n}=h,l;return e[0]!==n?(l=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n}),e[0]=n,e[1]=l):l=e[1],l},"Me"),tt=r(h=>{let e=(0,Z.c)(15),{children:n,columns:l,testId:d}=h,a=J(),u;e[0]!==l?(u=l.map(yt),e[0]=l,e[1]=u):u=e[1];let i;e[2]!==a?(i=a("Actions"),e[2]=a,e[3]=i):i=e[3];let s;e[4]!==i?(s=(0,t.jsx)(_,{"aria-label":i}),e[4]=i,e[5]=s):s=e[5];let c;e[6]!==u||e[7]!==s?(c=(0,t.jsx)(Re,{children:(0,t.jsxs)(Q,{children:[u,s]})}),e[6]=u,e[7]=s,e[8]=c):c=e[8];let f;e[9]!==n?(f=(0,t.jsx)(Be,{children:n}),e[9]=n,e[10]=f):f=e[10];let N;return e[11]!==c||e[12]!==f||e[13]!==d?(N=(0,t.jsx)(ie,{className:"overflow-hidden py-0",children:(0,t.jsx)(ne,{className:"px-0",children:(0,t.jsxs)(Pe,{"data-testid":d,children:[c,f]})})}),e[11]=c,e[12]=f,e[13]=d,e[14]=N):N=e[14],N},"qe"),ft=r(h=>{let e=(0,Z.c)(29),{busy:n,runAction:l,userId:d,version:a}=h,u=le(),i=J(),[s,c]=(0,w.useState)(null),[f,N]=(0,w.useState)(null),b;e[0]!==u||e[1]!==d?(b=r(()=>{te((async()=>{N(null);try{let o=await u.listAuthSessions({limit:50,userId:d});c(o.rows)}catch(o){let S=o;c(null),N(Ee(S))}})())},"b"),e[0]=u,e[1]=d,e[2]=b):b=e[2];let F;e[3]!==u||e[4]!==d||e[5]!==a?(F=[u,d,a],e[3]=u,e[4]=d,e[5]=a,e[6]=F):F=e[6],(0,w.useEffect)(b,F);let C;e[7]!==u||e[8]!==l?(C=r(o=>{l(()=>u.revokeAuthSession({sessionId:o}))},"C"),e[7]=u,e[8]=l,e[9]=C):C=e[9];let v=C,m;e[10]!==i?(m=i("Sessions"),e[10]=i,e[11]=m):m=e[11];let p;e[12]!==m?(p=(0,t.jsx)(Ye,{children:m}),e[12]=m,e[13]=p):p=e[13];let x;e[14]!==f?(x=f!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:f}),e[14]=f,e[15]=x):x=e[15];let y;e[16]!==s||e[17]!==i?(y=s!==null&&s.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=s,e[17]=i,e[18]=y):y=e[18];let k;e[19]!==n||e[20]!==v||e[21]!==s||e[22]!==i?(k=s!==null&&s.length>0&&(0,t.jsx)(ie,{className:"overflow-hidden py-0",children:(0,t.jsx)(ne,{className:"px-0",children:(0,t.jsxs)(Pe,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(Q,{children:[(0,t.jsx)(_,{children:i("expires")}),(0,t.jsx)(_,{children:i("ip")}),(0,t.jsx)(_,{children:i("user agent")}),(0,t.jsx)(_,{"aria-label":i("Actions")})]})}),(0,t.jsx)(Be,{children:s.map(o=>(0,t.jsxs)(Q,{"data-testid":`ud-session-${o.id}`,children:[(0,t.jsx)(U,{className:"text-muted-foreground tabular-nums",children:ae(o.expiresAt)}),(0,t.jsx)(U,{children:o.ipAddress??""}),(0,t.jsx)(U,{className:"max-w-40 truncate",children:o.userAgent??""}),(0,t.jsx)(U,{children:(0,t.jsx)(K,{"data-testid":`ud-revoke-${o.id}`,disabled:n,onClick:r(()=>{v(o.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},o.id))})]})})}),e[19]=n,e[20]=v,e[21]=s,e[22]=i,e[23]=k):k=e[23];let g;return e[24]!==p||e[25]!==x||e[26]!==y||e[27]!==k?(g=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[p,x,y,k]}),e[24]=p,e[25]=x,e[26]=y,e[27]=k,e[28]=g):g=e[28],g},"ht"),vt=r(h=>{let e=(0,Z.c)(30),{busy:n,runAction:l,userId:d,version:a}=h,u=le(),i=J(),[s,c]=(0,w.useState)(null),[f,N]=(0,w.useState)(null),b;e[0]!==u||e[1]!==d?(b=r(()=>{te((async()=>{N(null);try{c(await u.listAuthAccounts({userId:d}))}catch(o){let S=o;c(null),N(Ee(S))}})())},"b"),e[0]=u,e[1]=d,e[2]=b):b=e[2];let F;e[3]!==u||e[4]!==d||e[5]!==a?(F=[u,d,a],e[3]=u,e[4]=d,e[5]=a,e[6]=F):F=e[6],(0,w.useEffect)(b,F);let C;e[7]!==u||e[8]!==l||e[9]!==d?(C=r(o=>{l(()=>u.unlinkAuthAccount({accountId:o,userId:d}))},"C"),e[7]=u,e[8]=l,e[9]=d,e[10]=C):C=e[10];let v=C,m;e[11]!==i?(m=i("Linked accounts"),e[11]=i,e[12]=m):m=e[12];let p;e[13]!==m?(p=(0,t.jsx)(Ye,{children:m}),e[13]=m,e[14]=p):p=e[14];let x;e[15]!==f?(x=f!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:f}),e[15]=f,e[16]=x):x=e[16];let y;e[17]!==s||e[18]!==i?(y=s!==null&&s.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=s,e[18]=i,e[19]=y):y=e[19];let k;e[20]!==s||e[21]!==n||e[22]!==v||e[23]!==i?(k=s!==null&&s.length>0&&(0,t.jsx)(ie,{className:"overflow-hidden py-0",children:(0,t.jsx)(ne,{className:"px-0",children:(0,t.jsxs)(Pe,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(Q,{children:[(0,t.jsx)(_,{children:i("provider")}),(0,t.jsx)(_,{children:i("created")}),(0,t.jsx)(_,{"aria-label":i("Actions")})]})}),(0,t.jsx)(Be,{children:s.map(o=>{let S=ee(o.id);return(0,t.jsxs)(Q,{"data-testid":`ud-account-${S}`,children:[(0,t.jsx)(U,{children:ee(o.providerId)}),(0,t.jsx)(U,{className:"text-muted-foreground tabular-nums",children:ae(o.createdAt)}),(0,t.jsx)(U,{children:(0,t.jsx)(K,{"data-testid":`ud-unlink-${S}`,disabled:n,onClick:r(()=>{v(S)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},S)})})]})})}),e[20]=s,e[21]=n,e[22]=v,e[23]=i,e[24]=k):k=e[24];let g;return e[25]!==p||e[26]!==x||e[27]!==y||e[28]!==k?(g=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[p,x,y,k]}),e[25]=p,e[26]=x,e[27]=y,e[28]=k,e[29]=g):g=e[29],g},"ft"),gt=r(h=>{let e=(0,Z.c)(71),{busy:n,capabilities:l,runAction:d,userId:a,version:u}=h,i=le(),s=J(),[c,f]=(0,w.useState)(null),[N,b]=(0,w.useState)(null),[F,C]=(0,w.useState)(null),[v,m]=(0,w.useState)(0),p;e[0]!==l.apiKey||e[1]!==i||e[2]!==a?(p=r(()=>{if(!l.apiKey)return;let R={live:!0};return te((async()=>{try{let D=await i.listAuthApiKeys({userId:a});R.live&&(b({rows:D,userId:a}),C(null))}catch{R.live&&C(a)}})()),()=>{R.live=!1}},"f"),e[0]=l.apiKey,e[1]=i,e[2]=a,e[3]=p):p=e[3];let x;e[4]!==v||e[5]!==l.apiKey||e[6]!==i||e[7]!==a||e[8]!==u?(x=[v,l.apiKey,i,a,u],e[4]=v,e[5]=l.apiKey,e[6]=i,e[7]=a,e[8]=u,e[9]=x):x=e[9],(0,w.useEffect)(p,x);let y=N?.userId===a?N.rows:null,k=F===a,g;e[10]!==l.passkey||e[11]!==i||e[12]!==a?(g=r(()=>{l.passkey&&te((async()=>{try{f(await i.listAuthPasskeys({userId:a}))}catch{f(null)}})())},"g"),e[10]=l.passkey,e[11]=i,e[12]=a,e[13]=g):g=e[13];let o;e[14]!==l.passkey||e[15]!==i||e[16]!==a||e[17]!==u?(o=[l.passkey,i,a,u],e[14]=l.passkey,e[15]=i,e[16]=a,e[17]=u,e[18]=o):o=e[18],(0,w.useEffect)(g,o);let S;e[19]!==i||e[20]!==d||e[21]!==a?(S=r(()=>{d(()=>i.disableAuthTwoFactor({userId:a}))},"S"),e[19]=i,e[20]=d,e[21]=a,e[22]=S):S=e[22];let L=S,E;e[23]!==i||e[24]!==d?(E=r(R=>{d(()=>i.deleteAuthPasskey({passkeyId:R}))},"z"),e[23]=i,e[24]=d,e[25]=E):E=e[25];let H=E,j;e[26]!==i||e[27]!==d?(j=r(R=>{d(()=>i.deleteAuthApiKey({apiKeyId:R}))},"M"),e[26]=i,e[27]=d,e[28]=j):j=e[28];let Y=j,B;e[29]!==s?(B=s("Security"),e[29]=s,e[30]=B):B=e[30];let O;e[31]!==B?(O=(0,t.jsx)(Ye,{children:B}),e[31]=B,e[32]=O):O=e[32];let T;e[33]!==n||e[34]!==l.twoFactor||e[35]!==L||e[36]!==s?(T=l.twoFactor&&(0,t.jsx)(K,{"data-testid":"ud-disable-2fa",disabled:n,onClick:L,size:"sm",type:"button",variant:"outline",children:s("Disable two-factor")}),e[33]=n,e[34]=l.twoFactor,e[35]=L,e[36]=s,e[37]=T):T=e[37];let z;e[38]!==l.passkey||e[39]!==c||e[40]!==s?(z=l.passkey&&c!==null&&c.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s("No passkeys.")}),e[38]=l.passkey,e[39]=c,e[40]=s,e[41]=z):z=e[41];let $;e[42]!==n||e[43]!==l.passkey||e[44]!==H||e[45]!==c||e[46]!==s?($=l.passkey&&c!==null&&c.length>0&&(0,t.jsx)(tt,{columns:[s("name"),s("created")],testId:"ud-passkeys-table",children:c.map(R=>{let D=ee(R.id);return(0,t.jsxs)(Q,{"data-testid":`ud-passkey-${D}`,children:[(0,t.jsx)(U,{children:ee(R.name)||D}),(0,t.jsx)(U,{className:"text-muted-foreground tabular-nums",children:ae(R.createdAt)}),(0,t.jsx)(U,{children:(0,t.jsx)(K,{"data-testid":`ud-delete-passkey-${D}`,disabled:n,onClick:r(()=>{H(D)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Delete")})})]},D)})}),e[42]=n,e[43]=l.passkey,e[44]=H,e[45]=c,e[46]=s,e[47]=$):$=e[47];let I;e[48]!==k||e[49]!==n||e[50]!==l.apiKey||e[51]!==s?(I=l.apiKey&&k&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s("Could not load API keys.")}),(0,t.jsx)(K,{"data-testid":"ud-api-keys-retry",disabled:n,onClick:r(()=>{m(bt)},"onClick"),size:"xs",type:"button",variant:"outline",children:s("Retry")})]}),e[48]=k,e[49]=n,e[50]=l.apiKey,e[51]=s,e[52]=I):I=e[52];let P;e[53]!==l.apiKey||e[54]!==y||e[55]!==s?(P=l.apiKey&&y!==null&&y.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s("No API keys.")}),e[53]=l.apiKey,e[54]=y,e[55]=s,e[56]=P):P=e[56];let V;e[57]!==n||e[58]!==l.apiKey||e[59]!==y||e[60]!==Y||e[61]!==s?(V=l.apiKey&&y!==null&&y.length>0&&(0,t.jsx)(tt,{columns:[s("name"),s("Key"),s("created"),s("Expires")],testId:"ud-api-keys-table",children:y.map(R=>{let D=ee(R.id);return(0,t.jsxs)(Q,{"data-testid":`ud-api-key-${D}`,children:[(0,t.jsx)(U,{children:ee(R.name)||D}),(0,t.jsx)(U,{className:"font-mono text-muted-foreground",children:ee(R.start)||"\u2014"}),(0,t.jsx)(U,{className:"text-muted-foreground tabular-nums",children:ae(R.createdAt)}),(0,t.jsx)(U,{className:"text-muted-foreground tabular-nums",children:ae(R.expiresAt,s("Never"))}),(0,t.jsx)(U,{children:(0,t.jsx)(K,{"data-testid":`ud-revoke-api-key-${D}`,disabled:n,onClick:r(()=>{Y(D)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Revoke")})})]},D)})}),e[57]=n,e[58]=l.apiKey,e[59]=y,e[60]=Y,e[61]=s,e[62]=V):V=e[62];let G;return e[63]!==T||e[64]!==z||e[65]!==$||e[66]!==I||e[67]!==P||e[68]!==V||e[69]!==O?(G=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[O,T,z,$,I,P,V]}),e[63]=T,e[64]=z,e[65]=$,e[66]=I,e[67]=P,e[68]=V,e[69]=O,e[70]=G):G=e[70],G},"pt");function yt(h){return(0,t.jsx)(_,{children:h},h)}r(yt,"vt");function bt(h){return h+1}r(bt,"gt");var xt=/(?:at|expires)$/iu,Nt=/^[1-9]\d*$/u,kt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),wt=r(h=>{let e=(0,Z.c)(51),{busy:n,onBan:l}=h,d=J(),[a,u]=(0,w.useState)(""),[i,s]=(0,w.useState)(""),[c,f]=(0,w.useState)(!1),N;e[0]!==i?(N=Nt.test(i.trim())&&Number.isSafeInteger(Number(i.trim())*86400)?Number(i.trim()):void 0,e[0]=i,e[1]=N):N=e[1];let b=N,F=c||b!==void 0,C;e[2]!==l||e[3]!==c||e[4]!==a||e[5]!==b?(C=r(()=>{l({expiresInSeconds:c||b===void 0?void 0:b*86400,reason:a.trim()===""?void 0:a.trim()})},"C"),e[2]=l,e[3]=c,e[4]=a,e[5]=b,e[6]=C):C=e[6];let v=C,m;e[7]!==d?(m=d("Ban reason (optional)"),e[7]=d,e[8]=m):m=e[8];let p;e[9]!==m?(p=(0,t.jsx)(W,{htmlFor:"ud-ban-reason",children:m}),e[9]=m,e[10]=p):p=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=r(P=>{u(P.target.value)},"x"),e[11]=x):x=e[11];let y;e[12]!==a?(y=(0,t.jsx)(q,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:x,value:a}),e[12]=a,e[13]=y):y=e[13];let k;e[14]!==p||e[15]!==y?(k=(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[p,y]}),e[14]=p,e[15]=y,e[16]=k):k=e[16];let g;e[17]!==d?(g=d("Days"),e[17]=d,e[18]=g):g=e[18];let o;e[19]!==g?(o=(0,t.jsx)(W,{htmlFor:"ud-ban-days",children:g}),e[19]=g,e[20]=o):o=e[20];let S;e[21]!==i||e[22]!==b?(S=i.trim()!==""&&b===void 0,e[21]=i,e[22]=b,e[23]=S):S=e[23];let L;e[24]===Symbol.for("react.memo_cache_sentinel")?(L=r(P=>{s(P.target.value)},"_"),e[24]=L):L=e[24];let E;e[25]!==i||e[26]!==c||e[27]!==S?(E=(0,t.jsx)(q,{"aria-invalid":S,"data-testid":"ud-ban-days",disabled:c,id:"ud-ban-days",min:1,onChange:L,step:1,type:"number",value:i}),e[25]=i,e[26]=c,e[27]=S,e[28]=E):E=e[28];let H;e[29]!==E||e[30]!==o?(H=(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[o,E]}),e[29]=E,e[30]=o,e[31]=H):H=e[31];let j;e[32]===Symbol.for("react.memo_cache_sentinel")?(j=r(P=>{f(P.target.checked)},"M"),e[32]=j):j=e[32];let Y;e[33]!==c?(Y=(0,t.jsx)("input",{checked:c,className:"size-4 accent-destructive","data-testid":"ud-ban-permanent",id:"ud-ban-permanent",onChange:j,type:"checkbox"}),e[33]=c,e[34]=Y):Y=e[34];let B;e[35]!==d?(B=d("Permanent"),e[35]=d,e[36]=B):B=e[36];let O;e[37]!==Y||e[38]!==B?(O=(0,t.jsxs)(W,{className:"flex items-center gap-1.5 pb-2 text-xs font-normal",htmlFor:"ud-ban-permanent",children:[Y,B]}),e[37]=Y,e[38]=B,e[39]=O):O=e[39];let T=n||!F,z;e[40]!==d?(z=d("Ban user"),e[40]=d,e[41]=z):z=e[41];let $;e[42]!==v||e[43]!==T||e[44]!==z?($=(0,t.jsx)(K,{"data-testid":"ud-ban",disabled:T,onClick:v,size:"sm",type:"button",variant:"destructive",children:z}),e[42]=v,e[43]=T,e[44]=z,e[45]=$):$=e[45];let I;return e[46]!==H||e[47]!==O||e[48]!==$||e[49]!==k?(I=(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[k,H,O,$]}),e[46]=H,e[47]=O,e[48]=$,e[49]=k,e[50]=I):I=e[50],I},"Nt"),Ct=r((h,e)=>typeof e=="number"&&xt.test(h)?ae(e):ee(e),"kt"),It=r(({capabilities:h,onChanged:e,onClose:n,user:l})=>{let d=le(),a=J(),u=l.banned===!0,[i,s]=(0,w.useState)(null),[c,f]=(0,w.useState)(!1),[N,b]=(0,w.useState)(0),[F,C]=(0,w.useState)(typeof l.role=="string"?l.role:""),[v,m]=(0,w.useState)(""),[p,x]=(0,w.useState)(null),[y,k]=(0,w.useState)(!1),g=r((I,P)=>{te((async()=>{f(!0),s(null);try{let V=await I();P?.refresh!==!1&&(b(G=>G+1),e()),P?.onResult?.(V)}catch(V){s(Ee(V))}f(!1)})())},"g"),o=r(I=>{C(I.target.value)},"o"),S=r(I=>{m(I.target.value)},"S"),L=r(()=>{let I=F.trim();I!==""&&g(async()=>{await d.setAuthUserRole({role:I,userId:l.id})})},"_"),E=r(I=>{g(async()=>{await d.banAuthUser({...I,userId:l.id})})},"z"),H=r(()=>{g(async()=>{await d.unbanAuthUser({userId:l.id})})},"q"),j=r(()=>{g(async()=>{await d.setAuthUserPassword({newPassword:v,userId:l.id}),m("")})},"M"),Y=r(()=>{g(()=>d.impersonateAuthUser({userId:l.id}),{onResult:r(I=>{x(I.token)},"onResult"),refresh:!1})},"H"),B=r(()=>{g(async()=>{await d.revokeAuthUserSessions({userId:l.id})})},"D"),O=r(()=>{g(async()=>{await d.removeAuthUser({userId:l.id}),n()})},"B"),T=r(()=>{k(!0)},"O"),z=r(()=>{k(!1)},"U"),$=Object.entries(l).filter(([I])=>!kt.has(I));return(0,t.jsxs)(He,{label:a("User details"),onClose:n,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:l.name??l.email??l.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:l.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&(0,t.jsx)(X,{variant:"secondary",children:l.role}),u?(0,t.jsx)(X,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(X,{variant:"outline",children:a("Active")}),l.emailVerified===!0?(0,t.jsx)(X,{variant:"secondary",children:a("verified")}):(0,t.jsx)(X,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(K,{"data-testid":"ud-close",onClick:n,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),i!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:i}),h.admin&&(0,t.jsxs)(ie,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Actions")})}),(0,t.jsxs)(ne,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(W,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(q,{"data-testid":"ud-role-input",id:"ud-role",onChange:o,value:F})]}),(0,t.jsx)(K,{"data-testid":"ud-set-role",disabled:c||F.trim()==="",onClick:L,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),u?(0,t.jsx)(K,{"data-testid":"ud-unban",disabled:c,onClick:H,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsx)(wt,{busy:c,onBan:E}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(W,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(q,{"data-testid":"ud-password",id:"ud-password",onChange:S,type:"password",value:v})]}),(0,t.jsx)(K,{"data-testid":"ud-set-password",disabled:c||v==="",onClick:j,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(K,{"data-testid":"ud-impersonate",disabled:c,onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(K,{"data-testid":"ud-revoke-all",disabled:c,onClick:B,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),y?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K,{"data-testid":"ud-delete-confirm",disabled:c,onClick:O,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(K,{"data-testid":"ud-delete-cancel",onClick:z,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(K,{"data-testid":"ud-delete",disabled:c,onClick:T,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),p!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(W,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(q,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:p})]})]})]}),(0,t.jsx)(ft,{busy:c,runAction:g,userId:l.id,version:N}),h.accounts&&(0,t.jsx)(vt,{busy:c,runAction:g,userId:l.id,version:N}),(h.twoFactor||h.passkey||h.apiKey)&&(0,t.jsx)(gt,{busy:c,capabilities:h,runAction:g,userId:l.id,version:N}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:$.map(([I,P])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:I}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:Ct(I,P)})]},I))})]})]})},"Ct"),At=50,Ht=r(({pageSize:h=At}={})=>{let e=le(),n=J(),[l,d]=(0,w.useState)(""),[a,u]=(0,w.useState)(""),[i,s]=(0,w.useState)(0),c=Xe(l),[f,N]=(0,w.useState)(null),[b,F]=(0,w.useState)(!1),{capabilities:C}=st(),v=c.trim(),m=a.trim(),p=je(["lunora-auth-users",v,m,h,i],()=>e.listAuthUsers({filterField:m===""?void 0:"role",filterValue:m===""?void 0:m,limit:h,offset:i,search:v===""?void 0:v}).then(o=>({...o,offset:i})),{keepPreviousData:!0}),x=p.data?.rows??null,y=p.error,k=r(()=>{p.refetch()},"k");We(()=>p.poll(),!0);let g=f===null?null:x?.find(o=>o.id===f)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(q,{"aria-label":n("Search users"),className:"w-56","data-testid":"us-search",onChange:r(o=>{d(o.target.value),s(0)},"onChange"),placeholder:n("Search by email or name\u2026"),value:l}),(0,t.jsx)(q,{"aria-label":n("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:r(o=>{u(o.target.value),s(0)},"onChange"),placeholder:n("Filter by role"),value:a}),(0,t.jsx)(K,{"data-testid":"us-new",onClick:r(()=>{F(!0)},"onClick"),size:"sm",type:"button",children:n("New user")})]}),y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:y}),x!==null&&x.length===0&&(0,t.jsx)(Me,{description:n("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:n("No users.")}),x!==null&&x.length>0&&(0,t.jsx)(ie,{className:"overflow-hidden py-0",children:(0,t.jsx)(ne,{className:"px-0",children:(0,t.jsxs)(Pe,{"data-testid":"us-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(Q,{children:[(0,t.jsx)(_,{children:n("id")}),(0,t.jsx)(_,{children:n("email")}),(0,t.jsx)(_,{children:n("name")}),(0,t.jsx)(_,{children:n("role")}),(0,t.jsx)(_,{children:n("status")}),(0,t.jsx)(_,{children:n("verified")}),(0,t.jsx)(_,{children:n("created")}),(0,t.jsx)(_,{"aria-label":n("Actions")})]})}),(0,t.jsx)(Be,{children:x.map(o=>(0,t.jsxs)(Q,{"data-testid":`us-row-${o.id}`,children:[(0,t.jsx)(U,{className:"font-mono text-xs",children:o.id}),(0,t.jsx)(U,{children:o.email??""}),(0,t.jsx)(U,{children:o.name??""}),(0,t.jsx)(U,{children:typeof o.role=="string"&&o.role!==""?(0,t.jsx)(X,{variant:"secondary",children:o.role}):""}),(0,t.jsx)(U,{children:o.banned===!0?(0,t.jsx)(X,{variant:"destructive",children:n("Banned")}):(0,t.jsx)(X,{variant:"success",children:n("Active")})}),(0,t.jsx)(U,{children:o.emailVerified===!0?(0,t.jsx)(X,{variant:"success",children:n("yes")}):(0,t.jsx)(X,{variant:"outline",children:n("no")})}),(0,t.jsx)(U,{className:"text-muted-foreground tabular-nums",children:ae(o.createdAt)}),(0,t.jsx)(U,{children:(0,t.jsx)(K,{"data-testid":`us-manage-${o.id}`,onClick:r(()=>{N(o.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Manage")})})]},o.id))})]})})}),x!==null&&(0,t.jsx)(Ge,{count:x.length,offset:p.data?.offset??0,onOffsetChange:s,pageSize:h,prefix:"us",total:p.data?.total}),g!==null&&(0,t.jsx)(It,{capabilities:C,onChanged:k,onClose:r(()=>{N(null)},"onClose"),user:g}),b&&(0,t.jsx)(pt,{onClose:r(()=>{F(!1)},"onClose"),onCreated:k}),C.inviteOnly&&(0,t.jsx)(ct,{})]})},"Ht");export{Ht as UsersPanel};
@@ -0,0 +1 @@
1
+ import{a as r}from"./chunk-5PEAXTYQ.js";var d=[{headings:["Vocabulary","The mental model","The components","Request lifecycle","The data tiers","Compute tiers","The consistency model","The real-time engine"],id:"architecture",summary:"The full picture \u2014 topology, request lifecycle, the data tiers, the consistency model, and the design decisions behind them.",title:"Architecture"},{headings:["Choose Lunora when","Choose something else when","Against each alternative","Check these before you commit"],id:"choosing-lunora",summary:"A decision guide for choosing Lunora over Convex, Supabase, Firebase, Appwrite, or raw Cloudflare, including the cases where Lunora is the\u2026",title:"Is Lunora the right backend?"},{headings:["Authentication","lunora cloud deploy","lunora cloud rollback","lunora cloud eject","Reading logs","Push-to-deploy, without the CLI","What is not here yet"],id:"cloud/cli",summary:"Deploy to Lunora Cloud, roll a release back, and eject your data and config to your own Cloudflare account \u2014 all from the one `lunora`\u2026",title:"CLI"},{headings:["How telemetry reaches the cloud","Traces","Issues","Logs","Metrics","Traffic","Scoped ingest keys","Bring your own OpenTelemetry"],id:"cloud/monitoring",summary:"The Lunora cloud is a managed OpenTelemetry backend + control plane \u2014 deploy to it and your traces, logs, metrics, and AI generations flow\u2026",title:"Monitoring"},{headings:[],id:"cloud/serving-responses",summary:"The headers Lunora Cloud adds to an app's responses, what a browser does with them, and which deployments get them.",title:"Serving your app's responses"},{headings:["Make a production app sign-in only"],id:"cloud/who-can-open-my-app",summary:"Production apps on Lunora Cloud are open to anyone with the link. Your app controls sign-in; the preview password gate applies only to\u2026",title:"Who can open my app?"},{headings:["Connect an account","What gets created in your account","What Lunora Cloud keeps","Usage and billing","What works, and what doesn't","Limits","Disconnecting"],id:"cloud/your-own-cloudflare-account",summary:"Connect your Cloudflare account to Lunora Cloud with a scoped API token, and deploy into it as plain Workers. Your data stays in your\u2026",title:"Deploy into your own Cloudflare account"},{headings:["Requirements","Install","Your data","Isolation","What works, and what doesn't","Upgrades","Leaving","Pricing"],id:"cloud/your-own-server",summary:"Run Lunora apps on a Linux server you own, managed by Lunora Cloud through an agent that dials out. Your app data stays in a bucket you own.",title:"Run on your own server"},{headings:["When to use an action vs a mutation","ActionCtx","Calling queries and mutations from an action","Scheduling follow-up work"],id:"concepts/actions",summary:"Non-deterministic functions for external APIs and side effects \u2014 the action builder and its ActionCtx.",title:"Actions"},{headings:["Keep your session authority","Declare ownership once","Call Lunora from your own Worker","Dev proxy: two silent failures","Run both engines during the migration","Test it without a worker","When something is stuck"],id:"concepts/adopt-in-an-existing-app",summary:"Add Lunora to a working product that already has its own auth, Worker, and data layer \u2014 without rewriting either.",title:"Adopt in an existing app"},{headings:["Static lints","Runtime lints","Running advisors"],id:"concepts/advisors",summary:"Splinter-style lints that catch schema, performance, and security problems \u2014 many before you deploy.",title:"Advisors"},{headings:["Agent skills","Agent mode","The docs server","The local server","The MCP server","Keeping generated types honest"],id:"concepts/ai-tooling",summary:"Teach Claude Code, Cursor, and Copilot how to use Lunora \u2014 agent skills, agent-aware dev mode, the docs server, and the MCP server.",title:"AI coding agents"},{headings:["What lands in your project","Wire it up","The cards","Enabling the optional flows","Password rules","Username availability","Being an OAuth provider","Avatar and logo uploads"],id:"concepts/auth-ui",summary:"Copy-in sign-in, settings, and organization screens for React, Vue, Svelte, Solid, and Angular \u2014 the code lands in your project and you\u2026",title:"Auth UI"},{headings:["ctx.auth inside functions","@lunora/auth on the server","Routing /api/auth/*","The client side","Feeding row-level security","See also"],id:"concepts/authentication",summary:"How ctx.auth threads the signed-in user through queries, mutations, and actions \u2014 and feeds row-level security.",title:"Authentication"},{headings:["Point-in-time recovery","Snapshot backups","Export and import","Streaming data out continuously","Practising a restore"],id:"concepts/backups",summary:"Snapshot a deployment, recover a shard to any moment in the last 30 days, and move data in and out as NDJSON.",title:"Backups, export & import"},{headings:["Schema first","Reads","Writes","Inputs and safety","Scaling","Lean on Advisors"],id:"concepts/best-practices",summary:"The opinionated idioms that keep a Lunora app fast, safe, and reactive.",title:"Best practices"},{headings:["Enabling Workers Cache","Declarative cache headers on httpRoute","Programmatic cache purging","Why only HTTP actions?","Memoizing an expensive action result","Scaffolding cache-aware routes","Best practices"],id:"concepts/caching",summary:"Edge caching with Cloudflare Workers Cache \u2014 declarative headers on HTTP routes and programmatic cache purging from actions.",title:"Caching"},{headings:["The short version","Rows or events?","Live topics, whispers and rooms","Streams","Write a row, then tell the page","Things to know before you rely on a live topic"],id:"concepts/choosing-a-data-channel",summary:"Live query, stream, live topic, whisper, room or socket? Which one to use for which job.",title:"Choosing a data channel"},{headings:["Declaring it","What _commitSeq guarantees","Refreshed on every write","Three things it is not","When to reach for it"],id:"concepts/commit-ordering",summary:"Declare .commitOrdered() so every row carries _commitSeq \u2014 a per-shard sequence that orders commits, and the cursor a changefeed can page\u2026",title:"Commit ordering"},{headings:["Defining one","Installing one","What the namespace guarantees","What a component does NOT get","In the architecture view","Migrations","See also"],id:"concepts/components",summary:"Package backend features \u2014 tables, functions, and context \u2014 as an installable unit that cannot collide with the app that installs it.",title:"Components"},{headings:["Constraint kinds","Unique","Non-null","Foreign-key integrity","Error codes"],id:"concepts/constraints",summary:"Unique, non-null and foreign-key integrity declared on the schema and enforced at write time.",title:"Constraints"},{headings:["What it pins","Pinning auth and voice","Pinning mail","Set it once: changing it strands data","Runbook: moving an app to a new jurisdiction"],id:"concepts/data-residency",summary:"Pin Durable Objects to a Cloudflare jurisdiction with .jurisdiction(), and the export\u2192import runbook for moving regions.",title:"Data residency"},{headings:["The type table","Numbers, bigints, and dates","Optional versus null","Values that JSON cannot carry","Size limits","Types outside the schema"],id:"concepts/data-types",summary:"The value types a Lunora document can hold, how each is stored, and which ones need the wire codec to survive JSON.",title:"Data types"},{headings:["Start with lunora doctor","Catch it before it runs","The error overlay","Structured logging with ctx.log","The Studio","Find the slow or failing function","Watch production","Debugging authentication"],id:"concepts/debugging",summary:"The tools to reach for when something is broken \u2014 doctor, the error overlay, ctx.log, the Studio, insights, and live logs.",title:"Debugging"},{headings:["How ids are minted","Typing a reference with v.id","Reading and following ids","Validating an id that came from outside","Ids in exports and imports"],id:"concepts/document-ids",summary:"Every row carries an _id and a _creationTime \u2014 how they are minted, how v.id types a reference, and what an id does and does not guarantee.",title:"Document IDs"},{headings:["Locally: .dev.vars","In production: secrets and vars","Accessing env inside your app","The rule: never commit secrets"],id:"concepts/environment-variables",summary:"Configure secrets and vars \u2014 .dev.vars locally, wrangler secrets in production, env bindings inside functions.",title:"Environment variables"},{headings:["Multiple environments","Linking a checkout to a deployment","Preview deployments","Moving traffic between versions","Build once, deploy many","Custom domains","Trying a deploy without an account","Who changed what"],id:"concepts/environments",summary:"Running staging next to production, deploying an isolated environment, checking pull requests with a dry run, an isolated preview per pull\u2026",title:"Environments & releases"},{headings:["Throwing from a handler","Expected vs. unexpected","Reading error state on the client","Optimistic updates roll back on rejection","See also"],id:"concepts/error-handling",summary:"Throwing inside handlers, how errors travel to the client, and reading error state without losing optimistic safety.",title:"Error handling"},{headings:["What reaches your tracker","Wire it once, to both halves","Sentry","PostHog","Datadog, Axiom, Better Stack, and the rest","Source maps","Privacy"],id:"concepts/error-tracking",summary:"Send Lunora's failed calls and error logs to Sentry, PostHog, Datadog, or any error tracker, with the thrown error's real stack and\u2026",title:"Error tracking"},{headings:["External provider or @lunora/auth","The resolver","Client: hand over the token, refresh it","WebSockets and live queries","RLS with org claims","Memoization and revocation","Composing with @lunora/auth or Cloudflare Access","Walkthrough: Clerk"],id:"concepts/external-auth",summary:"Use Clerk, WorkOS AuthKit, Auth0, Supabase or any OIDC JWT issuer as your identity provider \u2014 verify its token at the Worker and feed\u2026",title:"External auth"},{headings:["Which contexts expose what","Uploading","Serving files","Named buckets","Deleting","See also"],id:"concepts/file-storage",summary:"Typed R2 buckets exposed as ctx.storage \u2014 uploading, serving via signed URLs, and deleting files from your functions.",title:"File storage"},{headings:["Where the work happens","Choosing between them","When a bare filter is fine","How the advisors catch this","Composing","Inside an object column"],id:"concepts/filtering",summary:".filter() is a JavaScript predicate applied after rows are loaded \u2014 when to use it, and when to reach for an index instead.",title:"Filtering"},{headings:["The three context types","Surfaces on every ctx","ctx field matrix","Add-on surfaces (codegen-wired)"],id:"concepts/function-context",summary:"The ctx object passed to every query, mutation, and action \u2014 and what each kind is allowed to do with it.",title:"Function context"},{headings:["api.ts and internal.ts: function references","server.ts: typed helpers","dataModel.ts: Id and Doc","Importing the generated code","lunora/* vs @lunora/* imports","Linting and formatting","Regenerating"],id:"concepts/generated-code",summary:"What @lunora/codegen emits from your schema.ts, and how api / Id / Doc keep server and client in sync.",title:"Generated code"},{headings:["Declaring a point column and a geo index",'"Places near me": near(point, radiusMeters)',"Bounding box: within(box)","Single-shard scope","How the Advisors catch geo mistakes"],id:"concepts/geospatial",summary:'Store lat/lng points with v.geoPoint, index them with .geoIndex, and answer "places near me" and bounding-box reads with withGeoIndex.',title:"Geospatial"},{headings:["httpAction","HttpActionCtx","Typed routes with httpRoute","How routes mount in the worker"],id:"concepts/http-endpoints",summary:"Public HTTP routes with httpAction and the Hono-based httpRouter.",title:"HTTP endpoints"},{headings:["Declaring an index","Querying with withIndex","Why every filtered read should hit an index","How the Advisors catch unindexed reads","Checking a read with explain","Aggregate indexes"],id:"concepts/indexes",summary:"Declare B-tree indexes on tables and query them with withIndex \u2014 every filtered read should hit one.",title:"Indexes"},{headings:["Calling internal functions","Internal functions and scheduling"],id:"concepts/internal-functions",summary:"internalQuery / internalMutation / internalAction \u2014 server-only functions never exposed to the client.",title:"Internal functions"},{headings:["Declare the stream","Publish","Follow a topic in the browser","Authorization","Where delivery stops","Platform support","React Native"],id:"concepts/live-streams",summary:"Publish events to named topics from the server and follow many of them over one SSE connection.",title:"Live topic streams"},{headings:["Turn CDC on first","Why the DO topology fits","Shapes \u2014 partial replication","The poke diff protocol","Custom mutators \u2014 optimistic, server-authoritative","The client store","Cross-shard joins \u2014 the one limit"],id:"concepts/local-first",summary:"Shapes, the poke diff protocol, and custom mutators \u2014 the Zero-class sync engine.",title:"Local-first sync"},{headings:["Strategies","Roles and bypass","What's masked, what isn't","Sensitive arguments","Tooling","See also"],id:"concepts/masking",summary:"Column-level redaction on the read path \u2014 the companion to row-level security.",title:"Data masking"},{headings:["The lifetime","Rebuilding: onShardInit","What .memory() buys, and what it does not","Restrictions","Choosing between .memory() and .ttl()"],id:"concepts/memory-tables",summary:"Declare .memory() for state the shard rebuilds rather than remembers \u2014 presence, cursors, live counters \u2014 and onShardInit to bring it back\u2026",title:"Memory tables"},{headings:["Attaching middleware","Augmenting ctx","Composing concerns"],id:"concepts/middleware",summary:"Compose cross-cutting concerns \u2014 auth checks, rate limiting, logging \u2014 and augment ctx for downstream handlers.",title:"Middleware"},{headings:["The deploy gate tells you when you need one","Schema migrations (global tables)","Data migrations (sharded tables)","Inspecting run-state in the Studio","One-off data edits without a deploy","Resetting local state"],id:"concepts/migrations",summary:"Schema-change SQL for global tables and online, resumable data migrations.",title:"Migrations"},{headings:["Queues and topics","What you get","Table ownership","Installed components"],id:"concepts/modules",summary:"Group lunora/ folders into modules and get a module catalog and an architecture diagram from codegen.",title:"Modules"},{headings:["Running as one node in a dev graph","Deploying from external IaC","Consuming the generated API from a sibling package","Calling the backend from a sibling Worker"],id:"concepts/monorepos-and-iac",summary:"Running the Lunora worker as one node in a larger dev graph, deploying it from Terraform/Pulumi/Alchemy, and consuming its generated API\u2026",title:"Monorepos and external IaC"},{headings:["The output is pinned to your CLI version","Wiring it into your project","What you get, and what you don't","Conformance"],id:"concepts/non-js-sdks",summary:"Generate a typed, self-contained Lunora client for Python, Go, Ruby, Rust, Swift, Java, Kotlin or Dart/Flutter \u2014 vendored into your\u2026",title:"Non-JS SDKs"},{headings:["Configure defineNotify","VAPID / FCM config via .dev.vars","Native devices (Android and iOS)","Register a browser push subscription","Send from an action","Queue-backed fan-out"],id:"concepts/notifications",summary:"Configure defineNotify in lunora/notify.ts for Web Push + FCM, register browser subscriptions, and send via ctx.notify / ctx.push from an\u2026",title:"Push notifications"},{headings:["Sinks","Structured logging with ctx.log","Tracing sub-operations with ctx.trace","Database telemetry (ctx.db and ctx.sql)","Trace sampling","Source maps","Application metrics with ctx.metrics","Container telemetry"],id:"concepts/observability",summary:"Ship Lunora's logs, traces, and metrics to any OTLP collector \u2014 the otlpSink worker option, ctx.log/ctx.trace/ctx.metrics, the zero-config\u2026",title:"Observability"},{headings:["Mutations are serialized, not retried","Where conflicts still happen","Handling a conflict on the client","Diagnosing a persistent conflict","Atomicity across shards",".global() tables"],id:"concepts/occ",summary:"Why mutations in one shard are serialized rather than retried, where optimistic-concurrency conflicts still arise, and what atomicity\u2026",title:"OCC & atomicity"},{headings:["Passing the adapters explicitly","What gets persisted","Surviving a breaking deploy","Multiple tabs","Sync status","Connection status UI","Boot with no network (the app shell)","The reconciliation model"],id:"concepts/offline-first",summary:"Persist reads and writes to disk so the app boots, renders, and accepts edits with no network.",title:"Offline-first"},{headings:["PaginationOptions","PaginationResult","Paging through a query","Ordering rows that hold NULL","Paging a findMany","Load more / infinite lists on the client",'Total count ("42 of 1,203")'],id:"concepts/pagination",summary:"Keyset pagination with .paginate(options) \u2014 page through a query and build an infinite list on the client.",title:"Pagination"},{headings:["ctx.db","ctx.auth","ctx.scheduler"],id:"concepts/queries-mutations",summary:"query / mutation / action \u2014 what each is for and how ctx is shaped.",title:"Queries & mutations"},{headings:["How this differs from a trigger","The convergence contract","What the handler receives","Execution and identity","Reads that should not wake you","Watching them work"],id:"concepts/reactors",summary:"Declare onQueryChange to run server logic when a query's result changes \u2014 the actor pattern, with no client on the other end and nothing\u2026",title:"Reactors (server-side reactivity)"},{headings:["Where a shard is created","Replica reads","Sockets near the client"],id:"concepts/read-replicas",summary:"Serve one-shot queries from a copy of the shard in the caller's region, pin where a shard is created, and terminate sockets near the client.",title:"Read replicas & placement"},{headings:["Hibernation","How an update reaches a subscriber","When a re-run fails","Reconnect","When WebSockets are blocked","Durable streams","Whispers (ephemeral peer messages)","Why no MQTT / Pub/Sub"],id:"concepts/realtime",summary:"How subscriptions, deltas, and hibernation fit together.",title:"Real-time"},{headings:["Using items","The manifest","Validation","Building the catalog","Distributing"],id:"concepts/registry-items",summary:"Package a reusable capability \u2014 schema, functions, bindings and env vars \u2014 as a registry item others install with one command.",title:"Authoring registry items"},{headings:["A worked example","The edge set","Directions","Depth, limit and score","Cycles and paging","It is an ordinary read","Fusing the graph into retrieval","From an AI agent"],id:"concepts/relation-graph",summary:"Traverse the foreign-key graph your schema already declares with ctx.db.related \u2014 depth-bounded, cycle-safe, scored by proximity, and\u2026",title:"Relation graph"},{headings:["The descriptors","Many-to-many","Index your foreign keys","Querying across a relation","Writing through a relation","Relations vs the relation graph"],id:"concepts/relations",summary:"Modeling many-to-one, one-to-many and many-to-many relationships with the one / many relation descriptors, foreign-key columns, join\u2026",title:"Relations"},{headings:["Default-closed","URLs and methods","Arguments","Choosing a shard","Authentication","Rate limiting","Caching","OpenAPI"],id:"concepts/rest-api",summary:"Publish a query, mutation, or action as a plain REST endpoint with .expose({ rest: true }) \u2014 default-closed, routed through the procedure\u2026",title:"Public REST API"},{headings:["Policies","Permissions and roles","Relation predicates","What's covered, what isn't","Testing policies","See also"],id:"concepts/rls",summary:"Server-side authorization that decides which rows a procedure can read or write.",title:"Row-level security"},{headings:["Node compatibility","Where the constraints bite","Bundling","The worker entry","Build once, deploy many"],id:"concepts/runtime",summary:"Everything runs on the Workers runtime \u2014 what that means for Node APIs, dependencies, and the 64 MiB bundle you have to fit into.",title:"Runtime & bundling"},{headings:["Deferring a function","Recurring jobs (Cron Triggers)","How dispatch works","See also"],id:"concepts/scheduling",summary:"Defer follow-up work with ctx.scheduler.runAfter / runAt, and run recurring jobs via Cron Triggers.",title:"Scheduling"},{headings:["Validators","Tier modifiers","Indexes"],id:"concepts/schema",summary:"Declarative tables, validators, indexes and sharding.",title:"Schema"},{headings:["Declaring a search index","Language","Running a search query","Matching rules","Filter fields","Relevance ordering, .take(n) and pagination","Limits","Backfill and staged"],id:"concepts/search",summary:"Declare a search index on a table and run relevance-ordered full-text queries.",title:"Full-text search"},{headings:["The HTTP edge","Auth, cookies, and secrets","Protecting public procedures","Securing sharded access","Advisor catalog","Config-time validation"],id:"concepts/security",summary:"Lunora's secure-by-default posture \u2014 the protections you get for free, how to opt out, and the advisor lints that catch the gaps.",title:"Security"},{headings:["From an SSR loader","From a script","From the terminal","From Python","From any language, over HTTP","Writing a new SDK"],id:"concepts/server-clients",summary:"Calling a Lunora deployment without a live subscription \u2014 from SSR loaders, scripts, other languages, or plain HTTP.",title:"Server-side & non-reactive clients"},{headings:["Declare a service","Call it from an action","What Lunora wires","Test an action that calls one","Make the service private","Smart Placement","Platforms","Migrating from URLs and HMAC"],id:"concepts/services",summary:"Call sibling Cloudflare Workers from actions over typed service bindings, run them in one dev session, and deploy them before the app.",title:"Services"},{headings:["When to shard","Migrating a populated table","What stays in the root DO","Going global","Cross-shard reads","The shard registry","Securing shard access"],id:"concepts/sharding",summary:"Default __root__ DO, opt-in .shardBy(), and .global() escape hatch.",title:"Sharding"},{headings:["The one caveat that matters","The read surface","_scheduled_functions","_storage"],id:"concepts/system-tables",summary:"Read pending scheduled jobs and stored file metadata through ctx.db.system \u2014 a read-only, eventually consistent view outside the mutation\u2026",title:"System tables"},{headings:["Install","Configure","Write a test","Run in CI"],id:"concepts/testing-ai-features",summary:"Drive a Lunora app's AI flows in a real browser with the e2e runner, and judge non-deterministic model output with natural-language\u2026",title:"Testing AI features end to end"},{headings:["The in-memory harness","Asserting reactive results","Mail-catcher helpers (E2E)","Running in CI"],id:"concepts/testing",summary:"Unit-test queries, mutations, and actions in memory with lunoraTest \u2014 no worker, no network.",title:"Testing"},{headings:["Declaring a TTL","Sweep semantics: coarse, batched, bounded","Not on .global() tables","Interaction with soft delete","How the Advisors catch TTL mistakes"],id:"concepts/ttl",summary:"Declare a table-level .ttl() so a DO alarm sweep auto-deletes expired rows \u2014 sessions, OTPs, and other ephemeral data.",title:"TTL & auto-expiry"},{headings:["Where types come from","Do not restate what is inferred","Reach for Doc and Id","Pin the client contract with .output()","Optional versus null in types","Bringing your own validators","Project configuration","Keeping types honest in CI"],id:"concepts/typescript",summary:"Getting the most out of Lunora's end-to-end types \u2014 where types come from, what to annotate, and what to let inference do.",title:"TypeScript"},{headings:["Job 1: column types in defineTable","Job 2: argument and return validation","Return-type inference to the client","Common validators","Coming from zod","ValidationError"],id:"concepts/validation",summary:"The v.* validators that type your columns and parse query / mutation / action inputs and outputs end to end.",title:"Validation"},{headings:["Declaring an index","Automatic write sync","ctx.vectors","RAG with @lunora/ai","Binding & config wiring"],id:"concepts/vector-search",summary:"Typed Vectorize indexes on ctx.vectors \u2014 automatic write sync, similarity search, and RAG with embeddings.",title:"Vector search"},{headings:["The specification","Conformance fixtures","SDKs built on it"],id:"concepts/wire-protocol",summary:"The language-independent Lunora client\u2194server wire protocol and the golden fixtures every SDK is tested against.",title:"Wire protocol"},{headings:["Idle and small apps: the free plan","Past the free plan: Workers Paid","Which meters grow with your app","Choosing where the cost lands"],id:"cost",summary:"What a self-hosted Lunora app costs on Cloudflare, what the free plan covers, and which meters grow with traffic.",title:"What Lunora costs to run"},{headings:["wrangler.jsonc","lunora.config.ts","Secrets","Containers","Deploy","Durable Object class limit","Worker size","Streaming logs"],id:"deployment",summary:"Wrangler bindings, secrets, and the deploy flow.",title:"Deployment"},{headings:["Redacted codes","Build-time errors","Throwing your own","Error codes"],id:"errors",summary:"Every well-known Lunora error code \u2014 its HTTP status, what it means, and what to do about it.",title:"Errors & warnings reference"},{headings:["Branching on one","The same number, in the document","Where the numbers come from","From your own code"],id:"exit-codes",summary:"The exit code every lunora command terminates with \u2014 what each number means, and how it is derived from the error catalog.",title:"CLI exit codes"},{headings:["Is Lunora open source?","Can I run Lunora on my own Cloudflare account?","Is Lunora production-ready?","Does Lunora run on Cloudflare's free plan?","Can one app scale past a single Durable Object?","How do I move an existing app to Lunora?"],id:"faq",summary:"Short answers to the questions people ask before adopting Lunora, with links to the pages that go deeper.",title:"FAQ"},{headings:["Install","Provide the client","Live queries","Mutations","Connection status","Reactive loaders"],id:"frameworks/angular",summary:"Use Lunora with Angular \u2014 provideLunora in your app config, signal-based liveQuery, imperative mutate, and a connectionStatus signal.",title:"Angular"},{headings:["Install","Exports","The integration","Single-worker composition with withLunora","Reactive-loader server helpers","Deploy"],id:"frameworks/astro",summary:"Compose Astro's @astrojs/cloudflare worker with Lunora realtime, plus reactive-loader server helpers for .astro frontmatter.",title:"Astro"},{headings:["One worker, two dispatch flows","Mount Lunora inside your framework","The per-framework matrix","Client adapters","Scaffolding","Vite composition"],id:"frameworks/bring-your-framework",summary:"Compose any meta-framework's SSR with Lunora realtime in one Cloudflare Worker.",title:"Bring your framework"},{headings:["One worker, two dispatch flows","Class A: Lunora owns the worker entry","Class B: the framework owns the CF adapter","Class C: SPA / SSR-less","Wrangler reconciliation"],id:"frameworks/deploy",summary:"One worker, one deploy \u2014 how a composed Lunora + meta-framework app ships to Cloudflare.",title:"Deploy your framework"},{headings:["Why two workers","Wiring them together","Client and server entry points","Loading data in a Server Component","Providing the client","Developing","Deploying"],id:"frameworks/nextjs",summary:"Run Lunora alongside Next.js on Cloudflare with the two-worker split \u2014 RSC loaders that hydrate into live subscriptions.",title:"Next.js"},{headings:["Install","Setup","How it works","Provide the client","Reactive loaders","Feature flags","Verify before deploy","Alternative: two-worker split"],id:"frameworks/nuxt",summary:"Run Lunora and Nuxt as one Cloudflare Worker \u2014 the @lunora/nuxt module mounts /_lunora/** into Nitro, plus reactive-loader server helpers.",title:"Nuxt"},{headings:["Scaffold a new app","Install","Create the client","Provide it","Live queries and mutations","HTTP streams","Local-first (shapes, custom mutators, TanStack DB)","Authentication (better-auth + Expo)"],id:"frameworks/react-native",summary:"Use Lunora in a React Native / Expo app \u2014 the same live hooks, plus an AsyncStorage-backed client and a better-auth Expo bridge.",title:"React Native / Expo"},{headings:["Install","Provide the client","Live queries","Mutations","Auth","Reactive loaders","One worker, one deploy"],id:"frameworks/react",summary:"Use Lunora with React \u2014 a provider, live useQuery/useMutation hooks, and the SSR-seed \u2192 live reactive-loader handoff.",title:"React"},{headings:["The problem with static loaders","The handoff","Why there's no flash","Identity continuity (SSR \u2192 client)","Sharding carries through","Status"],id:"frameworks/reactive-loaders",summary:"Your loaders are live \u2014 SSR data that hydrates into a real-time subscription with no flash.",title:"Reactive loaders"},{headings:["Install","Solid 1.x and Solid 2.0","Provide the client","Live queries","Mutations","Reactive loaders"],id:"frameworks/solid",summary:"Use Lunora with SolidJS \u2014 a provider, live createQuery/createMutation primitives, and the SSR-seed \u2192 live reactive-loader handoff.",title:"Solid"},{headings:["Install","Provide the client","Live queries","Mutations","Reactive loaders","One worker, one deploy"],id:"frameworks/svelte",summary:"Use Lunora with Svelte 5 / SvelteKit \u2014 context-provided client, live query/mutation stores, and the SSR-seed \u2192 live reactive-loader handoff.",title:"Svelte"},{headings:["What you're proving","1. Scaffold","2. Dev","3. Prove SSR preload (curl the raw HTML)","4. Prove the live subscription attaches","5. Prove live update (two tabs)","Identity check (optional, with auth)",'What "pass" looks like'],id:"frameworks/verify-live-loaders",summary:"How to actually prove live loaders work \u2014 scaffold, SSR-curl the preloaded value, two-tab live update.",title:"Manual end-to-end verification"},{headings:["Install","Provide the client","Live queries","Mutations","Reactive loaders","Worker composition"],id:"frameworks/vue",summary:"Use Lunora with Vue 3 \u2014 a client plugin, live useQuery/useMutation composables, and the server-side rendering (SSR) seed to live\u2026",title:"Vue"},{headings:["Requirements"],id:"getting-started",summary:"Scaffold a Lunora app and run the dev loop in under a minute.",title:"Getting started"},{headings:["Durable Objects","Statement limits (Durable Objects **and** D1)","Transaction limits","D1","R2","Workers","Worker startup (error 10021)","Queues"],id:"limits",summary:"Cloudflare ceilings you should keep in your head.",title:"Limits"},{headings:["Two translations, not one","Schema: transposing the relation graph","Procedures: the shape deltas","Writes: .returning() does not survive","Components decompose by hand"],id:"migrating/from-a-convex-toolkit",summary:"The second translation step a Drizzle-style schema DSL and a tRPC-style procedure builder add on top of the raw Convex mapping.",title:"Migrating from a Convex toolkit"},{headings:["Bump strategy","Breaking changes already landed","Recommended (non-breaking) follow-ups","See also"],id:"migrating/from-alpha",summary:"How a 1.0.0-alpha.* app moves to stable \u2014 dependency bumps plus every breaking change already landed on the road to 1.0.",title:"Upgrading from alpha to 1.0"},{headings:["At a glance","Schema","Queries, mutations, actions","React","Auth","Scheduler","File storage","Subscriptions"],id:"migrating/from-convex",summary:"Side-by-side mapping \u2014 schema, queries, mutations, actions, React hooks.",title:"Migrating from Convex"},{headings:["At a glance","Schema","Reads: onSnapshot \u2192 useQuery","Writes: setDoc \u2192 mutation","Cloud Functions \u2192 actions","Auth","File storage","Scheduled work"],id:"migrating/from-firebase",summary:"Side-by-side mapping \u2014 Firestore, Cloud Functions, Auth, Storage, and real-time listeners.",title:"Migrating from Firebase"},{headings:["At a glance","Schema","Reads: supabase.from(...).select() \u2192 useQuery","Writes: .insert() \u2192 mutation","Row-level security","Edge Functions \u2192 actions","Auth","File storage"],id:"migrating/from-supabase",summary:"Side-by-side mapping \u2014 Postgres tables, RLS, Edge Functions, Auth, Storage, and Realtime.",title:"Migrating from Supabase"},{headings:["No arbitrary external SQL or ad-hoc cross-dataset joins","RPC-first, not REST-first","Cross-shard writes are eventual, not atomic","No data warehouse hosting in the framework","No managed control plane as a hard dependency","Also deliberately absent","See also"],id:"non-goals",summary:"The things Lunora deliberately does not do \u2014 each with the reason it's a boundary and the escape hatch when you need past it.",title:"Design boundaries"},{headings:["Why Lunora","Self-host, or use Lunora Cloud","How Lunora compares","Where it's rough","What ships in the alpha","Start building"],id:"overview",summary:"The Convex-style real-time backend that runs on your own Cloudflare account \u2014 typed end to end, live by default, ~$0 at idle.",title:"Overview"},{headings:["Bindings and wrangler config","Secrets","LUNORA_ADMIN_TOKEN and the admin plane","Rate limiting and abuse","Auth and row-level security","Migrations","Observability","Health and readiness endpoint"],id:"production-checklist",summary:"Everything to verify before a Lunora app takes real traffic \u2014 bindings, secrets, admin tokens, rate limits, RLS, migrations, observability.",title:"Production checklist"},{headings:["Pick a starting point","Adding Lunora to an app you already have","What you get either way","Next steps"],id:"quickstarts",summary:"Every starting point Lunora scaffolds \u2014 pick your framework, run one command, and get a live backend wired to it.",title:"Quickstarts"},{headings:["1. See where you stand","2. Create the usage alerts","3. Add the budget alert by hand","4. Check delivery","In CI"],id:"runaway-bill",summary:"Set Cloudflare usage alerts well above normal with `lunora cloudflare alerts`, add the budget alert the API cannot, and check what\u2026",title:"Protect yourself from a runaway bill"},{headings:["Why startup grows with the app","Measure it locally","The fix: load function modules on demand","Keep heavy packages off the startup path"],id:"startup-cpu-limit",summary:'Why a large app fails to deploy with "Script startup exceeded CPU time limit", how to measure it, and how lazy function loading and\u2026',title:"Worker startup CPU limit (error 10021)"},{headings:["1. Scaffold","2. Model the data","3. Generate the migration","4. Write the query","5. Write the mutation","6. Wire the React app","7. Run the dev loop","8. Deploy"],id:"tutorial/realtime-chat",summary:"End-to-end Lunora walkthrough \u2014 schema, query, mutation, subscription, React, sharding.",title:"Build a real-time chat app in 15 minutes"},{headings:["Know when to act","Step 1: shard the messages","Step 2: put identities in a global table","Step 3: keep fan-out off the hot path","Step 4: lock down shard access","Step 5: migrate the data you already have","Checking your work","What you learned"],id:"tutorial/scaling",summary:"Take the chat app from one Durable Object to many \u2014 shard by channel, put identities in a global table, and keep cross-shard reads off the\u2026",title:"Tutorial: scaling the chat app"},{headings:["Release channels","What SemVer means here","Stability tiers",'What "experimental" means',"See also"],id:"versioning",summary:"What SemVer means for Lunora packages \u2014 release channels, stability tiers, and the experimental surface.",title:"Versioning & stability"}],l="https://lunora.sh/docs/",u=4,m=3,g=200,p=4,y=3,f=2,w=1,v=r(t=>t.slice(0,g).toLowerCase().split(/[^a-z0-9.]+/u).filter(a=>a.length>=m),"w"),b=r((t,a)=>{let n=t.id.toLowerCase(),e=t.title.toLowerCase(),s=t.summary.toLowerCase(),c=t.headings.map(i=>i.toLowerCase()),o=0;for(let i of a)n.includes(i)&&(o+=p),e.includes(i)&&(o+=y),c.some(h=>h.includes(i))&&(o+=f),s.includes(i)&&(o+=w);return o},"v"),k=r(t=>{let a=v(typeof t=="string"?t:""),n=a.length===0?[]:d.map(e=>({candidate:e,rank:b(e,a)})).filter(e=>e.rank>0).sort((e,s)=>s.rank-e.rank).slice(0,u).map(e=>({...e.candidate,url:`${l}${e.candidate.id}`}));return{entries:n.length===0?d.map(e=>e.id):n}},"b"),S=r(t=>{let{entries:a}=k(t);return a.every(n=>typeof n=="string")?[`Documentation pages under ${l}: ${a.join(", ")}`]:a.map(n=>{let e=n;return`${e.title} (${e.url}): ${e.summary} Sections: ${e.headings.join(", ")}`})},"k");export{S as knowledgeExcerpts};
@@ -0,0 +1 @@
1
+ import{G as ve,H as Ce,c as Z,d as fe,f as he,fa as Pe,g as ge,ga as G,h as ye,ha as Re,i as Se,ia as we,ja as be,ka as Ee,ta as xe}from"./chunk-YNCZVYCO.js";import{b as Y}from"./chunk-OWRWDDJT.js";import{a as Ye}from"./chunk-N7FOBAV3.js";import{F as U,H as j,M as V,N,e as de}from"./chunk-4SY2N2RS.js";import{a as ue}from"./chunk-4AG356VE.js";import{b as ce,f as le,o as pe,u as E,v,w as W}from"./chunk-OZID3UYF.js";import{d as me,g as w,i as D}from"./chunk-L27FKJTG.js";import{a as B,b as je}from"./chunk-ADABTCDI.js";import{a as n,d as R}from"./chunk-5PEAXTYQ.js";var Te=class{static{n(this,"BasePopupHandle")}attachedStores=[];attachedStoreValue=null;storeListeners=new Set;constructor(t,o,r=!0){this.fallbackStore=t,this.componentName=o,this.throwOnMissingTrigger=r}get attachedStore(){return this.attachedStoreValue}get store(){return this.attachedStoreValue??this.fallbackStore}get serverStore(){return this.fallbackStore}subscribeStore(t){return this.storeListeners.add(t),()=>{this.storeListeners.delete(t)}}attachStore(t){return this.attachedStores.push(t),this.setActiveStore(t),()=>{let o=this.attachedStores.lastIndexOf(t);o!==-1&&this.attachedStores.splice(o,1),this.setActiveStore(this.attachedStores[this.attachedStores.length-1]??null)}}setActiveStore(t){this.attachedStoreValue!==t&&(this.attachedStoreValue=t,this.storeListeners.forEach(o=>{o()}))}openByTrigger(t){let o=this.attachedStore;if(o===null)return;let r;if(t){for(let s=this.attachedStores.length-1;s>=0&&!r;s-=1)r=this.attachedStores[s].context.triggerElements.getById(t);r??=this.fallbackStore.context.triggerElements.getById(t)}if(t&&!r&&this.throwOnMissingTrigger)throw new Error(me(99,this.componentName,t,this.componentName));o.setOpen(!0,N(V.imperativeAction,void 0,r))}closePopup(){let t=this.attachedStore;t!==null&&t.setOpen(!1,N(V.imperativeAction))}};var ee=R(B(),1),Oe=R(Ye(),1);function rt(e){let t=ee.useCallback(r=>e===void 0?w:e.subscribeStore(r),[e]),o=ee.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Oe.useSyncExternalStore)(t,o,()=>e?.serverStore)}n(rt,"usePopupHandleStore");var Ae=R(B(),1),te=R(ue(),1);function lt(e,t){let o=Ae.useRef(null);function r(i){te.flushSync(()=>{e.setOpen(!1,N(V.focusOut,i.nativeEvent,i.currentTarget))}),ye(o.current)?.focus()}n(r,"handlePreFocusGuardFocus");function s(i){let u=e.select("positionerElement");if(u&&Se(i,u))e.context.beforeContentFocusGuardRef.current?.focus();else{te.flushSync(()=>{e.setOpen(!1,N(V.focusOut,i.nativeEvent,i.currentTarget))});let a=ge(e.context.triggerFocusTargetRef.current||t.current);for(;a!==null&&de(u,a);){let l=a;if(a=he(a),a===l)break}a?.focus()}}return n(s,"handleFocusTargetFocus"),{preFocusGuardRef:o,handlePreFocusGuardFocus:r,handleFocusTargetFocus:s}}n(lt,"useTriggerFocusGuards");var c=R(B(),1),Le=R(ue(),1);var F=R(B(),1);function oe(e){let t=pe(e),o=parseFloat(t.width)||0,r=parseFloat(t.height)||0,s=le(e),i=s?e.offsetWidth:o,u=s?e.offsetHeight:r;return(Z(o)!==i||Z(r)!==u)&&(o=i,r=u),{width:o,height:r}}n(oe,"getCssDimensions");var H="--popup-width",_="--popup-height";function Ne(e){let{popupElement:t,positionerElement:o,content:r,mounted:s,onMeasureLayout:i,onMeasureLayoutComplete:u,side:a,direction:l}=e,g=j(t,!0),C=U(),p=F.useRef(null),d=F.useRef(!0),m=F.useRef(w),y=E(i),h=E(u),b=F.useMemo(()=>Ge(a,l),[a,l]);v(()=>{if(!s){m.current=w,d.current=!0,p.current=null;return}if(!t||!o)return;m.current=Ve(t,b),ne(t,"auto");let I=q(t,"position","static"),x=q(t,"transform","none"),S=q(t,"scale","1"),T=Ve(o,{[Re]:"max-content",[we]:"max-content"});function X(){I(),x(),T()}n(X,"restoreMeasurementOverrides");function L(){X(),S()}if(n(L,"restoreMeasurementOverridesIncludingScale"),y?.(),d.current||p.current===null){K(o,"max-content");let A=oe(t);return p.current=A,K(o,A),L(),h?.(null,A),d.current=!1,()=>{m.current(),m.current=w}}K(o,"max-content");let O=p.current,P=oe(t);p.current=P,ne(t,O),L(),h?.(O,P),K(o,P);let $=new AbortController;return C.request(()=>{ne(t,P),g(()=>{t.style.setProperty(H,"auto"),t.style.setProperty(_,"auto")},$.signal)}),()=>{$.abort(),C.cancel(),m.current(),m.current=w}},[r,t,o,g,C,s,y,h,b])}n(Ne,"usePopupAutoResize");function Ge(e,t){let o=e==="top",r=e==="left"||e===(t==="rtl"?"inline-end":"inline-start");return!o&&!r?D:{position:"absolute",[o?"bottom":"top"]:"0",[r?"right":"left"]:"0"}}n(Ge,"getPopupAnchoringStyles");function q(e,t,o){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,o),()=>{e.style.setProperty(t,r)}}n(q,"overrideElementStyle");function Ve(e,t){let o=[];for(let[r,s]of Object.entries(t))o.push(q(e,r,s));return o.length?()=>{o.forEach(r=>r())}:w}n(Ve,"applyElementStyles");function ne(e,t){let o=t==="auto"?"auto":`${t.width}px`,r=t==="auto"?"auto":`${t.height}px`;e.style.setProperty(H,o),e.style.setProperty(_,r)}n(ne,"setPopupCssSize");function K(e,t){let o=t==="max-content"?"max-content":`${t.width}px`,r=t==="max-content"?"max-content":`${t.height}px`;e.style.setProperty(be,o),e.style.setProperty(Ee,r)}n(K,"setPositionerCssSize");var Fe={name:"adaptiveOrigin",async fn(e){let{x:t,y:o,rects:{floating:r},elements:{floating:s},platform:i,strategy:u,placement:a}=e,l=ce(s),g=l.getComputedStyle(s);if(!(g.transitionDuration!=="0s"&&g.transitionDuration!==""))return{x:t,y:o,data:G};let p=await i.getOffsetParent?.(s),d={width:0,height:0};if(u==="fixed"&&l?.visualViewport)d={width:l.visualViewport.width,height:l.visualViewport.height};else if(p===l){let x=W(s);d={width:x.documentElement.clientWidth,height:x.documentElement.clientHeight}}else await i.isElement?.(p)&&(d=await i.getDimensions(p));let m=fe(a),y=t,h=o;m==="left"&&(y=d.width-(t+r.width)),m==="top"&&(h=d.height-(o+r.height));let b=m==="left"?"right":G.sideX,I=m==="top"?"bottom":G.sideY;return{x:y,y:h,data:{sideX:b,sideY:I}}}};var Me="data-activation-direction";var M=R(je(),1);var Yt={activationDirection:n(e=>e?{[Me]:e}:null,"activationDirection")};function Gt(e){let{store:t,side:o,children:r}=e,s=Y(),i=t.useState("activeTriggerElement"),u=t.useState("activeTriggerId"),a=t.useState("open"),l=t.useState("payload"),g=t.useState("mounted"),C=t.useState("popupElement"),p=t.useState("positionerElement"),d=xe(a?i:null),m=Je(u,l),y=c.useRef(null),[h,b]=c.useState(null),[I,x]=c.useState(null),S=c.useRef(null),T=c.useRef(null),X=j(S,!0),L=U(),O=c.useRef(null),[P,$]=c.useState(null),[A,J]=c.useState(!1);v(()=>(t.set("adaptiveOrigin",Fe),()=>{t.set("adaptiveOrigin",void 0)}),[t]);let ke=E(()=>{S.current?.style.setProperty("animation","none"),S.current?.style.setProperty("transition","none"),T.current?.style.setProperty("display","none")}),Be=E(f=>{S.current?.style.removeProperty("animation"),S.current?.style.removeProperty("transition"),T.current?.style.removeProperty("display"),f&&$(f)}),ie=E(()=>{O.current?.abort();let f=new AbortController;O.current=f,X(()=>{b(null),$(null),y.current=null},f.signal)}),z=c.useRef(null);v(()=>{(!a||!g)&&(z.current=null)},[a,g]),v(()=>{if(i&&d&&i!==d&&z.current!==i&&y.current){b(y.current),J(!0);let f=Xe(d,i);x(f),z.current=i}},[i,d]),v(()=>{h!=null&&(O.current?.abort(),J(!0),L.request(()=>{Le.flushSync(()=>{J(!1)}),ie()}))},[m,h,ie,L]),v(()=>{let f=S.current;if(!f)return;let ae=W(f).createElement("div");for(let Ue of Array.from(f.childNodes))ae.appendChild(Ue.cloneNode(!0));y.current=ae});let se=h!=null,Q;se?Q=(0,M.jsxs)(c.Fragment,{children:[(0,M.jsx)("div",{"data-previous":!0,inert:Pe(!0),ref:T,style:{...P?{[H]:`${P.width}px`,[_]:`${P.height}px`}:null,position:"absolute"},"data-ending-style":A?void 0:""},"previous"),(0,M.jsx)("div",{"data-current":!0,ref:S,"data-starting-style":A?"":void 0,children:r},m)]}):Q=(0,M.jsx)("div",{"data-current":!0,ref:S,children:r},m),v(()=>{let f=T.current;!f||!h||f.replaceChildren(...Array.from(h.childNodes))},[h]),Ne({popupElement:C,positionerElement:p,mounted:g,content:l,onMeasureLayout:ke,onMeasureLayoutComplete:Be,side:o,direction:s});let We={activationDirection:qe(I),transitioning:se};return{children:Q,state:We}}n(Gt,"usePopupViewport");function qe(e){if(e)return`${Ie(e.horizontal,5,"right","left")} ${Ie(e.vertical,5,"down","up")}`}n(qe,"getActivationDirection");function Ie(e,t,o,r){return e>t?o:e<-t?r:""}n(Ie,"getValueWithTolerance");function Xe(e,t){let o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s={x:o.left+o.width/2,y:o.top+o.height/2},i={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:i.x-s.x,vertical:i.y-s.y}}n(Xe,"calculateRelativePosition");function Je(e,t){let[o,r]=c.useState(0),s=c.useRef(e),i=c.useRef(t),u=c.useRef(!1);return v(()=>{let a=s.current,l=i.current,g=e!==a,C=t!==l;g?(r(p=>p+1),u.current=!C):u.current&&C&&(r(p=>p+1),u.current=!1),s.current=e,i.current=t},[e,t]),`${e??"current"}-${o}`}n(Je,"usePopupContentKey");function zt(e,t,o=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Ce({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:o,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:D,inactiveTriggerProps:D,popupProps:D}}n(zt,"createInitialPopupStoreState");var k=n(e=>e.triggerIdProp??e.activeTriggerId,"activeTriggerIdSelector"),re=n(e=>e.openProp??e.open,"openSelector"),$e=n(e=>(e.popupElement?.id??e.floatingId)||void 0,"popupIdSelector");function He(e,t){return t!==void 0&&re(e)&&k(e)===t}n(He,"triggerOwnsOpenPopup");function ze(e,t){return He(e,t)?!0:t!==void 0&&re(e)&&k(e)==null&&e.triggerCount===1}n(ze,"triggerOwnsOpenPopupOrIsOnlyTrigger");var Qt={open:re,mounted:n(e=>e.mounted,"mounted"),transitionStatus:n(e=>e.transitionStatus,"transitionStatus"),floatingRootContext:n(e=>e.floatingRootContext,"floatingRootContext"),triggerCount:n(e=>e.triggerCount,"triggerCount"),preventUnmountingOnClose:n(e=>e.preventUnmountingOnClose,"preventUnmountingOnClose"),payload:n(e=>e.payload,"payload"),activeTriggerId:k,activeTriggerElement:n(e=>e.mounted?e.activeTriggerElement:null,"activeTriggerElement"),popupId:$e,isTriggerActive:n((e,t)=>t!==void 0&&k(e)===t,"isTriggerActive"),isOpenedByTrigger:n((e,t)=>He(e,t),"isOpenedByTrigger"),isMountedByTrigger:n((e,t)=>t!==void 0&&k(e)===t&&e.mounted,"isMountedByTrigger"),triggerProps:n((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,"triggerProps"),triggerPopupId:n((e,t)=>ze(e,t)?$e(e):void 0,"triggerPopupId"),popupProps:n(e=>e.popupProps,"popupProps"),popupElement:n(e=>e.popupElement,"popupElement"),positionerElement:n(e=>e.positionerElement,"positionerElement")};var _e=class extends ve{static{n(this,"NullStore")}setState(t){}update(t){}set(t,o){}notifyAll(){}};export{Te as a,zt as b,Qt as c,rt as d,_e as e,lt as f,Yt as g,Gt as h};