@lunora/studio 1.0.0-alpha.34 → 1.0.0-alpha.340

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 (472) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/index.d.mts +1597 -0
  4. package/dist/index.d.ts +991 -807
  5. package/dist/index.mjs +1 -0
  6. package/dist/mount.d.mts +22 -0
  7. package/dist/mount.d.ts +11 -10
  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 +6 -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 +10 -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-usage-panel.mjs +1 -0
  31. package/dist/packem_chunks/analytics-panel.mjs +1 -0
  32. package/dist/packem_chunks/architecture-panel.mjs +1 -0
  33. package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
  34. package/dist/packem_chunks/auth-config-panel.mjs +1 -0
  35. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
  36. package/dist/packem_chunks/containers-panel.mjs +1 -0
  37. package/dist/packem_chunks/dashboards-panel.mjs +1 -0
  38. package/dist/packem_chunks/evals-panel.mjs +1 -0
  39. package/dist/packem_chunks/fanout-panel.mjs +1 -0
  40. package/dist/packem_chunks/flags-panel.mjs +1 -0
  41. package/dist/packem_chunks/issues-panel.mjs +1 -0
  42. package/dist/packem_chunks/kv-browser.mjs +1 -0
  43. package/dist/packem_chunks/log-drains-panel.mjs +4 -0
  44. package/dist/packem_chunks/migrations-route.mjs +1 -0
  45. package/dist/packem_chunks/organizations-panel.mjs +1 -0
  46. package/dist/packem_chunks/payments-panel.mjs +1 -0
  47. package/dist/packem_chunks/permissions-panel.mjs +1 -0
  48. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -0
  49. package/dist/packem_chunks/queues-panel.mjs +1 -0
  50. package/dist/packem_chunks/reactors-panel.mjs +1 -0
  51. package/dist/packem_chunks/rls-panel.mjs +1 -0
  52. package/dist/packem_chunks/schedule-panel.mjs +1 -0
  53. package/dist/packem_chunks/sparkline.mjs +1 -0
  54. package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
  55. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  56. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  57. package/dist/packem_chunks/traces-panel.mjs +1 -0
  58. package/dist/packem_chunks/users-panel.mjs +1 -0
  59. package/dist/packem_chunks/vector-browser.mjs +1 -0
  60. package/dist/packem_chunks/workflows-panel.mjs +1 -0
  61. package/dist/packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs +1 -0
  62. package/dist/packem_shared/ApiDocsPanel-Py7C4ibM.mjs +2 -0
  63. package/dist/packem_shared/ApiReferencePanel-DlYVADAy.mjs +1 -0
  64. package/dist/packem_shared/CommandPalette-CM1hqAOD.mjs +1 -0
  65. package/dist/packem_shared/ConfirmButton-DU4p72Er.mjs +1 -0
  66. package/dist/packem_shared/ConnectionBadge-B8Hj5DaE.mjs +1 -0
  67. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs +1 -0
  68. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  69. package/dist/packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs +1 -0
  70. package/dist/packem_shared/DataBrowser-DxlLv5x1.mjs +4 -0
  71. package/dist/packem_shared/DataFilters-CYZFt2EK.mjs +1 -0
  72. package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
  73. package/dist/packem_shared/GlobalDataBrowser-TFTQpSVj.mjs +1 -0
  74. package/dist/packem_shared/HomePanel-BVz2sDQ4.mjs +1 -0
  75. package/dist/packem_shared/MigrationsPanel-fUyhbt0w.mjs +1 -0
  76. package/dist/packem_shared/OpenRpcReferencePanel-nYyfjjse.mjs +1 -0
  77. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
  78. package/dist/packem_shared/ScheduledJobs-zSeU_6cN.mjs +1 -0
  79. package/dist/packem_shared/ShardInput-C6mjgAh4.mjs +1 -0
  80. package/dist/packem_shared/Studio-CNqMkRmB.mjs +1 -0
  81. package/dist/packem_shared/StudioApp-CUxEVr__.mjs +1 -0
  82. package/dist/packem_shared/StudioI18nProvider-fVsCSs5L.mjs +1 -0
  83. package/dist/packem_shared/advisor-view-CXiPdw4B.mjs +1 -0
  84. package/dist/packem_shared/aggregateMetrics-DKFJc-o5.mjs +1 -0
  85. package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
  86. package/dist/packem_shared/app.d-D45VvUTx.d.mts +351 -0
  87. package/dist/packem_shared/app.d-D45VvUTx.d.ts +351 -0
  88. package/dist/packem_shared/auth-pager-DiDnXsfe.mjs +1 -0
  89. package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
  90. package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
  91. package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
  92. package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
  93. package/dist/packem_shared/card-By2O8ULa.mjs +1 -0
  94. package/dist/packem_shared/cf-links-CBJ5SywP.mjs +1 -0
  95. package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
  96. package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
  97. package/dist/packem_shared/data-grid-BHTuvSI7.mjs +1 -0
  98. package/dist/packem_shared/data-view-params-DhYmAkcj.mjs +1 -0
  99. package/dist/packem_shared/diagram-export-panel-BMLzao0Y.mjs +2 -0
  100. package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
  101. package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
  102. package/dist/packem_shared/error-alert-D-ftqyo-.mjs +1 -0
  103. package/dist/packem_shared/grid-features-CIdZ8Dqo.mjs +6 -0
  104. package/dist/packem_shared/grid-pagination-DgzyzfBh.mjs +1 -0
  105. package/dist/packem_shared/home-panel-CF-MfsnH.mjs +3 -0
  106. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  107. package/dist/packem_shared/internal-BXEjuLPN.mjs +2 -0
  108. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  109. package/dist/packem_shared/live-status-BuJdUZFU.mjs +1 -0
  110. package/dist/packem_shared/log-fields-BolUoZ9g.mjs +1 -0
  111. package/dist/packem_shared/log-line-BWDt_F56.mjs +1 -0
  112. package/dist/packem_shared/metrics-format-1sNGG47R.mjs +1 -0
  113. package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
  114. package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
  115. package/dist/packem_shared/recording-client-CFBkH4uZ.mjs +1 -0
  116. package/dist/packem_shared/reference-view-BrsL8UGn.mjs +13 -0
  117. package/dist/packem_shared/schema-diagram-ghsOCED7.mjs +2 -0
  118. package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
  119. package/dist/packem_shared/select-DPyS18Vy.mjs +2 -0
  120. package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
  121. package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
  122. package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
  123. package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
  124. package/dist/packem_shared/sql-result-table-COsfUSGc.mjs +1 -0
  125. package/dist/packem_shared/stat-card-BAv73QtB.mjs +1 -0
  126. package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
  127. package/dist/packem_shared/studio-BcHsk7mT.mjs +2 -0
  128. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  129. package/dist/packem_shared/table-list-sidebar-DwqtHSHU.mjs +1 -0
  130. package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
  131. package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
  132. package/dist/packem_shared/use-admin-query-I1uILsUP.mjs +1 -0
  133. package/dist/packem_shared/use-admin-spec-BdNLZbTO.mjs +1 -0
  134. package/dist/packem_shared/use-async-submit-2eBBD0-m.mjs +1 -0
  135. package/dist/packem_shared/use-auth-config-DQ8tNyBh.mjs +1 -0
  136. package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
  137. package/dist/packem_shared/use-open-trace-B_0LbTD7.mjs +1 -0
  138. package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
  139. package/dist/packem_shared/use-sql-assistant-DetnUyFf.mjs +1 -0
  140. package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
  141. package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
  142. package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
  143. package/dist/standalone/chunk-253UHWDX.js +1 -0
  144. package/dist/standalone/chunk-2I4NHEKA.js +1 -0
  145. package/dist/standalone/chunk-2IKDEUCX.js +1 -0
  146. package/dist/standalone/chunk-2SNK7KHX.js +1 -0
  147. package/dist/standalone/chunk-37WYCOQ2.js +1 -0
  148. package/dist/standalone/chunk-3FYMEXVB.js +1 -0
  149. package/dist/standalone/chunk-3N5PRV3V.js +1 -0
  150. package/dist/standalone/chunk-3YXASVTP.js +1 -0
  151. package/dist/standalone/chunk-43GV7LQK.js +1 -0
  152. package/dist/standalone/chunk-4CGBMYO3.js +6 -0
  153. package/dist/standalone/chunk-4NOMAGEO.js +1 -0
  154. package/dist/standalone/chunk-4ZEL6BYL.js +1 -0
  155. package/dist/standalone/chunk-55UGUCQ6.js +1 -0
  156. package/dist/standalone/chunk-5B2RTXBS.js +1 -0
  157. package/dist/standalone/chunk-5QR2SQIS.js +1 -0
  158. package/dist/standalone/chunk-5SLTDY4C.js +1 -0
  159. package/dist/standalone/chunk-5Y5UTG4N.js +1 -0
  160. package/dist/standalone/chunk-6XKL22OG.js +3 -0
  161. package/dist/standalone/chunk-6ZSIPBTC.js +6 -0
  162. package/dist/standalone/chunk-74IYYDDI.js +19 -0
  163. package/dist/standalone/chunk-7G4Z6Q7X.js +1 -0
  164. package/dist/standalone/chunk-7GVT36VI.js +1 -0
  165. package/dist/standalone/chunk-7Q256NLI.js +1 -0
  166. package/dist/standalone/chunk-7RKB5KS7.js +1 -0
  167. package/dist/standalone/chunk-7Y3SY37W.js +1 -0
  168. package/dist/standalone/chunk-APEQELK3.js +1 -0
  169. package/dist/standalone/chunk-AUAECCXB.js +1 -0
  170. package/dist/standalone/{chunk-BJGBHGK3.js → chunk-AUGKHAMQ.js} +1 -1
  171. package/dist/standalone/chunk-BFQMOALO.js +1 -0
  172. package/dist/standalone/chunk-BOMPSVRC.js +1 -0
  173. package/dist/standalone/chunk-BTG6YDYM.js +1 -0
  174. package/dist/standalone/chunk-BTQ72TPT.js +1 -0
  175. package/dist/standalone/chunk-CCDX5RYT.js +1 -0
  176. package/dist/standalone/chunk-CGQMJYCW.js +1 -0
  177. package/dist/standalone/chunk-CVXNHIQW.js +1 -0
  178. package/dist/standalone/chunk-DBHZXRL6.js +1 -0
  179. package/dist/standalone/chunk-DBZ4TBP5.js +1 -0
  180. package/dist/standalone/chunk-DEFCA7GG.js +5 -0
  181. package/dist/standalone/chunk-DHGPCQ2F.js +1 -0
  182. package/dist/standalone/chunk-E4PXACVL.js +3 -0
  183. package/dist/standalone/chunk-E5DXYVPB.js +1 -0
  184. package/dist/standalone/chunk-ECY2JC5F.js +1 -0
  185. package/dist/standalone/chunk-EE227HDE.js +1 -0
  186. package/dist/standalone/chunk-ENIA26XP.js +1 -0
  187. package/dist/standalone/chunk-EWMBX5N2.js +1 -0
  188. package/dist/standalone/chunk-FCXFQF2W.js +1 -0
  189. package/dist/standalone/chunk-FPI7AMQJ.js +1 -0
  190. package/dist/standalone/chunk-FUL4ROKH.js +1 -0
  191. package/dist/standalone/chunk-FUYEZFBP.js +1 -0
  192. package/dist/standalone/chunk-G2F22AMT.js +1 -0
  193. package/dist/standalone/chunk-GC4XRCRZ.js +1 -0
  194. package/dist/standalone/chunk-GHQ2VDI2.js +1 -0
  195. package/dist/standalone/chunk-GOFZ4Y74.js +1 -0
  196. package/dist/standalone/chunk-GUDC24NJ.js +1 -0
  197. package/dist/standalone/chunk-GWVYDOBH.js +1 -0
  198. package/dist/standalone/chunk-GYBCO7NN.js +1 -0
  199. package/dist/standalone/chunk-HCFJBY65.js +1 -0
  200. package/dist/standalone/chunk-HCTJKP5J.js +1 -0
  201. package/dist/standalone/chunk-HGHIVU76.js +1 -0
  202. package/dist/standalone/chunk-HH52IEFY.js +4 -0
  203. package/dist/standalone/chunk-HIJGQX6F.js +4 -0
  204. package/dist/standalone/chunk-HPYJUVCC.js +1 -0
  205. package/dist/standalone/chunk-I26MS5PJ.js +1 -0
  206. package/dist/standalone/chunk-ICRKYAYO.js +1 -0
  207. package/dist/standalone/chunk-IRSSZXC3.js +1 -0
  208. package/dist/standalone/chunk-ITT6MM23.js +1 -0
  209. package/dist/standalone/chunk-IWZ7GVQO.js +1 -0
  210. package/dist/standalone/chunk-JR4ROUBB.js +1 -0
  211. package/dist/standalone/chunk-K2EHRNYW.js +1 -0
  212. package/dist/standalone/chunk-K3UAOIR7.js +1 -0
  213. package/dist/standalone/chunk-KCFO2BVI.js +15 -0
  214. package/dist/standalone/chunk-KF7Y5S5O.js +1 -0
  215. package/dist/standalone/chunk-LHG2JVIM.js +2 -0
  216. package/dist/standalone/chunk-LXCVA5SP.js +1 -0
  217. package/dist/standalone/chunk-M3QKMHAP.js +15 -0
  218. package/dist/standalone/chunk-MVWZMWPD.js +1 -0
  219. package/dist/standalone/chunk-NCBLHBRW.js +1 -0
  220. package/dist/standalone/chunk-NCCORPSU.js +7 -0
  221. package/dist/standalone/chunk-NCPW7WHO.js +1 -0
  222. package/dist/standalone/chunk-NGVP66OH.js +1 -0
  223. package/dist/standalone/chunk-NQZALRU3.js +1 -0
  224. package/dist/standalone/chunk-NRP22GKC.js +1 -0
  225. package/dist/standalone/chunk-NXQW5E6W.js +1 -0
  226. package/dist/standalone/chunk-O2FW4VRL.js +1 -0
  227. package/dist/standalone/chunk-OI5HX3ZO.js +1 -0
  228. package/dist/standalone/chunk-OLIKYC3C.js +59 -0
  229. package/dist/standalone/chunk-OPM7ESDV.js +1 -0
  230. package/dist/standalone/chunk-OQ6I6OXT.js +2 -0
  231. package/dist/standalone/chunk-OYCUPD3Q.js +1 -0
  232. package/dist/standalone/chunk-PSMQQV6S.js +1 -0
  233. package/dist/standalone/chunk-Q6ED4KUL.js +1 -0
  234. package/dist/standalone/chunk-Q6IT6ZD7.js +1 -0
  235. package/dist/standalone/{chunk-ZHVTQ37P.js → chunk-QAQDMS6R.js} +1 -1
  236. package/dist/standalone/chunk-QJLHH3ET.js +1 -0
  237. package/dist/standalone/chunk-R3ADWOYR.js +1 -0
  238. package/dist/standalone/chunk-R6U22RSY.js +1 -0
  239. package/dist/standalone/chunk-RB3WPSY5.js +14 -0
  240. package/dist/standalone/chunk-RGMVGZV4.js +1 -0
  241. package/dist/standalone/chunk-RWVIV3U7.js +1 -0
  242. package/dist/standalone/chunk-S4Z7K55A.js +1 -0
  243. package/dist/standalone/chunk-SA2OGF3F.js +1 -0
  244. package/dist/standalone/chunk-SC6P4M3S.js +1 -0
  245. package/dist/standalone/chunk-SJQERRSZ.js +1 -0
  246. package/dist/standalone/chunk-SU6QNITV.js +1 -0
  247. package/dist/standalone/chunk-T6IV7OKH.js +1 -0
  248. package/dist/standalone/chunk-UC7MNI2F.js +1 -0
  249. package/dist/standalone/chunk-UIIKW4II.js +1 -0
  250. package/dist/standalone/chunk-UJQNKTYE.js +1 -0
  251. package/dist/standalone/chunk-UVL7N5IL.js +1 -0
  252. package/dist/standalone/chunk-UYEZR3BI.js +1 -0
  253. package/dist/standalone/chunk-VCFEO3RI.js +1 -0
  254. package/dist/standalone/chunk-VDC6JP4A.js +1 -0
  255. package/dist/standalone/chunk-VENSZ6LF.js +1 -0
  256. package/dist/standalone/chunk-VESGIGMQ.js +1 -0
  257. package/dist/standalone/chunk-VJ7RCBJ7.js +1 -0
  258. package/dist/standalone/chunk-VNMKNORK.js +1 -0
  259. package/dist/standalone/chunk-VQRCJJXS.js +1 -0
  260. package/dist/standalone/chunk-VVCXVAA7.js +8 -0
  261. package/dist/standalone/chunk-VXJJSPX3.js +1 -0
  262. package/dist/standalone/chunk-WJRYEML4.js +1 -0
  263. package/dist/standalone/chunk-WUI2PUY6.js +1 -0
  264. package/dist/standalone/chunk-WVWCUB4S.js +1 -0
  265. package/dist/standalone/chunk-WVYIBXUH.js +1 -0
  266. package/dist/standalone/chunk-X4MAMXRE.js +1 -0
  267. package/dist/standalone/chunk-XBQ66PGW.js +1 -0
  268. package/dist/standalone/chunk-XGCIDUJF.js +1 -0
  269. package/dist/standalone/chunk-XKISL2CG.js +1 -0
  270. package/dist/standalone/chunk-Y3AYVFTK.js +1 -0
  271. package/dist/standalone/chunk-YZ72ZAGX.js +1 -0
  272. package/dist/standalone/chunk-ZJQIGWLG.js +1 -0
  273. package/dist/standalone/chunk-ZKJS6EBE.js +1 -0
  274. package/dist/standalone/chunk-ZKV2XC5B.js +1 -0
  275. package/dist/standalone/chunk-ZPNTFCVI.js +1 -0
  276. package/dist/standalone/studio.js +9 -214
  277. package/dist/styles.css +2 -2
  278. package/package.json +26 -22
  279. package/dist/index.js +0 -41
  280. package/dist/mount.js +0 -27
  281. package/dist/packem_chunks/ApiTab.js +0 -251
  282. package/dist/packem_chunks/AuditPanel.js +0 -200
  283. package/dist/packem_chunks/ExportImportPanel.js +0 -198
  284. package/dist/packem_chunks/FileBrowser.js +0 -2932
  285. package/dist/packem_chunks/FunctionRunner.js +0 -343
  286. package/dist/packem_chunks/FunctionStatsPanel.js +0 -377
  287. package/dist/packem_chunks/HealthPanel.js +0 -648
  288. package/dist/packem_chunks/InsightsPanel.js +0 -462
  289. package/dist/packem_chunks/LogsPanel.js +0 -827
  290. package/dist/packem_chunks/MailPanel.js +0 -441
  291. package/dist/packem_chunks/MetricsPanel.js +0 -1344
  292. package/dist/packem_chunks/MigrationsPanel.js +0 -239
  293. package/dist/packem_chunks/PitrPanel.js +0 -252
  294. package/dist/packem_chunks/SchemaViewer.js +0 -2513
  295. package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -95
  296. package/dist/packem_chunks/SettingsPanel.js +0 -391
  297. package/dist/packem_chunks/SqlEditorPanel.js +0 -2323
  298. package/dist/packem_chunks/TableEditor.js +0 -313
  299. package/dist/packem_chunks/analytics-panel.js +0 -261
  300. package/dist/packem_chunks/auth-config-panel.js +0 -179
  301. package/dist/packem_chunks/auth-sessions-panel.js +0 -175
  302. package/dist/packem_chunks/containers-panel.js +0 -247
  303. package/dist/packem_chunks/dashboards-panel.js +0 -780
  304. package/dist/packem_chunks/fanout-panel.js +0 -482
  305. package/dist/packem_chunks/flags-panel.js +0 -176
  306. package/dist/packem_chunks/kv-browser.js +0 -1896
  307. package/dist/packem_chunks/log-drains-panel.js +0 -273
  308. package/dist/packem_chunks/organizations-panel.js +0 -670
  309. package/dist/packem_chunks/payments-panel.js +0 -186
  310. package/dist/packem_chunks/permissions-panel.js +0 -805
  311. package/dist/packem_chunks/queues-panel.js +0 -148
  312. package/dist/packem_chunks/rls-panel.js +0 -315
  313. package/dist/packem_chunks/schedule-panel.js +0 -831
  314. package/dist/packem_chunks/sparkline.js +0 -79
  315. package/dist/packem_chunks/storage-rules-panel.js +0 -140
  316. package/dist/packem_chunks/subscriptions-panel.js +0 -238
  317. package/dist/packem_chunks/users-panel.js +0 -1265
  318. package/dist/packem_chunks/vector-browser.js +0 -281
  319. package/dist/packem_chunks/workflows-panel.js +0 -562
  320. package/dist/packem_shared/ADMIN_FUNCTIONS-CdaxLGkE.js +0 -48
  321. package/dist/packem_shared/ApiDocsPanel-Cu6mD4u7.js +0 -842
  322. package/dist/packem_shared/ApiReferencePanel-Co_wpRF2.js +0 -230
  323. package/dist/packem_shared/CommandPalette-BUPpbpMc.js +0 -373
  324. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  325. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  326. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  327. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  328. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  329. package/dist/packem_shared/DataBrowser-DSNK1tPg.js +0 -4493
  330. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  331. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  332. package/dist/packem_shared/GlobalDataBrowser-ErfvIs1S.js +0 -289
  333. package/dist/packem_shared/HomePanel-DQk3P8xX.js +0 -14
  334. package/dist/packem_shared/OpenRpcReferencePanel-DLWzrIx9.js +0 -192
  335. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  336. package/dist/packem_shared/ScheduledJobs-ClaNpZsg.js +0 -262
  337. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  338. package/dist/packem_shared/Studio-Biu37c3O.js +0 -16
  339. package/dist/packem_shared/StudioApp-D6a2ZmXS.js +0 -657
  340. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  341. package/dist/packem_shared/advisor-view-D3-U4kRR.js +0 -159
  342. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  343. package/dist/packem_shared/alert-CdAET2K_.js +0 -68
  344. package/dist/packem_shared/app.d-CNLRTrWw.d.ts +0 -300
  345. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  346. package/dist/packem_shared/bar-chart-DSwcWIRy.js +0 -3246
  347. package/dist/packem_shared/browser-storage-tLOxkIHd.js +0 -185
  348. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  349. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  350. package/dist/packem_shared/cf-links-BZfRdxSE.js +0 -8
  351. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  352. package/dist/packem_shared/data-grid-Jz8FqQ2C.js +0 -183
  353. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
  354. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  355. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  356. package/dist/packem_shared/error-alert-BBT6D22d.js +0 -114
  357. package/dist/packem_shared/grid-features-CUr8Z1_O.js +0 -745
  358. package/dist/packem_shared/home-panel-Bo-Mgrkn.js +0 -1639
  359. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  360. package/dist/packem_shared/internal-DTsYVn-g.js +0 -97
  361. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  362. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  363. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
  364. package/dist/packem_shared/reference-view-CSKyUyPl.js +0 -2141
  365. package/dist/packem_shared/select-UkNYCT3s.js +0 -273
  366. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  367. package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
  368. package/dist/packem_shared/sparkline-BnA1kC9X.js +0 -93
  369. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  370. package/dist/packem_shared/studio-C4sgu0F7.js +0 -4015
  371. package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
  372. package/dist/packem_shared/table-list-sidebar-B5psdSV1.js +0 -832
  373. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  374. package/dist/packem_shared/use-admin-query-BHPKmPuj.js +0 -106
  375. package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
  376. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  377. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  378. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
  379. package/dist/standalone/chunk-25VHPD2I.js +0 -1
  380. package/dist/standalone/chunk-2GGMGPEP.js +0 -1
  381. package/dist/standalone/chunk-2K47A3P6.js +0 -1
  382. package/dist/standalone/chunk-2NGUNNGW.js +0 -1
  383. package/dist/standalone/chunk-3CJW6NWG.js +0 -4
  384. package/dist/standalone/chunk-3OA7PECS.js +0 -6
  385. package/dist/standalone/chunk-4H2OJBXO.js +0 -1
  386. package/dist/standalone/chunk-4MLAVZP4.js +0 -1
  387. package/dist/standalone/chunk-4QHKBC77.js +0 -1
  388. package/dist/standalone/chunk-55YA7ZZI.js +0 -76
  389. package/dist/standalone/chunk-5OH3VPZF.js +0 -1
  390. package/dist/standalone/chunk-5OIBXYZM.js +0 -1
  391. package/dist/standalone/chunk-5PQMXK24.js +0 -1
  392. package/dist/standalone/chunk-6GFEVKJP.js +0 -1
  393. package/dist/standalone/chunk-764T6X6X.js +0 -1
  394. package/dist/standalone/chunk-7M3F6U4L.js +0 -1
  395. package/dist/standalone/chunk-7TJJXVSE.js +0 -1
  396. package/dist/standalone/chunk-7VF3IAAW.js +0 -2
  397. package/dist/standalone/chunk-AHILM3ZP.js +0 -1
  398. package/dist/standalone/chunk-AJIUI7DD.js +0 -1
  399. package/dist/standalone/chunk-AQGOX5DK.js +0 -1
  400. package/dist/standalone/chunk-BACPICH6.js +0 -1
  401. package/dist/standalone/chunk-BET2625I.js +0 -1
  402. package/dist/standalone/chunk-BQUQS7QN.js +0 -1
  403. package/dist/standalone/chunk-CKSHCYGC.js +0 -2
  404. package/dist/standalone/chunk-DCECRP45.js +0 -1
  405. package/dist/standalone/chunk-DFP2DADO.js +0 -1
  406. package/dist/standalone/chunk-DORBUITF.js +0 -1
  407. package/dist/standalone/chunk-DVKPRFIJ.js +0 -1
  408. package/dist/standalone/chunk-DWDILV2E.js +0 -1
  409. package/dist/standalone/chunk-E6WUCLSI.js +0 -1
  410. package/dist/standalone/chunk-E7WLF6IU.js +0 -1
  411. package/dist/standalone/chunk-EVPLBWUT.js +0 -8
  412. package/dist/standalone/chunk-FCSPAJW4.js +0 -1
  413. package/dist/standalone/chunk-FKO3HO6I.js +0 -4
  414. package/dist/standalone/chunk-G2ICR3DL.js +0 -1
  415. package/dist/standalone/chunk-GJ6PGSES.js +0 -13
  416. package/dist/standalone/chunk-GMSGZDDH.js +0 -13
  417. package/dist/standalone/chunk-GTM65MVX.js +0 -1
  418. package/dist/standalone/chunk-GVRM4U6W.js +0 -2
  419. package/dist/standalone/chunk-GZDWDDXN.js +0 -1
  420. package/dist/standalone/chunk-HV7G6DFP.js +0 -5
  421. package/dist/standalone/chunk-ISJAJWYI.js +0 -1
  422. package/dist/standalone/chunk-J6J54MBP.js +0 -1
  423. package/dist/standalone/chunk-JIDZFLTB.js +0 -4
  424. package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
  425. package/dist/standalone/chunk-K3GNLVYK.js +0 -1
  426. package/dist/standalone/chunk-K4ZDRTQM.js +0 -1
  427. package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
  428. package/dist/standalone/chunk-KTK3V4DC.js +0 -1
  429. package/dist/standalone/chunk-KZ6INM5M.js +0 -1
  430. package/dist/standalone/chunk-LI43EKM6.js +0 -1
  431. package/dist/standalone/chunk-MFPTVCJ6.js +0 -1
  432. package/dist/standalone/chunk-MPYFGAOW.js +0 -1
  433. package/dist/standalone/chunk-O3NAGRTR.js +0 -1
  434. package/dist/standalone/chunk-O77VNUFD.js +0 -1
  435. package/dist/standalone/chunk-PA3LN4XJ.js +0 -1
  436. package/dist/standalone/chunk-PN5NCZDX.js +0 -1
  437. package/dist/standalone/chunk-PVZI3CXP.js +0 -19
  438. package/dist/standalone/chunk-PZ7HD5T2.js +0 -1
  439. package/dist/standalone/chunk-QAFAJBAW.js +0 -1
  440. package/dist/standalone/chunk-QBAT52GB.js +0 -1
  441. package/dist/standalone/chunk-QHIIRFG7.js +0 -1
  442. package/dist/standalone/chunk-RRCPZMC2.js +0 -22
  443. package/dist/standalone/chunk-RSEEHNFI.js +0 -1
  444. package/dist/standalone/chunk-SEU5V7I6.js +0 -1
  445. package/dist/standalone/chunk-SGDQIWAR.js +0 -4
  446. package/dist/standalone/chunk-SVR644RF.js +0 -1
  447. package/dist/standalone/chunk-SYEIXTEU.js +0 -1
  448. package/dist/standalone/chunk-T5HRXUSY.js +0 -1
  449. package/dist/standalone/chunk-TAD43CG5.js +0 -1
  450. package/dist/standalone/chunk-TBMYIZIO.js +0 -1
  451. package/dist/standalone/chunk-TDL7NEWA.js +0 -1
  452. package/dist/standalone/chunk-TM7CMA7X.js +0 -1
  453. package/dist/standalone/chunk-TQ36RWOP.js +0 -1
  454. package/dist/standalone/chunk-TY7L2V4E.js +0 -1
  455. package/dist/standalone/chunk-U4OAQPBT.js +0 -1
  456. package/dist/standalone/chunk-UDSVXA42.js +0 -1
  457. package/dist/standalone/chunk-UII66UVF.js +0 -1
  458. package/dist/standalone/chunk-UK64ZSUW.js +0 -1
  459. package/dist/standalone/chunk-VEZO7G5Q.js +0 -3
  460. package/dist/standalone/chunk-VLXV72QE.js +0 -1
  461. package/dist/standalone/chunk-VSHUSN6T.js +0 -1
  462. package/dist/standalone/chunk-VYMCCC6O.js +0 -1
  463. package/dist/standalone/chunk-WXPWVBIY.js +0 -1
  464. package/dist/standalone/chunk-X72PYOEW.js +0 -1
  465. package/dist/standalone/chunk-X7MMBSNW.js +0 -1
  466. package/dist/standalone/chunk-XIGIWZLO.js +0 -4
  467. package/dist/standalone/chunk-XNJNSCLM.js +0 -1
  468. package/dist/standalone/chunk-XUGSA2NG.js +0 -1
  469. package/dist/standalone/chunk-Y2ZPNDL7.js +0 -4
  470. package/dist/standalone/chunk-YM6BBZDN.js +0 -1
  471. package/dist/standalone/chunk-ZPP2KOR4.js +0 -1
  472. package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
@@ -0,0 +1 @@
1
+ import{c as R}from"react/compiler-runtime";import{E as B}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{ShardInput as E}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{S as I}from"../packem_shared/stat-card-BAv73QtB.mjs";import{B as M}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as _}from"../packem_shared/card-By2O8ULa.mjs";import{E as j}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as G,a as H,b as A,c as w,d as L,e as K}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Q}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{useAutoRefresh as W}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs";import{u as q}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as O}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as U}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsxs as m,jsx as l,Fragment as z}from"react/jsx-runtime";const D=d=>`${d.toString()} ms`,J=d=>d.totalConnections===0&&d.shapePoke.passes===0&&d.whisper.passes===0&&d.shapeProbe.run===0&&d.shapeProbe.served===0&&d.globalPoll.drains===0&&d.globalPoll.pairsSkipped===0,F=d=>{const e=R(48),{counters:o,includeTiming:t,prefix:r,t:a,title:u}=d,c=`${r}-section`;let n;e[0]!==u?(n=l("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];const s=`${r}-stats`;let i;e[2]!==a?(i=a("Passes"),e[2]=a,e[3]=i):i=e[3];const f=`${r}-passes`;let N;e[4]!==o.passes||e[5]!==i||e[6]!==f?(N=l(I,{label:i,testId:f,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=f,e[7]=N):N=e[7];let g;e[8]!==a?(g=a("Sockets iterated"),e[8]=a,e[9]=g):g=e[9];const k=`${r}-iterated`;let p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==k?(p=l(I,{label:g,testId:k,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=k,e[13]=p):p=e[13];let h;e[14]!==a?(h=a("Delivered"),e[14]=a,e[15]=h):h=e[15];const y=`${r}-delivered`;let b;e[16]!==o.socketsDelivered||e[17]!==h||e[18]!==y?(b=l(I,{label:h,testId:y,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=h,e[18]=y,e[19]=b):b=e[19];let x;e[20]!==a?(x=a("Peak width"),e[20]=a,e[21]=x):x=e[21];const S=`${r}-peak`;let v;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==S?(v=l(I,{label:x,testId:S,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=S,e[25]=v):v=e[25];let C;e[26]!==o.totalMs||e[27]!==t||e[28]!==r||e[29]!==a?(C=t&&l(I,{label:a("Total time"),testId:`${r}-total-ms`,value:D(o.totalMs)}),e[26]=o.totalMs,e[27]=t,e[28]=r,e[29]=a,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==t||e[33]!==r||e[34]!==a?(P=t&&l(I,{label:a("Max time"),testId:`${r}-max-ms`,value:D(o.maxMs)}),e[31]=o.maxMs,e[32]=t,e[33]=r,e[34]=a,e[35]=P):P=e[35];let $;e[36]!==b||e[37]!==v||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==N||e[42]!==p?($=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[N,p,b,v,C,P]}),e[36]=b,e[37]=v,e[38]=C,e[39]=P,e[40]=s,e[41]=N,e[42]=p,e[43]=$):$=e[43];let T;return e[44]!==c||e[45]!==$||e[46]!==n?(T=m("section",{className:"flex flex-col gap-2","data-testid":c,children:[n,$]}),e[44]=c,e[45]=$,e[46]=n,e[47]=T):T=e[47],T},V=d=>{const e=R(20),{counters:o,t}=d;let r;e[0]!==t?(r=t("Membership probes"),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==r?(a=l("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let u;e[4]!==t?(u=t("Queries run"),e[4]=t,e[5]=u):u=e[5];let c;e[6]!==o.run||e[7]!==u?(c=l(I,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=c):c=e[8];let n;e[9]!==t?(n=t("Shared from cache"),e[9]=t,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=l(I,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==c||e[15]!==s?(i=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[c,s]}),e[14]=c,e[15]=s,e[16]=i):i=e[16];let f;return e[17]!==a||e[18]!==i?(f=m("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[a,i]}),e[17]=a,e[18]=i,e[19]=f):f=e[19],f},X=d=>{const e=R(20),{counters:o,t}=d;let r;e[0]!==t?(r=t("Global shape polls"),e[0]=t,e[1]=r):r=e[1];let a;e[2]!==r?(a=l("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=a):a=e[3];let u;e[4]!==t?(u=t("Global reads"),e[4]=t,e[5]=u):u=e[5];let c;e[6]!==o.drains||e[7]!==u?(c=l(I,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=c):c=e[8];let n;e[9]!==t?(n=t("Pairs skipped"),e[9]=t,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=l(I,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==c||e[15]!==s?(i=m("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[c,s]}),e[14]=c,e[15]=s,e[16]=i):i=e[16];let f;return e[17]!==a||e[18]!==i?(f=m("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[a,i]}),e[17]=a,e[18]=i,e[19]=f):f=e[19],f},me=d=>{const e=R(31),{initialShardKey:o}=d,t=O(),{queryShardKey:r,setShardKey:a,shardKey:u}=q(o);let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];const{data:s,error:i,errorSource:f,poll:N}=Q(U.getFanoutMetrics,c,n);W(N,!0);let g;e[3]!==s?(g=s!==void 0&&J(s),e[3]=s,e[4]=g):g=e[4];const k=g;let p;e[5]!==a||e[6]!==u?(p=l(E,{onChange:a,testId:"fanout-shard-input",value:u}),e[5]=a,e[6]=u,e[7]=p):p=e[7];let h;e[8]!==s||e[9]!==t?(h=s!==void 0&&m("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&l(M,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?t("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):t("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),l(M,{variant:"secondary",children:t("{count} connections",{count:s.totalConnections})}),l(M,{variant:"secondary",children:t("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=t,e[10]=h):h=e[10];let y;e[11]!==p||e[12]!==h?(y=m("div",{className:"flex flex-wrap items-center gap-2",children:[p,h]}),e[11]=p,e[12]=h,e[13]=y):y=e[13];let b;e[14]!==i||e[15]!==f?(b=i!==null&&l(B,{error:f,testId:"fanout-error"}),e[14]=i,e[15]=f,e[16]=b):b=e[16];let x;e[17]!==i||e[18]!==k||e[19]!==t?(x=i===null&&k&&l(j,{description:t("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:l("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:t("No fan-out activity yet.")}),e[17]=i,e[18]=k,e[19]=t,e[20]=x):x=e[20];let S;e[21]!==i||e[22]!==k||e[23]!==s||e[24]!==t?(S=i===null&&s!==void 0&&!k&&m(z,{children:[s.topics.length>0&&m("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[l("h3",{className:"text-sm font-medium text-foreground",children:t("Hot topics")}),l(_,{className:"overflow-hidden py-0",children:m(G,{"data-testid":"fanout-topics-table",children:[l(H,{children:m(A,{children:[l(w,{children:t("Topic")}),l(w,{children:t("Kind")}),l(w,{className:"text-right",children:t("Subscribers")})]})}),l(L,{children:s.topics.map(Y)})]})})]}),m("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[l("h2",{className:"text-sm font-medium text-muted-foreground",children:t("Fan-out cost since this instance woke")}),l(F,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t,title:t("Shape pokes")}),l(F,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t,title:t("Whisper broadcasts")}),l(V,{counters:s.shapeProbe,t}),l(X,{counters:s.globalPoll,t})]})]}),e[21]=i,e[22]=k,e[23]=s,e[24]=t,e[25]=S):S=e[25];let v;return e[26]!==y||e[27]!==b||e[28]!==x||e[29]!==S?(v=m("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,b,x,S]}),e[26]=y,e[27]=b,e[28]=x,e[29]=S,e[30]=v):v=e[30],v};function Y(d){return m(A,{"data-testid":"fanout-topic-row",children:[l(K,{className:"font-mono text-xs",children:d.topic}),l(K,{children:l(M,{variant:"outline",children:d.kind})}),l(K,{className:"text-right font-medium tabular-nums",children:d.subscribers})]},`${d.kind}:${d.topic}`)}export{me as default};
@@ -0,0 +1 @@
1
+ import{useState as C}from"react";import{E as S}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{B as w}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as A,a as k}from"../packem_shared/card-By2O8ULa.mjs";import{E as g}from"../packem_shared/empty-state-D7jEML_T.mjs";import{L as E}from"../packem_shared/label-DKFzyHq6.mjs";import{T as O,a as F,b as x,c as s,d as j,e as n}from"../packem_shared/table-D0SBiDu-.mjs";import{T as I}from"../packem_shared/textarea--40GKAyz.mjs";import{u as J}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{useT as L}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as B}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsx as e,jsxs as l}from"react/jsx-runtime";const H=a=>{const t=a.trim();if(t.length===0)return{context:void 0,error:null};try{const o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},K='{ "targetingKey": "user-123", "plan": "premium" }',R=a=>a.type==="object"?JSON.stringify(a.value):String(a.value),W=({initialShardKey:a=""})=>{const t=L(),[o,p]=C(""),{context:c,error:f}=H(o),h=c===void 0?{}:{context:c},{data:i,error:y,errorSource:v,liveError:N}=J(B.listFlags,h,{live:!0,shardKey:a}),m=i!==void 0,b=i?.configured??!1,u=Array.isArray(i?.flags)?[...i.flags].toSorted((r,T)=>r.key.localeCompare(T.key)):[];let d;return m&&!b?d=e(g,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")}):m&&u.length===0?d=e(g,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")}):d=e(A,{className:"overflow-hidden py-0",children:e(k,{className:"px-0",children:l(O,{"data-testid":"flags-table",children:[e(F,{children:l(x,{children:[e(s,{children:t("Key")}),e(s,{children:t("Type")}),e(s,{children:t("Value")}),e(s,{children:t("Reason")}),e(s,{children:t("Variant")})]})}),e(j,{children:u.map(r=>l(x,{"data-testid":`flags-row-${r.key}`,children:[e(n,{className:"font-mono text-xs",children:r.key}),e(n,{className:"font-mono text-xs text-muted-foreground",children:r.type}),e(n,{className:"font-mono text-xs",children:R(r)}),e(n,{children:r.errorCode===void 0?e("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"—"}):e(w,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode})}),e(n,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"—"})]},r.key))})]})})}),l("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[y!==null&&e(S,{error:v,testId:"flags-error"}),e("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')}),l("div",{className:"flex flex-col gap-2",children:[e(E,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")}),e(I,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:r=>{p(r.target.value)},placeholder:K,rows:3,value:o}),f!==null&&e("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(f)}),N!==void 0&&e("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")})]}),d]})};export{W as default};
@@ -0,0 +1 @@
1
+ import{c as xe}from"react/compiler-runtime";import{findIssueSolution as we,flattenHint as Ee}from"@lunora/errors";import{useLunora as Ne}from"@lunora/react";import{useState as ne}from"react";import{L as Te}from"../packem_shared/live-status-BuJdUZFU.mjs";import{ShardInput as $e}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{B as pe}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as oe}from"../packem_shared/button-q0UYSmrn.mjs";import{C as Ae,a as Ce}from"../packem_shared/card-By2O8ULa.mjs";import{E as _e}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ke}from"../packem_shared/input-CXhxesPC.mjs";import{S as Me,a as Re,b as Ke,c as be,d as Le}from"../packem_shared/select-DPyS18Vy.mjs";import{T as Ve,a as Oe,b as ye,c as F,d as Ue,e as B}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Be}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{u as Fe}from"../packem_shared/use-async-submit-2eBBD0-m.mjs";import{u as ze}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as ve}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ie}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{h as He,f as re,c as de,d as Ie,b as je}from"../packem_shared/internal-BXEjuLPN.mjs";import{jsx as s,jsxs as w,Fragment as De}from"react/jsx-runtime";const ge="none",qe=["all","open","resolved","ignored"],Ge=["critical","high","medium","low"],Pe=de(ie.resolveIssue),We=de(ie.ignoreIssue),Se=de(ie.assignIssue),Ye=de(ie.setIssueSeverity),Qe=de(ie.explainIssue),Xe=n=>Array.isArray(n?.issues)?n.issues:[],Je=n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning",Ze=n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary",et=n=>{const e=xe(44),{expanded:h,issue:t,shardKey:E}=n,i=Ne(),r=ve(),[a,o]=ne(void 0),{busy:R,error:A,run:L}=Fe();let C;e[0]!==i||e[1]!==t||e[2]!==L||e[3]!==E?(C=()=>{o(void 0),L(async()=>{const f={culprit:t.culprit,sampleMessage:t.sampleMessage,title:t.title},I=await i.query(Qe,f,Ie(E));o(I)})},e[0]=i,e[1]=t,e[2]=L,e[3]=E,e[4]=C):C=e[4];const K=C;if(!h)return null;let T;if(e[5]!==t.sampleMessage){const f=we(t.sampleMessage);T=f===void 0?void 0:Ee(f.body),e[5]=t.sampleMessage,e[6]=T}else T=e[6];const _=T,M=`issues-detail-${t.hash}`;let d;e[7]!==t.sampleMessage?(d=s("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:t.sampleMessage}),e[7]=t.sampleMessage,e[8]=d):d=e[8];let g;e[9]!==r?(g=r("Suggested fix"),e[9]=r,e[10]=g):g=e[10];let $;e[11]!==g?($=s("div",{className:"text-xs font-medium text-muted-foreground",children:g}),e[11]=g,e[12]=$):$=e[12];let x;e[13]!==_||e[14]!==t.hash||e[15]!==r?(x=_===void 0?s("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${t.hash}`,children:r("No known fix for this error yet.")}):s("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${t.hash}`,children:_}),e[13]=_,e[14]=t.hash,e[15]=r,e[16]=x):x=e[16];let y;e[17]!==$||e[18]!==x?(y=w("div",{children:[$,x]}),e[17]=$,e[18]=x,e[19]=y):y=e[19];const S=`issues-explain-${t.hash}`;let N;e[20]!==R||e[21]!==r?(N=r(R?"Explaining…":"Explain in plain language"),e[20]=R,e[21]=r,e[22]=N):N=e[22];let u;e[23]!==R||e[24]!==K||e[25]!==N||e[26]!==S?(u=s("div",{children:s(oe,{"data-testid":S,disabled:R,onClick:K,size:"sm",type:"button",variant:"outline",children:N})}),e[23]=R,e[24]=K,e[25]=N,e[26]=S,e[27]=u):u=e[27];let p;e[28]!==A||e[29]!==t.hash?(p=A!==null&&s("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${t.hash}`,role:"alert",children:A}),e[28]=A,e[29]=t.hash,e[30]=p):p=e[30];let m;e[31]!==a||e[32]!==t.hash||e[33]!==r?(m=a!==void 0&&(a.degraded?s("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${t.hash}`,children:a.reason==="no-ai-binding"?r("No AI binding is configured. Wire an AI binding to enable plain-language explanations — the suggested fix above is always available."):r("The AI model could not explain this error right now. The suggested fix above still applies.")}):w("div",{"data-testid":`issues-explanation-${t.hash}`,children:[s("div",{className:"text-xs font-medium text-muted-foreground",children:r("AI explanation")}),s("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&s("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${t.hash}`,children:r("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),s("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:r("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=t.hash,e[33]=r,e[34]=m):m=e[34];let c;e[35]!==u||e[36]!==p||e[37]!==m||e[38]!==d||e[39]!==y?(c=s(B,{className:"bg-muted/30",colSpan:7,children:w("div",{className:"flex flex-col gap-3 py-1",children:[d,y,u,p,m]})}),e[35]=u,e[36]=p,e[37]=m,e[38]=d,e[39]=y,e[40]=c):c=e[40];let b;return e[41]!==c||e[42]!==M?(b=s(ye,{"data-testid":M,children:c}),e[41]=c,e[42]=M,e[43]=b):b=e[43],b},tt=n=>{const e=xe(119),{busy:h,issue:t,rowError:E,runTriage:i,shardKey:r}=n,a=ve(),[o,R]=ne(!1);let A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=()=>{R(st)},e[0]=A):A=e[0];const L=A;let C;e[1]!==t.hash||e[2]!==i?(C=ae=>{const he=ae===null||ae===ge?null:ae;re(i(t.hash,Ye,{severity:he}))},e[1]=t.hash,e[2]=i,e[3]=C):C=e[3];const K=C;let T;e[4]!==t.hash||e[5]!==i?(T=ae=>{if(ae.key!=="Enter")return;const he=ae.currentTarget.value.trim();re(i(t.hash,Se,{assignee:he===""?null:he}))},e[4]=t.hash,e[5]=i,e[6]=T):T=e[6];const _=T,M=`issues-row-${t.hash}`;let d;e[7]!==a?(d=a("Toggle issue details"),e[7]=a,e[8]=d):d=e[8];const g=`issues-toggle-${t.hash}`,$=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`;let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=s("path",{d:"m9 6 6 6-6 6"}),e[9]=x):x=e[9];let y;e[10]!==$?(y=s("svg",{"aria-hidden":"true",className:$,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:x}),e[10]=$,e[11]=y):y=e[11];let S;e[12]!==t.title?(S=s("span",{className:"block truncate font-medium",title:t.title,children:t.title}),e[12]=t.title,e[13]=S):S=e[13];let N;e[14]!==t.culprit?(N=s("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:t.culprit,children:t.culprit}),e[14]=t.culprit,e[15]=N):N=e[15];let u;e[16]!==S||e[17]!==N?(u=w("span",{className:"min-w-0",children:[S,N]}),e[16]=S,e[17]=N,e[18]=u):u=e[18];let p;e[19]!==o||e[20]!==u||e[21]!==d||e[22]!==g||e[23]!==y?(p=w("button",{"aria-expanded":o,"aria-label":d,className:"flex w-full items-start gap-2 text-left","data-testid":g,onClick:L,type:"button",children:[y,u]}),e[19]=o,e[20]=u,e[21]=d,e[22]=g,e[23]=y,e[24]=p):p=e[24];let m;e[25]!==t.hash||e[26]!==E?(m=E!==void 0&&s("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${t.hash}`,role:"alert",children:E}),e[25]=t.hash,e[26]=E,e[27]=m):m=e[27];let c;e[28]!==p||e[29]!==m?(c=w(B,{className:"max-w-80",children:[p,m]}),e[28]=p,e[29]=m,e[30]=c):c=e[30];const b=`issues-status-${t.hash}`;let f;e[31]!==t.status?(f=Je(t.status),e[31]=t.status,e[32]=f):f=e[32];let I;e[33]!==t.status||e[34]!==b||e[35]!==f?(I=s(B,{children:s(pe,{"data-testid":b,variant:f,children:t.status})}),e[33]=t.status,e[34]=b,e[35]=f,e[36]=I):I=e[36];const V=t.severity??ge;let l;e[37]!==a?(l=a("Set severity"),e[37]=a,e[38]=l):l=e[38];const le=`issues-severity-${t.hash}`;let O;e[39]!==a?(O=a("—"),e[39]=a,e[40]=O):O=e[40];let v;e[41]!==t.severity||e[42]!==a?(v=t.severity===void 0?s("span",{className:"text-muted-foreground",children:a("—")}):s(pe,{variant:Ze(t.severity),children:t.severity}),e[41]=t.severity,e[42]=a,e[43]=v):v=e[43];let k;e[44]!==O||e[45]!==v?(k=s(Me,{placeholder:O,children:v}),e[44]=O,e[45]=v,e[46]=k):k=e[46];let U;e[47]!==l||e[48]!==le||e[49]!==k?(U=s(Re,{"aria-label":l,className:"h-7 w-[110px]","data-testid":le,children:k}),e[47]=l,e[48]=le,e[49]=k,e[50]=U):U=e[50];let z;e[51]===Symbol.for("react.memo_cache_sentinel")?(z=Ge.map(at),e[51]=z):z=e[51];let H;e[52]!==a?(H=a("Clear"),e[52]=a,e[53]=H):H=e[53];let j;e[54]!==H?(j=w(Ke,{children:[z,s(be,{value:ge,children:H})]}),e[54]=H,e[55]=j):j=e[55];let D;e[56]!==h||e[57]!==K||e[58]!==V||e[59]!==U||e[60]!==j?(D=s(B,{children:w(Le,{disabled:h,onValueChange:K,value:V,children:[U,j]})}),e[56]=h,e[57]=K,e[58]=V,e[59]=U,e[60]=j,e[61]=D):D=e[61];let q;e[62]!==a?(q=a("Assignee"),e[62]=a,e[63]=q):q=e[63];const ue=`issues-assignee-${t.hash}`,me=t.assignee??"",fe=t.assignee??"";let G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let P;e[66]!==h||e[67]!==_||e[68]!==q||e[69]!==ue||e[70]!==me||e[71]!==fe||e[72]!==G?(P=s(B,{children:s(ke,{"aria-label":q,className:"h-7 w-32","data-testid":ue,defaultValue:me,disabled:h,onKeyDown:_,placeholder:G},fe)}),e[66]=h,e[67]=_,e[68]=q,e[69]=ue,e[70]=me,e[71]=fe,e[72]=G,e[73]=P):P=e[73];let W;e[74]!==t.count?(W=s(B,{className:"text-right",children:s(pe,{variant:"secondary",children:t.count})}),e[74]=t.count,e[75]=W):W=e[75];let Y;e[76]!==t.lastSeen?(Y=He(t.lastSeen),e[76]=t.lastSeen,e[77]=Y):Y=e[77];let Q;e[78]!==Y?(Q=s(B,{className:"text-xs tabular-nums text-muted-foreground",children:Y}),e[78]=Y,e[79]=Q):Q=e[79];let X;e[80]!==h||e[81]!==t.hash||e[82]!==t.status||e[83]!==i||e[84]!==a?(X=t.status!=="resolved"&&s(oe,{"data-testid":`issues-resolve-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,Pe,{}))},size:"xs",variant:"outline",children:a("Resolve")}),e[80]=h,e[81]=t.hash,e[82]=t.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let J;e[86]!==h||e[87]!==t.hash||e[88]!==t.status||e[89]!==i||e[90]!==a?(J=t.status!=="ignored"&&s(oe,{"data-testid":`issues-ignore-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,We,{}))},size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=h,e[87]=t.hash,e[88]=t.status,e[89]=i,e[90]=a,e[91]=J):J=e[91];let Z;e[92]!==h||e[93]!==t.assignee||e[94]!==t.hash||e[95]!==t.status||e[96]!==i||e[97]!==a?(Z=t.status!=="open"&&s(oe,{"data-testid":`issues-reopen-${t.hash}`,disabled:h,onClick:()=>{re(i(t.hash,Se,{assignee:t.assignee??null}))},size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=h,e[93]=t.assignee,e[94]=t.hash,e[95]=t.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==J||e[101]!==Z?(ee=s(B,{className:"text-right",children:w("div",{className:"flex justify-end gap-1",children:[X,J,Z]})}),e[99]=X,e[100]=J,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==c||e[104]!==I||e[105]!==D||e[106]!==P||e[107]!==W||e[108]!==Q||e[109]!==M||e[110]!==ee?(te=w(ye,{"data-testid":M,children:[c,I,D,P,W,Q,ee]}),e[103]=c,e[104]=I,e[105]=D,e[106]=P,e[107]=W,e[108]=Q,e[109]=M,e[110]=ee,e[111]=te):te=e[111];let se;e[112]!==o||e[113]!==t||e[114]!==r?(se=s(et,{expanded:o,issue:t,shardKey:r},t.sampleMessage),e[112]=o,e[113]=t,e[114]=r,e[115]=se):se=e[115];let ce;return e[116]!==te||e[117]!==se?(ce=w(De,{children:[te,se]}),e[116]=te,e[117]=se,e[118]=ce):ce=e[118],ce},Tt=n=>{const e=xe(38),{initialShardKey:h}=n,t=ve(),E=Ne(),{queryShardKey:i,setShardKey:r,shardKey:a}=ze(h),[o,R]=ne("all"),[A,L]=ne(it),[C,K]=ne(lt);let T;e[0]!==o?(T=o==="all"?{}:{status:o},e[0]=o,e[1]=T):T=e[1];let _;e[2]!==i?(_={live:!0,shardKey:i},e[2]=i,e[3]=_):_=e[3];const{data:M,error:d,liveError:g}=Be(ie.getIssues,T,_),$=M!==void 0;let x;if(e[4]!==C||e[5]!==A||e[6]!==E||e[7]!==M||e[8]!==d||e[9]!==g||e[10]!==$||e[11]!==i||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==t){const y=Xe(M);let S;e[17]!==E||e[18]!==i?(S=async(l,le,O)=>{K(v=>{if(!v.has(l))return v;const k=new Map(v);return k.delete(l),k}),L(v=>new Set(v).add(l));try{await E.query(le,{...O,hash:l},Ie(i))}catch(v){const U=je(v);K(z=>new Map(z).set(l,U))}L(v=>{const k=new Set(v);return k.delete(l),k})},e[17]=E,e[18]=i,e[19]=S):S=e[19];const N=S;let u;e[20]!==t?(u=l=>t(l==="all"?"All":l==="open"?"Open":l==="resolved"?"Resolved":"Ignored"),e[20]=t,e[21]=u):u=e[21];const p=u;let m;e[22]!==d?(m=d!==null&&s("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:d}),e[22]=d,e[23]=m):m=e[23];let c;e[24]!==r||e[25]!==a?(c=s($e,{onChange:r,testId:"issues-shard-input",value:a}),e[24]=r,e[25]=a,e[26]=c):c=e[26];let b;e[27]!==g?(b=s(Te,{message:g,prefix:"issues"}),e[27]=g,e[28]=b):b=e[28];let f;e[29]!==o||e[30]!==p?(f=qe.map(l=>s(oe,{"data-active":o===l?"":void 0,"data-testid":`issues-filter-${l}`,onClick:()=>{R(l)},size:"xs",variant:o===l?"default":"outline",children:p(l)},l)),e[29]=o,e[30]=p,e[31]=f):f=e[31];let I;e[32]!==f?(I=s("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:f}),e[32]=f,e[33]=I):I=e[33];let V;e[34]!==I||e[35]!==c||e[36]!==b?(V=w("div",{className:"flex flex-wrap items-center gap-2",children:[c,b,I]}),e[34]=I,e[35]=c,e[36]=b,e[37]=V):V=e[37],x=w("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[m,V,$&&y.length===0?s(_e,{description:t("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:t("No issues")}):s(Ae,{className:"overflow-hidden py-0",children:s(Ce,{className:"px-0",children:w(Ve,{"data-testid":"issues-table",children:[s(Oe,{children:w(ye,{children:[s(F,{children:t("Issue")}),s(F,{children:t("Status")}),s(F,{children:t("Severity")}),s(F,{children:t("Assignee")}),s(F,{className:"text-right",children:t("Events")}),s(F,{children:t("Last seen")}),s(F,{className:"text-right",children:t("Actions")})]})}),s(Ue,{children:y.map(l=>s(tt,{busy:A.has(l.hash),issue:l,rowError:C.get(l.hash),runTriage:N,shardKey:i},l.hash))})]})})})]}),e[4]=C,e[5]=A,e[6]=E,e[7]=M,e[8]=d,e[9]=g,e[10]=$,e[11]=i,e[12]=r,e[13]=a,e[14]=o,e[15]=t,e[16]=x}else x=e[16];return x};function st(n){return!n}function at(n){return s(be,{value:n,children:n},n)}function it(){return new Set}function lt(){return new Map}export{Tt as default};
@@ -0,0 +1 @@
1
+ import{useLunora as ee}from"@lunora/react";import{useState as Z,useReducer as le,useEffect as ae}from"react";import{C as ve,a as fe}from"../packem_shared/card-By2O8ULa.mjs";import{E as Ee}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as pe,a as he,b as X,c as q,d as ye,e as Q}from"../packem_shared/table-D0SBiDu-.mjs";import{useT as G}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as H,b as R,n as Fe,g as se}from"../packem_shared/internal-BXEjuLPN.mjs";import{B as P}from"../packem_shared/button-q0UYSmrn.mjs";import{C as ne}from"../packem_shared/checkbox-CnS9cyCz.mjs";import{I as re}from"../packem_shared/input-CXhxesPC.mjs";import{b as ie,c as de,d as oe,e as ce}from"../packem_shared/studio-BcHsk7mT.mjs";import{c as te}from"react/compiler-runtime";import{L as W}from"../packem_shared/label-DKFzyHq6.mjs";import{T as ke}from"../packem_shared/textarea--40GKAyz.mjs";import{c as Ke,S as Ve,a as Ie,b as _e,d as Me}from"../packem_shared/select-DPyS18Vy.mjs";import{jsx as r,jsxs as w,Fragment as be}from"react/jsx-runtime";import{B as Le}from"../packem_shared/badge-r_5B4LHP.mjs";const Be=l=>{const e=l.trim();if(e==="")return;const s=Number(e);return Number.isFinite(s)&&s>0?Math.floor(s):void 0},Oe=l=>l===void 0?"—":new Date(l*1e3).toISOString(),Ae=l=>new TextEncoder().encode(l).length,ge=l=>{if(l.trim()!=="")try{return JSON.stringify(JSON.parse(l),void 0,2)}catch{return}},xe=l=>{if(l.trim()==="")return!0;try{return JSON.parse(l),!0}catch{return!1}},Ne=[{key:"seconds",seconds:1},{key:"minutes",seconds:60},{key:"hours",seconds:3600},{key:"days",seconds:86400}],ue=(l,e)=>{const s=l.trim();if(s==="")return"";const c=Number(s),i=Ne.find(v=>v.key===e)?.seconds??1;return Number.isFinite(c)&&c>0?String(Math.round(c*i)):s},Ce=l=>{const e=l.trim();if(e==="")return!0;const s=Number(e);return Number.isInteger(s)&&s>=60},Se=(l,e,s,c)=>{const i=Be(l.ttl);return{expiration:i===void 0?c:void 0,expirationTtl:i,key:e,metadata:l.metadata.trim()===""?void 0:JSON.parse(l.metadata),namespace:s,value:l.value}},we=l=>{const e=te(60),{helper:s,id:c,invalid:i,onChange:v,testId:d}=l,t=G(),[a,f]=Z(""),[o,g]=Z("seconds");let k;e[0]!==v||e[1]!==o?(k=b=>{f(b.target.value),v(ue(b.target.value,o))},e[0]=v,e[1]=o,e[2]=k):k=e[2];const L=k;let K;e[3]!==a||e[4]!==v?(K=b=>{b!==null&&(g(b),v(ue(a,b)))},e[3]=a,e[4]=v,e[5]=K):K=e[5];const V=K;let p;e[6]!==t?(p=t("days"),e[6]=t,e[7]=p):p=e[7];let m;e[8]!==t?(m=t("hours"),e[8]=t,e[9]=m):m=e[9];let h;e[10]!==t?(h=t("minutes"),e[10]=t,e[11]=h):h=e[11];let x;e[12]!==t?(x=t("seconds"),e[12]=t,e[13]=x):x=e[13];let N;e[14]!==p||e[15]!==m||e[16]!==h||e[17]!==x?(N={days:p,hours:m,minutes:h,seconds:x},e[14]=p,e[15]=m,e[16]=h,e[17]=x,e[18]=N):N=e[18];const C=N;let y;e[19]!==t?(y=t("Expires after"),e[19]=t,e[20]=y):y=e[20];let S;e[21]!==c||e[22]!==y?(S=r(W,{className:"text-xs",htmlFor:c,children:y}),e[21]=c,e[22]=y,e[23]=S):S=e[23];let F;e[24]!==t?(F=t("No expiration"),e[24]=t,e[25]=F):F=e[25];let O;e[26]!==a||e[27]!==c||e[28]!==i||e[29]!==L||e[30]!==F||e[31]!==d?(O=r(re,{"aria-invalid":i,className:"flex-1","data-testid":d,id:c,inputMode:"numeric",onChange:L,placeholder:F,value:a}),e[26]=a,e[27]=c,e[28]=i,e[29]=L,e[30]=F,e[31]=d,e[32]=O):O=e[32];let I;e[33]!==t?(I=t("TTL unit"),e[33]=t,e[34]=I):I=e[34];const D=`${d}-unit`;let A;e[35]===Symbol.for("react.memo_cache_sentinel")?(A=r(Ve,{}),e[35]=A):A=e[35];let _;e[36]!==I||e[37]!==D?(_=r(Ie,{"aria-label":I,className:"w-[7.5rem]","data-testid":D,children:A}),e[36]=I,e[37]=D,e[38]=_):_=e[38];let n;e[39]!==C?(n=Ne.map(b=>r(Ke,{value:b.key,children:C[b.key]},b.key)),e[39]=C,e[40]=n):n=e[40];let u;e[41]!==n?(u=r(_e,{children:n}),e[41]=n,e[42]=u):u=e[42];let T;e[43]!==V||e[44]!==_||e[45]!==u||e[46]!==o?(T=w(Me,{onValueChange:V,value:o,children:[_,u]}),e[43]=V,e[44]=_,e[45]=u,e[46]=o,e[47]=T):T=e[47];let M;e[48]!==O||e[49]!==T?(M=w("div",{className:"flex gap-2",children:[O,T]}),e[48]=O,e[49]=T,e[50]=M):M=e[50];let E;e[51]!==s||e[52]!==i||e[53]!==t||e[54]!==d?(E=i?r("p",{className:"text-xs text-destructive","data-testid":`${d}-invalid`,children:t("TTL must be at least 60 seconds.")}):s!==void 0&&r("p",{className:"text-xs text-muted-foreground",children:s}),e[51]=s,e[52]=i,e[53]=t,e[54]=d,e[55]=E):E=e[55];let B;return e[56]!==M||e[57]!==E||e[58]!==S?(B=w("div",{className:"mb-3 grid gap-1",children:[S,M,E]}),e[56]=M,e[57]=E,e[58]=S,e[59]=B):B=e[59],B},Te=l=>{const e=te(36),{id:s,invalidTestId:c,onChange:i,testId:v,valid:d,value:t}=l,a=G();let f;e[0]!==t?(f=ge(t),e[0]=t,e[1]=f):f=e[1];const o=f;let g;e[2]!==a?(g=a("Metadata (JSON)"),e[2]=a,e[3]=g):g=e[3];let k;e[4]!==s||e[5]!==g?(k=r(W,{className:"text-xs",htmlFor:s,children:g}),e[4]=s,e[5]=g,e[6]=k):k=e[6];const L=`${v}-format`,K=o===void 0;let V;e[7]!==o||e[8]!==i?(V=()=>{o!==void 0&&i(o)},e[7]=o,e[8]=i,e[9]=V):V=e[9];let p;e[10]!==a?(p=a("Format JSON"),e[10]=a,e[11]=p):p=e[11];let m;e[12]!==L||e[13]!==K||e[14]!==V||e[15]!==p?(m=r(P,{"data-testid":L,disabled:K,onClick:V,size:"sm",variant:"outline",children:p}),e[12]=L,e[13]=K,e[14]=V,e[15]=p,e[16]=m):m=e[16];let h;e[17]!==k||e[18]!==m?(h=w("div",{className:"flex items-center justify-between gap-2",children:[k,m]}),e[17]=k,e[18]=m,e[19]=h):h=e[19];const x=!d;let N;e[20]!==i?(N=F=>{i(F.target.value)},e[20]=i,e[21]=N):N=e[21];let C;e[22]!==s||e[23]!==x||e[24]!==N||e[25]!==v||e[26]!==t?(C=r(ke,{"aria-invalid":x,className:"min-h-[4rem] font-mono text-xs","data-testid":v,id:s,onChange:N,value:t}),e[22]=s,e[23]=x,e[24]=N,e[25]=v,e[26]=t,e[27]=C):C=e[27];let y;e[28]!==c||e[29]!==a||e[30]!==d?(y=!d&&r("p",{className:"text-xs text-destructive","data-testid":c,children:a("Metadata must be valid JSON.")}),e[28]=c,e[29]=a,e[30]=d,e[31]=y):y=e[31];let S;return e[32]!==C||e[33]!==y||e[34]!==h?(S=w("div",{className:"mb-3 grid gap-1",children:[h,C,y]}),e[32]=C,e[33]=y,e[34]=h,e[35]=S):S=e[35],S},De={busy:!1,error:null,metadata:"",name:"",ttl:"",value:""},Je=(l,e)=>{switch(e.type){case"setField":return{...l,[e.field]:e.value};case"submitFailed":return{...l,busy:!1,error:e.error};case"submitStart":return{...l,busy:!0,error:null};default:return l}},Pe=l=>{const e=te(73),{namespace:s,onCancel:c,onCreated:i}=l,v=ee(),d=G(),[t,a]=le(Je,De);let f;e[0]!==t.metadata?(f=xe(t.metadata),e[0]=t.metadata,e[1]=f):f=e[1];const o=f;let g;e[2]!==t.ttl?(g=Ce(t.ttl),e[2]=t.ttl,e[3]=g):g=e[3];const k=g;let L;e[4]!==o||e[5]!==t.busy||e[6]!==t.name||e[7]!==k?(L=t.name.trim()!==""&&o&&k&&!t.busy,e[4]=o,e[5]=t.busy,e[6]=t.name,e[7]=k,e[8]=L):L=e[8];const K=L;let V;e[9]!==K||e[10]!==v||e[11]!==s||e[12]!==i||e[13]!==t.metadata||e[14]!==t.name||e[15]!==t.ttl||e[16]!==t.value?(V=()=>{K&&(a({type:"submitStart"}),H((async()=>{try{await v.putKvValue(Se({metadata:t.metadata,ttl:t.ttl,value:t.value},t.name,s)),i()}catch($){a({error:R($),type:"submitFailed"})}})()))},e[9]=K,e[10]=v,e[11]=s,e[12]=i,e[13]=t.metadata,e[14]=t.name,e[15]=t.ttl,e[16]=t.value,e[17]=V):V=e[17];const p=V;let m;e[18]!==d?(m=d("Key name"),e[18]=d,e[19]=m):m=e[19];let h;e[20]!==m?(h=r(W,{className:"text-xs",htmlFor:"kv-create-name",children:m}),e[20]=m,e[21]=h):h=e[21];let x;e[22]===Symbol.for("react.memo_cache_sentinel")?(x=$=>{a({field:"name",type:"setField",value:$.target.value})},e[22]=x):x=e[22];let N;e[23]!==d?(N=d("Key name"),e[23]=d,e[24]=N):N=e[24];let C;e[25]!==t.name||e[26]!==N?(C=r(re,{autoFocus:!0,"data-testid":"kv-create-name",id:"kv-create-name",onChange:x,placeholder:N,value:t.name}),e[25]=t.name,e[26]=N,e[27]=C):C=e[27];let y;e[28]!==h||e[29]!==C?(y=w("div",{className:"grid gap-1",children:[h,C]}),e[28]=h,e[29]=C,e[30]=y):y=e[30];let S;e[31]!==d?(S=d("Value"),e[31]=d,e[32]=S):S=e[32];let F;e[33]!==S?(F=r(W,{className:"text-xs",htmlFor:"kv-create-value",children:S}),e[33]=S,e[34]=F):F=e[34];let O;e[35]===Symbol.for("react.memo_cache_sentinel")?(O=$=>{a({field:"value",type:"setField",value:$.target.value})},e[35]=O):O=e[35];let I;e[36]!==t.value?(I=r(ke,{className:"min-h-[6rem] font-mono text-xs","data-testid":"kv-create-value",id:"kv-create-value",onChange:O,value:t.value}),e[36]=t.value,e[37]=I):I=e[37];let D;e[38]!==F||e[39]!==I?(D=w("div",{className:"grid gap-1",children:[F,I]}),e[38]=F,e[39]=I,e[40]=D):D=e[40];const A=!k;let _;e[41]===Symbol.for("react.memo_cache_sentinel")?(_=$=>{a({field:"ttl",type:"setField",value:$})},e[41]=_):_=e[41];let n;e[42]!==A?(n=r(we,{id:"kv-create-ttl",invalid:A,onChange:_,testId:"kv-create-ttl"}),e[42]=A,e[43]=n):n=e[43];let u;e[44]===Symbol.for("react.memo_cache_sentinel")?(u=$=>{a({field:"metadata",type:"setField",value:$})},e[44]=u):u=e[44];let T;e[45]!==o||e[46]!==t.metadata?(T=r(Te,{id:"kv-create-metadata",invalidTestId:"kv-create-metadata-invalid",onChange:u,testId:"kv-create-metadata",valid:o,value:t.metadata}),e[45]=o,e[46]=t.metadata,e[47]=T):T=e[47];const M=!K;let E;e[48]!==t.busy||e[49]!==d?(E=t.busy?d("Creating…"):d("Create key"),e[48]=t.busy,e[49]=d,e[50]=E):E=e[50];let B;e[51]!==p||e[52]!==M||e[53]!==E?(B=r(P,{"data-testid":"kv-create-submit",disabled:M,onClick:p,children:E}),e[51]=p,e[52]=M,e[53]=E,e[54]=B):B=e[54];const b=t.busy;let J;e[55]!==d?(J=d("Cancel"),e[55]=d,e[56]=J):J=e[56];let j;e[57]!==c||e[58]!==t.busy||e[59]!==J?(j=r(P,{"data-testid":"kv-create-cancel",disabled:b,onClick:c,variant:"outline",children:J}),e[57]=c,e[58]=t.busy,e[59]=J,e[60]=j):j=e[60];let z;e[61]!==B||e[62]!==j?(z=w("div",{className:"flex flex-wrap gap-2",children:[B,j]}),e[61]=B,e[62]=j,e[63]=z):z=e[63];let U;e[64]!==t.error?(U=t.error!==null&&r("p",{className:"text-sm text-destructive","data-testid":"kv-create-error",role:"alert",children:t.error}),e[64]=t.error,e[65]=U):U=e[65];let Y;return e[66]!==y||e[67]!==D||e[68]!==n||e[69]!==T||e[70]!==z||e[71]!==U?(Y=w("div",{className:"grid gap-3 px-4 pb-4","data-testid":"kv-create-form",children:[y,D,n,T,z,U]}),e[66]=y,e[67]=D,e[68]=n,e[69]=T,e[70]=z,e[71]=U,e[72]=Y):Y=e[72],Y},$e={busy:"",editedMetadata:"",editedTtl:"",editedValue:"",loadError:null,loading:!0,value:null,writeError:null},je=(l,e)=>{switch(e.type){case"deleteStart":return{...l,busy:"deleting",writeError:null};case"editMetadata":return{...l,editedMetadata:e.value};case"editTtl":return{...l,editedTtl:e.value};case"editValue":return{...l,editedValue:e.value};case"loaded":return{...l,editedMetadata:e.metadata===null||e.metadata===void 0?"":JSON.stringify(e.metadata,null,2),editedValue:e.value??"",loading:!1,value:e.value};case"loadFailed":return{...l,loadError:e.error,loading:!1};case"saveOk":return{...l,busy:"",value:l.editedValue};case"saveStart":return{...l,busy:"saving",writeError:null};case"writeFailed":return{...l,busy:"",writeError:e.error};default:return l}},He=l=>{const e=te(67),{expiration:s,keyName:c,namespace:i,onDeleted:v}=l,d=ee(),t=G(),[a,f]=le(je,$e);let o,g;e[0]!==d||e[1]!==c||e[2]!==i?(o=()=>{const b={cancelled:!1};return H((async()=>{try{const J=await d.getKvValue({key:c,namespace:i});b.cancelled||f({metadata:J.metadata,type:"loaded",value:J.value})}catch(J){const j=J;b.cancelled||f({error:R(j),type:"loadFailed"})}})()),()=>{b.cancelled=!0}},g=[d,i,c],e[0]=d,e[1]=c,e[2]=i,e[3]=o,e[4]=g):(o=e[3],g=e[4]),ae(o,g);let k;e[5]===Symbol.for("react.memo_cache_sentinel")?(k=b=>{f({type:"editValue",value:b.target.value})},e[5]=k):k=e[5];const L=k;let K;e[6]===Symbol.for("react.memo_cache_sentinel")?(K=b=>{f({type:"editMetadata",value:b})},e[6]=K):K=e[6];const V=K;let p;e[7]!==a.editedValue?(p=ge(a.editedValue),e[7]=a.editedValue,e[8]=p):p=e[8];const m=p;let h;e[9]!==a.editedMetadata?(h=xe(a.editedMetadata),e[9]=a.editedMetadata,e[10]=h):h=e[10];const x=h;let N;e[11]!==a.editedTtl?(N=Ce(a.editedTtl),e[11]=a.editedTtl,e[12]=N):N=e[12];const C=N;let y;e[13]!==m?(y=()=>{m!==void 0&&f({type:"editValue",value:m})},e[13]=m,e[14]=y):y=e[14];const S=y;let F;e[15]!==d||e[16]!==s||e[17]!==c||e[18]!==x||e[19]!==i||e[20]!==a.editedMetadata||e[21]!==a.editedTtl||e[22]!==a.editedValue||e[23]!==t?(F=()=>{if(!x){f({error:t("Metadata must be valid JSON."),type:"writeFailed"});return}f({type:"saveStart"}),H((async()=>{try{await d.putKvValue(Se({metadata:a.editedMetadata,ttl:a.editedTtl,value:a.editedValue},c,i,s)),f({type:"saveOk"})}catch(b){f({error:R(b),type:"writeFailed"})}})())},e[15]=d,e[16]=s,e[17]=c,e[18]=x,e[19]=i,e[20]=a.editedMetadata,e[21]=a.editedTtl,e[22]=a.editedValue,e[23]=t,e[24]=F):F=e[24];const O=F;let I;e[25]!==d||e[26]!==c||e[27]!==i||e[28]!==v?(I=()=>{f({type:"deleteStart"}),H((async()=>{try{await d.deleteKvKey({key:c,namespace:i}),v(c)}catch(b){f({error:R(b),type:"writeFailed"})}})())},e[25]=d,e[26]=c,e[27]=i,e[28]=v,e[29]=I):I=e[29];const D=I;let A;e[30]!==c?(A=()=>{se(c)},e[30]=c,e[31]=A):A=e[31];let _;e[32]!==t?(_=t("Copy key"),e[32]=t,e[33]=_):_=e[33];let n;e[34]!==A||e[35]!==_?(n=r("div",{className:"mb-2 flex justify-end",children:r(P,{"data-testid":"kv-copy-key-btn",onClick:A,size:"sm",variant:"outline",children:_})}),e[34]=A,e[35]=_,e[36]=n):n=e[36];let u;e[37]!==a.loadError?(u=a.loadError!==null&&r("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-value-error",role:"alert",children:a.loadError}),e[37]=a.loadError,e[38]=u):u=e[38];let T;e[39]!==a.loading||e[40]!==t?(T=a.loading&&r("p",{className:"text-sm text-muted-foreground","data-testid":"kv-value-loading",children:t("Loading…")}),e[39]=a.loading,e[40]=t,e[41]=T):T=e[41];let M;e[42]!==m||e[43]!==x||e[44]!==D||e[45]!==S||e[46]!==O||e[47]!==a.busy||e[48]!==a.editedMetadata||e[49]!==a.editedValue||e[50]!==a.loading||e[51]!==a.value||e[52]!==a.writeError||e[53]!==t||e[54]!==C?(M=!a.loading&&a.value!==null&&w(be,{children:[w("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[r(W,{className:"text-xs",htmlFor:"kv-value-editor",children:t("Value")}),m!==void 0&&r(Le,{variant:"secondary",children:t("JSON")}),r("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground","data-testid":"kv-value-size",children:Fe(Ae(a.editedValue))})]}),r("textarea",{"aria-label":t("KV value"),className:"mb-2 min-h-[8rem] w-full rounded border border-border bg-muted/30 p-2 font-mono text-xs","data-testid":"kv-value-editor",id:"kv-value-editor",onChange:L,value:a.editedValue}),w("div",{className:"mb-3 flex flex-wrap gap-2",children:[r(P,{"data-testid":"kv-format-btn",disabled:m===void 0,onClick:S,size:"sm",variant:"outline",children:t("Format JSON")}),r(P,{"data-testid":"kv-copy-value-btn",onClick:()=>{se(a.editedValue)},size:"sm",variant:"outline",children:t("Copy value")})]}),r(we,{helper:t("Leave blank to keep the current expiration."),id:"kv-ttl-input",invalid:!C,onChange:b=>{f({type:"editTtl",value:b})},testId:"kv-ttl-input"}),r(Te,{id:"kv-metadata-editor",invalidTestId:"kv-metadata-invalid",onChange:V,testId:"kv-metadata-editor",valid:x,value:a.editedMetadata}),w("div",{className:"flex flex-wrap gap-2",children:[r(P,{"data-testid":"kv-save-btn",disabled:a.busy!==""||!x||!C,onClick:O,children:a.busy==="saving"?t("Saving…"):t("Save")}),r(P,{"data-testid":"kv-delete-btn",disabled:a.busy!=="",onClick:D,variant:"destructive",children:a.busy==="deleting"?t("Deleting…"):t("Delete")})]}),a.writeError!==null&&r("p",{className:"mt-2 text-sm text-destructive","data-testid":"kv-save-error",role:"alert",children:a.writeError})]}),e[42]=m,e[43]=x,e[44]=D,e[45]=S,e[46]=O,e[47]=a.busy,e[48]=a.editedMetadata,e[49]=a.editedValue,e[50]=a.loading,e[51]=a.value,e[52]=a.writeError,e[53]=t,e[54]=C,e[55]=M):M=e[55];let E;e[56]!==a.loadError||e[57]!==a.loading||e[58]!==a.value||e[59]!==t?(E=!a.loading&&a.value===null&&a.loadError===null&&r("p",{className:"text-sm text-muted-foreground","data-testid":"kv-absent",children:t("Key is absent or has no value.")}),e[56]=a.loadError,e[57]=a.loading,e[58]=a.value,e[59]=t,e[60]=E):E=e[60];let B;return e[61]!==n||e[62]!==u||e[63]!==T||e[64]!==M||e[65]!==E?(B=w("div",{className:"px-4 pb-4","data-testid":"kv-value-section",children:[n,u,T,M,E]}),e[61]=n,e[62]=u,e[63]=T,e[64]=M,e[65]=E,e[66]=B):B=e[66],B},me=100,Re={appliedPrefix:"",bulk:[],bulkBusy:!1,bulkError:null,cursor:null,keys:null,listComplete:!1,loadError:null,loading:!1,prefixInput:"",reloadNonce:0,selectedKey:null},ze=(l,e)=>{switch(e.type){case"appendPage":return e.generation!==l.reloadNonce?l:{...l,cursor:e.cursor,keys:[...l.keys??[],...e.keys],listComplete:e.listComplete,loading:!1};case"applyFilter":return{...l,appliedPrefix:l.prefixInput,bulk:[],bulkError:null,cursor:null,keys:null,listComplete:!1,reloadNonce:l.reloadNonce+1,selectedKey:null};case"bulkDeleted":{const s=new Set(e.deleted);return{...l,bulk:l.bulk.filter(c=>!s.has(c)),bulkBusy:!1,bulkError:e.error,keys:l.keys===null?null:l.keys.filter(c=>!s.has(c.name)),selectedKey:l.selectedKey!==null&&s.has(l.selectedKey)?null:l.selectedKey}}case"bulkDeleteStart":return{...l,bulkBusy:!0,bulkError:null};case"firstPage":return{...l,cursor:e.cursor,keys:e.keys,listComplete:e.listComplete,loading:!1};case"keyDeleted":return{...l,bulk:l.bulk.filter(s=>s!==e.name),keys:l.keys===null?null:l.keys.filter(s=>s.name!==e.name),selectedKey:null};case"loadFailed":return e.generation!==void 0&&e.generation!==l.reloadNonce?l:{...l,loadError:e.error,loading:!1};case"loadStart":return{...l,loadError:null,loading:!0};case"prefixInput":return{...l,prefixInput:e.value};case"reload":return{...l,bulk:[],bulkError:null,reloadNonce:l.reloadNonce+1,selectedKey:null};case"selectKey":return{...l,selectedKey:e.name};case"toggleAllBulk":return{...l,bulk:e.names};case"toggleBulk":return{...l,bulk:l.bulk.includes(e.name)?l.bulk.filter(s=>s!==e.name):[...l.bulk,e.name]};default:return l}},Ue=({namespace:l})=>{const e=ee(),s=G(),[c,i]=le(ze,Re),{appliedPrefix:v,bulk:d,bulkBusy:t,bulkError:a,cursor:f,keys:o,listComplete:g,loadError:k,loading:L,prefixInput:K,reloadNonce:V,selectedKey:p}=c,[m,h]=Z(!1);ae(()=>{const n={cancelled:!1};return H((async()=>{i({type:"loadStart"});try{const u=await e.listKvKeys({limit:me,namespace:l,prefix:v===""?void 0:v});n.cancelled||i({cursor:u.cursor??null,keys:u.keys,listComplete:u.listComplete,type:"firstPage"})}catch(u){n.cancelled||i({error:R(u),type:"loadFailed"})}})()),()=>{n.cancelled=!0}},[e,l,v,V]);const x=n=>{i({type:"prefixInput",value:n.target.value})},N=()=>{i({type:"applyFilter"})},C=n=>{i({name:n.currentTarget.dataset.key??null,type:"selectKey"})},y=()=>{if(f===null)return;i({type:"loadStart"});const n=V;H((async()=>{try{const u=await e.listKvKeys({cursor:f,limit:me,namespace:l,prefix:v===""?void 0:v});i({cursor:u.cursor??null,generation:n,keys:u.keys,listComplete:u.listComplete,type:"appendPage"})}catch(u){i({error:R(u),generation:n,type:"loadFailed"})}})())},S=n=>{i({name:n,type:"keyDeleted"})},F=n=>{i({name:n,type:"toggleBulk"})},O=n=>{i({names:n&&o!==null?o.map(u=>u.name):[],type:"toggleAllBulk"})},I=()=>{if(d.length===0)return;const n=[...d];i({type:"bulkDeleteStart"}),H((async()=>{const u=await Promise.allSettled(n.map(E=>e.deleteKvKey({key:E,namespace:l}))),T=n.filter((E,B)=>u[B]?.status==="fulfilled"),M=n.length-T.length;i({deleted:T,error:M>0?s("Failed to delete {count} keys.",{count:M}):null,type:"bulkDeleted"})})())},D=()=>{h(!1),i({type:"reload"})},A=o!==null&&o.length>0&&d.length===o.length,_=new Set(d);return w(be,{children:[w("section",{className:"border border-border bg-card p-3","data-testid":"kv-keys-section",children:[w("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[r(re,{"aria-label":s("Filter keys by prefix"),className:"min-w-[16rem] flex-1","data-testid":"kv-prefix-input",onChange:x,placeholder:s("Filter by prefix…"),value:K}),r(P,{"data-testid":"kv-filter-btn",disabled:L,onClick:N,children:s("Filter")}),r(P,{"data-testid":"kv-new-key-btn",onClick:()=>{h(n=>!n)},variant:"outline",children:s("New key")}),d.length>0&&r(P,{"data-testid":"kv-bulk-delete-btn",disabled:t,onClick:I,variant:"destructive",children:t?s("Deleting…"):s("Delete {count}",{count:d.length})})]}),a!==null&&r("p",{className:"mb-2 text-sm text-destructive","data-testid":"kv-bulk-error",role:"alert",children:a}),k!==null&&r("p",{className:"text-sm text-destructive","data-testid":"kv-keys-error",role:"alert",children:k}),o!==null&&o.length===0&&!L&&r("p",{className:"text-sm text-muted-foreground","data-testid":"kv-no-keys",children:s("No keys.")}),o!==null&&o.length>0&&r(ve,{className:"overflow-hidden py-0",children:r(fe,{className:"px-0",children:w(pe,{"data-testid":"kv-key-table",children:[r(he,{children:w(X,{children:[r(q,{className:"w-10",children:r(ne,{"aria-label":s("Select all"),checked:A,"data-testid":"kv-select-all",onCheckedChange:O})}),r(q,{children:s("Key")}),r(q,{children:s("Expiration")})]})}),r(ye,{children:o.map(n=>w(X,{className:n.name===p?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-key":n.name,"data-testid":`kv-key-row-${n.name}`,onClick:C,children:[r(Q,{onClick:u=>{u.stopPropagation()},children:r(ne,{"aria-label":s("Select {name}",{name:n.name}),checked:_.has(n.name),"data-testid":`kv-select-${n.name}`,onCheckedChange:()=>{F(n.name)}})}),r(Q,{className:"font-mono text-xs",children:n.name}),r(Q,{className:"tabular-nums text-xs",children:Oe(n.expiration)})]},n.name))})]})})}),!g&&f!==null&&r("div",{className:"mt-2",children:r(P,{"data-testid":"kv-load-more",disabled:L,onClick:y,variant:"outline",children:s(L?"Loading…":"Load more")})})]}),r(ie,{onOpenChange:n=>{n||h(!1)},open:m,children:w(de,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-create-sheet",side:"right",children:[r(oe,{children:r(ce,{children:s("New key")})}),r(Pe,{namespace:l,onCancel:()=>{h(!1)},onCreated:D})]})}),r(ie,{onOpenChange:n=>{n||i({name:null,type:"selectKey"})},open:p!==null,children:w(de,{className:"w-full gap-0 overflow-y-auto sm:max-w-md","data-testid":"kv-editor-sheet",side:"right",children:[r(oe,{children:r(ce,{className:"truncate font-mono text-xs",children:p})}),p!==null&&r(He,{expiration:o?.find(n=>n.name===p)?.expiration,keyName:p,namespace:l,onDeleted:S},`${l}:${p}`)]})})]})},ut=({loadNamespaces:l}={})=>{const e=ee(),s=G(),[c,i]=Z(null),[v,d]=Z(null),[t,a]=Z(null);ae(()=>{const o={cancelled:!1};return H((async()=>{try{const g=await(l??(()=>e.listKvNamespaces()))();o.cancelled||(i(g),d(null),a(k=>k??g[0]?.binding??null))}catch(g){o.cancelled||(i(null),d(R(g)))}})()),()=>{o.cancelled=!0}},[e,l]);const f=o=>{a(o.currentTarget.dataset.ns??null)};return w("div",{className:"flex flex-col gap-4","data-testid":"lunora-kv-browser",children:[v!==null&&r("p",{className:"text-sm text-destructive","data-testid":"kv-ns-error",role:"alert",children:v}),c!==null&&c.length===0&&r(Ee,{description:s("Add a kv_namespaces binding to wrangler.jsonc — it appears here automatically, no wiring needed."),icon:r("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r("path",{d:"M5 5h14v4H5V5Zm0 5h14v4H5v-4Zm0 5h14v4H5v-4Z"})}),testId:"kv-empty",title:s("No KV namespaces.")}),c!==null&&c.length>0&&r(ve,{className:"overflow-hidden py-0",children:r(fe,{className:"px-0",children:w(pe,{"data-testid":"kv-namespace-table",children:[r(he,{children:r(X,{children:r(q,{children:s("Namespace")})})}),r(ye,{children:c.map(o=>r(X,{className:o.binding===t?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-ns":o.binding,"data-testid":`kv-ns-row-${o.binding}`,onClick:f,children:r(Q,{className:"font-mono text-xs",children:o.binding})},o.binding))})]})})}),t!==null&&r(Ue,{namespace:t},t)]})};export{ut as KvBrowser};
@@ -0,0 +1,4 @@
1
+ import{c as ie}from"react/compiler-runtime";import{useState as te}from"react";import{B as oe}from"../packem_shared/button-q0UYSmrn.mjs";import{C as re,a as ne}from"../packem_shared/card-By2O8ULa.mjs";import{I as pe}from"../packem_shared/input-CXhxesPC.mjs";import{useT as ae}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{a as ue}from"../packem_shared/cf-links-CBJ5SywP.mjs";import{g as he,b as ge,f as xe}from"../packem_shared/internal-BXEjuLPN.mjs";import{jsx as l,jsxs as g}from"react/jsx-runtime";const be=e=>{const t=ie(23),{destination:s}=e,u=ae();let x;t[0]!==s.snippet?(x=()=>{he(s.snippet)},t[0]=s.snippet,t[1]=x):x=t[1];const m=x;let i;t[2]!==s.title?(i=l("h4",{className:"text-sm font-semibold",children:s.title}),t[2]=s.title,t[3]=i):i=t[3];let o;t[4]!==s.description?(o=l("p",{className:"text-sm text-muted-foreground",children:s.description}),t[4]=s.description,t[5]=o):o=t[5];let c;t[6]!==i||t[7]!==o?(c=g("div",{children:[i,o]}),t[6]=i,t[7]=o,t[8]=c):c=t[8];const P=`drain-copy-${s.id}`;let r;t[9]!==u?(r=u("Copy"),t[9]=u,t[10]=r):r=t[10];let n;t[11]!==m||t[12]!==P||t[13]!==r?(n=l(oe,{"data-testid":P,onClick:m,size:"sm",variant:"outline",children:r}),t[11]=m,t[12]=P,t[13]=r,t[14]=n):n=t[14];let a;t[15]!==c||t[16]!==n?(a=g("div",{className:"flex items-start justify-between gap-3",children:[c,n]}),t[15]=c,t[16]=n,t[17]=a):a=t[17];let f;t[18]!==s.snippet?(f=l("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:s.snippet}),t[18]=s.snippet,t[19]=f):f=t[19];let b;return t[20]!==a||t[21]!==f?(b=l(re,{className:"py-0","data-testid":"drain-card",children:g(ne,{className:"p-3",children:[a,f]})}),t[20]=a,t[21]=f,t[22]=b):b=t[22],b},je=()=>{const e=ie(93),t=ae();let s;e[0]!==t?(s=t("Stream every request log to R2, a SIEM, or a third-party log service."),e[0]=t,e[1]=s):s=e[1];let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=["{",' "logpush": true',"}"],e[2]=u):u=e[2];const x=u.join(`
2
+ `);let m;e[3]!==t?(m=t("Logpush"),e[3]=t,e[4]=m):m=e[4];let i;e[5]!==s||e[6]!==m?(i={description:s,id:"logpush",snippet:x,title:m},e[5]=s,e[6]=m,e[7]=i):i=e[7];let o;e[8]!==t?(o=t("Send logs programmatically to a Worker for custom capture and forwarding."),e[8]=t,e[9]=o):o=e[9];let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=["{",' "tail_consumers": [{ "service": "my-log-forwarder" }]',"}"],e[10]=c):c=e[10];const P=c.join(`
3
+ `);let r;e[11]!==t?(r=t("Tail Workers"),e[11]=t,e[12]=r):r=e[12];let n;e[13]!==o||e[14]!==r?(n={description:o,id:"tail-worker",snippet:P,title:r},e[13]=o,e[14]=r,e[15]=n):n=e[15];let a;e[16]!==t?(a=t("Retain and query recent request logs directly in Cloudflare's dashboard."),e[16]=t,e[17]=a):a=e[17];let f;e[18]===Symbol.for("react.memo_cache_sentinel")?(f=["{",' "observability": { "enabled": true }',"}"],e[18]=f):f=e[18];const b=f.join(`
4
+ `);let y;e[19]!==t?(y=t("Workers Logs"),e[19]=t,e[20]=y):y=e[20];let k;e[21]!==a||e[22]!==y?(k={description:a,id:"workers-logs",snippet:b,title:y},e[21]=a,e[22]=y,e[23]=k):k=e[23];let $;e[24]!==k||e[25]!==i||e[26]!==n?($=[i,n,k],e[24]=k,e[25]=i,e[26]=n,e[27]=$):$=e[27];const Q=$,[d,de]=te(""),[v,se]=te(!1),[z,J]=te(null);let V;e[28]!==t||e[29]!==d?(V=async()=>{const h=d.trim();if(h==="")return;const le="fetch"in globalThis?globalThis.fetch:void 0;if(le===void 0){J({kind:"error",message:t("fetch is unavailable in this environment."),url:h});return}const fe={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};se(!0),J(null);const me=performance.now();try{const ee=await le(h,{body:JSON.stringify(fe),headers:{"Content-Type":"application/json"},method:"POST"});J({kind:"success",latencyMs:Math.round(performance.now()-me),status:ee.status,url:h})}catch(ee){J({kind:"error",message:ge(ee),url:h})}se(!1)},e[28]=t,e[29]=d,e[30]=V):V=e[30];const X=V;let Y;e[31]!==z||e[32]!==d?(Y=z?.url===d.trim()?z:null,e[31]=z,e[32]=d,e[33]=Y):Y=e[33];const p=Y;let G;e[34]!==X?(G=()=>{xe(X())},e[34]=X,e[35]=G):G=e[35];const Z=G;let H;e[36]===Symbol.for("react.memo_cache_sentinel")?(H=h=>{de(h.target.value)},e[36]=H):H=e[36];const ce=H;let w;e[37]!==t?(w=t("Open in Cloudflare"),e[37]=t,e[38]=w):w=e[38];let N;e[39]!==w?(N=l("div",{className:"flex flex-wrap items-center gap-3",children:l("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:ue,rel:"noreferrer",target:"_blank",children:w})}),e[39]=w,e[40]=N):N=e[40];let C;e[41]!==t?(C=t("Lunora does not ship logs itself — forwarding is handled by Cloudflare. Configure a destination below, then test your collector."),e[41]=t,e[42]=C):C=e[42];let S;e[43]!==C?(S=l("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:C}),e[43]=C,e[44]=S):S=e[44];let _;e[45]!==t?(_=t("Cloudflare destinations"),e[45]=t,e[46]=_):_=e[46];let T;e[47]!==_?(T=l("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:_}),e[47]=_,e[48]=T):T=e[48];let L;e[49]!==Q?(L=Q.map(ye),e[49]=Q,e[50]=L):L=e[50];let R;e[51]!==T||e[52]!==L?(R=g("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[T,L]}),e[51]=T,e[52]=L,e[53]=R):R=e[53];let j;e[54]!==t?(j=t("Webhook test"),e[54]=t,e[55]=j):j=e[55];let O;e[56]!==j?(O=l("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:j}),e[56]=j,e[57]=O):O=e[57];let W;e[58]!==t?(W=t("POST a sample Lunora request-log envelope to your collector to confirm it is reachable."),e[58]=t,e[59]=W):W=e[59];let I;e[60]!==W?(I=l("p",{className:"mb-2 text-sm text-muted-foreground",children:W}),e[60]=W,e[61]=I):I=e[61];let M;e[62]!==t?(M=t("https://example.com/logs"),e[62]=t,e[63]=M):M=e[63];let q;e[64]!==M||e[65]!==d?(q=l(pe,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:ce,placeholder:M,type:"url",value:d}),e[64]=M,e[65]=d,e[66]=q):q=e[66];let D;e[67]!==v||e[68]!==d?(D=v||d.trim()==="",e[67]=v,e[68]=d,e[69]=D):D=e[69];let U;e[70]!==v||e[71]!==t?(U=t(v?"Sending…":"Send test event"),e[70]=v,e[71]=t,e[72]=U):U=e[72];let A;e[73]!==Z||e[74]!==D||e[75]!==U?(A=l(oe,{"data-testid":"drain-webhook-test",disabled:D,onClick:Z,children:U}),e[73]=Z,e[74]=D,e[75]=U,e[76]=A):A=e[76];let B;e[77]!==q||e[78]!==A?(B=g("div",{className:"flex flex-wrap items-center gap-2",children:[q,A]}),e[77]=q,e[78]=A,e[79]=B):B=e[79];let E;e[80]!==p||e[81]!==t?(E=p!==null&&l("p",{className:p.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:p.kind==="error"?"alert":void 0,children:p.kind==="success"?t("Delivered — status {status} in {latency}ms",{latency:p.latencyMs,status:p.status}):t("Failed: {message}",{message:p.message})}),e[80]=p,e[81]=t,e[82]=E):E=e[82];let F;e[83]!==O||e[84]!==I||e[85]!==B||e[86]!==E?(F=l(re,{className:"py-0",children:l(ne,{className:"p-3",children:g("section",{"data-testid":"drain-webhook",children:[O,I,B,E]})})}),e[83]=O,e[84]=I,e[85]=B,e[86]=E,e[87]=F):F=e[87];let K;return e[88]!==N||e[89]!==S||e[90]!==R||e[91]!==F?(K=g("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[N,S,R,F]}),e[88]=N,e[89]=S,e[90]=R,e[91]=F,e[92]=K):K=e[92],K};function ye(e){return l(be,{destination:e},e.id)}export{je as default};
@@ -0,0 +1 @@
1
+ import{c as R}from"react/compiler-runtime";import{useMemo as A,useState as ne}from"react";import{useT as P}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{c as F}from"../packem_shared/utils-bhneXptQ.mjs";import{MigrationsPanel as ie}from"../packem_shared/MigrationsPanel-fUyhbt0w.mjs";import{useNavigate as oe,useSearch as se}from"@tanstack/react-router";import{E as re}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{E as ae}from"../packem_shared/empty-state-D7jEML_T.mjs";import{u as D}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{ADMIN_FUNCTIONS as L}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{h as de,f as ce}from"../packem_shared/internal-BXEjuLPN.mjs";import{S as le}from"../packem_shared/schema-diagram-ghsOCED7.mjs";import{jsx as l,jsxs as y}from"react/jsx-runtime";const J=1;function me(t){const e={},n=Object.keys(t);n.sort();for(const i of n)e[i]=t[i];return e}const O=t=>typeof t=="object"&&t!==null,ue=t=>O(t)&&O(t.fields)&&O(t.indexes)&&O(t.relations)&&typeof t.shardMode=="string",fe=t=>{if(t===void 0||t.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(t)}catch(i){return{error:`baseline is not valid JSON: ${i instanceof Error?i.message:String(i)}`,status:"invalid"}}if(!O(e)||e.version!==J||!O(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(J)})`,status:"invalid"};for(const[i,o]of Object.entries(e.tables))if(!ue(o))return{error:`baseline table "${i}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:J},status:"ok"}},he=(t,e)=>t.unique===e.unique&&t.fields.length===e.fields.length&&t.fields.every((n,i)=>n===e.fields[i]),V=t=>t.unique!==void 0,M=({nullable:t,optional:e,refined:n,unique:i,...o})=>JSON.stringify(me(o)),G=t=>({form:JSON.stringify([M(t),t.optional===!0,t.nullable===!0]),refined:t.refined===!0}),Q=t=>t.kind==="union"&&t.members?t.members.map(e=>G(e)):[G({...t,nullable:!1,optional:!1})],pe=(t,e)=>{if(e.kind!=="union")return!1;const n=Q(e);return Q(t).every(i=>n.some(o=>o.form===i.form&&(i.refined||!o.refined)))},x=t=>{switch(t.kind){case"array":return`array(${t.of?x(t.of):"?"})`;case"from":return t.output===void 0?"from":`from(${t.output})`;case"id":return`id(${t.ref??"?"})`;case"literal":return`literal(${t.literal??"?"})`;case"object":return`object({ ${Object.keys(t.fields??{}).join(", ")} })`;case"record":return`record(${t.key?x(t.key):"?"}, ${t.of?x(t.of):"?"})`;case"union":return(t.members??[]).map(e=>x(e)).join(" | ");default:return t.kind}},j=(t,e,n)=>({remediation:"backfill",scope:"table",severity:"breaking",summary:n,table:t,type:e}),C=(t,e,n)=>({remediation:"none",scope:"table",severity:"safe",summary:n,table:t,type:e}),X=(t,e)=>{const n=JSON.stringify(t),i=JSON.stringify(e);return n===i?0:n<i?-1:1},S=t=>({...t,...t.kind==="from"?{output:void 0}:{},...t.fields?{fields:Object.fromEntries(Object.entries(t.fields).map(([e,n])=>[e,S(n)]))}:{},...t.key?{key:S(t.key)}:{},...t.of?{of:S(t.of)}:{},...t.members?{members:t.members.map(e=>S(e)).toSorted(X)}:{}}),U=t=>t.kind==="union"?t.members??[]:[t],ge=(t,e)=>{const n=[...t],i=[...e],o=new Set,r=new Set,s=(a,d)=>{for(const[m,f]of n.entries()){if(r.has(m))continue;const u=i.findIndex((g,p)=>!o.has(p)&&a(f,g));u!==-1&&(o.add(u),r.add(m),d&&([n[m],i[u]]=I(f,i[u])))}};return s((a,d)=>JSON.stringify(a)===JSON.stringify(d),!1),s((a,d)=>M(S(a))===M(S(d)),!0),[n,i]},I=(t,e)=>{if(t.kind==="union"||e.kind==="union"){const[o,r]=ge(U(t),U(e)),s=(a,d)=>a.kind==="union"?{...a,members:d.toSorted(X)}:d[0];return[s(t,o),s(e,r)]}if(t.kind!==e.kind)return[t,e];if(t.kind==="from")return t.output===void 0||e.output===void 0?[{...t,output:void 0},{...e,output:void 0}]:[t,e];const n={...t.fields?{fields:{...t.fields}}:{}},i={...e.fields?{fields:{...e.fields}}:{}};for(const o of["key","of"])t[o]&&e[o]&&([n[o],i[o]]=I(t[o],e[o]));for(const o of Object.keys(t.fields??{})){const r=t.fields?.[o],s=e.fields?.[o];r&&s&&n.fields&&i.fields&&([n.fields[o],i.fields[o]]=I(r,s))}return[{...t,...n},{...e,...i}]},be=(t,e,n,i,o)=>{const[r,s]=I(n,i);if(!(r.kind===s.kind&&(!o||M(r)===M(s))))return o&&pe(r,s)?C(t,"widenedFieldShape",`field ${t}.${e} widened: ${x(r)} → ${x(s)} — every stored value stays valid`):r.kind!==s.kind?j(t,"changedFieldKind",`field ${t}.${e} changed type: ${r.kind} → ${s.kind} — add a data migration to convert existing values`):j(t,"changedFieldShape",`field ${t}.${e} changed shape: ${x(r)} → ${x(s)} — stored values were written against the old shape; add a data migration to convert them`)},ye=(t,e,n,i)=>{const o=[];return n.unique!==i.unique&&o.push(i.unique===!0?j(t,"addedFieldConstraint",`field ${t}.${e} became unique — existing duplicates would violate it; add a data migration to de-duplicate first`):C(t,"relaxedFieldConstraint",`field ${t}.${e} is no longer unique`)),n.nullable!==i.nullable&&o.push(i.nullable===!0?C(t,"relaxedFieldConstraint",`field ${t}.${e} became nullable`):j(t,"addedFieldConstraint",`field ${t}.${e} is no longer nullable — rows holding NULL would be invalid; add a data migration to backfill them`)),n.refined!==i.refined&&o.push(i.refined===!0?j(t,"addedFieldConstraint",`field ${t}.${e} gained a validation refinement — stored values were never checked against it; add a data migration if any could fail`):C(t,"relaxedFieldConstraint",`field ${t}.${e} dropped its validation refinement`)),o},Z=(t,e,n,i)=>{const o=[],r=V(n)&&V(i),s=be(t,e,n,i,r);return s&&o.push(s),r&&o.push(...ye(t,e,n,i)),n.optional&&!i.optional?o.push({remediation:"backfill",severity:"breaking",summary:`field ${t}.${e} became required — rows missing it would be invalid; add a data migration to backfill it`,table:t,scope:"table",type:"fieldOptionalToRequired"}):!n.optional&&i.optional&&o.push({remediation:"none",scope:"table",severity:"safe",summary:`field ${t}.${e} became optional`,table:t,type:"fieldRequiredToOptional"}),o},ve=(t,e,n)=>n.optional?{remediation:"none",scope:"table",severity:"safe",summary:`added optional field ${t}.${e}`,table:t,type:"addedOptionalField"}:{remediation:"backfill",severity:"breaking",summary:`added required field ${t}.${e} — existing rows have no value; add a data migration to backfill it`,table:t,scope:"table",type:"addedRequiredField"},xe=(t,e,n,i)=>{for(const[o,r]of Object.entries(n.fields)){const s=e.fields[o];s===void 0?i.push(ve(t,o,r)):i.push(...Z(t,o,s,r))}for(const o of Object.keys(e.fields))n.fields[o]===void 0&&i.push({remediation:"backfill",severity:"breaking",summary:`removed field ${t}.${o} — add a data migration if stored data must be cleaned up`,table:t,scope:"table",type:"removedField"})},ke=(t,e,n,i)=>{for(const[o,r]of Object.entries(n.indexes)){const s=e.indexes[o];if(s===void 0){i.push(r.unique?{remediation:"backfill",scope:"table",severity:"breaking",summary:`added unique index ${o} on ${t} — existing duplicates would violate it; add a data migration to de-duplicate first`,table:t,type:"addedIndex"}:{remediation:"none",scope:"table",severity:"safe",summary:`added index ${o} on ${t}`,table:t,type:"addedIndex"});continue}he(s,r)||i.push({remediation:"code",severity:"breaking",summary:`index ${o} on ${t} changed shape — a query may have relied on the old index`,table:t,scope:"table",type:"changedIndex"})}for(const o of Object.keys(e.indexes))n.indexes[o]===void 0&&i.push({remediation:"code",severity:"breaking",summary:`removed index ${o} on ${t} — a query that used \`.withIndex("${o}")\` would break`,table:t,scope:"table",type:"removedIndex"})},$e=(t,e,n,i)=>{for(const o of Object.keys(n.relations))e.relations[o]===void 0&&i.push({remediation:"none",scope:"schema",severity:"safe",summary:`added relation ${t}.${o}`,table:t,type:"addedRelation"});for(const o of Object.keys(e.relations))n.relations[o]===void 0&&i.push({remediation:"code",scope:"schema",severity:"breaking",summary:`removed relation ${t}.${o}`,table:t,type:"removedRelation"})},W="shardBy:_unknown_",q="global",we=(t,e)=>t===q&&e.startsWith(`${q}:`)||e===q&&t.startsWith(`${q}:`),Oe=(t,e,n)=>{if(e===n)return n!==W?void 0:{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} declares a non-literal .shardBy(...) key, so codegen cannot read which column partitions it — every such key records as "${W}" and two DIFFERENT keys would compare equal. Pass the shard key as a string literal; until then this is reported on every run, because the alternative is a silent pass on a re-home that strands every row (export/import is the only way back).`,table:t,type:"changedShardMode"};if(!we(e,n))return{remediation:"rehome",severity:"breaking",summary:`table ${t} changed shard mode: ${e} → ${n} — its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:t,scope:"table",type:"changedShardMode"}},B=t=>t.memory!==void 0,K=t=>t.after??0,w=t=>t.after===void 0?`.ttl("${t.field}")`:`.ttl("${t.field}", { after: ${String(t.after)} })`,Se=(t,e,n)=>{if(e===void 0&&n===void 0)return;const i=a=>({remediation:"backfill",scope:"table",severity:"breaking",summary:a,table:t,type:"changedTtlPolicy"}),o=a=>({remediation:"none",scope:"table",severity:"safe",summary:a,table:t,type:"changedTtlPolicy"});if(n===void 0)return o(`table ${t} dropped its TTL policy — its rows are no longer swept`);if(e===void 0)return i(`table ${t} gained a TTL policy ${w(n)} — every row already past the cutoff is deleted on the next alarm sweep; add a data migration to refresh or clear "${n.field}" on the rows written before it`);if(e.field!==n.field)return i(`table ${t} moved its TTL to a different column: ${w(e)} → ${w(n)} — rows are now expired by a column they were never written against; add a data migration to populate "${n.field}"`);const r=K(e),s=K(n);return s<r?i(`table ${t} shortened its TTL: ${w(e)} → ${w(n)} — rows that were not expired under the old offset are deleted on the next alarm sweep; add a data migration to refresh "${n.field}" on the rows that must survive`):s>r?o(`table ${t} lengthened its TTL: ${w(e)} → ${w(n)}`):void 0},Te=(t,e,n)=>{const i=[];return e.memory!==n.memory&&i.push(n.memory===!0?{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} became a .memory() table — every row is deleted in every shard on the next Durable Object cold start, and no data migration survives that; export the rows first if they must be kept, or revert`,table:t,type:"changedMemoryMode"}:{remediation:"none",scope:"table",severity:"safe",summary:`table ${t} is no longer a .memory() table — its rows now survive a cold start`,table:t,type:"changedMemoryMode"}),e.commitOrdered!==n.commitOrdered&&i.push(n.commitOrdered===!0?{remediation:"backfill",scope:"table",severity:"breaking",summary:`table ${t} became .commitOrdered() — rows written before it carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed never offers them; add a data migration over the table to stamp them (the rewrite allocates a sequence)`,table:t,type:"changedCommitOrdering"}:{remediation:"code",scope:"table",severity:"breaking",summary:`table ${t} is no longer .commitOrdered() — new rows carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed stops advancing without erroring; update the consumers before deploying`,table:t,type:"changedCommitOrdering"}),i},je=(t,e,n,i)=>{const o=Oe(t,e.shardMode,n.shardMode);if(o&&i.push(o),B(e)&&B(n)){i.push(...Te(t,e,n));const r=Se(t,e.ttl,n.ttl);r&&i.push(r)}xe(t,e,n,i),ke(t,e,n,i),$e(t,e,n,i)},Fe=(t,e)=>{const n=[],i=t?.tables??{};for(const[o,r]of Object.entries(e.tables)){const s=i[o];if(s===void 0){n.push({remediation:"none",scope:"table",severity:"safe",summary:`added table ${o}`,table:o,type:"addedTable"});continue}je(o,s,r,n)}for(const o of Object.keys(i))e.tables[o]===void 0&&n.push({remediation:"rehome",scope:"table",severity:"breaking",summary:`removed table ${o} — its rows stay in each shard's SQLite, unreachable through the schema; export the shard first if the data must be kept`,table:o,type:"removedTable"});if(t!==void 0&&t.jurisdiction!==e.jurisdiction){const o=t.jurisdiction??"(none)",r=e.jurisdiction??"(none)";n.push({remediation:"rehome",scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${o} to ${r} — this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (no in-place migration; export then import to move it). Revert the change, or override the gate to proceed intentionally.`,type:"changedJurisdiction"})}return{changes:n}},Y=t=>Object.entries(t.fields).map(([e,n])=>({name:e,optional:n.optional,ref:Object.values(t.relations).find(i=>i.field===e&&i.kind==="one")?.table,type:x(n)})),z=(t,e,n)=>{const i={},o=e?.fields??{},r=n?.fields??{};for(const[s,a]of Object.entries(r)){const d=o[s];d===void 0?i[s]=e===void 0?"unchanged":"added":i[s]=Z(t,s,d,a).length===0?"unchanged":"changed"}for(const s of Object.keys(o))r[s]===void 0&&(i[s]="removed");return i},Me=(t,e)=>{const{changes:n}=Fe(t,e),i=new Set(n.filter(s=>s.scope==="table"&&s.table!==void 0).map(s=>s.table)),o=[],r=(s,a)=>s?"added":i.has(a)?"changed":"context";for(const[s,a]of Object.entries(e.tables)){const d=t?.tables[s],m=r(d===void 0,s);o.push({columns:Y(a),fieldStatus:z(s,d,a),name:s,shardMode:a.shardMode,status:m})}for(const[s,a]of Object.entries(t?.tables??{}))e.tables[s]===void 0&&o.push({columns:Y(a),fieldStatus:z(s,a,void 0),name:s,shardMode:a.shardMode,status:"removed"});return o.sort((s,a)=>s.name.localeCompare(a.name)),{breakingCount:n.filter(s=>s.severity==="breaking").length,changes:n,tables:o}},N=t=>{const e=fe(t);return e.status==="ok"?e.snapshot:void 0},qe={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},Ce=t=>t==="global"||t.startsWith("global:")?"global":"shard",Ie=t=>{const e=R(24),{appliedAt:n,hash:i,onSelect:o,selected:r,seq:s}=t,a=r?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground";let d;e[0]!==a?(d=F("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",a),e[0]=a,e[1]=d):d=e[1];const m=`sh-version-${i}`;let f;e[2]!==i||e[3]!==o?(f=()=>{o(i)},e[2]=i,e[3]=o,e[4]=f):f=e[4];let u;e[5]!==s?(u=y("span",{className:"font-mono text-[13px] tabular-nums",children:["v",s]}),e[5]=s,e[6]=u):u=e[6];let g;e[7]!==i?(g=i.slice(0,7),e[7]=i,e[8]=g):g=e[8];let p;e[9]!==g?(p=l("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:g}),e[9]=g,e[10]=p):p=e[10];let h;e[11]!==u||e[12]!==p?(h=y("span",{className:"flex w-full items-baseline gap-2",children:[u,p]}),e[11]=u,e[12]=p,e[13]=h):h=e[13];let b;e[14]!==n?(b=de(n),e[14]=n,e[15]=b):b=e[15];let v;e[16]!==b?(v=l("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:b}),e[16]=b,e[17]=v):v=e[17];let k;return e[18]!==v||e[19]!==d||e[20]!==m||e[21]!==f||e[22]!==h?(k=l("li",{children:y("button",{className:d,"data-testid":m,onClick:f,type:"button",children:[h,v]})}),e[18]=v,e[19]=d,e[20]=m,e[21]=f,e[22]=h,e[23]=k):k=e[23],k},Re=t=>{const e=R(26),{breaking:n,count:i,first:o}=t,r=P();if(o){let p;e[0]!==i?(p=l("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:i}),e[0]=i,e[1]=p):p=e[1];let h;e[2]!==r?(h=r("tables"),e[2]=r,e[3]=h):h=e[3];let b;e[4]!==h?(b=l("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:h}),e[4]=h,e[5]=b):b=e[5];let v;return e[6]!==p||e[7]!==b?(v=y("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[p,b]}),e[6]=p,e[7]=b,e[8]=v):v=e[8],v}const s=n>0&&"text-destructive";let a;e[9]!==s?(a=F("text-3xl leading-none font-light tracking-tight tabular-nums",s),e[9]=s,e[10]=a):a=e[10];let d;e[11]!==i||e[12]!==a?(d=l("span",{className:a,children:i}),e[11]=i,e[12]=a,e[13]=d):d=e[13];let m;e[14]!==i||e[15]!==r?(m=r(i===1?"change":"changes"),e[14]=i,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==m?(f=l("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:m}),e[17]=m,e[18]=f):f=e[18];let u;e[19]!==n||e[20]!==r?(u=n>0&&y("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["· ",r("{count} breaking",{count:n})]}),e[19]=n,e[20]=r,e[21]=u):u=e[21];let g;return e[22]!==d||e[23]!==f||e[24]!==u?(g=y("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[d,f,u]}),e[22]=d,e[23]=f,e[24]=u,e[25]=g):g=e[25],g},ee={addedFieldConstraint:{action:"added",kind:"constraint"},addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedCommitOrdering:{action:"changed",kind:"commit ordering"},changedFieldKind:{action:"changed",kind:"field kind"},changedFieldShape:{action:"changed",kind:"field shape"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedMemoryMode:{action:"changed",kind:"memory mode"},changedShardMode:{action:"changed",kind:"shard mode"},changedTtlPolicy:{action:"changed",kind:"TTL policy"},fieldOptionalToRequired:{action:"changed",kind:"field → required"},fieldRequiredToOptional:{action:"changed",kind:"field → optional"},relaxedFieldConstraint:{action:"removed",kind:"constraint"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"},widenedFieldShape:{action:"changed",kind:"field → wider"}},Ee=(t,e)=>{const n=`${ee[t.type].action} ${e} `;return t.summary.startsWith(n)?t.summary.slice(n.length):t.summary},Ae=t=>{const e=new Map;for(const i of t){const o=i.table??"",r=e.get(o);r===void 0?e.set(o,[i]):r.push(i)}const n=[...e].map(([i,o])=>({changes:o,table:i}));return[...n.filter(i=>i.table!==""),...n.filter(i=>i.table==="")]},De=t=>{const e=R(2),{children:n}=t;let i;return e[0]!==n?(i=l("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:n}),e[0]=n,e[1]=i):i=e[1],i},Le=({pane:t,shardKey:e=""})=>{const n=P(),i=oe(),r=se({strict:!1}).version,s=c=>{ce(i({search:{version:c},to:"/migrations"}))},a=D(L.schemaHistory,{},{shardKey:e}),d=a.data?.versions??[],m=r!==void 0&&d.some(c=>c.hash===r)?r:d[0]?.hash,f=d.findIndex(c=>c.hash===m),u=f===-1?void 0:d[f+1]?.hash,g=D(L.schemaVersion,{hash:m??""},{enabled:m!==void 0,shardKey:e}),p=D(L.schemaVersion,{hash:u??""},{enabled:u!==void 0,shardKey:e}),h=A(()=>{const c=N(g.data?.version?.snapshotJson);if(c!==void 0)return Me(N(p.data?.version?.snapshotJson),c)},[g.data,p.data]),b=A(()=>(h?.tables??[]).map(c=>({columns:c.columns,name:c.name,tier:Ce(c.shardMode)})),[h]),v=A(()=>{const c={};for(const T of h?.tables??[])c[T.name]=qe[T.status];return c},[h]);if(a.error!==null)return l(re,{error:a.errorSource,testId:"sh-error"});if(d.length===0)return l(ae,{description:n("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:n("No schema versions recorded yet.")});const k=h?.changes??[];return y("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[y("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[l(De,{children:n("Schema versions")}),l("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:d.map(c=>l(Ie,{appliedAt:c.appliedAt,hash:c.hash,onSelect:s,selected:c.hash===m,seq:c.seq},c.hash))})]}),y("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[l(Re,{breaking:h?.breakingCount??0,count:u===void 0?b.length:k.length,first:u===void 0}),t==="diagram"?l("div",{className:"flex min-h-0 flex-1 flex-col",children:l(le,{fill:!0,nodeClasses:v,tables:b,testIdPrefix:"sh"})}):l("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:Ae(k).map(c=>{const T=(h?.tables??[]).find($=>$.name===c.table);return y("section",{className:"mb-6",children:[y("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[l("span",{className:"font-mono text-[13px] text-foreground",children:c.table===""?n("schema"):c.table}),T!==void 0&&l("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:n("{count} columns",{count:T.columns.length})}),c.changes.length>1&&l("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:c.changes.length})]}),l("ul",{children:c.changes.map($=>{const{action:te,kind:_}=ee[$.type],E=$.severity==="breaking",H=Ee($,_);return y("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[l("span",{"aria-hidden":"true",className:F("-ms-3 h-3 w-0.5 shrink-0 self-center",E?"bg-destructive":"bg-transparent")}),y("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[n(te)," ",_]}),H!==c.table&&l("span",{className:F("min-w-0 font-mono text-[13px]",E?"text-destructive":"text-foreground"),children:H}),E&&l("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:n("breaking")})]},`${$.type}-${$.summary}`)})})]},c.table)})})]})]})},Je=t=>F("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),Xe=t=>{const e=R(11),{initialShardKey:n}=t,i=P(),[o,r]=ne("diagram");let s;e[0]!==o?(s=(u,g,p,h)=>y("button",{"aria-selected":o===u,className:Je(o===u),"data-testid":p,onClick:()=>{r(u)},role:"tab",type:"button",children:[g,h!==void 0&&l("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:h})]}),e[0]=o,e[1]=s):s=e[1];const a=s;let d;e[2]!==i||e[3]!==a?(d=y("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[a("diagram",i("Diagram"),"mg-pane-diagram"),a("changes",i("Changes"),"mg-pane-changes"),a("data",i("Data migrations"),"mg-pane-data")]}),e[2]=i,e[3]=a,e[4]=d):d=e[4];let m;e[5]!==n||e[6]!==o?(m=l("div",{className:"flex min-h-0 flex-1 flex-col",children:o==="data"?l("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:l(ie,{initialShardKey:n})}):l(Le,{pane:o,shardKey:n})}),e[5]=n,e[6]=o,e[7]=m):m=e[7];let f;return e[8]!==d||e[9]!==m?(f=y("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[d,m]}),e[8]=d,e[9]=m,e[10]=f):f=e[10],f};export{Xe as default};
@@ -0,0 +1 @@
1
+ import{c as G}from"react/compiler-runtime";import{useLunora as ae}from"@lunora/react";import{useState as P}from"react";import{B as L}from"../packem_shared/button-q0UYSmrn.mjs";import{a as _t,C as Tt}from"../packem_shared/card-By2O8ULa.mjs";import{E as Xe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{c as ce,a as $t,b as ht,e as fe,d as Mt,T as Rt}from"../packem_shared/table-D0SBiDu-.mjs";import{b as Ve}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{u as Bt}from"../packem_shared/use-auth-config-DQ8tNyBh.mjs";import{useAutoRefresh as We,settlePolls as Qt}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs";import{useT as q}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{l as A,f as kt,b as Jt,h as Ut}from"../packem_shared/internal-BXEjuLPN.mjs";import{u as Gt,A as Et}from"../packem_shared/auth-pager-DiDnXsfe.mjs";import{I as X}from"../packem_shared/input-CXhxesPC.mjs";import{L as Ht}from"../packem_shared/label-DKFzyHq6.mjs";import{M as Zt}from"../packem_shared/modal-shell-CDztwLnv.mjs";import{T as Ft}from"../packem_shared/textarea--40GKAyz.mjs";import{u as me}from"../packem_shared/use-async-submit-2eBBD0-m.mjs";import{jsx as s,jsxs as E,Fragment as bt}from"react/jsx-runtime";const Pt=t=>{const e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},qt=t=>{const e=Pt(t),l={};for(const[d,u]of Object.entries(e)){if(!Array.isArray(u)||u.some(n=>typeof n!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=u}return l},jt=t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),W=t=>{const e=G(6),{children:l,htmlFor:d,label:u}=t;let n;e[0]!==d||e[1]!==u?(n=s(Ht,{htmlFor:d,children:u}),e[0]=d,e[1]=u,e[2]=n):n=e[2];let o;return e[3]!==l||e[4]!==n?(o=E("div",{className:"flex flex-col gap-1",children:[n,l]}),e[3]=l,e[4]=n,e[5]=o):o=e[5],o},de=({busy:t,canSubmit:e,children:l,destructive:d=!1,error:u,onClose:n,onSubmit:o,submitLabel:i,testId:r,title:m})=>{const a=q();return E(Zt,{label:m,onClose:n,panelTestId:`${r}-panel`,testId:`${r}-overlay`,variant:"dialog",children:[s("h2",{className:"text-sm font-semibold text-foreground",children:m}),l,u!==null&&s("p",{className:"text-sm text-destructive","data-testid":`${r}-error`,role:"alert",children:u}),E("div",{className:"flex justify-end gap-2 pt-1",children:[s(L,{"data-testid":`${r}-cancel`,onClick:n,size:"sm",type:"button",variant:"outline",children:a("Cancel")}),s(L,{"data-testid":`${r}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?a("Saving…"):i})]})]})},Dt=t=>{const e=G(79),{mode:l,onClose:d,onDone:u,org:n}=t,o=ae(),i=q(),{busy:r,error:m,run:a}=me();let h;e[0]!==n?(h=n?A(n.name):"",e[0]=n,e[1]=h):h=e[1];const[c,g]=P(h);let p;e[2]!==n?(p=n?A(n.slug):"",e[2]=n,e[3]=p):p=e[3];const[f,b]=P(p);let S;e[4]!==n?(S=n?A(n.logo):"",e[4]=n,e[5]=S):S=e[5];const[v,y]=P(S),[x,I]=P("");let C;e[6]!==l||e[7]!==n?.metadata?(C=l==="edit"?jt(n?.metadata):"",e[6]=l,e[7]=n?.metadata,e[8]=C):C=e[8];const[w,k]=P(C);let O;e[9]!==o||e[10]!==v||e[11]!==w||e[12]!==l||e[13]!==c||e[14]!==d||e[15]!==u||e[16]!==n?.id||e[17]!==x||e[18]!==a||e[19]!==f?(O=()=>{a(async()=>{const D=w.trim()===""?void 0:Pt(w);l==="create"?await o.createAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:D,name:c.trim(),ownerId:x.trim()===""?void 0:x.trim(),slug:f.trim()===""?void 0:f.trim()}):await o.updateAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:D,name:c.trim()===""?void 0:c.trim(),organizationId:A(n?.id),slug:f.trim()===""?void 0:f.trim()}),u(),d()})},e[9]=o,e[10]=v,e[11]=w,e[12]=l,e[13]=c,e[14]=d,e[15]=u,e[16]=n?.id,e[17]=x,e[18]=a,e[19]=f,e[20]=O):O=e[20];const z=O;let N;e[21]!==l||e[22]!==c?(N=c.trim()!==""||l==="edit",e[21]=l,e[22]=c,e[23]=N):N=e[23];let _;e[24]!==l||e[25]!==i?(_=i(l==="create"?"Create":"Save"),e[24]=l,e[25]=i,e[26]=_):_=e[26];let T;e[27]!==l||e[28]!==i?(T=i(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=i,e[29]=T):T=e[29];let R;e[30]!==i?(R=i("name"),e[30]=i,e[31]=R):R=e[31];let H;e[32]===Symbol.for("react.memo_cache_sentinel")?(H=D=>{g(D.target.value)},e[32]=H):H=e[32];let B;e[33]!==c?(B=s(X,{"data-testid":"org-form-name",id:"org-form-name",onChange:H,value:c}),e[33]=c,e[34]=B):B=e[34];let U;e[35]!==B||e[36]!==R?(U=s(W,{htmlFor:"org-form-name",label:R,children:B}),e[35]=B,e[36]=R,e[37]=U):U=e[37];let Q;e[38]!==i?(Q=i("Slug (optional — derived from name)"),e[38]=i,e[39]=Q):Q=e[39];let F;e[40]===Symbol.for("react.memo_cache_sentinel")?(F=D=>{b(D.target.value)},e[40]=F):F=e[40];let J;e[41]!==f?(J=s(X,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:F,value:f}),e[41]=f,e[42]=J):J=e[42];let j;e[43]!==Q||e[44]!==J?(j=s(W,{htmlFor:"org-form-slug",label:Q,children:J}),e[43]=Q,e[44]=J,e[45]=j):j=e[45];let Z;e[46]!==i?(Z=i("Logo URL (optional)"),e[46]=i,e[47]=Z):Z=e[47];let M;e[48]===Symbol.for("react.memo_cache_sentinel")?(M=D=>{y(D.target.value)},e[48]=M):M=e[48];let $;e[49]!==v?($=s(X,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:M,value:v}),e[49]=v,e[50]=$):$=e[50];let K;e[51]!==Z||e[52]!==$?(K=s(W,{htmlFor:"org-form-logo",label:Z,children:$}),e[51]=Z,e[52]=$,e[53]=K):K=e[53];let Y;e[54]!==l||e[55]!==x||e[56]!==i?(Y=l==="create"&&s(W,{htmlFor:"org-form-owner",label:i("Owner user id (optional)"),children:s(X,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:D=>{I(D.target.value)},value:x})}),e[54]=l,e[55]=x,e[56]=i,e[57]=Y):Y=e[57];let te;e[58]!==i?(te=i("Metadata (JSON, optional)"),e[58]=i,e[59]=te):te=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=D=>{k(D.target.value)},e[60]=oe):oe=e[60];let le;e[61]!==w?(le=s(Ft,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:w}),e[61]=w,e[62]=le):le=e[62];let ee;e[63]!==te||e[64]!==le?(ee=s(W,{htmlFor:"org-form-metadata",label:te,children:le}),e[63]=te,e[64]=le,e[65]=ee):ee=e[65];let ie;return e[66]!==r||e[67]!==m||e[68]!==d||e[69]!==z||e[70]!==U||e[71]!==j||e[72]!==K||e[73]!==Y||e[74]!==ee||e[75]!==N||e[76]!==_||e[77]!==T?(ie=E(de,{busy:r,canSubmit:N,error:m,onClose:d,onSubmit:z,submitLabel:_,testId:"org-form",title:T,children:[U,j,K,Y,ee]}),e[66]=r,e[67]=m,e[68]=d,e[69]=z,e[70]=U,e[71]=j,e[72]=K,e[73]=Y,e[74]=ee,e[75]=N,e[76]=_,e[77]=T,e[78]=ie):ie=e[78],ie},Kt=t=>{const e=G(40),{onClose:l,onDone:d,organizationId:u}=t,n=ae(),o=q(),{busy:i,error:r,run:m}=me(),[a,h]=P(""),[c,g]=P("");let p;e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==u||e[4]!==c||e[5]!==m||e[6]!==a?(p=()=>{m(async()=>{await n.addAuthOrgMember({organizationId:u,role:c.trim()===""?void 0:c.trim(),userId:a.trim()}),d(),l()})},e[0]=n,e[1]=l,e[2]=d,e[3]=u,e[4]=c,e[5]=m,e[6]=a,e[7]=p):p=e[7];const f=p;let b;e[8]!==a?(b=a.trim(),e[8]=a,e[9]=b):b=e[9];const S=b!=="";let v;e[10]!==o?(v=o("Add member"),e[10]=o,e[11]=v):v=e[11];let y;e[12]!==o?(y=o("Add member"),e[12]=o,e[13]=y):y=e[13];let x;e[14]!==o?(x=o("User id"),e[14]=o,e[15]=x):x=e[15];let I;e[16]===Symbol.for("react.memo_cache_sentinel")?(I=T=>{h(T.target.value)},e[16]=I):I=e[16];let C;e[17]!==a?(C=s(X,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:I,value:a}),e[17]=a,e[18]=C):C=e[18];let w;e[19]!==x||e[20]!==C?(w=s(W,{htmlFor:"org-add-member-user",label:x,children:C}),e[19]=x,e[20]=C,e[21]=w):w=e[21];let k;e[22]!==o?(k=o("Role (optional)"),e[22]=o,e[23]=k):k=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=T=>{g(T.target.value)},e[24]=O):O=e[24];let z;e[25]!==c?(z=s(X,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:O,value:c}),e[25]=c,e[26]=z):z=e[26];let N;e[27]!==k||e[28]!==z?(N=s(W,{htmlFor:"org-add-member-role",label:k,children:z}),e[27]=k,e[28]=z,e[29]=N):N=e[29];let _;return e[30]!==i||e[31]!==r||e[32]!==l||e[33]!==f||e[34]!==N||e[35]!==S||e[36]!==v||e[37]!==y||e[38]!==w?(_=E(de,{busy:i,canSubmit:S,error:r,onClose:l,onSubmit:f,submitLabel:v,testId:"org-add-member",title:y,children:[w,N]}),e[30]=i,e[31]=r,e[32]=l,e[33]=f,e[34]=N,e[35]=S,e[36]=v,e[37]=y,e[38]=w,e[39]=_):_=e[39],_},Vt=t=>{const e=G(40),{onClose:l,onDone:d,organizationId:u}=t,n=ae(),o=q(),{busy:i,error:r,run:m}=me(),[a,h]=P(""),[c,g]=P("");let p;e[0]!==n||e[1]!==a||e[2]!==l||e[3]!==d||e[4]!==u||e[5]!==c||e[6]!==m?(p=()=>{m(async()=>{await n.inviteAuthOrgMember({email:a.trim(),organizationId:u,role:c.trim()===""?void 0:c.trim()}),d(),l()})},e[0]=n,e[1]=a,e[2]=l,e[3]=d,e[4]=u,e[5]=c,e[6]=m,e[7]=p):p=e[7];const f=p;let b;e[8]!==a?(b=a.trim(),e[8]=a,e[9]=b):b=e[9];const S=b!=="";let v;e[10]!==o?(v=o("Send invitation"),e[10]=o,e[11]=v):v=e[11];let y;e[12]!==o?(y=o("Invite member"),e[12]=o,e[13]=y):y=e[13];let x;e[14]!==o?(x=o("email"),e[14]=o,e[15]=x):x=e[15];let I;e[16]===Symbol.for("react.memo_cache_sentinel")?(I=T=>{h(T.target.value)},e[16]=I):I=e[16];let C;e[17]!==a?(C=s(X,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:I,type:"email",value:a}),e[17]=a,e[18]=C):C=e[18];let w;e[19]!==x||e[20]!==C?(w=s(W,{htmlFor:"org-invite-member-email",label:x,children:C}),e[19]=x,e[20]=C,e[21]=w):w=e[21];let k;e[22]!==o?(k=o("Role (optional)"),e[22]=o,e[23]=k):k=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=T=>{g(T.target.value)},e[24]=O):O=e[24];let z;e[25]!==c?(z=s(X,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:O,value:c}),e[25]=c,e[26]=z):z=e[26];let N;e[27]!==k||e[28]!==z?(N=s(W,{htmlFor:"org-invite-member-role",label:k,children:z}),e[27]=k,e[28]=z,e[29]=N):N=e[29];let _;return e[30]!==i||e[31]!==r||e[32]!==l||e[33]!==f||e[34]!==N||e[35]!==S||e[36]!==v||e[37]!==y||e[38]!==w?(_=E(de,{busy:i,canSubmit:S,error:r,onClose:l,onSubmit:f,submitLabel:v,testId:"org-invite-member",title:y,children:[w,N]}),e[30]=i,e[31]=r,e[32]=l,e[33]=f,e[34]=N,e[35]=S,e[36]=v,e[37]=y,e[38]=w,e[39]=_):_=e[39],_},Wt=t=>{const e=G(32),{member:l,onClose:d,onDone:u}=t,n=ae(),o=q(),{busy:i,error:r,run:m}=me();let a;e[0]!==l.role?(a=()=>A(l.role),e[0]=l.role,e[1]=a):a=e[1];const[h,c]=P(a);let g;e[2]!==n||e[3]!==l.id||e[4]!==d||e[5]!==u||e[6]!==h||e[7]!==m?(g=()=>{m(async()=>{await n.setAuthOrgMemberRole({memberId:A(l.id),role:h.trim()}),u(),d()})},e[2]=n,e[3]=l.id,e[4]=d,e[5]=u,e[6]=h,e[7]=m,e[8]=g):g=e[8];const p=g;let f;e[9]!==h?(f=h.trim(),e[9]=h,e[10]=f):f=e[10];const b=f!=="";let S;e[11]!==o?(S=o("Save"),e[11]=o,e[12]=S):S=e[12];let v;e[13]!==o?(v=o("Change member role"),e[13]=o,e[14]=v):v=e[14];let y;e[15]!==o?(y=o("Role"),e[15]=o,e[16]=y):y=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=k=>{c(k.target.value)},e[17]=x):x=e[17];let I;e[18]!==h?(I=s(X,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:x,value:h}),e[18]=h,e[19]=I):I=e[19];let C;e[20]!==y||e[21]!==I?(C=s(W,{htmlFor:"org-member-role-value",label:y,children:I}),e[20]=y,e[21]=I,e[22]=C):C=e[22];let w;return e[23]!==i||e[24]!==r||e[25]!==d||e[26]!==p||e[27]!==C||e[28]!==b||e[29]!==S||e[30]!==v?(w=s(de,{busy:i,canSubmit:b,error:r,onClose:d,onSubmit:p,submitLabel:S,testId:"org-member-role",title:v,children:C}),e[23]=i,e[24]=r,e[25]=d,e[26]=p,e[27]=C,e[28]=b,e[29]=S,e[30]=v,e[31]=w):w=e[31],w},zt=t=>{const e=G(36),{mode:l,onClose:d,onDone:u,organizationId:n,team:o}=t,i=ae(),r=q(),{busy:m,error:a,run:h}=me();let c;e[0]!==o?(c=o?A(o.name):"",e[0]=o,e[1]=c):c=e[1];const[g,p]=P(c);let f;e[2]!==i||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==u||e[7]!==n||e[8]!==h||e[9]!==o?.id?(f=()=>{h(async()=>{await(l==="create"?i.createAuthOrgTeam({name:g.trim(),organizationId:n}):i.updateAuthOrgTeam({name:g.trim(),teamId:A(o?.id)})),u(),d()})},e[2]=i,e[3]=l,e[4]=g,e[5]=d,e[6]=u,e[7]=n,e[8]=h,e[9]=o?.id,e[10]=f):f=e[10];const b=f;let S;e[11]!==g?(S=g.trim(),e[11]=g,e[12]=S):S=e[12];const v=S!=="";let y;e[13]!==l||e[14]!==r?(y=r(l==="create"?"Create":"Save"),e[13]=l,e[14]=r,e[15]=y):y=e[15];let x;e[16]!==l||e[17]!==r?(x=r(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=r,e[18]=x):x=e[18];let I;e[19]!==r?(I=r("name"),e[19]=r,e[20]=I):I=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=z=>{p(z.target.value)},e[21]=C):C=e[21];let w;e[22]!==g?(w=s(X,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g}),e[22]=g,e[23]=w):w=e[23];let k;e[24]!==I||e[25]!==w?(k=s(W,{htmlFor:"org-team-form-name",label:I,children:w}),e[24]=I,e[25]=w,e[26]=k):k=e[26];let O;return e[27]!==m||e[28]!==a||e[29]!==d||e[30]!==b||e[31]!==k||e[32]!==v||e[33]!==y||e[34]!==x?(O=s(de,{busy:m,canSubmit:v,error:a,onClose:d,onSubmit:b,submitLabel:y,testId:"org-team-form",title:x,children:k}),e[27]=m,e[28]=a,e[29]=d,e[30]=b,e[31]=k,e[32]=v,e[33]=y,e[34]=x,e[35]=O):O=e[35],O},Xt=t=>{const e=G(30),{onClose:l,onDone:d,teamId:u}=t,n=ae(),o=q(),{busy:i,error:r,run:m}=me(),[a,h]=P("");let c;e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==u||e[5]!==a?(c=()=>{m(async()=>{await n.addAuthOrgTeamMember({teamId:u,userId:a.trim()}),d(),l()})},e[0]=n,e[1]=l,e[2]=d,e[3]=m,e[4]=u,e[5]=a,e[6]=c):c=e[6];const g=c;let p;e[7]!==a?(p=a.trim(),e[7]=a,e[8]=p):p=e[8];const f=p!=="";let b;e[9]!==o?(b=o("Add member"),e[9]=o,e[10]=b):b=e[10];let S;e[11]!==o?(S=o("Add team member"),e[11]=o,e[12]=S):S=e[12];let v;e[13]!==o?(v=o("User id"),e[13]=o,e[14]=v):v=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=w=>{h(w.target.value)},e[15]=y):y=e[15];let x;e[16]!==a?(x=s(X,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:y,value:a}),e[16]=a,e[17]=x):x=e[17];let I;e[18]!==v||e[19]!==x?(I=s(W,{htmlFor:"org-team-add-member-user",label:v,children:x}),e[18]=v,e[19]=x,e[20]=I):I=e[20];let C;return e[21]!==i||e[22]!==r||e[23]!==l||e[24]!==g||e[25]!==f||e[26]!==b||e[27]!==S||e[28]!==I?(C=s(de,{busy:i,canSubmit:f,error:r,onClose:l,onSubmit:g,submitLabel:b,testId:"org-team-add-member",title:S,children:I}),e[21]=i,e[22]=r,e[23]=l,e[24]=g,e[25]=f,e[26]=b,e[27]=S,e[28]=I,e[29]=C):C=e[29],C},At=t=>{const e=G(47),{mode:l,onClose:d,onDone:u,organizationId:n,role:o}=t,i=ae(),r=q(),{busy:m,error:a,run:h}=me();let c;e[0]!==o?(c=o?A(o.role):"",e[0]=o,e[1]=c):c=e[1];const[g,p]=P(c);let f;e[2]!==l||e[3]!==o?.permission?(f=l==="edit"?jt(o?.permission):"",e[2]=l,e[3]=o?.permission,e[4]=f):f=e[4];const[b,S]=P(f);let v;e[5]!==i||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==u||e[10]!==n||e[11]!==b||e[12]!==o?.id||e[13]!==h?(v=()=>{h(async()=>{const T=qt(b);await(l==="create"?i.createAuthOrgRole({organizationId:n,permission:T,role:g.trim()}):i.updateAuthOrgRole({permission:T,roleId:A(o?.id)})),u(),d()})},e[5]=i,e[6]=l,e[7]=g,e[8]=d,e[9]=u,e[10]=n,e[11]=b,e[12]=o?.id,e[13]=h,e[14]=v):v=e[14];const y=v;let x;e[15]!==l||e[16]!==g||e[17]!==b?(x=b.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=b,e[18]=x):x=e[18];let I;e[19]!==l||e[20]!==r?(I=r(l==="create"?"Create":"Save"),e[19]=l,e[20]=r,e[21]=I):I=e[21];let C;e[22]!==l||e[23]!==r?(C=r(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=r,e[24]=C):C=e[24];let w;e[25]!==l||e[26]!==g||e[27]!==r?(w=l==="create"&&s(W,{htmlFor:"org-role-form-name",label:r("Role name"),children:s(X,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:T=>{p(T.target.value)},value:g})}),e[25]=l,e[26]=g,e[27]=r,e[28]=w):w=e[28];let k;e[29]!==r?(k=r('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=r,e[30]=k):k=e[30];let O;e[31]===Symbol.for("react.memo_cache_sentinel")?(O=T=>{S(T.target.value)},e[31]=O):O=e[31];let z;e[32]!==b?(z=s(Ft,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:O,value:b}),e[32]=b,e[33]=z):z=e[33];let N;e[34]!==z||e[35]!==k?(N=s(W,{htmlFor:"org-role-form-permission",label:k,children:z}),e[34]=z,e[35]=k,e[36]=N):N=e[36];let _;return e[37]!==m||e[38]!==a||e[39]!==d||e[40]!==y||e[41]!==N||e[42]!==x||e[43]!==I||e[44]!==C||e[45]!==w?(_=E(de,{busy:m,canSubmit:x,error:a,onClose:d,onSubmit:y,submitLabel:I,testId:"org-role-form",title:C,children:[w,N]}),e[37]=m,e[38]=a,e[39]=d,e[40]=y,e[41]=N,e[42]=x,e[43]=I,e[44]=C,e[45]=w,e[46]=_):_=e[46],_},Lt=t=>{const e=G(18),{action:l,message:d,onClose:u,onDone:n,testId:o,title:i}=t,r=q(),{busy:m,error:a,run:h}=me();let c;e[0]!==l||e[1]!==u||e[2]!==n||e[3]!==h?(c=()=>{h(async()=>{await l(),n(),u()})},e[0]=l,e[1]=u,e[2]=n,e[3]=h,e[4]=c):c=e[4];const g=c;let p;e[5]!==r?(p=r("Delete"),e[5]=r,e[6]=p):p=e[6];let f;e[7]!==d?(f=s("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=f):f=e[8];let b;return e[9]!==m||e[10]!==a||e[11]!==u||e[12]!==g||e[13]!==p||e[14]!==f||e[15]!==o||e[16]!==i?(b=s(de,{busy:m,canSubmit:!0,destructive:!0,error:a,onClose:u,onSubmit:g,submitLabel:p,testId:o,title:i,children:f}),e[9]=m,e[10]=a,e[11]=u,e[12]=g,e[13]=p,e[14]=f,e[15]=o,e[16]=i,e[17]=b):b=e[17],b},Ye=t=>{const e=G(13),{action:l,children:d,heading:u,testId:n}=t;let o;e[0]!==u?(o=s("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:u}),e[0]=u,e[1]=o):o=e[1];let i;e[2]!==l?(i=l!==void 0&&s("div",{className:"flex items-center gap-2",children:l}),e[2]=l,e[3]=i):i=e[3];let r;e[4]!==o||e[5]!==i?(r=E("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,i]}),e[4]=o,e[5]=i,e[6]=r):r=e[6];let m;e[7]!==d?(m=s(_t,{className:"px-0",children:d}),e[7]=d,e[8]=m):m=e[8];let a;return e[9]!==r||e[10]!==m||e[11]!==n?(a=E(Tt,{className:"overflow-hidden py-0","data-testid":n,children:[r,m]}),e[9]=r,e[10]=m,e[11]=n,e[12]=a):a=e[12],a},et=t=>{const e=G(23),{columns:l,rowActions:d,rowPrefix:u,rows:n}=t,o=q();let i;e[0]!==l?(i=l.map(Yt),e[0]=l,e[1]=i):i=e[1];let r;e[2]!==o?(r=o("Actions"),e[2]=o,e[3]=r):r=e[3];let m;e[4]!==r?(m=s(ce,{"aria-label":r}),e[4]=r,e[5]=m):m=e[5];let a;e[6]!==i||e[7]!==m?(a=s($t,{children:E(ht,{children:[i,m]})}),e[6]=i,e[7]=m,e[8]=a):a=e[8];let h;if(e[9]!==l||e[10]!==d||e[11]!==u||e[12]!==n){let p;e[14]!==l||e[15]!==d||e[16]!==u?(p=(f,b)=>{const S=A(f.id),v=S===""?`index-${b.toString()}`:S;return E(ht,{"data-testid":`${u}-${v}`,children:[l.map(y=>s(fe,{className:y.className,children:y.render(f)},y.head)),s(fe,{children:s("div",{className:"flex justify-end gap-1",children:d(f)})})]},v)},e[14]=l,e[15]=d,e[16]=u,e[17]=p):p=e[17],h=n.map(p),e[9]=l,e[10]=d,e[11]=u,e[12]=n,e[13]=h}else h=e[13];let c;e[18]!==h?(c=s(Mt,{children:h}),e[18]=h,e[19]=c):c=e[19];let g;return e[20]!==a||e[21]!==c?(g=E(Rt,{children:[a,c]}),e[20]=a,e[21]=c,e[22]=g):g=e[22],g};function Yt(t){return s(ce,{children:t.head},t.head)}const el=t=>{const e=G(30),{actionBusy:l,onRemoveMember:d,memberColumns:u,members:n,onDialog:o}=t,i=q();let r;e[0]!==o?(r=()=>{o({kind:"add-member"})},e[0]=o,e[1]=r):r=e[1];let m;e[2]!==i?(m=i("Add member"),e[2]=i,e[3]=m):m=e[3];let a;e[4]!==r||e[5]!==m?(a=s(L,{"data-testid":"org-open-add-member",onClick:r,size:"xs",type:"button",variant:"outline",children:m}),e[4]=r,e[5]=m,e[6]=a):a=e[6];let h;e[7]!==o?(h=()=>{o({kind:"invite-member"})},e[7]=o,e[8]=h):h=e[8];let c;e[9]!==i?(c=i("Invite member"),e[9]=i,e[10]=c):c=e[10];let g;e[11]!==h||e[12]!==c?(g=s(L,{"data-testid":"org-open-invite-member",onClick:h,size:"xs",type:"button",variant:"outline",children:c}),e[11]=h,e[12]=c,e[13]=g):g=e[13];let p;e[14]!==a||e[15]!==g?(p=E(bt,{children:[a,g]}),e[14]=a,e[15]=g,e[16]=p):p=e[16];let f;e[17]!==i?(f=i("Members"),e[17]=i,e[18]=f):f=e[18];let b;e[19]!==l||e[20]!==u||e[21]!==n||e[22]!==o||e[23]!==d||e[24]!==i?(b=n.length===0?s("div",{className:"p-3",children:s(Xe,{testId:"org-members-empty",title:i("No members.")})}):s(et,{columns:u,rowActions:v=>E(bt,{children:[s(L,{"data-testid":`org-member-role-${A(v.id)}`,onClick:()=>{o({kind:"member-role",member:v})},size:"xs",type:"button",variant:"ghost",children:i("Change role")}),s(L,{"data-testid":`org-remove-member-${A(v.id)}`,disabled:l,onClick:()=>{d(A(v.id))},size:"xs",type:"button",variant:"ghost",children:i("Remove")})]}),rowPrefix:"org-member",rows:n}),e[19]=l,e[20]=u,e[21]=n,e[22]=o,e[23]=d,e[24]=i,e[25]=b):b=e[25];let S;return e[26]!==p||e[27]!==f||e[28]!==b?(S=s(Ye,{action:p,heading:f,testId:"org-members",children:b}),e[26]=p,e[27]=f,e[28]=b,e[29]=S):S=e[29],S},tl=t=>{const e=G(21),{onConfirmDeleteTeam:l,onDialog:d,onSelectTeam:u,selectedTeam:n,teamColumns:o,teams:i}=t,r=q();let m;e[0]!==d?(m=()=>{d({kind:"team-create"})},e[0]=d,e[1]=m):m=e[1];let a;e[2]!==r?(a=r("New team"),e[2]=r,e[3]=a):a=e[3];let h;e[4]!==m||e[5]!==a?(h=s(L,{"data-testid":"org-open-create-team",onClick:m,size:"xs",type:"button",variant:"outline",children:a}),e[4]=m,e[5]=a,e[6]=h):h=e[6];let c;e[7]!==r?(c=r("Teams"),e[7]=r,e[8]=c):c=e[8];let g;e[9]!==l||e[10]!==d||e[11]!==u||e[12]!==n||e[13]!==r||e[14]!==o||e[15]!==i?(g=i.length===0?s("div",{className:"p-3",children:s(Xe,{testId:"org-teams-empty",title:r("No teams.")})}):s(et,{columns:o,rowActions:f=>E(bt,{children:[s(L,{"aria-pressed":n===A(f.id),"data-testid":`org-team-select-${A(f.id)}`,onClick:()=>{u(A(f.id))},size:"xs",type:"button",variant:"ghost",children:r("Members")}),s(L,{"data-testid":`org-team-rename-${A(f.id)}`,onClick:()=>{d({kind:"team-rename",team:f})},size:"xs",type:"button",variant:"ghost",children:r("Rename")}),s(L,{"data-testid":`org-team-delete-${A(f.id)}`,onClick:()=>{l(f)},size:"xs",type:"button",variant:"ghost",children:r("Delete")})]}),rowPrefix:"org-team",rows:i}),e[9]=l,e[10]=d,e[11]=u,e[12]=n,e[13]=r,e[14]=o,e[15]=i,e[16]=g):g=e[16];let p;return e[17]!==h||e[18]!==c||e[19]!==g?(p=s(Ye,{action:h,heading:c,testId:"org-teams",children:g}),e[17]=h,e[18]=c,e[19]=g,e[20]=p):p=e[20],p},ll=t=>{const e=G(20),{actionBusy:l,onRemoveTeamMember:d,onDialog:u,selectedTeam:n,teamMemberColumns:o,teamMembers:i}=t,r=q();let m;e[0]!==u||e[1]!==n?(m=()=>{u({kind:"team-add-member",teamId:n})},e[0]=u,e[1]=n,e[2]=m):m=e[2];let a;e[3]!==r?(a=r("Add member"),e[3]=r,e[4]=a):a=e[4];let h;e[5]!==m||e[6]!==a?(h=s(L,{"data-testid":"org-open-add-team-member",onClick:m,size:"xs",type:"button",variant:"outline",children:a}),e[5]=m,e[6]=a,e[7]=h):h=e[7];let c;e[8]!==r?(c=r("Team members"),e[8]=r,e[9]=c):c=e[9];let g;e[10]!==l||e[11]!==d||e[12]!==r||e[13]!==o||e[14]!==i?(g=i.length===0?s("div",{className:"p-3",children:s(Xe,{testId:"org-team-members-empty",title:r("No team members.")})}):s(et,{columns:o,rowActions:f=>s(L,{"data-testid":`org-team-remove-member-${A(f.id)}`,disabled:l,onClick:()=>{d(A(f.id))},size:"xs",type:"button",variant:"ghost",children:r("Remove")}),rowPrefix:"org-team-member",rows:i}),e[10]=l,e[11]=d,e[12]=r,e[13]=o,e[14]=i,e[15]=g):g=e[15];let p;return e[16]!==h||e[17]!==c||e[18]!==g?(p=s(Ye,{action:h,heading:c,testId:"org-team-members",children:g}),e[16]=h,e[17]=c,e[18]=g,e[19]=p):p=e[19],p},ol=t=>{const e=G(19),{onConfirmDeleteRole:l,onDialog:d,roleColumns:u,roles:n}=t,o=q();let i;e[0]!==d?(i=()=>{d({kind:"role-create"})},e[0]=d,e[1]=i):i=e[1];let r;e[2]!==o?(r=o("New role"),e[2]=o,e[3]=r):r=e[3];let m;e[4]!==i||e[5]!==r?(m=s(L,{"data-testid":"org-open-create-role",onClick:i,size:"xs",type:"button",variant:"outline",children:r}),e[4]=i,e[5]=r,e[6]=m):m=e[6];let a;e[7]!==o?(a=o("Roles"),e[7]=o,e[8]=a):a=e[8];let h;e[9]!==l||e[10]!==d||e[11]!==u||e[12]!==n||e[13]!==o?(h=n.length===0?s("div",{className:"p-3",children:s(Xe,{testId:"org-roles-empty",title:o("No custom roles.")})}):s(et,{columns:u,rowActions:g=>E(bt,{children:[s(L,{"data-testid":`org-role-edit-${A(g.id)}`,onClick:()=>{d({kind:"role-edit",role:g})},size:"xs",type:"button",variant:"ghost",children:o("Edit")}),s(L,{"data-testid":`org-role-delete-${A(g.id)}`,onClick:()=>{l(A(g.id))},size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),rowPrefix:"org-role",rows:n}),e[9]=l,e[10]=d,e[11]=u,e[12]=n,e[13]=o,e[14]=h):h=e[14];let c;return e[15]!==m||e[16]!==a||e[17]!==h?(c=s(Ye,{action:m,heading:a,testId:"org-roles",children:h}),e[15]=m,e[16]=a,e[17]=h,e[18]=c):c=e[18],c},Nt=200,il=t=>{const e=G(217),{organizationId:l,rolesEnabled:d,teamsEnabled:u}=t,n=ae(),o=q(),[i,r]=P(null),[m,a]=P(null),[h,c]=P(!1),[g,p]=P(null),[f,b]=Gt(l);let S;e[0]!==f||e[1]!==l?(S=["lunora-auth-org-members",l,f],e[0]=f,e[1]=l,e[2]=S):S=e[2];let v;e[3]!==n||e[4]!==f||e[5]!==l?(v=()=>n.listAuthOrgMembers({limit:Nt,offset:f,organizationId:l}),e[3]=n,e[4]=f,e[5]=l,e[6]=v):v=e[6];const y=Ve(S,v);let x;e[7]!==l?(x=["lunora-auth-org-invitations",l],e[7]=l,e[8]=x):x=e[8];let I;e[9]!==n||e[10]!==l?(I=()=>n.listAuthOrgInvitations({limit:200,organizationId:l}),e[9]=n,e[10]=l,e[11]=I):I=e[11];const C=Ve(x,I);let w;e[12]!==l?(w=["lunora-auth-org-teams",l],e[12]=l,e[13]=w):w=e[13];let k;e[14]!==n||e[15]!==l?(k=()=>n.listAuthOrgTeams({limit:200,organizationId:l}),e[14]=n,e[15]=l,e[16]=k):k=e[16];let O;e[17]!==u?(O={enabled:u},e[17]=u,e[18]=O):O=e[18];const z=Ve(w,k,O);let N;e[19]!==l?(N=["lunora-auth-org-roles",l],e[19]=l,e[20]=N):N=e[20];let _;e[21]!==n||e[22]!==l?(_=()=>n.listAuthOrgRoles({limit:200,organizationId:l}),e[21]=n,e[22]=l,e[23]=_):_=e[23];let T;e[24]!==d?(T={enabled:d},e[24]=d,e[25]=T):T=e[25];const R=Ve(N,_,T);let H;e[26]!==m?(H=["lunora-auth-org-team-members",m],e[26]=m,e[27]=H):H=e[27];let B;e[28]!==n||e[29]!==m?(B=()=>n.listAuthOrgTeamMembers({limit:200,teamId:m??""}),e[28]=n,e[29]=m,e[30]=B):B=e[30];const U=m!==null;let Q;e[31]!==U?(Q={enabled:U},e[31]=U,e[32]=Q):Q=e[32];const F=Ve(H,B,Q);let J;e[33]!==y.data?.rows?(J=y.data?.rows??[],e[33]=y.data?.rows,e[34]=J):J=e[34];const j=J;let Z;e[35]!==C.data?.rows?(Z=C.data?.rows??[],e[35]=C.data?.rows,e[36]=Z):Z=e[36];const M=Z;let $;e[37]!==z.data?.rows?($=z.data?.rows??[],e[37]=z.data?.rows,e[38]=$):$=e[38];const K=$;let Y;e[39]!==R.data?.rows?(Y=R.data?.rows??[],e[39]=R.data?.rows,e[40]=Y):Y=e[40];const te=Y;let oe;e[41]!==m||e[42]!==F.data?.rows?(oe=m===null?[]:F.data?.rows??[],e[41]=m,e[42]=F.data?.rows,e[43]=oe):oe=e[43];const le=oe,ee=y.error??C.error??z.error??R.error??F.error;let ie;if(e[44]!==C||e[45]!==y||e[46]!==d||e[47]!==R||e[48]!==m||e[49]!==F||e[50]!==u||e[51]!==z){const V=()=>{const ne=[y.poll(),C.poll()];return u&&ne.push(z.poll()),d&&ne.push(R.poll()),m!==null&&ne.push(F.poll()),Qt(ne)};ie=()=>{kt(V())},e[44]=C,e[45]=y,e[46]=d,e[47]=R,e[48]=m,e[49]=F,e[50]=u,e[51]=z,e[52]=ie}else ie=e[52];const D=ie;let tt;e[53]!==y?(tt=()=>y.poll(),e[53]=y,e[54]=tt):tt=e[54],We(tt,!0);let lt;e[55]!==C?(lt=()=>C.poll(),e[55]=C,e[56]=lt):lt=e[56],We(lt,!0);let ot;e[57]!==z?(ot=()=>z.poll(),e[57]=z,e[58]=ot):ot=e[58],We(ot,u);let it;e[59]!==R?(it=()=>R.poll(),e[59]=R,e[60]=it):it=e[60],We(it,d);let rt;e[61]!==F?(rt=()=>F.poll(),e[61]=F,e[62]=rt):rt=e[62],We(rt,m!==null);let st;e[63]===Symbol.for("react.memo_cache_sentinel")?(st=()=>{r(null)},e[63]=st):st=e[63];const re=st;let nt;e[64]!==D?(nt=V=>{kt((async()=>{c(!0),p(null);try{await V(),D(),c(!1)}catch(ne){p(Jt(ne)),c(!1)}})())},e[64]=D,e[65]=nt):nt=e[65];const se=nt;let at;e[66]!==n||e[67]!==o?(at=V=>{const ne=A(V.id);r({action:async()=>{await n.removeAuthOrgTeam({teamId:ne}),a(wt=>wt===ne?null:wt)},kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},e[66]=n,e[67]=o,e[68]=at):at=e[68];const pt=at;let ue;e[69]!==o?(ue=o("userId"),e[69]=o,e[70]=ue):ue=e[70];let ge;e[71]!==ue?(ge={head:ue,render:rl},e[71]=ue,e[72]=ge):ge=e[72];let he;e[73]!==o?(he=o("role"),e[73]=o,e[74]=he):he=e[74];let be;e[75]!==he?(be={head:he,render:sl},e[75]=he,e[76]=be):be=e[76];let mt;e[77]!==ge||e[78]!==be?(mt=[ge,be],e[77]=ge,e[78]=be,e[79]=mt):mt=e[79];const vt=mt;let pe;e[80]!==o?(pe=o("email"),e[80]=o,e[81]=pe):pe=e[81];let ve;e[82]!==pe?(ve={head:pe,render:nl},e[82]=pe,e[83]=ve):ve=e[83];let ye;e[84]!==o?(ye=o("role"),e[84]=o,e[85]=ye):ye=e[85];let Ce;e[86]!==ye?(Ce={head:ye,render:al},e[86]=ye,e[87]=Ce):Ce=e[87];let xe;e[88]!==o?(xe=o("status"),e[88]=o,e[89]=xe):xe=e[89];let Ie;e[90]!==xe?(Ie={head:xe,render:ml},e[90]=xe,e[91]=Ie):Ie=e[91];let dt;e[92]!==ve||e[93]!==Ce||e[94]!==Ie?(dt=[ve,Ce,Ie],e[92]=ve,e[93]=Ce,e[94]=Ie,e[95]=dt):dt=e[95];const yt=dt;let Se;e[96]!==o?(Se=o("id"),e[96]=o,e[97]=Se):Se=e[97];let we;e[98]!==Se?(we={className:"font-mono text-xs",head:Se,render:dl},e[98]=Se,e[99]=we):we=e[99];let ke;e[100]!==o?(ke=o("name"),e[100]=o,e[101]=ke):ke=e[101];let De;e[102]!==ke?(De={head:ke,render:cl},e[102]=ke,e[103]=De):De=e[103];let ct;e[104]!==we||e[105]!==De?(ct=[we,De],e[104]=we,e[105]=De,e[106]=ct):ct=e[106];const Ct=ct;let ze;e[107]!==o?(ze=o("userId"),e[107]=o,e[108]=ze):ze=e[108];let ft;e[109]!==ze?(ft=[{head:ze,render:fl}],e[109]=ze,e[110]=ft):ft=e[110];const xt=ft;let Ae;e[111]!==o?(Ae=o("role"),e[111]=o,e[112]=Ae):Ae=e[112];let Ne;e[113]!==Ae?(Ne={head:Ae,render:ul},e[113]=Ae,e[114]=Ne):Ne=e[114];let Oe;e[115]!==o?(Oe=o("Permission"),e[115]=o,e[116]=Oe):Oe=e[116];let _e;e[117]!==Oe?(_e={className:"font-mono text-xs whitespace-pre-wrap",head:Oe,render:gl},e[117]=Oe,e[118]=_e):_e=e[118];let ut;e[119]!==Ne||e[120]!==_e?(ut=[Ne,_e],e[119]=Ne,e[120]=_e,e[121]=ut):ut=e[121];const It=ut;let Te;e[122]!==ee?(Te=ee!==null&&s("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:ee}),e[122]=ee,e[123]=Te):Te=e[123];let $e;e[124]!==g?($e=g!==null&&s("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g}),e[124]=g,e[125]=$e):$e=e[125];let Me;e[126]!==n||e[127]!==se?(Me=V=>{se(()=>n.removeAuthOrgMember({memberId:V}))},e[126]=n,e[127]=se,e[128]=Me):Me=e[128];let Re;e[129]!==h||e[130]!==vt||e[131]!==j||e[132]!==Me?(Re=s(el,{actionBusy:h,memberColumns:vt,members:j,onDialog:r,onRemoveMember:Me}),e[129]=h,e[130]=vt,e[131]=j,e[132]=Me,e[133]=Re):Re=e[133];const St=y.data?.total;let Ee;e[134]!==j.length||e[135]!==f||e[136]!==b||e[137]!==St?(Ee=s(Et,{count:j.length,offset:f,onOffsetChange:b,pageSize:Nt,prefix:"org-members",total:St}),e[134]=j.length,e[135]=f,e[136]=b,e[137]=St,e[138]=Ee):Ee=e[138];let Fe;e[139]!==h||e[140]!==n||e[141]!==yt||e[142]!==M||e[143]!==se||e[144]!==o?(Fe=M.length>0&&s(Ye,{heading:o("Invitations"),testId:"org-invitations",children:s(et,{columns:yt,rowActions:V=>s(L,{"data-testid":`org-cancel-invitation-${A(V.id)}`,disabled:h,onClick:()=>{se(()=>n.cancelAuthOrgInvitation({invitationId:A(V.id)}))},size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),rowPrefix:"org-invitation",rows:M})}),e[139]=h,e[140]=n,e[141]=yt,e[142]=M,e[143]=se,e[144]=o,e[145]=Fe):Fe=e[145];let Pe;e[146]!==pt||e[147]!==m||e[148]!==Ct||e[149]!==K||e[150]!==u?(Pe=u&&s(tl,{onConfirmDeleteTeam:pt,onDialog:r,onSelectTeam:a,selectedTeam:m,teamColumns:Ct,teams:K}),e[146]=pt,e[147]=m,e[148]=Ct,e[149]=K,e[150]=u,e[151]=Pe):Pe=e[151];let je;e[152]!==h||e[153]!==n||e[154]!==se||e[155]!==m||e[156]!==xt||e[157]!==le||e[158]!==u?(je=u&&m!==null&&s(ll,{actionBusy:h,onDialog:r,onRemoveTeamMember:V=>{se(()=>n.removeAuthOrgTeamMember({teamMemberId:V}))},selectedTeam:m,teamMemberColumns:xt,teamMembers:le}),e[152]=h,e[153]=n,e[154]=se,e[155]=m,e[156]=xt,e[157]=le,e[158]=u,e[159]=je):je=e[159];let Le;e[160]!==n||e[161]!==It||e[162]!==te||e[163]!==d||e[164]!==o?(Le=d&&s(ol,{onConfirmDeleteRole:V=>{r({action:()=>n.deleteAuthOrgRole({roleId:V}),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},onDialog:r,roleColumns:It,roles:te}),e[160]=n,e[161]=It,e[162]=te,e[163]=d,e[164]=o,e[165]=Le):Le=e[165];let Be;e[166]!==i?.kind||e[167]!==l||e[168]!==D?(Be=i?.kind==="add-member"&&s(Kt,{onClose:re,onDone:D,organizationId:l}),e[166]=i?.kind,e[167]=l,e[168]=D,e[169]=Be):Be=e[169];let Qe;e[170]!==i?.kind||e[171]!==l||e[172]!==D?(Qe=i?.kind==="invite-member"&&s(Vt,{onClose:re,onDone:D,organizationId:l}),e[170]=i?.kind,e[171]=l,e[172]=D,e[173]=Qe):Qe=e[173];let Je;e[174]!==i||e[175]!==D?(Je=i?.kind==="member-role"&&s(Wt,{member:i.member,onClose:re,onDone:D}),e[174]=i,e[175]=D,e[176]=Je):Je=e[176];let Ue;e[177]!==i?.kind||e[178]!==l||e[179]!==D?(Ue=i?.kind==="team-create"&&s(zt,{mode:"create",onClose:re,onDone:D,organizationId:l}),e[177]=i?.kind,e[178]=l,e[179]=D,e[180]=Ue):Ue=e[180];let Ge;e[181]!==i||e[182]!==l||e[183]!==D?(Ge=i?.kind==="team-rename"&&s(zt,{mode:"edit",onClose:re,onDone:D,organizationId:l,team:i.team}),e[181]=i,e[182]=l,e[183]=D,e[184]=Ge):Ge=e[184];let He;e[185]!==i||e[186]!==D?(He=i?.kind==="team-add-member"&&s(Xt,{onClose:re,onDone:D,teamId:i.teamId}),e[185]=i,e[186]=D,e[187]=He):He=e[187];let Ze;e[188]!==i?.kind||e[189]!==l||e[190]!==D?(Ze=i?.kind==="role-create"&&s(At,{mode:"create",onClose:re,onDone:D,organizationId:l}),e[188]=i?.kind,e[189]=l,e[190]=D,e[191]=Ze):Ze=e[191];let qe;e[192]!==i||e[193]!==l||e[194]!==D?(qe=i?.kind==="role-edit"&&s(At,{mode:"edit",onClose:re,onDone:D,organizationId:l,role:i.role}),e[192]=i,e[193]=l,e[194]=D,e[195]=qe):qe=e[195];let Ke;e[196]!==i||e[197]!==D?(Ke=i?.kind==="confirm"&&s(Lt,{action:i.action,message:i.message,onClose:re,onDone:D,testId:i.testId,title:i.title}),e[196]=i,e[197]=D,e[198]=Ke):Ke=e[198];let gt;return e[199]!==Te||e[200]!==$e||e[201]!==Re||e[202]!==Ee||e[203]!==Fe||e[204]!==Pe||e[205]!==je||e[206]!==Le||e[207]!==Be||e[208]!==Qe||e[209]!==Je||e[210]!==Ue||e[211]!==Ge||e[212]!==He||e[213]!==Ze||e[214]!==qe||e[215]!==Ke?(gt=E("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Te,$e,Re,Ee,Fe,Pe,je,Le,Be,Qe,Je,Ue,Ge,He,Ze,qe,Ke]}),e[199]=Te,e[200]=$e,e[201]=Re,e[202]=Ee,e[203]=Fe,e[204]=Pe,e[205]=je,e[206]=Le,e[207]=Be,e[208]=Qe,e[209]=Je,e[210]=Ue,e[211]=Ge,e[212]=He,e[213]=Ze,e[214]=qe,e[215]=Ke,e[216]=gt):gt=e[216],gt};function rl(t){return s("span",{className:"font-mono text-xs",children:A(t.userId)})}function sl(t){return A(t.role)}function nl(t){return A(t.email)}function al(t){return A(t.role)}function ml(t){return A(t.status)}function dl(t){return A(t.id)}function cl(t){return A(t.name)}function fl(t){return s("span",{className:"font-mono text-xs",children:A(t.userId)})}function ul(t){return A(t.role)}function gl(t){return A(t.permission)}const Ot=100,Ml=()=>{const t=G(69),e=ae(),l=q(),{config:d,ready:u}=Bt(),n=d.capabilities.organization,[o,i]=P(null),[r,m]=P(null),[a,h]=P(0);let c;t[0]!==a?(c=["lunora-auth-orgs",a],t[0]=a,t[1]=c):c=t[1];let g;t[2]!==e||t[3]!==a?(g=()=>e.listAuthOrganizations({limit:Ot,offset:a}),t[2]=e,t[3]=a,t[4]=g):g=t[4];let p;t[5]!==n?(p={enabled:n},t[5]=n,t[6]=p):p=t[6];const f=Ve(c,g,p),b=f.data?.rows??null;let S;t[7]!==f?(S=()=>f.poll(),t[7]=f,t[8]=S):S=t[8],We(S,n);let v;t[9]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{m(null)},t[9]=v):v=t[9];const y=v;let x;t[10]!==f?(x=()=>{f.refetch()},t[10]=f,t[11]=x):x=t[11];const I=x;let C;t[12]===Symbol.for("react.memo_cache_sentinel")?(C=M=>{i(M)},t[12]=C):C=t[12];const w=C;if(u&&!n){let M;t[13]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[13]=l,t[14]=M):M=t[14];let $;t[15]!==l?($=l("Organizations are not enabled."),t[15]=l,t[16]=$):$=t[16];let K;return t[17]!==M||t[18]!==$?(K=s(Xe,{description:M,testId:"org-disabled",title:$}),t[17]=M,t[18]=$,t[19]=K):K=t[19],K}let k;t[20]!==l?(k=l("Organizations"),t[20]=l,t[21]=k):k=t[21];let O;t[22]!==k?(O=s("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:k}),t[22]=k,t[23]=O):O=t[23];let z;t[24]===Symbol.for("react.memo_cache_sentinel")?(z=()=>{m({kind:"create"})},t[24]=z):z=t[24];let N;t[25]!==l?(N=l("New organization"),t[25]=l,t[26]=N):N=t[26];let _;t[27]!==N?(_=s(L,{"data-testid":"org-new",onClick:z,size:"sm",type:"button",children:N}),t[27]=N,t[28]=_):_=t[28];let T;t[29]!==_||t[30]!==O?(T=E("div",{className:"flex items-center justify-between",children:[O,_]}),t[29]=_,t[30]=O,t[31]=T):T=t[31];let R;t[32]!==f.error?(R=f.error!==null&&s("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:f.error}),t[32]=f.error,t[33]=R):R=t[33];let H;t[34]!==b||t[35]!==l?(H=b!==null&&b.length===0&&s(Xe,{testId:"org-empty",title:l("No organizations.")}),t[34]=b,t[35]=l,t[36]=H):H=t[36];let B;t[37]!==b||t[38]!==o||t[39]!==l?(B=b!==null&&b.length>0&&s(Tt,{className:"overflow-hidden py-0",children:s(_t,{className:"px-0",children:E(Rt,{"data-testid":"org-table",children:[s($t,{children:E(ht,{children:[s(ce,{children:l("id")}),s(ce,{children:l("name")}),s(ce,{children:l("slug")}),s(ce,{children:l("created")}),s(ce,{"aria-label":l("Actions")})]})}),s(Mt,{children:b.map(M=>{const $=A(M.id);return E(ht,{"data-testid":`org-row-${$}`,children:[s(fe,{className:"font-mono text-xs",children:$}),s(fe,{children:A(M.name)}),s(fe,{children:A(M.slug)}),s(fe,{className:"text-muted-foreground tabular-nums",children:Ut(M.createdAt)}),s(fe,{children:E("div",{className:"flex justify-end gap-1",children:[s(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:()=>{w($)},size:"xs",type:"button",variant:"ghost",children:l("Manage")}),s(L,{"data-testid":`org-edit-${$}`,onClick:()=>{m({kind:"edit",org:M})},size:"xs",type:"button",variant:"ghost",children:l("Edit")}),s(L,{"data-testid":`org-delete-${$}`,onClick:()=>{m({kind:"delete",org:M})},size:"xs",type:"button",variant:"ghost",children:l("Delete")})]})})]},$)})})]})})}),t[37]=b,t[38]=o,t[39]=l,t[40]=B):B=t[40];let U;t[41]!==a||t[42]!==b||t[43]!==f.data?.total?(U=b!==null&&s(Et,{count:b.length,offset:a,onOffsetChange:h,pageSize:Ot,prefix:"org",total:f.data?.total}),t[41]=a,t[42]=b,t[43]=f.data?.total,t[44]=U):U=t[44];let Q;t[45]!==d.organization||t[46]!==o?(Q=o!==null&&s(il,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[45]=d.organization,t[46]=o,t[47]=Q):Q=t[47];let F;t[48]!==r?.kind||t[49]!==I?(F=r?.kind==="create"&&s(Dt,{mode:"create",onClose:y,onDone:I}),t[48]=r?.kind,t[49]=I,t[50]=F):F=t[50];let J;t[51]!==r||t[52]!==I?(J=r?.kind==="edit"&&s(Dt,{mode:"edit",onClose:y,onDone:I,org:r.org}),t[51]=r,t[52]=I,t[53]=J):J=t[53];let j;t[54]!==e||t[55]!==r||t[56]!==I||t[57]!==l?(j=r?.kind==="delete"&&s(Lt,{action:async()=>{const M=A(r.org.id);await e.deleteAuthOrganization({organizationId:M}),i($=>$===M?null:$)},message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:y,onDone:I,testId:"org-delete",title:l("Delete organization")}),t[54]=e,t[55]=r,t[56]=I,t[57]=l,t[58]=j):j=t[58];let Z;return t[59]!==T||t[60]!==R||t[61]!==H||t[62]!==B||t[63]!==U||t[64]!==Q||t[65]!==F||t[66]!==J||t[67]!==j?(Z=E("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[T,R,H,B,U,Q,F,J,j]}),t[59]=T,t[60]=R,t[61]=H,t[62]=B,t[63]=U,t[64]=Q,t[65]=F,t[66]=J,t[67]=j,t[68]=Z):Z=t[68],Z};export{Ml as default};
@@ -0,0 +1 @@
1
+ import{decodeDocument as D}from"@lunora/wire";import{E as F}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{B as E}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as x,a as A}from"../packem_shared/card-By2O8ULa.mjs";import{E as I}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as P,a as V,b as g,c as m,d as C,e as o}from"../packem_shared/table-D0SBiDu-.mjs";import{u as h}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{useAutoRefresh as H}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs";import{u as M}from"../packem_shared/home-panel-CF-MfsnH.mjs";import{useT as U}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as b}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{h as B}from"../packem_shared/internal-BXEjuLPN.mjs";import{jsx as e,jsxs as d}from"react/jsx-runtime";const T="payment_subscriptions",R="payment_events",k=[T,R],G={},N=new Set(["active","trialing"]),Y=new Set(["past_due","unpaid"]),a=(n,r)=>{if(n[r]!==void 0)return n[r];const p=n.__doc__;return typeof p=="string"?D(p)?.[r]:void 0},s=n=>typeof n=="string"?n:typeof n=="number"||typeof n=="bigint"||typeof n=="boolean"?String(n):"",q=n=>N.has(n)?"default":Y.has(n)?"destructive":"outline",oe=({limit:n=100})=>{const r=U(),p=M(),{data:y}=h(b.listTables,G,{live:!0}),_=y!==void 0,w=Array.isArray(y)&&k.every(t=>y.some(c=>c.name===t)),l=p.payments&&w,i=h(b.readTablePage,{filters:[],limit:n,offset:0,orderBy:{column:"updatedAt",direction:"desc"},search:"",table:T},{enabled:l}),u=h(b.readTablePage,{filters:[],limit:25,offset:0,orderBy:{column:"processedAt",direction:"desc"},search:"",table:R},{enabled:l}),v=h(b.facetColumn,{column:"state",table:T},{enabled:l});H(()=>{if(l)return Promise.all([i.poll(),u.poll(),v.poll()])},!0);const f=i.data?.rows??[],L=u.data?.rows??[],O=i.error??u.error,Q=i.error===null?u.errorSource:i.errorSource,j=i.data?.total??f.length,S=v.data?.values===void 0?f.filter(t=>N.has(s(a(t,"state")))).length:v.data.values.reduce((t,c)=>t+(N.has(s(c.value))?c.count:0),0);return _&&!l?e("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:e(I,{description:r("No @lunora/payment tables found in this deployment. Add `.extend(paymentExtension)` to lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:r("No payments configured")})}):d("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[e("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:d(x,{className:"justify-between gap-0 py-0",children:[d("div",{className:"flex flex-col gap-2.5 p-4",children:[e("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Subscriptions")}),d("div",{className:"flex items-center gap-2",children:[e("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:S}),e(E,{variant:"default",children:r("{count} active",{count:S})})]})]}),e("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:r("{total} total",{total:j})})]})}),O===null?void 0:e(F,{error:Q}),f.length===0&&!i.isLoading?e(I,{testId:"payments-empty",title:r("No subscriptions yet")}):e(x,{className:"overflow-hidden py-0",children:e(A,{className:"px-0",children:d(P,{children:[e(V,{children:d(g,{children:[e(m,{children:r("Provider")}),e(m,{children:r("Reference")}),e(m,{children:r("Plan")}),e(m,{children:r("State")}),e(m,{children:r("Renews")})]})}),e(C,{children:f.map(t=>{const c=s(a(t,"state"));return d(g,{"data-testid":"payment-subscription-row",children:[e(o,{children:s(a(t,"provider"))}),e(o,{children:s(a(t,"referenceId"))}),e(o,{children:s(a(t,"priceId"))}),e(o,{children:e(E,{variant:q(c),children:c})}),e(o,{children:B(a(t,"currentPeriodEnd"))})]},s(a(t,"providerSubscriptionId")))})})]})})}),d(x,{className:"overflow-hidden py-0",children:[e("header",{className:"border-b border-border px-4 py-3",children:e("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Recent webhook events")})}),e(A,{className:"px-0",children:e(P,{children:e(C,{children:L.map(t=>d(g,{"data-testid":"payment-event-row",children:[e(o,{children:s(a(t,"provider"))}),e(o,{className:"font-medium",children:s(a(t,"type"))}),e(o,{className:"text-muted-foreground",children:s(a(t,"providerEventId"))}),e(o,{children:B(a(t,"processedAt"))})]},s(a(t,"providerEventId"))))})})})]})]})};export{oe as PaymentsPanel};
@@ -0,0 +1 @@
1
+ import{useState as h,useRef as le,useEffect as oe}from"react";import{c as xe,d as ye,b as be,a as de,C as me}from"../packem_shared/card-By2O8ULa.mjs";import{useT as ee}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{c as fe}from"react/compiler-runtime";import{E as ge}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{L as ve}from"../packem_shared/live-status-BuJdUZFU.mjs";import{B as Q}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as j}from"../packem_shared/button-q0UYSmrn.mjs";import{E as pe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as Ne,a as ke,b as ie,c as te,d as Ce,e as ae}from"../packem_shared/table-D0SBiDu-.mjs";import{u as re}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{ADMIN_FUNCTIONS as X}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsxs as o,jsx as a}from"react/jsx-runtime";import{useLunora as ue}from"@lunora/react";import{decodeWire as Se}from"@lunora/wire";import{ConfirmButton as we}from"../packem_shared/ConfirmButton-DU4p72Er.mjs";import{ShardInput as Pe}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{I as G}from"../packem_shared/input-CXhxesPC.mjs";import{L as O}from"../packem_shared/label-DKFzyHq6.mjs";import{T as Ie}from"../packem_shared/textarea--40GKAyz.mjs";import{d as Te,c as Ae,b as Ee,f as se,k as Re}from"../packem_shared/internal-BXEjuLPN.mjs";const ne=["read","insert","update","delete"],_e=(e,t)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[t],Fe=e=>e.file===""?e.procedure:`${e.file}:${e.procedure}`,Oe=e=>{const t=new Set;for(const i of e?.advisories??[])if(i.name==="rls_uncovered_table"){const{table:d}=i.metadata;typeof d=="string"&&d!==""&&t.add(d)}return t},De=(e,t,i)=>{const d=new Map,r=c=>{const n=d.get(c);if(n!==void 0)return n;const f={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:new Set,table:c,uncovered:i.has(c)};return d.set(c,f),f};for(const c of e)r(c.table).cells[c.on]={path:Fe(c),procedure:c.procedure};for(const c of t)r(c.table).maskedColumns.add(c.column);for(const c of i)r(c);return[...d.values()].toSorted((c,n)=>c.table.localeCompare(n.table))},Le=e=>{const t=fe(17);let i;t[0]!==e?(i=e===void 0?{}:e,t[0]=e,t[1]=i):i=t[1];const{onProbe:d}=i,r=ee();let c,n;t[2]===Symbol.for("react.memo_cache_sentinel")?(c={},n={live:!0},t[2]=c,t[3]=n):(c=t[2],n=t[3]);const f=re(X.rlsPolicies,c,n);let s;t[4]===Symbol.for("react.memo_cache_sentinel")?(s={},t[4]=s):s=t[4];const k=re(X.maskPolicies,s);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u={},t[5]=u):u=t[5];const y=re(X.getAdvisories,u);let b;if(t[6]!==y.data||t[7]!==k.data||t[8]!==d||t[9]!==f||t[10]!==r){let C=null;f.data!==void 0&&(C=Array.isArray(f.data.policies)?f.data.policies:[]);const D=Array.isArray(k.data?.columns)?k.data.columns:[],H=y.data??null,{error:P,errorSource:g,liveError:I}=f,T=C===null?[]:De(C,D,Oe(H));let S;t[12]!==I?(S=a("div",{className:"flex items-center justify-end",children:a(ve,{message:I,prefix:"pm"})}),t[12]=I,t[13]=S):S=t[13];let p;t[14]!==P||t[15]!==g?(p=P!==null&&a(ge,{error:g,testId:"pm-error"}),t[14]=P,t[15]=g,t[16]=p):p=t[16],b=o("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[S,p,C!==null&&T.length===0?a(pe,{description:r("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:r("No policy")}):o(Ne,{"data-testid":"pm-table",children:[a(ke,{children:o(ie,{children:[a(te,{children:r("Table")}),ne.map(m=>a(te,{children:_e(r,m)},m)),a(te,{children:r("Masked columns")})]})}),a(Ce,{children:T.map(m=>o(ie,{"data-testid":`pm-row-${m.table}`,children:[a(ae,{className:"font-mono text-xs",children:o("span",{className:"flex items-center gap-1.5",children:[m.table,m.uncovered&&a(Q,{"data-testid":`pm-uncovered-${m.table}`,title:r("Uncovered — reachable without a policy"),variant:"destructive",children:r("Uncovered — reachable without a policy")})]})}),ne.map(A=>{const v=m.cells[A];return a(ae,{"data-testid":`pm-cell-${m.table}-${A}`,children:v.procedure===void 0?a("span",{className:"text-xs text-muted-foreground",children:r("No policy")}):o("span",{className:"flex flex-col gap-1",children:[a(Q,{variant:"secondary",children:r("Covered by {procedure}",{procedure:v.procedure})}),d!==void 0&&a(j,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${m.table}-${A}`,onClick:()=>{d(m.table,A,v.path??"")},size:"xs",type:"button",variant:"ghost",children:r("Probe this")})]})},A)}),a(ae,{children:m.maskedColumns.size===0?a("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"—"}):a("span",{className:"flex flex-wrap gap-1",children:[...m.maskedColumns].map($e)})})]},m.table))})]})]}),t[6]=y.data,t[7]=k.data,t[8]=d,t[9]=f,t[10]=r,t[11]=b}else b=t[11];return b};function $e(e){return a(Q,{variant:"outline",children:e},e)}const Ue=Ae(X.runAs),Me=new Set(["FORBIDDEN","RLS_REQUIRED","UNAUTHORIZED"]),We=e=>{const t=e?.code;return typeof t=="string"?t:void 0},ze=()=>{const e=ue();return async({args:t,functionPath:i,shardKey:d="",userId:r})=>{if(r.trim()==="")return{kind:"invalid",message:"No identity to probe: enter the userId whose access you want to test."};const c=Ue;try{return{kind:"allowed",value:await e.query(c,{args:t,functionPath:i,userId:r},Te(d))}}catch(n){const f=n instanceof Error?n.message:String(n),s=We(n);return s!==void 0&&Me.has(s)?{kind:"denied",message:f}:{kind:"errored",message:f}}}},qe=e=>e===void 0?"undefined":JSON.stringify(e,Re,2),Be=({functions:e,prefill:t,runAsIdentity:i=!1}={})=>{const d=ue(),r=ee(),c=ze(),[n,f]=h(null),[s,k]=h(null),u=e??n??[],[y,b]=h(""),[C,D]=h("{}"),[H,P]=h(""),[g,I]=h(""),[T,S]=h(!1),[p,m]=h(null),[A,v]=h(null),[E,L]=h(!1),R=le(-1),w=le(0);oe(()=>{if(e!==void 0)return;let l=!1;return d.listFunctions().then(N=>(l||f(N),N)).catch(N=>{l||k(Ee(N))}),()=>{l=!0}},[d,e]),oe(()=>{if(t===void 0||R.current===t.nonce)return;R.current=t.nonce,w.current+=1;const l=t.functionPath;queueMicrotask(()=>{b(l),m(null)})},[t]);const J=E?u:u.filter(l=>l.kind==="query"||l.path===y),x=y===""?J[0]?.path??"":y,$=u.find(l=>l.path===x),K=x!==""&&$?.kind!=="query",U=async()=>{if(x==="")return;let l;try{l=C.trim()===""?{}:Se(JSON.parse(C))}catch(B){v(r("Invalid JSON args: {message}",{message:B.message})),m(null);return}w.current+=1;const N=w.current;v(null),S(!0);try{const B=await c({args:l,functionPath:x,shardKey:H.trim(),userId:g.trim()});N===w.current&&m(B)}finally{S(!1)}},_=()=>{se(U())},M=l=>{b(l.target.value)},W=l=>{D(l.target.value)},z=l=>{I(l.target.value)},q=l=>{L(l.target.checked),!l.target.checked&&K&&b("")},F=!i||T||x==="";return o("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[s!==null&&a("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:s}),!i&&a(pe,{description:r("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:r("Set `runAsIdentity` to forge an identity and probe access.")}),o("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[o("div",{className:"flex flex-col gap-1.5",children:[a(O,{htmlFor:"pp-function",children:r("Function")}),a("select",{"aria-label":r("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:M,value:x,children:J.map(l=>o("option",{value:l.path,children:[l.path," (",l.kind,")"]},l.path))}),o(O,{className:"flex items-center gap-1.5 text-xs font-normal",htmlFor:"pp-include-writes",children:[a("input",{checked:E,className:"size-4 accent-primary","data-testid":"pp-include-writes",id:"pp-include-writes",onChange:q,type:"checkbox"}),r("Include mutations and actions")]})]}),o("div",{className:"flex flex-col gap-1.5",children:[a(O,{htmlFor:"pp-args",children:r("Arguments")}),a(Ie,{"aria-label":r("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:W,value:C})]}),a(Pe,{onChange:P,testId:"pp-shard",value:H}),o("div",{className:"flex flex-col gap-1.5",children:[a(O,{htmlFor:"pp-user",children:r("Run as (userId)")}),a(G,{"aria-label":r("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:z,placeholder:r("Required — the identity to probe as"),value:g})]}),o("div",{className:"flex items-center gap-2",children:[K?a(we,{confirmLabel:r("This will execute `{functionPath}` as user `{userId}`.",{functionPath:x,userId:g.trim()}),disabled:F,onConfirm:_,testId:"pp-run",children:r(T?"Probing…":"Run probe")}):a(j,{"data-testid":"pp-run",disabled:F,onClick:_,type:"button",children:r(T?"Probing…":"Run probe")}),g.trim()!==""&&a(Q,{"data-testid":"pp-as-badge",variant:"secondary",children:r("as {userId}",{userId:g.trim()})})]})]}),A!==null&&a("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:A}),p!==null&&p.kind==="allowed"&&o("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[a(Q,{variant:"secondary",children:r("Allowed")}),a("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:qe(p.value)})]}),p!==null&&p.kind==="invalid"&&o("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-invalid",children:[a(Q,{variant:"outline",children:r("Not run")}),a("p",{className:"text-sm text-muted-foreground","data-testid":"pp-invalid",role:"status",children:p.message})]}),p!==null&&p.kind==="errored"&&o("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-errored",children:[a(Q,{variant:"outline",children:r("Errored")}),a("p",{className:"text-sm text-muted-foreground",children:r("The call failed for a reason that is not an access verdict, so it says nothing about the policy.")}),a("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-errored",role:"alert",children:p.message})]}),p!==null&&p.kind==="denied"&&o("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[a(Q,{variant:"destructive",children:r("Denied")}),a("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:p.message})]})]})},je="/__lunora/policy-scaffold",Qe={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists — pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({…}) form — convert it to the builder form (c.use(…).query(…)) before wiring RLS."},He=async e=>{const t=await fetch(je,{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"}),i=await t.json();if(i.needsManualEdit===!0)return{kind:"needs-manual-edit",message:i.message??"This change must be made by hand."};if(t.ok)return{diagnostics:i.diagnostics??[],kind:"ok",label:i.fileName??i.exportName??""};const d=i.error;return{kind:"error",message:d===void 0?`policy scaffold failed (${String(t.status)})`:Qe[d]??d}},ce={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},Je=()=>{const e=fe(69),t=ee(),[i,d]=h(null),[r,c]=h(!1),[n,f]=h(null),[s,k]=h(ce);let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=Z=>{const Y=Z.target.name,{value:V}=Z.target;k(he=>({...he,[Y]:V}))},e[0]=u):u=e[0];const y=u;let b;e[1]===Symbol.for("react.memo_cache_sentinel")?(b=()=>{d(null),k(ce)},e[1]=b):b=e[1];const C=b;let D;e[2]===Symbol.for("react.memo_cache_sentinel")?(D=async Z=>{c(!0),f(null);try{const Y=await He(Z);f(Y),Y.kind==="ok"&&C()}catch(Y){const V=Y;f({kind:"error",message:V instanceof Error?V.message:String(V)})}c(!1)},e[2]=D):D=e[2];const H=D;let P;e[3]!==s.policyName||e[4]!==s.tableName?(P=()=>{se(H({kind:"scaffoldPolicy",name:s.policyName.trim(),table:s.tableName.trim()}))},e[3]=s.policyName,e[4]=s.tableName,e[5]=P):P=e[5];const g=P;let I;e[6]!==s.exportName||e[7]!==s.filePath||e[8]!==s.policies?(I=()=>{se(H({exportName:s.exportName.trim(),filePath:s.filePath.trim(),kind:"wireRls",policies:s.policies.trim()}))},e[6]=s.exportName,e[7]=s.filePath,e[8]=s.policies,e[9]=I):I=e[9];const T=I;let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{f(null),d("scaffold")},e[10]=S):S=e[10];const p=S;let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{f(null),d("wire")},e[11]=m):m=e[11];const A=m;let v;e[12]!==t?(v=t("Scaffold access rules"),e[12]=t,e[13]=v):v=e[13];let E;e[14]!==v?(E=a(xe,{children:v}),e[14]=v,e[15]=E):E=e[15];let L;e[16]!==t?(L=t("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only."),e[16]=t,e[17]=L):L=e[17];let R;e[18]!==L?(R=a(ye,{children:L}),e[18]=L,e[19]=R):R=e[19];let w;e[20]!==R||e[21]!==E?(w=o(be,{children:[E,R]}),e[20]=R,e[21]=E,e[22]=w):w=e[22];const J=i==="scaffold"?"default":"outline";let x;e[23]!==t?(x=t("New policy file"),e[23]=t,e[24]=x):x=e[24];let $;e[25]!==J||e[26]!==x?($=a(j,{"data-testid":"policy-scaffolder-new",onClick:p,size:"xs",type:"button",variant:J,children:x}),e[25]=J,e[26]=x,e[27]=$):$=e[27];const K=i==="wire"?"default":"outline";let U;e[28]!==t?(U=t("Wire into a procedure"),e[28]=t,e[29]=U):U=e[29];let _;e[30]!==K||e[31]!==U?(_=a(j,{"data-testid":"policy-scaffolder-wire",onClick:A,size:"xs",type:"button",variant:K,children:U}),e[30]=K,e[31]=U,e[32]=_):_=e[32];let M;e[33]!==$||e[34]!==_?(M=o("div",{className:"flex flex-wrap gap-2",children:[$,_]}),e[33]=$,e[34]=_,e[35]=M):M=e[35];let W;e[36]!==r||e[37]!==s.policyName||e[38]!==s.tableName||e[39]!==i||e[40]!==g||e[41]!==t?(W=i==="scaffold"&&o("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[o("div",{className:"flex flex-col gap-1 text-xs",children:[a(O,{htmlFor:"policy-scaffolder-name",children:t("Policy name")}),a(G,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:y,value:s.policyName})]}),o("div",{className:"flex flex-col gap-1 text-xs",children:[a(O,{htmlFor:"policy-scaffolder-table",children:t("Table name")}),a(G,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:y,value:s.tableName})]}),a(j,{"data-testid":"policy-scaffolder-create",disabled:r||s.policyName.trim()===""||s.tableName.trim()==="",onClick:g,size:"xs",type:"button",children:t(r?"Creating…":"Create policy file")}),a(j,{onClick:C,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[36]=r,e[37]=s.policyName,e[38]=s.tableName,e[39]=i,e[40]=g,e[41]=t,e[42]=W):W=e[42];let z;e[43]!==r||e[44]!==s.exportName||e[45]!==s.filePath||e[46]!==s.policies||e[47]!==i||e[48]!==T||e[49]!==t?(z=i==="wire"&&o("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[o("div",{className:"flex flex-col gap-1 text-xs",children:[a(O,{htmlFor:"policy-scaffolder-file",children:t("Procedure file path")}),a(G,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:y,value:s.filePath})]}),o("div",{className:"flex flex-col gap-1 text-xs",children:[a(O,{htmlFor:"policy-scaffolder-export",children:t("Exported procedure")}),a(G,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:y,value:s.exportName})]}),o("div",{className:"flex flex-col gap-1 text-xs",children:[a(O,{htmlFor:"policy-scaffolder-policies",children:t("Policy set identifier")}),a(G,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:y,value:s.policies})]}),a(j,{"data-testid":"policy-scaffolder-apply",disabled:r||s.filePath.trim()===""||s.exportName.trim()===""||s.policies.trim()==="",onClick:T,size:"xs",type:"button",children:t(r?"Wiring…":"Wire RLS")}),a(j,{onClick:C,size:"xs",type:"button",variant:"ghost",children:t("Cancel")})]}),e[43]=r,e[44]=s.exportName,e[45]=s.filePath,e[46]=s.policies,e[47]=i,e[48]=T,e[49]=t,e[50]=z):z=e[50];let q;e[51]!==n?(q=n?.kind==="error"&&a("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:n.message}),e[51]=n,e[52]=q):q=e[52];let F;e[53]!==n?.kind||e[54]!==t?(F=n?.kind==="needs-manual-edit"&&a("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:t("This change must be made by hand — the scaffolder only adds new, deny-by-default rules.")}),e[53]=n?.kind,e[54]=t,e[55]=F):F=e[55];let l;e[56]!==n||e[57]!==t?(l=n?.kind==="ok"&&o("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[a("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:t("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:n.label})}),n.diagnostics.length>0&&a("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:n.diagnostics.map(Ke)})]}),e[56]=n,e[57]=t,e[58]=l):l=e[58];let N;e[59]!==M||e[60]!==W||e[61]!==z||e[62]!==q||e[63]!==F||e[64]!==l?(N=o(de,{children:[M,W,z,q,F,l]}),e[59]=M,e[60]=W,e[61]=z,e[62]=q,e[63]=F,e[64]=l,e[65]=N):N=e[65];let B;return e[66]!==w||e[67]!==N?(B=o(me,{"data-testid":"policy-scaffolder",size:"sm",children:[w,N]}),e[66]=w,e[67]=N,e[68]=B):B=e[68],B};function Ke(e){return a("li",{className:"font-mono text-[11px] text-destructive",children:e},e)}const xt=({functions:e,runAsIdentity:t=!1,schemaEditable:i=!1}={})=>{const d=ee(),[r,c]=h(void 0),n=(f,s,k)=>{k!==""&&c(u=>({functionPath:k,nonce:(u?.nonce??0)+1}))};return o("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[o("section",{className:"flex flex-col gap-3",children:[a("header",{className:"border-b border-border px-4 py-3",children:a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d("Permissions")})}),a(Le,{onProbe:n})]}),a("section",{className:"flex flex-col gap-3",children:o(me,{className:"gap-0 py-0",children:[a("header",{className:"border-b border-border px-4 py-3",children:a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d("Probe")})}),o(de,{className:"px-4 py-4",children:[a("p",{className:"mb-3 text-sm text-muted-foreground",children:d("Pick a function and an identity, then run it to see the access outcome.")}),a(Be,{functions:e,prefill:r,runAsIdentity:t})]})]})}),i&&a("section",{className:"flex flex-col gap-2",children:a(Je,{})})]})};export{xt as PermissionsPanel};
@@ -0,0 +1 @@
1
+ import{c as W}from"react/compiler-runtime";import{useQueryClient as se,useQuery as ie,useMutation as re}from"@tanstack/react-query";import{useId as le}from"react";import{E as Z}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{B as G}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as ne}from"../packem_shared/button-q0UYSmrn.mjs";import{E as ee}from"../packem_shared/empty-state-D7jEML_T.mjs";import{c as w,a as ae,b as te,d as de,T as ce,e as O}from"../packem_shared/table-D0SBiDu-.mjs";import{useT as X}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{h as J}from"../packem_shared/internal-BXEjuLPN.mjs";import{c as oe}from"../packem_shared/utils-bhneXptQ.mjs";import{jsx as i,jsxs as z}from"react/jsx-runtime";const ue=new Set(["cancelled","completed","expired"]),fe=r=>ue.has(r),me=r=>r.extendedDueAt??r.dueAt,ve=r=>!fe(r)&&r!=="ready",pe=(r,e)=>ve(r.status)&&e.getTime()>me(r).getTime(),ye=(r,e)=>pe({dueAt:new Date(r.dueAt),status:r.status,...r.extendedDueAt===void 0||r.extendedDueAt===null?{}:{extendedDueAt:new Date(r.extendedDueAt)}},new Date(e)),he=["studio","privacy-requests"],xe={cancelled:"outline",completed:"success",expired:"outline",failed:"destructive",grace:"secondary",processing:"warning",ready:"success",received:"info"},Ae=r=>J(r??void 0,"—"),ge=r=>{const e=W(55),{asOf:o,retrying:t,row:s,onRetry:q}=r,a=X();let d,c,D;e[0]!==o||e[1]!==s?(c=ye(s,o),d=te,D=oe(c&&"bg-destructive/5"),e[0]=o,e[1]=s,e[2]=d,e[3]=c,e[4]=D):(d=e[2],c=e[3],D=e[4]);const S=c?"true":"false";let u;e[5]!==s.id?(u=i(O,{className:"font-mono text-xs",children:s.id}),e[5]=s.id,e[6]=u):u=e[6];let f;e[7]!==s.type||e[8]!==a?(f=s.type==="export"?a("Export"):a("Erasure"),e[7]=s.type,e[8]=a,e[9]=f):f=e[9];let E;e[10]!==f?(E=i(O,{children:i(G,{variant:"secondary",children:f})}),e[10]=f,e[11]=E):E=e[11];let n;e[12]!==s.subjectId?(n=i(O,{className:"font-mono text-xs",children:s.subjectId}),e[12]=s.subjectId,e[13]=n):n=e[13];const N=xe[s.status];let b;e[14]!==s.status||e[15]!==N?(b=i(O,{children:i(G,{variant:N,children:s.status})}),e[14]=s.status,e[15]=N,e[16]=b):b=e[16];let R;e[17]!==s.receivedAt?(R=J(s.receivedAt),e[17]=s.receivedAt,e[18]=R):R=e[18];let P;e[19]!==R?(P=i(O,{children:R}),e[19]=R,e[20]=P):P=e[20];let m;e[21]!==s.dueAt?(m=J(s.dueAt),e[21]=s.dueAt,e[22]=m):m=e[22];let v;e[23]!==m?(v=i(O,{children:m}),e[23]=m,e[24]=v):v=e[24];let p;e[25]!==s.extendedDueAt?(p=Ae(s.extendedDueAt),e[25]=s.extendedDueAt,e[26]=p):p=e[26];let y;e[27]!==p?(y=i(O,{children:p}),e[27]=p,e[28]=y):y=e[28];let h;e[29]!==c||e[30]!==a?(h=c&&i(G,{"data-testid":"privacy-overdue",variant:"destructive",children:a("Overdue")}),e[29]=c,e[30]=a,e[31]=h):h=e[31];let x;e[32]!==h?(x=i(O,{children:h}),e[32]=h,e[33]=x):x=e[33];let A;e[34]!==q||e[35]!==t||e[36]!==s.id||e[37]!==s.status||e[38]!==a?(A=s.status==="failed"&&i(ne,{disabled:t,onClick:()=>{q(s.id)},size:"xs",variant:"outline",children:a("Retry")}),e[34]=q,e[35]=t,e[36]=s.id,e[37]=s.status,e[38]=a,e[39]=A):A=e[39];let g;e[40]!==A?(g=i(O,{children:A}),e[40]=A,e[41]=g):g=e[41];let I;return e[42]!==d||e[43]!==D||e[44]!==P||e[45]!==v||e[46]!==y||e[47]!==x||e[48]!==g||e[49]!==S||e[50]!==u||e[51]!==E||e[52]!==n||e[53]!==b?(I=z(d,{className:D,"data-overdue":S,"data-testid":"privacy-request-row",children:[u,E,n,b,P,v,y,x,g]}),e[42]=d,e[43]=D,e[44]=P,e[45]=v,e[46]=y,e[47]=x,e[48]=g,e[49]=S,e[50]=u,e[51]=E,e[52]=n,e[53]=b,e[54]=I):I=e[54],I},Te=r=>{const e=W(95),{source:o}=r,t=X(),s=se(),q=le();let a;e[0]!==q?(a=[...he,q],e[0]=q,e[1]=a):a=e[1];const d=a;let c;e[2]!==o?(c=async()=>({asOf:Date.now(),requests:await o.listOpenPrivacyRequests()}),e[2]=o,e[3]=c):c=e[3];let D;e[4]!==d||e[5]!==c?(D={queryKey:d,refetchInterval:6e4,queryFn:c,staleTime:0},e[4]=d,e[5]=c,e[6]=D):D=e[6];const S=ie(D);let u;e[7]!==o?(u=l=>o.retryPrivacyRequest(l),e[7]=o,e[8]=u):u=e[8];let f;e[9]!==s||e[10]!==d?(f=async()=>{await s.invalidateQueries({queryKey:d})},e[9]=s,e[10]=d,e[11]=f):f=e[11];let E;e[12]!==u||e[13]!==f?(E={mutationFn:u,onSuccess:f},e[12]=u,e[13]=f,e[14]=E):E=e[14];const n=re(E);let N;e[15]!==n?(N=l=>{n.mutate(l)},e[15]=n,e[16]=N):N=e[16];const b=N;if(S.isPending){let l;e[17]!==t?(l=t("Loading privacy requests…"),e[17]=t,e[18]=l):l=e[18];let T;return e[19]!==l?(T=i("p",{className:"text-sm text-muted-foreground","data-testid":"privacy-requests-loading",role:"status",children:l}),e[19]=l,e[20]=T):T=e[20],T}if(S.isError){let l;return e[21]!==S.error?(l=i(Z,{error:S.error,testId:"privacy-requests-error"}),e[21]=S.error,e[22]=l):l=e[22],l}const{asOf:R,requests:P}=S.data;if(P.length===0){let l;e[23]!==t?(l=t("No open privacy requests."),e[23]=t,e[24]=l):l=e[24];let T;return e[25]!==l?(T=i(ee,{testId:"privacy-requests-empty",title:l}),e[25]=l,e[26]=T):T=e[26],T}let m;e[27]!==n.error||e[28]!==n.isError?(m=n.isError&&i(Z,{error:n.error,testId:"privacy-retry-error"}),e[27]=n.error,e[28]=n.isError,e[29]=m):m=e[29];let v;e[30]!==t?(v=t("ID"),e[30]=t,e[31]=v):v=e[31];let p;e[32]!==v?(p=i(w,{children:v}),e[32]=v,e[33]=p):p=e[33];let y;e[34]!==t?(y=t("Type"),e[34]=t,e[35]=y):y=e[35];let h;e[36]!==y?(h=i(w,{children:y}),e[36]=y,e[37]=h):h=e[37];let x;e[38]!==t?(x=t("Subject"),e[38]=t,e[39]=x):x=e[39];let A;e[40]!==x?(A=i(w,{children:x}),e[40]=x,e[41]=A):A=e[41];let g;e[42]!==t?(g=t("Status"),e[42]=t,e[43]=g):g=e[43];let I;e[44]!==g?(I=i(w,{children:g}),e[44]=g,e[45]=I):I=e[45];let j;e[46]!==t?(j=t("Received"),e[46]=t,e[47]=j):j=e[47];let B;e[48]!==j?(B=i(w,{children:j}),e[48]=j,e[49]=B):B=e[49];let C;e[50]!==t?(C=t("Due"),e[50]=t,e[51]=C):C=e[51];let Q;e[52]!==C?(Q=i(w,{children:C}),e[52]=C,e[53]=Q):Q=e[53];let U;e[54]!==t?(U=t("Extended due"),e[54]=t,e[55]=U):U=e[55];let V;e[56]!==U?(V=i(w,{children:U}),e[56]=U,e[57]=V):V=e[57];let _;e[58]!==t?(_=t("Overdue"),e[58]=t,e[59]=_):_=e[59];let $;e[60]!==_?($=i(w,{children:_}),e[60]=_,e[61]=$):$=e[61];let F;e[62]!==t?(F=t("Actions"),e[62]=t,e[63]=F):F=e[63];let H;e[64]!==F?(H=i(w,{children:F}),e[64]=F,e[65]=H):H=e[65];let K;e[66]!==p||e[67]!==h||e[68]!==A||e[69]!==I||e[70]!==B||e[71]!==Q||e[72]!==V||e[73]!==$||e[74]!==H?(K=i(ae,{children:z(te,{children:[p,h,A,I,B,Q,V,$,H]})}),e[66]=p,e[67]=h,e[68]=A,e[69]=I,e[70]=B,e[71]=Q,e[72]=V,e[73]=$,e[74]=H,e[75]=K):K=e[75];let L;if(e[76]!==R||e[77]!==b||e[78]!==P||e[79]!==n.isPending||e[80]!==n.variables){let l;e[82]!==R||e[83]!==b||e[84]!==n.isPending||e[85]!==n.variables?(l=T=>i(ge,{asOf:R,onRetry:b,retrying:n.isPending&&n.variables===T.id,row:T},T.id),e[82]=R,e[83]=b,e[84]=n.isPending,e[85]=n.variables,e[86]=l):l=e[86],L=P.map(l),e[76]=R,e[77]=b,e[78]=P,e[79]=n.isPending,e[80]=n.variables,e[81]=L}else L=e[81];let M;e[87]!==L?(M=i(de,{children:L}),e[87]=L,e[88]=M):M=e[88];let Y;e[89]!==K||e[90]!==M?(Y=z(ce,{children:[K,M]}),e[89]=K,e[90]=M,e[91]=Y):Y=e[91];let k;return e[92]!==Y||e[93]!==m?(k=z("div",{className:"flex flex-col gap-3",children:[m,Y]}),e[92]=Y,e[93]=m,e[94]=k):k=e[94],k},Be=r=>{const e=W(11);let o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];const{source:t}=o,s=X();if(t===void 0){let a;e[2]!==s?(a=s("Pass privacyRequests to the Studio to list and retry data-subject requests."),e[2]=s,e[3]=a):a=e[3];let d;e[4]!==s?(d=s("Privacy requests not configured"),e[4]=s,e[5]=d):d=e[5];let c;return e[6]!==a||e[7]!==d?(c=i(ee,{description:a,testId:"privacy-requests-not-configured",title:d}),e[6]=a,e[7]=d,e[8]=c):c=e[8],c}let q;return e[9]!==t?(q=i(Te,{source:t}),e[9]=t,e[10]=q):q=e[10],q};export{Be as PrivacyRequestsPanel};
@@ -0,0 +1 @@
1
+ import{c as U}from"react/compiler-runtime";import{useLunora as et}from"@lunora/react";import{useState as R,Fragment as tt}from"react";import{ConfirmButton as st}from"../packem_shared/ConfirmButton-DU4p72Er.mjs";import{E as at}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{A as rt}from"../packem_shared/alert-PB5W11MM.mjs";import{B as Ee}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as Ce}from"../packem_shared/button-q0UYSmrn.mjs";import{C as Oe,a as ke}from"../packem_shared/card-By2O8ULa.mjs";import{E as ve}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as nt}from"../packem_shared/input-CXhxesPC.mjs";import{S as ot}from"../packem_shared/scroll-area-CXCQH7VT.mjs";import{T as Fe,a as Ue,b as j,c as C,d as Je,e as _}from"../packem_shared/table-D0SBiDu-.mjs";import{T as lt}from"../packem_shared/textarea--40GKAyz.mjs";import{u as De}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{useAutoRefresh as ct}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs";import{useT as G}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as W}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{f as Se,b as ne,d as Te,c as we,h as it,k as dt}from"../packem_shared/internal-BXEjuLPN.mjs";import{jsx as s,jsxs as b,Fragment as Pe}from"react/jsx-runtime";const ut=(a,e)=>{const t=new Set(a.map(r=>r.deadLetterQueue).filter(r=>typeof r=="string"&&r!=="")),c=a.filter(r=>(r.deadLetterQueue===void 0||r.deadLetterQueue==="")&&!t.has(r.name)),o=e.filter(r=>r.deadLettered).length;return{deadLetteredCount:o,queuesWithoutDlq:c,showReliabilityWarning:c.length>0||o>0}},_e="topic:",Qe=a=>{const e=[],t=new Map;for(const c of a)c.topic===void 0?e.push(c):t.set(c.topic,[...t.get(c.topic)??[],c]);return{plain:e,topics:t}},je=a=>`${_e}${a}`,mt=(a,e)=>a.startsWith(_e)?(e.get(a.slice(_e.length))??[]).map(t=>t.exportName):[a],pt=200,ft=we(W.sendQueueMessage),ht=async(a,e,t)=>{const o=(await Promise.allSettled(e.map(async n=>a.query(ft,n,Te(""))))).flatMap((n,l)=>n.status==="rejected"?[{exportName:e[l]?.exportName??"",message:ne(n.reason)}]:[]),[r]=o;return r===void 0?null:e.length===1?r.message:t("Not sent to {failed}",{failed:o.map(n=>`${n.exportName}: ${n.message}`).join("; ")})},gt=we(W.replayQueueMessage),xt=we(W.clearQueueMessages),$e=96,yt=a=>{if(a===void 0)return"—";try{return JSON.stringify(a,dt)}catch{return"[unserializable]"}},bt=a=>a.length>$e?`${a.slice(0,$e)}…`:a,Nt=a=>a==="error"?"destructive":a==="retry"?"outline":"secondary",qt=(a,e)=>e(a==="messages"?"Messages":a==="send"?"Send":"Declared"),We=a=>{const e=U(17),{queue:t}=a,c=`queues-row-${t.exportName}`;let o;e[0]!==t.exportName?(o=s(_,{className:"font-mono text-xs",children:t.exportName}),e[0]=t.exportName,e[1]=o):o=e[1];let r;e[2]!==t.name?(r=s(_,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e[2]=t.name,e[3]=r):r=e[3];let n;e[4]!==t.mode?(n=s(_,{className:"font-mono text-xs text-muted-foreground",children:t.mode}),e[4]=t.mode,e[5]=n):n=e[5];let l;e[6]!==t.binding?(l=s(_,{className:"font-mono text-xs text-muted-foreground",children:t.binding}),e[6]=t.binding,e[7]=l):l=e[7];const u=t.deadLetterQueue??"—";let i;e[8]!==u?(i=s(_,{className:"font-mono text-xs text-muted-foreground",children:u}),e[8]=u,e[9]=i):i=e[9];let m;return e[10]!==c||e[11]!==o||e[12]!==r||e[13]!==n||e[14]!==l||e[15]!==i?(m=b(j,{"data-testid":c,children:[o,r,n,l,i]}),e[10]=c,e[11]=o,e[12]=r,e[13]=n,e[14]=l,e[15]=i,e[16]=m):m=e[16],m},St=a=>{const e=U(8),{loaded:t,queues:c}=a,o=G();let r;if(e[0]!==t||e[1]!==c||e[2]!==o){const{plain:n,topics:l}=Qe(c);let u;e[4]!==o?(u=o("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[4]=o,e[5]=u):u=e[5];let i;e[6]!==u?(i=s("p",{className:"text-sm text-muted-foreground",children:u}),e[6]=u,e[7]=i):i=e[7],r=b("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[i,t&&c.length===0?s(ve,{description:o("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:o("No queues defined")}):s(Oe,{className:"overflow-hidden py-0",children:s(ke,{className:"px-0",children:b(Fe,{"data-testid":"queues-table",children:[s(Ue,{children:b(j,{children:[s(C,{children:o("Export")}),s(C,{children:o("Queue")}),s(C,{children:o("Mode")}),s(C,{children:o("Binding")}),s(C,{children:o("Dead-letter")})]})}),b(Je,{children:[n.map(Ct),[...l].map(m=>{const[h,g]=m;return b(tt,{children:[s(j,{className:"bg-muted/40","data-testid":`queues-topic-${h}`,children:s(_,{className:"text-xs font-medium",colSpan:5,children:o("Topic {topic} · {count} subscriptions",{count:g.length,topic:h})})}),g.map(vt)]},h)})]})]})})})]}),e[0]=t,e[1]=c,e[2]=o,e[3]=r}else r=e[3];return r},Et=a=>{const e=U(67),{message:t,onReplay:c,replayingId:o}=a,r=G();let n,l,u,i,m,h,g,d,p,y;if(e[0]!==t.attempts||e[1]!==t.body||e[2]!==t.deadLettered||e[3]!==t.exportName||e[4]!==t.id||e[5]!==t.messageId||e[6]!==t.outcome||e[7]!==t.queue||e[8]!==r){const z=yt(t.body);l=j,h=`queues-message-${t.id}`;const B=t.exportName??t.queue;e[19]!==B?(g=s(_,{className:"font-mono text-xs",children:B}),e[19]=B,e[20]=g):g=e[20],e[21]!==t.messageId?(d=s(_,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:t.messageId,children:t.messageId}),e[21]=t.messageId,e[22]=d):d=e[22],e[23]!==t.attempts?(p=s(_,{className:"font-mono text-xs tabular-nums",children:t.attempts}),e[23]=t.attempts,e[24]=p):p=e[24];const J=`queues-outcome-${t.id}`;let w;e[25]!==t.outcome?(w=Nt(t.outcome),e[25]=t.outcome,e[26]=w):w=e[26];let M;e[27]!==t.outcome||e[28]!==J||e[29]!==w?(M=s(Ee,{"data-testid":J,variant:w,children:t.outcome}),e[27]=t.outcome,e[28]=J,e[29]=w,e[30]=M):M=e[30];let Q;e[31]!==t.deadLettered||e[32]!==t.id||e[33]!==r?(Q=t.deadLettered&&s(Ee,{"data-testid":`queues-dlq-${t.id}`,variant:"destructive",children:r("DLQ")}),e[31]=t.deadLettered,e[32]=t.id,e[33]=r,e[34]=Q):Q=e[34],e[35]!==M||e[36]!==Q?(y=s(_,{children:b("span",{className:"inline-flex items-center gap-1",children:[M,Q]})}),e[35]=M,e[36]=Q,e[37]=y):y=e[37],n=_,u="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",i=z,m=bt(z),e[0]=t.attempts,e[1]=t.body,e[2]=t.deadLettered,e[3]=t.exportName,e[4]=t.id,e[5]=t.messageId,e[6]=t.outcome,e[7]=t.queue,e[8]=r,e[9]=n,e[10]=l,e[11]=u,e[12]=i,e[13]=m,e[14]=h,e[15]=g,e[16]=d,e[17]=p,e[18]=y}else n=e[9],l=e[10],u=e[11],i=e[12],m=e[13],h=e[14],g=e[15],d=e[16],p=e[17],y=e[18];let x;e[38]!==n||e[39]!==u||e[40]!==i||e[41]!==m?(x=s(n,{className:u,title:i,children:m}),e[38]=n,e[39]=u,e[40]=i,e[41]=m,e[42]=x):x=e[42];let N;e[43]!==t.capturedAt?(N=it(t.capturedAt,"—"),e[43]=t.capturedAt,e[44]=N):N=e[44];let T;e[45]!==N?(T=s(_,{className:"text-xs text-muted-foreground tabular-nums",children:N}),e[45]=N,e[46]=T):T=e[46];const q=`queues-replay-${t.id}`,S=o!==null;let v;e[47]!==t.id||e[48]!==o||e[49]!==r?(v=o===t.id?r("Replaying…"):r("Replay"),e[47]=t.id,e[48]=o,e[49]=r,e[50]=v):v=e[50];let A;e[51]!==t.id||e[52]!==c||e[53]!==q||e[54]!==S||e[55]!==v?(A=s(_,{children:s(Ce,{"data-id":t.id,"data-testid":q,disabled:S,onClick:c,size:"xs",type:"button",variant:"outline",children:v})}),e[51]=t.id,e[52]=c,e[53]=q,e[54]=S,e[55]=v,e[56]=A):A=e[56];let I;return e[57]!==l||e[58]!==T||e[59]!==A||e[60]!==h||e[61]!==g||e[62]!==d||e[63]!==p||e[64]!==y||e[65]!==x?(I=b(l,{"data-testid":h,children:[g,d,p,y,x,T,A]}),e[57]=l,e[58]=T,e[59]=A,e[60]=h,e[61]=g,e[62]=d,e[63]=p,e[64]=y,e[65]=x,e[66]=I):I=e[66],I},Tt=a=>{const e=U(29),{hasError:t,messages:c,onClear:o,onReplay:r,replayingId:n}=a,l=G();let u;e[0]!==l?(u=l("Cloudflare Queues have no peek API, so this is what push consumers actually processed — not pending depth."),e[0]=l,e[1]=u):u=e[1];let i;e[2]!==u?(i=s("p",{className:"text-sm text-muted-foreground",children:u}),e[2]=u,e[3]=i):i=e[3];let m;e[4]!==l?(m=l("Clear the whole message log?"),e[4]=l,e[5]=m):m=e[5];const h=c.length===0;let g;e[6]!==l?(g=l("Clear log"),e[6]=l,e[7]=g):g=e[7];let d;e[8]!==o||e[9]!==m||e[10]!==h||e[11]!==g?(d=s("div",{className:"ml-auto",children:s(st,{confirmLabel:m,disabled:h,onConfirm:o,testId:"queues-clear",children:g})}),e[8]=o,e[9]=m,e[10]=h,e[11]=g,e[12]=d):d=e[12];let p;e[13]!==c.length||e[14]!==l?(p=c.length>0&&s(Ee,{"data-testid":"queues-count",variant:"secondary",children:l("{count} messages",{count:c.length})}),e[13]=c.length,e[14]=l,e[15]=p):p=e[15];let y;e[16]!==i||e[17]!==d||e[18]!==p?(y=b("div",{className:"flex flex-wrap items-center gap-2",children:[i,d,p]}),e[16]=i,e[17]=d,e[18]=p,e[19]=y):y=e[19];let x;e[20]!==t||e[21]!==c||e[22]!==r||e[23]!==n||e[24]!==l?(x=!t&&c.length===0?s(ve,{description:l("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:l("No consumed messages yet.")}):s(Oe,{className:"overflow-hidden py-0",children:s(ke,{className:"px-0",children:s(ot,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:b(Fe,{"data-testid":"queues-messages-table",children:[s(Ue,{children:b(j,{children:[s(C,{children:l("Export")}),s(C,{children:l("Message")}),s(C,{children:l("Attempts")}),s(C,{children:l("Outcome")}),s(C,{children:l("Body")}),s(C,{children:l("Captured")}),s(C,{})]})}),s(Je,{children:c.map(T=>s(Et,{message:T,onReplay:r,replayingId:n},T.id))})]})})})}),e[20]=t,e[21]=c,e[22]=r,e[23]=n,e[24]=l,e[25]=x):x=e[25];let N;return e[26]!==y||e[27]!==x?(N=b("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[y,x]}),e[26]=y,e[27]=x,e[28]=N):N=e[28],N},_t=a=>{const e=U(20),{batchMode:t,bodyText:c,delayText:o,onBatchModeChange:r,onBodyChange:n,onDelayChange:l,onSelectExport:u,onSend:i,queues:m,selectedExportName:h,sending:g}=a,d=G();let p;e[0]!==d?(p=d("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=d,e[1]=p):p=e[1];let y;e[2]!==p?(y=s("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=y):y=e[3];let x;e[4]!==t||e[5]!==c||e[6]!==o||e[7]!==r||e[8]!==n||e[9]!==l||e[10]!==u||e[11]!==i||e[12]!==m||e[13]!==h||e[14]!==g||e[15]!==d?(x=m.length===0?s(ve,{description:d("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:d("No queues to send to")}):b(Pe,{children:[b("div",{className:"flex flex-wrap items-center gap-2",children:[b("select",{"aria-label":d("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:u,value:h,children:[m.map(wt),[...Qe(m).topics].map(T=>{const[q,S]=T;return s("option",{value:je(q),children:d("{topic} (topic → {count} subscriptions)",{count:S.length,topic:q})},q)})]}),s(nt,{"aria-label":d("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:l,placeholder:d("Delay (s)"),type:"number",value:o}),b("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[s("input",{checked:t,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:r,type:"checkbox"}),d("Send as batch (JSON array)")]}),s(Ce,{className:"ml-auto","data-testid":"queues-send-button",disabled:g||h==="",onClick:i,type:"button",children:d(g?"Sending…":"Send message")})]}),s(lt,{"aria-label":d("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:n,placeholder:t?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:c})]}),e[4]=t,e[5]=c,e[6]=o,e[7]=r,e[8]=n,e[9]=l,e[10]=u,e[11]=i,e[12]=m,e[13]=h,e[14]=g,e[15]=d,e[16]=x):x=e[16];let N;return e[17]!==y||e[18]!==x?(N=b("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[y,x]}),e[17]=y,e[18]=x,e[19]=N):N=e[19],N},es=a=>{const e=U(55),{limit:t}=a,c=t??pt,o=et(),r=G(),[n,l]=R("declared"),[u,i]=R(null);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={},e[0]=m):m=e[0];const{data:h,error:g,errorSource:d}=De(W.listQueues,m);let p;e[1]!==c?(p={limit:c},e[1]=c,e[2]=p):p=e[2];const{data:y,error:x,errorSource:N,poll:T,refetch:q}=De(W.getQueueMessages,p),S=Array.isArray(h?.queues)?[...h.queues].toSorted(Qt):[],v=y?.entries??[],{deadLetteredCount:A,queuesWithoutDlq:I,showReliabilityWarning:z}=ut(S,v),[B,J]=R(""),[w,M]=R(""),[Q,Ge]=R(""),[P,ze]=R(!1),[oe,Ae]=R(!1),[le,Ie]=R(null),{topics:Me}=Qe(S),Le=[...S.map(At),...[...Me.keys()].map(It)],H=Le.includes(B)?B:Le[0]??"",Re=n==="messages"?x:g,He=n==="messages"?N:d,ce=Re??u,ie=Re===null?u:He;ct(T,n==="messages");const Ve=async()=>{i(null);const f=H;if(f==="")return;let E=null;const Ne=w.trim();if(Ne!=="")try{E=JSON.parse(Ne)}catch{i(r("Body must be valid JSON."));return}let qe;const Be=Q.trim();if(Be!==""){const L=Number(Be);if(!Number.isFinite(L)||L<0){i(r("Delay must be a non-negative number of seconds."));return}qe=L}if(P&&!Array.isArray(E)){i(r("Batch mode needs a JSON array body — each element is enqueued as one message."));return}Ae(!0);const Ze=mt(f,Me).map(L=>P?{batch:E,delaySeconds:qe,exportName:L}:{body:E,delaySeconds:qe,exportName:L});try{i(await ht(o,Ze,r)),q()}catch(L){i(ne(L))}Ae(!1)};let V;e[3]!==o||e[4]!==q?(V=async f=>{i(null),Ie(f);try{await o.query(gt,{id:f},Te("")),q()}catch(E){i(ne(E))}Ie(null)},e[3]=o,e[4]=q,e[5]=V):V=e[5];const de=V;let X;e[6]!==o||e[7]!==q?(X=async()=>{i(null);try{await o.query(xt,{},Te("")),q()}catch(f){i(ne(f))}},e[6]=o,e[7]=q,e[8]=X):X=e[8];const ue=X;let Y;e[9]===Symbol.for("react.memo_cache_sentinel")?(Y=f=>{const E=f.currentTarget.dataset.tab;(E==="declared"||E==="messages"||E==="send")&&l(E)},e[9]=Y):Y=e[9];const Xe=Y;let K;e[10]===Symbol.for("react.memo_cache_sentinel")?(K=f=>{J(f.currentTarget.value)},e[10]=K):K=e[10];const me=K;let Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=f=>{M(f.currentTarget.value)},e[11]=Z):Z=e[11];const pe=Z;let ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=f=>{Ge(f.currentTarget.value)},e[12]=ee):ee=e[12];const fe=ee;let te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=f=>{ze(f.currentTarget.checked)},e[13]=te):te=e[13];const he=te,ge=()=>{Se(Ve())};let se;e[14]!==de?(se=f=>{const{id:E}=f.currentTarget.dataset;E!==void 0&&Se(de(E))},e[14]=de,e[15]=se):se=e[15];const xe=se;let ae;e[16]!==ue?(ae=()=>{Se(ue())},e[16]=ue,e[17]=ae):ae=e[17];const ye=ae,Ye="flex flex-col gap-6",Ke="lunora-queues-panel";let D;e[18]!==r||e[19]!==n?(D=s("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(f=>s(Ce,{"aria-selected":n===f,"data-tab":f,"data-testid":`queues-tab-${f}`,onClick:Xe,role:"tab",size:"sm",type:"button",variant:n===f?"secondary":"ghost",children:qt(f,r)},f))}),e[18]=r,e[19]=n,e[20]=D):D=e[20];let $;e[21]!==ce||e[22]!==ie?($=ce!==null&&s(at,{error:ie,testId:"queues-error"}),e[21]=ce,e[22]=ie,e[23]=$):$=e[23];const be=z&&s(rt,{icon:s("span",{"aria-hidden":"true",className:"text-base leading-none",children:"⚠"}),testId:"queues-dlq-warning",variant:"warning",children:b("div",{className:"flex flex-col gap-1",children:[I.length>0&&b(Pe,{children:[s("p",{className:"font-medium",children:r("No dead-letter queue on {queues}.",{queues:I.map(Mt).join(", ")})}),s("p",{className:"text-muted-foreground",children:r("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),A>0&&s("p",{className:I.length>0?"text-muted-foreground":"font-medium",children:A===1?r("1 message was recently dead-lettered."):r("{count} messages were recently dead-lettered.",{count:A})})]})});let O;e[24]!==S||e[25]!==h||e[26]!==n?(O=n==="declared"&&s(St,{loaded:h!==void 0,queues:S}),e[24]=S,e[25]=h,e[26]=n,e[27]=O):O=e[27];let k;e[28]!==v||e[29]!==x||e[30]!==ye||e[31]!==xe||e[32]!==le||e[33]!==n?(k=n==="messages"&&s(Tt,{hasError:x!==null,messages:v,onClear:ye,onReplay:xe,replayingId:le}),e[28]=v,e[29]=x,e[30]=ye,e[31]=xe,e[32]=le,e[33]=n,e[34]=k):k=e[34];let F;e[35]!==P||e[36]!==w||e[37]!==Q||e[38]!==he||e[39]!==pe||e[40]!==fe||e[41]!==me||e[42]!==ge||e[43]!==S||e[44]!==H||e[45]!==oe||e[46]!==n?(F=n==="send"&&s(_t,{batchMode:P,bodyText:w,delayText:Q,onBatchModeChange:he,onBodyChange:pe,onDelayChange:fe,onSelectExport:me,onSend:ge,queues:S,selectedExportName:H,sending:oe}),e[35]=P,e[36]=w,e[37]=Q,e[38]=he,e[39]=pe,e[40]=fe,e[41]=me,e[42]=ge,e[43]=S,e[44]=H,e[45]=oe,e[46]=n,e[47]=F):F=e[47];let re;return e[48]!==D||e[49]!==$||e[50]!==be||e[51]!==O||e[52]!==k||e[53]!==F?(re=b("div",{className:Ye,"data-testid":Ke,children:[D,$,be,O,k,F]}),e[48]=D,e[49]=$,e[50]=be,e[51]=O,e[52]=k,e[53]=F,e[54]=re):re=e[54],re};function Ct(a){return s(We,{queue:a},a.exportName)}function vt(a){return s(We,{queue:a},a.exportName)}function wt(a){return s("option",{value:a.exportName,children:a.exportName},a.exportName)}function Qt(a,e){return a.exportName.localeCompare(e.exportName)}function At(a){return a.exportName}function It(a){return je(a)}function Mt(a){return a.name}export{es as default};
@@ -0,0 +1 @@
1
+ import{E as g}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{B as N}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as v,a as b}from"../packem_shared/card-By2O8ULa.mjs";import{E as y}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T,a as w,b as m,c as s,d as S,e as n}from"../packem_shared/table-D0SBiDu-.mjs";import{u as A}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{useT as E}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as C}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsx as e,jsxs as o}from"react/jsx-runtime";const R={active:"default",failing:"destructive",idle:"secondary"},I=a=>a===void 0?"—":`${new Date(a).toISOString().slice(0,19).replace("T"," ")} UTC`,$=a=>{const r=a.runs+a.suppressed;return r===0?void 0:Math.round(a.suppressed/r*100)},U=({initialShardKey:a=""})=>{const r=E(),{data:l,error:p,errorSource:u,liveError:f}=A(C.listReactors,{},{live:!0,shardKey:a}),x=l!==void 0,d=Array.isArray(l?.reactors)?l.reactors:[];let i;x&&d.length===0?i=e(y,{description:r("No reactor is declared in this deployment. Export an onQueryChange(select, handler) from lunora/ to run server-side logic when a query's result changes."),testId:"reactors-empty",title:r("No reactors declared")}):i=e(v,{className:"overflow-hidden py-0",children:e(b,{className:"px-0",children:o(T,{"data-testid":"reactors-table",children:[e(w,{children:o(m,{children:[e(s,{children:r("Reactor")}),e(s,{children:r("State")}),e(s,{children:r("Ran")}),e(s,{children:r("Suppressed")}),e(s,{children:r("Errors")}),e(s,{children:r("Watches")}),e(s,{children:r("Last dispatch")})]})}),e(S,{children:d.map(t=>{const h=$(t);return o(m,{"data-testid":`reactors-row-${t.path}`,children:[e(n,{className:"font-mono text-xs",children:t.path}),e(n,{children:e(N,{"data-testid":`reactors-state-${t.path}`,variant:R[t.state],children:t.state})}),e(n,{className:"font-mono text-xs",children:t.runs}),o(n,{className:"font-mono text-xs text-muted-foreground",children:[t.suppressed,h===void 0?"":` (${String(h)}%)`]}),e(n,{className:"font-mono text-xs",children:t.errors===0?e("span",{className:"text-muted-foreground",children:"0"}):e("span",{className:"text-destructive",children:t.errors})}),e(n,{className:"font-mono text-xs text-muted-foreground",children:t.tables===void 0||t.tables.length===0?"—":t.tables.join(", ")}),e(n,{className:"font-mono text-xs text-muted-foreground",children:I(t.lastRanAt)})]},t.path)})})]})})});const c=d.filter(t=>t.state==="failing");return o("div",{className:"flex flex-col gap-6","data-testid":"lunora-reactors-panel",children:[p!==null&&e(g,{error:u,testId:"reactors-error"}),e("p",{className:"text-sm text-muted-foreground",children:r("A reactor runs after a write flush, but only when the result of the query it watches actually changed — a trigger fires on a row write, a reactor fires on a result changing. Suppressed dispatches are the ones where the read re-ran and nothing had moved.")}),c.length>0&&e("div",{className:"flex flex-col gap-2","data-testid":"reactors-failing",children:c.map(t=>o("p",{className:"text-xs text-destructive",role:"alert",children:[e("span",{className:"font-mono",children:t.path}),": ",t.lastError??r("last dispatch failed")]},t.path))}),f!==void 0&&e("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"reactors-live-error",role:"alert",children:r("Live updates unavailable; showing the last reading.")}),i]})};export{U as default};
@@ -0,0 +1 @@
1
+ import{c as U}from"react/compiler-runtime";import{E as F}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{B as M}from"../packem_shared/badge-r_5B4LHP.mjs";import{a as _,C as j}from"../packem_shared/card-By2O8ULa.mjs";import{E as D}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as O,a as $,b as E,c as R,d as G,e as S}from"../packem_shared/table-D0SBiDu-.mjs";import{u as L}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{useT as Q}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as q}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsx as t,jsxs as a}from"react/jsx-runtime";const H=["read","insert","update","delete"],z=(e,r)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[r],J=e=>{const r=new Map;for(const s of e){const l=r.get(s.table)??{operations:new Set,procedures:new Set,table:s.table};l.operations.add(s.on),l.procedures.add(s.procedure),r.set(s.table,l)}return[...r.values()].toSorted((s,l)=>s.table.localeCompare(l.table))},oe=()=>{const e=U(49),r=Q();let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={},e[0]=s):s=e[0];const{data:l,error:C,errorSource:I}=L(q.rlsPolicies,s),c=l!==void 0;let p,n,m,o,f,h,u,b,i;if(e[1]!==l||e[2]!==C||e[3]!==I||e[4]!==c||e[5]!==r){const k=J(Array.isArray(l?.policies)?l.policies:[]);let v;e[15]!==l?(v=Array.isArray(l?.roles)?l.roles:[],e[15]=l,e[16]=v):v=e[16],n=v,u="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==C||e[18]!==I?(i=C!==null&&t(F,{error:I,testId:"rls-error"}),e[17]=C,e[18]=I,e[19]=i):i=e[19],h="flex flex-col gap-2",p=j,m="overflow-hidden py-0";let A;e[20]!==r?(A=r("Policies"),e[20]=r,e[21]=A):A=e[21],e[22]!==A?(o=t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:A})}),e[22]=A,e[23]=o):o=e[23],f=c&&k.length===0?t(D,{description:r("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:r("No policies defined")}):t(_,{className:"px-0",children:a(O,{"data-testid":"rls-policies-table",children:[t($,{children:a(E,{children:[t(R,{children:r("Table")}),H.map(d=>t(R,{children:z(r,d)},d)),t(R,{children:r("Guarded by")})]})}),t(G,{children:k.map(d=>a(E,{"data-testid":`rls-table-${d.table}`,children:[t(S,{className:"font-mono text-xs",children:d.table}),H.map(B=>t(S,{children:d.operations.has(B)?t(M,{variant:"secondary",children:r("Guarded")}):t("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"—"})},B)),t(S,{className:"font-mono text-xs text-muted-foreground",children:[...d.procedures].join(", ")})]},d.table))})]})}),e[1]=l,e[2]=C,e[3]=I,e[4]=c,e[5]=r,e[6]=p,e[7]=n,e[8]=m,e[9]=o,e[10]=f,e[11]=h,e[12]=u,e[13]=b,e[14]=i}else p=e[6],n=e[7],m=e[8],o=e[9],f=e[10],h=e[11],u=e[12],b=e[13],i=e[14];let x;e[24]!==p||e[25]!==m||e[26]!==o||e[27]!==f?(x=a(p,{className:m,children:[o,f]}),e[24]=p,e[25]=m,e[26]=o,e[27]=f,e[28]=x):x=e[28];let N;e[29]!==h||e[30]!==x?(N=t("section",{className:h,children:x}),e[29]=h,e[30]=x,e[31]=N):N=e[31];let y;e[32]!==r?(y=r("Roles"),e[32]=r,e[33]=y):y=e[33];let g;e[34]!==y?(g=t("header",{className:"border-b border-border px-4 py-3",children:t("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[34]=y,e[35]=g):g=e[35];let T;e[36]!==c||e[37]!==n||e[38]!==r?(T=c&&n.length===0?t(D,{description:r("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:r("No roles defined")}):t(_,{className:"px-0",children:a(O,{"data-testid":"rls-roles-table",children:[t($,{children:a(E,{children:[t(R,{children:r("Role")}),t(R,{children:r("Description")}),t(R,{children:r("Permissions")})]})}),t(G,{children:n.map(V)})]})}),e[36]=c,e[37]=n,e[38]=r,e[39]=T):T=e[39];let w;e[40]!==g||e[41]!==T?(w=t("section",{className:"flex flex-col gap-2",children:a(j,{className:"overflow-hidden py-0",children:[g,T]})}),e[40]=g,e[41]=T,e[42]=w):w=e[42];let P;return e[43]!==w||e[44]!==u||e[45]!==b||e[46]!==i||e[47]!==N?(P=a("div",{className:u,"data-testid":b,children:[i,N,w]}),e[43]=w,e[44]=u,e[45]=b,e[46]=i,e[47]=N,e[48]=P):P=e[48],P};function K(e){return t(M,{variant:"outline",children:e},e)}function V(e){return a(E,{"data-testid":`rls-role-${e.name}`,children:[t(S,{className:"font-mono text-xs",children:e.name}),t(S,{className:"text-muted-foreground",children:e.description??""}),t(S,{children:e.permissions.length===0?t("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"—"}):t("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(K)})})]},e.name)}export{oe as default};
@@ -0,0 +1 @@
1
+ import{c as D}from"react/compiler-runtime";import{useState as F}from"react";import{B as Y}from"../packem_shared/button-q0UYSmrn.mjs";import{useT as M}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{useLunora as V}from"@lunora/react";import{ConfirmButton as G}from"../packem_shared/ConfirmButton-DU4p72Er.mjs";import{B as O}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as P,a as R}from"../packem_shared/card-By2O8ULa.mjs";import{E as W}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as Q,a as K,b as q,c as x,d as z,e as b}from"../packem_shared/table-D0SBiDu-.mjs";import{b as H}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{f as A,b as U,h as j}from"../packem_shared/internal-BXEjuLPN.mjs";import{jsxs as m,jsx as t}from"react/jsx-runtime";import{useAutoRefresh as X}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs";import{ScheduledJobs as ee}from"../packem_shared/ScheduledJobs-zSeU_6cN.mjs";const te={kind:"idle"},re=(n,e,c)=>c!==void 0?c:e===void 0?a=>n.runCronJob(a):void 0,le=({loadCronJobs:n,runCronJob:e}={})=>{const c=V(),a=M(),[p,o]=F({}),s=H(["lunora-cron-jobs",n?"custom":"default"],()=>(n??(()=>c.getCronJobs()))()),{data:r,error:y}=s,h=re(c,n,e),i=async l=>{if(h!==void 0){o(d=>({...d,[l]:{kind:"running"}}));try{await h(l),o(d=>({...d,[l]:{kind:"ok"}})),s.refetch()}catch(d){o(g=>({...g,[l]:{kind:"error",message:U(d)}}))}}};return m("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[y!==null&&t("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:y}),r?.length===0&&t(W,{description:a("Triggers declared with the cronJobs() builder appear here."),icon:m("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:a("No cron triggers.")}),r!==void 0&&r.length>0&&t(P,{className:"overflow-hidden py-0",children:t(R,{className:"px-0",children:m(Q,{"data-testid":"cron-table",children:[t(K,{children:m(q,{children:[t(x,{children:a("name")}),t(x,{children:a("schedule")}),t(x,{children:a("target")}),t(x,{children:a("shard")}),h!==void 0&&t(x,{"aria-label":a("Actions")})]})}),t(z,{children:r.map(l=>{const d=p[l.name]??te;return m(q,{"data-testid":`cron-row-${l.name}`,children:[t(b,{children:l.name}),t(b,{className:"font-mono text-xs tabular-nums",children:l.cron}),t(b,{children:m("span",{className:"flex items-center gap-2",children:[l.workflow===void 0?t(O,{variant:"outline",children:a("function")}):t(O,{variant:"secondary",children:a("workflow")}),t("span",{className:"font-mono text-xs",children:l.workflow??l.functionPath})]})}),t(b,{children:l.shardKey??""}),h!==void 0&&t(b,{className:"text-right",children:m("span",{className:"flex items-center justify-end gap-2",children:[d.kind==="ok"&&t("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${l.name}`,children:a("ran")}),d.kind==="error"&&t("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${l.name}`,role:"alert",children:d.message}),t(G,{confirmLabel:a("Run now?"),disabled:d.kind==="running",onConfirm:()=>{A(i(l.name))},testId:`cron-run-${l.name}`,children:d.kind==="running"?a("Running…"):a("Run now")})]})})]},`${l.cron}:${l.name}`)})})]})})})]})},se=n=>Number.isFinite(n)?j(n,"—"):"—",ne=n=>{const e=D(34);let c;e[0]!==n?(c=n===void 0?{}:n,e[0]=n,e[1]=c):c=e[1];const{loadJobs:a,removeJob:p,retryJob:o}=c,s=V(),r=M();let y;e[2]===Symbol.for("react.memo_cache_sentinel")?(y=["lunora-dead-jobs"],e[2]=y):y=e[2];let h;e[3]!==s||e[4]!==a?(h=async()=>(await(a??(()=>s.listDeadJobs()))()).toSorted(oe),e[3]=s,e[4]=a,e[5]=h):h=e[5];const i=H(y,h),l=i.data,[d,g]=F(void 0),N=i.error??d,f=a===void 0;let C;e[6]!==s||e[7]!==f||e[8]!==o?(C=o??(f?u=>s.retryDeadJob(u):void 0),e[6]=s,e[7]=f,e[8]=o,e[9]=C):C=e[9];const v=C;let k;e[10]!==s||e[11]!==f||e[12]!==p?(k=p??(f?u=>s.removeDeadJob(u):void 0),e[10]=s,e[11]=f,e[12]=p,e[13]=k):k=e[13];const S=k;let $;e[14]!==i?($=()=>i.poll(),e[14]=i,e[15]=$):$=e[15],X($,!0);let I;e[16]!==i?(I=async u=>{g(void 0);try{await u,i.refetch()}catch(Z){g(U(Z))}},e[16]=i,e[17]=I):I=e[17];const L=I,T=v!==void 0||S!==void 0;let J;e[18]!==N?(J=N!==void 0&&t("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:N}),e[18]=N,e[19]=J):J=e[19];let w;e[20]!==l?.length||e[21]!==r?(w=l?.length===0&&t(W,{description:r("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:r("No dead-letter jobs.")}),e[20]=l?.length,e[21]=r,e[22]=w):w=e[22];let _;e[23]!==L||e[24]!==T||e[25]!==l||e[26]!==S||e[27]!==v||e[28]!==r?(_=l!==void 0&&l.length>0&&t(P,{className:"overflow-hidden py-0",children:t(R,{className:"px-0",children:m(Q,{"data-testid":"dlq-table",children:[t(K,{children:m(q,{children:[t(x,{children:r("function")}),t(x,{children:r("attempts")}),t(x,{children:r("last tried")}),t(x,{children:r("pool")}),t(x,{children:r("shard")}),t(x,{children:r("id")}),T&&t(x,{"aria-label":r("Actions")})]})}),t(z,{children:l.map(u=>m(q,{"data-testid":`dlq-row-${u.id}`,children:[t(b,{className:"font-mono text-xs",children:u.workflow??u.functionPath}),t(b,{className:"tabular-nums",children:u.attempts??0}),t(b,{className:"text-muted-foreground tabular-nums",children:se(u.scheduledFor)}),t(b,{className:"font-mono text-xs",children:u.pool??""}),t(b,{children:u.shardKey??""}),t(b,{className:"font-mono text-xs",children:u.id}),T&&t(b,{className:"text-right",children:m("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&t(Y,{"data-testid":`dlq-retry-${u.id}`,onClick:()=>{A(L(v(u.id)))},size:"sm",type:"button",variant:"outline",children:r("Retry")}),S!==void 0&&t(G,{confirmLabel:r("Drop job?"),onConfirm:()=>{A(L(S(u.id)))},testId:`dlq-remove-${u.id}`,children:r("Drop")})]})})]},u.id))})]})})}),e[23]=L,e[24]=T,e[25]=l,e[26]=S,e[27]=v,e[28]=r,e[29]=_):_=e[29];let B;return e[30]!==_||e[31]!==J||e[32]!==w?(B=m("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[J,w,_]}),e[30]=_,e[31]=J,e[32]=w,e[33]=B):B=e[33],B};function oe(n,e){return(e.attempts??0)-(n.attempts??0)}const E=n=>{const e=D(8),{label:c,testId:a,value:p}=n;let o;e[0]!==c?(o=t("span",{className:"text-xs text-muted-foreground",children:c}),e[0]=c,e[1]=o):o=e[1];let s;e[2]!==a||e[3]!==p?(s=t("span",{className:"text-2xl font-semibold tabular-nums","data-testid":a,children:p}),e[2]=a,e[3]=p,e[4]=s):s=e[4];let r;return e[5]!==o||e[6]!==s?(r=t(P,{className:"flex-1 py-0",children:m(R,{className:"flex flex-col gap-1 p-4",children:[o,s]})}),e[5]=o,e[6]=s,e[7]=r):r=e[7],r},ae=n=>{const e=D(25);let c;e[0]!==n?(c=n===void 0?{}:n,e[0]=n,e[1]=c):c=e[1];const{loadStatus:a}=c,p=V(),o=M(),s=a===void 0;let r;e[2]!==s?(r=["lunora-scheduler-status",s],e[2]=s,e[3]=r):r=e[3];let y;e[4]!==p||e[5]!==a?(y=async()=>{const k=await(a??(()=>p.schedulerStatus()))();return{...k,pools:k.pools.toSorted(ie)}},e[4]=p,e[5]=a,e[6]=y):y=e[6];const h=H(r,y),{data:i,error:l}=h;let d;e[7]!==h?(d=()=>h.poll(),e[7]=h,e[8]=d):d=e[8],X(d,!0);let g;e[9]!==l?(g=l!==null&&t("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:l}),e[9]=l,e[10]=g):g=e[10];let N;e[11]!==i||e[12]!==o?(N=i!==void 0&&m("div",{className:"flex gap-3","data-testid":"pools-totals",children:[t(E,{label:o("backlog"),testId:"pools-backlog",value:i.backlog}),t(E,{label:o("in flight"),testId:"pools-inflight",value:i.inFlight}),t(E,{label:o("pools"),testId:"pools-count",value:i.pools.length})]}),e[11]=i,e[12]=o,e[13]=N):N=e[13];let f;e[14]!==i?.pools.length||e[15]!==o?(f=i?.pools.length===0&&t(W,{description:o("Pools created with createWorkpool appear here once they have activity."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:o("No workpools.")}),e[14]=i?.pools.length,e[15]=o,e[16]=f):f=e[16];let C;e[17]!==i||e[18]!==o?(C=i!==void 0&&i.pools.length>0&&t(P,{className:"overflow-hidden py-0",children:t(R,{className:"px-0",children:m(Q,{"data-testid":"pools-table",children:[t(K,{children:m(q,{children:[t(x,{children:o("pool")}),t(x,{children:o("queued")}),t(x,{children:o("in flight")}),t(x,{children:o("max concurrency")})]})}),t(z,{children:i.pools.map(de)})]})})}),e[17]=i,e[18]=o,e[19]=C):C=e[19];let v;return e[20]!==g||e[21]!==N||e[22]!==f||e[23]!==C?(v=m("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[g,N,f,C]}),e[20]=g,e[21]=N,e[22]=f,e[23]=C,e[24]=v):v=e[24],v};function ie(n,e){return e.queued-n.queued}function de(n){return m(q,{"data-testid":`pools-row-${n.name}`,children:[t(b,{className:"font-mono text-xs",children:n.name}),t(b,{className:"tabular-nums",children:n.queued}),m(b,{className:"tabular-nums",children:[n.inFlight," / ",n.maxConcurrency]}),t(b,{className:"tabular-nums",children:n.maxConcurrency})]},n.name)}const ce=["jobs","dead","pools","cron"],Ie=n=>{const e=D(41);let c;e[0]!==n?(c=n===void 0?{}:n,e[0]=n,e[1]=c):c=e[1];const{loadCronJobs:a,scheduledCancel:p,scheduledLoad:o}=c,s=M(),[r,y]=F("jobs");let h;e[2]!==s?(h=s("Cron triggers"),e[2]=s,e[3]=h):h=e[3];let i;e[4]!==s?(i=s("Dead letter"),e[4]=s,e[5]=i):i=e[5];let l;e[6]!==s?(l=s("Scheduled jobs"),e[6]=s,e[7]=l):l=e[7];let d;e[8]!==s?(d=s("Pools"),e[8]=s,e[9]=d):d=e[9];let g;e[10]!==h||e[11]!==i||e[12]!==l||e[13]!==d?(g={cron:h,dead:i,jobs:l,pools:d},e[10]=h,e[11]=i,e[12]=l,e[13]=d,e[14]=g):g=e[14];const N=g;let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=w=>{y(w.currentTarget.dataset.view)},e[15]=f):f=e[15];const C=f;let v;e[16]!==s?(v=s("Schedule view"),e[16]=s,e[17]=v):v=e[17];let k;e[18]!==r||e[19]!==N?(k=ce.map(w=>t(Y,{"aria-selected":r===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:C,role:"tab",size:"sm",type:"button",variant:r===w?"default":"outline",children:N[w]},w)),e[18]=r,e[19]=N,e[20]=k):k=e[20];let S;e[21]!==v||e[22]!==k?(S=t("div",{"aria-label":v,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:k}),e[21]=v,e[22]=k,e[23]=S):S=e[23];let $;e[24]!==p||e[25]!==o||e[26]!==r?($=r==="jobs"&&t(ee,{cancelJob:p,loadJobs:o}),e[24]=p,e[25]=o,e[26]=r,e[27]=$):$=e[27];let I;e[28]!==r?(I=r==="dead"&&t(ne,{}),e[28]=r,e[29]=I):I=e[29];let L;e[30]!==r?(L=r==="pools"&&t(ae,{}),e[30]=r,e[31]=L):L=e[31];let T;e[32]!==a||e[33]!==r?(T=r==="cron"&&t(le,{loadCronJobs:a}),e[32]=a,e[33]=r,e[34]=T):T=e[34];let J;return e[35]!==S||e[36]!==$||e[37]!==I||e[38]!==L||e[39]!==T?(J=m("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[S,$,I,L,T]}),e[35]=S,e[36]=$,e[37]=I,e[38]=L,e[39]=T,e[40]=J):J=e[40],J};export{Ie as SchedulePanel};
@@ -0,0 +1 @@
1
+ import{c as f}from"react/compiler-runtime";import{B as m,E as u}from"../packem_shared/bar-chart-BCsEIQoQ.mjs";import{jsx as s}from"react/jsx-runtime";const d={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},b=n=>{const e=f(6),{data:o}=n;let t,r;if(e[0]!==o){r=Symbol.for("react.early_return_sentinel");e:{const c=o.slice(-16);if(c.length<3){r=null;break e}t=c.map(h)}e[0]=o,e[1]=t,e[2]=r}else t=e[1],r=e[2];if(r!==Symbol.for("react.early_return_sentinel"))return r;const i=t;let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s(m,{dataKey:"value"}),e[3]=a):a=e[3];let l;return e[4]!==i?(l=s("div",{"aria-hidden":"true",className:"h-8 w-28",children:s(u,{animationType:"none",barCategoryGap:1,className:"h-8 w-full",config:d,data:i,children:a})}),e[4]=i,e[5]=l):l=e[5],l};function h(n,e){return{index:e,value:n}}export{b as default};
@@ -0,0 +1 @@
1
+ import{c as y}from"react/compiler-runtime";import{E as N}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{B as R}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as T,a as k}from"../packem_shared/card-By2O8ULa.mjs";import{E as S}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as w,a as C,b as g,c as f,d as $,e as p}from"../packem_shared/table-D0SBiDu-.mjs";import{u as A}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{useT as E}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as v}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{jsxs as u,jsx as r}from"react/jsx-runtime";const I=(e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],b={delete:2,list:3,read:0,write:1},O=e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||b[t.on]-b[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),M=()=>{const e=y(14),t=E();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];const{data:l,error:d,errorSource:i}=A(v.storageRules,a),h=l!==void 0;let n;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==t){const x=O(Array.isArray(l?.rules)?l.rules:[]);let c;e[7]!==d||e[8]!==i?(c=d!==null&&r(N,{error:i,testId:"storage-rules-error"}),e[7]=d,e[8]=i,e[9]=c):c=e[9];let s;e[10]!==t?(s=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=s):s=e[11];let m;e[12]!==s?(m=r("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s}),e[12]=s,e[13]=m):m=e[13],n=u("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[c,m,h&&x.length===0?r(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):r(T,{className:"overflow-hidden py-0",children:r(k,{className:"px-0",children:u(w,{"data-testid":"storage-rules-table",children:[r(C,{children:u(g,{children:[r(f,{children:t("Bucket")}),r(f,{children:t("Operation")}),r(f,{children:t("Key prefix")}),r(f,{children:t("Guarded by")})]})}),r($,{children:x.map(o=>u(g,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[r(p,{className:"font-mono text-xs",children:o.bucket}),r(p,{children:r(R,{variant:"secondary",children:I(t,o.on)})}),r(p,{className:"font-mono text-xs",children:o.prefix??r("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),r(p,{className:"font-mono text-xs text-muted-foreground",children:o.procedure})]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`))})]})})})]}),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=t,e[6]=n}else n=e[6];return n};export{M as default};
@@ -0,0 +1 @@
1
+ import{c as R}from"react/compiler-runtime";import{E as j}from"../packem_shared/error-alert-D-ftqyo-.mjs";import{ShardInput as E}from"../packem_shared/ShardInput-C6mjgAh4.mjs";import{B as A}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as M,a as $}from"../packem_shared/card-By2O8ULa.mjs";import{E as B}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as _,a as D,b as T,c as y,d as H,e as S}from"../packem_shared/table-D0SBiDu-.mjs";import{u as P}from"../packem_shared/use-admin-query-I1uILsUP.mjs";import{useAutoRefresh as F}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs";import{u as L}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as O}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as W}from"../packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{k as q}from"../packem_shared/internal-BXEjuLPN.mjs";import{jsxs as a,jsx as t}from"react/jsx-runtime";const w=80,G=c=>{if(c===void 0)return"";const e=JSON.stringify(c,q);return e.length>w?`${e.slice(0,w)}…`:e},J=c=>{const e=[];for(const o of c){const n=o.id.toString();if(o.subscriptions.length===0){e.push({admin:o.admin,connectionId:o.id,key:`c${n}`,subscription:null});continue}o.subscriptions.forEach((u,r)=>{e.push({admin:o.admin,connectionId:o.id,key:`c${n}-s${r.toString()}`,subscription:u})})}return e},C=t("span",{className:"text-muted-foreground",children:"—"}),ae=c=>{const e=R(22),{initialShardKey:o}=c,n=O(),{queryShardKey:u,setShardKey:r,shardKey:m}=L(o);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let f;e[1]!==u?(f={keepPreviousData:!0,shardKey:u},e[1]=u,e[2]=f):f=e[2];const{data:s,error:i,errorSource:h,poll:K}=P(W.listSubscriptions,p,f);F(K,!0);let b;if(e[3]!==i||e[4]!==h||e[5]!==s||e[6]!==r||e[7]!==m||e[8]!==n){const N=s===void 0?[]:J(s.connections);let l;e[10]!==r||e[11]!==m?(l=t(E,{onChange:r,testId:"subs-shard-input",value:m}),e[10]=r,e[11]=m,e[12]=l):l=e[12];let d;e[13]!==s||e[14]!==n?(d=s!==void 0&&a("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[t(A,{variant:"secondary",children:n("{count} connections",{count:s.totalConnections})}),t(A,{variant:"secondary",children:n("{count} subscriptions",{count:s.totalSubscriptions})})]}),e[13]=s,e[14]=n,e[15]=d):d=e[15];let g;e[16]!==l||e[17]!==d?(g=a("div",{className:"flex flex-wrap items-center gap-2",children:[l,d]}),e[16]=l,e[17]=d,e[18]=g):g=e[18];let x;e[19]!==i||e[20]!==h?(x=i!==null&&t(j,{error:h,testId:"subs-error"}),e[19]=i,e[20]=h,e[21]=x):x=e[21],b=a("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,x,i===null&&s!==void 0&&N.length===0&&t(B,{description:n("Active WebSocket subscriptions on this shard."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),i===null&&N.length>0&&t(M,{className:"overflow-hidden py-0",children:t($,{className:"px-0",children:a(_,{"data-testid":"subs-table",children:[t(D,{children:a(T,{children:[t(y,{children:n("Connection")}),t(y,{children:n("Function path")}),t(y,{children:n("Table")}),t(y,{children:n("Arguments")})]})}),t(H,{children:N.map(v=>{const{subscription:k}=v,I=G(k?.args);return a(T,{"data-testid":"subs-row",children:[t(S,{className:"font-medium tabular-nums",children:a("span",{className:"inline-flex items-center gap-1.5",children:["#",v.connectionId,v.admin&&t(A,{variant:"outline",children:n("admin")})]})}),t(S,{className:"font-mono text-xs",children:k?.functionPath??C}),t(S,{children:k?.table??C}),t(S,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:I||void 0,children:I||C})]},v.key)})})]})})})]}),e[3]=i,e[4]=h,e[5]=s,e[6]=r,e[7]=m,e[8]=n,e[9]=b}else b=e[9];return b};export{ae as default};