@lunora/studio 1.0.0-alpha.9 → 1.0.0-alpha.91

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 (314) hide show
  1. package/LICENSE.md +6 -0
  2. package/dist/index.d.ts +822 -781
  3. package/dist/index.js +1 -41
  4. package/dist/mount.d.ts +10 -10
  5. package/dist/mount.js +1 -26
  6. package/dist/packem_chunks/AdvisorHealthPanel.js +1 -0
  7. package/dist/packem_chunks/ApiTab.js +1 -0
  8. package/dist/packem_chunks/AuditPanel.js +1 -0
  9. package/dist/packem_chunks/DeploymentHealthPanel.js +1 -0
  10. package/dist/packem_chunks/ExportImportPanel.js +3 -0
  11. package/dist/packem_chunks/FileBrowser.js +4 -0
  12. package/dist/packem_chunks/FunctionRunner.js +1 -0
  13. package/dist/packem_chunks/FunctionStatsPanel.js +1 -0
  14. package/dist/packem_chunks/HealthPanel.js +1 -0
  15. package/dist/packem_chunks/InsightsPanel.js +1 -0
  16. package/dist/packem_chunks/LogsPanel.js +1 -0
  17. package/dist/packem_chunks/MailPanel.js +2 -0
  18. package/dist/packem_chunks/MetricsPanel.js +1 -0
  19. package/dist/packem_chunks/NotificationsPanel.js +1 -0
  20. package/dist/packem_chunks/PitrPanel.js +1 -0
  21. package/dist/packem_chunks/SchemaViewer.js +1 -0
  22. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -0
  23. package/dist/packem_chunks/SettingsPanel.js +1 -0
  24. package/dist/packem_chunks/SqlEditorPanel.js +6 -0
  25. package/dist/packem_chunks/TableEditor.js +1 -0
  26. package/dist/packem_chunks/agents-panel.js +1 -0
  27. package/dist/packem_chunks/analytics-panel.js +1 -0
  28. package/dist/packem_chunks/auth-audit-panel.js +1 -0
  29. package/dist/packem_chunks/auth-config-panel.js +1 -0
  30. package/dist/packem_chunks/auth-sessions-panel.js +1 -0
  31. package/dist/packem_chunks/containers-panel.js +1 -0
  32. package/dist/packem_chunks/dashboards-panel.js +1 -0
  33. package/dist/packem_chunks/fanout-panel.js +1 -0
  34. package/dist/packem_chunks/flags-panel.js +1 -0
  35. package/dist/packem_chunks/issues-panel.js +1 -0
  36. package/dist/packem_chunks/kv-browser.js +1 -0
  37. package/dist/packem_chunks/log-drains-panel.js +4 -0
  38. package/dist/packem_chunks/migrations-route.js +1 -0
  39. package/dist/packem_chunks/organizations-panel.js +1 -0
  40. package/dist/packem_chunks/payments-panel.js +1 -0
  41. package/dist/packem_chunks/permissions-panel.js +1 -0
  42. package/dist/packem_chunks/queues-panel.js +1 -0
  43. package/dist/packem_chunks/rls-panel.js +1 -0
  44. package/dist/packem_chunks/schedule-panel.js +1 -0
  45. package/dist/packem_chunks/sparkline.js +1 -0
  46. package/dist/packem_chunks/storage-rules-panel.js +1 -0
  47. package/dist/packem_chunks/subscriptions-panel.js +1 -0
  48. package/dist/packem_chunks/sync-client-panel.js +1 -0
  49. package/dist/packem_chunks/traces-panel.js +1 -0
  50. package/dist/packem_chunks/users-panel.js +1 -0
  51. package/dist/packem_chunks/vector-browser.js +1 -0
  52. package/dist/packem_chunks/workflows-panel.js +1 -0
  53. package/dist/packem_shared/ADMIN_FUNCTIONS-4aE59aDq.js +1 -0
  54. package/dist/packem_shared/ApiDocsPanel-Cu_QmzO0.js +2 -0
  55. package/dist/packem_shared/ApiReferencePanel-DuIU1P8B.js +1 -0
  56. package/dist/packem_shared/CommandPalette-mPR8-vIm.js +1 -0
  57. package/dist/packem_shared/ConfirmButton-CTL3f3kr.js +1 -0
  58. package/dist/packem_shared/ConnectionBadge-DOk0CQWo.js +1 -0
  59. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js +1 -0
  60. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-B-hcFVoi.js +1 -0
  61. package/dist/packem_shared/DEFAULT_LOCALE-BZ4NojpD.js +1 -0
  62. package/dist/packem_shared/DataBrowser-BPRDaOHx.js +1 -0
  63. package/dist/packem_shared/DataFilters-B26ZeqBZ.js +1 -0
  64. package/dist/packem_shared/ErrorBoundary-DvzYskH7.js +1 -0
  65. package/dist/packem_shared/GlobalDataBrowser-CeA8bDjX.js +1 -0
  66. package/dist/packem_shared/HomePanel-DLP1nQdC.js +1 -0
  67. package/dist/packem_shared/MigrationsPanel-dm_M75mR.js +1 -0
  68. package/dist/packem_shared/OpenRpcReferencePanel-DXeffPFr.js +1 -0
  69. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.js +1 -0
  70. package/dist/packem_shared/ScheduledJobs-DDJG9Je7.js +1 -0
  71. package/dist/packem_shared/ShardInput-BVn2iCU0.js +1 -0
  72. package/dist/packem_shared/Studio-BYg65qWq.js +1 -0
  73. package/dist/packem_shared/StudioApp-D0UOg0a_.js +1 -0
  74. package/dist/packem_shared/StudioI18nProvider-CZ5h4nrV.js +1 -0
  75. package/dist/packem_shared/advisor-view-Coipc04R.js +1 -0
  76. package/dist/packem_shared/aggregateMetrics-BNfajLa2.js +1 -0
  77. package/dist/packem_shared/alert-CVcOFuDR.js +1 -0
  78. package/dist/packem_shared/app.d-DW7yZsfu.d.ts +252 -0
  79. package/dist/packem_shared/badge-BbuuAio7.js +1 -0
  80. package/dist/packem_shared/bar-chart-DraN_srt.js +9 -0
  81. package/dist/packem_shared/browser-storage-xjTyMKY0.js +1 -0
  82. package/dist/packem_shared/button-BkCrNcAs.js +1 -0
  83. package/dist/packem_shared/card-CIDGUN6K.js +1 -0
  84. package/dist/packem_shared/cf-links-Dmg86v1D.js +1 -0
  85. package/dist/packem_shared/checkbox-StT4Gob6.js +1 -0
  86. package/dist/packem_shared/data-grid-Ci4-tZkk.js +1 -0
  87. package/dist/packem_shared/data-view-params-ClrV7XgF.js +1 -0
  88. package/dist/packem_shared/dropdown-menu-C3RQ_HlW.js +2 -0
  89. package/dist/packem_shared/empty-state-Cg7t_8qu.js +1 -0
  90. package/dist/packem_shared/error-alert--Ie7ofJ0.js +1 -0
  91. package/dist/packem_shared/grid-features-Db_BNYRo.js +6 -0
  92. package/dist/packem_shared/home-panel-BtxdqXDe.js +3 -0
  93. package/dist/packem_shared/input-JHu63lTv.js +1 -0
  94. package/dist/packem_shared/internal-zkEvTqy8.js +2 -0
  95. package/dist/packem_shared/label-6uP1obNF.js +1 -0
  96. package/dist/packem_shared/live-status-CmuRLFKf.js +1 -0
  97. package/dist/packem_shared/log-fields-CoL3hsIQ.js +1 -0
  98. package/dist/packem_shared/modal-shell-CUwwWC2o.js +1 -0
  99. package/dist/packem_shared/operation-console-provider-BMJNtiyB.js +1 -0
  100. package/dist/packem_shared/recording-client-DtUxwVNY.js +1 -0
  101. package/dist/packem_shared/reference-view-DncEStdm.js +12 -0
  102. package/dist/packem_shared/result-chart-Gywg9DOk.js +1 -0
  103. package/dist/packem_shared/schema-diagram-DTRaCp6Y.js +2 -0
  104. package/dist/packem_shared/scroll-area-DTEq6Jec.js +2 -0
  105. package/dist/packem_shared/select-Bul-DeII.js +2 -0
  106. package/dist/packem_shared/shard-history-DMEW5VBE.js +1 -0
  107. package/dist/packem_shared/skeleton-C1wQ9M5t.js +1 -0
  108. package/dist/packem_shared/sparkline-CgjeUU2I.js +1 -0
  109. package/dist/packem_shared/stat-card-fm_TF1mo.js +1 -0
  110. package/dist/packem_shared/storage-tier-DznqOf-q.js +1 -0
  111. package/dist/packem_shared/studio-Drf4en3j.js +2 -0
  112. package/dist/packem_shared/table-DdJBrClo.js +2 -0
  113. package/dist/packem_shared/table-list-sidebar-fz0m_4I4.js +1 -0
  114. package/dist/packem_shared/textarea-Bu2-jKAs.js +1 -0
  115. package/dist/packem_shared/trace-handoff-Dw7mwjxu.js +1 -0
  116. package/dist/packem_shared/use-admin-query-CnnyWJXM.js +1 -0
  117. package/dist/packem_shared/use-async-submit-BFIMhRqh.js +1 -0
  118. package/dist/packem_shared/use-auth-config-0EnNCdLu.js +1 -0
  119. package/dist/packem_shared/use-shard-key-B2JtNa5m.js +1 -0
  120. package/dist/packem_shared/use-sql-assistant-Dtw55kKM.js +1 -0
  121. package/dist/packem_shared/useDebounced-CU-uftxO.js +1 -0
  122. package/dist/packem_shared/utils-bhneXptQ.js +1 -0
  123. package/dist/packem_shared/virtual-rect-1o1veP7R.js +1 -0
  124. package/dist/packem_shared/wire-codec-BUrWLklj.js +1 -0
  125. package/dist/standalone/chunk-2NX5QU44.js +1 -0
  126. package/dist/standalone/chunk-2OUPA2WJ.js +1 -0
  127. package/dist/standalone/chunk-2PJNAWB3.js +1 -0
  128. package/dist/standalone/chunk-2QSHLBCO.js +1 -0
  129. package/dist/standalone/chunk-2QWHVQ6P.js +1 -0
  130. package/dist/standalone/chunk-3C3CG7ZK.js +1 -0
  131. package/dist/standalone/chunk-3CWGJYBB.js +1 -0
  132. package/dist/standalone/chunk-3FIN5PH4.js +6 -0
  133. package/dist/standalone/chunk-3XIESWL4.js +1 -0
  134. package/dist/standalone/chunk-3XQMTTW2.js +1 -0
  135. package/dist/standalone/chunk-4D7XIQ5Q.js +1 -0
  136. package/dist/standalone/chunk-4LCY5XUR.js +1 -0
  137. package/dist/standalone/chunk-4PLB4ZNI.js +1 -0
  138. package/dist/standalone/chunk-4UOFSGUS.js +1 -0
  139. package/dist/standalone/chunk-4VEAVSAZ.js +1 -0
  140. package/dist/standalone/chunk-54MMVNPT.js +1 -0
  141. package/dist/standalone/chunk-5Y3QLNWX.js +1 -0
  142. package/dist/standalone/chunk-6QKJ6JPJ.js +1 -0
  143. package/dist/standalone/chunk-6ST5ECQA.js +1 -0
  144. package/dist/standalone/chunk-6WWX4FJB.js +1 -0
  145. package/dist/standalone/chunk-6XKVQES4.js +1 -0
  146. package/dist/standalone/chunk-7H7LZRLP.js +1 -0
  147. package/dist/standalone/chunk-7QIFDWQV.js +1 -0
  148. package/dist/standalone/chunk-7QMX3D4D.js +3 -0
  149. package/dist/standalone/chunk-7T7UOTYK.js +1 -0
  150. package/dist/standalone/chunk-7YXDJXNL.js +1 -0
  151. package/dist/standalone/chunk-A7647FJE.js +1 -0
  152. package/dist/standalone/chunk-AQT6EPZT.js +1 -0
  153. package/dist/standalone/chunk-AREBQI6D.js +1 -0
  154. package/dist/standalone/chunk-AVAC26HJ.js +1 -0
  155. package/dist/standalone/chunk-BCGEI67L.js +2 -0
  156. package/dist/standalone/chunk-BENJFRZL.js +1 -0
  157. package/dist/standalone/chunk-BGBLQ563.js +1 -0
  158. package/dist/standalone/chunk-BYIS2KWZ.js +1 -0
  159. package/dist/standalone/chunk-C6GLTSPO.js +4 -0
  160. package/dist/standalone/chunk-CFPZYHPY.js +2 -0
  161. package/dist/standalone/chunk-CMP33R3N.js +1 -0
  162. package/dist/standalone/chunk-CRHCAN4W.js +13 -0
  163. package/dist/standalone/chunk-CUAGAM2B.js +1 -0
  164. package/dist/standalone/chunk-DBWOWJYT.js +11 -0
  165. package/dist/standalone/chunk-EQZTSISX.js +1 -0
  166. package/dist/standalone/chunk-ESEEVSPC.js +1 -0
  167. package/dist/standalone/chunk-ESVP44Y3.js +1 -0
  168. package/dist/standalone/chunk-F3TP5L34.js +1 -0
  169. package/dist/standalone/chunk-FBNRATNR.js +1 -0
  170. package/dist/standalone/chunk-FURI47Z2.js +1 -0
  171. package/dist/standalone/chunk-FW75RYZU.js +1 -0
  172. package/dist/standalone/chunk-FXCBF4XT.js +1 -0
  173. package/dist/standalone/chunk-GMR677FL.js +1 -0
  174. package/dist/standalone/chunk-GRL5MG3Z.js +1 -0
  175. package/dist/standalone/chunk-HKG5I64M.js +1 -0
  176. package/dist/standalone/chunk-HPFLBYRI.js +1 -0
  177. package/dist/standalone/chunk-HWOD25QD.js +1 -0
  178. package/dist/standalone/chunk-I6A5C46N.js +1 -0
  179. package/dist/standalone/chunk-IBVBIKUI.js +1 -0
  180. package/dist/standalone/chunk-IC4L6G56.js +1 -0
  181. package/dist/standalone/chunk-IGCNMZSB.js +1 -0
  182. package/dist/standalone/chunk-ILNELDFC.js +1 -0
  183. package/dist/standalone/chunk-IUUSMC2R.js +8 -0
  184. package/dist/standalone/chunk-IUYFXK4X.js +19 -0
  185. package/dist/standalone/chunk-IVFHIQOT.js +1 -0
  186. package/dist/standalone/chunk-IZ3ISXSM.js +1 -0
  187. package/dist/standalone/chunk-J3FR2XBV.js +1 -0
  188. package/dist/standalone/chunk-JN2Y24PY.js +1 -0
  189. package/dist/standalone/chunk-JWXKUXYA.js +1 -0
  190. package/dist/standalone/chunk-KUFAOKU3.js +1 -0
  191. package/dist/standalone/chunk-KUVMORDQ.js +1 -0
  192. package/dist/standalone/chunk-LDYOCGEG.js +1 -0
  193. package/dist/standalone/chunk-LEDWUPXM.js +1 -0
  194. package/dist/standalone/chunk-LUU4SDHW.js +1 -0
  195. package/dist/standalone/chunk-LYQY7L72.js +4 -0
  196. package/dist/standalone/chunk-LZH7RDRV.js +1 -0
  197. package/dist/standalone/chunk-MIQTKZAR.js +1 -0
  198. package/dist/standalone/chunk-ML5IJMH6.js +1 -0
  199. package/dist/standalone/chunk-MV4A2PAK.js +1 -0
  200. package/dist/standalone/chunk-N233NOIN.js +1 -0
  201. package/dist/standalone/chunk-NH3VWHCL.js +1 -0
  202. package/dist/standalone/chunk-NNRFDPSD.js +1 -0
  203. package/dist/standalone/chunk-O2QUUHGF.js +1 -0
  204. package/dist/standalone/chunk-Q2Q7FR3R.js +1 -0
  205. package/dist/standalone/chunk-Q4AI6JRP.js +1 -0
  206. package/dist/standalone/chunk-QBWRC5YX.js +1 -0
  207. package/dist/standalone/chunk-QGA2HITH.js +1 -0
  208. package/dist/standalone/chunk-QLQADHFE.js +1 -0
  209. package/dist/standalone/chunk-QWGT25SE.js +1 -0
  210. package/dist/standalone/chunk-QWJ4HKPY.js +1 -0
  211. package/dist/standalone/chunk-QZGTDXV5.js +1 -0
  212. package/dist/standalone/chunk-RHPP74O4.js +1 -0
  213. package/dist/standalone/chunk-RKGCSNAW.js +1 -0
  214. package/dist/standalone/chunk-RMN2JN4S.js +1 -0
  215. package/dist/standalone/chunk-RNOSWEMO.js +4 -0
  216. package/dist/standalone/chunk-S3DWUXGY.js +62 -0
  217. package/dist/standalone/chunk-SD4BERSA.js +1 -0
  218. package/dist/standalone/chunk-SFDOII3B.js +1 -0
  219. package/dist/standalone/chunk-SMIESS7P.js +1 -0
  220. package/dist/standalone/chunk-T6VMSOBB.js +1 -0
  221. package/dist/standalone/chunk-THIXMMZD.js +1 -0
  222. package/dist/standalone/chunk-ULYM26IH.js +1 -0
  223. package/dist/standalone/chunk-UU2QJMGJ.js +1 -0
  224. package/dist/standalone/chunk-UZERI5YC.js +1 -0
  225. package/dist/standalone/chunk-V53KNYRN.js +1 -0
  226. package/dist/standalone/chunk-VDW32UET.js +1 -0
  227. package/dist/standalone/chunk-WOEGO5M6.js +1 -0
  228. package/dist/standalone/chunk-XBDKZZ67.js +1 -0
  229. package/dist/standalone/chunk-XDEDCAYN.js +1 -0
  230. package/dist/standalone/chunk-XF2B7P5A.js +1 -0
  231. package/dist/standalone/chunk-XGMZESWC.js +1 -0
  232. package/dist/standalone/chunk-XKKP2VFZ.js +1 -0
  233. package/dist/standalone/chunk-XNGYYOLS.js +14 -0
  234. package/dist/standalone/chunk-XQCVZAGU.js +1 -0
  235. package/dist/standalone/chunk-XTEWLG3J.js +3 -0
  236. package/dist/standalone/chunk-XXQUMVWH.js +1 -0
  237. package/dist/standalone/chunk-XXXMUP6L.js +1 -0
  238. package/dist/standalone/chunk-ZJGP6EKR.js +1 -0
  239. package/dist/standalone/chunk-ZKTWHB7Q.js +1 -0
  240. package/dist/standalone/chunk-ZNMZQXWN.js +1 -0
  241. package/dist/standalone/chunk-ZWSTXAG3.js +6 -0
  242. package/dist/standalone/studio.js +9 -356
  243. package/dist/styles.css +2 -2
  244. package/package.json +16 -14
  245. package/dist/packem_shared/ADMIN_FUNCTIONS-DjXgvJb6.js +0 -46
  246. package/dist/packem_shared/ApiDocsPanel-yVSGHK3H.js +0 -842
  247. package/dist/packem_shared/ApiReferencePanel-1vubqG5s.js +0 -229
  248. package/dist/packem_shared/ApiTab-rwttyQ1-.js +0 -251
  249. package/dist/packem_shared/AuditPanel-BqXZAsu_.js +0 -212
  250. package/dist/packem_shared/CommandPalette-BtgkBzZI.js +0 -373
  251. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  252. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  253. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  254. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  255. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  256. package/dist/packem_shared/DataBrowser-BtT2NYcR.js +0 -4542
  257. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  258. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  259. package/dist/packem_shared/ExportImportPanel-Dq6rj0tI.js +0 -193
  260. package/dist/packem_shared/FileBrowser-0pCpdKPE.js +0 -2932
  261. package/dist/packem_shared/FunctionRunner-7NH3KcTg.js +0 -343
  262. package/dist/packem_shared/FunctionStatsPanel-Cn_EBpDy.js +0 -432
  263. package/dist/packem_shared/GlobalDataBrowser-BTEmGrph.js +0 -318
  264. package/dist/packem_shared/HealthPanel-CQ4LzVET.js +0 -640
  265. package/dist/packem_shared/HomePanel-CP0lN1eF.js +0 -1273
  266. package/dist/packem_shared/InsightsPanel-B1BaHaPL.js +0 -431
  267. package/dist/packem_shared/LogsPanel-C3W0mabf.js +0 -839
  268. package/dist/packem_shared/MailPanel-DozizrvV.js +0 -447
  269. package/dist/packem_shared/MetricsPanel-CujtUfpl.js +0 -1625
  270. package/dist/packem_shared/MigrationsPanel-RX5qIFSr.js +0 -246
  271. package/dist/packem_shared/OpenRpcReferencePanel-vbcYbv3V.js +0 -191
  272. package/dist/packem_shared/PitrPanel-LJGNP_IX.js +0 -252
  273. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  274. package/dist/packem_shared/ScheduledJobs-CabfKbyM.js +0 -159
  275. package/dist/packem_shared/SchemaViewer-Bam6ylvw.js +0 -2512
  276. package/dist/packem_shared/SecurityAdvisorPanel-Bn2yq05G.js +0 -79
  277. package/dist/packem_shared/SettingsPanel-CBXQpYQA.js +0 -176
  278. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  279. package/dist/packem_shared/SqlEditorPanel-D5wMIxcg.js +0 -13
  280. package/dist/packem_shared/Studio-CccqZ-J1.js +0 -33
  281. package/dist/packem_shared/StudioApp-CQbULfaH.js +0 -657
  282. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  283. package/dist/packem_shared/TableEditor-Df_5NPaF.js +0 -371
  284. package/dist/packem_shared/advisor-view-CGcfMiPq.js +0 -159
  285. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  286. package/dist/packem_shared/app.d-Nbhpihxv.d.ts +0 -300
  287. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  288. package/dist/packem_shared/bar-chart-CzJAgqkp.js +0 -3245
  289. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  290. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  291. package/dist/packem_shared/cf-links-2cktDedA.js +0 -8
  292. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  293. package/dist/packem_shared/data-grid-B5CaV3wS.js +0 -183
  294. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  295. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  296. package/dist/packem_shared/grid-features-CzUfqgsM.js +0 -840
  297. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  298. package/dist/packem_shared/internal-rXJEAhXS.js +0 -68
  299. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  300. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  301. package/dist/packem_shared/reference-view-B4E49Lip.js +0 -2180
  302. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  303. package/dist/packem_shared/sparkline-10dG-_f0.js +0 -93
  304. package/dist/packem_shared/sql-editor-panel-Smfl_FDF.js +0 -2562
  305. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  306. package/dist/packem_shared/studio-D93XGB-i.js +0 -10413
  307. package/dist/packem_shared/table-_RzNvy3R.js +0 -246
  308. package/dist/packem_shared/table-list-sidebar-Bg7uzbvC.js +0 -832
  309. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  310. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  311. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
  312. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  313. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  314. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
@@ -0,0 +1 @@
1
+ import{c as A}from"react/compiler-runtime";import{useLunora as H}from"@lunora/react";import{useState as h,useEffect as Q}from"react";import{u as R}from"../packem_shared/button-BkCrNcAs.js";import{c as V,u as j}from"../packem_shared/card-CIDGUN6K.js";import{E as W}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as D}from"../packem_shared/input-JHu63lTv.js";import{n as q,d as E,m as N,p as o,f as L,u as i}from"../packem_shared/table-DdJBrClo.js";import{useT as G}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{f as M,b as B,h as J}from"../packem_shared/internal-zkEvTqy8.js";import{jsxs as n,jsx as e}from"react/jsx-runtime";const O=10,g=x=>{const r=A(7),{label:m,value:a}=x;let l;r[0]!==m?(l=e("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m}),r[0]=m,r[1]=l):l=r[1];const f=a??"—";let c;r[2]!==f?(c=e("span",{className:"font-mono text-sm",children:f}),r[2]=f,r[3]=c):c=r[3];let u;return r[4]!==l||r[5]!==c?(u=n("div",{className:"flex flex-col gap-0.5",children:[l,c]}),r[4]=l,r[5]=c,r[6]=u):u=r[6],u},ce=({loadIndexes:x,runQuery:r}={})=>{const m=H(),a=G(),[l,f]=h(null),[c,u]=h(null),[v,C]=h(null),[b,F]=h(""),[p,y]=h(null),[k,w]=h(null),[I,S]=h(!1);Q(()=>{const t={cancelled:!1};return M((async()=>{try{const d=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(f(d),u(null),C($=>$??d[0]?.name??null))}catch(d){t.cancelled||(f(null),u(B(d)))}})()),()=>{t.cancelled=!0}},[m,x]);const s=l?.find(t=>t.name===v)??null,K=t=>{C(t.currentTarget.dataset.index??null),y(null),w(null)},T=t=>{F(t.target.value)},Z=async()=>{const t=b.trim();if(!(v===null||t==="")){S(!0),w(null);try{const d=await(r??($=>m.queryVectorIndex($)))({name:v,text:t,topK:O});y(d)}catch(d){y(null),w(B(d))}S(!1)}},z=()=>{M(Z())};return n("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[c!==null&&e("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:c}),l!==null&&l.length===0&&e(W,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:e("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:e("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:a("No vector indexes.")}),l!==null&&l.length>0&&e(V,{className:"overflow-hidden py-0",children:e(j,{className:"px-0",children:n(q,{"data-testid":"vector-table",children:[e(E,{children:n(N,{children:[e(o,{children:a("name")}),e(o,{children:a("table")}),e(o,{children:a("dimensions")}),e(o,{children:a("metric")}),e(o,{children:a("vectors")})]})}),e(L,{children:l.map(t=>n(N,{className:t.name===v?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:K,children:[e(i,{className:"font-mono text-xs",children:t.name}),e(i,{className:"font-mono text-xs",children:t.table}),e(i,{className:"tabular-nums",children:t.dimensions??"—"}),e(i,{children:t.metric??"—"}),e(i,{className:"tabular-nums",children:t.vectorsCount??"—"})]},t.name))})]})})}),s!==null&&n("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[n("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e(g,{label:a("field"),value:s.field}),e(g,{label:a("dimensions"),value:s.dimensions}),e(g,{label:a("metric"),value:s.metric}),e(g,{label:a("vectors"),value:s.vectorsCount})]}),s.metadata!==void 0&&s.metadata.length>0&&n("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",e("span",{className:"font-mono",children:s.metadata.join(", ")})]}),n("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e(D,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:T,placeholder:a("Search by similarity…"),value:b}),e(R,{"data-testid":"vector-search",disabled:I||b.trim()==="",onClick:z,children:a(I?"Searching…":"Search")})]}),k!==null&&e("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:k}),p!==null&&p.length===0&&e("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")}),p!==null&&p.length>0&&e(V,{className:"mt-3 overflow-hidden py-0",children:e(j,{className:"px-0",children:n(q,{"data-testid":"vector-matches",children:[e(E,{children:n(N,{children:[e(o,{children:a("id")}),e(o,{children:a("score")}),e(o,{children:a("metadata")})]})}),e(L,{children:p.map(t=>n(N,{"data-testid":`vector-match-${t.id}`,children:[e(i,{className:"font-mono text-xs",children:t.id}),e(i,{className:"tabular-nums",children:t.score.toFixed(4)}),e(i,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"—":J(t.metadata)})]},t.id))})]})})})]})]})};export{ce as VectorBrowser};
@@ -0,0 +1 @@
1
+ import{useLunora as Q}from"@lunora/react";import{useState as m,useEffect as te}from"react";import{u as W}from"../packem_shared/button-BkCrNcAs.js";import{c as J,u as L}from"../packem_shared/card-CIDGUN6K.js";import{E as M}from"../packem_shared/empty-state-Cg7t_8qu.js";import{u as ae}from"../packem_shared/input-JHu63lTv.js";import{n as U,d as _,m as x,p as i,f as q,u as d}from"../packem_shared/table-DdJBrClo.js";import{l as re}from"../packem_shared/textarea-Bu2-jKAs.js";import{N as ne}from"../packem_shared/use-admin-query-CnnyWJXM.js";import{useT as V}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as B}from"../packem_shared/ADMIN_FUNCTIONS-4aE59aDq.js";import{f as A,b as E,d as H,g as X}from"../packem_shared/internal-zkEvTqy8.js";import{jsxs as s,jsx as e}from"react/jsx-runtime";const se=["queued","running","paused","waiting","complete","errored","terminated"],oe=["pause","resume","terminate"],le="WORKFLOWS_NOT_CONFIGURED",ie=o=>typeof o=="object"&&o!==null&&o.code===le,de=o=>{const r=o.error??o.output;if(r===void 0)return"—";try{return JSON.stringify(r)}catch{return"(unserializable)"}},ce=({loadDetail:o,loadInstances:r,readOnly:N,runAction:T,workflowName:g})=>{const I=Q(),n=V(),[h,k]=m(null),[S,$]=m(null),[v,j]=m(""),[b,f]=m(null),[F,C]=m(!1),[R,z]=m(null),p=o??(a=>I.getWorkflowInstance(a)),w=N?void 0:T??(r===void 0?a=>I.setWorkflowInstanceStatus(a):void 0),O=async()=>{f(null),C(!1);const a=v===""?void 0:v;try{if(r===void 0){const l=await I.listWorkflowInstances({name:g,status:a});if(l.configured===!1){k(null),C(!0);return}k(l.instances);return}k(await r({name:g,status:a}))}catch(l){k(null),ie(l)?C(!0):f(E(l))}};te(()=>{$(null),A(O())},[g,v]);const D=async a=>{f(null);try{$(await p({id:a,name:g}))}catch(l){f(E(l))}},K=async(a,l)=>{if(w!==void 0){z(a),f(null);try{await w({action:l,id:a,name:g}),await O()}catch(P){f(E(P))}z(null)}};return s("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[s("div",{className:"flex items-center justify-between gap-2",children:[e("h3",{className:"text-sm font-medium",children:n("Instance history")}),s("select",{"aria-label":n("Filter by status"),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":"workflow-instances-filter",onChange:a=>{j(a.target.value)},value:v,children:[e("option",{value:"",children:n("All statuses")}),se.map(a=>e("option",{value:a,children:a},a))]})]}),b!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),F&&e(M,{description:n("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:n("Workflow inspection not configured")}),!F&&h!==null&&h.length===0&&e(M,{description:n("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:n("No instances")}),h!==null&&h.length>0&&e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflow-instances-table",children:[e(_,{children:s(x,{children:[e(i,{children:n("Instance id")}),e(i,{children:n("Status")}),e(i,{children:n("Created")}),e(i,{children:n("Ended")}),e(i,{"aria-label":n("Actions")})]})}),e(q,{children:h.map(a=>s(x,{"data-testid":`workflow-instance-${a.id}`,children:[e(d,{className:"font-mono text-xs",children:a.id}),e(d,{className:"font-mono text-xs",children:a.status}),e(d,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"—"}),e(d,{className:"text-right",children:s("div",{className:"flex justify-end gap-1.5",children:[e(W,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:()=>{A(D(a.id))},size:"sm",type:"button",variant:"outline",children:n("Steps")}),w!==void 0&&oe.map(l=>e(W,{"data-testid":`workflow-instance-${l}-${a.id}`,disabled:R===a.id,onClick:()=>{A(K(a.id,l))},size:"sm",type:"button",variant:"ghost",children:n(l)},l))]})})]},a.id))})]})})}),S!==null&&e(J,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:s(L,{className:"flex flex-col gap-2 px-4 py-3",children:[s("div",{className:"flex items-center justify-between",children:[s("span",{className:"font-mono text-xs",children:[n("Steps")," · ",S.id]}),e(W,{"data-testid":"workflow-instance-detail-close",onClick:()=>{$(null)},size:"xs",type:"button",variant:"ghost",children:n("Close")})]}),S.steps.length===0?e("p",{className:"text-xs text-muted-foreground",children:n("This instance has no recorded steps yet.")}):s(U,{"data-testid":"workflow-instance-steps",children:[e(_,{children:s(x,{children:[e(i,{children:n("Step")}),e(i,{children:n("Type")}),e(i,{children:n("Attempts")}),e(i,{children:n("Started")}),e(i,{children:n("Output")})]})}),e(q,{children:S.steps.map((a,l)=>s(x,{"data-testid":`workflow-step-${String(l)}`,children:[e(d,{className:"font-mono text-xs",children:a.name}),e(d,{className:"text-xs text-muted-foreground",children:a.type??"—"}),e(d,{className:"tabular-nums",children:a.attempts??"—"}),e(d,{className:"text-muted-foreground tabular-nums",children:a.start??"—"}),e(d,{className:"font-mono text-xs text-muted-foreground",children:de(a)})]},`${a.name}:${String(l)}`))})]})]})})]})},me=X(B.createWorkflowInstance),ue=X(B.getWorkflowInstanceStatus),fe=o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"—";try{return JSON.stringify(o.output)}catch{return"(unserializable)"}},he=(o,r)=>o.some(N=>N.exportName===r)?r:o[0]?.exportName??"",Oe=()=>{const o=Q(),r=V(),{data:N,error:T}=ne(B.listWorkflows,{}),[g,I]=m(""),[n,h]=m(""),[k,S]=m(""),[$,v]=m(!1),[j,b]=m(null),[f,F]=m([]),[C,R]=m(null),z=N!==void 0,p=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],w=he(p,g),O=p.find(t=>t.exportName===w),D=t=>{F(u=>{const c=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...c]})},K=async()=>{const t=w;if(t==="")return;let u;const c=k.trim();if(c!=="")try{u=JSON.parse(c)}catch{b(r("Params must be valid JSON"));return}v(!0),b(null);try{const y=n.trim(),G=await o.query(me,{exportName:t,id:y===""?void 0:y,params:u},H(""));D({exportName:t,id:G.id,status:G.status}),h("")}catch(y){b(E(y))}v(!1)},a=()=>{A(K())},l=async(t,u)=>{R(u);try{const c=await o.query(ue,{exportName:t,id:u},H(""));D({error:c.error,exportName:t,id:c.id,output:c.output,status:c.status})}catch(c){b(E(c))}R(null)},P=t=>{I(t.target.value)},Y=t=>{h(t.target.value)},Z=t=>{S(t.target.value)},ee=t=>{const{export:u,id:c}=t.currentTarget.dataset;u!==void 0&&c!==void 0&&A(l(u,c))};return s("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[T!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:T}),e("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),z&&p.length===0?e(M,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflows-table",children:[e(_,{children:s(x,{children:[e(i,{children:r("Export")}),e(i,{children:r("Name")}),e(i,{children:r("Class")}),e(i,{children:r("Binding")})]})}),e(q,{children:p.map(t=>s(x,{"data-testid":`workflows-row-${t.exportName}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.className}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),p.length>0&&s("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[e("h3",{className:"text-sm font-medium",children:r("Start instance")}),j!==null&&e("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:j}),s("div",{className:"flex flex-wrap items-center gap-2",children:[e("select",{"aria-label":r("Workflow"),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":"workflows-start-select",onChange:P,value:w,children:p.map(t=>e("option",{value:t.exportName,children:t.exportName},t.exportName))}),e(ae,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:Y,placeholder:r("Instance id (optional)"),value:n}),e(W,{"data-testid":"workflows-start-button",disabled:$||w==="",onClick:a,children:r($?"Starting…":"Start instance")})]}),e(re,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:Z,placeholder:r("Params (JSON, optional)"),value:k})]}),f.length>0&&s("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[e("h3",{className:"text-sm font-medium",children:r("Instances")}),e(J,{className:"overflow-hidden py-0",children:e(L,{className:"px-0",children:s(U,{"data-testid":"workflows-instances-table",children:[e(_,{children:s(x,{children:[e(i,{children:r("Workflow")}),e(i,{children:r("Instance id")}),e(i,{children:r("Status")}),e(i,{children:r("Output")}),e(i,{})]})}),e(q,{children:f.map(t=>s(x,{"data-testid":`workflows-instance-${t.id}`,children:[e(d,{className:"font-mono text-xs",children:t.exportName}),e(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),e(d,{className:"font-mono text-xs",children:t.status}),e(d,{className:"font-mono text-xs text-muted-foreground",children:fe(t)}),e(d,{children:e(W,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:C===t.id,onClick:ee,size:"xs",variant:"outline",children:C===t.id?r("Refreshing…"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),O!==void 0&&e(ce,{workflowName:O.name})]})};export{Oe as default};
@@ -0,0 +1 @@
1
+ const _="__lunora_admin__:",e={aiAvailable:"__lunora_admin__:aiAvailable",aiChartConfig:"__lunora_admin__:aiChartConfig",aiGenerateSql:"__lunora_admin__:aiGenerateSql",aiTableFilter:"__lunora_admin__:aiTableFilter",assignIssue:"__lunora_admin__:assignIssue",backRelationCounts:"__lunora_admin__:backRelationCounts",clearCapturedMail:"__lunora_admin__:clearCapturedMail",clearQueueMessages:"__lunora_admin__:clearQueueMessages",clearTable:"__lunora_admin__:clearTable",createWorkflowInstance:"__lunora_admin__:createWorkflowInstance",deleteRows:"__lunora_admin__:deleteRows",describeTable:"__lunora_admin__:describeTable",describeTables:"__lunora_admin__:describeTables",explainIssue:"__lunora_admin__:explainIssue",exportShard:"__lunora_admin__:exportShard",facetColumn:"__lunora_admin__:facetColumn",getAdvisories:"__lunora_admin__:getAdvisories",getAdvisorProcedures:"__lunora_admin__:getAdvisorProcedures",getAuditLog:"__lunora_admin__:getAuditLog",getAuthAuditLog:"__lunora_admin__:getAuthAuditLog",getAuthMetrics:"__lunora_admin__:getAuthMetrics",getCapturedMail:"__lunora_admin__:getCapturedMail",getFanoutMetrics:"__lunora_admin__:getFanoutMetrics",getFunctionStats:"__lunora_admin__:getFunctionStats",getIssues:"__lunora_admin__:getIssues",lintSql:"__lunora_admin__:lintSql",listFlags:"__lunora_admin__:listFlags",listPushSubscriptions:"__lunora_admin__:listPushSubscriptions",listQueues:"__lunora_admin__:listQueues",listSubscriptions:"__lunora_admin__:listSubscriptions",listTableIndexes:"__lunora_admin__:listTableIndexes",listTablesIndexes:"__lunora_admin__:listTablesIndexes",listWorkflows:"__lunora_admin__:listWorkflows",getLogs:"__lunora_admin__:getLogs",getMetricHistory:"__lunora_admin__:getMetricHistory",getMetricSeries:"__lunora_admin__:getMetricSeries",getMetrics:"__lunora_admin__:getMetrics",getPitrBookmark:"__lunora_admin__:getPitrBookmark",getQueryInsights:"__lunora_admin__:getQueryInsights",getQueueMessages:"__lunora_admin__:getQueueMessages",getRequestLog:"__lunora_admin__:getRequestLog",getSecurityAudit:"__lunora_admin__:getSecurityAudit",getSettings:"__lunora_admin__:getSettings",getTraces:"__lunora_admin__:getTraces",getWorkflowInstanceStatus:"__lunora_admin__:getWorkflowInstanceStatus",ignoreIssue:"__lunora_admin__:ignoreIssue",importShard:"__lunora_admin__:importShard",listTables:"__lunora_admin__:listTables",maskPolicies:"__lunora_admin__:maskPolicies",migrationStatus:"__lunora_admin__:migrationStatus",pitrRestore:"__lunora_admin__:pitrRestore",readTablePage:"__lunora_admin__:readTablePage",replayQueueMessage:"__lunora_admin__:replayQueueMessage",resolveIssue:"__lunora_admin__:resolveIssue",rlsPolicies:"__lunora_admin__:rlsPolicies",schemaHistory:"__lunora_admin__:schemaHistory",schemaVersion:"__lunora_admin__:schemaVersion",runAs:"__lunora_admin__:runAs",runMigration:"__lunora_admin__:runMigration",runSql:"__lunora_admin__:runSql",sendQueueMessage:"__lunora_admin__:sendQueueMessage",sendTestMail:"__lunora_admin__:sendTestMail",setIssueSeverity:"__lunora_admin__:setIssueSeverity",storageOrphans:"__lunora_admin__:storageOrphans",storageReferences:"__lunora_admin__:storageReferences",storageRules:"__lunora_admin__:storageRules",studioFeatures:"__lunora_admin__:studioFeatures",writeRow:"__lunora_admin__:writeRow"};export{e as ADMIN_FUNCTIONS,_ as ADMIN_FUNCTION_PREFIX};
@@ -0,0 +1,2 @@
1
+ import{c as E}from"react/compiler-runtime";import{useLunora as Y}from"@lunora/react";import{useState as M,useEffect as Z}from"react";import{u as Q}from"./button-BkCrNcAs.js";import{E as z}from"./empty-state-Cg7t_8qu.js";import{useT as L}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as B}from"./ADMIN_FUNCTIONS-4aE59aDq.js";import{c as ee,d as te,g as ae}from"./internal-zkEvTqy8.js";import{jsxs as A,jsx as m}from"react/jsx-runtime";const ne=ae(B.listTables),ie=["react","client","cli"],le=!1,oe={action:"action",mutation:"mutation",query:"query"},J=i=>{const e=i.indexOf(":");return e===-1?{file:"",fn:i}:{file:i.slice(0,e),fn:i.slice(e+1)}},U=({file:i,fn:e,kind:l})=>`await client.${oe[l]}(api.${i}.${e}, { /* args */ });`,re=i=>{const e=`api.${i.file}.${i.fn}`;switch(i.kind){case"action":return U(i);case"mutation":return`const ${i.fn} = useMutation(${e});`;default:return`const data = useQuery(${e}, { /* args */ });`}},se=({file:i,fn:e})=>`lunora run ${i}:${e} --args '{ }'`,de=i=>["// Read rows",`const rows = await ctx.db.query("${i}").collect();`,"","// Insert a row",`const id = await ctx.db.insert("${i}", { /* fields */ });`,"","// Generated types",`type Row = Doc<"${i}">;`,`type RowId = Id<"${i}">;`].join(`
2
+ `),ce=(i,e)=>{switch(i){case"cli":return se(e);case"client":return U(e);default:return re(e)}},V=i=>{const e=E(19),{code:l,label:o,testId:a}=i,n=L();let s;e[0]!==l?(s=()=>{ee(l)},e[0]=l,e[1]=s):s=e[1];const u=s;let t;e[2]!==o?(t=m("span",{className:"text-xs font-medium text-muted-foreground",children:o}),e[2]=o,e[3]=t):t=e[3];const c=`${a}-copy`;let r;e[4]!==n?(r=n("Copy"),e[4]=n,e[5]=r):r=e[5];let p;e[6]!==u||e[7]!==c||e[8]!==r?(p=m(Q,{"data-testid":c,onClick:u,size:"xs",type:"button",variant:"ghost",children:r}),e[6]=u,e[7]=c,e[8]=r,e[9]=p):p=e[9];let f;e[10]!==t||e[11]!==p?(f=A("div",{className:"flex items-center justify-between gap-2",children:[t,p]}),e[10]=t,e[11]=p,e[12]=f):f=e[12];let d;e[13]!==l||e[14]!==a?(d=m("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":a,children:l}),e[13]=l,e[14]=a,e[15]=d):d=e[15];let h;return e[16]!==f||e[17]!==d?(h=A("div",{className:"flex flex-col gap-1.5",children:[f,d]}),e[16]=f,e[17]=d,e[18]=h):h=e[18],h},pe=i=>{const e=E(50),{file:l,fn:o,kind:a}=i,n=L(),[s,u]=M("react");let t,c,r;if(e[0]!==l||e[1]!==o||e[2]!==a||e[3]!==n||e[4]!==s){const x={file:l,fn:o,kind:a};let I;e[8]!==n?(I=n("CLI"),e[8]=n,e[9]=I):I=e[9];let C;e[10]!==n?(C=n("Client"),e[10]=n,e[11]=C):C=e[11];let T;e[12]!==n?(T=n("React"),e[12]=n,e[13]=T):T=e[13];let _;e[14]!==I||e[15]!==C||e[16]!==T?(_={cli:I,client:C,react:T},e[14]=I,e[15]=C,e[16]=T,e[17]=_):_=e[17],r=_;let D;e[18]===Symbol.for("react.memo_cache_sentinel")?(D=P=>{u(P.currentTarget.dataset.tab)},e[18]=D):D=e[18],t=D,c=ce(s,x),e[0]=l,e[1]=o,e[2]=a,e[3]=n,e[4]=s,e[5]=t,e[6]=c,e[7]=r}else t=e[5],c=e[6],r=e[7];const p=c,f=a==="action"&&s==="react"&&!le,d=`api.${l}.${o}`;let h;e[19]!==d?(h=m("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-fn-title",children:d}),e[19]=d,e[20]=h):h=e[20];let b;e[21]!==a||e[22]!==n?(b=n("Call this {kind} from your app.",{kind:a}),e[21]=a,e[22]=n,e[23]=b):b=e[23];let v;e[24]!==b?(v=m("p",{className:"text-xs text-muted-foreground",children:b}),e[24]=b,e[25]=v):v=e[25];let y;e[26]!==h||e[27]!==v?(y=A("div",{children:[h,v]}),e[26]=h,e[27]=v,e[28]=y):y=e[28];let k;e[29]!==n?(k=n("Snippet flavour"),e[29]=n,e[30]=k):k=e[30];let $;e[31]!==t||e[32]!==s||e[33]!==r?($=ie.map(x=>m(Q,{"aria-selected":s===x,"data-tab":x,"data-testid":`api-tab-${x}`,onClick:t,role:"tab",size:"xs",type:"button",variant:s===x?"default":"outline",children:r[x]},x)),e[31]=t,e[32]=s,e[33]=r,e[34]=$):$=e[34];let N;e[35]!==k||e[36]!==$?(N=m("div",{"aria-label":k,className:"flex gap-1.5","data-testid":"api-tabs",role:"tablist",children:$}),e[35]=k,e[36]=$,e[37]=N):N=e[37];const O=r[s],j=`api-snippet-${s}`;let w;e[38]!==p||e[39]!==O||e[40]!==j?(w=m(V,{code:p,label:O,testId:j}),e[38]=p,e[39]=O,e[40]=j,e[41]=w):w=e[41];let S;e[42]!==f||e[43]!==n?(S=f&&m("p",{className:"text-xs text-muted-foreground","data-testid":"api-action-note",children:n("Actions have no React hook — call them through the client.")}),e[42]=f,e[43]=n,e[44]=S):S=e[44];let R;return e[45]!==w||e[46]!==S||e[47]!==y||e[48]!==N?(R=A("div",{className:"flex flex-col gap-3","data-testid":"api-fn-doc",children:[y,N,w,S]}),e[45]=w,e[46]=S,e[47]=y,e[48]=N,e[49]=R):R=e[49],R},fe=i=>{const e=E(19),{name:l}=i,o=L();let a;e[0]!==l?(a=de(l),e[0]=l,e[1]=a):a=e[1];const n=a;let s;e[2]!==l?(s=m("h2",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"api-table-title",children:l}),e[2]=l,e[3]=s):s=e[3];let u;e[4]!==o?(u=o("Read and write this table through the typed data model."),e[4]=o,e[5]=u):u=e[5];let t;e[6]!==u?(t=m("p",{className:"text-xs text-muted-foreground",children:u}),e[6]=u,e[7]=t):t=e[7];let c;e[8]!==s||e[9]!==t?(c=A("div",{children:[s,t]}),e[8]=s,e[9]=t,e[10]=c):c=e[10];let r;e[11]!==o?(r=o("Data model"),e[11]=o,e[12]=r):r=e[12];let p;e[13]!==n||e[14]!==r?(p=m(V,{code:n,label:r,testId:"api-snippet-table"}),e[13]=n,e[14]=r,e[15]=p):p=e[15];let f;return e[16]!==c||e[17]!==p?(f=A("div",{className:"flex flex-col gap-3","data-testid":"api-table-doc",children:[c,p]}),e[16]=c,e[17]=p,e[18]=f):f=e[18],f},G=i=>{const e=E(8),{active:l,label:o,onSelect:a,testId:n,value:s}=i;let u;e[0]!==a||e[1]!==s?(u=()=>{a(s)},e[0]=a,e[1]=s,e[2]=u):u=e[2];const t=u,c=l?"page":void 0;let r;return e[3]!==o||e[4]!==t||e[5]!==c||e[6]!==n?(r=m("button",{"aria-current":c,className:"w-full truncate rounded-md px-2 py-1 text-start font-mono text-xs text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-testid":n,onClick:t,type:"button",children:o}),e[3]=o,e[4]=t,e[5]=c,e[6]=n,e[7]=r):r=e[7],r},me=i=>{const e=new Map;for(const l of i){const{file:o,fn:a}=J(l.path),n=e.get(o)??[];n.push({fn:a,kind:l.kind,path:l.path}),e.set(o,n)}return[...e.entries()].map(([l,o])=>({file:l,items:o.toSorted((a,n)=>a.fn.localeCompare(n.fn))})).toSorted((l,o)=>l.file.localeCompare(o.file))},Se=i=>{const e=E(58),{functions:l,initialShardKey:o}=i,a=L(),n=Y(),[s,u]=M(null),[t,c]=M(null);let r,p;e[0]!==n||e[1]!==o?(r=()=>{let _=!1;return n.query(ne,{},te(o??"")).then(D=>(_||u(D),D)).catch(()=>{_||u([])}),()=>{_=!0}},p=[n,o],e[0]=n,e[1]=o,e[2]=r,e[3]=p):(r=e[2],p=e[3]),Z(r,p);let f,d,h,b,v,y,k,$,N,O;if(e[4]!==l||e[5]!==t||e[6]!==a||e[7]!==s){const _=l??[],D=me(_),P=(s??[]).map(ue).toSorted(he);let F;e[18]===Symbol.for("react.memo_cache_sentinel")?(F=g=>{c({kind:"fn",path:g})},e[18]=F):F=e[18];const W=F;let H;e[19]===Symbol.for("react.memo_cache_sentinel")?(H=g=>{c({kind:"table",name:g})},e[19]=H):H=e[19];const X=H;d=t?.kind==="fn"?_.find(g=>g.path===t.path):void 0,f=_.length>0||P.length>0,h=d===void 0?void 0:J(d.path),N="grid min-h-0 gap-6 md:grid-cols-[16rem_minmax(0,1fr)]",O="lunora-api-docs",e[20]!==a?(b=a("API resources"),e[20]=a,e[21]=b):b=e[21],v="flex flex-col gap-4 overflow-y-auto",y="api-rail";let K;e[22]!==t||e[23]!==a?(K=g=>A("div",{className:"flex flex-col gap-1",children:[m("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g.file||a("(root)")}),g.items.map(q=>m(G,{active:t?.kind==="fn"&&t.path===q.path,label:q.fn,onSelect:W,testId:`api-rail-fn-${q.path}`,value:q.path},q.path))]},g.file),e[22]=t,e[23]=a,e[24]=K):K=e[24],k=D.map(K),$=P.length>0&&A("div",{className:"flex flex-col gap-1",children:[m("span",{className:"px-2 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Tables")}),P.map(g=>m(G,{active:t?.kind==="table"&&t.name===g,label:g,onSelect:X,testId:`api-rail-table-${g}`,value:g},g))]}),e[4]=l,e[5]=t,e[6]=a,e[7]=s,e[8]=f,e[9]=d,e[10]=h,e[11]=b,e[12]=v,e[13]=y,e[14]=k,e[15]=$,e[16]=N,e[17]=O}else f=e[8],d=e[9],h=e[10],b=e[11],v=e[12],y=e[13],k=e[14],$=e[15],N=e[16],O=e[17];let j;e[25]!==f||e[26]!==a?(j=!f&&m("p",{className:"px-2 text-xs text-muted-foreground","data-testid":"api-rail-empty",children:a("No functions or tables to document yet.")}),e[25]=f,e[26]=a,e[27]=j):j=e[27];let w;e[28]!==j||e[29]!==b||e[30]!==v||e[31]!==y||e[32]!==k||e[33]!==$?(w=A("nav",{"aria-label":b,className:v,"data-testid":y,children:[k,$,j]}),e[28]=j,e[29]=b,e[30]=v,e[31]=y,e[32]=k,e[33]=$,e[34]=w):w=e[34];let S;e[35]!==t||e[36]!==a?(S=t===null&&m(z,{description:a("Select a function or table to see how to call it from your app."),testId:"api-empty",title:a("API usage snippets")}),e[35]=t,e[36]=a,e[37]=S):S=e[37];let R;e[38]!==t?.kind||e[39]!==d||e[40]!==h?(R=t?.kind==="fn"&&d!==void 0&&h!==void 0&&m(pe,{file:h.file,fn:h.fn,kind:d.kind},d.path),e[38]=t?.kind,e[39]=d,e[40]=h,e[41]=R):R=e[41];let x;e[42]!==t?.kind||e[43]!==d||e[44]!==a?(x=t?.kind==="fn"&&d===void 0&&m(z,{testId:"api-empty",title:a("API usage snippets")}),e[42]=t?.kind,e[43]=d,e[44]=a,e[45]=x):x=e[45];let I;e[46]!==t?(I=t?.kind==="table"&&m(fe,{name:t.name}),e[46]=t,e[47]=I):I=e[47];let C;e[48]!==S||e[49]!==R||e[50]!==x||e[51]!==I?(C=A("div",{className:"min-w-0",children:[S,R,x,I]}),e[48]=S,e[49]=R,e[50]=x,e[51]=I,e[52]=C):C=e[52];let T;return e[53]!==w||e[54]!==C||e[55]!==N||e[56]!==O?(T=A("div",{className:N,"data-testid":O,children:[w,C]}),e[53]=w,e[54]=C,e[55]=N,e[56]=O,e[57]=T):T=e[57],T};function ue(i){return i.name}function he(i,e){return i.localeCompare(e)}export{le as REACT_HAS_ACTION_HOOK,se as buildCliSnippet,U as buildClientSnippet,re as buildReactSnippet,de as buildTableSnippet,Se as default,J as splitPath};
@@ -0,0 +1 @@
1
+ import{c as y}from"react/compiler-runtime";import{useLunora as k}from"@lunora/react";import{E as u}from"./empty-state-Cg7t_8qu.js";import{n as h}from"./skeleton-C1wQ9M5t.js";import{u as v,U as j}from"./reference-view-DncEStdm.js";import{useT as I}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{jsxs as w,jsx as f}from"react/jsx-runtime";const x=["get","post","put","patch","delete","head","options","trace"],g=i=>i?.content?.["application/json"]?.schema,P=(i,e)=>Object.entries(i.responses??{}).map(([a,t])=>{const c=t.$ref?.replace("#/components/responses/",""),n=c===void 0?t:e.components?.responses?.[c]??t;return{description:n.description,schema:g(n),status:a}}),A=(i,e,a,t,c)=>{const n=g(t.requestBody),r=n?.properties?.functionPath?.const,s=typeof r=="string"?r:void 0,m=s===void 0?n:n?.properties?.args,d=t.operationId??`${a} ${e}`;return{argsSchema:m,description:t.description,functionPath:s,httpPath:e,key:i,kind:t["x-lunora-function-kind"],method:a.toUpperCase(),operationId:d,requestSchema:n,responses:P(t,c),summary:t.summary??d,tags:t.tags??[],title:t.summary??d}},O=i=>{const e=[];for(const[a,t]of Object.entries(i.paths??{})){const c=a.includes("#")?a.slice(0,a.indexOf("#")):a;for(const n of x){const r=t[n];r!==void 0&&e.push(A(a,c,n,r,i))}}return e},b=i=>{const e=i??{},a=O(e),t=new Map((e.tags??[]).map(s=>[s.name,s.description])),c=new Set,n=[],r=s=>{if(c.has(s))return;c.add(s);const m=a.filter(d=>(d.tags[0]??"")===s);m.length>0&&n.push({description:t.get(s),name:s,operations:m})};for(const s of e.tags??[])r(s.name);for(const s of a)r(s.tags[0]??"");return{groups:n,operationByKey:new Map(a.map(s=>[s.key,s])),server:e.servers?.[0]?.url,title:e.info?.title??"API reference",version:e.info?.version}},S=i=>{const{paths:e}=i;return e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0},$=i=>{const e=i;return S(e)?{kind:"empty"}:{kind:"ready",spec:e}},U=i=>{const e=y(23),{spec:a}=i,t=I(),c=k();let n;e[0]!==c?(n=()=>c.fetchOpenApi(),e[0]=c,e[1]=n):n=e[1];const r=v(a,n,$);let s;e[2]!==r.kind||e[3]!==r.spec?(s=r.kind==="ready"?b(r.spec):void 0,e[2]=r.kind,e[3]=r.spec,e[4]=s):s=e[4];const m=s;if(r.kind==="loading"){let o;return e[5]===Symbol.for("react.memo_cache_sentinel")?(o=w("div",{className:"flex flex-col gap-4","data-testid":"api-reference-loading",children:[f(h,{className:"h-8 w-48"}),f(h,{className:"h-64 w-full"})]}),e[5]=o):o=e[5],o}if(r.kind==="error"){let o;e[6]!==r.message||e[7]!==t?(o=t("Couldn't load the OpenAPI spec: {message}",{message:r.message}),e[6]=r.message,e[7]=t,e[8]=o):o=e[8];let p;e[9]!==t?(p=t("API reference unavailable"),e[9]=t,e[10]=p):p=e[10];let l;return e[11]!==o||e[12]!==p?(l=f(u,{description:o,testId:"api-reference-error",title:p}),e[11]=o,e[12]=p,e[13]=l):l=e[13],l}if(r.kind==="empty"||m===void 0){let o;e[14]!==t?(o=t("Run `lunora codegen` and wire `_generated/openapi.json` to the worker to render the API reference here."),e[14]=t,e[15]=o):o=e[15];let p;e[16]!==t?(p=t("No OpenAPI spec configured"),e[16]=t,e[17]=p):p=e[17];let l;return e[18]!==o||e[19]!==p?(l=f(u,{description:o,testId:"api-reference-empty",title:p}),e[18]=o,e[19]=p,e[20]=l):l=e[20],l}let d;return e[21]!==m?(d=f(j,{model:m}),e[21]=m,e[22]=d):d=e[22],d};export{U as default};
@@ -0,0 +1 @@
1
+ import{c as I}from"react/compiler-runtime";import{Dialog as L}from"@base-ui/react/dialog";import{useNavigate as M}from"@tanstack/react-router";import{useState as R,useRef as O,useEffect as U}from"react";import{useT as W}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{f as X}from"./internal-zkEvTqy8.js";import{c as Y}from"./utils-bhneXptQ.js";import{jsx as l,jsxs as S}from"react/jsx-runtime";const z="lunora:command-palette",re=()=>{"window"in globalThis&&globalThis.dispatchEvent(new Event(z))},q=g=>{const e=I(18),{active:u,index:a,item:n,onActivate:f,onSelect:h}=g;let s;e[0]!==n||e[1]!==h?(s=()=>{h(n)},e[0]=n,e[1]=h,e[2]=s):s=e[2];const b=s;let c;e[3]!==a||e[4]!==f?(c=()=>{f(a)},e[3]=a,e[4]=f,e[5]=c):c=e[5];const p=c,x=u?"bg-accent text-accent-foreground":"text-foreground";let i;e[6]!==x?(i=Y("flex w-full items-center justify-between gap-3 rounded-md px-3 py-2 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground",x),e[6]=x,e[7]=i):i=e[7];let d;e[8]!==n.label?(d=l("span",{children:n.label}),e[8]=n.label,e[9]=d):d=e[9];let m;e[10]!==n.group?(m=l("span",{className:"text-xs text-muted-foreground",children:n.group}),e[10]=n.group,e[11]=m):m=e[11];let t;return e[12]!==b||e[13]!==p||e[14]!==i||e[15]!==d||e[16]!==m?(t=l("li",{children:S("button",{className:i,onClick:b,onMouseEnter:p,type:"button",children:[d,m]})}),e[12]=b,e[13]=p,e[14]=i,e[15]=d,e[16]=m,e[17]=t):t=e[17],t},G=(g,e)=>{const u=e.trim().toLowerCase();return u===""?g:g.filter(a=>a.label.toLowerCase().includes(u)||a.group.toLowerCase().includes(u))},le=g=>{const e=I(39),{items:u}=g,a=W(),n=M(),[f,h]=R(!1),[s,b]=R(""),[c,p]=R(0),x=O(null);let i,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{const o=B=>{(B.metaKey||B.ctrlKey)&&B.key.toLowerCase()==="k"&&(B.preventDefault(),h(!0))},r=()=>{h(!0)};return globalThis.addEventListener("keydown",o),globalThis.addEventListener(z,r),()=>{globalThis.removeEventListener("keydown",o),globalThis.removeEventListener(z,r)}},d=[],e[0]=i,e[1]=d):(i=e[0],d=e[1]),U(i,d);let m;e[2]!==u||e[3]!==s?(m=G(u,s),e[2]=u,e[3]=s,e[4]=m):m=e[4];const t=m;let T;e[5]===Symbol.for("react.memo_cache_sentinel")?(T=o=>{h(o),o||(b(""),p(0))},e[5]=T):T=e[5];const H=T;let D;e[6]!==n?(D=o=>{H(!1),X(n({to:o.to}))},e[6]=n,e[7]=D):D=e[7];const v=D;let A;e[8]===Symbol.for("react.memo_cache_sentinel")?(A=o=>{b(o.target.value),p(0)},e[8]=A):A=e[8];const J=A;let j;e[9]!==c||e[10]!==t||e[11]!==v?(j=o=>{e:switch(o.key){case"ArrowDown":{o.preventDefault(),p(r=>t.length===0?0:(r+1)%t.length);break e}case"ArrowUp":{o.preventDefault(),p(r=>t.length===0?0:(r-1+t.length)%t.length);break e}case"Enter":{o.preventDefault();const r=t[c];r!==void 0&&v(r);break e}}},e[9]=c,e[10]=t,e[11]=v,e[12]=j):j=e[12];const F=j;let K;e[13]===Symbol.for("react.memo_cache_sentinel")?(K=l(L.Backdrop,{className:"fixed inset-0 z-50 bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0"}),e[13]=K):K=e[13];let w;e[14]!==a?(w=a("Command palette"),e[14]=a,e[15]=w):w=e[15];let y;e[16]!==w?(y=l(L.Title,{className:"sr-only",children:w}),e[16]=w,e[17]=y):y=e[17];let P;e[18]===Symbol.for("react.memo_cache_sentinel")?(P=S("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.8,viewBox:"0 0 24 24",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3",strokeLinecap:"round"})]}),e[18]=P):P=e[18];let k;e[19]!==a?(k=a("Search…"),e[19]=a,e[20]=k):k=e[20];let N;e[21]!==F||e[22]!==s||e[23]!==k?(N=S("div",{className:"flex items-center gap-2 border-b border-border px-3",children:[P,l("input",{className:"h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground","data-testid":"dash-command-input",onChange:J,onKeyDown:F,placeholder:k,ref:x,type:"text",value:s})]}),e[21]=F,e[22]=s,e[23]=k,e[24]=N):N=e[24];let C;e[25]!==c||e[26]!==t||e[27]!==v||e[28]!==a?(C=t.length===0?l("li",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:a("No results.")}):t.map((o,r)=>l(q,{active:r===c,index:r,item:o,onActivate:p,onSelect:v},o.to)),e[25]=c,e[26]=t,e[27]=v,e[28]=a,e[29]=C):C=e[29];let _;e[30]!==C?(_=l("ul",{className:"max-h-80 overflow-y-auto p-1.5","data-testid":"dash-command-list",children:C}),e[30]=C,e[31]=_):_=e[31];let E;e[32]!==y||e[33]!==N||e[34]!==_?(E=S(L.Portal,{children:[K,S(L.Popup,{className:"fixed start-1/2 top-24 z-50 w-[36rem] max-w-[90vw] -translate-x-1/2 overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","data-testid":"dash-command-palette",initialFocus:x,children:[y,N,_]})]}),e[32]=y,e[33]=N,e[34]=_,e[35]=E):E=e[35];let $;return e[36]!==f||e[37]!==E?($=l(L.Root,{onOpenChange:H,open:f,children:E}),e[36]=f,e[37]=E,e[38]=$):$=e[38],$};export{le as CommandPalette,re as openCommandPalette};
@@ -0,0 +1 @@
1
+ import{useState as p}from"react";import{useT as u}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{u as i}from"./button-BkCrNcAs.js";import{jsxs as b,jsx as n}from"react/jsx-runtime";const $=({children:o,confirmLabel:r,disabled:s=!1,onConfirm:l,testId:t})=>{const a=u(),[d,e]=p(!1),m=()=>{e(!0)},c=()=>{e(!1)},f=()=>{e(!1),l()};return d?b("span",{className:"inline-flex items-center gap-1","data-testid":`${t}-prompt`,role:"group",children:[n(i,{"data-testid":`${t}-confirm`,disabled:s,onClick:f,size:"sm",type:"button",variant:"destructive",children:r??a("Confirm")}),n(i,{"data-testid":`${t}-cancel`,onClick:c,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):n(i,{"data-testid":t,disabled:s,onClick:m,size:"sm",type:"button",variant:"outline",children:o})};export{$ as ConfirmButton};
@@ -0,0 +1 @@
1
+ import{c as l}from"react/compiler-runtime";import{useConnectionStatus as d}from"@lunora/react";import{useT as f}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{c as u}from"./utils-bhneXptQ.js";import{jsx as m,jsxs as g}from"react/jsx-runtime";const p={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},j=()=>{const e=l(16),n=f(),a=d();let s;e:switch(a){case"connected":{let t;e[0]!==n?(t=n("Connected"),e[0]=n,e[1]=t):t=e[1],s=t;break e}case"connecting":{let t;e[2]!==n?(t=n("Connecting…"),e[2]=n,e[3]=t):t=e[3],s=t;break e}case"idle":{let t;e[4]!==n?(t=n("Idle"),e[4]=n,e[5]=t):t=e[5],s=t;break e}case"offline":{let t;e[6]!==n?(t=n("Offline"),e[6]=n,e[7]=t):t=e[7],s=t;break e}default:s=a}const r=p[a];let o;e[8]!==r?(o=u("size-2 rounded-full",r),e[8]=r,e[9]=o):o=e[9];let c;e[10]!==o?(c=m("span",{"aria-hidden":"true",className:o}),e[10]=o,e[11]=c):c=e[11];let i;return e[12]!==a||e[13]!==c||e[14]!==s?(i=g("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[c,s]}),e[12]=a,e[13]=c,e[14]=s,e[15]=i):i=e[15],i};export{j as default};
@@ -0,0 +1 @@
1
+ import{c as m}from"react/compiler-runtime";import{useRef as a,useEffect as f}from"react";const d=5e3,h=(e,r,u)=>{const t=m(6),o=u===void 0?d:u,l=a(e);let n;t[0]!==e?(n=()=>{l.current=e},t[0]=e,t[1]=n):n=t[1],f(n);let c,s;t[2]!==r||t[3]!==o?(c=()=>{if(!r)return;const i=setInterval(()=>{globalThis.document?.hidden!==!0&&l.current()},o);return()=>{clearInterval(i)}},s=[r,o],t[2]=r,t[3]=o,t[4]=c,t[5]=s):(c=t[4],s=t[5]),f(c,s)};export{d as DEFAULT_AUTO_REFRESH_MS,h as useAutoRefresh};
@@ -0,0 +1 @@
1
+ const c={highErrorRate:.05,highWriteContention:.1,lowCacheHitRate:.5,minCacheSamples:10,minConflictCalls:5,minErrorCalls:5,slowFunctionMs:1e3},l={error:0,info:2,warning:1},u=(i,t)=>{const s=[];if(i.maxDurationMs>=t.slowFunctionMs){const e=i.scannedTables??[];e.length>0?s.push({fn:i.path,kind:"missing-index",severity:"warning",tables:e.map(a=>a.table),value:i.maxDurationMs}):s.push({fn:i.path,kind:"slow-function",severity:"info",value:i.maxDurationMs})}i.calls>=t.minErrorCalls&&i.errors/i.calls>=t.highErrorRate&&s.push({fn:i.path,kind:"high-error-rate",message:i.lastErrorMessage??void 0,severity:"error",value:i.errors/i.calls});const r=i.conflicts??0;return r>0&&i.calls>=t.minConflictCalls&&r/i.calls>=t.highWriteContention&&s.push({fn:i.path,kind:"high-write-contention",severity:"warning",value:r/i.calls}),s},g=(i,t,s=c)=>{const r=[];if(i?.cache){const{evictions:e,hits:a,misses:h}=i.cache,o=a+h;if(o>=s.minCacheSamples){const n=a/o;n<s.lowCacheHitRate&&r.push({kind:"low-cache-hit-rate",severity:"warning",value:n})}e>0&&e>a&&r.push({kind:"high-evictions",severity:"warning",value:e})}for(const e of t??[])r.push(...u(e,s));return r.toSorted((e,a)=>l[e.severity]-l[a.severity])};export{c as DEFAULT_INSIGHT_THRESHOLDS,g as deriveInsights};
@@ -0,0 +1 @@
1
+ import{setupI18n as a}from"@lingui/core";import{compileMessage as i}from"@lingui/message-utils/compileMessage";import{createContext as c,use as m}from"react";const u={},s="en",p={en:u},f=(e=s,o=p)=>{const t=a();t.setMessagesCompiler(i);for(const[n,r]of Object.entries(o))t.load(n,r);return t.activate(o[e]===void 0?s:e),t},d=f(),I=c(d),L=()=>{const e=m(I);return(o,t)=>e._(o,t)};export{s as DEFAULT_LOCALE,I as StudioI18nContext,f as createStudioI18n,d as studioI18n,L as useT};
@@ -0,0 +1 @@
1
+ import{c as j}from"react/compiler-runtime";import{useLunora as Je}from"@lunora/react";import{useState as P,useMemo as ot,useRef as je,useCallback as rt,useEffect as Re}from"react";import{ShardInput as cn}from"./ShardInput-BVn2iCU0.js";import{N as ze}from"./use-admin-query-CnnyWJXM.js";import{ADMIN_FUNCTIONS as ee}from"./ADMIN_FUNCTIONS-4aE59aDq.js";import{b as $t}from"./browser-storage-xjTyMKY0.js";import{h as Me,f as se,j as un,d as ue,g as ve,i as mn}from"./internal-zkEvTqy8.js";import{k as gn}from"./use-sql-assistant-Dtw55kKM.js";import{ConfirmButton as lt}from"./ConfirmButton-CTL3f3kr.js";import{E as fn}from"./empty-state-Cg7t_8qu.js";import{useT as me}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{useReactTable as bn,getSortedRowModel as pn,getCoreRowModel as hn,flexRender as xn}from"@tanstack/react-table";import{useVirtualizer as vn}from"@tanstack/react-virtual";import{f as it}from"./checkbox-StT4Gob6.js";import{c as Ve}from"./utils-bhneXptQ.js";import{l as wn}from"./virtual-rect-1o1veP7R.js";import{g as Ye,k as yn,v as Sn}from"./data-grid-Ci4-tZkk.js";import{jsx as m,jsxs as T,Fragment as qe}from"react/jsx-runtime";import{DataFilters as Nn,toFilterClauses as Ee}from"./DataFilters-B26ZeqBZ.js";import{c as Cn,r as kn}from"./grid-features-Db_BNYRo.js";import{_ as $n,u as Tn,i as et,a as En,$ as Rn}from"./table-list-sidebar-fz0m_4I4.js";import{M as Tt}from"./modal-shell-CUwwWC2o.js";import{a as _n,s as Mn,m as Pn,O as Dn}from"./wire-codec-BUrWLklj.js";import bt from"./useDebounced-CU-uftxO.js";import{r as In,l as On}from"./shard-history-DMEW5VBE.js";const pt=(r,e)=>{const n=[];for(const[o,t]of Object.entries(e))for(const l of t)l.ref===r&&n.push({column:l.name,table:o});return n.sort((o,t)=>o.table.localeCompare(t.table)||o.column.localeCompare(t.column)),n},dt=r=>`${r.table}.${r.column}`,Fn=/([a-z\d])([A-Z])/gu,zn=/[\s_-]+/u,jn=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),An=r=>{const e=r.replaceAll(Fn,"$1 $2").split(zn).map(o=>o.toLowerCase()).filter(o=>o.length>0),n=new Set(e);for(let o=0;o<e.length-1;o+=1){const t=e[o],l=e[o+1];t===void 0||l===void 0||(n.add(`${t}${l}`),n.add(`${t}_${l}`))}return[...n]},ht="•••",Ln=r=>{let e=2166136261;for(let n=0;n<r.length;n+=1)e^=r.codePointAt(n)??0,e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")},Et=(r,e)=>{try{return e==="redact"?null:e==="hash"?r==null?r:Ln(typeof r=="bigint"?r.toString():typeof r=="string"?r:JSON.stringify(r)):ht}catch{return ht}},Bn=(r,e)=>{const n=new Map;for(const o of r)o.table===e&&n.set(o.column,o.strategy);return n},Vn=r=>{for(const e of An(r))if(jn.has(e))return!0;return!1},qn=(r,e)=>{const n=e.filter(t=>!r.has(t)&&Vn(t));if(n.length===0)return r;const o=new Map(r);for(const t of n)o.set(t,"redact");return o},Jn=(r,e,n)=>{if(!n.enabled)return r;const o=n.columns.get(e);return o===void 0?r:Et(r,o)},xt=(r,e)=>!e.enabled||e.columns.size===0?r:r.map(n=>{const o={...n};for(const[t,l]of e.columns)t in o&&(o[t]=Et(o[t],l));return o}),Kn=(r,e,n,o,t=300)=>{if(o<=0)return{ids:new Set(r.map(c=>c.id)),leadPx:0,tailPx:0};const l=n-t,i=n+o+t,a=new Set;let d=0,s=0,g=0;for(const c of r){const u=c.getSize(),b=e.has(c.id),f=d+u>l&&d<i;b||f?a.add(c.id):d<l?s+=u:g+=u,d+=u}return{ids:a,leadPx:s,tailPx:g}},Gn=(r,e)=>{const n=new Map;let o=0;for(const t of r)e.has(t.id)&&(n.set(t.id,o),o+=t.getSize());return n},Hn=()=>{const r=j(11);let e;r[0]===Symbol.for("react.memo_cache_sentinel")?(e={},r[0]=e):e=r[0];const[n,o]=P(e);let t;r[1]===Symbol.for("react.memo_cache_sentinel")?(t=(b,f,p)=>{o(v=>({...v,[b]:{...v[b],[f]:p}}))},r[1]=t):t=r[1];const l=t;let i;r[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{o({})},r[2]=i):i=r[2];const a=i;let d;r[3]!==n?(d=(b,f)=>{const p=n[b];return p!==void 0&&f in p?{value:p[f]}:void 0},r[3]=n,r[4]=d):d=r[4];const s=d;let g;r[5]!==n?(g=Object.values(n).reduce(Un,0),r[5]=n,r[6]=g):g=r[6];const c=g;let u;return r[7]!==c||r[8]!==n||r[9]!==s?(u={clear:a,count:c,stage:l,staged:n,stagedValue:s},r[7]=c,r[8]=n,r[9]=s,r[10]=u):u=r[10],u},Qn=(r,e)=>{if(typeof e=="number"){const n=Number(r);return r.trim()===""||Number.isNaN(n)?r:n}if(typeof e=="boolean"){if(r==="true")return!0;if(r==="false")return!1}return r},Wn=r=>{const e=j(29),{changes:n,committing:o,onCommit:t,onDiscard:l}=r,i=me();let a;e[0]!==n.length||e[1]!==i?(a=i("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=i,e[2]=a):a=e[2];let d;e[3]!==a?(d=m("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:a}),e[3]=a,e[4]=d):d=e[4];let s;e[5]!==o||e[6]!==i?(s=i(o?"Committing…":"Commit"),e[5]=o,e[6]=i,e[7]=s):s=e[7];let g;e[8]!==o||e[9]!==t||e[10]!==s?(g=m("button",{className:"ms-auto rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-commit",disabled:o,onClick:t,type:"button",children:s}),e[8]=o,e[9]=t,e[10]=s,e[11]=g):g=e[11];let c;e[12]!==i?(c=i("Discard"),e[12]=i,e[13]=c):c=e[13];let u;e[14]!==o||e[15]!==l||e[16]!==c?(u=m("button",{className:"rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-discard",disabled:o,onClick:l,type:"button",children:c}),e[14]=o,e[15]=l,e[16]=c,e[17]=u):u=e[17];let b;e[18]!==d||e[19]!==g||e[20]!==u?(b=T("div",{className:"flex flex-wrap items-center gap-2",children:[d,g,u]}),e[18]=d,e[19]=g,e[20]=u,e[21]=b):b=e[21];let f;e[22]!==n?(f=n.map(Zn),e[22]=n,e[23]=f):f=e[23];let p;e[24]!==f?(p=m("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:f}),e[24]=f,e[25]=p):p=e[25];let v;return e[26]!==b||e[27]!==p?(v=T("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[b,p]}),e[26]=b,e[27]=p,e[28]=v):v=e[28],v};function Un(r,e){return r+Object.keys(e).length}function Zn(r){return T("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[T("span",{className:"text-muted-foreground",children:[r.rowId,".",r.column]}),m("span",{className:"text-destructive line-through",children:Me(r.oldValue)}),m("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),m("span",{className:"text-foreground",children:Me(r.newValue)})]},`${r.rowId}:${r.column}`)}const vt=400,Xn=36,Yn={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},eo={width:"100%"},to={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},no={display:"flex",width:"100%"},wt={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},oo="2.5rem",Rt={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},ct=r=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${r.toString()}px`}),_t=(r,e)=>({...ct(r),left:`calc(${oo} + ${e.toString()}px)`,position:"sticky",zIndex:2}),yt="rounded-md px-2 py-0.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",ro=(r,e,n)=>e.enabled&&e.columns.has(n)?void 0:r,at="__back__:",lo=r=>`${at}${r.table}.${r.column}`,ao=r=>{const e=j(3),{counts:n,rowId:o}=r;if(n===void 0){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=m("span",{className:"text-muted-foreground/50",children:"—"}),e[0]=i):i=e[0],i}const t=n[o]??0;let l;return e[1]!==t?(l=m("span",{className:"tabular-nums",children:t}),e[1]=t,e[2]=l):l=e[2],l},ye=r=>{for(const e of["id","__id__","_id"]){const n=r[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},Mt=(r,e)=>ye(r)??`row-${e.toString()}`,so=8,io=r=>{const e=j(16),{anchor:n,state:o}=r,t=me();let l;e[0]!==n.left||e[1]!==n.top?(l={left:n.left,position:"fixed",top:n.top,zIndex:50},e[0]=n.left,e[1]=n.top,e[2]=l):l=e[2];const i=l;let a;if(o==="loading"){let s;e[3]!==t?(s=t("Loading…"),e[3]=t,e[4]=s):s=e[4];let g;e[5]!==s?(g=m("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:s}),e[5]=s,e[6]=g):g=e[6],a=g}else if(o.row===null){let s;e[7]!==t?(s=t("No matching row."),e[7]=t,e[8]=s):s=e[8];let g;e[9]!==s?(g=m("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:s}),e[9]=s,e[10]=g):g=e[10],a=g}else{let s;if(e[11]!==o.row){const g=Object.entries(o.row).slice(0,so);s=m("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 px-3 py-2",children:g.map(yo)}),e[11]=o.row,e[12]=s}else s=e[12];a=s}let d;return e[13]!==a||e[14]!==i?(d=m("div",{className:"pointer-events-none w-72 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground","data-testid":"db-ref-preview",role:"tooltip",style:i,children:a}),e[13]=a,e[14]=i,e[15]=d):d=e[15],d},co=r=>{const e=j(22),{column:n,id:o,onNavigate:t,onPreview:l,target:i}=r,[a,d]=P(null),[s,g]=P("idle");let c;e[0]!==o||e[1]!==t||e[2]!==i?(c=()=>{t(i,o)},e[0]=o,e[1]=t,e[2]=i,e[3]=c):c=e[3];const u=c;let b;e[4]!==o||e[5]!==l||e[6]!==s||e[7]!==i?(b=$=>{const h=$.currentTarget.getBoundingClientRect();d({left:h.left,top:h.bottom+4}),s==="idle"&&(g("loading"),se((async()=>{try{g({row:await l(i,o)})}catch{g({row:null})}})()))},e[4]=o,e[5]=l,e[6]=s,e[7]=i,e[8]=b):b=e[8];const f=b;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{d(null)},e[9]=p):p=e[9];const v=p,x=`db-ref-${n}`,w=`Open ${i} ${o}`;let y;e[10]!==o||e[11]!==u||e[12]!==f||e[13]!==x||e[14]!==w?(y=T("button",{"data-testid":x,onBlur:v,onClick:u,onFocus:f,onMouseEnter:f,onMouseLeave:v,title:w,type:"button",children:[o," ↗"]}),e[10]=o,e[11]=u,e[12]=f,e[13]=x,e[14]=w,e[15]=y):y=e[15];let S;e[16]!==a||e[17]!==s?(S=a!==null&&s!=="idle"&&m(io,{anchor:a,state:s}),e[16]=a,e[17]=s,e[18]=S):S=e[18];let N;return e[19]!==y||e[20]!==S?(N=T(qe,{children:[y,S]}),e[19]=y,e[20]=S,e[21]=N):N=e[21],N},uo=r=>r==="asc"?" ▲":r==="desc"?" ▼":"",mo="absolute end-1 top-1/2 hidden -translate-y-1/2 items-center justify-center rounded text-muted-foreground outline-none group-hover/cell:flex hover:text-foreground focus-visible:flex",St=r=>{const e=j(8),{column:n,onExpand:o,value:t}=r;let l;e[0]!==n||e[1]!==o||e[2]!==t?(l=()=>{o(n,t)},e[0]=n,e[1]=o,e[2]=t,e[3]=l):l=e[3];const i=l,a=`db-expand-${n}`;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=m("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:m("path",{d:"M9 21H5a2 2 0 0 1-2-2v-4m18 0v4a2 2 0 0 1-2 2h-4M3 9V5a2 2 0 0 1 2-2h4m6 0h4a2 2 0 0 1 2 2v4"})}),e[4]=d):d=e[4];let s;return e[5]!==i||e[6]!==a?(s=m("button",{"aria-label":"Expand cell",className:mo,"data-testid":a,onClick:i,type:"button",children:d}),e[5]=i,e[6]=a,e[7]=s):s=e[7],s},go=r=>{const e=j(15),{column:n,initial:o,onCancel:t,onCommit:l,recordId:i}=r,a=je(null);let d,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{a.current?.select()},s=[],e[0]=d,e[1]=s):(d=e[0],s=e[1]),Re(d,s);let g;e[2]!==t||e[3]!==l?(g=x=>{x.key==="Enter"?(x.preventDefault(),l(x.currentTarget.value)):x.key==="Escape"&&(x.preventDefault(),t())},e[2]=t,e[3]=l,e[4]=g):g=e[4];const c=g;let u;e[5]!==l?(u=x=>{l(x.currentTarget.value)},e[5]=l,e[6]=u):u=e[6];const b=u,f=`db-cell-input-${i}-${n}`;let p;e[7]!==o?(p=Me(o),e[7]=o,e[8]=p):p=e[8];let v;return e[9]!==n||e[10]!==b||e[11]!==c||e[12]!==f||e[13]!==p?(v=m("input",{"aria-label":n,className:"w-full rounded border border-ring bg-background px-1 py-0.5 font-mono text-xs outline-none","data-testid":f,defaultValue:p,onBlur:b,onKeyDown:c,ref:a}),e[9]=n,e[10]=b,e[11]=c,e[12]=f,e[13]=p,e[14]=v):v=e[14],v},fo=r=>{const e=j(68),{cell:n,edit:o,highlight:t,mask:l,refs:i}=r,a=n.column.id;let d,s,g,c;if(e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==l||e[4]!==i.columns||e[5]!==i.onNavigate||e[6]!==i.onPreview){c=Symbol.for("react.early_return_sentinel");e:{s=n.getValue(),d=ye(n.row.original);const E=i.columns?.[a];if(l.enabled&&l.columns.has(a)){const R=`db-masked-${a}`,_=m(Ye,{value:Jn(s,a,l)});let k;e[11]!==R||e[12]!==_?(k=m("span",{className:"text-muted-foreground italic","data-testid":R,title:"Masked (preview)",children:_}),e[11]=R,e[12]=_,e[13]=k):k=e[13],c=k;break e}if(E!==void 0&&(typeof s=="string"||typeof s=="number")&&String(s)!==""){const R=String(s),_=`${E}:${String(s)}`;let k;e[14]!==a||e[15]!==i.onNavigate||e[16]!==i.onPreview||e[17]!==R||e[18]!==_||e[19]!==E?(k=m(co,{column:a,id:R,onNavigate:i.onNavigate,onPreview:i.onPreview,target:E},_),e[14]=a,e[15]=i.onNavigate,e[16]=i.onPreview,e[17]=R,e[18]=_,e[19]=E,e[20]=k):k=e[20],c=k;break e}if(d===null){let R;e[21]!==s?(R=m(Ye,{value:s}),e[21]=s,e[22]=R):R=e[22];let _;e[23]!==a||e[24]!==o.onExpandCell||e[25]!==s?(_=m(St,{column:a,onExpand:o.onExpandCell,value:s}),e[23]=a,e[24]=o.onExpandCell,e[25]=s,e[26]=_):_=e[26];let k;e[27]!==R||e[28]!==_?(k=T(qe,{children:[R,_]}),e[27]=R,e[28]=_,e[29]=k):k=e[29],c=k;break e}g=o.stagedValue(d,a)}e[0]=n,e[1]=a,e[2]=o,e[3]=l,e[4]=i.columns,e[5]=i.onNavigate,e[6]=i.onPreview,e[7]=d,e[8]=s,e[9]=g,e[10]=c}else d=e[7],s=e[8],g=e[9],c=e[10];if(c!==Symbol.for("react.early_return_sentinel"))return c;const u=g,b=u===void 0?s:u.value;let f;e[30]!==a||e[31]!==o?(f=o.editable&&o.editableColumn(a),e[30]=a,e[31]=o,e[32]=f):f=e[32];const p=f;if(o.editingCell!==null&&o.editingCell.rowId===d&&o.editingCell.column===a){let E;e[33]!==a||e[34]!==o||e[35]!==d||e[36]!==s?(E=_=>{o.stage(d,a,Qn(_,s)),o.cancelEdit()},e[33]=a,e[34]=o,e[35]=d,e[36]=s,e[37]=E):E=e[37];let R;return e[38]!==a||e[39]!==b||e[40]!==o.cancelEdit||e[41]!==d||e[42]!==E?(R=m(go,{column:a,initial:b,onCancel:o.cancelEdit,onCommit:E,recordId:d}),e[38]=a,e[39]=b,e[40]=o.cancelEdit,e[41]=d,e[42]=E,e[43]=R):R=e[43],R}let v;u!==void 0?v="rounded bg-warning/15 px-1":p&&(v="cursor-text");let x;e[44]!==p||e[45]!==a||e[46]!==o||e[47]!==d?(x=p?()=>{o.startEdit(d,a)}:void 0,e[44]=p,e[45]=a,e[46]=o,e[47]=d,e[48]=x):x=e[48];const w=x,y=v,S=`db-cell-${d}-${a}`;let N;e[49]!==a||e[50]!==t||e[51]!==l?(N=ro(t,l,a),e[49]=a,e[50]=t,e[51]=l,e[52]=N):N=e[52];let $;e[53]!==b||e[54]!==N?($=m(Ye,{highlight:N,value:b}),e[53]=b,e[54]=N,e[55]=$):$=e[55];let h;e[56]!==v||e[57]!==w||e[58]!==S||e[59]!==$?(h=m("span",{className:y,"data-testid":S,onDoubleClick:w,children:$}),e[56]=v,e[57]=w,e[58]=S,e[59]=$,e[60]=h):h=e[60];let C;e[61]!==a||e[62]!==b||e[63]!==o.onExpandCell?(C=m(St,{column:a,onExpand:o.onExpandCell,value:b}),e[61]=a,e[62]=b,e[63]=o.onExpandCell,e[64]=C):C=e[64];let D;return e[65]!==C||e[66]!==h?(D=T(qe,{children:[h,C]}),e[65]=C,e[66]=h,e[67]=D):D=e[67],D},bo=r=>{r.preventDefault()},po=({draggedRef:r,header:e,masked:n=!1,onTogglePin:o,pinnedOffset:t,table:l})=>{const i=()=>{r.current=e.column.id},a=()=>{const d=r.current,s=e.column.id;if(r.current=null,d===null||d===s)return;const g=l.getState().columnOrder,c=(g.length>0?g:l.getAllLeafColumns().map(b=>b.id)).filter(b=>b!==d),u=c.indexOf(s);c.splice(u===-1?c.length:u,0,d),l.setColumnOrder(c)};return T("th",{className:Ve("group/head text-start text-xs font-medium text-muted-foreground",t!==void 0&&"border-e border-border bg-muted"),draggable:!0,onDragOver:bo,onDragStart:i,onDrop:a,style:t===void 0?ct(e.getSize()):_t(e.getSize(),t),children:[T("button",{className:"inline-flex max-w-full cursor-grab items-center gap-1 truncate outline-none hover:text-foreground","data-testid":`db-sort-${e.column.id}`,onClick:e.column.getToggleSortingHandler(),type:"button",children:[xn(e.column.columnDef.header,e.getContext()),uo(e.column.getIsSorted())]}),n&&m("span",{className:"ms-1 inline-flex items-center rounded-sm bg-warning/15 px-1 text-[0.625rem] font-medium uppercase text-warning","data-testid":`db-mask-chip-${e.column.id}`,title:"This column is masked by a mask() policy",children:"masked"}),m("button",{"aria-label":t===void 0?`Pin ${e.column.id}`:`Unpin ${e.column.id}`,"aria-pressed":t!==void 0,className:Ve("ms-1 rounded-sm px-1 text-[0.625rem] outline-none transition-opacity hover:bg-accent focus-visible:bg-accent",t===void 0?"opacity-0 group-hover/head:opacity-100 focus-visible:opacity-100":"opacity-100 text-foreground"),"data-testid":`db-pin-${e.column.id}`,onClick:()=>{o(e.column.id)},type:"button",children:"📌"}),m("span",{"aria-hidden":"true",className:"absolute inset-y-0 end-0 w-1 cursor-col-resize touch-none select-none hover:bg-ring/60 data-[resizing=true]:bg-ring","data-resizing":e.column.getIsResizing(),"data-testid":`db-resize-${e.column.id}`,onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler()})]})},ho=r=>{const e=j(13),{table:n}=r,o=me();let t;e[0]!==n?(t=g=>{n.toggleAllRowsSelected(g)},e[0]=n,e[1]=t):t=e[1];const l=t;let i;e[2]!==o?(i=o("Select all rows"),e[2]=o,e[3]=i):i=e[3];let a;e[4]!==n?(a=n.getIsAllRowsSelected(),e[4]=n,e[5]=a):a=e[5];let d;e[6]!==n?(d=n.getIsSomeRowsSelected()&&!n.getIsAllRowsSelected(),e[6]=n,e[7]=d):d=e[7];let s;return e[8]!==l||e[9]!==i||e[10]!==a||e[11]!==d?(s=m("th",{className:"bg-muted",style:Rt,children:m(it,{"aria-label":i,checked:a,"data-testid":"db-select-all",indeterminate:d,onCheckedChange:l})}),e[8]=l,e[9]=i,e[10]=a,e[11]=d,e[12]=s):s=e[12],s},xo=r=>{const e=j(17),{row:n}=r,o=me();let t;e[0]!==n.original?(t=ye(n.original),e[0]=n.original,e[1]=t):t=e[1];const l=t;let i;e[2]!==n?(i=f=>{n.toggleSelected(f)},e[2]=n,e[3]=i):i=e[3];const a=i;let d;e[4]!==o?(d=o("Select row"),e[4]=o,e[5]=d):d=e[5];let s;e[6]!==n?(s=n.getIsSelected(),e[6]=n,e[7]=s):s=e[7];let g;e[8]!==n.index||e[9]!==n.original?(g=Mt(n.original,n.index),e[8]=n.index,e[9]=n.original,e[10]=g):g=e[10];const c=`db-select-${g}`,u=l===null;let b;return e[11]!==a||e[12]!==d||e[13]!==s||e[14]!==c||e[15]!==u?(b=m("td",{className:"bg-background",style:Rt,children:m(it,{"aria-label":d,checked:s,"data-testid":c,disabled:u,onCheckedChange:a})}),e[11]=a,e[12]=d,e[13]=s,e[14]=c,e[15]=u,e[16]=b):b=e[16],b},vo=r=>{const e=j(70),{edit:n,editable:o,mask:t,onDelete:l,onEdit:i,onInspect:a,highlight:d,backRelationCounts:s,onTogglePin:g,pinnedColumns:c,refs:u,tableModel:b}=r,{attachScroll:f,scrollLeft:p,scrollToIndex:v,table:x,tableRows:w,tbodyStyle:y,viewportWidth:S,virtualRows:N}=b,$=je(null),[h,C]=P(null);let D;e[0]!==x?(D=x.getVisibleLeafColumns(),e[0]=x,e[1]=D):D=e[1];const E=D.length;let R;e[2]!==h||e[3]!==E||e[4]!==n||e[5]!==x||e[6]!==w?(R=pe=>{if(!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"].includes(pe.key))return;pe.preventDefault();const W=h??{col:0,row:0};if(pe.key==="Enter"){const L=w[W.row],Y=x.getVisibleLeafColumns()[W.col];if(L!==void 0&&Y!==void 0){const q=ye(L.original);q!==null&&n.editableColumn(Y.id)&&n.startEdit(q,Y.id)}C(W);return}let{col:te,row:Q}=W;e:switch(pe.key){case"ArrowDown":{Q=Math.min(Q+1,w.length-1);break e}case"ArrowRight":{te=Math.min(te+1,E-1);break e}case"ArrowUp":{Q=Math.max(Q-1,0);break e}default:te=Math.max(te-1,0)}C({col:te,row:Q})},e[2]=h,e[3]=E,e[4]=n,e[5]=x,e[6]=w,e[7]=R):R=e[7];const _=R;let k,F;e[8]!==h||e[9]!==v?(k=()=>{h!==null&&v(h.row)},F=[h,v],e[8]=h,e[9]=v,e[10]=k,e[11]=F):(k=e[10],F=e[11]),Re(k,F);let B,O,I,G,A,V,H,Z,ge,oe,re,fe,ie,de;if(e[12]!==h||e[13]!==f||e[14]!==s||e[15]!==n||e[16]!==o||e[17]!==d||e[18]!==t||e[19]!==l||e[20]!==i||e[21]!==_||e[22]!==a||e[23]!==g||e[24]!==c||e[25]!==u||e[26]!==p||e[27]!==x||e[28]!==w||e[29]!==y||e[30]!==S||e[31]!==N){const pe=x.getVisibleLeafColumns().map(So),W=Kn(pe,c,p,S),te=Gn(x.getVisibleLeafColumns().map(No),c),Q=q=>{const Se=w[q.index],{original:Ne}=Se,Ce=ye(Ne),ke=Mt(Ne,q.index),ae={...to,height:`${q.size.toString()}px`,transform:`translateY(${q.start.toString()}px)`};return T("tr",{className:"border-b border-border text-xs transition-colors hover:bg-muted/50","data-testid":"db-row",style:ae,children:[m(xo,{row:Se}),W.leadPx>0&&m("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),Se.getVisibleCells().map((J,Pe)=>{if(!W.ids.has(J.column.id))return null;const Te=te.get(J.column.id),De=h!==null&&h.row===q.index&&h.col===Pe?" ring-1 ring-ring ring-inset":"";return m("td",{className:Ve("group/cell truncate font-mono text-muted-foreground",Te!==void 0&&"border-e border-border bg-background",De),style:Te===void 0?ct(J.column.getSize()):_t(J.column.getSize(),Te),children:J.column.id.startsWith(at)?m(ao,{counts:s[J.column.id.slice(at.length)],rowId:ke}):m(fo,{cell:J,edit:n,highlight:d,mask:t,refs:u})},J.id)}),W.tailPx>0&&m("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),T("td",{className:"flex items-center gap-1",style:wt,children:[m("button",{className:yt,"data-testid":`db-inspect-${ke}`,onClick:()=>{a(Ne)},type:"button",children:"Details"}),o&&T(qe,{children:[m("button",{className:yt,"data-testid":`db-edit-${ke}`,disabled:Ce===null,onClick:()=>{i(Ce,Ne)},type:"button",children:"Edit"}),m(lt,{confirmLabel:"Delete?",disabled:Ce===null,onConfirm:()=>{l(Ce)},testId:`db-delete-${ke}`,children:"Delete"})]})]})]},Se.id)};B=yn,ge="fill",I="db-scroll",G=_,A=f,V="grid",H=Yn,Z=0,fe="w-full text-xs",ie="db-rows",de=eo;let L;e[46]!==x?(L=m(ho,{table:x}),e[46]=x,e[47]=L):L=e[47];let Y;e[48]===Symbol.for("react.memo_cache_sentinel")?(Y=m("th",{"aria-label":"Row actions",style:wt}),e[48]=Y):Y=e[48],O=m("thead",{className:"bg-muted/50",children:T("tr",{className:"border-b border-border",style:no,children:[L,W.leadPx>0&&m("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),x.getFlatHeaders().map(q=>W.ids.has(q.column.id)?m(po,{draggedRef:$,header:q,masked:t.columns.has(q.column.id),onTogglePin:g,pinnedOffset:te.get(q.column.id),table:x},q.id):null),W.tailPx>0&&m("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),Y]})}),oe=y,re=N.map(q=>Q(q)),e[12]=h,e[13]=f,e[14]=s,e[15]=n,e[16]=o,e[17]=d,e[18]=t,e[19]=l,e[20]=i,e[21]=_,e[22]=a,e[23]=g,e[24]=c,e[25]=u,e[26]=p,e[27]=x,e[28]=w,e[29]=y,e[30]=S,e[31]=N,e[32]=B,e[33]=O,e[34]=I,e[35]=G,e[36]=A,e[37]=V,e[38]=H,e[39]=Z,e[40]=ge,e[41]=oe,e[42]=re,e[43]=fe,e[44]=ie,e[45]=de}else B=e[32],O=e[33],I=e[34],G=e[35],A=e[36],V=e[37],H=e[38],Z=e[39],ge=e[40],oe=e[41],re=e[42],fe=e[43],ie=e[44],de=e[45];let ce;e[49]!==oe||e[50]!==re?(ce=m("tbody",{style:oe,children:re}),e[49]=oe,e[50]=re,e[51]=ce):ce=e[51];let le;e[52]!==O||e[53]!==ce||e[54]!==fe||e[55]!==ie||e[56]!==de?(le=T("table",{className:fe,"data-testid":ie,style:de,children:[O,ce]}),e[52]=O,e[53]=ce,e[54]=fe,e[55]=ie,e[56]=de,e[57]=le):le=e[57];let X;e[58]!==I||e[59]!==G||e[60]!==A||e[61]!==V||e[62]!==H||e[63]!==Z||e[64]!==le?(X=m("div",{"data-testid":I,onKeyDown:G,ref:A,role:V,style:H,tabIndex:Z,children:le}),e[58]=I,e[59]=G,e[60]=A,e[61]=V,e[62]=H,e[63]=Z,e[64]=le,e[65]=X):X=e[65];let be;return e[66]!==B||e[67]!==ge||e[68]!==X?(be=m(B,{layout:ge,children:X}),e[66]=B,e[67]=ge,e[68]=X,e[69]=be):be=e[69],be},wo=(r,e,n,o=[])=>{const t=r?.columns,l=r?.rows,i=r?.refs,a=ot(()=>{if(t===void 0)return[];const h=t.map(C=>({accessorFn:D=>D[C],header:i?.[C]===void 0?C:`${C} →`,id:C}));for(const C of o)h.push({accessorFn:()=>{},enableSorting:!1,header:`← ${C.table}`,id:lo(C)});return h},[o,t,i]),d=ot(()=>l??[],[l]),[s,g]=P({}),[c,u]=P({}),b=bn({columnResizeMode:"onChange",columns:a,data:d,defaultColumn:{minSize:80,size:200},enableColumnResizing:!0,enableRowSelection:h=>ye(h.original)!==null,getCoreRowModel:hn(),getRowId:(h,C)=>ye(h)??`row-${C.toString()}`,getSortedRowModel:pn(),manualSorting:!0,onColumnVisibilityChange:u,onRowSelectionChange:g,onSortingChange:n,state:{columnVisibility:c,rowSelection:s,sorting:e}}),f=b.getRowModel().rows,p=je(null),v=vn({count:f.length,estimateSize:()=>Xn,getScrollElement:()=>p.current,initialRect:{height:vt,width:0},observeElementRect:(h,C)=>wn(h,C,vt),overscan:8}),x=rt(h=>{v.scrollToIndex(h)},[v]),[w,y]=P({left:0,width:0}),S=rt(h=>{if(p.current=h,h===null)return;const C=()=>{y(E=>E.left===h.scrollLeft&&E.width===h.clientWidth?E:{left:h.scrollLeft,width:h.clientWidth})};h.addEventListener("scroll",C,{passive:!0});const D=new ResizeObserver(C);return D.observe(h),()=>{h.removeEventListener("scroll",C),D.disconnect(),p.current=null}},[]),N=v.getVirtualItems(),$={display:"block",height:`${v.getTotalSize().toString()}px`,position:"relative"};return{attachScroll:S,scrollLeft:w.left,scrollToIndex:x,table:b,tableRows:f,tbodyStyle:$,viewportWidth:w.width,virtualRows:N}};function yo(r){const[e,n]=r;return T("div",{className:"contents",children:[m("dt",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e}),m("dd",{className:"truncate font-mono text-[11px] text-foreground",title:Me(n),children:Me(n)})]},e)}function So(r){return{getSize:()=>r.getSize(),id:r.id}}function No(r){return{getSize:()=>r.getSize(),id:r.id}}const st="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",Co=r=>{const e=j(22),{onCommit:n}=r,o=me(),[t,l]=P(""),i=je(null);let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{i.current?.focus()},d=[],e[0]=a,e[1]=d):(a=e[0],d=e[1]),Re(a,d);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=y=>{l(y.target.value)},e[2]=s):s=e[2];const g=s;let c;e[3]!==t||e[4]!==n?(c=()=>{const y=t.trim();y!==""&&n(y)},e[3]=t,e[4]=n,e[5]=c):c=e[5];const u=c;let b;e[6]!==o?(b=o("Query name"),e[6]=o,e[7]=b):b=e[7];let f;e[8]!==o?(f=o("Query name"),e[8]=o,e[9]=f):f=e[9];let p;e[10]!==t||e[11]!==b||e[12]!==f?(p=m("input",{"aria-label":b,className:"h-7 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"db-save-query-name",onChange:g,placeholder:f,ref:i,value:t}),e[10]=t,e[11]=b,e[12]=f,e[13]=p):p=e[13];let v;e[14]!==o?(v=o("Save"),e[14]=o,e[15]=v):v=e[15];let x;e[16]!==u||e[17]!==v?(x=m("button",{className:st,"data-testid":"db-save-query-confirm",onClick:u,type:"button",children:v}),e[16]=u,e[17]=v,e[18]=x):x=e[18];let w;return e[19]!==p||e[20]!==x?(w=T("span",{className:"inline-flex items-center gap-1",children:[p,x]}),e[19]=p,e[20]=x,e[21]=w):w=e[21],w},ko=r=>{const e=j(27),{onApply:n,onCopyLink:o,onDelete:t,onSave:l,saved:i}=r,a=me(),[d,s]=P(!1);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{s(!0)},e[0]=g):g=e[0];const c=g;let u;e[1]!==l?(u=h=>{l(h),s(!1)},e[1]=l,e[2]=u):u=e[2];const b=u;let f;e[3]!==n||e[4]!==i?(f=h=>{const C=i[Number(h.currentTarget.dataset.index)];C!==void 0&&n(C)},e[3]=n,e[4]=i,e[5]=f):f=e[5];const p=f;let v;e[6]!==t||e[7]!==i?(v=h=>{const C=i[Number(h.currentTarget.dataset.index)];C!==void 0&&t(C.name)},e[6]=t,e[7]=i,e[8]=v):v=e[8];const x=v;let w;e[9]!==a?(w=a("Copy link"),e[9]=a,e[10]=w):w=e[10];let y;e[11]!==o||e[12]!==w?(y=m("button",{className:st,"data-testid":"db-copy-link",onClick:o,type:"button",children:w}),e[11]=o,e[12]=w,e[13]=y):y=e[13];let S;e[14]!==b||e[15]!==d||e[16]!==a?(S=d?m(Co,{onCommit:b}):m("button",{className:st,"data-testid":"db-save-query",onClick:c,type:"button",children:a("Save query")}),e[14]=b,e[15]=d,e[16]=a,e[17]=S):S=e[17];let N;e[18]!==p||e[19]!==x||e[20]!==i||e[21]!==a?(N=i.length>0&&T("div",{className:"flex flex-wrap items-center gap-1","data-testid":"db-saved-queries",children:[m("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:a("Saved")}),i.map((h,C)=>T("span",{className:"inline-flex items-center overflow-hidden rounded-md border border-border",children:[m("button",{className:"px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-accent","data-index":C,"data-testid":`db-saved-query-${h.name}`,onClick:p,type:"button",children:h.name}),m("button",{"aria-label":a("Delete saved query {name}",{name:h.name}),className:"border-l border-border px-1 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive","data-index":C,"data-testid":`db-saved-query-delete-${h.name}`,onClick:x,type:"button",children:"✕"})]},h.name))]}),e[18]=p,e[19]=x,e[20]=i,e[21]=a,e[22]=N):N=e[22];let $;return e[23]!==y||e[24]!==S||e[25]!==N?($=T("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-query-bar",children:[y,S,N]}),e[23]=y,e[24]=S,e[25]=N,e[26]=$):$=e[26],$},Ae="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",Ke="w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus-visible:border-ring",$o=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,To=(r,e)=>typeof e=="boolean"?"boolean":typeof e=="number"?$o.test(r)?"date":"number":e!==null&&typeof e=="object"?"json":"text",Eo=r=>{try{const e=JSON.parse(r);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}},Ro=r=>{const e=new Date(r),n=o=>String(o).padStart(2,"0");return`${e.getFullYear().toString()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`},_o=r=>{const e=j(8),{column:n,onChange:o,value:t}=r;let l;e[0]!==n||e[1]!==o?(l=g=>{o(n,g)},e[0]=n,e[1]=o,e[2]=l):l=e[2];const i=l,a=t===!0,d=`db-field-${n}`;let s;return e[3]!==n||e[4]!==i||e[5]!==a||e[6]!==d?(s=m(it,{"aria-label":n,checked:a,"data-testid":d,onCheckedChange:i}),e[3]=n,e[4]=i,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},Mo=r=>{const e=j(8),{column:n,onChange:o,value:t}=r;let l;e[0]!==n||e[1]!==o?(l=g=>{const c=Number(g.target.value);g.target.value!==""&&!Number.isNaN(c)&&o(n,c)},e[0]=n,e[1]=o,e[2]=l):l=e[2];const i=l,a=`db-field-${n}`,d=typeof t=="number"?t:"";let s;return e[3]!==n||e[4]!==i||e[5]!==a||e[6]!==d?(s=m("input",{"aria-label":n,className:Ke,"data-testid":a,onChange:i,type:"number",value:d}),e[3]=n,e[4]=i,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},Po=r=>{const e=j(10),{column:n,onChange:o,value:t}=r;let l;e[0]!==n||e[1]!==o?(l=g=>{const c=new Date(g.target.value).getTime();Number.isNaN(c)||o(n,c)},e[0]=n,e[1]=o,e[2]=l):l=e[2];const i=l,a=`db-field-${n}`;let d;e[3]!==t?(d=typeof t=="number"?Ro(t):"",e[3]=t,e[4]=d):d=e[4];let s;return e[5]!==n||e[6]!==i||e[7]!==a||e[8]!==d?(s=m("input",{"aria-label":n,className:Ke,"data-testid":a,onChange:i,type:"datetime-local",value:d}),e[5]=n,e[6]=i,e[7]=a,e[8]=d,e[9]=s):s=e[9],s},Do=r=>{const e=j(8),{column:n,onChange:o,value:t}=r;let l;e[0]!==n||e[1]!==o?(l=g=>{o(n,g.target.value)},e[0]=n,e[1]=o,e[2]=l):l=e[2];const i=l,a=`db-field-${n}`,d=typeof t=="string"?t:"";let s;return e[3]!==n||e[4]!==i||e[5]!==a||e[6]!==d?(s=m("input",{"aria-label":n,className:Ke,"data-testid":a,onChange:i,type:"text",value:d}),e[3]=n,e[4]=i,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},Io=r=>{const e=j(20),{column:n,onChange:o,value:t}=r,l=me();let i;e[0]!==t?(i=()=>JSON.stringify(t,null,2),e[0]=t,e[1]=i):i=e[1];const[a,d]=P(i),[s,g]=P(!1);let c;e[2]!==n||e[3]!==o?(c=y=>{const S=y.target.value;d(S);try{o(n,JSON.parse(S)),g(!1)}catch{g(!0)}},e[2]=n,e[3]=o,e[4]=c):c=e[4];const u=c,b=s&&"border-destructive";let f;e[5]!==b?(f=Ve(Ke,"min-h-16",b),e[5]=b,e[6]=f):f=e[6];const p=`db-field-${n}`;let v;e[7]!==n||e[8]!==u||e[9]!==f||e[10]!==p||e[11]!==a?(v=m("textarea",{"aria-label":n,className:f,"data-testid":p,onChange:u,value:a}),e[7]=n,e[8]=u,e[9]=f,e[10]=p,e[11]=a,e[12]=v):v=e[12];let x;e[13]!==n||e[14]!==s||e[15]!==l?(x=s&&m("span",{className:"text-xs text-destructive","data-testid":`db-field-error-${n}`,children:l("Invalid JSON")}),e[13]=n,e[14]=s,e[15]=l,e[16]=x):x=e[16];let w;return e[17]!==v||e[18]!==x?(w=T("div",{className:"flex flex-col gap-1",children:[v,x]}),e[17]=v,e[18]=x,e[19]=w):w=e[19],w},Oo=r=>{const e=j(43),{column:n,onChange:o,target:t,value:l}=r;let i;e[0]!==n||e[1]!==l?(i=To(n,l),e[0]=n,e[1]=l,e[2]=i):i=e[2];const a=i,d=`db-field-${n}`;let s;e[3]!==n?(s=m("span",{className:"font-mono",children:n}),e[3]=n,e[4]=s):s=e[4];let g;e[5]!==t?(g=t!==void 0&&T("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:["→ ",t]}),e[5]=t,e[6]=g):g=e[6];let c;e[7]!==s||e[8]!==g?(c=T("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground",children:[s,g]}),e[7]=s,e[8]=g,e[9]=c):c=e[9];let u;e[10]!==n||e[11]!==a||e[12]!==o||e[13]!==l?(u=a==="boolean"&&m(_o,{column:n,onChange:o,value:l}),e[10]=n,e[11]=a,e[12]=o,e[13]=l,e[14]=u):u=e[14];let b;e[15]!==n||e[16]!==a||e[17]!==o||e[18]!==l?(b=a==="number"&&m(Mo,{column:n,onChange:o,value:l}),e[15]=n,e[16]=a,e[17]=o,e[18]=l,e[19]=b):b=e[19];let f;e[20]!==n||e[21]!==a||e[22]!==o||e[23]!==l?(f=a==="date"&&m(Po,{column:n,onChange:o,value:l}),e[20]=n,e[21]=a,e[22]=o,e[23]=l,e[24]=f):f=e[24];let p;e[25]!==n||e[26]!==a||e[27]!==o||e[28]!==l?(p=a==="json"&&m(Io,{column:n,onChange:o,value:l}),e[25]=n,e[26]=a,e[27]=o,e[28]=l,e[29]=p):p=e[29];let v;e[30]!==n||e[31]!==a||e[32]!==o||e[33]!==l?(v=a==="text"&&m(Do,{column:n,onChange:o,value:l}),e[30]=n,e[31]=a,e[32]=o,e[33]=l,e[34]=v):v=e[34];let x;return e[35]!==v||e[36]!==d||e[37]!==c||e[38]!==u||e[39]!==b||e[40]!==f||e[41]!==p?(x=T("label",{className:"flex flex-col gap-1 text-xs",htmlFor:d,children:[c,u,b,f,p,v]}),e[35]=v,e[36]=d,e[37]=c,e[38]=u,e[39]=b,e[40]=f,e[41]=p,e[42]=x):x=e[42],x},Fo=r=>{const e=j(48),{documentText:n,onCancel:o,onDocumentTextChange:t,onSave:l,refs:i}=r,a=me();let d;e[0]!==n?(d=Eo(n),e[0]=n,e[1]=d):d=e[1];const s=d,[g,c]=P(!1),u=!g&&s!==null;let b;e[2]!==s||e[3]!==t?(b=(A,V)=>{t(JSON.stringify({...s,[A]:V},null,2))},e[2]=s,e[3]=t,e[4]=b):b=e[4];const f=b;let p;e[5]!==t?(p=A=>{t(A.target.value)},e[5]=t,e[6]=p):p=e[6];const v=p;let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{c(!1)},e[7]=x):x=e[7];const w=x;let y;e[8]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{c(!0)},e[8]=y):y=e[8];const S=y,N=s===null;let $;e[9]!==a?($=a("Form"),e[9]=a,e[10]=$):$=e[10];let h;e[11]!==u||e[12]!==N||e[13]!==$?(h=m("button",{"aria-pressed":u,className:Ae,"data-testid":"db-editor-form",disabled:N,onClick:w,type:"button",children:$}),e[11]=u,e[12]=N,e[13]=$,e[14]=h):h=e[14];const C=!u;let D;e[15]!==a?(D=a("JSON"),e[15]=a,e[16]=D):D=e[16];let E;e[17]!==D||e[18]!==C?(E=m("button",{"aria-pressed":C,className:Ae,"data-testid":"db-editor-json",onClick:S,type:"button",children:D}),e[17]=D,e[18]=C,e[19]=E):E=e[19];let R;e[20]!==E||e[21]!==h?(R=T("div",{className:"flex items-center gap-1.5",children:[h,E]}),e[20]=E,e[21]=h,e[22]=R):R=e[22];let _;e[23]!==n||e[24]!==s||e[25]!==f||e[26]!==v||e[27]!==i||e[28]!==u||e[29]!==a?(_=u?m("div",{className:"flex flex-col gap-3","data-testid":"db-editor-fields",children:Object.entries(s).map(A=>{const[V,H]=A;return m(Oo,{column:V,onChange:f,target:i?.[V],value:H},V)})}):m("textarea",{"aria-label":a("Row document JSON"),className:"min-h-28 w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"db-editor-doc",onChange:v,value:n}),e[23]=n,e[24]=s,e[25]=f,e[26]=v,e[27]=i,e[28]=u,e[29]=a,e[30]=_):_=e[30];let k;e[31]!==a?(k=a("Save"),e[31]=a,e[32]=k):k=e[32];let F;e[33]!==l||e[34]!==k?(F=m("button",{className:Ae,"data-testid":"db-editor-save",onClick:l,type:"button",children:k}),e[33]=l,e[34]=k,e[35]=F):F=e[35];let B;e[36]!==a?(B=a("Cancel"),e[36]=a,e[37]=B):B=e[37];let O;e[38]!==o||e[39]!==B?(O=m("button",{className:Ae,"data-testid":"db-editor-cancel",onClick:o,type:"button",children:B}),e[38]=o,e[39]=B,e[40]=O):O=e[40];let I;e[41]!==F||e[42]!==O?(I=T("div",{className:"flex items-center gap-1.5",children:[F,O]}),e[41]=F,e[42]=O,e[43]=I):I=e[43];let G;return e[44]!==R||e[45]!==_||e[46]!==I?(G=T("div",{className:"flex flex-col gap-2 border border-border bg-card p-3","data-testid":"db-editor",children:[R,_,I]}),e[44]=R,e[45]=_,e[46]=I,e[47]=G):G=e[47],G},Fe="inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50 aria-pressed:bg-accent aria-pressed:text-accent-foreground",zo=r=>{const e=j(61),{columns:n,editable:o,filter:t,filters:l,hasMaskedColumns:i,liveError:a,maskOn:d,onAddRow:s,onBulkDelete:g,onAskAiFilter:c,onClearTable:u,onFilterChange:b,onFiltersChange:f,onGenerateRows:p,onShowJson:v,onShowTable:x,onToggleMask:w,total:y,viewMode:S}=r,N=me(),$=S==="table";let h;e[0]!==x||e[1]!==$?(h=m("button",{"aria-pressed":$,className:Fe,"data-testid":"db-view-table",onClick:x,type:"button",children:"Table"}),e[0]=x,e[1]=$,e[2]=h):h=e[2];const C=S==="json";let D;e[3]!==v||e[4]!==C?(D=m("button",{"aria-pressed":C,className:Fe,"data-testid":"db-view-json",onClick:v,type:"button",children:"JSON"}),e[3]=v,e[4]=C,e[5]=D):D=e[5];let E;e[6]!==a||e[7]!==N?(E=a===void 0?N("Live — changes stream in automatically"):N("Live unavailable: {liveError}",{liveError:a}),e[6]=a,e[7]=N,e[8]=E):E=e[8];const R=`size-1.5 rounded-full ${a===void 0?"bg-success":"bg-muted-foreground/50"}`;let _;e[9]!==R?(_=m("span",{"aria-hidden":"true",className:R}),e[9]=R,e[10]=_):_=e[10];let k;e[11]!==a||e[12]!==N?(k=N(a===void 0?"Live":"Live unavailable"),e[11]=a,e[12]=N,e[13]=k):k=e[13];let F;e[14]!==E||e[15]!==_||e[16]!==k?(F=T("span",{className:"inline-flex items-center gap-1.5 px-1 text-xs font-medium text-muted-foreground","data-testid":"db-live-indicator",role:"status",title:E,children:[_,k]}),e[14]=E,e[15]=_,e[16]=k,e[17]=F):F=e[17];let B;e[18]!==i||e[19]!==d||e[20]!==w||e[21]!==N?(B=i&&m("button",{"aria-pressed":d,className:Fe,"data-testid":"db-mask-toggle",onClick:w,type:"button",children:N("Mask sensitive columns")}),e[18]=i,e[19]=d,e[20]=w,e[21]=N,e[22]=B):B=e[22];let O;e[23]!==o||e[24]!==s?(O=o&&m("button",{className:Fe,"data-testid":"db-add-row",onClick:s,type:"button",children:"Add row"}),e[23]=o,e[24]=s,e[25]=O):O=e[25];let I;e[26]!==o||e[27]!==p||e[28]!==N?(I=o&&m("button",{className:Fe,"data-testid":"db-generate-rows",onClick:p,type:"button",children:N("Generate rows")}),e[26]=o,e[27]=p,e[28]=N,e[29]=I):I=e[29];let G;e[30]!==o||e[31]!==t||e[32]!==l||e[33]!==g||e[34]!==y?(G=o&&y>0&&(t!==""||l.length>0)&&m(lt,{confirmLabel:`Delete ${y.toString()} matching?`,onConfirm:g,testId:"db-bulk-delete",children:`Delete ${y.toString()} matching`}),e[30]=o,e[31]=t,e[32]=l,e[33]=g,e[34]=y,e[35]=G):G=e[35];let A;e[36]!==o||e[37]!==t||e[38]!==l||e[39]!==u||e[40]!==y?(A=o&&y>0&&t===""&&l.length===0&&m(lt,{confirmLabel:`Clear all ${y.toString()} rows?`,onConfirm:u,testId:"db-clear-table",children:`Clear table (${y.toString()})`}),e[36]=o,e[37]=t,e[38]=l,e[39]=u,e[40]=y,e[41]=A):A=e[41];let V;e[42]!==B||e[43]!==O||e[44]!==I||e[45]!==G||e[46]!==A||e[47]!==h||e[48]!==D||e[49]!==F?(V=T("div",{className:"flex flex-wrap items-center gap-1.5",children:[h,D,F,B,O,I,G,A]}),e[42]=B,e[43]=O,e[44]=I,e[45]=G,e[46]=A,e[47]=h,e[48]=D,e[49]=F,e[50]=V):V=e[50];let H;e[51]!==n||e[52]!==t||e[53]!==l||e[54]!==c||e[55]!==b||e[56]!==f?(H=m(Nn,{columns:n,filters:l,onAskAi:c,onFiltersChange:f,onSearchChange:b,search:t}),e[51]=n,e[52]=t,e[53]=l,e[54]=c,e[55]=b,e[56]=f,e[57]=H):H=e[57];let Z;return e[58]!==V||e[59]!==H?(Z=T("div",{className:"flex flex-col gap-2","data-testid":"db-view-toggle",children:[V,H]}),e[58]=V,e[59]=H,e[60]=Z):Z=e[60],Z},jo=r=>{const e=j(101),{assistant:n,backRelations:o,browser:t,edit:l,editable:i,onAskAiFilter:a,onInspect:d,onOpenGenerateRows:s,onSaveQuery:g,page:c,preferences:u,queryBar:b,references:f}=r,p=u.maskColumns.size>0,v=n.unavailable?void 0:a;let x;e[0]!==t.addRow||e[1]!==t.bulkDelete||e[2]!==t.clearTable||e[3]!==t.columns||e[4]!==t.filter||e[5]!==t.filters||e[6]!==t.liveError||e[7]!==t.onFilterChange||e[8]!==t.onFiltersChange||e[9]!==t.showJson||e[10]!==t.showTable||e[11]!==t.total||e[12]!==t.viewMode||e[13]!==i||e[14]!==s||e[15]!==u.maskOn||e[16]!==u.onToggleMask||e[17]!==p||e[18]!==v?(x=m(zo,{columns:t.columns,editable:i,filter:t.filter,filters:t.filters,hasMaskedColumns:p,liveError:t.liveError,maskOn:u.maskOn,onAddRow:t.addRow,onAskAiFilter:v,onBulkDelete:t.bulkDelete,onClearTable:t.clearTable,onFilterChange:t.onFilterChange,onFiltersChange:t.onFiltersChange,onGenerateRows:s,onShowJson:t.showJson,onShowTable:t.showTable,onToggleMask:u.onToggleMask,total:t.total,viewMode:t.viewMode}),e[0]=t.addRow,e[1]=t.bulkDelete,e[2]=t.clearTable,e[3]=t.columns,e[4]=t.filter,e[5]=t.filters,e[6]=t.liveError,e[7]=t.onFilterChange,e[8]=t.onFiltersChange,e[9]=t.showJson,e[10]=t.showTable,e[11]=t.total,e[12]=t.viewMode,e[13]=i,e[14]=s,e[15]=u.maskOn,e[16]=u.onToggleMask,e[17]=p,e[18]=v,e[19]=x):x=e[19];let w;e[20]!==g||e[21]!==b?(w=b!==void 0&&m(ko,{onApply:b.onApplyQuery,onCopyLink:b.onCopyLink,onDelete:b.onDeleteQuery,onSave:g,saved:b.saved}),e[20]=g,e[21]=b,e[22]=w):w=e[22];let y;e[23]!==o||e[24]!==t.onBulkDeleteSelected||e[25]!==t.selectedTable||e[26]!==t.table||e[27]!==t.viewMode||e[28]!==i||e[29]!==c||e[30]!==u.onToggleTranspose||e[31]!==u.transposed?(y=t.viewMode==="table"&&c.rows.length>0&&m(Cn,{backRelations:o.available,columns:c.columns,editable:i,enabledBackRelations:o.enabled,name:t.selectedTable??"export",onBulkDelete:t.onBulkDeleteSelected,onToggleBackRelation:o.onToggle,onToggleTranspose:u.onToggleTranspose,rows:c.rows,table:t.table.table,transposed:u.transposed}),e[23]=o,e[24]=t.onBulkDeleteSelected,e[25]=t.selectedTable,e[26]=t.table,e[27]=t.viewMode,e[28]=i,e[29]=c,e[30]=u.onToggleTranspose,e[31]=u.transposed,e[32]=y):y=e[32];let S;e[33]!==t.cancelEdit||e[34]!==t.editing||e[35]!==t.saveEdit||e[36]!==t.setEditorDocumentText||e[37]!==i||e[38]!==c?(S=i&&t.editing!==null&&m(Fo,{documentText:t.editing.docText,onCancel:t.cancelEdit,onDocumentTextChange:t.setEditorDocumentText,onSave:t.saveEdit,refs:c.refs}),e[33]=t.cancelEdit,e[34]=t.editing,e[35]=t.saveEdit,e[36]=t.setEditorDocumentText,e[37]=i,e[38]=c,e[39]=S):S=e[39];let N;e[40]!==t.committing||e[41]!==t.discardStaged||e[42]!==t.onCommitStaged||e[43]!==t.stagedChanges||e[44]!==i?(N=i&&t.stagedChanges.length>0&&m(Wn,{changes:t.stagedChanges,committing:t.committing,onCommit:t.onCommitStaged,onDiscard:t.discardStaged}),e[40]=t.committing,e[41]=t.discardStaged,e[42]=t.onCommitStaged,e[43]=t.stagedChanges,e[44]=i,e[45]=N):N=e[45];let $;e[46]!==t.writeError?($=t.writeError!==null&&m("p",{className:"text-sm text-destructive","data-testid":"db-write-error",role:"alert",children:t.writeError}),e[46]=t.writeError,e[47]=$):$=e[47];let h;e[48]!==x||e[49]!==w||e[50]!==y||e[51]!==S||e[52]!==N||e[53]!==$?(h=T("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3",children:[x,w,y,S,N,$]}),e[48]=x,e[49]=w,e[50]=y,e[51]=S,e[52]=N,e[53]=$,e[54]=h):h=e[54];let C;e[55]!==t.viewMode||e[56]!==c?(C=t.viewMode==="table"&&c.rows.length===0&&m("div",{className:"flex flex-1 items-center justify-center p-6",children:m(fn,{description:"Rows you insert into this table will show up here.",icon:m("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:m("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"})}),testId:"db-empty-rows",title:"This table is empty."})}),e[55]=t.viewMode,e[56]=c,e[57]=C):C=e[57];let D;e[58]!==t.viewMode||e[59]!==c||e[60]!==u.maskView||e[61]!==u.transposed?(D=t.viewMode==="table"&&c.rows.length>0&&u.transposed&&m(Sn,{columns:c.columns,rows:xt(c.rows,u.maskView)}),e[58]=t.viewMode,e[59]=c,e[60]=u.maskView,e[61]=u.transposed,e[62]=D):D=e[62];let E;e[63]!==o||e[64]!==t.filter||e[65]!==t.onRowDelete||e[66]!==t.onRowEdit||e[67]!==t.table||e[68]!==t.viewMode||e[69]!==l||e[70]!==i||e[71]!==d||e[72]!==c||e[73]!==u.maskView||e[74]!==u.onTogglePin||e[75]!==u.pinnedColumns||e[76]!==u.transposed||e[77]!==f?(E=t.viewMode==="table"&&c.rows.length>0&&!u.transposed&&m(vo,{backRelationCounts:o.counts,edit:l,editable:i,highlight:t.filter,mask:u.maskView,onDelete:t.onRowDelete,onEdit:t.onRowEdit,onInspect:d,onTogglePin:u.onTogglePin,pinnedColumns:u.pinnedColumns,refs:f,tableModel:t.table}),e[63]=o,e[64]=t.filter,e[65]=t.onRowDelete,e[66]=t.onRowEdit,e[67]=t.table,e[68]=t.viewMode,e[69]=l,e[70]=i,e[71]=d,e[72]=c,e[73]=u.maskView,e[74]=u.onTogglePin,e[75]=u.pinnedColumns,e[76]=u.transposed,e[77]=f,e[78]=E):E=e[78];let R;e[79]!==t.viewMode||e[80]!==c||e[81]!==u.maskView?(R=t.viewMode==="json"&&m("pre",{className:"min-h-0 flex-1 overflow-auto border-t border-border bg-muted/30 p-3 text-xs","data-testid":"db-json",children:JSON.stringify(xt(c.rows,u.maskView),un,2)}),e[79]=t.viewMode,e[80]=c,e[81]=u.maskView,e[82]=R):R=e[82];let _;e[83]!==t.changePageSize||e[84]!==t.goNext||e[85]!==t.goPrevious||e[86]!==t.hasNext||e[87]!==t.hasPrevious||e[88]!==t.jumpToPage||e[89]!==t.pageSize||e[90]!==t.rangeEnd||e[91]!==t.rangeStart||e[92]!==t.total?(_=m("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:m($n,{hasNext:t.hasNext,hasPrevious:t.hasPrevious,onJumpToPage:t.jumpToPage,onNext:t.goNext,onPageSizeChange:t.changePageSize,onPrevious:t.goPrevious,pageSize:t.pageSize,prefix:"db",rangeEnd:t.rangeEnd,rangeStart:t.rangeStart,total:t.total})}),e[83]=t.changePageSize,e[84]=t.goNext,e[85]=t.goPrevious,e[86]=t.hasNext,e[87]=t.hasPrevious,e[88]=t.jumpToPage,e[89]=t.pageSize,e[90]=t.rangeEnd,e[91]=t.rangeStart,e[92]=t.total,e[93]=_):_=e[93];let k;return e[94]!==C||e[95]!==D||e[96]!==E||e[97]!==R||e[98]!==_||e[99]!==h?(k=T("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"db-page",children:[h,C,D,E,R,_]}),e[94]=C,e[95]=D,e[96]=E,e[97]=R,e[98]=_,e[99]=h,e[100]=k):k=e[100],k},Ao="/__lunora/seed",tt=200,Lo=50,Bo=(r,e)=>{const n=[];for(const o of r)o.pk!==!0&&o.ref!==void 0&&o.type==="id"&&(e[o.ref]??[]).length===0&&n.push(o.name);return n},Vo=async r=>{const e=await fetch(Ao,{body:JSON.stringify(r),headers:{"Content-Type":"application/json"},method:"POST"}),n=await e.json();return e.ok&&n.rows!==void 0?{kind:"ok",rows:n.rows}:{kind:"error",message:n.error??`seed request failed (${String(e.status)})`}},qo="rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",Jo="rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",Ko=({columns:r,fkPools:e,onClose:n,onInsertRows:o,table:t})=>{const l=me(),[i,a]=P(10),[d,s]=P(!1),[g,c]=P(void 0),[u,b]=P(void 0),[f,p]=P(0),v=S=>{const N=Number(S.target.value);!Number.isNaN(N)&&N>=1&&a(Math.min(N,tt))},x=async()=>{c(void 0),b(void 0),p(0),s(!0);try{const S=await Vo({count:i,existingIds:e,seed:Date.now(),table:t});if(S.kind==="error"){c(S.message);return}const{rows:N}=S;if(N.length===0){c(l("No rows generated — all columns were skipped."));return}const $=await o(N);if($.error!==void 0){c($.error);return}b($.inserted),p($.conflicts);const h=Bo(r,e);h.length>0&&c(l("Inserted {count} rows. Skipped FK columns: {cols}",{cols:h.join(", "),count:$.inserted.toString()}))}finally{s(!1)}},w=()=>{se(x())},y=r.filter(S=>S.pk!==!0);return T(Tt,{label:l("Generate dummy rows"),onClose:n,panelTestId:"gen-rows-panel",testId:"gen-rows-overlay",variant:"dialog",children:[T("div",{className:"flex items-start justify-between",children:[T("div",{className:"flex flex-col gap-0.5",children:[m("h3",{className:"text-base text-foreground","data-testid":"gen-rows-title",children:l("Generate dummy rows")}),m("p",{className:"text-xs text-muted-foreground","data-testid":"gen-rows-desc",children:l("Seed {table} with Faker-generated rows. Existing rows are not affected.",{table:t})})]}),m("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"gen-rows-close",onClick:n,type:"button",children:l("Close")})]}),T("div",{className:"flex items-center gap-2",children:[m("label",{className:"text-xs font-medium text-foreground",htmlFor:"gen-rows-count",children:l("Row count")}),m("input",{className:"w-20 rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus-visible:border-ring","data-testid":"gen-rows-count",id:"gen-rows-count",max:tt,min:1,onChange:v,type:"number",value:i}),m("span",{className:"text-xs text-muted-foreground",children:l("(max {max})",{max:tt.toString()})})]}),y.length>0&&T("div",{className:"flex flex-col gap-1",children:[m("p",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:l("Columns to seed")}),m("ul",{className:"flex flex-col gap-0.5","data-testid":"gen-rows-columns",children:y.map(S=>{const N=S.ref!==void 0&&S.type==="id",$=N&&(e[S.ref??""]??[]).length===0,h=$?"rounded bg-destructive/10 px-1 text-destructive":"rounded bg-muted px-1 text-muted-foreground",C=$?`gen-rows-fk-empty-${S.name}`:`gen-rows-fk-ok-${S.name}`,D=$?l("FK: no rows in {ref} — will skip",{ref:S.ref??""}):l("→ {ref}",{ref:S.ref??""});return T("li",{className:"flex items-center gap-1.5 font-mono text-xs",children:[m("span",{className:"text-foreground",children:S.name}),T("span",{className:"text-muted-foreground",children:["(",S.type,")"]}),S.optional&&m("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:"optional"}),N&&m("span",{className:h,"data-testid":C,children:D})]},S.name)})})]}),g!==void 0&&m("p",{className:"text-xs text-destructive","data-testid":"gen-rows-error",role:"alert",children:g}),u!==void 0&&g===void 0&&m("p",{className:"text-xs text-success","data-testid":"gen-rows-success",children:f>0?l("Inserted {inserted} of {total} rows — {conflicts} skipped as id conflicts.",{conflicts:f.toString(),inserted:u.toString(),total:(u+f).toString()}):l("Inserted {count} rows successfully.",{count:u.toString()})}),T("div",{className:"flex justify-end gap-2",children:[m("button",{className:qo,"data-testid":"gen-rows-cancel",onClick:n,type:"button",children:l("Cancel")}),m("button",{className:Jo,"data-testid":"gen-rows-generate",disabled:d,onClick:w,type:"button",children:l(d?"Inserting…":"Generate & insert")})]})]})},Go=ve(ee.backRelationCounts),Ho=(r,e,n,o)=>{const t=j(16),l=Je();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i={},t[0]=i):i=t[0];const[a,d]=P(i);let s;if(t[1]!==r||t[2]!==e){let x;t[4]!==r?(x=w=>r.has(dt(w)),t[4]=r,t[5]=x):x=t[5],s=e.filter(x),t[1]=r,t[2]=e,t[3]=s}else s=t[3];const g=s;let c;t[6]!==n||t[7]!==g?(c=JSON.stringify([g,n]),t[6]=n,t[7]=g,t[8]=c):c=t[8];const u=c;let b;t[9]!==l||t[10]!==o||t[11]!==u?(b=async x=>{const[w,y]=JSON.parse(u);if(w.length===0||y.length===0){x.cancelled||d({});return}try{const S=await l.query(Go,{ids:y,relations:w},ue(o));x.cancelled||d(Object.fromEntries(S.relations.map(Qo)))}catch{}},t[9]=l,t[10]=o,t[11]=u,t[12]=b):b=t[12];const f=b;let p,v;return t[13]!==f?(p=()=>{const x={cancelled:!1};return se(f(x)),()=>{x.cancelled=!0}},v=[f],t[13]=f,t[14]=p,t[15]=v):(p=t[14],v=t[15]),Re(p,v),a};function Qo(r){return[dt(r),r.counts]}const Be=r=>{const e=r[0];return e===void 0?void 0:{column:e.id,direction:e.desc?"desc":"asc"}},Pt=r=>r==null?"":typeof r=="object"?JSON.stringify(r):String(r),Nt=r=>r.map(e=>({column:e.column,operator:e.operator,value:e.value===void 0?"":Pt(e.value)})),Ct=r=>r===void 0?[]:[{desc:r.direction==="desc",id:r.column}],Wo=r=>[r.column,r.operator,r.value],Le=(r,e,n,o)=>JSON.stringify([r??"",e??"",(n??[]).map(t=>Wo(t)),o===void 0?null:[o.column,o.direction]]),kt=200,Uo=20,Zo=ve(ee.readTablePage),Xo=ve(ee.facetColumn),nt=ve(ee.writeRow),Yo=ve(ee.deleteRows),er=ve(ee.clearTable),tr={},ut=new Set(["__doc__","__id__","_creationTime","_id","id"]),nr=r=>{const e=r.__doc__;if(typeof e=="string"){const o=Dn(e);if(o!==void 0)return o}const n={};for(const[o,t]of Object.entries(r))ut.has(o)||(n[o]=t);return n},or=({filters:r,offset:e,pageSize:n,search:o,sorting:t,table:l})=>({filters:Ee(r),limit:n,offset:e,orderBy:Be(t),search:o,skipCount:!0,table:l}),rr=({filters:r,search:e,table:n})=>({filters:Ee(r),limit:1,search:e,table:n}),lr=(r,e)=>{const n=new Map;for(const t of r?.rows??[]){const l=ye(t);l!==null&&n.set(l,t)}const o=[];for(const[t,l]of Object.entries(e))for(const[i,a]of Object.entries(l))o.push({column:i,newValue:a,oldValue:n.get(t)?.[i],rowId:t});return o},ar=r=>!ut.has(r),sr=({initialFilters:r,initialOrderBy:e,initialSearch:n,initialShardKey:o,onSelectTable:t,onViewChange:l,pageSize:i,resolveBackRelations:a,tableParam:d})=>{const s=Je(),[g,c]=P(i),[u,b]=P(o??""),f=d===void 0||d===""?null:d,[p,v]=P(0),[x,w]=P("table"),[y,S]=P(()=>Ct(e)),[N,$]=P(n??""),[h,C]=P(()=>Nt(r??[])),{clearFacets:D,facets:E,refetchFacets:R,toggleFacet:_}=Tn(),[k,F]=P(null),[B,O]=P(null),I=Hn(),[G,A]=P(null),[V,H]=P(!1),[Z,ge]=P(d),[oe,re]=P(()=>Le(o,n,r,e)),[fe,ie]=P(0),[de,ce]=P(()=>Le(o,n,r,e)),le=d!==Z,X=Le(o,n,r,e),be=le||!le&&X!==oe&&X!==de;if(be){ge(d),re(X),ie(z=>z+1),S(Ct(e)),$(n??"");const M=Nt(r??[]);C(M),b(o??""),D(),I.clear(),A(null),v(0)}else X!==oe&&re(X);const pe=be?n??"":N,W=be?o??"":u,te=`${d??""}:${fe.toString()}`,Q=bt(pe.trim(),300,te),L=bt(W.trim(),400,te),Y=Le(L,Q,Ee(h),Be(y));Y!==de&&ce(Y);const q=ze(ee.listTables,tr,{live:!0,shardKey:L}),Se=q.data??null,Ne=q.error,Ce=or({filters:h,offset:p,pageSize:g,search:Q,sorting:y,table:f??""}),ke=rr({filters:h,search:Q,table:f??""}),ae=ze(ee.readTablePage,Ce,{enabled:f!==null,keepPreviousData:!1,live:!0,shardKey:L}),J=ae.data??null,Pe=ae.error,{liveError:Te}=ae,De=ze(ee.readTablePage,ke,{enabled:f!==null,live:!0,shardKey:L});Re(()=>{q.data!==void 0&&In(L)},[q.data,L]);const Ge=M=>{t?.(M)},He=(M,z)=>{t?.(M,{search:z})},Qe=async(M,z)=>{try{return(await s.query(Zo,{filters:[],limit:Uo,offset:0,search:z,table:M},ue(L))).rows.find(ne=>ye(ne)===z)??null}catch{return null}},Ie=(M,z,ne,we)=>$e=>s.query(Xo,{column:$e,filters:Ee(ne),search:we,table:z},ue(M)),We=M=>{_(M,f===null?null:Ie(L,f,h,Q))},Ue=(M,z)=>{const ne=Pt(z);C(we=>[...we.filter($e=>$e.column!==M),{column:M,operator:"eq",value:ne}]),v(0)},Ze=et(Ie),Xe=et(R),K=et(l);Re(()=>{f!==null&&Xe.current(Ze.current(L,f,h,Q))},[L,f,h,Q]),Re(()=>{f===null||K.current===void 0||Z!==d||oe!==X||K.current({filters:Ee(h),orderBy:Be(y),search:Q,shard:L})},[f,d,Z,oe,X,h,y,Q,L]);const U=M=>{f!==null&&v(Math.max(0,M))},he=(M,z)=>{A({column:z,rowId:M})},xe=()=>{A(null)},Oe=async()=>{if(f!==null){O(null),H(!0);try{for(const[M,z]of Object.entries(I.staged))await s.query(nt,{doc:z,id:M,op:"patch",table:f},ue(L));I.clear(),A(null),ae.refetch()}catch(M){O(M.message)}H(!1)}},Dt=()=>{I.clear(),A(null)},It=lr(J,I.staged),mt=async(M,z,ne)=>{if(f===null)return;O(null);let we;if(M!=="delete"){let $e;try{$e=ne===void 0||ne.trim()===""?{}:JSON.parse(ne)}catch(_e){O(`Invalid JSON: ${_e.message}`);return}try{const _e=Mn($e);if(!Pn(_e)){O("The document must be a JSON object.");return}we=_e}catch(_e){O(`Invalid document: ${_e.message}`);return}}try{await s.query(nt,{doc:we,id:z??void 0,op:M,table:f},ue(L)),F(null),ae.refetch()}catch($e){O($e.message)}},gt=async(M,z)=>{if(f!==null){O(null);try{let ne="cap-hit";for(let we=0;we<kt;we+=1)if(!(await s.query(M,z,ue(L))).hasMore){ne="completed";break}v(0),ae.refetch(),ne==="cap-hit"&&O(`Stopped after ${kt.toString()} batches — rows still match this delete. Run it again to remove the rest.`)}catch(ne){O(ne.message)}}},Ot=M=>{S(M),v(0)},Ft=ot(()=>f===null?[]:a?.(f)??[],[a,f]),zt=wo(J,y,Ot,Ft),jt={filters:Ee(h),orderBy:Be(y),search:Q,shard:u,table:f??void 0},ft=De.data?.total??(J===null?0:p+J.rows.length),At=p>0,Lt=J!==null&&p+J.rows.length<ft,Bt=J===null||J.rows.length===0?0:p+1,Vt=J===null?0:p+J.rows.length,qt=()=>{q.refetch()},Jt=()=>{w("table")},Kt=()=>{w("json")},Gt=()=>{se(gt(Yo,{filters:Ee(h),search:Q,table:f}))},Ht=()=>{se(gt(er,{table:f}))},Qt=M=>{$(M.target.value),v(0)},Wt=M=>{C(M),v(0)},Ut=()=>{O(null);const M={};for(const z of J?.columns??[])ut.has(z)||(M[z]="");F({docText:JSON.stringify(M,null,2),id:""})},Zt=M=>{F(z=>z===null?z:{docText:M,id:z.id})},Xt=()=>{k!==null&&se(mt(k.id===""?"insert":"patch",k.id===""?null:k.id,k.docText))},Yt=()=>{F(null),O(null)},en=()=>{U(p-g)},tn=()=>{U(p+g)},nn=M=>{U(Math.max(0,(M-1)*g))},on=M=>{c(M),v(0)},rn=(M,z)=>{O(null),F({docText:JSON.stringify(_n(nr(z)),null,2),id:M})},ln=M=>{se(mt("delete",M))},an=async M=>{if(!(f===null||M.length===0)){O(null);try{for(const z of M)await s.query(nt,{id:z,op:"delete",table:f},ue(L));ae.refetch()}catch(z){O(z.message)}}},sn=M=>{se(an(M))},dn=()=>{se(Oe())};return{addRow:Ut,bulkDelete:Gt,cancelCellEdit:xe,cancelEdit:Yt,changePageSize:on,clearTable:Ht,columns:J?.columns??[],committing:V,currentView:jt,discardStaged:Dt,editableColumn:ar,editing:k,editingCell:G,facetFilter:Ue,facets:E,filter:N,filters:h,goNext:tn,goPrevious:en,hasNext:Lt,hasPrevious:At,jumpToPage:nn,liveError:Te,loadTables:qt,navigateToRef:He,onBulkDeleteSelected:sn,onCommitStaged:dn,onFilterChange:Qt,onFiltersChange:Wt,onRowDelete:ln,onRowEdit:rn,page:J,previewRef:Qe,pageError:Pe,pageSize:g,rangeEnd:Vt,rangeStart:Bt,queryShardKey:L,saveEdit:Xt,selectedTable:f,selectTable:Ge,setEditorDocumentText:Zt,setShardKey:b,shardKey:u,showJson:Kt,showTable:Jt,stage:I.stage,stagedChanges:It,stagedValue:I.stagedValue,startCellEdit:he,table:zt,tables:Se,tablesError:Ne,toggleFacet:We,total:ft,viewMode:x,writeError:B}},ir=[],dr=()=>{const r=j(1);let e;r[0]===Symbol.for("react.memo_cache_sentinel")?(e={},r[0]=e):e=r[0];const{data:n}=ze(ee.maskPolicies,e);return Array.isArray(n?.columns)?n.columns:ir},cr="lunora-studio-pinned-columns",ur=r=>{const e=j(24),{columns:n,initialPins:o,selectedTable:t}=r;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];const[i,a]=$t(cr,l),d=t??"",s=i[d];let g;e[1]!==o||e[2]!==s?(g=s===void 0?new Set((o??"").split(",").filter(mr)):new Set(s),e[1]=o,e[2]=s,e[3]=g):g=e[3];const c=g;let u;e[4]!==d||e[5]!==c||e[6]!==a?(u=_=>{a(k=>{const F=k[d]??[...c],B=F.includes(_)?F.filter(O=>O!==_):[...F,_];return{...k,[d]:B}})},e[4]=d,e[5]=c,e[6]=a,e[7]=u):u=e[7];const b=u,[f,p]=P(!1);let v;e[8]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{p(gr)},e[8]=v):v=e[8];const x=v,w=dr(),[y,S]=P(!0);let N;e[9]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{S(fr)},e[9]=N):N=e[9];const $=N;let h;if(e[10]!==n||e[11]!==w||e[12]!==t){const _=Bn(w,t??"");h=qn(_,n),e[10]=n,e[11]=w,e[12]=t,e[13]=h}else h=e[13];const C=h;let D;e[14]!==C||e[15]!==y?(D={columns:C,enabled:y},e[14]=C,e[15]=y,e[16]=D):D=e[16];const E=D;let R;return e[17]!==C||e[18]!==y||e[19]!==E||e[20]!==b||e[21]!==c||e[22]!==f?(R={maskColumns:C,maskOn:y,maskView:E,onToggleMask:$,onTogglePin:b,onToggleTranspose:x,pinnedColumns:c,transposed:f},e[17]=C,e[18]=y,e[19]=E,e[20]=b,e[21]=c,e[22]=f,e[23]=R):R=e[23],R};function mr(r){return r!==""}function gr(r){return!r}function fr(r){return!r}const br=ve(ee.describeTable),pr=ve(ee.readTablePage),hr=ve(ee.importShard),xr=r=>{const e=r._id??r.id??r.__id__??"";return typeof e=="string"?e:typeof e=="number"?String(e):""},vr=r=>{const e=Object.values(r.inserted).reduce((d,s)=>d+s,0),[n]=r.errors;if(n===void 0)return{conflicts:r.conflicts,error:void 0,inserted:e};const o=r.errors.length-1,t=e+r.conflicts+r.errors.length,l=o===1?"error":"errors",i=o>0?` (+${o.toString()} more ${l})`:"",a=`Inserted ${e.toString()} of ${t.toString()} rows — row ${n.line.toString()} (${n.table}): ${n.message}${i}`;return{conflicts:r.conflicts,error:a,inserted:e}},wr=r=>{const e=Je(),[n,o]=P(!1),[t,l]=P(void 0),[i,a]=P(void 0),[d,s]=P(void 0),[g,c]=P({}),[u,b]=P(!1),[f,p]=P(void 0),v=async(x,w)=>{o(!0),l(x),a(w),s(void 0),c({}),p(void 0),b(!0);try{const y=await e.query(br,{table:x},ue(w)),{columns:S}=y;s(S);const N={},$=S.filter(h=>h.ref!==void 0&&h.type==="id"&&h.pk!==!0);for(const h of $){if(h.ref===void 0)continue;const{ref:C}=h;if(N[C]===void 0)try{const D=await e.query(pr,{filters:[],limit:Lo,offset:0,search:"",table:C},ue(w));N[C]=D.rows.flatMap(E=>xr(E)||[])}catch{N[C]=[]}}c(N)}catch(y){p(y.message)}b(!1)};return{closeDialog:()=>{o(!1),l(void 0),a(void 0),s(void 0),c({}),p(void 0)},columnMeta:d,error:f,fkPools:g,insertBatch:async(x,w)=>{if(t===void 0||i===void 0)return{conflicts:0,error:"No table selected.",inserted:0};try{const y=await e.query(hr,{rows:x.map(N=>({doc:N,table:t}))},ue(i)),S=vr(y);return S.error!==void 0||(w(),r()),S}catch(y){return{conflicts:0,error:y.message,inserted:0}}},loading:u,open:n,openDialog:(x,w)=>{se(v(x,w))},shardKey:i,table:t}},yr=()=>{const r=j(6),[e,n]=P(null);let o;r[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{n(null)},r[0]=o):o=r[0];const t=o,[l,i]=P(null);let a;r[1]===Symbol.for("react.memo_cache_sentinel")?(a=(u,b)=>{i({column:u,value:b})},r[1]=a):a=r[1];const d=a;let s;r[2]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{i(null)},r[2]=s):s=r[2];const g=s;let c;return r[3]!==l||r[4]!==e?(c={closeExpandedCell:g,closeInspect:t,expandedCell:l,inspecting:e,onExpandCell:d,onInspect:n},r[3]=l,r[4]=e,r[5]=c):c=r[5],c},Sr=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Nr=(r,e)=>typeof e=="number"&&Sr.test(r),Cr=r=>{const e=j(26),{column:n,onNavigate:o,target:t,value:l}=r;let i;e[0]!==o||e[1]!==t||e[2]!==l?(i=()=>{t!==void 0&&o(t,String(l))},e[0]=o,e[1]=t,e[2]=l,e[3]=i):i=e[3];const a=i;if(l==null){let g;return e[4]===Symbol.for("react.memo_cache_sentinel")?(g=m("span",{className:"italic text-muted-foreground",children:"null"}),e[4]=g):g=e[4],g}if(t!==void 0&&(typeof l=="string"||typeof l=="number")&&String(l)!==""){const g=`rd-ref-${n}`,c=`Open ${t} ${String(l)}`,u=String(l);let b;return e[5]!==a||e[6]!==g||e[7]!==c||e[8]!==u?(b=T("button",{"data-testid":g,onClick:a,title:c,type:"button",children:[u," ↗"]}),e[5]=a,e[6]=g,e[7]=c,e[8]=u,e[9]=b):b=e[9],b}if(Nr(n,l)){const g=`rd-ts-${n}`;let c;e[10]!==l?(c=l.toString(),e[10]=l,e[11]=c):c=e[11];let u;e[12]!==l?(u=mn(l),e[12]=l,e[13]=u):u=e[13];let b;return e[14]!==g||e[15]!==c||e[16]!==u?(b=m("span",{"data-testid":g,title:c,children:u}),e[14]=g,e[15]=c,e[16]=u,e[17]=b):b=e[17],b}if(typeof l=="object"){let g;e[18]!==l?(g=JSON.stringify(l,null,2),e[18]=l,e[19]=g):g=e[19];let c;return e[20]!==g?(c=m("pre",{className:"m-0 overflow-auto rounded-md bg-muted/50 p-2 text-xs",children:g}),e[20]=g,e[21]=c):c=e[21],c}let d;e[22]!==l?(d=Me(l),e[22]=l,e[23]=d):d=e[23];let s;return e[24]!==d?(s=m("span",{children:d}),e[24]=d,e[25]=s):s=e[25],s},kr=r=>{const e=j(21),{columns:n,onClose:o,onNavigate:t,refs:l,row:i}=r;let a;e[0]!==o||e[1]!==t?(a=(f,p)=>{t(f,p),o()},e[0]=o,e[1]=t,e[2]=a):a=e[2];const d=a;let s;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=m("h3",{className:"m-0 text-base text-foreground",children:"Row detail"}),e[3]=s):s=e[3];let g;e[4]!==o?(g=T("div",{className:"mb-3 flex items-center justify-between",children:[s,m("button",{"data-testid":"rd-close",onClick:o,type:"button",children:"Close"})]}),e[4]=o,e[5]=g):g=e[5];let c;if(e[6]!==n||e[7]!==d||e[8]!==l||e[9]!==i){let f;e[11]!==d||e[12]!==l||e[13]!==i?(f=p=>T("div",{className:"border-t border-border py-2 first:border-t-0","data-testid":`rd-field-${p}`,children:[m("dt",{className:"mb-0.5 text-xs font-semibold text-muted-foreground",children:p}),m("dd",{className:"m-0",children:m(Cr,{column:p,onNavigate:d,target:l?.[p],value:i[p]})})]},p),e[11]=d,e[12]=l,e[13]=i,e[14]=f):f=e[14],c=n.map(f),e[6]=n,e[7]=d,e[8]=l,e[9]=i,e[10]=c}else c=e[10];let u;e[15]!==c?(u=m("dl",{"data-testid":"rd-fields",children:c}),e[15]=c,e[16]=u):u=e[16];let b;return e[17]!==o||e[18]!==g||e[19]!==u?(b=T(Tt,{label:"Row detail",onClose:o,panelTestId:"rd-panel",testId:"rd-overlay",variant:"drawer",children:[g,u]}),e[17]=o,e[18]=g,e[19]=u,e[20]=b):b=e[20],b},$r=50,Tr=r=>{const e=j(8),{active:n,onPick:o,shard:t}=r;let l;e[0]!==o||e[1]!==t?(l=()=>{o(t)},e[0]=o,e[1]=t,e[2]=l):l=e[2];const i=l,a=`w-full rounded px-2 py-0.5 text-left text-xs transition-colors hover:bg-accent ${n?"bg-accent font-medium":""}`,d=`shard-explorer-item-${t}`;let s;return e[3]!==i||e[4]!==t||e[5]!==a||e[6]!==d?(s=m("button",{className:a,"data-testid":d,onClick:i,type:"button",children:t}),e[3]=i,e[4]=t,e[5]=a,e[6]=d,e[7]=s):s=e[7],s},Er=({onFetchTables:r,onSelect:e})=>{const n=me(),[o]=P(()=>On()),[t,l]=P(!1),[i,a]=P(void 0),[d,s]=P(void 0),[g,c]=P(!1),[u,b]=P(void 0),f=je(0),p=()=>{l(w=>!w)},v=async w=>{e(w),a(w),s(void 0),b(void 0),c(!0),f.current+=1;const y=f.current;try{const S=await r(w);f.current===y&&s(S?.slice(0,$r))}catch(S){f.current===y&&b(S.message)}f.current===y&&c(!1)},x=w=>{se(v(w))};return o.length===0?null:T("div",{"data-testid":"shard-explorer",children:[T("button",{"aria-controls":"shard-explorer-panel","aria-expanded":t,className:"inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"shard-explorer-toggle",onClick:p,type:"button",children:[n("Shards seen"),m("span",{"aria-hidden":"true",className:`ml-0.5 transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),t&&T("div",{className:"mt-1 flex flex-col gap-1 rounded-md border border-border bg-popover p-2","data-testid":"shard-explorer-panel",id:"shard-explorer-panel",children:[m("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-hint",children:n("Recently visited shards — click to switch")}),m("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-list",children:o.map(w=>m("li",{children:m(Tr,{active:i===w,onPick:x,shard:w})},w))}),i!==void 0&&T("div",{className:"mt-1 border-t border-border pt-1","data-testid":"shard-explorer-summary",children:[m("p",{className:"mb-1 text-xs font-medium text-foreground","data-testid":"shard-explorer-summary-title",children:n("{shard} tables",{shard:i})}),g&&m("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-loading",children:n("Loading…")}),u!==void 0&&m("p",{className:"text-xs text-destructive","data-testid":"shard-explorer-error",role:"alert",children:u}),!g&&u===void 0&&d?.length===0&&m("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-empty",children:n("No tables in this shard.")}),!g&&u===void 0&&d!==void 0&&d.length>0&&m("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-tables",children:d.map(w=>T("li",{className:"flex items-center justify-between text-xs",children:[m("span",{"data-testid":`shard-explorer-table-${w.name}`,children:w.name}),m("span",{className:"text-muted-foreground","data-testid":`shard-explorer-rowcount-${w.name}`,children:w.rowCount})]},w.name))})]})]})]})},Rr="lunora-studio-back-relations",_r={},Mr=50,Pr=[],Dr=ve(ee.listTables),Ir=r=>{const e=j(10),{onFetchShardTables:n,onShardChange:o,schemaSwitch:t,shardKey:l}=r;let i;e[0]!==o||e[1]!==l?(i=m(cn,{onChange:o,testId:"db-shard-input",value:l}),e[0]=o,e[1]=l,e[2]=i):i=e[2];let a;e[3]!==n||e[4]!==o?(a=m(Er,{onFetchTables:n,onSelect:o}),e[3]=n,e[4]=o,e[5]=a):a=e[5];let d;return e[6]!==t||e[7]!==i||e[8]!==a?(d=T("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[t,i,a]}),e[6]=t,e[7]=i,e[8]=a,e[9]=d):d=e[9],d},sl=({editable:r=!1,globalTableNames:e,initialFilters:n,initialOrderBy:o,initialPins:t,initialSearch:l,initialShardKey:i,onNavigateToGlobal:a,onSelectTable:d,onViewChange:s,pageSize:g=Mr,queryBar:c,schemaSwitch:u,tableParam:b})=>{const f=ze(ee.describeTables,{},{shardKey:i??""}).data?.columnsByTable??_r,[p,v]=$t(Rr,{}),x=rt(K=>{const U=new Set(p[K]);return pt(K,f).filter(he=>U.has(dt(he)))},[p,f]),w=sr({initialFilters:n,initialOrderBy:o,initialSearch:l,initialShardKey:i,onSelectTable:d,onViewChange:s,pageSize:g,resolveBackRelations:x,tableParam:b}),{cancelCellEdit:y,columns:S,currentView:N,editableColumn:$,editingCell:h,facetFilter:C,facets:D,loadTables:E,navigateToRef:R,onFiltersChange:_,page:k,pageError:F,previewRef:B,queryShardKey:O,selectedTable:I,selectTable:G,setShardKey:A,shardKey:V,stage:H,stagedValue:Z,startCellEdit:ge,tables:oe,tablesError:re,toggleFacet:fe}=w,ie=gn(V),de=K=>{se((async()=>{const U=await ie.suggestFilter(K,I??"");U!==void 0&&_(U.map(he=>{const xe=he.value,Oe=typeof xe=="string"||typeof xe=="number"||typeof xe=="boolean"?String(xe):"";return{column:he.column,operator:he.operator,value:Oe}}))})())},ce=I===null?[]:pt(I,f),le=new Set(p[I??""]),X=[];for(const K of k?.rows??[]){const U=K._id??K.id;typeof U=="string"&&U!==""&&X.push(U)}const be=Ho(le,ce,X,O),pe=K=>{v(U=>{const he=I??"",xe=U[he]??[];return{...U,[he]:xe.includes(K)?xe.filter(Oe=>Oe!==K):[...xe,K]}})},W=ur({columns:S,initialPins:t,selectedTable:I}),te=yr(),{closeExpandedCell:Q,closeInspect:L,expandedCell:Y,inspecting:q,onExpandCell:Se}=te,Ne=Je(),Ce=async K=>await Ne.query(Dr,{},ue(K)),ke=()=>{I!==null&&G(I)},{closeDialog:ae,columnMeta:J,fkPools:Pe,insertBatch:Te,open:De,openDialog:Ge}=wr(ke),He=()=>{I!==null&&Ge(I,V)},Qe=K=>Te(K,ae),Ie=(K,U)=>{if(a!==void 0&&e?.has(K)===!0){a(K,U);return}R(K,U)},We=c?.onSaveQuery,Ue=K=>{We?.(K,N)},Ze={cancelEdit:y,editable:r,editableColumn:$,editingCell:h,onExpandCell:Se,stage:H,stagedValue:Z,startEdit:ge},Xe={columns:k?.refs,onNavigate:Ie,onPreview:B};return T("div",{className:"flex h-full min-w-0","data-testid":"lunora-data-browser",children:[m(En,{header:m(Ir,{onFetchShardTables:Ce,onShardChange:A,schemaSwitch:u,shardKey:V}),onReload:E,onSelect:G,prefix:"db",selected:I,tables:oe??Pr}),T("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[re!==null&&m("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-tables-error",role:"alert",children:re}),k===null&&F===null&&m("div",{className:"flex flex-1 items-center justify-center p-6",children:m("p",{className:"text-sm text-muted-foreground",children:"Select a table to browse its rows."})}),F!==null&&m("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-page-error",role:"alert",children:F}),k!==null&&m(jo,{assistant:ie,backRelations:{available:ce,counts:be,enabled:le,onToggle:pe},browser:w,edit:Ze,editable:r,onAskAiFilter:de,onInspect:te.onInspect,onOpenGenerateRows:He,onSaveQuery:Ue,page:k,preferences:W,queryBar:c,references:Xe})]}),k!==null&&m(Rn,{columns:S,facets:D,onFacetFilter:C,onToggleFacet:fe}),q!==null&&k!==null&&m(kr,{columns:k.columns,onClose:L,onNavigate:Ie,refs:k.refs,row:q}),Y!==null&&m(kn,{column:Y.column,onClose:Q,value:Y.value}),De&&I!==null&&J!==void 0&&m(Ko,{columns:J,fkPools:Pe,onClose:ae,onInsertRows:Qe,table:I})]})};export{sl as DataBrowser};
@@ -0,0 +1 @@
1
+ import{c as K}from"react/compiler-runtime";import{useState as z}from"react";import{jsx as u,jsxs as A,Fragment as B}from"react/jsx-runtime";const M=[{label:"=",value:"eq"},{label:"≠",value:"ne"},{label:"<",value:"lt"},{label:"≤",value:"lte"},{label:">",value:"gt"},{label:"≥",value:"gte"},{label:"contains",value:"contains"}],O=r=>{const e=r.trim(),n=Number(e);return e!==""&&Number.isFinite(n)&&String(n)===e?n:r},I=r=>r.filter(e=>e.column!=="").map(e=>({column:e.column,operator:e.operator,value:e.operator==="contains"?e.value:O(e.value)})),J=r=>{const e=K(44),{columns:n,filters:a,onAskAi:f,onFiltersChange:l,onSearchChange:D,search:j}=r,[c,E]=z("");let F;e[0]!==n[0]||e[1]!==a||e[2]!==l?(F=()=>{l([...a,{column:n[0]??"",operator:"eq",value:""}])},e[0]=n[0],e[1]=a,e[2]=l,e[3]=F):F=e[3];const q=F;let T;e[4]!==a||e[5]!==l?(T=t=>{const o=Number(t.currentTarget.dataset.index);l(a.filter((i,d)=>d!==o))},e[4]=a,e[5]=l,e[6]=T):T=e[6];const h=T;let k;e[7]!==a||e[8]!==l?(k=t=>{const o=Number(t.currentTarget.dataset.index),i=t.currentTarget.value;l(a.map((d,N)=>N===o?{...d,column:i}:d))},e[7]=a,e[8]=l,e[9]=k):k=e[9];const g=k;let w;e[10]!==a||e[11]!==l?(w=t=>{const o=Number(t.currentTarget.dataset.index),i=t.currentTarget.value;l(a.map((d,N)=>N===o?{...d,operator:i}:d))},e[10]=a,e[11]=l,e[12]=w):w=e[12];const x=w;let y;e[13]!==a||e[14]!==l?(y=t=>{const o=Number(t.currentTarget.dataset.index),i=t.currentTarget.value;l(a.map((d,N)=>N===o?{...d,value:i}:d))},e[13]=a,e[14]=l,e[15]=y):y=e[15];const C=y;let s;e[16]!==D||e[17]!==j?(s=u("input",{"aria-label":"Search rows","data-testid":"db-filter",onChange:D,placeholder:"search table…",value:j}),e[16]=D,e[17]=j,e[18]=s):s=e[18];let m;e[19]!==q?(m=u("button",{"data-testid":"db-add-filter",onClick:q,type:"button",children:"Add filter"}),e[19]=q,e[20]=m):m=e[20];let b;e[21]!==c||e[22]!==f?(b=f!==void 0&&A(B,{children:[u("input",{"aria-label":"Describe a filter","data-testid":"db-ai-prompt",onChange:t=>{E(t.target.value)},onKeyDown:t=>{t.key==="Enter"&&c.trim()!==""&&(t.preventDefault(),f(c.trim()))},placeholder:"describe a filter…",value:c}),u("button",{"data-testid":"db-ai-filter",disabled:c.trim()==="",onClick:()=>{f(c.trim())},type:"button",children:"Suggest"})]}),e[21]=c,e[22]=f,e[23]=b):b=e[23];let p;e[24]!==s||e[25]!==m||e[26]!==b?(p=A("div",{className:"flex flex-wrap items-center gap-1.5",children:[s,m,b]}),e[24]=s,e[25]=m,e[26]=b,e[27]=p):p=e[27];let v;if(e[28]!==g||e[29]!==x||e[30]!==C||e[31]!==n||e[32]!==a||e[33]!==h){let t;e[35]!==g||e[36]!==x||e[37]!==C||e[38]!==n||e[39]!==h?(t=(o,i)=>A("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-filter-row",children:[u("select",{"aria-label":"Filter column","data-index":i,"data-testid":"db-filter-column",onChange:g,value:o.column,children:n.map(R)}),u("select",{"aria-label":"Filter operator","data-index":i,"data-testid":"db-filter-operator",onChange:x,value:o.operator,children:M.map(V)}),u("input",{"aria-label":"Filter value","data-index":i,"data-testid":"db-filter-value",onChange:C,placeholder:"value",value:o.value}),u("button",{"aria-label":"Remove filter","data-index":i,"data-testid":"db-filter-remove",onClick:h,type:"button",children:"✕"})]},i),e[35]=g,e[36]=x,e[37]=C,e[38]=n,e[39]=h,e[40]=t):t=e[40],v=a.map(t),e[28]=g,e[29]=x,e[30]=C,e[31]=n,e[32]=a,e[33]=h,e[34]=v}else v=e[34];let S;return e[41]!==v||e[42]!==p?(S=A("div",{className:"flex flex-col gap-1.5","data-testid":"db-filters",children:[p,v]}),e[41]=v,e[42]=p,e[43]=S):S=e[43],S};function R(r){return u("option",{value:r,children:r},r)}function V(r){return u("option",{value:r.value,children:r.label},r.value)}export{J as DataFilters,I as toFilterClauses};
@@ -0,0 +1 @@
1
+ import{Component as i}from"react";import{jsx as e,Fragment as d,jsxs as l}from"react/jsx-runtime";const c={border:"1px solid var(--destructive)",color:"var(--destructive)",padding:12},h={overflow:"auto",whiteSpace:"pre-wrap"};class g extends i{static getDerivedStateFromError(r){return{error:r}}state={error:null};componentDidCatch(r,t){console.error("[lunora-studio] panel error",r,t.componentStack)}reset=()=>{this.setState({error:null})};render(){const{children:r,fallbackTitle:t,label:o,retryLabel:n}=this.props,{error:a}=this.state;if(a===null)return e(d,{children:r});const s=t??(o===void 0?"Something went wrong":`${o} failed`);return l("div",{"data-testid":"dash-error-boundary",role:"alert",style:c,children:[e("strong",{children:s}),e("pre",{"data-testid":"dash-error-message",style:h,children:a.message}),e("button",{"data-testid":"dash-error-retry",onClick:this.reset,type:"button",children:n??"Try again"})]})}}export{g as ErrorBoundary};
@@ -0,0 +1 @@
1
+ import{useLunora as oe}from"@lunora/react";import{useState as L,useRef as G,useEffect as B}from"react";import{O as I}from"./use-admin-query-CnnyWJXM.js";import{useAutoRefresh as ne}from"./DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{_ as ae,i as se,u as ie,a as ce,$ as de}from"./table-list-sidebar-fz0m_4I4.js";import{useT as J}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{b as ue}from"./cf-links-Dmg86v1D.js";import{c as A}from"react/compiler-runtime";import{d as me,m as U,f as fe,n as pe,p as ge,u as he}from"./table-DdJBrClo.js";import{k as be,g as xe}from"./data-grid-Ci4-tZkk.js";import{jsx as r,jsxs as $}from"react/jsx-runtime";import{E as ve}from"./empty-state-Cg7t_8qu.js";const Ne=(t,e)=>{const a=t._id;return typeof a=="string"||typeof a=="number"?String(a):`row-${e.toString()}`},q=t=>t==null?"∅":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),we=t=>{const e=A(33),{filters:a,onChangePageSize:f,onJumpToPage:i,onNext:u,onPrevious:s,onRemoveFilter:F,page:o,pageSize:b,pagination:x}=t,C=J(),{hasNext:v,hasPrevious:k,rangeEnd:p,rangeStart:R,total:_}=x;let N;e[0]!==a||e[1]!==F||e[2]!==C?(N=a.length>0&&r("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-4 py-2 text-xs","data-testid":"gdb-filters",children:a.map((d,y)=>$("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-muted px-1.5 py-0.5","data-testid":"gdb-filter-chip",children:[r("span",{className:"font-medium text-foreground",children:d.column}),r("span",{className:"text-muted-foreground",children:"="}),r("span",{className:"font-mono text-foreground",children:q(d.value)}),r("button",{"aria-label":C("Remove filter"),className:"ml-0.5 text-muted-foreground hover:text-foreground","data-testid":"gdb-filter-remove",onClick:()=>{F(y)},type:"button",children:"✕"})]},`${d.column}:${q(d.value)}`))}),e[0]=a,e[1]=F,e[2]=C,e[3]=N):N=e[3];let w;e[4]!==o.columns?(w=o.columns.map(Se),e[4]=o.columns,e[5]=w):w=e[5];let m;e[6]!==w?(m=r(me,{children:r(U,{children:w})}),e[6]=w,e[7]=m):m=e[7];let c;if(e[8]!==o.columns||e[9]!==o.rows){let d;e[11]!==o.columns?(d=(y,E)=>r(U,{"data-testid":"gdb-row",children:o.columns.map(P=>r(he,{className:"max-w-xs truncate font-mono text-xs",children:r(xe,{value:y[P]})},P))},Ne(y,E)),e[11]=o.columns,e[12]=d):d=e[12],c=o.rows.map(d),e[8]=o.columns,e[9]=o.rows,e[10]=c}else c=e[10];let h;e[13]!==c?(h=r(fe,{children:c}),e[13]=c,e[14]=h):h=e[14];let g;e[15]!==m||e[16]!==h?(g=r(be,{layout:"fill",children:r("div",{className:"min-h-0 flex-1 overflow-auto",children:$(pe,{"data-testid":"gdb-rows",children:[m,h]})})}),e[15]=m,e[16]=h,e[17]=g):g=e[17];let n;e[18]!==v||e[19]!==k||e[20]!==f||e[21]!==i||e[22]!==u||e[23]!==s||e[24]!==b||e[25]!==p||e[26]!==R||e[27]!==_?(n=r("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:r(ae,{hasNext:v,hasPrevious:k,onJumpToPage:i,onNext:u,onPageSizeChange:f,onPrevious:s,pageSize:b,prefix:"gdb",rangeEnd:p,rangeStart:R,total:_})}),e[18]=v,e[19]=k,e[20]=f,e[21]=i,e[22]=u,e[23]=s,e[24]=b,e[25]=p,e[26]=R,e[27]=_,e[28]=n):n=e[28];let S;return e[29]!==N||e[30]!==g||e[31]!==n?(S=$("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"gdb-page",children:[N,g,n]}),e[29]=N,e[30]=g,e[31]=n,e[32]=S):S=e[32],S};function Se(t){return r(ge,{children:t},t)}const ye=()=>{const t=A(8),e=J();let a;t[0]!==e?(a=e("Tables marked .global() (D1-backed, region-replicated) will appear here."),t[0]=e,t[1]=a):a=t[1];let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f=$("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18Z"})]}),t[2]=f):f=t[2];let i;t[3]!==e?(i=e("No global tables."),t[3]=e,t[4]=i):i=t[4];let u;return t[5]!==a||t[6]!==i?(u=r("div",{className:"flex flex-1 items-center justify-center p-6",children:r(ve,{description:a,icon:f,testId:"gdb-empty",title:i})}),t[5]=a,t[6]=i,t[7]=u):u=t[7],u},$e=50,ke=[],Pe=[],De=({initialTable:t,onSelectTable:e,pageSize:a=$e,schemaSwitch:f}={})=>{const i=oe(),u=J(),[s,F]=L(t??null),[o,b]=L(0),[x,C]=L(a),[v,k]=L([]),p=se(v),{clearFacets:R,facets:_,refetchFacets:N,toggleFacet:w}=ie(),m=I(["lunora-global-tables"],()=>i.listGlobalTables()),c=m.data??null,h=m.error,g=I(["lunora-global-page",s??"",o,x,JSON.stringify(v)],()=>i.readGlobalTablePage({filters:v,limit:x,offset:o,table:s??""}),{enabled:s!==null,keepPreviousData:!1}),n=g.data??null,S=g.error,d=(l,T)=>z=>i.facetGlobalColumn({column:z,filters:T,table:l}),y=(l,T)=>{N(d(l,T))};ne(()=>{m.refetch(),s!==null&&(g.refetch(),y(s,p.current))},!0);const E=G(void 0),P=l=>{F(l),E.current=l,k([]),p.current=[],R(),b(0),e?.(l)},W=l=>{w(l,s===null?null:d(s,p.current))},M=l=>{k(l),p.current=l,b(0),s!==null&&y(s,l)},Z=(l,T)=>{M([...p.current.filter(z=>z.column!==l),{column:l,value:T}])},H=l=>{M(p.current.filter((T,z)=>z!==l))},O=G(P);B(()=>{O.current=P}),B(()=>{if(t===void 0||t===""||E.current===t)return;E.current=t;const l=t;queueMicrotask(()=>{O.current(l)})},[t]);const j=l=>{s!==null&&b(Math.max(0,l))},D=n?.total??0,K=o>0,Q=n!==null&&o+n.rows.length<D,V=n===null||n.rows.length===0?0:o+1,X=n===null?0:o+n.rows.length,Y=()=>{m.refetch()},ee=()=>{j(o-x)},te=()=>{j(o+x)},re=l=>{j(Math.max(0,(l-1)*x))},le=l=>{C(l),b(0)};return $("div",{className:"flex h-full min-w-0","data-testid":"lunora-global-data-browser",children:[r(ce,{header:$("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[f,r("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"gdb-cf-link",href:ue,rel:"noreferrer",target:"_blank",children:u("Open in Cloudflare")})]}),onReload:Y,onSelect:P,prefix:"gdb",selected:s,tables:c??ke}),$("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[h!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-tables-error",role:"alert",children:h}),c!==null&&c.length===0&&r(ye,{}),S!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-page-error",role:"alert",children:S}),c!==null&&c.length>0&&n===null&&S===null&&r("div",{className:"flex flex-1 items-center justify-center p-6",children:r("p",{className:"text-sm text-muted-foreground",children:u("Select a table to browse its rows.")})}),n!==null&&r(we,{filters:v,onChangePageSize:le,onJumpToPage:re,onNext:te,onPrevious:ee,onRemoveFilter:H,page:n,pageSize:x,pagination:{hasNext:Q,hasPrevious:K,rangeEnd:X,rangeStart:V,total:D}})]}),r(de,{columns:n?.columns??Pe,facets:_,onFacetFilter:Z,onToggleFacet:W})]})};export{De as GlobalDataBrowser};
@@ -0,0 +1 @@
1
+ import"react/compiler-runtime";import"@tanstack/react-router";import"react";import"./badge-BbuuAio7.js";import"./card-CIDGUN6K.js";import"./empty-state-Cg7t_8qu.js";import"./use-admin-query-CnnyWJXM.js";import"./DEFAULT_LOCALE-BZ4NojpD.js";import"./ADMIN_FUNCTIONS-4aE59aDq.js";import"./internal-zkEvTqy8.js";import"./utils-bhneXptQ.js";import"./DEFAULT_INSIGHT_THRESHOLDS-B-hcFVoi.js";import{H as b}from"./home-panel-BtxdqXDe.js";import"react/jsx-runtime";export{b as HomePanel};
@@ -0,0 +1 @@
1
+ import{c as we}from"react/compiler-runtime";import{useLunora as $e}from"@lunora/react";import{useState as W,useEffect as ke}from"react";import{ConfirmButton as Re}from"./ConfirmButton-CTL3f3kr.js";import{E as Ce}from"./error-alert--Ie7ofJ0.js";import{L as _e}from"./live-status-CmuRLFKf.js";import{ShardInput as Ee}from"./ShardInput-BVn2iCU0.js";import{g as Le}from"./badge-BbuuAio7.js";import{u as Me}from"./button-BkCrNcAs.js";import{c as Ie,u as De}from"./card-CIDGUN6K.js";import{E as Ke}from"./empty-state-Cg7t_8qu.js";import{u as Ae}from"./input-JHu63lTv.js";import{p as ue}from"./label-6uP1obNF.js";import{n as je,d as Fe,m as he,p as u,f as Te,u as h}from"./table-DdJBrClo.js";import{N as qe}from"./use-admin-query-CnnyWJXM.js";import{S as Be}from"./use-shard-key-B2JtNa5m.js";import{useT as Oe}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{ADMIN_FUNCTIONS as pe}from"./ADMIN_FUNCTIONS-4aE59aDq.js";import{i as We,f as ze,d as Je,b as Pe,g as Ue}from"./internal-zkEvTqy8.js";import{r as Ge}from"./shard-history-DMEW5VBE.js";import{jsx as t,jsxs as i}from"react/jsx-runtime";const Qe=Ue(pe.runMigration),yr=n=>{const e=we(98),{initialShardKey:ge}=n,te=$e(),r=Oe(),{queryShardKey:s,setShardKey:ne,shardKey:o}=Be(ge),[p,fe]=W(""),[g,ye]=W("up"),[l,be]=W(!0),[f,ce]=W(!1),[c,ae]=W(null),[z,ie]=W(null);let J;e[0]!==o?(J=o.trim(),e[0]=o,e[1]=J):J=e[1];const P=J===s;let U;e[2]===Symbol.for("react.memo_cache_sentinel")?(U={},e[2]=U):U=e[2];let G;e[3]!==s?(G={live:!0,shardKey:s},e[3]=s,e[4]=G):G=e[4];const a=qe(pe.migrationStatus,U,G),d=a.data?.migrations??null,oe=a.error,{errorSource:le,liveError:de}=a;let Q,V;e[5]!==s||e[6]!==a.data?(Q=()=>{a.data!==void 0&&Ge(s)},V=[a.data,s],e[5]=s,e[6]=a.data,e[7]=Q,e[8]=V):(Q=e[7],V=e[8]),ke(Q,V);let X;if(e[9]!==te||e[10]!==g||e[11]!==l||e[12]!==p||e[13]!==o||e[14]!==a||e[15]!==r){const m=async()=>{const me=p.trim();if(me===""){ie(r("Enter a migration id")),ae(null);return}ce(!0),ie(null);try{const se=await te.query(Qe,{direction:g,dryRun:l,id:me},Je(o));ae(se),a.refetch()}catch(se){const Se=se;ae(null),ie(Pe(Se))}ce(!1)};X=()=>{ze(m())},e[9]=te,e[10]=g,e[11]=l,e[12]=p,e[13]=o,e[14]=a,e[15]=r,e[16]=X}else X=e[16];const Y=X;let Z;e[17]===Symbol.for("react.memo_cache_sentinel")?(Z=m=>{fe(m.target.value)},e[17]=Z):Z=e[17];const ve=Z;let H;e[18]===Symbol.for("react.memo_cache_sentinel")?(H=m=>{ye(m.target.value==="down"?"down":"up")},e[18]=H):H=e[18];const xe=H;let ee;e[19]===Symbol.for("react.memo_cache_sentinel")?(ee=m=>{be(m.target.checked)},e[19]=ee):ee=e[19];const Ne=ee;let y;e[20]!==ne||e[21]!==o?(y=t(Ee,{onChange:ne,testId:"mg-shard-input",value:o}),e[20]=ne,e[21]=o,e[22]=y):y=e[22];let b;e[23]!==de?(b=t(_e,{message:de,prefix:"mg"}),e[23]=de,e[24]=b):b=e[24];let v;e[25]!==y||e[26]!==b?(v=i("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]}),e[25]=y,e[26]=b,e[27]=v):v=e[27];let x;e[28]!==oe||e[29]!==le?(x=oe!==null&&t(Ce,{error:le,testId:"mg-status-error"}),e[28]=oe,e[29]=le,e[30]=x):x=e[30];let N;e[31]!==d||e[32]!==r?(N=d!==null&&d.length===0&&t(Ke,{description:r("Data migrations you run against this shard will be tracked here."),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 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:r("No migrations have run on this shard.")}),e[31]=d,e[32]=r,e[33]=N):N=e[33];let S;e[34]!==d||e[35]!==r?(S=d!==null&&d.length>0&&t(Ie,{className:"overflow-hidden py-0",children:t(De,{className:"px-0",children:i(je,{"data-testid":"mg-table",children:[t(Fe,{children:i(he,{children:[t(u,{children:r("id")}),t(u,{children:r("direction")}),t(u,{children:r("status")}),t(u,{children:r("processed")}),t(u,{children:r("changed")}),t(u,{children:r("updated")}),t(u,{children:r("error")})]})}),t(Te,{children:d.map(Ve)})]})})}),e[34]=d,e[35]=r,e[36]=S):S=e[36];let w;e[37]!==r?(w=r("Run migration"),e[37]=r,e[38]=w):w=e[38];let $;e[39]!==w?($=t(ue,{children:w}),e[39]=w,e[40]=$):$=e[40];let k;e[41]!==r?(k=r("Migration id"),e[41]=r,e[42]=k):k=e[42];let R;e[43]!==r?(R=r("migration id"),e[43]=r,e[44]=R):R=e[44];let C;e[45]!==p||e[46]!==k||e[47]!==R?(C=t(Ae,{"aria-label":k,className:"w-auto","data-testid":"mg-id-input",onChange:ve,placeholder:R,value:p}),e[45]=p,e[46]=k,e[47]=R,e[48]=C):C=e[48];let _;e[49]!==r?(_=r("Direction"),e[49]=r,e[50]=_):_=e[50];let E;e[51]!==r?(E=r("up"),e[51]=r,e[52]=E):E=e[52];let L;e[53]!==E?(L=t("option",{value:"up",children:E}),e[53]=E,e[54]=L):L=e[54];let M;e[55]!==r?(M=r("down"),e[55]=r,e[56]=M):M=e[56];let I;e[57]!==M?(I=t("option",{value:"down",children:M}),e[57]=M,e[58]=I):I=e[58];let D;e[59]!==g||e[60]!==_||e[61]!==L||e[62]!==I?(D=i("select",{"aria-label":_,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:xe,value:g,children:[L,I]}),e[59]=g,e[60]=_,e[61]=L,e[62]=I,e[63]=D):D=e[63];let K;e[64]!==l?(K=t("input",{checked:l,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:Ne,type:"checkbox"}),e[64]=l,e[65]=K):K=e[65];let A;e[66]!==r?(A=r("Dry run"),e[66]=r,e[67]=A):A=e[67];let j;e[68]!==K||e[69]!==A?(j=i(ue,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[K,A]}),e[68]=K,e[69]=A,e[70]=j):j=e[70];let F;e[71]!==l||e[72]!==Y||e[73]!==f||e[74]!==P||e[75]!==r?(F=l?t(Me,{"data-testid":"mg-run",disabled:f||!P,onClick:Y,type:"button",children:r(f?"Running…":"Run")}):t(Re,{confirmLabel:r(f?"Running…":"Run migration?"),disabled:f||!P,onConfirm:Y,testId:"mg-run",children:r("Run")}),e[71]=l,e[72]=Y,e[73]=f,e[74]=P,e[75]=r,e[76]=F):F=e[76];let T;e[77]!==C||e[78]!==D||e[79]!==j||e[80]!==F?(T=i("div",{className:"flex flex-wrap items-center gap-2",children:[C,D,j,F]}),e[77]=C,e[78]=D,e[79]=j,e[80]=F,e[81]=T):T=e[81];let q;e[82]!==$||e[83]!==T?(q=i("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[$,T]}),e[82]=$,e[83]=T,e[84]=q):q=e[84];let B;e[85]!==z?(B=z!==null&&t("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:z}),e[85]=z,e[86]=B):B=e[86];let O;e[87]!==c||e[88]!==r?(O=c!==null&&i("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[c.dryRun?r("Dry run: "):"",r("{status} — processed",{status:c.status}),c.processed,r(", changed"),c.changed]}),e[87]=c,e[88]=r,e[89]=O):O=e[89];let re;return e[90]!==v||e[91]!==x||e[92]!==N||e[93]!==S||e[94]!==q||e[95]!==B||e[96]!==O?(re=i("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[v,x,N,S,q,B,O]}),e[90]=v,e[91]=x,e[92]=N,e[93]=S,e[94]=q,e[95]=B,e[96]=O,e[97]=re):re=e[97],re};function Ve(n){return i(he,{"data-testid":`mg-row-${n.id}`,children:[t(h,{children:n.id}),t(h,{children:n.direction}),t(h,{children:t(Le,{variant:"secondary",children:n.status})}),t(h,{children:n.processed}),t(h,{children:n.changed}),t(h,{children:We(n.updatedAt)}),t(h,{children:n.error??""})]},n.id)}export{yr as MigrationsPanel};
@@ -0,0 +1 @@
1
+ import{c as g}from"react/compiler-runtime";import{useLunora as y}from"@lunora/react";import{E as f}from"./empty-state-Cg7t_8qu.js";import{n as h}from"./skeleton-C1wQ9M5t.js";import{u as k,U as x}from"./reference-view-DncEStdm.js";import{useT as P}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{jsxs as S,jsx as p}from"react/jsx-runtime";const v=t=>(t.params??[]).find(e=>e.name==="args")??(t.params??[])[0],w=t=>t["x-tags"]?.[0]?.name??(t.name.includes(":")?t.name.slice(0,t.name.indexOf(":")):""),I=t=>{const e=v(t)?.schema;return{argsSchema:e,description:t.description,functionPath:t.name,httpPath:"/_lunora/rpc",key:t.name,kind:t["x-lunora-function-kind"],method:"POST",operationId:t.name,requestSchema:e,responses:[{description:t.result?.name,schema:t.result?.schema,status:"200"}],summary:t.summary??t.name,tags:[w(t)],title:t.summary??t.name}},C=t=>{const e=t??{},d=(e.methods??[]).map(a=>I(a)),o=new Map;for(const a of d){const m=a.tags[0]??"",r=o.get(m)??[];r.push(a),o.set(m,r)}return{groups:[...o.entries()].map(([a,m])=>({name:a,operations:m.toSorted((r,c)=>r.operationId.localeCompare(c.operationId))})).toSorted((a,m)=>a.name.localeCompare(m.name)),operationByKey:new Map(d.map(a=>[a.key,a])),title:e.info?.title??"API reference",version:e.info?.version}},O=t=>t.methods===void 0||t.methods.length===0,R=t=>{const e=t;return O(e)?{kind:"empty"}:{kind:"ready",spec:e}},T=t=>{const e=g(23),{spec:d}=t,o=P(),a=y();let m;e[0]!==a?(m=()=>a.fetchOpenRpc(),e[0]=a,e[1]=m):m=e[1];const r=k(d,m,R);let c;e[2]!==r.kind||e[3]!==r.spec?(c=r.kind==="ready"?C(r.spec):void 0,e[2]=r.kind,e[3]=r.spec,e[4]=c):c=e[4];const l=c;if(r.kind==="loading"){let n;return e[5]===Symbol.for("react.memo_cache_sentinel")?(n=S("div",{className:"flex flex-col gap-4","data-testid":"openrpc-reference-loading",children:[p(h,{className:"h-8 w-48"}),p(h,{className:"h-64 w-full"})]}),e[5]=n):n=e[5],n}if(r.kind==="error"){let n;e[6]!==r.message||e[7]!==o?(n=o("Couldn't load the OpenRPC spec: {message}",{message:r.message}),e[6]=r.message,e[7]=o,e[8]=n):n=e[8];let s;e[9]!==o?(s=o("API reference unavailable"),e[9]=o,e[10]=s):s=e[10];let i;return e[11]!==n||e[12]!==s?(i=p(f,{description:n,testId:"openrpc-reference-error",title:s}),e[11]=n,e[12]=s,e[13]=i):i=e[13],i}if(r.kind==="empty"||l===void 0){let n;e[14]!==o?(n=o("Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here."),e[14]=o,e[15]=n):n=e[15];let s;e[16]!==o?(s=o("No OpenRPC spec configured"),e[16]=o,e[17]=s):s=e[17];let i;return e[18]!==n||e[19]!==s?(i=p(f,{description:n,testId:"openrpc-reference-empty",title:s}),e[18]=n,e[19]=s,e[20]=i):i=e[20],i}let u;return e[21]!==l?(u=p(x,{model:l}),e[21]=l,e[22]=u):u=e[22],u};export{T as default};
@@ -0,0 +1 @@
1
+ const o="lunora-studio-root";export{o as default};
@@ -0,0 +1 @@
1
+ import{c as I}from"react/compiler-runtime";import{useLunora as M}from"@lunora/react";import{useState as J,useEffect as R}from"react";import{ConfirmButton as T}from"./ConfirmButton-CTL3f3kr.js";import{c as q,u as K}from"./card-CIDGUN6K.js";import{E as O}from"./empty-state-Cg7t_8qu.js";import{n as P,d as V,m as $,p as s,f as W,u as d}from"./table-DdJBrClo.js";import{O as X}from"./use-admin-query-CnnyWJXM.js";import{useAutoRefresh as Y}from"./DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js";import{useT as z}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{f as D,i as G,b as H}from"./internal-zkEvTqy8.js";import{jsx as o,jsxs as p}from"react/jsx-runtime";const Q=i=>Number.isFinite(i)?G(i,"—"):"—",A=i=>i.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),U=(i,e,u)=>e!==void 0?e:u===void 0?f=>i.cancelScheduledJob(f):void 0,me=i=>{const e=I(16),{cancelJob:u,loadJobs:f}=i===void 0?{}:i,l=M(),t=z(),c=f===void 0;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=["lunora-scheduled-jobs"],e[0]=b):b=e[0];const a=X(b,async()=>{const r=await(f??(()=>l.listScheduledJobs()))();return A(r)}),[C,F]=J(void 0),[L,S]=J(void 0);let v,x;e[1]!==l||e[2]!==c?(v=()=>{if(c)return l.subscribeScheduledJobs(r=>{S(void 0),F(A(r))})},x=[c,l],e[1]=l,e[2]=c,e[3]=v,e[4]=x):(v=e[3],x=e[4]),R(v,x);let j;e[5]!==a?(j=()=>{a.refetch()},e[5]=a,e[6]=j):j=e[6],Y(j,!c);const N=U(l,u,f),n=C??a.data,g=L??a.error,k=async r=>{if(N!==void 0){S(void 0);try{await N(r),c||a.refetch()}catch(B){S(H(B))}}},E="flex flex-col gap-3",_="lunora-scheduled-jobs";let m;e[7]!==g?(m=g!==null&&o("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:g}),e[7]=g,e[8]=m):m=e[8];let h;e[9]!==n?.length||e[10]!==t?(h=n?.length===0&&o(O,{description:t("Jobs queued with runAfter / runAt will appear here."),icon:p("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[o("circle",{cx:"12",cy:"12",r:"9"}),o("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:t("No scheduled jobs.")}),e[9]=n?.length,e[10]=t,e[11]=h):h=e[11];const w=n!==void 0&&n.length>0&&o(q,{className:"overflow-hidden py-0",children:o(K,{className:"px-0",children:p(P,{"data-testid":"sj-table",children:[o(V,{children:p($,{children:[o(s,{children:t("function")}),o(s,{children:t("scheduled for")}),o(s,{children:t("pool")}),o(s,{children:t("attempts")}),o(s,{children:t("shard")}),o(s,{children:t("id")}),N!==void 0&&o(s,{"aria-label":t("Actions")})]})}),o(W,{children:n.map(r=>p($,{"data-testid":`sj-row-${r.id}`,children:[o(d,{className:"font-mono text-xs",children:r.functionPath}),o(d,{className:"text-muted-foreground tabular-nums",children:Q(r.scheduledFor)}),o(d,{className:"font-mono text-xs",children:r.pool??""}),o(d,{className:"tabular-nums",children:r.attempts??0}),o(d,{children:r.shardKey??""}),o(d,{className:"font-mono text-xs",children:r.id}),N!==void 0&&o(d,{className:"text-right",children:o(T,{confirmLabel:t("Cancel job?"),onConfirm:()=>{D(k(r.id))},testId:`sj-cancel-${r.id}`,children:t("Cancel")})})]},r.id))})]})})});let y;return e[12]!==w||e[13]!==m||e[14]!==h?(y=p("div",{className:E,"data-testid":_,children:[m,h,w]}),e[12]=w,e[13]=m,e[14]=h,e[15]=y):y=e[15],y};export{me as ScheduledJobs};
@@ -0,0 +1 @@
1
+ import{c as $}from"react/compiler-runtime";import{useId as x,useState as I}from"react";import{useT as b}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{l as j}from"./shard-history-DMEW5VBE.js";import{u as k}from"./input-JHu63lTv.js";import{jsx as v,jsxs as y,Fragment as C}from"react/jsx-runtime";const A=i=>{const t=$(21),{id:c,onChange:h,testId:e,value:p}=i,a=b(),d=x(),[s]=I(F);let m;t[0]!==h?(m=S=>{h(S.target.value)},t[0]=h,t[1]=m):m=t[1];const f=m;let r;t[2]!==a?(r=a("Shard key"),t[2]=a,t[3]=r):r=t[3];const g=s.length>0?d:void 0;let o;t[4]!==a?(o=a("shard key (optional)"),t[4]=a,t[5]=o):o=t[5];let n;t[6]!==c||t[7]!==f||t[8]!==r||t[9]!==g||t[10]!==o||t[11]!==e||t[12]!==p?(n=v(k,{"aria-label":r,className:"h-8 w-48","data-testid":e,id:c,list:g,onChange:f,placeholder:o,value:p}),t[6]=c,t[7]=f,t[8]=r,t[9]=g,t[10]=o,t[11]=e,t[12]=p,t[13]=n):n=t[13];let l;t[14]!==d||t[15]!==s||t[16]!==e?(l=s.length>0&&v("datalist",{"data-testid":`${e}-recents`,id:d,children:s.map(w)}),t[14]=d,t[15]=s,t[16]=e,t[17]=l):l=t[17];let u;return t[18]!==n||t[19]!==l?(u=y(C,{children:[n,l]}),t[18]=n,t[19]=l,t[20]=u):u=t[20],u};function F(){return j()}function w(i){return v("option",{"aria-label":i,value:i},i)}export{A as ShardInput};
@@ -0,0 +1 @@
1
+ import"react/compiler-runtime";import"@tanstack/react-router";import"react";import{S as j}from"./studio-Drf4en3j.js";import"./ErrorBoundary-DvzYskH7.js";import"./operation-console-provider-BMJNtiyB.js";import"./badge-BbuuAio7.js";import"./input-JHu63lTv.js";import"./skeleton-C1wQ9M5t.js";import"./home-panel-BtxdqXDe.js";import"./DEFAULT_LOCALE-BZ4NojpD.js";import"./StudioI18nProvider-CZ5h4nrV.js";import"./data-view-params-ClrV7XgF.js";import"./internal-zkEvTqy8.js";import"./utils-bhneXptQ.js";import"./CommandPalette-mPR8-vIm.js";import"react/jsx-runtime";export{j as Studio};
@@ -0,0 +1 @@
1
+ import{c as E}from"react/compiler-runtime";import{LunoraClient as z}from"@lunora/client";import{LunoraProvider as q}from"@lunora/react";import{useState as K,useEffect as U}from"react";import{ErrorBoundary as G}from"./ErrorBoundary-DvzYskH7.js";import{b as R,f as H,a as J,m as Q,S as V}from"./studio-Drf4en3j.js";import X from"./useDebounced-CU-uftxO.js";import{useT as D,createStudioI18n as Y}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{StudioI18nProvider as M}from"./StudioI18nProvider-CZ5h4nrV.js";import{r as Z}from"./internal-zkEvTqy8.js";import{h as j}from"./recording-client-DtUxwVNY.js";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.js";import{a as B}from"./browser-storage-xjTyMKY0.js";import{c as W}from"./utils-bhneXptQ.js";import{u as ee}from"./button-BkCrNcAs.js";import{u as te}from"./input-JHu63lTv.js";import{jsx as b,jsxs as C}from"react/jsx-runtime";const O="lunora-studio-admin-token",oe=()=>{try{return B("session")?.getItem(O)??""}catch{return""}},ne=k=>{const e=B("session");if(e!==void 0)try{k===""?e.removeItem(O):e.setItem(O,k)}catch{}},re="/_lunora/admin/ws-token",le=k=>{const e=k;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},ae=k=>{const{adminToken:e,baseUrl:c}=k,o=k.fetchImpl??fetch;let n=c;for(;n.endsWith("/");)n=n.slice(0,-1);const s=`${n}${re}`;let t,r=!1,l;const m=async()=>{const f=await o(s,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(f.status===404||f.status===405)return r=!0,e;if(!f.ok)throw new Error(`ws-token mint failed: ${String(f.status)}`);const a=await f.json().catch(()=>{});if(!le(a))throw new Error("ws-token mint failed: malformed response body");return t=a,a.token};return{getToken:async()=>r?e:t!==void 0&&t.expiresAtMs-1e4>Date.now()?t.token:(l??=m().finally(()=>{l=void 0}),l),invalidate:()=>{t=void 0}}},se=k=>{const e=E(42),{onSubmit:c}=k,o=D(),[n,s]=K("");let t;e[0]!==n?(t=n.trim(),e[0]=n,e[1]=t):t=e[1];const r=t;let l;e[2]!==c||e[3]!==r?(l=N=>{N.preventDefault(),r!==""&&c(r)},e[2]=c,e[3]=r,e[4]=l):l=e[4];const m=l;let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=b("div",{className:"h-10 w-10 text-foreground",children:b(H,{})}),e[5]=f):f=e[5];let a;e[6]!==o?(a=o("Connect to Lunora Studio"),e[6]=o,e[7]=a):a=e[7];let v;e[8]!==a?(v=b("h1",{className:"text-base font-semibold text-foreground",children:a}),e[8]=a,e[9]=v):v=e[9];let g;e[10]!==o?(g=o("Enter your admin token to access the studio."),e[10]=o,e[11]=g):g=e[11];let u;e[12]!==g?(u=b("p",{className:"text-[13px] text-muted-foreground",children:g}),e[12]=g,e[13]=u):u=e[13];let d;e[14]!==v||e[15]!==u?(d=C("div",{className:"flex flex-col items-center gap-3 text-center",children:[f,C("div",{className:"flex flex-col gap-1",children:[v,u]})]}),e[14]=v,e[15]=u,e[16]=d):d=e[16];let h;e[17]!==o?(h=o("admin token"),e[17]=o,e[18]=h):h=e[18];let i;e[19]!==h?(i=b("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:h}),e[19]=h,e[20]=i):i=e[20];let p;e[21]===Symbol.for("react.memo_cache_sentinel")?(p=N=>{s(N.target.value)},e[21]=p):p=e[21];let x;e[22]!==n?(x=b(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:p,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:n}),e[22]=n,e[23]=x):x=e[23];let y;e[24]!==o?(y=o("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production."),e[24]=o,e[25]=y):y=e[25];let I;e[26]!==y?(I=b("p",{className:"text-[11px] text-muted-foreground",children:y}),e[26]=y,e[27]=I):I=e[27];let S;e[28]!==i||e[29]!==x||e[30]!==I?(S=C("div",{className:"flex flex-col gap-1.5",children:[i,x,I]}),e[28]=i,e[29]=x,e[30]=I,e[31]=S):S=e[31];const _=r==="";let T;e[32]!==o?(T=o("Connect"),e[32]=o,e[33]=T):T=e[33];let w;e[34]!==_||e[35]!==T?(w=b(ee,{"data-testid":"lunora-studio-login-submit",disabled:_,type:"submit",children:T}),e[34]=_,e[35]=T,e[36]=w):w=e[36];let $;return e[37]!==m||e[38]!==S||e[39]!==w||e[40]!==d?($=C("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:m,children:[d,S,w]}),e[37]=m,e[38]=S,e[39]=w,e[40]=d,e[41]=$):$=e[41],$},ie=k=>{const e=E(10),{i18n:c,onSubmit:o}=k,{resolvedTheme:n}=R(),s=n==="dark"&&"dark";let t;e[0]!==s?(t=W(F,s,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=s,e[1]=t):t=e[1];let r;e[2]!==o?(r=b(se,{onSubmit:o}),e[2]=o,e[3]=r):r=e[3];let l;e[4]!==c||e[5]!==r?(l=b(M,{i18n:c,children:r}),e[4]=c,e[5]=r,e[6]=l):l=e[6];let m;return e[7]!==t||e[8]!==l?(m=b("div",{className:t,"data-testid":"lunora-studio-login-root",children:l}),e[7]=t,e[8]=l,e[9]=m):m=e[9],m},de=k=>{const e=E(23),{basePath:c,chrome:o,studio:n}=k,s=D();let t;e[0]!==s?(t=s("Studio failed"),e[0]=s,e[1]=t):t=e[1];let r;e[2]!==s?(r=s("Studio"),e[2]=s,e[3]=r):r=e[3];let l;e[4]!==s?(l=s("Try again"),e[4]=s,e[5]=l):l=e[5];const m=n?.dataEditable,f=n?.functions,a=n?.initialShardKey,v=n?.openApiSpec,g=n?.openRpcSpec,u=n?.runAsIdentity,d=n?.scheduledCancel,h=n?.scheduledLoad,i=n?.schemaEditable;let p;e[6]!==c||e[7]!==o||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==m||e[12]!==f||e[13]!==a||e[14]!==v||e[15]!==g||e[16]!==u?(p=b(V,{basePath:c,chrome:o,dataEditable:m,functions:f,initialShardKey:a,openApiSpec:v,openRpcSpec:g,runAsIdentity:u,scheduledCancel:d,scheduledLoad:h,schemaEditable:i}),e[6]=c,e[7]=o,e[8]=d,e[9]=h,e[10]=i,e[11]=m,e[12]=f,e[13]=a,e[14]=v,e[15]=g,e[16]=u,e[17]=p):p=e[17];let x;return e[18]!==t||e[19]!==p||e[20]!==r||e[21]!==l?(x=b(G,{fallbackTitle:t,label:r,retryLabel:l,children:p}),e[18]=t,e[19]=p,e[20]=r,e[21]=l,e[22]=x):x=e[22],x},ce=k=>{const e=E(20),{basePath:c,clearToken:o,client:n,i18n:s,onTokenChange:t,rulesInstalled:r,studio:l,token:m}=k,{resolvedTheme:f}=R();let a;e[0]!==o||e[1]!==t||e[2]!==r||e[3]!==m?(a={clearToken:o,onTokenChange:t,rulesInstalled:r,token:m},e[0]=o,e[1]=t,e[2]=r,e[3]=m,e[4]=a):a=e[4];const v=a,g=f==="dark"&&"dark";let u;e[5]!==g?(u=W(F,g,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=g,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==v||e[9]!==l?(d=b(Q,{children:b(de,{basePath:c,chrome:v,studio:l})}),e[7]=c,e[8]=v,e[9]=l,e[10]=d):d=e[10];let h;e[11]!==s||e[12]!==d?(h=b(M,{i18n:s,children:d}),e[11]=s,e[12]=d,e[13]=h):h=e[13];let i;e[14]!==n||e[15]!==h?(i=b(q,{client:n,children:h}),e[14]=n,e[15]=h,e[16]=i):i=e[16];let p;return e[17]!==u||e[18]!==i?(p=b("div",{className:u,"data-testid":"lunora-studio-app",children:i}),e[17]=u,e[18]=i,e[19]=p):p=e[19],p},Ae=k=>{const e=E(27);let c;e[0]!==k?(c=k===void 0?{}:k,e[0]=k,e[1]=c):c=e[1];const{adminToken:o,basePath:n,baseUrl:s,client:t,rulesInstalled:r,studio:l,locale:m}=c;let f;e[2]!==o?(f=()=>o??oe(),e[2]=o,e[3]=f):f=e[3];const[a,v]=K(f);let g,u;e[4]!==a?(g=()=>{ne(a)},u=[a],e[4]=a,e[5]=g,e[6]=u):(g=e[5],u=e[6]),U(g,u);const d=X(a,300);let h;e:{if(t!==void 0){let A;e[7]!==t?(A=j(t),e[7]=t,e[8]=A):A=e[8],h=A;break e}let N;if(e[9]!==s||e[10]!==d){const A=Z(s),P=d===""?void 0:ae({adminToken:d,baseUrl:A}),L=new z({url:A,...P===void 0?{}:{wsToken:P.getToken}});P!==void 0&&(L.setAuthToken(d),L.onTokenExpired(P.invalidate)),N=j(L),e[9]=s,e[10]=d,e[11]=N}else N=e[11];h=N}const i=h;let p,x;e[12]!==i||e[13]!==t?(p=()=>()=>{t===void 0&&i.close()},x=[i,t],e[12]=i,e[13]=t,e[14]=p,e[15]=x):(p=e[14],x=e[15]),U(p,x);let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=N=>{v(N.target.value)},e[16]=y):y=e[16];const I=y;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{v("")},e[17]=S):S=e[17];const _=S;let T;e[18]!==m?(T=Y(m),e[18]=m,e[19]=T):T=e[19];const w=T;let $;return e[20]!==n||e[21]!==i||e[22]!==w||e[23]!==r||e[24]!==l||e[25]!==a?($=b(J,{children:a===""?b(ie,{i18n:w,onSubmit:v}):b(ce,{basePath:n,clearToken:_,client:i,i18n:w,onTokenChange:I,rulesInstalled:r,studio:l,token:a})}),e[20]=n,e[21]=i,e[22]=w,e[23]=r,e[24]=l,e[25]=a,e[26]=$):$=e[26],$};export{Ae as StudioApp};
@@ -0,0 +1 @@
1
+ import{c as a}from"react/compiler-runtime";import{StudioI18nContext as l,studioI18n as m,createStudioI18n as u}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{jsx as v}from"react/jsx-runtime";const p=(i,o,t)=>i!==void 0?i:o===void 0&&t===void 0?m:u(o,t),S=i=>{const o=a(7),{catalogs:t,children:n,i18n:s,locale:d}=i;let r;o[0]!==t||o[1]!==s||o[2]!==d?(r=p(s,d,t),o[0]=t,o[1]=s,o[2]=d,o[3]=r):r=o[3];const c=r;let e;return o[4]!==n||o[5]!==c?(e=v(l,{value:c,children:n}),o[4]=n,o[5]=c,o[6]=e):e=o[6],e};export{S as StudioI18nProvider};
@@ -0,0 +1 @@
1
+ import{useState as x}from"react";import{E as b}from"./error-alert--Ie7ofJ0.js";import{c as N,u as v}from"./card-CIDGUN6K.js";import{n as w,d as y,m as c,p as m,f as $,u as l}from"./table-DdJBrClo.js";import{useT as k}from"./DEFAULT_LOCALE-BZ4NojpD.js";import{c as E}from"./utils-bhneXptQ.js";import{jsxs as i,jsx as t}from"react/jsx-runtime";const I={ERROR:"error",INFO:"info",WARN:"warning"},q=e=>{const n=typeof e.metadata.table=="string"?e.metadata.table:void 0;return{description:`${e.detail} ${e.remediation}`,entity:n,issueType:e.title,key:e.cacheKey,level:I[e.level]}},T=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},R=(e,n)=>({error:e("Errors"),info:e("Info"),warning:e("Warnings")})[n],O=(e,n,o)=>({error:e("{count} errors",{count:o}),info:e("{count} suggestions",{count:o}),warning:e("{count} warnings",{count:o})})[n],S=(e,n)=>({error:e("No errors detected"),info:e("No suggestions"),warning:e("No warnings detected")})[n],j=e=>{const n={error:0,info:0,warning:0};for(const o of e??[])n[o.level]+=1;return n},B=({error:e=null,errorSource:n,rows:o,testId:a,toolbar:f})=>{const s=k(),[d,p]=x("error"),g=j(o),u=(o??[]).filter(r=>r.level===d),h=r=>{p(r.currentTarget.dataset.level)};return i("div",{className:"flex flex-col gap-3","data-testid":a,children:[t("div",{className:"flex border-b border-border",role:"tablist",children:T.map(r=>i("button",{"aria-selected":d===r,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":r,"data-testid":`${a}-tab-${r}`,onClick:h,role:"tab",type:"button",children:[i("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t("span",{"aria-hidden":"true",className:E("size-2 rounded-sm",A[r])}),R(s,r)]}),t("span",{className:"ps-4 text-xs text-muted-foreground",children:O(s,r,g[r])})]},r))}),f!==void 0&&t("div",{className:"flex flex-wrap items-center gap-2",children:f}),e!==null&&t(b,{error:n??e,testId:`${a}-error`}),t(N,{className:"overflow-hidden py-0",children:t(v,{className:"px-0",children:i(w,{children:[t(y,{children:i(c,{children:[t(m,{children:s("Issue type")}),t(m,{children:s("Entity/item")}),t(m,{children:s("Description")})]})}),t($,{children:u.length===0?t(c,{children:i(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${a}-empty`,children:[t("span",{className:"block text-sm font-medium text-foreground",children:S(s,d)}),t("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(r=>i(c,{children:[t(l,{className:"font-medium text-foreground",children:r.issueType}),t(l,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"—"}),i(l,{className:"text-muted-foreground",children:[t("span",{children:r.description}),r.action!==void 0&&t("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:r.action})]})]},r.key))})]})})})]})};export{B as A,q as E};
@@ -0,0 +1 @@
1
+ const u=e=>{let t=0,a=0,r=0,n=0,o=0,l=0,c=0;for(const{metrics:s}of e){if(s===null){o+=1;continue}n+=1,t+=s.requests,a+=s.errors,r+=s.databaseSize??0,s.cache!==null&&(l+=s.cache.hits,c+=s.cache.hits+s.cache.misses)}return{failed:o,hitRate:c===0?null:l/c,reachable:n,totalDatabaseSize:r,totalErrors:a,totalRequests:t}},h=(e,t)=>{const a=new Set,r=[];for(const n of["",e.trim(),...t])a.has(n)||(a.add(n),r.push(n));return r},i=(e,t)=>{if(e.length===0)return 0;if(e.sort((r,n)=>r-n),t<=0)return e[0]??0;if(t>=100)return e.at(-1)??0;const a=Math.ceil(t/100*e.length)-1;return e[a]??0},f=e=>{const t=e.functions;if(!t||t.length===0)return{p90:0,p95:0};const a=1e3,r=[];for(const n of t){if(n.calls<=0)continue;const o=n.totalDurationMs/n.calls,l=Math.min(n.calls,a);for(let c=0;c<l;c+=1)r.push(o)}return r.length===0?{p90:0,p95:0}:{p90:i([...r],90),p95:i([...r],95)}},p=(e,t,a="neutral")=>{const r=t-e,n=e===0?null:r/e*100;return{delta:r,direction:a,pct:n}},g=e=>e.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0}));export{u as aggregateMetrics,p as computeDelta,f as computeLatencyPercentiles,g as enrichQueryStats,i as percentile,h as shardsToAggregate};
@@ -0,0 +1 @@
1
+ import{c}from"react/compiler-runtime";import{cva as l}from"class-variance-authority";import{c as v}from"./utils-bhneXptQ.js";import{jsx as b,jsxs as u}from"react/jsx-runtime";const x=l("flex items-start gap-2 rounded-md border px-3 py-2 text-sm [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0",{defaultVariants:{variant:"default"},variants:{variant:{default:"border-border bg-muted/40 text-foreground",destructive:"border-destructive/40 bg-destructive/5 text-destructive",warning:"border-amber-500/40 bg-amber-500/5 text-amber-700 dark:text-amber-400"}}}),N=m=>{const t=c(10),{children:s,className:d,icon:i,testId:o,variant:n}=m;let e;t[0]!==d||t[1]!==n?(e=v(x({variant:n}),d),t[0]=d,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s?(r=b("div",{className:"min-w-0 flex-1",children:s}),t[3]=s,t[4]=r):r=t[4];let a;return t[5]!==i||t[6]!==e||t[7]!==r||t[8]!==o?(a=u("div",{className:e,"data-testid":o,role:"alert",children:[i,r]}),t[5]=i,t[6]=e,t[7]=r,t[8]=o,t[9]=a):a=t[9],a};export{N as A};