@lunora/studio 1.0.0-alpha.3 → 1.0.0-alpha.300

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 (353) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +1 -1
  3. package/__assets__/package-og.svg +1 -1
  4. package/dist/index.d.mts +1581 -0
  5. package/dist/index.d.ts +982 -803
  6. package/dist/index.mjs +1 -0
  7. package/dist/mount.d.mts +22 -0
  8. package/dist/mount.d.ts +11 -10
  9. package/dist/mount.mjs +1 -0
  10. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
  11. package/dist/packem_chunks/ApiTab.mjs +1 -0
  12. package/dist/packem_chunks/AuditPanel.mjs +1 -0
  13. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
  14. package/dist/packem_chunks/ExportImportPanel.mjs +3 -0
  15. package/dist/packem_chunks/FileBrowser.mjs +4 -0
  16. package/dist/packem_chunks/FunctionRunner.mjs +1 -0
  17. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
  18. package/dist/packem_chunks/HealthPanel.mjs +1 -0
  19. package/dist/packem_chunks/InsightsPanel.mjs +1 -0
  20. package/dist/packem_chunks/LogsPanel.mjs +1 -0
  21. package/dist/packem_chunks/MailPanel.mjs +2 -0
  22. package/dist/packem_chunks/MetricsPanel.mjs +1 -0
  23. package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
  24. package/dist/packem_chunks/PitrPanel.mjs +1 -0
  25. package/dist/packem_chunks/SchemaViewer.mjs +1 -0
  26. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
  27. package/dist/packem_chunks/SettingsPanel.mjs +1 -0
  28. package/dist/packem_chunks/SqlEditorPanel.mjs +10 -0
  29. package/dist/packem_chunks/TableEditor.mjs +1 -0
  30. package/dist/packem_chunks/agents-panel.mjs +1 -0
  31. package/dist/packem_chunks/ai-usage-panel.mjs +1 -0
  32. package/dist/packem_chunks/analytics-panel.mjs +1 -0
  33. package/dist/packem_chunks/architecture-panel.mjs +1 -0
  34. package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
  35. package/dist/packem_chunks/auth-config-panel.mjs +1 -0
  36. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
  37. package/dist/packem_chunks/containers-panel.mjs +1 -0
  38. package/dist/packem_chunks/dashboards-panel.mjs +1 -0
  39. package/dist/packem_chunks/evals-panel.mjs +1 -0
  40. package/dist/packem_chunks/fanout-panel.mjs +1 -0
  41. package/dist/packem_chunks/flags-panel.mjs +1 -0
  42. package/dist/packem_chunks/issues-panel.mjs +1 -0
  43. package/dist/packem_chunks/kv-browser.mjs +1 -0
  44. package/dist/packem_chunks/log-drains-panel.mjs +4 -0
  45. package/dist/packem_chunks/migrations-route.mjs +1 -0
  46. package/dist/packem_chunks/organizations-panel.mjs +1 -0
  47. package/dist/packem_chunks/payments-panel.mjs +1 -0
  48. package/dist/packem_chunks/permissions-panel.mjs +1 -0
  49. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -0
  50. package/dist/packem_chunks/queues-panel.mjs +1 -0
  51. package/dist/packem_chunks/reactors-panel.mjs +1 -0
  52. package/dist/packem_chunks/rls-panel.mjs +1 -0
  53. package/dist/packem_chunks/schedule-panel.mjs +1 -0
  54. package/dist/packem_chunks/sparkline.mjs +1 -0
  55. package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
  56. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  57. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  58. package/dist/packem_chunks/traces-panel.mjs +1 -0
  59. package/dist/packem_chunks/users-panel.mjs +1 -0
  60. package/dist/packem_chunks/vector-browser.mjs +1 -0
  61. package/dist/packem_chunks/workflows-panel.mjs +1 -0
  62. package/dist/packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs +1 -0
  63. package/dist/packem_shared/ApiDocsPanel-fhDlZGE4.mjs +2 -0
  64. package/dist/packem_shared/ApiReferencePanel-nAf8tNRr.mjs +1 -0
  65. package/dist/packem_shared/CommandPalette-D9ZY-qQd.mjs +1 -0
  66. package/dist/packem_shared/ConfirmButton-DU4p72Er.mjs +1 -0
  67. package/dist/packem_shared/ConnectionBadge-B8Hj5DaE.mjs +1 -0
  68. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs +1 -0
  69. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  70. package/dist/packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs +1 -0
  71. package/dist/packem_shared/DataBrowser-C14aRmmR.mjs +4 -0
  72. package/dist/packem_shared/DataFilters-CYZFt2EK.mjs +1 -0
  73. package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
  74. package/dist/packem_shared/GlobalDataBrowser-DhObcZDY.mjs +1 -0
  75. package/dist/packem_shared/HomePanel-CUuYsApa.mjs +1 -0
  76. package/dist/packem_shared/MigrationsPanel-CkVIwAbK.mjs +1 -0
  77. package/dist/packem_shared/OpenRpcReferencePanel-BxEr49D9.mjs +1 -0
  78. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
  79. package/dist/packem_shared/ScheduledJobs-BZNcYWBP.mjs +1 -0
  80. package/dist/packem_shared/ShardInput-C6mjgAh4.mjs +1 -0
  81. package/dist/packem_shared/Studio-CZjQXFHC.mjs +1 -0
  82. package/dist/packem_shared/StudioApp-C9ENwcOH.mjs +1 -0
  83. package/dist/packem_shared/StudioI18nProvider-fVsCSs5L.mjs +1 -0
  84. package/dist/packem_shared/advisor-view-DzI2RQhY.mjs +1 -0
  85. package/dist/packem_shared/aggregateMetrics-DKFJc-o5.mjs +1 -0
  86. package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
  87. package/dist/packem_shared/app.d-D7vL0y8y.d.mts +349 -0
  88. package/dist/packem_shared/app.d-D7vL0y8y.d.ts +349 -0
  89. package/dist/packem_shared/auth-pager-DiDnXsfe.mjs +1 -0
  90. package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
  91. package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
  92. package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
  93. package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
  94. package/dist/packem_shared/card-By2O8ULa.mjs +1 -0
  95. package/dist/packem_shared/cf-links-CBJ5SywP.mjs +1 -0
  96. package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
  97. package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
  98. package/dist/packem_shared/data-grid-DIiNmDR9.mjs +1 -0
  99. package/dist/packem_shared/data-view-params-DhYmAkcj.mjs +1 -0
  100. package/dist/packem_shared/diagram-export-panel-D5CVNJkp.mjs +2 -0
  101. package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
  102. package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
  103. package/dist/packem_shared/error-alert-DueSEkt-.mjs +1 -0
  104. package/dist/packem_shared/grid-features-OVIMIQan.mjs +6 -0
  105. package/dist/packem_shared/grid-pagination-DgzyzfBh.mjs +1 -0
  106. package/dist/packem_shared/home-panel-BcE8S2Nn.mjs +3 -0
  107. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  108. package/dist/packem_shared/internal-Df43vQI0.mjs +2 -0
  109. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  110. package/dist/packem_shared/live-status-BuJdUZFU.mjs +1 -0
  111. package/dist/packem_shared/log-fields-BolUoZ9g.mjs +1 -0
  112. package/dist/packem_shared/log-line-CICyJ_kc.mjs +1 -0
  113. package/dist/packem_shared/metrics-format-1sNGG47R.mjs +1 -0
  114. package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
  115. package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
  116. package/dist/packem_shared/recording-client-CyFiAE2l.mjs +1 -0
  117. package/dist/packem_shared/reference-view-CIHyURU6.mjs +13 -0
  118. package/dist/packem_shared/schema-diagram-C5oilX7l.mjs +2 -0
  119. package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
  120. package/dist/packem_shared/select-DPyS18Vy.mjs +2 -0
  121. package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
  122. package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
  123. package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
  124. package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
  125. package/dist/packem_shared/sql-result-table-DyK762_A.mjs +1 -0
  126. package/dist/packem_shared/stat-card-BAv73QtB.mjs +1 -0
  127. package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
  128. package/dist/packem_shared/studio-fK2DTLde.mjs +2 -0
  129. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  130. package/dist/packem_shared/table-list-sidebar-DkPO_Qtz.mjs +1 -0
  131. package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
  132. package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
  133. package/dist/packem_shared/use-admin-query-tlBof8Yg.mjs +1 -0
  134. package/dist/packem_shared/use-admin-spec-Bir7V68L.mjs +1 -0
  135. package/dist/packem_shared/use-async-submit-CZqCMTJ_.mjs +1 -0
  136. package/dist/packem_shared/use-auth-config-Z_n4ABCI.mjs +1 -0
  137. package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
  138. package/dist/packem_shared/use-open-trace-DMVhpnyG.mjs +1 -0
  139. package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
  140. package/dist/packem_shared/use-sql-assistant-CZydTzd5.mjs +1 -0
  141. package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
  142. package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
  143. package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
  144. package/dist/packem_shared/wire-codec-B2DgCbKt.mjs +1 -0
  145. package/dist/standalone/chunk-23DA2KK5.js +9 -0
  146. package/dist/standalone/chunk-253UHWDX.js +1 -0
  147. package/dist/standalone/chunk-2I4NHEKA.js +1 -0
  148. package/dist/standalone/chunk-2IKDEUCX.js +1 -0
  149. package/dist/standalone/chunk-2VA5S3IA.js +1 -0
  150. package/dist/standalone/chunk-2WCD2IHE.js +1 -0
  151. package/dist/standalone/chunk-2XNKJZR7.js +1 -0
  152. package/dist/standalone/chunk-37WYCOQ2.js +1 -0
  153. package/dist/standalone/chunk-3CTF6VCQ.js +1 -0
  154. package/dist/standalone/chunk-3T5F2LKG.js +1 -0
  155. package/dist/standalone/chunk-3YXASVTP.js +1 -0
  156. package/dist/standalone/chunk-47INSVZQ.js +1 -0
  157. package/dist/standalone/chunk-4FFZMCLM.js +1 -0
  158. package/dist/standalone/chunk-4QO356DN.js +1 -0
  159. package/dist/standalone/chunk-4WD4XGC3.js +1 -0
  160. package/dist/standalone/chunk-4ZEL6BYL.js +1 -0
  161. package/dist/standalone/chunk-55UGUCQ6.js +1 -0
  162. package/dist/standalone/chunk-57L3MFDQ.js +14 -0
  163. package/dist/standalone/chunk-5AORAJFI.js +1 -0
  164. package/dist/standalone/chunk-5B2RTXBS.js +1 -0
  165. package/dist/standalone/chunk-5QR2SQIS.js +1 -0
  166. package/dist/standalone/chunk-6EZBEZ7D.js +1 -0
  167. package/dist/standalone/chunk-6HLARDYO.js +1 -0
  168. package/dist/standalone/chunk-6K53DCPW.js +2 -0
  169. package/dist/standalone/chunk-6MHPVN2Q.js +15 -0
  170. package/dist/standalone/chunk-6QTAHSDD.js +1 -0
  171. package/dist/standalone/chunk-76GDLOCA.js +1 -0
  172. package/dist/standalone/chunk-7G4Z6Q7X.js +1 -0
  173. package/dist/standalone/chunk-7RKB5KS7.js +1 -0
  174. package/dist/standalone/chunk-7Y3SY37W.js +1 -0
  175. package/dist/standalone/chunk-A4GRIXDU.js +1 -0
  176. package/dist/standalone/chunk-APEMVK3W.js +1 -0
  177. package/dist/standalone/chunk-AUAECCXB.js +1 -0
  178. package/dist/standalone/chunk-AUGKHAMQ.js +1 -0
  179. package/dist/standalone/chunk-AUO3CXYH.js +1 -0
  180. package/dist/standalone/chunk-AXU6L4JV.js +1 -0
  181. package/dist/standalone/chunk-BOMPSVRC.js +1 -0
  182. package/dist/standalone/chunk-C3TKN336.js +1 -0
  183. package/dist/standalone/chunk-C5NU4UZY.js +1 -0
  184. package/dist/standalone/chunk-CCDX5RYT.js +1 -0
  185. package/dist/standalone/chunk-CGQMJYCW.js +1 -0
  186. package/dist/standalone/chunk-CKEE7CZ6.js +1 -0
  187. package/dist/standalone/chunk-CQILUV6T.js +1 -0
  188. package/dist/standalone/chunk-CVXNHIQW.js +1 -0
  189. package/dist/standalone/chunk-DG4MKUNK.js +1 -0
  190. package/dist/standalone/chunk-E4PXACVL.js +3 -0
  191. package/dist/standalone/chunk-E6E3H5HA.js +4 -0
  192. package/dist/standalone/chunk-ECY2JC5F.js +1 -0
  193. package/dist/standalone/chunk-F2HHJDID.js +1 -0
  194. package/dist/standalone/chunk-FJKOBDDS.js +1 -0
  195. package/dist/standalone/chunk-FMJPASTV.js +1 -0
  196. package/dist/standalone/chunk-FPI7AMQJ.js +1 -0
  197. package/dist/standalone/chunk-FUYEZFBP.js +1 -0
  198. package/dist/standalone/chunk-FZIZZO3M.js +5 -0
  199. package/dist/standalone/chunk-G3MCWHRS.js +1 -0
  200. package/dist/standalone/chunk-G6DD6BH4.js +3 -0
  201. package/dist/standalone/chunk-G74GIEU4.js +1 -0
  202. package/dist/standalone/chunk-G7O4XEPM.js +1 -0
  203. package/dist/standalone/chunk-GBS5ACLN.js +1 -0
  204. package/dist/standalone/chunk-GHQ2VDI2.js +1 -0
  205. package/dist/standalone/chunk-GMIJJY43.js +1 -0
  206. package/dist/standalone/chunk-GUAU5JHQ.js +1 -0
  207. package/dist/standalone/chunk-HCTJKP5J.js +1 -0
  208. package/dist/standalone/chunk-HJHSQPHW.js +19 -0
  209. package/dist/standalone/chunk-I26MS5PJ.js +1 -0
  210. package/dist/standalone/chunk-IALIMFV2.js +1 -0
  211. package/dist/standalone/chunk-IHPBU2X4.js +1 -0
  212. package/dist/standalone/chunk-IMBXNH5M.js +1 -0
  213. package/dist/standalone/chunk-IT6VW5MM.js +1 -0
  214. package/dist/standalone/chunk-IWZ7GVQO.js +1 -0
  215. package/dist/standalone/chunk-JQXA2OYK.js +1 -0
  216. package/dist/standalone/chunk-JZGTSH2C.js +4 -0
  217. package/dist/standalone/chunk-KCNSN6ZF.js +1 -0
  218. package/dist/standalone/chunk-KQSQVNVI.js +1 -0
  219. package/dist/standalone/chunk-KUFFHQPR.js +1 -0
  220. package/dist/standalone/chunk-LOKJEEUS.js +1 -0
  221. package/dist/standalone/chunk-LUNNBKUL.js +1 -0
  222. package/dist/standalone/chunk-MK7SA3YV.js +8 -0
  223. package/dist/standalone/chunk-MVWZMWPD.js +1 -0
  224. package/dist/standalone/chunk-NCPW7WHO.js +1 -0
  225. package/dist/standalone/chunk-NDTQTKDX.js +6 -0
  226. package/dist/standalone/chunk-NGVP66OH.js +1 -0
  227. package/dist/standalone/chunk-NQZALRU3.js +1 -0
  228. package/dist/standalone/chunk-NRP22GKC.js +1 -0
  229. package/dist/standalone/chunk-NXQW5E6W.js +1 -0
  230. package/dist/standalone/chunk-OPM7ESDV.js +1 -0
  231. package/dist/standalone/chunk-OQ6I6OXT.js +2 -0
  232. package/dist/standalone/chunk-OSGXNEFA.js +1 -0
  233. package/dist/standalone/chunk-OWD32MWS.js +1 -0
  234. package/dist/standalone/chunk-OYCUPD3Q.js +1 -0
  235. package/dist/standalone/chunk-P2I22USO.js +1 -0
  236. package/dist/standalone/chunk-P5OQ2T7O.js +1 -0
  237. package/dist/standalone/chunk-PIMTWCRD.js +1 -0
  238. package/dist/standalone/chunk-PPX63XHJ.js +1 -0
  239. package/dist/standalone/chunk-PTPKBYI5.js +1 -0
  240. package/dist/standalone/chunk-Q4UISMBL.js +1 -0
  241. package/dist/standalone/chunk-Q6ED4KUL.js +1 -0
  242. package/dist/standalone/chunk-Q6IT6ZD7.js +1 -0
  243. package/dist/standalone/chunk-QAQDMS6R.js +1 -0
  244. package/dist/standalone/chunk-QJLHH3ET.js +1 -0
  245. package/dist/standalone/chunk-R6U22RSY.js +1 -0
  246. package/dist/standalone/chunk-RGMVGZV4.js +1 -0
  247. package/dist/standalone/chunk-ROX6INV5.js +1 -0
  248. package/dist/standalone/chunk-RUBMOQH2.js +1 -0
  249. package/dist/standalone/chunk-RWVIV3U7.js +1 -0
  250. package/dist/standalone/chunk-RZ6QAA2I.js +1 -0
  251. package/dist/standalone/chunk-S4Z7K55A.js +1 -0
  252. package/dist/standalone/chunk-SA2OGF3F.js +1 -0
  253. package/dist/standalone/chunk-SJQERRSZ.js +1 -0
  254. package/dist/standalone/chunk-SV764LKQ.js +1 -0
  255. package/dist/standalone/chunk-UC7MNI2F.js +1 -0
  256. package/dist/standalone/chunk-UIC7EN6V.js +1 -0
  257. package/dist/standalone/chunk-UVUKVNCP.js +1 -0
  258. package/dist/standalone/chunk-UYEZR3BI.js +1 -0
  259. package/dist/standalone/chunk-VAITO6LM.js +3 -0
  260. package/dist/standalone/chunk-VAVZCMJZ.js +1 -0
  261. package/dist/standalone/chunk-VCFEO3RI.js +1 -0
  262. package/dist/standalone/chunk-VESGIGMQ.js +1 -0
  263. package/dist/standalone/chunk-VHLKUGQL.js +1 -0
  264. package/dist/standalone/chunk-VMLLR636.js +1 -0
  265. package/dist/standalone/chunk-VZWZIIP6.js +1 -0
  266. package/dist/standalone/chunk-WIASRPIC.js +59 -0
  267. package/dist/standalone/chunk-WJRYEML4.js +1 -0
  268. package/dist/standalone/chunk-XGCIDUJF.js +1 -0
  269. package/dist/standalone/chunk-XHRKNCCI.js +1 -0
  270. package/dist/standalone/chunk-XTUTKZ2F.js +1 -0
  271. package/dist/standalone/chunk-Y3AYVFTK.js +1 -0
  272. package/dist/standalone/chunk-YIDRRLUF.js +1 -0
  273. package/dist/standalone/chunk-YLPATGWK.js +15 -0
  274. package/dist/standalone/chunk-YSIOHDX6.js +1 -0
  275. package/dist/standalone/chunk-YVR4SEPU.js +1 -0
  276. package/dist/standalone/chunk-Z22BDS6N.js +1 -0
  277. package/dist/standalone/chunk-ZG4KF3SJ.js +1 -0
  278. package/dist/standalone/chunk-ZKJS6EBE.js +1 -0
  279. package/dist/standalone/studio.js +9 -356
  280. package/dist/styles.css +2 -2
  281. package/package.json +26 -21
  282. package/dist/index.js +0 -41
  283. package/dist/mount.js +0 -26
  284. package/dist/packem_shared/ADMIN_FUNCTIONS-DmBqMZ-z.js +0 -45
  285. package/dist/packem_shared/ApiDocsPanel-C5-yJ1p7.js +0 -842
  286. package/dist/packem_shared/ApiReferencePanel-1vubqG5s.js +0 -229
  287. package/dist/packem_shared/ApiTab-W3no0KOj.js +0 -251
  288. package/dist/packem_shared/AuditPanel-Bq4o_IqT.js +0 -212
  289. package/dist/packem_shared/CommandPalette-BtgkBzZI.js +0 -373
  290. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  291. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  292. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  293. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  294. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  295. package/dist/packem_shared/DataBrowser-CtBe1So9.js +0 -4542
  296. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  297. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  298. package/dist/packem_shared/ExportImportPanel-dxY56TDF.js +0 -193
  299. package/dist/packem_shared/FileBrowser-Dhy4zES8.js +0 -2932
  300. package/dist/packem_shared/FunctionRunner--fQJRPAD.js +0 -343
  301. package/dist/packem_shared/FunctionStatsPanel-BjRUA_G3.js +0 -432
  302. package/dist/packem_shared/GlobalDataBrowser-BTEmGrph.js +0 -318
  303. package/dist/packem_shared/HealthPanel-PxclMWmA.js +0 -640
  304. package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
  305. package/dist/packem_shared/InsightsPanel-CWS_C-xW.js +0 -423
  306. package/dist/packem_shared/LogsPanel-CTW8CFcM.js +0 -839
  307. package/dist/packem_shared/MailPanel-BwkvfIHF.js +0 -447
  308. package/dist/packem_shared/MetricsPanel-BLuOhZQ4.js +0 -1625
  309. package/dist/packem_shared/MigrationsPanel-DT3lnwHF.js +0 -246
  310. package/dist/packem_shared/OpenRpcReferencePanel-vbcYbv3V.js +0 -191
  311. package/dist/packem_shared/PitrPanel-CdErL7EJ.js +0 -252
  312. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  313. package/dist/packem_shared/ScheduledJobs-CabfKbyM.js +0 -159
  314. package/dist/packem_shared/SchemaViewer-LJDcmNIO.js +0 -2512
  315. package/dist/packem_shared/SecurityAdvisorPanel-C_ETsPih.js +0 -79
  316. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  317. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  318. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  319. package/dist/packem_shared/Studio-DFWAlcuf.js +0 -33
  320. package/dist/packem_shared/StudioApp-CHOZA-z-.js +0 -383
  321. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  322. package/dist/packem_shared/TableEditor-ChfUOZec.js +0 -371
  323. package/dist/packem_shared/advisor-view-CGcfMiPq.js +0 -159
  324. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  325. package/dist/packem_shared/app.d-CCmwDEVs.d.ts +0 -300
  326. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  327. package/dist/packem_shared/bar-chart-CzJAgqkp.js +0 -3245
  328. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  329. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  330. package/dist/packem_shared/cf-links-2cktDedA.js +0 -8
  331. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  332. package/dist/packem_shared/data-grid-B5CaV3wS.js +0 -183
  333. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  334. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  335. package/dist/packem_shared/grid-features-CzUfqgsM.js +0 -840
  336. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  337. package/dist/packem_shared/internal-rXJEAhXS.js +0 -68
  338. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  339. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  340. package/dist/packem_shared/reference-view-B4E49Lip.js +0 -2180
  341. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  342. package/dist/packem_shared/sparkline-10dG-_f0.js +0 -93
  343. package/dist/packem_shared/sql-editor-panel-BFRpzj6r.js +0 -2562
  344. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  345. package/dist/packem_shared/studio-Bj8psK1c.js +0 -10303
  346. package/dist/packem_shared/table-_RzNvy3R.js +0 -246
  347. package/dist/packem_shared/table-list-sidebar-Bg7uzbvC.js +0 -832
  348. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  349. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  350. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
  351. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  352. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  353. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
@@ -0,0 +1,15 @@
1
+ import{a as ct,b as dt}from"./chunk-CKEE7CZ6.js";import{c as at}from"./chunk-NDTQTKDX.js";import{a as it}from"./chunk-3T5F2LKG.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import"./chunk-QJLHH3ET.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as lt}from"./chunk-IWZ7GVQO.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-WIASRPIC.js";import"./chunk-AUGKHAMQ.js";import"./chunk-WJRYEML4.js";import"./chunk-XHRKNCCI.js";import{a as rt}from"./chunk-YVR4SEPU.js";import{b as ot}from"./chunk-ZKJS6EBE.js";import{c as nt,d as Ne,e as De,f as Ae,g as Ke}from"./chunk-RGMVGZV4.js";import{i as Qe}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as st}from"./chunk-NCPW7WHO.js";import{a as ke}from"./chunk-4ZEL6BYL.js";import"./chunk-C5NU4UZY.js";import{g as _e}from"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import"./chunk-HCTJKP5J.js";import{d as ae,f as Se,g as Ce,h as tt,p as me}from"./chunk-HJHSQPHW.js";import{a,d as Fe,e as Lt,f as Rt,g as _t,i as ue}from"./chunk-I26MS5PJ.js";var Z=Fe(Rt(),1);var B=Fe(Lt(),1);var u=Fe(_t(),1);var qe=class{static{a(this,"Diff")}diff(e,n,t={}){let r;typeof t=="function"?(r=t,t={}):"callback"in t&&(r=t.callback);let o=this.castInput(e,t),l=this.castInput(n,t),i=this.removeEmpty(this.tokenize(o,t)),c=this.removeEmpty(this.tokenize(l,t));return this.diffWithOptionsObj(i,c,t,r)}diffWithOptionsObj(e,n,t,r){var o;let l=a(p=>{if(p=this.postProcess(p,t),r){setTimeout(function(){r(p)},0);return}else return p},"done"),i=n.length,c=e.length,d=1,m=i+c;t.maxEditLength!=null&&(m=Math.min(m,t.maxEditLength));let x=(o=t.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+x,v=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(v[0],n,e,0,t);if(v[0].oldPos+1>=c&&f+1>=i)return l(this.buildValues(v[0].lastComponent,n,e));let N=-1/0,b=1/0,w=a(()=>{for(let p=Math.max(N,-d);p<=Math.min(b,d);p+=2){let S,y=v[p-1],g=v[p+1];y&&(v[p-1]=void 0);let C=!1;if(g){let q=g.oldPos-p;C=g&&0<=q&&q<i}let k=y&&y.oldPos+1<c;if(!C&&!k){v[p]=void 0;continue}if(!k||C&&y.oldPos<g.oldPos?S=this.addToPath(g,!0,!1,0,t):S=this.addToPath(y,!1,!0,1,t),f=this.extractCommon(S,n,e,p,t),S.oldPos+1>=c&&f+1>=i)return l(this.buildValues(S.lastComponent,n,e))||!0;v[p]=S,S.oldPos+1>=c&&(b=Math.min(b,p-1)),f+1>=i&&(N=Math.max(N,p+1))}d++},"execEditLength");if(r)a(function p(){setTimeout(function(){if(d>m||Date.now()>h)return r(void 0);w()||p()},0)},"exec")();else for(;d<=m&&Date.now()<=h;){let p=w();if(p)return p}}addToPath(e,n,t,r,o){let l=e.lastComponent;return l&&!o.oneChangePerToken&&l.added===n&&l.removed===t?{oldPos:e.oldPos+r,lastComponent:{count:l.count+1,added:n,removed:t,previousComponent:l.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:n,removed:t,previousComponent:l}}}extractCommon(e,n,t,r,o){let l=n.length,i=t.length,c=e.oldPos,d=c-r,m=0;for(;d+1<l&&c+1<i&&this.equals(t[c+1],n[d+1],o);)d++,c++,m++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return m&&!o.oneChangePerToken&&(e.lastComponent={count:m,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=c,d}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){let n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){let r=[],o;for(;e;)r.push(e),o=e.previousComponent,delete e.previousComponent,e=o;r.reverse();let l=r.length,i=0,c=0,d=0;for(;i<l;i++){let m=r[i];if(m.removed)m.value=this.join(t.slice(d,d+m.count)),d+=m.count;else{if(!m.added&&this.useLongestToken){let x=n.slice(c,c+m.count);x=x.map(function(h,v){let f=t[d+v];return f.length>h.length?f:h}),m.value=this.join(x)}else m.value=this.join(n.slice(c,c+m.count));c+=m.count,m.added||(d+=m.count)}}return r}};var Ue=class extends qe{static{a(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=Dt}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
2
+ `))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(`
3
+ `))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(`
4
+ `)&&(e=e.slice(0,-1)),n.endsWith(`
5
+ `)&&(n=n.slice(0,-1))),super.equals(e,n,t)}},ut=new Ue;function Ge(s,e,n){return ut.diff(s,e,n)}a(Ge,"diffLines");function Dt(s,e){e.stripTrailingCr&&(s=s.replace(/\r\n/g,`
6
+ `));let n=[],t=s.split(/(\n|\r\n)/);t[t.length-1]||t.pop();for(let r=0;r<t.length;r++){let o=t[r];r%2&&!e.newlineIsToken?n[n.length-1]+=o:n.push(o)}return n}a(Dt,"tokenize");var At="x",mt=" ",Mt={'"':'"',"'":"'","[":"]","`":"`"},gt=a((s,e)=>{let n=e+2;for(;n<s.length&&s[n]!==`
7
+ `;)n+=1;return n},"rt"),xt=a((s,e)=>{let n=s.indexOf("*/",e+2);return n===-1?-1:n+2},"it"),vt=a(s=>{let e=s.split(""),n=0;for(;n<s.length;){let t=s[n]??"",r=Mt[t];if(t==="-"&&s[n+1]==="-"){let o=gt(s,n);e.fill(mt,n,o),n=o}else if(t==="/"&&s[n+1]==="*"){let o=xt(s,n);if(o===-1)return;e.fill(mt,n,o),n=o}else if(r!==void 0){let o=n+1;for(;o<s.length;)if(s[o]!==r)o+=1;else if(r!=="]"&&s[o+1]===r)o+=2;else break;if(o>=s.length)return;e.fill(At,n,o+1),n=o+1}else n+=1}for(let t=0;t<s.length;t+=1)s[t]===`
8
+ `&&(e[t]=`
9
+ `);return e.join("")},"at"),Ot=/^(?:explain\s+(?:query\s+plan\s+)?)?(?:select|with)\b/iu,Pt=/\b(?:alter|attach|create|delete|detach|drop|insert|pragma|reindex|truncate|update|vacuum)\b|\breplace\b(?!\s*\()/iu,$t=/^\w+/u,jt=/;\s*$/u,zt=/\s/u,yt=a(s=>{let e=0;for(;e<s.length;){let n=s[e];if(n!==void 0&&zt.test(n))e+=1;else if(n==="-"&&s[e+1]==="-")e=gt(s,e);else if(n==="/"&&s[e+1]==="*"){let t=xt(s,e);if(t===-1)break;e=t}else break}return e},"ct"),Ht=a(s=>{let e=yt(s),n=s.slice(e).trimEnd();if(n==="")return{code:"SQL_EMPTY",message:"the query is empty"};let t=(vt(n)??n).replace(jt,""),r=n.slice(0,t.length),o=t.indexOf(";");if(o!==-1)return{code:"SQL_MULTIPLE_STATEMENTS",length:1,message:"only a single statement may be run",offset:e+o};let l="the SQL editor is read-only \u2014 only SELECT / WITH / EXPLAIN queries are allowed";if(!Ot.test(r))return{code:"SQL_NOT_READONLY",length:$t.exec(r)?.[0].length??1,message:l,offset:e};let i=Pt.exec(r);if(i!==null)return{code:"SQL_NOT_READONLY",length:i[0].length,message:`${l} (\`${i[0].toUpperCase()}\` is not allowed)`,offset:e+i.index}},"Ht"),Wt=/^explain\b/iu,Bt=a(s=>Wt.test(s.slice(yt(s)))?s:`EXPLAIN QUERY PLAN ${s}`,"Ft"),Ye=a((s,e)=>{let n=s.trim();if(n==="")return[];let t=e+s.indexOf(n),r=Ht(n);return r?.code==="SQL_EMPTY"?[]:[r===void 0?{offset:t,sql:n}:{offset:t,rejection:r,sql:n}]},"ze"),wt=a(s=>{let e=vt(s);if(e===void 0)return Ye(s,0);let n=[],t=0;for(let r=0;r<=e.length;r+=1)r!==e.length&&e[r]!==";"||(n.push(...Ye(s.slice(t,r),t)),t=r+1);return n},"dt"),Ft=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],Qt=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],$e=String.fromCodePoint(0),Kt=new RegExp(`${$e}${String.raw`(\d+)`}${$e}`,"gu"),Ut=Ft.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Gt=Qt.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
10
+ ${s}`})),Jt=a(s=>{let e=[],n=s.replaceAll(/'(?:[^']|'')*'/gu,t=>(e.push(t),`${$e}${(e.length-1).toString()}${$e}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:t,replacement:r}of Ut)n=n.replaceAll(t,r);for(let{pattern:t,replacement:r}of Gt)n=n.replaceAll(t,r);return n=n.replaceAll(Kt,(t,r)=>e[Number(r)]??""),n},"jt"),Yt=/\b(?:from|join)\s+([a-z_][\w$]*)(?:\s+(?:as\s+)?([a-z_][\w$]*))?/giu,Vt=/(?:\bwith\s+(?:recursive\s+)?|,\s*)([a-z_][\w$]*)\s+as\s*\(/giu,Xt=new Set(["cross","full","group","having","inner","join","left","limit","offset","on","order","right","union","using","where","window"]),Zt=/[^\n]/gu,en=a((s,e)=>{let n=s[e];if(n==="'"){let t=e+1;for(;t<s.length&&s[t]!=="'";)t+=1;return Math.min(t+1,s.length)}if(n==="-"&&s[e+1]==="-"){let t=s.indexOf(`
11
+ `,e);return t===-1?s.length:t}if(n==="/"&&s[e+1]==="*"){let t=s.indexOf("*/",e+2);return t===-1?s.length:t+2}return-1},"Xt"),tn=a(s=>{let e="",n=0;for(;n<s.length;){let t=en(s,n);t===-1?(e+=s.slice(n,n+1),n+=1):(e+=s.slice(n,t).replaceAll(Zt," "),n=t)}return e},"Zt"),nn=a(s=>{let e=new Set;for(let n of s.matchAll(Vt))e.add((n[1]??"").toLowerCase());return e},"en"),on=a((s,e)=>{let n=new Map;for(let t of s.matchAll(Yt)){let r=(t[1]??"").toLowerCase(),o=(t[2]??"").toLowerCase();e.has(r)&&(n.set(r,r),o!==""&&!Xt.has(o)&&n.set(o,r))}return n},"tn"),St=a((s,e)=>{let n=tn(s),t=new Set(e.map(r=>r.toLowerCase()));return{ctes:nn(n),masked:n,targets:on(n,t)}},"ut"),rn=/^(?:__lunora|sqlite_)/iu,sn=/\b(?:from|join)\s+([a-z_][\w$]*)/giu,ln=/\b([a-z_][\w$]*)\.([a-z_][\w$]*)/giu,an=new Set(["cross","full","group","having","inner","join","lateral","left","limit","offset","order","right","select","union","where","window"]),cn=a((s,e,n)=>{let t=[];for(let r of s.matchAll(sn)){let o=r[1]??"",l=o.toLowerCase();!e.has(l)&&!n.has(l)&&!an.has(l)&&!rn.test(o)&&t.push({length:o.length,message:`unknown table \`${o}\``,offset:r.index+r[0].length-o.length,severity:"error",source:"schema"})}return t},"rn"),dn=a((s,e,n)=>{let t=[],r=new Map;for(let[o,l]of Object.entries(e.columns))r.set(o.toLowerCase(),new Set(l.map(i=>i.toLowerCase())));for(let o of s.matchAll(ln)){let l=(o[1]??"").toLowerCase(),i=o[2]??"",c=n.get(l),d=c===void 0?void 0:r.get(c);d!==void 0&&!d.has(i.toLowerCase())&&t.push({length:i.length,message:`\`${c??""}\` has no column \`${i}\``,offset:o.index+o[0].length-i.length,severity:"error",source:"schema"})}return t},"an"),un=/(?<![\w$."])(?:"([a-z_][\w$]*)"|([a-z_][\w$]*))(?![.(])/giu,mn=/\bas\s+"?([a-z_][\w$]*)"?/giu,fn=a((s,e,n,t)=>{let r=[...new Set(n.values())],o=new Map,l=new Set;for(let d of r){for(let m of e.columns[d]??[])l.add(m.toLowerCase());for(let m of e.docFields?.[d]??[])o.set(m.toLowerCase(),m)}if(o.size===0)return[];let i=new Set([...s.matchAll(mn)].map(d=>(d[1]??"").toLowerCase())),c=[];for(let d of s.matchAll(un)){let m=d[1],x=m??d[2]??"",h=x.toLowerCase(),v=o.get(h);v===void 0||l.has(h)||i.has(h)||t.has(h)||n.has(h)||c.push({length:x.length,message:`\`${v}\` is a \`__doc__\` field, not a column \u2014 use \`json_extract(__doc__, '$.${v}')\``,offset:d.index+(m===void 0?0:1),severity:"error",source:"schema"})}return c},"un"),hn=a((s,e)=>{if(s.trim()==="")return[];let n=wt(s),t=new Set(e.tables.map(o=>o.toLowerCase())),r=[];for(let o of n){let{offset:l,rejection:i}=o;if(i!==void 0){r.push({length:i.length,message:i.message,offset:i.offset===void 0?l:l+i.offset,severity:"error",source:"gate"});continue}let{ctes:c,masked:d,targets:m}=St(o.sql,e.tables);r.push(...[...cn(d,t,c),...dn(d,e,m),...fn(d,e,m,c)].map(x=>({...x,offset:x.offset===void 0?l:l+x.offset})))}return r},"fn"),pn=Se(ke.lintSql),bn=600,gn=a((s,e,n)=>{let t=_e(),[r,o]=(0,B.useState)([]),l=(0,B.useMemo)(()=>hn(s,e),[s,e]),i=lt(s,bn),c=l.some(x=>x.source==="gate")||i.trim()==="",d=(0,B.useCallback)(async x=>{try{let h=await t.query(pn,{sql:i},Ce(n));x.cancelled||o(h.diagnostics??[])}catch{x.cancelled||o([])}},[t,i,n]);(0,B.useEffect)(()=>{if(c){o([]);return}let x={cancelled:!1};return me(d(x)),()=>{x.cancelled=!0}},[d,c]);let m=i===s;return(0,B.useMemo)(()=>m?[...l,...r]:l,[l,r,m])},"hn"),Me=8,xn=["AND","ASC","AS","BY","COUNT","DESC","DISTINCT","EXPLAIN","FROM","GROUP","HAVING","INNER","JOIN","LEFT","LIKE","LIMIT","NOT","NULL","OFFSET","ON","ORDER","OR","QUERY","SELECT","WHERE","WITH"],vn=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),yn=/[\w$]/,Ct=a(s=>s!==void 0&&yn.test(s),"ft"),kt=a(s=>{let e=s.length;for(;e>0&&Ct(s[e-1]);)e-=1;return s.slice(e)},"mt"),Nt=a((s,e)=>{let n=e;for(;n>0&&Ct(s[n-1]);)n-=1;return{end:e,start:n,text:s.slice(n,e)}},"pt"),ft=a((s,e)=>{let n=s.slice(0,e).trimEnd();return n.endsWith(".")||vn.has(kt(n).toUpperCase())},"et"),wn=a((s,e,n)=>{let t=s.slice(0,e);if(!t.endsWith("."))return;let r=kt(t.slice(0,-1));if(r!=="")return St(s,n).targets.get(r.toLowerCase())??r},"yn"),Ve=a((s,e)=>s.toLowerCase().startsWith(e.toLowerCase()),"Ye"),ht=a((s,e,n,t)=>{let r=[];for(let o of s)if(Ve(o,e)&&(r.push(t(o)),r.length>=n))break;return r},"tt"),Sn=a((s,e,n)=>{let t=new Map;for(let[r,o]of Object.entries(s.columns))for(let l of o)if(Ve(l,e)&&!t.has(l)&&(t.set(l,r),t.size>=n))return[...t].map(([i,c])=>({detail:c,kind:"column",label:i}));return[...t].map(([r,o])=>({detail:o,kind:"column",label:r}))},"vn"),Cn=a((s,e,n)=>{let t=Nt(s,e),r=wn(s,t.start,n.tables);if(r!==void 0){let c=n.columns[r]??n.columns[r.toLowerCase()]??[];return ht(c,t.text,Me,d=>({detail:r,kind:"column",label:d}))}if(t.text===""&&!ft(s,t.start))return[];let o=ht(n.tables,t.text,Me,c=>({kind:"table",label:c})),l=Sn(n,t.text,Me),i=xn.flatMap(c=>t.text!==""&&Ve(c,t.text)&&c.toLowerCase()!==t.text.toLowerCase()?[{kind:"keyword",label:c}]:[]);return(ft(s,t.start)?[...l,...o,...i]:[...o,...l,...i]).slice(0,Me)},"Sn"),kn=a((s,e,n)=>{let t=Nt(s,e),r=s.slice(0,t.start)+n.label+s.slice(t.end);return{caret:t.start+n.label.length,value:r}},"wn"),Nn=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],qn=a((s,e)=>{let n=globalThis.getComputedStyle(s),t=globalThis.document.createElement("div"),{style:r}=t;r.position="absolute",r.visibility="hidden",r.whiteSpace="pre-wrap",r.overflowWrap="break-word";for(let c of Nn)r[c]=n[c];t.textContent=s.value.slice(0,Math.max(0,e));let o=globalThis.document.createElement("span");o.textContent=s.value.slice(Math.max(0,e))||".",t.append(o),globalThis.document.body.append(t);let l=o.offsetLeft-s.scrollLeft,i=o.offsetTop-s.scrollTop;return t.remove(),{left:l,top:i}},"En"),En=a((s,e,n)=>{let t=(0,Z.c)(16),[r,o]=(0,B.useState)(null),l;t[0]!==s||t[1]!==e?(l=a((w,p)=>{let S=Cn(w,p,s);if(S.length===0){o(null);return}let y=e.current,{left:g,top:C}=y===null?{left:0,top:0}:qn(y,p);o(k=>k!==null&&k.active===0&&k.left===g&&k.top===C&&k.suggestions.length===S.length&&k.suggestions.every((q,E)=>{let T=S.at(E);return q.kind===T?.kind&&q.label===T.label&&q.detail===T.detail})?k:{active:0,left:g,suggestions:S,top:C})},"r"),t[0]=s,t[1]=e,t[2]=l):l=t[2];let i=l,c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=a(()=>{o(null)},"c"),t[3]=c):c=t[3];let d=c,m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=a(w=>{o(p=>{if(p===null)return p;let S=p.suggestions.length,y=(p.active+w+S)%S;return{...p,active:y}})},"f"),t[4]=m):m=t[4];let x=m,h;t[5]!==n||t[6]!==r||t[7]!==e?(h=a(w=>{let p=e.current;if(r===null||p===null)return!1;let S=r.suggestions[w??r.active];if(S===void 0)return!1;let y=kn(p.value,p.selectionStart,S);return n(y.value),o(null),requestAnimationFrame(()=>{let g=e.current;g!==null&&(g.focus(),g.setSelectionRange(y.caret,y.caret))}),!0},"u"),t[5]=n,t[6]=r,t[7]=e,t[8]=h):h=t[8];let v=h,f;t[9]!==v?(f=a(()=>v(),"d"),t[9]=v,t[10]=f):f=t[10];let N=f,b;return t[11]!==N||t[12]!==v||t[13]!==i||t[14]!==r?(b={close:d,commit:N,commitAt:v,move:x,refresh:i,state:r},t[11]=N,t[12]=v,t[13]=i,t[14]=r,t[15]=b):b=t[15],b},"Nn"),Tn={column:"column",keyword:"keyword",table:"table"},In=20,Ln=a(s=>{let e=(0,Z.c)(17),{listboxId:n,onPick:t,state:r}=s,o=ae(),l;e[0]!==r?(l=r===null?void 0:{left:r.left,top:r.top+In},e[0]=r,e[1]=l):l=e[1];let i=l;if(r===null)return null;let c;if(e[2]!==n||e[3]!==t||e[4]!==r.active||e[5]!==r.suggestions||e[6]!==o){let m;e[8]!==n||e[9]!==t||e[10]!==r.active||e[11]!==o?(m=a((x,h)=>(0,u.jsxs)("li",{"aria-selected":h===r.active,className:ue("flex cursor-pointer items-center gap-2 px-2 py-1 text-[13px]",h===r.active?"bg-accent text-accent-foreground":"text-foreground"),"data-testid":"sql-autocomplete-item",id:`${n}-opt-${h.toString()}`,onMouseDown:a(v=>{v.preventDefault(),t(h)},"onMouseDown"),role:"option",children:[(0,u.jsx)("span",{className:"truncate font-mono",children:x.label}),x.detail!==void 0&&(0,u.jsx)("span",{className:"ms-auto truncate text-xs text-muted-foreground",children:x.detail}),(0,u.jsx)("span",{className:"shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground/70 uppercase",children:o(Tn[x.kind])})]},`${x.kind}:${x.label}`),"f"),e[8]=n,e[9]=t,e[10]=r.active,e[11]=o,e[12]=m):m=e[12],c=r.suggestions.map(m),e[2]=n,e[3]=t,e[4]=r.active,e[5]=r.suggestions,e[6]=o,e[7]=c}else c=e[7];let d;return e[13]!==n||e[14]!==i||e[15]!==c?(d=(0,u.jsx)("ul",{className:"absolute z-30 max-h-56 w-72 overflow-auto rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-autocomplete",id:n,role:"listbox",style:i,children:c}),e[13]=n,e[14]=i,e[15]=c,e[16]=d):d=e[16],d},"Rn"),Rn=Se(ke.listTables),_n=Se(ke.readTablePage),Dn=a(s=>{let e=(0,Z.c)(18),n=_e(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];let[r,o]=(0,B.useState)(t),l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l={},e[1]=l):l=e[1];let[i,c]=(0,B.useState)(l),d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d={},e[2]=d):d=e[2];let[m,x]=(0,B.useState)(d),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=new Set,e[3]=h):h=e[3];let v=(0,B.useRef)(h),f,N;e[4]!==n||e[5]!==s?(f=a(()=>{let g={cancelled:!1};return me((async()=>{try{let C=await n.query(Rn,{},Ce(s));g.cancelled||(o(C.map(Mn)),c({}),x({}),v.current=new Set)}catch{g.cancelled||(o([]),c({}),x({}),v.current=new Set)}})()),()=>{g.cancelled=!0}},"d"),N=[n,s],e[4]=n,e[5]=s,e[6]=f,e[7]=N):(f=e[6],N=e[7]),(0,B.useEffect)(f,N);let b;e[8]!==n||e[9]!==s?(b=a(g=>{v.current.has(g)||(v.current.add(g),me((async()=>{try{let C=await n.query(_n,{limit:1,offset:0,table:g},Ce(s)),{sqlColumns:k}=C;if(k===void 0){v.current.delete(g);return}let q=new Set(k),E=C.columns.filter(T=>!q.has(T));c(T=>({...T,[g]:k})),x(T=>({...T,[g]:E}))}catch{v.current.delete(g)}})()))},"m"),e[8]=n,e[9]=s,e[10]=b):b=e[10];let w=b,p;e[11]!==i||e[12]!==m||e[13]!==r?(p={columns:i,docFields:m,tables:r},e[11]=i,e[12]=m,e[13]=r,e[14]=p):p=e[14];let S=p,y;return e[15]!==w||e[16]!==S?(y={probe:w,schema:S},e[15]=w,e[16]=S,e[17]=y):y=e[17],y},"_n"),Je=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,An=a(s=>{let e=new Set;Je.lastIndex=0;let n=Je.exec(s);for(;n!==null;)e.add(n[1]??n[2]),n=Je.exec(s);return[...e]},"An");function Mn(s){return s.name}a(Mn,"qn");var On=a(s=>(s.metaKey||s.ctrlKey)&&!s.shiftKey&&!s.altKey&&s.key.toLowerCase()==="i","Dn"),Pn=a(s=>{let e=(0,Z.c)(44),{inlineEditEnabled:n,onSubmit:t,probe:r,schema:o,setDraft:l}=s,i=(0,B.useId)(),[c,d]=(0,B.useState)(null),m=(0,B.useRef)(null),x=(0,B.useRef)(null),h=(0,B.useRef)(null),v=En(o,h,l),{close:f,commit:N,commitAt:b,move:w,refresh:p,state:S}=v,y;e[0]!==b?(y=a(A=>{b(A)},"v"),e[0]=b,e[1]=y):y=e[1];let g=y,C;e[2]!==p?(C=a(()=>{let A=h.current;A!==null&&A===document.activeElement&&p(A.value,A.selectionStart)},"E"),e[2]=p,e[3]=C):C=e[3];let k;e[4]!==p||e[5]!==o?(k=[p,o],e[4]=p,e[5]=o,e[6]=k):k=e[6],(0,B.useEffect)(C,k);let q;e[7]!==r||e[8]!==p||e[9]!==l?(q=a(A=>{let{selectionStart:U,value:G}=A.target;l(G),d(null);for(let Y of An(G))r(Y);p(G,U)},"T"),e[7]=r,e[8]=p,e[9]=l,e[10]=q):q=e[10];let E=q,T;e[11]!==p?(T=a(A=>{let U=A.currentTarget;p(U.value,U.selectionStart)},"R"),e[11]=p,e[12]=T):T=e[12];let I=T,D;e[13]!==f||e[14]!==N||e[15]!==w?(D=a(A=>A.key==="ArrowDown"?(A.preventDefault(),w(1),!0):A.key==="ArrowUp"?(A.preventDefault(),w(-1),!0):A.key==="Escape"?(A.preventDefault(),f(),!0):(A.key==="Enter"||A.key==="Tab")&&!A.metaKey&&!A.ctrlKey&&N()?(A.preventDefault(),!0):!1,"_"),e[13]=f,e[14]=N,e[15]=w,e[16]=D):D=e[16];let R=D,_;e[17]!==S||e[18]!==f||e[19]!==n||e[20]!==R||e[21]!==t?(_=a(A=>{if(!(S!==null&&R(A))){if((A.metaKey||A.ctrlKey)&&A.key==="Enter"){A.preventDefault(),t();return}if(n&&On(A)){A.preventDefault(),f();let{selectionEnd:U,selectionStart:G,value:Y}=A.currentTarget,[O,oe]=G===U?[0,Y.length]:[G,U];d({end:oe,start:O,text:Y.slice(O,oe)})}}},"L"),e[17]=S,e[18]=f,e[19]=n,e[20]=R,e[21]=t,e[22]=_):_=e[22];let Q=_,j;e[23]!==f?(j=a(()=>{requestAnimationFrame(()=>{f()})},"B"),e[23]=f,e[24]=j):j=e[24];let K=j,P;e[25]===Symbol.for("react.memo_cache_sentinel")?(P=a(A=>{let{scrollLeft:U,scrollTop:G}=A.currentTarget;m.current!==null&&(m.current.scrollTop=G),x.current!==null&&(x.current.scrollTop=G,x.current.scrollLeft=U)},"M"),e[25]=P):P=e[25];let W=P,F;e[26]===Symbol.for("react.memo_cache_sentinel")?(F=a(A=>{let U=h.current;U===null||A.offset===void 0||(U.focus(),U.setSelectionRange(A.offset,A.offset+(A.length??0)))},"Q"),e[26]=F):F=e[26];let L=F,M;e[27]===Symbol.for("react.memo_cache_sentinel")?(M=a(()=>{d(null),h.current?.focus()},"D"),e[27]=M):M=e[27];let z=M,$;e[28]!==c||e[29]!==l?($=a(A=>{let U=h.current;if(c===null||U===null)return;let{end:G,start:Y,text:O}=c;if(U.value.slice(Y,G)!==O){z();return}l(U.value.slice(0,Y)+A+U.value.slice(G)),d(null),U.focus(),requestAnimationFrame(()=>{U.setSelectionRange(Y,Y+A.length)})},"$"),e[28]=c,e[29]=l,e[30]=$):$=e[30];let te=$,V;e[31]!==E||e[32]!==K||e[33]!==Q||e[34]!==I?(V={onBlur:K,onChange:E,onKeyDown:Q,onScroll:W,onSelect:I},e[31]=E,e[32]=K,e[33]=Q,e[34]=I,e[35]=V):V=e[35];let ee;return e[36]!==te||e[37]!==S||e[38]!==f||e[39]!==c||e[40]!==i||e[41]!==g||e[42]!==V?(ee={acceptInlineEdit:te,autocompleteState:S,closeAutocomplete:f,closeInlineEdit:z,inlineEdit:c,handlers:V,listboxId:i,onPickSuggestion:g,editorRef:h,gutterRef:m,overlayRef:x,revealDiagnostic:L},e[36]=te,e[37]=S,e[38]=f,e[39]=c,e[40]=i,e[41]=g,e[42]=V,e[43]=ee):ee=e[43],ee},"On"),$n="lunora-studio-sql-tabs",jn="lunora-studio-sql-active-tab",Xe=12,Ee=a((s="",e="")=>({activeId:null,id:Ke("tab"),name:e,sql:s}),"Ee"),zn=a(()=>Ae(jn,""),"Bn"),Hn=a(s=>{let e=(0,Z.c)(16),[n,t]=De($n),[r,o]=zn(),[l]=(0,B.useState)(s),i,c;e[0]!==l||e[1]!==t||e[2]!==n.length?(i=a(()=>{n.length===0&&t([l])},"i"),c=[l,t,n.length],e[0]=l,e[1]=t,e[2]=n.length,e[3]=i,e[4]=c):(i=e[3],c=e[4]),(0,B.useEffect)(i,c);let d;e[5]!==l||e[6]!==n?(d=n.length===0?[l]:n,e[5]=l,e[6]=n,e[7]=d):d=e[7];let m=d,x;e[8]!==r||e[9]!==m?(x=m.some(f=>f.id===r)?r:m[0]?.id??"",e[8]=r,e[9]=m,e[10]=x):x=e[10];let h=x,v;return e[11]!==h||e[12]!==o||e[13]!==t||e[14]!==m?(v={activeId:h,setActiveId:o,setTabs:t,tabs:m},e[11]=h,e[12]=o,e[13]=t,e[14]=m,e[15]=v):v=e[15],v},"Hn"),qt=a(s=>s.activeId===null&&s.sql.trim()!=="","ht"),Wn=a((s,e)=>[...s,e].slice(-Xe),"Pn"),Bn=a((s,e,n)=>{let t=s.findIndex(o=>o.id===e);if(t===-1)return{activeId:s[0]?.id??"",tabs:[...s]};let r=s.filter(o=>o.id!==e);if(r.length===0){let o=n();return{activeId:o.id,tabs:[o]}}return{activeId:r[Math.min(t,r.length-1)].id,tabs:r}},"Fn"),Fn=a((s,e)=>{let n=s.filter(t=>t.id===e);return n.length===0?{activeId:s[0]?.id??"",tabs:[...s]}:{activeId:e,tabs:n}},"Wn"),Qn=a((s,e,n)=>{let t=s.findIndex(o=>o.id===e);if(t===-1)return{activeId:n,tabs:[...s]};let r=s.slice(0,t+1);return{activeId:r.some(o=>o.id===n)?n:e,tabs:r}},"Kn"),Kn=a(s=>{let e=s();return{activeId:e.id,tabs:[e]}},"Qn"),Un=a((s,e,n)=>{if(s==="others")return e.filter(t=>t.id!==n);if(s==="right"){let t=e.findIndex(r=>r.id===n);return t===-1?[]:e.slice(t+1)}return[...e]},"zn"),pt={error:null,pane:"results",result:null,running:!1},Gn=a(s=>{let e=(0,Z.c)(66),{activeId:n,setActiveId:t,setTabs:r,tabs:o}=Hn(s),l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];let[i,c]=(0,B.useState)(l),[d,m]=(0,B.useState)(null),[x,h]=(0,B.useState)(null),v;e[1]!==n||e[2]!==o?(v=o.find(H=>H.id===n)??o[0]??Ee(),e[1]=n,e[2]=o,e[3]=v):v=e[3];let f=v,N=i[f.id]??pt,b;e[4]!==f.id||e[5]!==r?(b=a(H=>{r(J=>J.map(X=>X.id===f.id?{...X,...H}:X))},"m"),e[4]=f.id,e[5]=r,e[6]=b):b=e[6];let w=b,p;e[7]!==f.id?(p=a(H=>{c(J=>{let X=J[f.id]??pt;return{...J,[f.id]:{...X,...H}}})},"b"),e[7]=f.id,e[8]=p):p=e[8];let S=p,y;e[9]!==t||e[10]!==r||e[11]!==o.length?(y=a(()=>{if(o.length>=Xe)return;let H=Ee();r(J=>Wn(J,H)),t(H.id)},"v"),e[9]=t,e[10]=r,e[11]=o.length,e[12]=y):y=e[12];let g=y,C;e[13]!==t||e[14]!==r?(C=a(H=>{m(null),h(null),r(H.tabs),t(H.activeId);let J=new Set(H.tabs.map(Jn));c(X=>Object.fromEntries(Object.entries(X).filter(re=>{let[fe]=re;return J.has(fe)})))},"E"),e[13]=t,e[14]=r,e[15]=C):C=e[15];let k=C,q;e[16]!==k||e[17]!==o?(q=a(H=>{k(Bn(o,H,Ee))},"T"),e[16]=k,e[17]=o,e[18]=q):q=e[18];let E=q,T;e[19]!==n||e[20]!==k||e[21]!==o?(T=a((H,J)=>{k(H==="others"?Fn(o,J):H==="right"?Qn(o,J,n):Kn(Ee))},"R"),e[19]=n,e[20]=k,e[21]=o,e[22]=T):T=e[22];let I=T,D;e[23]!==I||e[24]!==d||e[25]!==o?(D=a(H=>{d!==null&&(Un(H,o,d.id).some(Yn)?h(H):I(H,d.id))},"_"),e[23]=I,e[24]=d,e[25]=o,e[26]=D):D=e[26];let R=D,_;e[27]===Symbol.for("react.memo_cache_sentinel")?(_=a((H,J)=>{J.preventDefault(),h(null),m({id:H,x:J.clientX,y:J.clientY})},"L"),e[27]=_):_=e[27];let Q=_,j;e[28]===Symbol.for("react.memo_cache_sentinel")?(j=a(()=>{m(null),h(null)},"B"),e[28]=j):j=e[28];let K=j,P;e[29]===Symbol.for("react.memo_cache_sentinel")?(P=a(H=>{H.preventDefault(),m(null),h(null)},"M"),e[29]=P):P=e[29];let W=P,F;e[30]!==R?(F=a(()=>{R("others")},"Q"),e[30]=R,e[31]=F):F=e[31];let L=F,M;e[32]!==R?(M=a(()=>{R("right")},"D"),e[32]=R,e[33]=M):M=e[33];let z=M,$;e[34]!==R?($=a(()=>{R("all")},"$"),e[34]=R,e[35]=$):$=e[35];let te=$,V;e[36]!==I||e[37]!==x||e[38]!==d?(V=a(()=>{d!==null&&x!==null&&I(x,d.id),h(null)},"J"),e[36]=I,e[37]=x,e[38]=d,e[39]=V):V=e[39];let ee=V,A;e[40]===Symbol.for("react.memo_cache_sentinel")?(A=a(()=>{h(null)},"q"),e[40]=A):A=e[40];let U=A,G;e[41]!==d?(G=d===null?void 0:{left:d.x,top:d.y},e[41]=d,e[42]=G):G=e[42];let Y=G,O;e[43]!==r?(O=a(H=>{r(J=>J.map(X=>X.activeId===H?{...X,activeId:null}:X))},"O"),e[43]=r,e[44]=O):O=e[44];let oe=O,se;e[45]!==r?(se=a((H,J)=>{r(X=>X.map(re=>re.id===H?{...re,name:J}:re))},"re"),e[45]=r,e[46]=se):se=e[46];let le=se,ie;return e[47]!==f||e[48]!==n||e[49]!==g||e[50]!==E||e[51]!==ee||e[52]!==te||e[53]!==L||e[54]!==z||e[55]!==N||e[56]!==S||e[57]!==w||e[58]!==x||e[59]!==le||e[60]!==t||e[61]!==d||e[62]!==Y||e[63]!==o||e[64]!==oe?(ie={activeTab:f,activeTabId:n,addEditorTab:g,cancelBulk:U,closeEditorTab:E,closeTabMenu:K,confirmBulk:ee,menuStyle:Y,onBackdropContextMenu:W,onCloseAll:te,onCloseOthers:L,onCloseToRight:z,openTabMenu:Q,output:N,patchActiveOutput:S,patchActiveTab:w,pendingBulk:x,renameTab:le,setActiveTabId:t,tabMenu:d,tabs:o,unlinkQuery:oe},e[47]=f,e[48]=n,e[49]=g,e[50]=E,e[51]=ee,e[52]=te,e[53]=L,e[54]=z,e[55]=N,e[56]=S,e[57]=w,e[58]=x,e[59]=le,e[60]=t,e[61]=d,e[62]=Y,e[63]=o,e[64]=oe,e[65]=ie):ie=e[65],ie},"Un");function Jn(s){return s.id}a(Jn,"jn");function Yn(s){return qt(s)}a(Yn,"Yn");var Vn="lunora-studio-sql-queries",we="lunora-studio-sql-history",Xn="lunora-studio-sql-remember-history",Zn=25,eo=a(s=>{let e=(0,Z.c)(41),{loadIntoActiveTab:n,unlinkQuery:t}=s,r=ae(),[o,l]=De(Vn),[i,c]=Ae(Xn,!1),[d,m]=De(we,i?"local":"session"),x,h;e[0]!==i?(x=a(()=>{i||Ne(we,"local")},"g"),h=[i],e[0]=i,e[1]=x,e[2]=h):(x=e[1],h=e[2]),(0,B.useEffect)(x,h);let[v,f]=(0,B.useState)(""),N=(0,B.useRef)(null),b;e[3]!==m?(b=a(L=>{m(M=>M[0]?.sql===L?M:[{at:Date.now(),sql:L},...M.filter(z=>z.sql!==L)].slice(0,Zn))},"m"),e[3]=m,e[4]=b):b=e[4];let w=b,p;e[5]!==n||e[6]!==l||e[7]!==r?(p=a(()=>{let L={id:Ke("q"),name:r("Untitled query"),sql:""};l(M=>[L,...M]),n("",L.id)},"b"),e[5]=n,e[6]=l,e[7]=r,e[8]=p):p=e[8];let S=p,y;e[9]!==n||e[10]!==o?(y=a(L=>{let M=o.find(z=>z.id===L);M!==void 0&&(n(M.sql,L),N.current?.querySelector(`[data-testid="sql-query-${L}"]`)?.scrollIntoView({block:"nearest"}))},"v"),e[9]=n,e[10]=o,e[11]=y):y=e[11];let g=y,C;e[12]!==l||e[13]!==t?(C=a(L=>{l(M=>M.filter(z=>z.id!==L)),t(L)},"E"),e[12]=l,e[13]=t,e[14]=C):C=e[14];let k=C,q;e[15]!==n?(q=a(L=>{n(L.currentTarget.dataset.sql??"",null)},"T"),e[15]=n,e[16]=q):q=e[16];let E=q,T;e[17]!==n?(T=a(L=>{n(L.currentTarget.dataset.sql??"",null)},"R"),e[17]=n,e[18]=T):T=e[18];let I=T,D;e[19]!==m?(D=a(()=>{m([]),Ne(we,"local"),Ne(we,"session")},"_"),e[19]=m,e[20]=D):D=e[20];let R=D,_;e[21]!==d||e[22]!==c?(_=a(L=>{nt(we,d,L?"local":"session"),L||Ne(we,"local"),c(L)},"L"),e[21]=d,e[22]=c,e[23]=_):_=e[23];let Q=_,j;e[24]===Symbol.for("react.memo_cache_sentinel")?(j=a(L=>{f(L.target.value)},"B"),e[24]=j):j=e[24];let K=j,P;e[25]!==l?(P=a((L,M)=>{l(z=>z.map($=>$.id===L?{...$,sql:M}:$))},"M"),e[25]=l,e[26]=P):P=e[26];let W=P,F;return e[27]!==R||e[28]!==k||e[29]!==d||e[30]!==I||e[31]!==E||e[32]!==S||e[33]!==o||e[34]!==w||e[35]!==i||e[36]!==v||e[37]!==g||e[38]!==Q||e[39]!==W?(F={clearHistory:R,deleteQuery:k,history:d,listRef:N,loadFromHistory:I,loadTemplate:E,newQuery:S,onSearchChange:K,queries:o,recordHistory:w,rememberHistory:i,search:v,selectQuery:g,setRememberHistory:Q,updateQuerySql:W},e[27]=R,e[28]=k,e[29]=d,e[30]=I,e[31]=E,e[32]=S,e[33]=o,e[34]=w,e[35]=i,e[36]=v,e[37]=g,e[38]=Q,e[39]=W,e[40]=F):F=e[40],F},"Xn"),Ze="p-3 font-mono text-xs leading-5 whitespace-pre-wrap break-words",to=a((s,e)=>{let n=[];for(let r of s){if(r.offset===void 0||r.length===void 0||r.length<=0)continue;let o=Math.max(0,Math.min(r.offset,e)),l=Math.max(o,Math.min(r.offset+r.length,e));o!==l&&n.push({end:l,severity:r.severity,start:o})}n.sort((r,o)=>r.start-o.start);let t=[];for(let r of n)r.start>=(t.at(-1)?.end??0)&&t.push(r);return t},"Zn"),Et=a((s,e)=>e(s==="unsafe-response"?"The model returned a statement that is not read-only, so it was discarded.":s==="too-long"?"The statement is too long to rewrite. Select a shorter part of it.":s==="empty-response"?"The model returned nothing usable.":"The model could not be reached."),"bt"),no=a(s=>{let e=(0,Z.c)(51),{assistant:n,failed:t,onGenerated:r}=s,o=ae(),[l,i]=(0,B.useState)("");if(n.unavailable)return null;let c;e[0]!==n?(c=n.pending("sql"),e[0]=n,e[1]=c):c=e[1];let d=c,m;if(e[2]!==n||e[3]!==t||e[4]!==r||e[5]!==d||e[6]!==l||e[7]!==o){let x=n.reason("sql"),h;e[9]!==n||e[10]!==t||e[11]!==r||e[12]!==l?(h=a(I=>{let D=l.trim();D===""&&!I||me((async()=>{let R=await n.generate(D===""?"fix the failing statement":D,I?t:void 0);R!==void 0&&r(R)})())},"u"),e[9]=n,e[10]=t,e[11]=r,e[12]=l,e[13]=h):h=e[13];let v=h,f;e[14]!==o?(f=o("Describe the query you want"),e[14]=o,e[15]=f):f=e[15];let N;e[16]===Symbol.for("react.memo_cache_sentinel")?(N=a(I=>{i(I.target.value)},"N"),e[16]=N):N=e[16];let b;e[17]!==v?(b=a(I=>{I.key==="Enter"&&(I.preventDefault(),v(!1))},"m"),e[17]=v,e[18]=b):b=e[18];let w;e[19]!==o?(w=o("Describe the query you want"),e[19]=o,e[20]=w):w=e[20];let p;e[21]!==d||e[22]!==l||e[23]!==f||e[24]!==b||e[25]!==w?(p=(0,u.jsx)(Qe,{"aria-label":f,className:"h-7 flex-1 text-xs","data-testid":"sql-assistant-prompt",disabled:d,onChange:N,onKeyDown:b,placeholder:w,value:l}),e[21]=d,e[22]=l,e[23]=f,e[24]=b,e[25]=w,e[26]=p):p=e[26];let S=d&&"opacity-60",y;e[27]!==S?(y=ue("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",S),e[27]=S,e[28]=y):y=e[28];let g;e[29]!==d||e[30]!==l?(g=d||l.trim()==="",e[29]=d,e[30]=l,e[31]=g):g=e[31];let C;e[32]!==v?(C=a(()=>{v(!1)},"E"),e[32]=v,e[33]=C):C=e[33];let k;e[34]!==d||e[35]!==o?(k=o(d?"Thinking\u2026":"Draft SQL"),e[34]=d,e[35]=o,e[36]=k):k=e[36];let q;e[37]!==y||e[38]!==g||e[39]!==C||e[40]!==k?(q=(0,u.jsx)("button",{className:y,"data-testid":"sql-assistant-generate",disabled:g,onClick:C,type:"button",children:k}),e[37]=y,e[38]=g,e[39]=C,e[40]=k,e[41]=q):q=e[41];let E;e[42]!==t||e[43]!==d||e[44]!==v||e[45]!==o?(E=t!==void 0&&(0,u.jsx)("button",{className:"rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-assistant-fix",disabled:d,onClick:a(()=>{v(!0)},"onClick"),type:"button",children:o("Fix this")}),e[42]=t,e[43]=d,e[44]=v,e[45]=o,e[46]=E):E=e[46];let T;e[47]!==q||e[48]!==E||e[49]!==p?(T=(0,u.jsxs)("div",{className:"flex items-center gap-2",children:[p,q,E]}),e[47]=q,e[48]=E,e[49]=p,e[50]=T):T=e[50],m=(0,u.jsxs)("div",{className:"flex flex-col gap-1 border-b border-border px-3 py-2","data-testid":"sql-assistant",children:[T,x!==void 0&&(0,u.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-assistant-reason",role:"status",children:Et(x,o)})]}),e[2]=n,e[3]=t,e[4]=r,e[5]=d,e[6]=l,e[7]=o,e[8]=m}else m=e[8];return m},"es"),oo=a(s=>{let e=(0,Z.c)(8),{diagnostics:n,draft:t,scrollRef:r}=s,o,l;if(e[0]!==n||e[1]!==t){l=Symbol.for("react.early_return_sentinel");e:{let d=to(n,t.length);if(d.length===0){l=null;break e}o=[];let m=0;for(let[x,h]of d.entries())h.start>m&&o.push(t.slice(m,h.start)),o.push((0,u.jsx)("span",{className:ue("decoration-wavy underline underline-offset-4",h.severity==="error"?"decoration-destructive":"decoration-amber-500"),children:t.slice(h.start,h.end)},`${h.start.toString()}-${x.toString()}`)),m=h.end;o.push(t.slice(m))}e[0]=n,e[1]=t,e[2]=o,e[3]=l}else o=e[2],l=e[3];if(l!==Symbol.for("react.early_return_sentinel"))return l;let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=ue("pointer-events-none absolute inset-0 overflow-hidden text-transparent",Ze),e[4]=i):i=e[4];let c;return e[5]!==o||e[6]!==r?(c=(0,u.jsx)("div",{"aria-hidden":"true",className:i,"data-testid":"sql-diagnostics-overlay",ref:r,children:o}),e[5]=o,e[6]=r,e[7]=c):c=e[7],c},"ts"),ro={gate:"read-only",plan:"plan",schema:"schema",syntax:"syntax"},so=a(s=>{let e=(0,Z.c)(10),{diagnostics:n,onSelect:t}=s,r=ae();if(n.length===0)return null;let o;e[0]!==r?(o=r("SQL problems"),e[0]=r,e[1]=o):o=e[1];let l;if(e[2]!==n||e[3]!==t){let c;e[5]!==t?(c=a((d,m)=>(0,u.jsx)("li",{children:(0,u.jsxs)("button",{className:"flex w-full items-start gap-2 px-3 py-1 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-problem",onClick:a(()=>{t(d)},"onClick"),type:"button",children:[(0,u.jsx)("span",{className:ue("mt-px shrink-0 rounded px-1 font-mono text-[10px] uppercase",d.severity==="error"?"bg-destructive/15 text-destructive":"bg-amber-500/15 text-amber-600"),children:ro[d.source]}),(0,u.jsx)("span",{className:"min-w-0 text-muted-foreground",children:d.message})]})},`${d.source}-${(d.offset??m).toString()}-${m.toString()}`),"c"),e[5]=t,e[6]=c):c=e[6],l=n.map(c),e[2]=n,e[3]=t,e[4]=l}else l=e[4];let i;return e[7]!==o||e[8]!==l?(i=(0,u.jsx)("ul",{"aria-label":o,className:"max-h-24 shrink-0 overflow-y-auto border-t border-border bg-muted/30","data-testid":"sql-problems",children:l}),e[7]=o,e[8]=l,e[9]=i):i=e[9],i},"ss"),lo=a(s=>(s.endsWith(`
12
+ `)?s.slice(0,-1):s).split(`
13
+ `),"os"),io=a((s,e)=>{let n=[],t=1,r=1;for(let o of Ge(s,e,{ignoreNewlineAtEof:!0}))for(let l of lo(o.value))o.added?(n.push({after:r,kind:"added",text:l}),r+=1):o.removed?(n.push({before:t,kind:"removed",text:l}),t+=1):(n.push({after:r,before:t,kind:"context",text:l}),t+=1,r+=1);return n},"ls"),ao={added:"bg-emerald-500/10 text-emerald-700 dark:text-emerald-400",context:"text-muted-foreground",removed:"bg-destructive/10 text-destructive"},co={added:"+",context:" ",removed:"-"},uo=a(s=>{let e=(0,Z.c)(11),{lines:n}=s,t=ae(),r;e[0]!==t?(r=t("Proposed edit"),e[0]=t,e[1]=r):r=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=ue("max-h-48 overflow-auto rounded-md border border-border bg-background",Ze),e[2]=o):o=e[2];let l;if(e[3]!==n||e[4]!==t){let c;e[6]!==t?(c=a(d=>(0,u.jsxs)("li",{className:ue("flex gap-2",ao[d.kind]),"data-kind":d.kind,children:[(0,u.jsx)("span",{"aria-hidden":"true",className:"shrink-0 select-none opacity-60",children:co[d.kind]}),d.kind!=="context"&&(0,u.jsx)("span",{className:"sr-only",children:d.kind==="added"?t("Added"):t("Removed")}),(0,u.jsx)("span",{className:"min-w-0",children:d.text===""?"\xA0":d.text})]},`${String(d.before)}:${String(d.after)}`),"c"),e[6]=t,e[7]=c):c=e[7],l=n.map(c),e[3]=n,e[4]=t,e[5]=l}else l=e[5];let i;return e[8]!==r||e[9]!==l?(i=(0,u.jsx)("ul",{"aria-label":r,className:o,"data-testid":"sql-inline-diff",children:l}),e[8]=r,e[9]=l,e[10]=i):i=e[10],i},"as"),Oe="rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",mo=a(s=>{let e=(0,Z.c)(41),{onAccept:n,onCancel:t,rpc:r,source:o,whole:l}=s,i=ae(),c=(0,B.useRef)(null),d=(0,B.useRef)(null),[m,x]=(0,B.useState)(""),[h,v]=(0,B.useState)(null),f,N;if(e[0]!==h?(f=a(()=>{h===null?c.current?.focus():d.current?.focus()},"d"),N=[h],e[0]=h,e[1]=f,e[2]=N):(f=e[1],N=e[2]),(0,B.useEffect)(f,N),r.unavailable)return null;let b;e[3]!==r?(b=r.pending("sql"),e[3]=r,e[4]=b):b=e[4];let w=b,p;if(e[5]!==m||e[6]!==n||e[7]!==t||e[8]!==w||e[9]!==h||e[10]!==r||e[11]!==o||e[12]!==i||e[13]!==l){let S=r.reason("sql"),y;e[15]!==m||e[16]!==r||e[17]!==o?(y=a(()=>{let R=m.trim();R===""||o.trim()===""||me((async()=>{let _=await r.rewrite(R,o);_!==void 0&&v(_)})())},"v"),e[15]=m,e[16]=r,e[17]=o,e[18]=y):y=e[18];let g=y,C;e[19]!==t?(C=a(R=>{R.key==="Escape"&&(R.preventDefault(),t())},"E"),e[19]=t,e[20]=C):C=e[20];let k=C,q;e[21]!==i||e[22]!==l?(q=i(l?"Whole query":"Selection"),e[21]=i,e[22]=l,e[23]=q):q=e[23];let E;e[24]!==q?(E=(0,u.jsx)("span",{className:"shrink-0 rounded bg-muted px-1 font-mono text-[10px] uppercase text-muted-foreground","data-testid":"sql-inline-edit-scope",children:q}),e[24]=q,e[25]=E):E=e[25];let T;e[26]!==m||e[27]!==n||e[28]!==t||e[29]!==k||e[30]!==w||e[31]!==h||e[32]!==g||e[33]!==i?(T=h===null?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Qe,{"aria-label":i("Tell the model what to change"),className:"h-7 flex-1 text-xs","data-testid":"sql-inline-edit-prompt",disabled:w,onChange:a(R=>{x(R.target.value)},"onChange"),onKeyDown:a(R=>{if(R.key==="Enter"){R.preventDefault(),g();return}k(R)},"onKeyDown"),placeholder:i("Tell the model what to change"),ref:c,value:m}),(0,u.jsx)("button",{className:ue(Oe,w&&"opacity-60"),"data-testid":"sql-inline-edit-submit",disabled:w||m.trim()==="",onClick:g,onKeyDown:k,type:"button",children:i(w?"Thinking\u2026":"Rewrite")}),(0,u.jsx)("button",{className:Oe,"data-testid":"sql-inline-edit-cancel",onClick:t,onKeyDown:k,type:"button",children:i("Cancel")})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("span",{className:"flex-1 text-xs text-muted-foreground",children:i("Proposed edit")}),(0,u.jsx)("button",{className:Oe,"data-testid":"sql-inline-edit-accept",onClick:a(()=>{n(h)},"onClick"),onKeyDown:k,ref:d,type:"button",children:i("Accept")}),(0,u.jsx)("button",{className:Oe,"data-testid":"sql-inline-edit-reject",onClick:a(()=>{v(null)},"onClick"),onKeyDown:k,type:"button",children:i("Reject")})]}),e[26]=m,e[27]=n,e[28]=t,e[29]=k,e[30]=w,e[31]=h,e[32]=g,e[33]=i,e[34]=T):T=e[34];let I;e[35]!==E||e[36]!==T?(I=(0,u.jsxs)("div",{className:"flex items-center gap-2",children:[E,T]}),e[35]=E,e[36]=T,e[37]=I):I=e[37];let D;e[38]!==h||e[39]!==o?(D=h!==null&&(0,u.jsx)(uo,{lines:io(o,h)}),e[38]=h,e[39]=o,e[40]=D):D=e[40],p=(0,u.jsxs)("div",{className:"flex flex-col gap-1 border-b border-border bg-muted/20 px-3 py-2","data-testid":"sql-inline-edit",children:[I,D,S!==void 0&&(0,u.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-inline-edit-reason",role:"status",children:Et(S,i)})]}),e[5]=m,e[6]=n,e[7]=t,e[8]=w,e[9]=h,e[10]=r,e[11]=o,e[12]=i,e[13]=l,e[14]=p}else p=e[14];return p},"cs"),fo={minWidth:"2.75rem",paddingInline:"0.5rem"},ho=a(s=>{let e=(0,Z.c)(75),{assistant:n,autocomplete:t,diagnostics:r,draft:o,failed:l,handlers:i,editorRef:c,gutterRef:d,inlineEdit:m,listboxId:x,onAcceptInlineEdit:h,onCancelInlineEdit:v,onGenerated:f,onPickSuggestion:N,onRevealDiagnostic:b,overlayRef:w}=s,p=ae(),S,y,g,C,k,q,E,T,I;if(e[0]!==n||e[1]!==o||e[2]!==l||e[3]!==d||e[4]!==m||e[5]!==h||e[6]!==v||e[7]!==f){let $=o.split(`
14
+ `).length;E="flex min-h-0 min-w-0 flex-1 flex-col",e[17]!==n||e[18]!==l||e[19]!==f?(T=(0,u.jsx)(no,{assistant:n,failed:l,onGenerated:f}),e[17]=n,e[18]=l,e[19]=f,e[20]=T):T=e[20],e[21]!==n||e[22]!==o.length||e[23]!==m||e[24]!==h||e[25]!==v?(I=m!==null&&(0,u.jsx)(mo,{onAccept:h,onCancel:v,rpc:n,source:m.text,whole:m.start===0&&m.end===o.length},`${m.start.toString()}-${m.end.toString()}`),e[21]=n,e[22]=o.length,e[23]=m,e[24]=h,e[25]=v,e[26]=I):I=e[26],q="flex min-h-0 min-w-0 flex-1",S="true",y="shrink-0 select-none overflow-hidden border-e border-border bg-muted/30 py-3 text-end font-mono text-xs leading-5 text-muted-foreground/60",g=d,C=fo,k=Array.from({length:$},po),e[0]=n,e[1]=o,e[2]=l,e[3]=d,e[4]=m,e[5]=h,e[6]=v,e[7]=f,e[8]=S,e[9]=y,e[10]=g,e[11]=C,e[12]=k,e[13]=q,e[14]=E,e[15]=T,e[16]=I}else S=e[8],y=e[9],g=e[10],C=e[11],k=e[12],q=e[13],E=e[14],T=e[15],I=e[16];let D;e[27]!==S||e[28]!==y||e[29]!==g||e[30]!==C||e[31]!==k?(D=(0,u.jsx)("div",{"aria-hidden":S,className:y,ref:g,style:C,children:k}),e[27]=S,e[28]=y,e[29]=g,e[30]=C,e[31]=k,e[32]=D):D=e[32];let R;e[33]!==r||e[34]!==o||e[35]!==w?(R=(0,u.jsx)(oo,{diagnostics:r,draft:o,scrollRef:w}),e[33]=r,e[34]=o,e[35]=w,e[36]=R):R=e[36];let _;e[37]!==t||e[38]!==x?(_=t===null?void 0:`${x}-opt-${t.active.toString()}`,e[37]=t,e[38]=x,e[39]=_):_=e[39];let Q=t===null?void 0:x,j=t!==null,K;e[40]!==p?(K=p("SQL query"),e[40]=p,e[41]=K):K=e[41];let P;e[42]!==o||e[43]!==c||e[44]!==i.onBlur||e[45]!==i.onChange||e[46]!==i.onKeyDown||e[47]!==i.onScroll||e[48]!==i.onSelect||e[49]!==_||e[50]!==Q||e[51]!==j||e[52]!==K?(P=(0,u.jsx)("textarea",{"aria-activedescendant":_,"aria-autocomplete":"list","aria-controls":Q,"aria-expanded":j,"aria-label":K,className:`relative size-full resize-none bg-transparent outline-none ${Ze}`,"data-testid":"sql-input",onBlur:i.onBlur,onChange:i.onChange,onKeyDown:i.onKeyDown,onScroll:i.onScroll,onSelect:i.onSelect,placeholder:"SELECT * FROM \u2026",ref:c,role:"combobox",spellCheck:!1,value:o}),e[42]=o,e[43]=c,e[44]=i.onBlur,e[45]=i.onChange,e[46]=i.onKeyDown,e[47]=i.onScroll,e[48]=i.onSelect,e[49]=_,e[50]=Q,e[51]=j,e[52]=K,e[53]=P):P=e[53];let W;e[54]!==t||e[55]!==x||e[56]!==N?(W=(0,u.jsx)(Ln,{listboxId:x,onPick:N,state:t}),e[54]=t,e[55]=x,e[56]=N,e[57]=W):W=e[57];let F;e[58]!==R||e[59]!==P||e[60]!==W?(F=(0,u.jsxs)("div",{className:"relative min-w-0 flex-1 bg-background",children:[R,P,W]}),e[58]=R,e[59]=P,e[60]=W,e[61]=F):F=e[61];let L;e[62]!==D||e[63]!==F||e[64]!==q?(L=(0,u.jsxs)("div",{className:q,children:[D,F]}),e[62]=D,e[63]=F,e[64]=q,e[65]=L):L=e[65];let M;e[66]!==r||e[67]!==b?(M=(0,u.jsx)(so,{diagnostics:r,onSelect:b}),e[66]=r,e[67]=b,e[68]=M):M=e[68];let z;return e[69]!==L||e[70]!==M||e[71]!==E||e[72]!==T||e[73]!==I?(z=(0,u.jsxs)("div",{className:E,children:[T,I,L,M]}),e[69]=L,e[70]=M,e[71]=E,e[72]=T,e[73]=I,e[74]=z):z=e[74],z},"us");function po(s,e){return(0,u.jsx)("div",{children:e+1},e)}a(po,"fs");var Tt=[{label:"List tables",sql:"SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name;"},{label:"Table row count",sql:"SELECT COUNT(*) AS rows FROM messages;"},{label:"Recent rows",sql:"SELECT id, _creationTime, __doc__ FROM messages ORDER BY _creationTime DESC LIMIT 50;"},{label:"Index list",sql:"SELECT name, tbl_name FROM sqlite_master WHERE type = 'index' ORDER BY tbl_name;"}],bo=a(s=>{let e=(0,Z.c)(29),{active:n,onDelete:t,onSelect:r,query:o}=s,l=ae(),i;e[0]!==r||e[1]!==o.id?(i=a(()=>{r(o.id)},"i"),e[0]=r,e[1]=o.id,e[2]=i):i=e[2];let c=i,d;e[3]!==t||e[4]!==o.id?(d=a(C=>{C.stopPropagation(),t(o.id)},"a"),e[3]=t,e[4]=o.id,e[5]=d):d=e[5];let m=d,x=n?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",h;e[6]!==x?(h=ue("flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",x),e[6]=x,e[7]=h):h=e[7];let v=`sql-query-${o.id}`,f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M4 6h16M4 12h10M4 18h7"})}),e[8]=f):f=e[8];let N;e[9]!==o.name?(N=(0,u.jsx)("span",{className:"truncate",children:o.name}),e[9]=o.name,e[10]=N):N=e[10];let b;e[11]!==n||e[12]!==c||e[13]!==h||e[14]!==v||e[15]!==N?(b=(0,u.jsxs)("button",{"aria-pressed":n,className:h,"data-testid":v,onClick:c,type:"button",children:[f,N]}),e[11]=n,e[12]=c,e[13]=h,e[14]=v,e[15]=N,e[16]=b):b=e[16];let w;e[17]!==l?(w=l("Delete query"),e[17]=l,e[18]=w):w=e[18];let p;e[19]!==l?(p=l("Delete query"),e[19]=l,e[20]=p):p=e[20];let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[21]=S):S=e[21];let y;e[22]!==m||e[23]!==p||e[24]!==w?(y=(0,u.jsx)("button",{"aria-label":w,className:"me-1 hidden size-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive group-hover/q:flex",onClick:m,title:p,type:"button",children:S}),e[22]=m,e[23]=p,e[24]=w,e[25]=y):y=e[25];let g;return e[26]!==y||e[27]!==b?(g=(0,u.jsxs)("li",{className:"group/q flex items-center",children:[b,y]}),e[26]=y,e[27]=b,e[28]=g):g=e[28],g},"ms"),bt="sql-history-remember",go=a((s,e)=>{let n=e.trim().toLowerCase();return n===""?[...s]:s.filter(t=>t.name.toLowerCase().includes(n))},"ps"),xo=a(s=>{let e=(0,Z.c)(66),{activeId:n,history:t,listRef:r,onClearHistory:o,onDelete:l,onLoadHistory:i,onLoadTemplate:c,onNew:d,onSearchChange:m,onSelect:x,onToggleRememberHistory:h,queries:v,rememberHistory:f,search:N}=s,b=ae(),w,p,S,y,g;if(e[0]!==n||e[1]!==r||e[2]!==l||e[3]!==d||e[4]!==m||e[5]!==x||e[6]!==h||e[7]!==v||e[8]!==N||e[9]!==b){let _=go(v,N),Q;e[15]!==h?(Q=a($=>{h($.target.checked)},"F"),e[15]=h,e[16]=Q):Q=e[16],w=Q,S="flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar";let j;e[17]!==b?(j=b("Search queries\u2026"),e[17]=b,e[18]=j):j=e[18];let K;e[19]!==m||e[20]!==N||e[21]!==j?(K=(0,u.jsx)("input",{className:"h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"sql-search",onChange:m,placeholder:j,type:"text",value:N}),e[19]=m,e[20]=N,e[21]=j,e[22]=K):K=e[22];let P;e[23]!==b?(P=b("New query"),e[23]=b,e[24]=P):P=e[24];let W;e[25]!==b?(W=b("New query"),e[25]=b,e[26]=W):W=e[26];let F;e[27]===Symbol.for("react.memo_cache_sentinel")?(F=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M12 5v14M5 12h14"})}),e[27]=F):F=e[27];let L;e[28]!==d||e[29]!==P||e[30]!==W?(L=(0,u.jsx)("button",{"aria-label":P,className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-new",onClick:d,title:W,type:"button",children:F}),e[28]=d,e[29]=P,e[30]=W,e[31]=L):L=e[31],e[32]!==L||e[33]!==K?(y=(0,u.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[K,L]}),e[32]=L,e[33]=K,e[34]=y):y=e[34],p="flex flex-1 flex-col gap-4 overflow-y-auto p-2";let M;e[35]!==b?(M=b("Private"),e[35]=b,e[36]=M):M=e[36];let z;e[37]!==M?(z=(0,u.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M}),e[37]=M,e[38]=z):z=e[38],g=(0,u.jsxs)("div",{children:[z,_.length===0?(0,u.jsx)("p",{className:"px-1 py-2 text-xs text-muted-foreground","data-testid":"sql-private-empty",children:b("No saved queries yet \u2014 they save to this browser as you type.")}):(0,u.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-private",ref:r,children:_.map($=>(0,u.jsx)(bo,{active:n===$.id,onDelete:l,onSelect:x,query:$},$.id))})]}),e[0]=n,e[1]=r,e[2]=l,e[3]=d,e[4]=m,e[5]=x,e[6]=h,e[7]=v,e[8]=N,e[9]=b,e[10]=w,e[11]=p,e[12]=S,e[13]=y,e[14]=g}else w=e[10],p=e[11],S=e[12],y=e[13],g=e[14];let C;e[39]!==b?(C=b("Reference"),e[39]=b,e[40]=C):C=e[40];let k;e[41]!==C?(k=(0,u.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:C}),e[41]=C,e[42]=k):k=e[42];let q;e[43]!==c?(q=Tt.map(_=>(0,u.jsx)("li",{children:(0,u.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":_.sql,onClick:c,type:"button",children:[(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M7 4h7l4 4v12H7zM14 4v4h4"})}),_.label]})},_.label)),e[43]=c,e[44]=q):q=e[44];let E;e[45]!==q?(E=(0,u.jsx)("ul",{className:"flex flex-col gap-px",children:q}),e[45]=q,e[46]=E):E=e[46];let T;e[47]!==k||e[48]!==E?(T=(0,u.jsxs)("div",{children:[k,E]}),e[47]=k,e[48]=E,e[49]=T):T=e[49];let I;e[50]!==t||e[51]!==o||e[52]!==i||e[53]!==w||e[54]!==f||e[55]!==b?(I=t.length>0&&(0,u.jsxs)("div",{children:[(0,u.jsxs)("div",{className:"flex items-center justify-between px-1 pb-1",children:[(0,u.jsx)("p",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:b("History")}),(0,u.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"sql-history-clear",onClick:o,type:"button",children:b("Clear history")})]}),(0,u.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 px-1 pb-1.5 text-[11px] text-muted-foreground",htmlFor:bt,children:[(0,u.jsx)("input",{checked:f,"data-testid":"sql-history-remember",id:bt,onChange:w,type:"checkbox"}),b("Keep history on this browser")]}),(0,u.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:t.map(_=>(0,u.jsx)("li",{children:(0,u.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":_.sql,"data-testid":"sql-history-item",onClick:i,title:_.sql,type:"button",children:[(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M12 8v4l3 2M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"})}),(0,u.jsx)("span",{className:"truncate font-mono",children:_.sql})]})},`${_.at.toString()}:${_.sql}`))})]}),e[50]=t,e[51]=o,e[52]=i,e[53]=w,e[54]=f,e[55]=b,e[56]=I):I=e[56];let D;e[57]!==p||e[58]!==I||e[59]!==g||e[60]!==T?(D=(0,u.jsxs)("div",{className:p,children:[g,T,I]}),e[57]=p,e[58]=I,e[59]=g,e[60]=T,e[61]=D):D=e[61];let R;return e[62]!==D||e[63]!==S||e[64]!==y?(R=(0,u.jsxs)("aside",{className:S,children:[y,D]}),e[62]=D,e[63]=S,e[64]=y,e[65]=R):R=e[65],R},"hs"),Pe=a(s=>`border-b-2 px-3 py-2 text-sm outline-none transition-colors ${s?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"qe"),vo=a(s=>{let e=(0,Z.c)(96),{assistant:n,chart:t,className:r,error:o,onFormat:l,onInferChart:i,onRun:c,onSelectStatement:d,onShardKeyChange:m,onShowChart:x,onShowExplain:h,onShowResults:v,onToggleSplit:f,pane:N,result:b,running:w,script:p,shardKey:S,splitView:y}=s,g=ae(),C=N==="results",k;e[0]!==C?(k=Pe(C),e[0]=C,e[1]=k):k=e[1];let q;e[2]!==g?(q=g("Results"),e[2]=g,e[3]=q):q=e[3];let E;e[4]!==v||e[5]!==k||e[6]!==q?(E=(0,u.jsx)("button",{className:k,"data-testid":"sql-tab-results",onClick:v,type:"button",children:q}),e[4]=v,e[5]=k,e[6]=q,e[7]=E):E=e[7];let T=N==="chart",I;e[8]!==T?(I=Pe(T),e[8]=T,e[9]=I):I=e[9];let D;e[10]!==g?(D=g("Chart"),e[10]=g,e[11]=D):D=e[11];let R;e[12]!==x||e[13]!==I||e[14]!==D?(R=(0,u.jsx)("button",{className:I,"data-testid":"sql-tab-chart",onClick:x,type:"button",children:D}),e[12]=x,e[13]=I,e[14]=D,e[15]=R):R=e[15];let _;e[16]!==n||e[17]!==i||e[18]!==N||e[19]!==b||e[20]!==g?(_=!n.unavailable&&N==="chart"&&b!==null&&(0,u.jsx)("button",{className:Pe(!1),"data-testid":"sql-infer-chart",disabled:n.pending("chart"),onClick:i,type:"button",children:n.pending("chart")?g("Thinking\u2026"):g("Suggest chart")}),e[16]=n,e[17]=i,e[18]=N,e[19]=b,e[20]=g,e[21]=_):_=e[21];let Q=N==="explain",j;e[22]!==Q?(j=Pe(Q),e[22]=Q,e[23]=j):j=e[23];let K;e[24]!==g?(K=g("Explain"),e[24]=g,e[25]=K):K=e[25];let P;e[26]!==h||e[27]!==j||e[28]!==K?(P=(0,u.jsx)("button",{className:j,"data-testid":"sql-tab-explain",onClick:h,type:"button",children:K}),e[26]=h,e[27]=j,e[28]=K,e[29]=P):P=e[29];let W;e[30]!==g?(W=g("Split editor and results"),e[30]=g,e[31]=W):W=e[31];let F=`inline-flex items-center rounded-md border border-border px-2 py-1.5 outline-none transition-colors hover:bg-accent focus-visible:bg-accent ${y?"bg-accent text-foreground":"text-muted-foreground"}`,L;e[32]!==g?(L=g("Split editor and results"),e[32]=g,e[33]=L):L=e[33];let M;e[34]===Symbol.for("react.memo_cache_sentinel")?(M=(0,u.jsxs)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:[(0,u.jsx)("rect",{height:"16",rx:"2",width:"18",x:"3",y:"4"}),(0,u.jsx)("path",{d:"M12 4v16"})]}),e[34]=M):M=e[34];let z;e[35]!==f||e[36]!==y||e[37]!==W||e[38]!==F||e[39]!==L?(z=(0,u.jsx)("button",{"aria-label":W,"aria-pressed":y,className:F,"data-testid":"sql-split-toggle",onClick:f,title:L,type:"button",children:M}),e[35]=f,e[36]=y,e[37]=W,e[38]=F,e[39]=L,e[40]=z):z=e[40];let $;e[41]!==b?($=b!==null&&b.columns.length>0&&(0,u.jsx)(at,{columns:b.columns,name:"query-result",rows:b.rows}),e[41]=b,e[42]=$):$=e[42];let te;e[43]!==g?(te=g("Format"),e[43]=g,e[44]=te):te=e[44];let V;e[45]!==l||e[46]!==w||e[47]!==te?(V=(0,u.jsx)("button",{className:"inline-flex items-center 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","data-testid":"sql-format",disabled:w,onClick:l,type:"button",children:te}),e[45]=l,e[46]=w,e[47]=te,e[48]=V):V=e[48];let ee;e[49]!==m||e[50]!==S?(ee=(0,u.jsx)(rt,{onChange:m,testId:"sql-shard-input",value:S}),e[49]=m,e[50]=S,e[51]=ee):ee=e[51];let A;e[52]!==w||e[53]!==g?(A=g(w?"Running\u2026":"Run"),e[52]=w,e[53]=g,e[54]=A):A=e[54];let U;e[55]===Symbol.for("react.memo_cache_sentinel")?(U=(0,u.jsx)("kbd",{className:"rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",children:"\u2318\u21B5"}),e[55]=U):U=e[55];let G;e[56]!==c||e[57]!==w||e[58]!==A?(G=(0,u.jsxs)("button",{className:"inline-flex items-center gap-1.5 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","data-testid":"sql-run",disabled:w,onClick:c,type:"button",children:[A,U]}),e[56]=c,e[57]=w,e[58]=A,e[59]=G):G=e[59];let Y;e[60]!==z||e[61]!==$||e[62]!==V||e[63]!==ee||e[64]!==G?(Y=(0,u.jsxs)("div",{className:"ms-auto flex items-center gap-2",children:[z,$,V,ee,G]}),e[60]=z,e[61]=$,e[62]=V,e[63]=ee,e[64]=G,e[65]=Y):Y=e[65];let O;e[66]!==P||e[67]!==Y||e[68]!==E||e[69]!==R||e[70]!==_?(O=(0,u.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[E,R,_,P,Y]}),e[66]=P,e[67]=Y,e[68]=E,e[69]=R,e[70]=_,e[71]=O):O=e[71];let oe;e[72]!==d||e[73]!==p?(oe=p!==void 0&&(0,u.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-border px-3 py-1.5","data-testid":"sql-statements",children:p.runs.map((X,re)=>(0,u.jsx)("button",{"aria-pressed":re===p.selected,className:`rounded-md border px-2 py-0.5 font-mono text-[11px] outline-none transition-colors ${re===p.selected?"border-foreground text-foreground":"border-border text-muted-foreground hover:text-foreground"} ${X.error===null?"":"border-destructive/50 text-destructive"}`,"data-testid":`sql-statement-${re.toString()}`,onClick:a(()=>{d(re)},"onClick"),title:X.sql,type:"button",children:re+1},`${re.toString()}:${X.sql}`))}),e[72]=d,e[73]=p,e[74]=oe):oe=e[74];let se;e[75]!==o?(se=o!==null&&(0,u.jsx)(st,{className:"m-3 font-mono text-xs",testId:"sql-error",variant:"destructive",children:o}),e[75]=o,e[76]=se):se=e[76];let le;e[77]!==o||e[78]!==b||e[79]!==g?(le=o===null&&b===null&&(0,u.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:g("Click Run to execute your query.")}),e[77]=o,e[78]=b,e[79]=g,e[80]=le):le=e[80];let ie;e[81]!==t||e[82]!==o||e[83]!==N||e[84]!==b||e[85]!==g?(ie=o===null&&b!==null&&(0,u.jsxs)("div",{"data-testid":"sql-result",children:[N==="chart"?(0,u.jsx)(ct,{axes:t,result:b}):(0,u.jsx)(dt,{result:b}),(0,u.jsx)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:b.truncated?g("Showing the first {max} of {count} rows.",{count:b.rowCount,max:b.rows.length}):g("{count} rows",{count:b.rowCount})})]}),e[81]=t,e[82]=o,e[83]=N,e[84]=b,e[85]=g,e[86]=ie):ie=e[86];let H;e[87]!==se||e[88]!==le||e[89]!==ie?(H=(0,u.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto",children:[se,le,ie]}),e[87]=se,e[88]=le,e[89]=ie,e[90]=H):H=e[90];let J;return e[91]!==r||e[92]!==O||e[93]!==oe||e[94]!==H?(J=(0,u.jsxs)("div",{className:r,children:[O,oe,H]}),e[91]=r,e[92]=O,e[93]=oe,e[94]=H,e[95]=J):J=e[95],J},"bs"),yo=a((s,e)=>s.trim()===""?e:(s.split(`
15
+ `)[0]??s).slice(0,24),"gs"),wo=a(s=>{s?.focus(),s?.select()},"xs"),So=a(s=>{let e=(0,Z.c)(14),{initial:n,onCancel:t,onCommit:r,placeholder:o,testId:l}=s,i=ae(),c;e[0]!==r?(c=a(f=>{r(f.currentTarget.value.trim())},"c"),e[0]=r,e[1]=c):c=e[1];let d=c,m;e[2]!==t||e[3]!==r?(m=a(f=>{f.key==="Enter"?r(f.currentTarget.value.trim()):f.key==="Escape"&&t()},"f"),e[2]=t,e[3]=r,e[4]=m):m=e[4];let x=m,h;e[5]!==i?(h=i("Tab title"),e[5]=i,e[6]=h):h=e[6];let v;return e[7]!==n||e[8]!==d||e[9]!==x||e[10]!==o||e[11]!==h||e[12]!==l?(v=(0,u.jsx)("input",{"aria-label":h,className:"w-40 rounded border border-ring bg-background px-1 py-0.5 text-xs outline-none","data-testid":l,defaultValue:n,onBlur:d,onKeyDown:x,placeholder:o,ref:wo,type:"text"}),e[7]=n,e[8]=d,e[9]=x,e[10]=o,e[11]=h,e[12]=l,e[13]=v):v=e[13],v},"ys"),Co=a(s=>{let e=(0,Z.c)(29),{idBase:n,onDiscard:t,onKeep:r}=s,o=ae(),l=`sql-tab-close-prompt-${n}`,i;e[0]!==o?(i=o("Discard?"),e[0]=o,e[1]=i):i=e[1];let c;e[2]!==i?(c=(0,u.jsx)("span",{className:"text-[11px] text-muted-foreground",children:i}),e[2]=i,e[3]=c):c=e[3];let d;e[4]!==o?(d=o("Discard changes"),e[4]=o,e[5]=d):d=e[5];let m=`sql-tab-close-confirm-${n}`,x;e[6]!==o?(x=o("Discard changes"),e[6]=o,e[7]=x):x=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M5 13l4 4L19 7"})}),e[8]=h):h=e[8];let v;e[9]!==t||e[10]!==d||e[11]!==m||e[12]!==x?(v=(0,u.jsx)("button",{"aria-label":d,className:"flex size-5 items-center justify-center rounded text-destructive hover:bg-destructive/10","data-testid":m,onClick:t,title:x,type:"button",children:h}),e[9]=t,e[10]=d,e[11]=m,e[12]=x,e[13]=v):v=e[13];let f;e[14]!==o?(f=o("Keep editing"),e[14]=o,e[15]=f):f=e[15];let N=`sql-tab-close-cancel-${n}`,b;e[16]!==o?(b=o("Keep editing"),e[16]=o,e[17]=b):b=e[17];let w;e[18]===Symbol.for("react.memo_cache_sentinel")?(w=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})}),e[18]=w):w=e[18];let p;e[19]!==r||e[20]!==N||e[21]!==b||e[22]!==f?(p=(0,u.jsx)("button",{"aria-label":f,className:"flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent","data-testid":N,onClick:r,title:b,type:"button",children:w}),e[19]=r,e[20]=N,e[21]=b,e[22]=f,e[23]=p):p=e[23];let S;return e[24]!==l||e[25]!==p||e[26]!==c||e[27]!==v?(S=(0,u.jsxs)("span",{className:"flex shrink-0 items-center gap-1","data-testid":l,role:"group",children:[c,v,p]}),e[24]=l,e[25]=p,e[26]=c,e[27]=v,e[28]=S):S=e[28],S},"vs"),ko=a(s=>{let e=(0,Z.c)(47),{active:n,canClose:t,onClose:r,onMenu:o,onRename:l,onSelect:i,tab:c}=s,d=ae(),[m,x]=(0,B.useState)(!1),[h,v]=(0,B.useState)(!1),f;e[0]!==o||e[1]!==c.id?(f=a($=>{o(c.id,$)},"d"),e[0]=o,e[1]=c.id,e[2]=f):f=e[2];let N=f,b;e[3]!==i||e[4]!==c.id?(b=a(()=>{i(c.id)},"m"),e[3]=i,e[4]=c.id,e[5]=b):b=e[5];let w=b,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=a(()=>{x(!0)},"b"),e[6]=p):p=e[6];let S=p,y;e[7]!==r||e[8]!==c?(y=a($=>{$.stopPropagation(),qt(c)?v(!0):r(c.id)},"v"),e[7]=r,e[8]=c,e[9]=y):y=e[9];let g=y,C;e[10]!==r||e[11]!==c.id?(C=a($=>{$.stopPropagation(),v(!1),r(c.id)},"E"),e[10]=r,e[11]=c.id,e[12]=C):C=e[12];let k=C,q;e[13]===Symbol.for("react.memo_cache_sentinel")?(q=a($=>{$.stopPropagation(),v(!1)},"T"),e[13]=q):q=e[13];let E=q,T;e[14]!==l||e[15]!==c.id?(T=a($=>{l(c.id,$),x(!1)},"R"),e[14]=l,e[15]=c.id,e[16]=T):T=e[16];let I=T,D;e[17]===Symbol.for("react.memo_cache_sentinel")?(D=a(()=>{x(!1)},"_"),e[17]=D):D=e[17];let R=D,_;e[18]!==c.name?(_=c.name.trim(),e[18]=c.name,e[19]=_):_=e[19];let Q=_,j;e[20]!==d||e[21]!==c.sql?(j=yo(c.sql,d("Untitled")),e[20]=d,e[21]=c.sql,e[22]=j):j=e[22];let K=j,P=n?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",W;e[23]!==P?(W=ue("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",P),e[23]=P,e[24]=W):W=e[24];let F=`sql-tab-${c.id}`,L;e[25]!==n||e[26]!==I||e[27]!==Q||e[28]!==K||e[29]!==m||e[30]!==w||e[31]!==d||e[32]!==c.id?(L=m?(0,u.jsx)(So,{initial:Q,onCancel:R,onCommit:I,placeholder:K,testId:`sql-tab-rename-${c.id}`}):(0,u.jsx)("button",{"aria-pressed":n,className:"max-w-40 truncate py-1.5 outline-none","data-testid":`sql-tab-select-${c.id}`,onClick:w,onDoubleClick:S,title:d("Double-click to rename"),type:"button",children:Q===""?K:Q}),e[25]=n,e[26]=I,e[27]=Q,e[28]=K,e[29]=m,e[30]=w,e[31]=d,e[32]=c.id,e[33]=L):L=e[33];let M;e[34]!==t||e[35]!==k||e[36]!==h||e[37]!==g||e[38]!==d||e[39]!==c.id?(M=t&&(h?(0,u.jsx)(Co,{idBase:c.id,onDiscard:k,onKeep:E}):(0,u.jsx)("button",{"aria-label":d("Close tab"),className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive","data-testid":`sql-tab-close-${c.id}`,onClick:g,title:d("Close tab"),type:"button",children:(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})})})),e[34]=t,e[35]=k,e[36]=h,e[37]=g,e[38]=d,e[39]=c.id,e[40]=M):M=e[40];let z;return e[41]!==N||e[42]!==W||e[43]!==F||e[44]!==L||e[45]!==M?(z=(0,u.jsxs)("div",{className:W,"data-testid":F,onContextMenu:N,children:[L,M]}),e[41]=N,e[42]=W,e[43]=F,e[44]=L,e[45]=M,e[46]=z):z=e[46],z},"Ss"),No=a(s=>{let e=(0,Z.c)(43),{model:n,onSelect:t}=s,r=ae(),{activeTab:o,addEditorTab:l,cancelBulk:i,closeEditorTab:c,closeTabMenu:d,confirmBulk:m,menuStyle:x,onBackdropContextMenu:h,onCloseAll:v,onCloseOthers:f,onCloseToRight:N,openTabMenu:b,pendingBulk:w,renameTab:p,tabMenu:S,tabs:y}=n,g;if(e[0]!==o||e[1]!==c||e[2]!==t||e[3]!==b||e[4]!==p||e[5]!==y){let _;e[7]!==o||e[8]!==c||e[9]!==t||e[10]!==b||e[11]!==p||e[12]!==y.length?(_=a(Q=>(0,u.jsx)(ko,{active:Q.id===o.id,canClose:y.length>1,onClose:c,onMenu:b,onRename:p,onSelect:t,tab:Q},Q.id),"L"),e[7]=o,e[8]=c,e[9]=t,e[10]=b,e[11]=p,e[12]=y.length,e[13]=_):_=e[13],g=y.map(_),e[0]=o,e[1]=c,e[2]=t,e[3]=b,e[4]=p,e[5]=y,e[6]=g}else g=e[6];let C;e[14]!==r?(C=r("New tab"),e[14]=r,e[15]=C):C=e[15];let k=y.length>=Xe,q;e[16]!==r?(q=r("New tab"),e[16]=r,e[17]=q):q=e[17];let E;e[18]===Symbol.for("react.memo_cache_sentinel")?(E=(0,u.jsx)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,u.jsx)("path",{d:"M12 5v14M5 12h14"})}),e[18]=E):E=e[18];let T;e[19]!==l||e[20]!==C||e[21]!==k||e[22]!==q?(T=(0,u.jsx)("button",{"aria-label":C,className:"flex size-8 shrink-0 items-center justify-center text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-add",disabled:k,onClick:l,title:q,type:"button",children:E}),e[19]=l,e[20]=C,e[21]=k,e[22]=q,e[23]=T):T=e[23];let I;e[24]!==g||e[25]!==T?(I=(0,u.jsxs)("div",{className:"flex shrink-0 items-stretch overflow-x-auto border-b border-border bg-muted/30","data-testid":"sql-tab-strip",role:"tablist",children:[g,T]}),e[24]=g,e[25]=T,e[26]=I):I=e[26];let D;e[27]!==i||e[28]!==d||e[29]!==m||e[30]!==x||e[31]!==h||e[32]!==v||e[33]!==f||e[34]!==N||e[35]!==w||e[36]!==r||e[37]!==S||e[38]!==y?(D=S!==null&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:"fixed inset-0 z-40","data-testid":"sql-tab-menu-backdrop",onClick:d,onContextMenu:h,role:"presentation"}),(0,u.jsx)("div",{className:"fixed z-50 min-w-44 rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-tab-menu",role:"menu",style:x,children:w===null?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-others",disabled:y.length<=1,onClick:f,role:"menuitem",type:"button",children:r("Close other tabs")}),(0,u.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-right",disabled:y.findIndex(_=>_.id===S.id)>=y.length-1,onClick:N,role:"menuitem",type:"button",children:r("Close tabs to the right")}),(0,u.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-close-all",onClick:v,role:"menuitem",type:"button",children:r("Close all tabs")})]}):(0,u.jsxs)("div",{className:"px-3 py-1.5","data-testid":"sql-tab-menu-confirm",children:[(0,u.jsx)("p",{className:"pb-1.5 text-xs text-muted-foreground",children:r("Discard unsaved tabs?")}),(0,u.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,u.jsx)("button",{className:"rounded px-2 py-1 text-xs font-medium text-destructive outline-none hover:bg-destructive/10 focus-visible:bg-destructive/10","data-testid":"sql-tab-menu-confirm-discard",onClick:m,type:"button",children:r("Discard")}),(0,u.jsx)("button",{className:"rounded px-2 py-1 text-xs text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-confirm-cancel",onClick:i,type:"button",children:r("Cancel")})]})]})})]}),e[27]=i,e[28]=d,e[29]=m,e[30]=x,e[31]=h,e[32]=v,e[33]=f,e[34]=N,e[35]=w,e[36]=r,e[37]=S,e[38]=y,e[39]=D):D=e[39];let R;return e[40]!==I||e[41]!==D?(R=(0,u.jsxs)(u.Fragment,{children:[I,D]}),e[40]=I,e[41]=D,e[42]=R):R=e[42],R},"ws"),qo=Se(ke.runSql),Eo="lunora-studio-sql-split-view",To=a(()=>Ee(Tt[0]?.sql??""),"Ns"),Xo=a(s=>{let e=(0,Z.c)(117),{initialShardKey:n}=s,t=_e(),r=Gn(To),{activeTab:o,output:l,patchActiveOutput:i,patchActiveTab:c,setActiveTabId:d,unlinkQuery:m}=r,x;e[0]!==i||e[1]!==c?(x=a((ne,ce)=>{c({activeId:ce,sql:ne}),i({chart:void 0,error:null,failed:void 0,result:null,script:void 0})},"g"),e[0]=i,e[1]=c,e[2]=x):x=e[2];let h=x,v;e[3]!==h||e[4]!==m?(v={loadIntoActiveTab:h,unlinkQuery:m},e[3]=h,e[4]=m,e[5]=v):v=e[5];let f=eo(v),{recordHistory:N,updateQuerySql:b}=f,w=o.sql,{activeId:p}=o,{chart:S,error:y,failed:g,result:C,running:k}=l,q=l.pane,[E,T]=(0,B.useState)(n??""),[I,D]=Ae(Eo,!1),{probe:R,schema:_}=Dn(E),Q;e[6]!==p||e[7]!==c||e[8]!==b?(Q=a(ne=>{c({sql:ne}),p!==null&&b(p,ne)},"F"),e[6]=p,e[7]=c,e[8]=b,e[9]=Q):Q=e[9];let j=Q,K=gn(w,_,E),P=it(E),W;e[10]!==P||e[11]!==i||e[12]!==C?(W=a(()=>{C!==null&&me((async()=>{let ne=await P.inferChart({columns:C.columns,rowCount:C.rowCount,types:Object.fromEntries(C.columns.map(ce=>[ce,typeof(C.rows[0]?.[ce]??"")]))});i({chart:ne})})())},"W"),e[10]=P,e[11]=i,e[12]=C,e[13]=W):W=e[13];let F=W,L;e[14]!==t||e[15]!==N||e[16]!==E?(L=a(async ne=>{try{let ce=await t.query(qo,{sql:ne},Ce(E));return N(ne),{error:null,result:ce,sql:ne}}catch(ce){return{error:tt(ce),result:null,sql:ne}}},"I"),e[14]=t,e[15]=N,e[16]=E,e[17]=L):L=e[17];let M=L,z;e[18]!==w||e[19]!==i||e[20]!==M||e[21]!==E?(z=a(async ne=>{if(w.trim()==="")return;i({running:!0});let ce=ne==="explain"?Ye(Bt(w),0):wt(w),de=[];for(let Re of ce){let It={error:Re.rejection?.message??"",result:null,sql:Re.sql};de.push(Re.rejection===void 0?await M(Re.sql):It)}ot(E);let et=Math.max(de.length-1,0),ye=de[et];i({chart:void 0,error:ye?.error??null,failed:ye?.error===null||ye===void 0?void 0:{error:ye.error,sql:ye.sql},pane:ne,result:ye?.result??null,running:!1,script:de.length>1?{runs:de,selected:et}:void 0})},"K"),e[18]=w,e[19]=i,e[20]=M,e[21]=E,e[22]=z):z=e[22];let $=z,te;e[23]!==l.script?.runs||e[24]!==i?(te=a(ne=>{let ce=l.script?.runs,de=ce?.[ne];ce===void 0||de===void 0||i({chart:void 0,error:de.error,failed:de.error===null?void 0:{error:de.error,sql:de.sql},result:de.result,script:{runs:ce,selected:ne}})},"ee"),e[23]=l.script?.runs,e[24]=i,e[25]=te):te=e[25];let V=te,ee;e[26]!==$?(ee=a(()=>{me($("results"))},"Z"),e[26]=$,e[27]=ee):ee=e[27];let A=ee,U=!P.unavailable,G;e[28]!==l.pane||e[29]!==$?(G=a(()=>{me($(l.pane))},"j"),e[28]=l.pane,e[29]=$,e[30]=G):G=e[30];let Y;e[31]!==R||e[32]!==_||e[33]!==j||e[34]!==G||e[35]!==U?(Y={inlineEditEnabled:U,onSubmit:G,probe:R,schema:_,setDraft:j},e[31]=R,e[32]=_,e[33]=j,e[34]=G,e[35]=U,e[36]=Y):Y=e[36];let O=Pn(Y),{closeAutocomplete:oe,closeInlineEdit:se}=O,le;e[37]!==w||e[38]!==j?(le=a(()=>{j(Jt(w))},"ie"),e[37]=w,e[38]=j,e[39]=le):le=e[39];let ie=le,H;e[40]!==oe||e[41]!==se||e[42]!==d?(H=a(ne=>{oe(),se(),d(ne)},"P"),e[40]=oe,e[41]=se,e[42]=d,e[43]=H):H=e[43];let J=H,X;e[44]!==i?(X=a(()=>{i({pane:"results"})},"V"),e[44]=i,e[45]=X):X=e[45];let re=X,fe;e[46]!==$?(fe=a(()=>{me($("explain"))},"pe"),e[46]=$,e[47]=fe):fe=e[47];let je=fe,Te;e[48]!==i?(Te=a(()=>{i({pane:"chart"})},"ke"),e[48]=i,e[49]=Te):Te=e[49];let ze=Te,Ie;e[50]!==D||e[51]!==I?(Ie=a(()=>{D(!I)},"Te"),e[50]=D,e[51]=I,e[52]=Ie):Ie=e[52];let He=Ie,We=I?"flex min-h-0 flex-1 flex-row":"flex min-h-0 flex-1 flex-col",Be=I?"flex w-2/5 min-h-0 min-w-0 shrink-0 flex-col border-s border-border":"flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border",he;e[53]!==p||e[54]!==f.clearHistory||e[55]!==f.deleteQuery||e[56]!==f.history||e[57]!==f.listRef||e[58]!==f.loadFromHistory||e[59]!==f.loadTemplate||e[60]!==f.newQuery||e[61]!==f.onSearchChange||e[62]!==f.queries||e[63]!==f.rememberHistory||e[64]!==f.search||e[65]!==f.selectQuery||e[66]!==f.setRememberHistory?(he=(0,u.jsx)(xo,{activeId:p,history:f.history,listRef:f.listRef,onClearHistory:f.clearHistory,onDelete:f.deleteQuery,onLoadHistory:f.loadFromHistory,onLoadTemplate:f.loadTemplate,onNew:f.newQuery,onSearchChange:f.onSearchChange,onSelect:f.selectQuery,onToggleRememberHistory:f.setRememberHistory,queries:f.queries,rememberHistory:f.rememberHistory,search:f.search}),e[53]=p,e[54]=f.clearHistory,e[55]=f.deleteQuery,e[56]=f.history,e[57]=f.listRef,e[58]=f.loadFromHistory,e[59]=f.loadTemplate,e[60]=f.newQuery,e[61]=f.onSearchChange,e[62]=f.queries,e[63]=f.rememberHistory,e[64]=f.search,e[65]=f.selectQuery,e[66]=f.setRememberHistory,e[67]=he):he=e[67];let pe;e[68]!==r||e[69]!==J?(pe=(0,u.jsx)(No,{model:r,onSelect:J}),e[68]=r,e[69]=J,e[70]=pe):pe=e[70];let be;e[71]!==P||e[72]!==K||e[73]!==w||e[74]!==g||e[75]!==j||e[76]!==O.acceptInlineEdit||e[77]!==O.autocompleteState||e[78]!==O.closeInlineEdit||e[79]!==O.editorRef||e[80]!==O.gutterRef||e[81]!==O.handlers||e[82]!==O.inlineEdit||e[83]!==O.listboxId||e[84]!==O.onPickSuggestion||e[85]!==O.overlayRef||e[86]!==O.revealDiagnostic?(be=(0,u.jsx)(ho,{assistant:P,autocomplete:O.autocompleteState,diagnostics:K,draft:w,editorRef:O.editorRef,failed:g,gutterRef:O.gutterRef,handlers:O.handlers,inlineEdit:O.inlineEdit,listboxId:O.listboxId,onAcceptInlineEdit:O.acceptInlineEdit,onCancelInlineEdit:O.closeInlineEdit,onGenerated:j,onPickSuggestion:O.onPickSuggestion,onRevealDiagnostic:O.revealDiagnostic,overlayRef:O.overlayRef}),e[71]=P,e[72]=K,e[73]=w,e[74]=g,e[75]=j,e[76]=O.acceptInlineEdit,e[77]=O.autocompleteState,e[78]=O.closeInlineEdit,e[79]=O.editorRef,e[80]=O.gutterRef,e[81]=O.handlers,e[82]=O.inlineEdit,e[83]=O.listboxId,e[84]=O.onPickSuggestion,e[85]=O.overlayRef,e[86]=O.revealDiagnostic,e[87]=be):be=e[87];let ge;e[88]!==P||e[89]!==y||e[90]!==ie||e[91]!==F||e[92]!==S||e[93]!==A||e[94]!==V||e[95]!==l.script||e[96]!==C||e[97]!==Be||e[98]!==k||e[99]!==E||e[100]!==ze||e[101]!==je||e[102]!==re||e[103]!==I||e[104]!==q||e[105]!==He?(ge=(0,u.jsx)(vo,{assistant:P,chart:S,className:Be,error:y,onFormat:ie,onInferChart:F,onRun:A,onSelectStatement:V,onShardKeyChange:T,onShowChart:ze,onShowExplain:je,onShowResults:re,onToggleSplit:He,pane:q,result:C,running:k,script:l.script,shardKey:E,splitView:I}),e[88]=P,e[89]=y,e[90]=ie,e[91]=F,e[92]=S,e[93]=A,e[94]=V,e[95]=l.script,e[96]=C,e[97]=Be,e[98]=k,e[99]=E,e[100]=ze,e[101]=je,e[102]=re,e[103]=I,e[104]=q,e[105]=He,e[106]=ge):ge=e[106];let xe;e[107]!==be||e[108]!==ge||e[109]!==We?(xe=(0,u.jsxs)("div",{className:We,children:[be,ge]}),e[107]=be,e[108]=ge,e[109]=We,e[110]=xe):xe=e[110];let ve;e[111]!==pe||e[112]!==xe?(ve=(0,u.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[pe,xe]}),e[111]=pe,e[112]=xe,e[113]=ve):ve=e[113];let Le;return e[114]!==he||e[115]!==ve?(Le=(0,u.jsxs)("div",{className:"flex h-full min-w-0","data-testid":"lunora-sql-editor",children:[he,ve]}),e[114]=he,e[115]=ve,e[116]=Le):Le=e[116],Le},"Qs");export{Xo as SqlEditorPanel};
@@ -0,0 +1 @@
1
+ import{a as c}from"./chunk-VESGIGMQ.js";import{i as e}from"./chunk-OQ6I6OXT.js";import{p as m}from"./chunk-HJHSQPHW.js";import{a as s,d as p,f as n}from"./chunk-I26MS5PJ.js";var f=p(n(),1);var h=s(r=>{let t=(0,f.c)(3),a=e(),o;return t[0]!==a||t[1]!==r?(o=s(i=>{c({shardKey:r,traceId:i}),m(a({to:"/traces"}))},"e"),t[0]=a,t[1]=r,t[2]=o):o=t[2],o},"u");export{h as a};
@@ -0,0 +1 @@
1
+ import{a as y,b as G}from"./chunk-Q6IT6ZD7.js";import{a as _,b as z,c as B,d as E,e as j,f as H,g as L,h as T,i as V,j as Z,k as q,l as D}from"./chunk-MK7SA3YV.js";import{i as K}from"./chunk-E4PXACVL.js";import{a as k}from"./chunk-7G4Z6Q7X.js";import{b as w}from"./chunk-Q6ED4KUL.js";import{d as M,p as I}from"./chunk-HJHSQPHW.js";import{a as u,d as $,e as le,f as se,g as de,i as N}from"./chunk-I26MS5PJ.js";var v=$(se(),1);var h=$(le(),1);var n=$(de(),1);function ie(a){let e=(0,v.c)(10),t,l,r;e[0]!==a?({className:t,selected:r,...l}=a,e[0]=a,e[1]=t,e[2]=l,e[3]=r):(t=e[1],l=e[2],r=e[3]);let s=r===!0?"":void 0,o;e[4]!==t?(o=N("rounded-md border border-border bg-card text-card-foreground shadow-sm transition-colors","data-[selected]:border-ring data-[selected]:ring-[3px] data-[selected]:ring-ring/30",t),e[4]=t,e[5]=o):o=e[5];let d;return e[6]!==l||e[7]!==s||e[8]!==o?(d=(0,n.jsx)("div",{"data-slot":"base-node","data-selected":s,className:o,...l}),e[6]=l,e[7]=s,e[8]=o,e[9]=d):d=e[9],d}u(ie,"ie");function ce(a){let e=(0,v.c)(8),t,l;e[0]!==a?({className:t,...l}=a,e[0]=a,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let r;e[3]!==t?(r=N("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=r):r=e[4];let s;return e[5]!==l||e[6]!==r?(s=(0,n.jsx)("div",{"data-slot":"base-node-header",className:r,...l}),e[5]=l,e[6]=r,e[7]=s):s=e[7],s}u(ce,"de");function me(a){let e=(0,v.c)(8),t,l;e[0]!==a?({className:t,...l}=a,e[0]=a,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let r;e[3]!==t?(r=N("flex flex-col",t),e[3]=t,e[4]=r):r=e[4];let s;return e[5]!==l||e[6]!==r?(s=(0,n.jsx)("div",{"data-slot":"base-node-content",className:r,...l}),e[5]=l,e[6]=r,e[7]=s):s=e[7],s}u(me,"ce");var O=u(a=>{let e=a.ref===void 0?a.type:`${a.type} \u2192 ${a.ref}`;return a.optional===!0?`${e}?`:e},"A"),ue=u(a=>{let e=(0,v.c)(22),{data:t,selected:l}=a,r=M(),s;e[0]!==t.label||e[1]!==t.loadError||e[2]!==r?(s=t.loadError===!0?(0,n.jsx)("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:r("Columns unavailable")}):(0,n.jsx)("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"\u2014"}),e[0]=t.label,e[1]=t.loadError,e[2]=r,e[3]=s):s=e[3];let o=s,d=`sd-node-${t.label}`,c;e[4]!==t.label?(c=(0,n.jsx)("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=c):c=e[5];let m;e[6]!==t.tier?(m=(0,n.jsx)("span",{className:"ms-auto",children:(0,n.jsx)(G,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let i;e[8]!==c||e[9]!==m?(i=(0,n.jsxs)(ce,{children:[c,m]}),e[8]=c,e[9]=m,e[10]=i):i=e[10];let f;e[11]!==t.columns||e[12]!==t.label||e[13]!==o?(f=t.columns.length===0?o:t.columns.map(b=>(0,n.jsxs)("div",{className:N("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",b.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${b.name}`,children:[(0,n.jsx)(E,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:b.name,isConnectable:!1,position:_.Left,type:"target"}),(0,n.jsx)("span",{className:"truncate font-mono",title:b.name,children:b.name}),b.pk===!0&&(0,n.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),b.ref!==void 0&&(0,n.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),(0,n.jsx)("span",{className:"ms-auto truncate text-muted-foreground",title:O(b),children:O(b)}),(0,n.jsx)(E,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:b.name,isConnectable:!1,position:_.Right,type:"source"})]},b.name)),e[11]=t.columns,e[12]=t.label,e[13]=o,e[14]=f):f=e[14];let p;e[15]!==f?(p=(0,n.jsx)(me,{children:f}),e[15]=f,e[16]=p):p=e[16];let x;return e[17]!==l||e[18]!==d||e[19]!==i||e[20]!==p?(x=(0,n.jsxs)(ie,{className:"w-64 overflow-hidden","data-testid":d,selected:l,children:[i,p]}),e[17]=l,e[18]=d,e[19]=i,e[20]=p,e[21]=x):x=e[21],x},"me"),J=256,Q=112,W=36,C=24,fe=480,pe=1.4,be=u(a=>{let e=Math.max(1,Math.round(Math.sqrt(pe*a/(J+Q))));return Math.max(fe,a/e)},"pe"),he=38,ge=28,A=u(a=>he+Math.max(1,a)*ge,"B"),xe=u((a,e)=>{let t=new Map;for(let o of a)t.set(o,[]);for(let o of e)o.to!==o.from&&t.has(o.from)&&t.has(o.to)&&t.get(o.from)?.push(o.to);let l=new Map,r=new Set,s=u(o=>{let d=l.get(o);if(d!==void 0)return d;if(r.has(o))return 0;r.add(o);let c=0;for(let m of t.get(o)??[])c=Math.max(c,s(m)+1);return r.delete(o),l.set(o,c),c},"n");for(let o of a)s(o);return l},"be"),Ne=u((a,e,t)=>{let l=xe(a,e),r=new Map;for(let m of a){let i=l.get(m)??0,f=r.get(i);f===void 0?r.set(i,[m]):f.push(m)}let s=a.reduce((m,i)=>m+A(t.get(i)??0)+W,0),o=be(s),d=[],c=0;for(let m of[...r.keys()].toSorted((i,f)=>i-f)){let i=0,f=C;for(let p of r.get(m)??[]){let x=A(t.get(p)??0);f>C&&f+x>o&&(i+=1,f=C),d.push({name:p,x:C+(c+i)*(J+Q),y:f}),f+=x+W}c+=i+1}return d},"xe"),ye={databaseSchema:ue},U={backgroundColor:y.shard.color},X={backgroundColor:y.global.color},ve={global:!0,shard:!0},we={},Me=u(a=>{let e=a.find(t=>t.pk===!0)?.name;return e!==void 0?e:a.some(t=>t.name==="_id")?"_id":a.some(t=>t.name==="id")?"id":a[0]?.name??"_id"},"Ee"),Y=u(a=>a.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),"K"),Ce=u((a,e,t)=>{let l=a.map(d=>d.name),r=new Map(a.map(d=>[d.name,d.columns.length])),s=Ne(l,Y(a),r),o=new Map(a.map(d=>[d.name,d]));return s.flatMap(({name:d,x:c,y:m})=>{let i=o.get(d);return i===void 0?[]:[{className:t[d],data:{columns:i.columns,label:d,loadError:e,tier:i.tier},id:d,position:{x:c,y:m},type:"databaseSchema"}]})},"Se"),Se=u(a=>{let e=new Map(a.map(t=>[t.name,t.columns]));return Y(a).flatMap(t=>{let l=e.get(t.to)??[],r=e.get(t.from)??[],s=Me(l);return!l.some(o=>o.name===s)||!r.some(o=>o.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:s,target:t.from,targetHandle:t.column}]})},"_e"),$e=u(()=>{let a=(0,v.c)(15),e=M(),t;a[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),a[0]=t):t=a[0];let l;a[1]===Symbol.for("react.memo_cache_sentinel")?(l=(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]}),a[1]=l):l=a[1];let r;a[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,n.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),a[2]=r):r=a[2];let s;a[3]!==e?(s=e("Primary key"),a[3]=e,a[4]=s):s=a[4];let o;a[5]!==s?(o=(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[r,s]}),a[5]=s,a[6]=o):o=a[6];let d;a[7]===Symbol.for("react.memo_cache_sentinel")?(d=(0,n.jsx)(w,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),a[7]=d):d=a[7];let c;a[8]!==e?(c=e("Foreign key"),a[8]=e,a[9]=c):c=a[9];let m;a[10]!==c?(m=(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[d,c]}),a[10]=c,a[11]=m):m=a[11];let i;return a[12]!==o||a[13]!==m?(i=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-xl border border-border bg-card/95 px-2.5 py-1.5 text-[11px] text-muted-foreground shadow-xs",children:[t,l,o,m]}),a[12]=o,a[13]=m,a[14]=i):i=a[14],i},"we"),ke=12,_e=u(a=>{let e=(0,v.c)(9),{containerRef:t,seedKey:l}=a,r=T(),{fitView:s}=B(),o;e[0]!==t||e[1]!==s||e[2]!==r?(o=u(()=>{if(!r)return;let c=u(()=>{I(s({duration:0,maxZoom:1.6,padding:.14}))},"c");c();let m=t.current;if(m===null)return;let i=new ResizeObserver(()=>{c()});return i.observe(m),()=>{i.disconnect()}},"o"),e[0]=t,e[1]=s,e[2]=r,e[3]=o):o=e[3];let d;return e[4]!==t||e[5]!==s||e[6]!==r||e[7]!==l?(d=[t,s,r,l],e[4]=t,e[5]=s,e[6]=r,e[7]=l,e[8]=d):d=e[8],(0,h.useEffect)(o,d),null},"Me"),He=u(({columnsError:a,fill:e=!1,nodeClasses:t,tables:l,testIdPrefix:r})=>{let s=M(),[o,d]=(0,h.useState)(ve),[c,m]=(0,h.useState)(""),i=(0,h.useMemo)(()=>{let g=c.trim().toLowerCase();return l.filter(P=>o[P.tier]&&P.name.toLowerCase().includes(g))},[l,o,c]),f=(0,h.useMemo)(()=>Ce(i,a??!1,t??we),[i,a,t]),p=(0,h.useMemo)(()=>Se(i),[i]),x=i.map(g=>g.name).join(","),[b,R,ee]=H(f),[te,F,ae]=L(p),S=(0,h.useRef)(null);(0,h.useEffect)(()=>{R(f)},[f,R]),(0,h.useEffect)(()=>{F(p)},[p,F]);let re=u(g=>{m(g.target.value)},"j"),oe=u(()=>{d(g=>({...g,shard:!g.shard}))},"q"),ne=u(()=>{d(g=>({...g,global:!g.global}))},"Q");return l.length===0?(0,n.jsx)("section",{className:"flex flex-col gap-2","data-testid":`${r}-section`,children:(0,n.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":`${r}-empty`,children:s("No tables to graph.")})}):(0,n.jsx)("section",{className:N("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${r}-section`,children:(0,n.jsx)("div",{className:N("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${r}-canvas`,ref:S,children:(0,n.jsxs)(j,{edges:te,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:b,nodesConnectable:!1,nodeTypes:ye,onEdgesChange:ae,onNodesChange:ee,children:[(0,n.jsx)(V,{}),(0,n.jsx)(z,{position:"top-left",children:(0,n.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[(0,n.jsx)(K,{"aria-label":s("Find table\u2026"),className:"h-7 w-44 text-xs","data-testid":`${r}-find`,onChange:re,placeholder:s("Find table\u2026"),value:c}),(0,n.jsxs)("div",{"aria-label":s("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[(0,n.jsxs)(k,{"aria-pressed":o.shard,className:"gap-1.5","data-testid":`${r}-tier-shard`,onClick:oe,size:"xs",type:"button",variant:o.shard?"default":"outline",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:U}),y.shard.label]}),(0,n.jsxs)(k,{"aria-pressed":o.global,className:"gap-1.5","data-testid":`${r}-tier-global`,onClick:ne,size:"xs",type:"button",variant:o.global?"default":"outline",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:X}),y.global.label]})]})]})}),(0,n.jsx)(z,{position:"bottom-center",children:(0,n.jsx)($e,{})}),(0,n.jsx)(Z,{showInteractive:!1}),i.length>ke&&(0,n.jsx)(q,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),(0,n.jsx)(D,{containerRef:S,filenameBase:`${r}-schema-diagram`,testIdPrefix:r}),(0,n.jsx)(_e,{containerRef:S,seedKey:x})]})})})},"Ge");export{He as a};
@@ -0,0 +1 @@
1
+ import{c as l}from"./chunk-3YXASVTP.js";import{j as u}from"./chunk-BOMPSVRC.js";import{a as c}from"./chunk-QAQDMS6R.js";import{a as t,d as o,e as h,g as z,i as d}from"./chunk-I26MS5PJ.js";var p=o(h(),1);var a=p.forwardRef(t(function(e,r){let{render:n,className:k,disabled:s=!1,focusableWhenDisabled:g=!1,nativeButton:f=!0,style:B,...b}=e,{getButtonProps:m,buttonRef:x}=l({disabled:s,focusableWhenDisabled:g,native:f});return u("button",e,{state:{disabled:s},ref:[r,x],props:[b,m]})},"Button"));var v=o(z(),1);var y=c("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",xs:"h-6 gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-md px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",icon:"size-8","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-md","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function W({className:i,variant:e="default",size:r="default",...n}){return(0,v.jsx)(a,{"data-slot":"button",className:d(y({variant:e,size:r,className:i})),...n})}t(W,"v");export{W as a};
@@ -0,0 +1 @@
1
+ import{a as Oe,b as _e}from"./chunk-NGVP66OH.js";import{i as je,k as He}from"./chunk-GHQ2VDI2.js";import{a as Re,b as ye,c as Ie,d as Ee,e as Pe,g as Be,h as Ve}from"./chunk-E4PXACVL.js";import{I as Ae,J as Me,K as Se,L as Le,M as Fe,N as Te,b as U,l as De}from"./chunk-MVWZMWPD.js";import{b as we,c as Ge}from"./chunk-3YXASVTP.js";import{a as M,e as Ne}from"./chunk-AUAECCXB.js";import{a as Ce,c as ke,e as ge,i as ve,j as H}from"./chunk-BOMPSVRC.js";import{a as i,c as It,d as C,e as A,f as Et,g as xe,i as he}from"./chunk-I26MS5PJ.js";var Qe=C(Et(),1);var V={};It(V,{Indicator:()=>$e,Root:()=>Ye});var l=C(A(),1);function Ue(o){if(!o)return null;for(let e of o.elements){let r=e.tagName;if(r==="BUTTON"||r==="INPUT"){let a=e;if(a.type==="submit")return a}}return null}i(Ue,"getDefaultFormSubmitter");var qe="data-checked",We="data-unchecked";function q(o){return{checked(e){return o.indeterminate?{}:e?{[qe]:""}:{[We]:""}},...Re}}i(q,"getCheckboxStateAttributesMapping");var ze=C(A(),1);function Ke(o,e,r,a=!0,s){let[f,p]=ze.useState(),P=U(s?`${s}-label`:void 0),b=o??e??f;return M(()=>{let x=o||e||!a?void 0:Nt(r.current,P);f!==x&&p(x)}),b}i(Ke,"useAriaLabelledBy");function Nt(o,e){let r=Dt(o);if(r)return!r.id&&e&&(r.id=e),r.id||void 0}i(Nt,"getAriaLabelledBy");function Dt(o){if(!o)return;let e=o.parentElement;if(e&&e.tagName==="LABEL")return e;let r=o.id;if(r){let s=o.nextElementSibling;if(s&&s.htmlFor===r)return s}let a=o.labels;return a&&a[0]}i(Dt,"findAssociatedLabel");var W=C(A(),1);var Bt=W.createContext(void 0);function Je(){return W.useContext(Bt)}i(Je,"useCheckboxGroupContext");var z=C(A(),1);var ie=z.createContext(void 0);function Xe(){let o=z.useContext(ie);if(o===void 0)throw new Error(ke(14));return o}i(Xe,"useCheckboxRootContext");var S=C(xe(),1);var At="data-parent",Ye=l.forwardRef(i(function(e,r){let{checked:a,className:s,defaultChecked:f=!1,"aria-labelledby":p,disabled:P=!1,form:b,id:x,indeterminate:N=!1,inputRef:X,name:L,onCheckedChange:F,parent:u=!1,readOnly:y=!1,render:ae,required:I=!1,uncheckedValue:T,value:O,nativeButton:_=!1,style:Mt,...Ze}=e,{clearErrors:et}=Ie(),{disabled:tt,name:ot,setDirty:rt,setFilled:se,setFocused:de,setTouched:nt,state:ce,validationMode:it,validityData:at,validation:st}=ye(),dt=Be(),{labelId:ct,registerControlId:ut,getDescriptionProps:ue}=Ee(),n=Je(),k=n?.allValues===void 0?void 0:n.parent,w=k!==void 0,c=tt||dt.disabled||n?.disabled||P,E=ot??L,d=O??E,le=U(),lt=n?.registerControlId!==ut,Y=Pe({id:x||void 0,enabled:lt}),ft=_?Y:le,$={};w&&(u?$=k.getParentProps():d!==void 0&&($=k.getChildProps(d)));let{checked:fe=a,indeterminate:pt=N,onCheckedChange:mt,...bt}=$,Q=n?.value,G=l.useRef(null),{getButtonProps:xt,buttonRef:ht}=Ge({disabled:c,native:_}),D=n?.validation??st,[m,Ct]=Se({controlled:d!==void 0&&Q!==void 0&&!u?Q.includes(d):fe,default:f,name:"Checkbox",state:"checked"}),Z=w?!!fe:m,B=w&&pt||N;Ve(G,le,m,void 0,!n&&!c,L);let ee=k?.registerChildId,g=l.useRef(null),pe=D.registerInput,me=n?d:void 0,kt=l.useCallback(t=>pe(t,{controlRef:G,value:me}),[pe,me]),gt=ge(X,g,u?void 0:kt),vt=Ke(p,ct,g,!_,Y);M(()=>{g.current&&(g.current.indeterminate=B),n||se(m)},[m,B,n,se]),Le(m,()=>{n||(et(E),rt(m!==at.initialValue),D.change(m))});let Rt=Ce({checked:m,disabled:c,form:b,name:u?void 0:E,id:_?void 0:Y,required:I,ref:gt,style:E?_e:Oe,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(t){if(t.nativeEvent.defaultPrevented)return;if(y){t.preventDefault();return}let h=t.currentTarget.checked,v=Te(Fe.none,t.nativeEvent);if(F?.(h,v),!v.isCanceled&&(mt?.(h,v),!v.isCanceled&&(Ct(h),d!==void 0&&n!==void 0&&!u&&!w))){let R=h?[...n.value,d]:n.value.filter(j=>j!==d);n.setValue(R,v)}},onClick(t){t.stopPropagation()},onFocus(){G.current?.focus()}},O!==void 0?{value:(n?m&&O:O)||""}:ve,ue,t=>D.getValidationProps(c,t));l.useEffect(()=>{if(!k||d===void 0)return;let t=k.disabledStatesRef.current;return t.set(d,c),()=>{t.delete(d)}},[k,c,d]);let te=l.useMemo(()=>({...ce,checked:Z,disabled:c,readOnly:y,required:I,indeterminate:B}),[ce,Z,c,y,I,B]),yt=q(te),be=H("span",e,{state:te,ref:[ht,G,r],props:[{id:ft,role:"checkbox","aria-checked":B?"mixed":Z,"aria-readonly":y||void 0,"aria-required":I||void 0,"aria-labelledby":vt,[At]:u?"":void 0,onFocus(){c||de(!0)},onBlur(){let t=g.current;t&&(nt(!0),de(!1),it==="onBlur"&&D.commit(n?Q:t.checked))},onKeyDown(t){if(t.key!=="Enter"||(t.preventBaseUIHandler(),t.defaultPrevented))return;let h=g.current?.form??null,v=t.currentTarget,R=t.nativeEvent,j=t.preventDefault,re=R.preventDefault,ne=!1;t.preventDefault=()=>{ne=!0,j.call(t)},R.preventDefault=()=>{ne=!0,re.call(R)},re.call(R),Ne(v).queueMicrotask(()=>{t.preventDefault=j,R.preventDefault=re,ne||Ue(h)?.click()})},onClick(t){if(y||c)return;t.preventDefault();let h=g.current;h&&we(h,t)}},Ze,bt,xt,ue,t=>D.getValidationProps(c,t)],stateAttributesMapping:yt}),oe=be.props.id;return M(()=>{if(!(!ee||u||d===void 0||oe===void 0))return ee(d,oe)},[ee,u,d,oe]),(0,S.jsxs)(ie.Provider,{value:te,children:[be,!m&&!n&&E&&!u&&T!==void 0&&(0,S.jsx)("input",{type:"hidden",form:b,name:E,value:T,disabled:c}),(0,S.jsx)("input",{...Rt,suppressHydrationWarning:!0})]})},"CheckboxRoot"));var K=C(A(),1);var $e=K.forwardRef(i(function(e,r){let{render:a,className:s,style:f,keepMounted:p=!1,...P}=e,b=Xe(),x=b.checked||b.indeterminate,{mounted:N,transitionStatus:X,setMounted:L}=Me(x),F=K.useRef(null),u={...b,transitionStatus:X};Ae({batch:!0,enabled:!x,open:x,ref:F,onComplete(){x||L(!1)}});let ae={...q(b),...De},I=p||N,T=H("span",e,{ref:[r,F],state:u,stateAttributesMapping:ae,props:P});return I?T:null},"CheckboxIndicator"));var J=C(xe(),1);function Fo(o){let e=(0,Qe.c)(9),r,a;e[0]!==o?({className:r,...a}=o,e[0]=o,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let s;e[3]!==r?(s=he("peer relative flex size-4 shrink-0 items-center justify-center rounded-md border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",r),e[3]=r,e[4]=s):s=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=(0,J.jsx)(V.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:(0,J.jsx)(He,{icon:je,strokeWidth:2})}),e[5]=f):f=e[5];let p;return e[6]!==a||e[7]!==s?(p=(0,J.jsx)(V.Root,{"data-slot":"checkbox",className:s,...a,children:f}),e[6]=a,e[7]=s,e[8]=p):p=e[8],p}i(Fo,"v");export{Fo as a};
@@ -0,0 +1 @@
1
+ import{a as f,b as s,e as O}from"./chunk-I26MS5PJ.js";var _=s(i=>{"use strict";var E=O();function o(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}f(o,"formatProdErrorMessage");function a(){}f(a,"noop");var n={d:{f:a,r:f(function(){throw Error(o(522))},"r"),D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},S=Symbol.for("react.portal"),T=Symbol.for("react.recoverable"),l=Symbol.for("react.optimistic_key");function P(r,e,t){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:S,key:c==null?null:c===l?l:""+c,children:r,containerInfo:e,implementation:t}}f(P,"createPortal$1");var y=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}f(u,"getCrossOriginStringAs");i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n;i.browser=function(r){return{$$typeof:T,_reason:r}};i.createPortal=function(r,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(o(299));return P(r,e,null,t)};i.flushSync=function(r){var e=y.T,t=n.p;try{if(y.T=null,n.p=2,r)return r()}finally{y.T=e,n.p=t,n.d.f()}};i.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,n.d.C(r,e))};i.prefetchDNS=function(r){typeof r=="string"&&n.d.D(r)};i.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var t=e.as,c=u(t,e.crossOrigin),g=typeof e.integrity=="string"?e.integrity:void 0,d=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;t==="style"?n.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:c,integrity:g,fetchPriority:d}):t==="script"&&n.d.X(r,{crossOrigin:c,integrity:g,fetchPriority:d,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};i.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var t=u(e.as,e.crossOrigin);n.d.M(r,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0})}}else e==null&&n.d.M(r)};i.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var t=e.as,c=u(t,e.crossOrigin);n.d.L(r,t,{crossOrigin:c,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};i.preloadModule=function(r,e){if(typeof r=="string")if(e){var t=u(e.as,e.crossOrigin);n.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0})}else n.d.m(r)};i.requestFormReset=function(r){n.d.r(r)};i.unstable_batchedUpdates=function(r,e){return r(e)};i.useFormState=function(r,e,t){return y.H.useFormState(r,e,t)};i.useFormStatus=function(){return y.H.useHostTransitionStatus()};i.version="19.3.0"});var R=s((C,m)=>{"use strict";function v(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(v)}catch(r){console.error(r)}}f(v,"checkDCE");v(),m.exports=_()});export{R as a};
@@ -0,0 +1 @@
1
+ import{a as ae,d as le,e as ke,i as Ne,j as we,l as Se}from"./chunk-MK7SA3YV.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ye}from"./chunk-6HLARDYO.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as oe}from"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{i as me}from"./chunk-OQ6I6OXT.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ne}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{g as ue}from"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as re}from"./chunk-RWVIV3U7.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-HCTJKP5J.js";import{a as he,e as pe}from"./chunk-2IKDEUCX.js";import{d as Y,p as ge}from"./chunk-HJHSQPHW.js";import{a as c,d as te,e as Ae,f as qe,g as je,i as fe}from"./chunk-I26MS5PJ.js";var z=te(qe(),1);var E=te(Ae(),1);var n=te(je(),1);var Ie=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let l of r.nodes)(e===void 0||H(l)===e)&&t.add(l.id);if(e===void 0)return t;let a=new Set(t);for(let l of r.edges)d.has(l.kind)&&(t.has(l.from)&&a.add(l.to),t.has(l.to)&&a.add(l.from));return a},"Pe"),Ee=c((r,e,d,t)=>{let a=`lane:${r}`;return[{data:{label:e},id:a,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((l,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${l.detail??l.kind} \xB7 ${l.name}`,link:Pe(l)},extent:"parent",id:l.id,parentId:a,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let o of r.nodes)d.has(o.id)&&t.set(H(o),[...t.get(H(o))??[],o]);let a=[...r.modules.map(o=>({label:o.installed===!0?`${o.name} \xB7 ${e.componentLabel}`:o.name,lane:o.name})),{label:e.appLaneLabel,lane:Q}],l=[],i=0;for(let{label:o,lane:f}of a){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(l.push(...Ee(f,o,i,m)),i+=1)}let u=[];for(let o of r.edges)e.kinds.has(o.kind)&&d.has(o.from)&&d.has(o.to)&&u.push({animated:Me.has(o.kind),id:`${o.from}|${o.kind}|${o.to}`,label:o.kind,labelBgStyle:Fe,labelStyle:De,source:o.from,style:Be,target:o.to,type:"smoothstep"});return{edges:u,nodes:l}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),a;return e[0]!==t?(a=(0,n.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1],a},"qe"),Le={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=me(),{label:a,link:l}=d,i;e[0]!==l||e[1]!==t?(i=c(()=>{ge(t(l))},"u"),e[0]=l,e[1]=t,e[2]=i):i=e[2];let u=i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(le,{isConnectable:!1,position:ae.Left,style:Le,type:"target"}),e[3]=o):o=e[3];let f;e[4]!==a||e[5]!==u?(f=(0,n.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:a}),e[4]=a,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(le,{isConnectable:!1,position:ae.Right,style:Le,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,n.jsxs)(n.Fragment,{children:[o,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),a,l,i,u,o,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");o=j(Q),u=he,p="overflow-hidden py-0",i=pe,s="px-0",l=be,m="architecture-catalog";let L;e[13]!==t?(L=t("Module"),e[13]=t,e[14]=L):L=e[14];let I;e[15]!==L?(I=(0,n.jsx)(T,{children:L}),e[15]=L,e[16]=I):I=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,n.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,n.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,n.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==I||e[32]!==q?(h=(0,n.jsx)(xe,{children:(0,n.jsxs)(J,{children:[I,q,y,N]})}),e[29]=y,e[30]=N,e[31]=I,e[32]=q,e[33]=h):h=e[33],a=ve,f=d.modules.map(g=>(0,n.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,n.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,n.jsx)(ne,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,n.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,n.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=a,e[4]=l,e[5]=i,e[6]=u,e[7]=o,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else a=e[3],l=e[4],i=e[5],u=e[6],o=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==o||e[35]!==t?(b=o>0&&(0,n.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,n.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs",children:o})]}),e[34]=o,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==a||e[38]!==f||e[39]!==b?(x=(0,n.jsxs)(a,{children:[f,b]}),e[37]=a,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==l||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,n.jsxs)(l,{"data-testid":m,children:[h,x]}),e[41]=l,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,n.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,n.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[a,l]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),o;e[0]!==d.edges?(o=c(w=>d.edges.some(X=>X.kind===w),"n"),e[0]=d.edges,e[1]=o):o=e[1];let f=Ie.filter(o),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==a||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...a===ce?{}:{lane:a}}),e[6]=h,e[7]=p,e[8]=i,e[9]=a,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{l(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let L=j,I="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,n.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,n.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==a||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,n.jsxs)("select",{"aria-label":v,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":"architecture-module-filter",onChange:P,value:a,children:[k,N,M]}),e[26]=a,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,n.jsx)("button",{"aria-pressed":i.has(w),className:fe("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{L(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,n.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,n.jsx)(Ne,{}),G=(0,n.jsx)(we,{showInteractive:!1}),K=(0,n.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,n.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,n.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,n.jsxs)("section",{className:I,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),a=ue(),l;e[0]!==a?(l=c(()=>a.fetchArchitecture(),"r"),e[0]=a,e[1]=l):l=e[1];let i=ye(d,l,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,n.jsx)(oe,{className:"h-8 w-48"}),(0,n.jsx)(oe,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,o,f;e[18]!==u?(o=(0,n.jsx)(We,{manifest:u}),f=(0,n.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=o,e[20]=f):(o=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,n.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,n.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,n.jsx)(ne,{variant:"outline",children:u.unresolved.length})]}),(0,n.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==o||e[25]!==f||e[26]!==m?(h=(0,n.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[o,f,m]}),e[24]=o,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Ie)}c(Je,"We");function Qe(r){return(0,n.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,n.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
@@ -0,0 +1 @@
1
+ import{b as y}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as R}from"./chunk-3CTF6VCQ.js";import"./chunk-NCPW7WHO.js";import"./chunk-VZWZIIP6.js";import"./chunk-55UGUCQ6.js";import{a as v}from"./chunk-4ZEL6BYL.js";import{c as $}from"./chunk-C5NU4UZY.js";import"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as S}from"./chunk-RWVIV3U7.js";import{a as A,b as C,c as I,d as x,e as c,f as n}from"./chunk-HCTJKP5J.js";import{a as k,e as w}from"./chunk-2IKDEUCX.js";import{d as N}from"./chunk-HJHSQPHW.js";import{a as f,d as b,f as E,g as O}from"./chunk-I26MS5PJ.js";var j=b(E(),1);var r=b(O(),1);var _=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"I"),T={delete:2,list:3,read:0,write:1},B=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||T[t.on]-T[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"O"),q=f(()=>{let e=(0,j.c)(14),t=N(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(v.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=B(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(R,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(w,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(C,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(c,{children:t("Bucket")}),(0,r.jsx)(c,{children:t("Operation")}),(0,r.jsx)(c,{children:t("Key prefix")}),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(I,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(n,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(n,{children:(0,r.jsx)(y,{variant:"secondary",children:_(t,s.on)})}),(0,r.jsx)(n,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(n,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"M");export{q as default};
@@ -0,0 +1 @@
1
+ import{d as E}from"./chunk-BOMPSVRC.js";import{a as n,d as b,e as h}from"./chunk-I26MS5PJ.js";var y=b(h(),1);var T=n(()=>{},"noop"),K=typeof document<"u"?y.useLayoutEffect:T;var W=b(h(),1),l={...W};var a=l.useInsertionEffect,_=a&&a!==l.useLayoutEffect?a:t=>t();function q(t){let e=E(B).current;return e.next=t,_(e.effect),e.trampoline}n(q,"useStableCallback");function B(){let t={next:void 0,callback:O,trampoline:n((...e)=>t.callback?.(...e),"trampoline"),effect:n(()=>{t.callback=t.next},"effect")};return t}n(B,"createStableCallback");function O(){}n(O,"assertNotCalled");function s(){return typeof window<"u"}n(s,"hasWindow");function m(t){return N(t)?(t.nodeName||"").toLowerCase():"#document"}n(m,"getNodeName");function c(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}n(c,"getWindow");function V(t){var e;return(e=(N(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}n(V,"getDocumentElement");function N(t){return s()?t instanceof Node||t instanceof c(t).Node:!1}n(N,"isNode");function C(t){return s()?t instanceof Element||t instanceof c(t).Element:!1}n(C,"isElement");function L(t){return s()?t instanceof HTMLElement||t instanceof c(t).HTMLElement:!1}n(L,"isHTMLElement");function g(t){return!s()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof c(t).ShadowRoot}n(g,"isShadowRoot");function R(t){let{overflow:e,overflowX:i,overflowY:u,display:o}=v(t);return/auto|scroll|overlay|hidden|clip/.test(e+u+i)&&o!=="inline"&&o!=="contents"}n(R,"isOverflowElement");function J(t){return/^(table|td|th)$/.test(m(t))}n(J,"isTableElement");function $(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}n($,"isTopLayer");var A=/transform|translate|scale|rotate|perspective|filter/,H=/paint|layout|strict|content/,r=n(t=>!!t&&t!=="none","isNotNone"),d;function I(t){let e=C(t)?v(t):t;return r(e.transform)||r(e.translate)||r(e.scale)||r(e.rotate)||r(e.perspective)||!M()&&(r(e.backdropFilter)||r(e.filter))||A.test(e.willChange||"")||H.test(e.contain||"")}n(I,"isContainingBlock");function Q(t){let e=p(t);for(;L(e)&&!k(e);){if(I(e))return e;if($(e))return null;e=p(e)}return null}n(Q,"getContainingBlock");function M(){return d==null&&(d=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),d}n(M,"isWebKit");function k(t){return/^(html|body|#document)$/.test(m(t))}n(k,"isLastTraversableNode");function v(t){return c(t).getComputedStyle(t)}n(v,"getComputedStyle");function Z(t){return C(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}n(Z,"getNodeScroll");function p(t){if(m(t)==="html")return t;let e=t.assignedSlot||t.parentNode||g(t)&&t.host||V(t);return g(e)?e.host:e}n(p,"getParentNode");function D(t){let e=p(t);return k(e)?(t.ownerDocument||t).body:L(e)&&R(e)?e:D(e)}n(D,"getNearestOverflowAncestor");function S(t,e,i){var u;e===void 0&&(e=[]),i===void 0&&(i=!0);let o=D(t),x=o===((u=t.ownerDocument)==null?void 0:u.body),f=c(o);if(x){let w=F(f);return e.concat(f,f.visualViewport||[],R(o)?o:[],w&&i?S(w):[])}else return e.concat(o,S(o,[],i))}n(S,"getOverflowAncestors");function F(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}n(F,"getFrameElement");function nt(t){return t?.ownerDocument||document}n(nt,"ownerDocument");export{K as a,l as b,q as c,m as d,c as e,V as f,N as g,C as h,L as i,g as j,R as k,J as l,$ as m,I as n,Q as o,M as p,k as q,v as r,Z as s,p as t,S as u,F as v,nt as w};
@@ -0,0 +1 @@
1
+ import{a as f}from"./chunk-I26MS5PJ.js";function S(e,r,t){e.prototype=r.prototype=t,t.constructor=e}f(S,"default");function W(e,r){var t=Object.create(e.prototype);for(var n in r)t[n]=r[n];return t}f(W,"extend");function B(){}f(B,"Color");var C=.7,Y=1/C,R="\\s*([+-]?\\d+)\\s*",E="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",y="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Xe=/^#([0-9a-f]{3,8})$/,Se=new RegExp(`^rgb\\(${R},${R},${R}\\)$`),Ce=new RegExp(`^rgb\\(${y},${y},${y}\\)$`),Ee=new RegExp(`^rgba\\(${R},${R},${R},${E}\\)$`),Be=new RegExp(`^rgba\\(${y},${y},${y},${E}\\)$`),Ie=new RegExp(`^hsl\\(${E},${y},${y}\\)$`),_e=new RegExp(`^hsla\\(${E},${y},${y},${E}\\)$`),se={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};S(B,v,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:le,formatHex:le,formatHex8:je,formatHsl:Ye,formatRgb:ue,toString:ue});function le(){return this.rgb().formatHex()}f(le,"color_formatHex");function je(){return this.rgb().formatHex8()}f(je,"color_formatHex8");function Ye(){return ge(this).formatHsl()}f(Ye,"color_formatHsl");function ue(){return this.rgb().formatRgb()}f(ue,"color_formatRgb");function v(e){var r,t;return e=(e+"").trim().toLowerCase(),(r=Xe.exec(e))?(t=r[1].length,r=parseInt(r[1],16),t===6?xe(r):t===3?new d(r>>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):t===8?_(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):t===4?_(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=Se.exec(e))?new d(r[1],r[2],r[3],1):(r=Ce.exec(e))?new d(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=Ee.exec(e))?_(r[1],r[2],r[3],r[4]):(r=Be.exec(e))?_(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=Ie.exec(e))?he(r[1],r[2]/100,r[3]/100,1):(r=_e.exec(e))?he(r[1],r[2]/100,r[3]/100,r[4]):se.hasOwnProperty(e)?xe(se[e]):e==="transparent"?new d(NaN,NaN,NaN,0):null}f(v,"color");function xe(e){return new d(e>>16&255,e>>8&255,e&255,1)}f(xe,"rgbn");function _(e,r,t,n){return n<=0&&(e=r=t=NaN),new d(e,r,t,n)}f(_,"rgba");function Le(e){return e instanceof B||(e=v(e)),e?(e=e.rgb(),new d(e.r,e.g,e.b,e.opacity)):new d}f(Le,"rgbConvert");function H(e,r,t,n){return arguments.length===1?Le(e):new d(e,r,t,n??1)}f(H,"rgb");function d(e,r,t,n){this.r=+e,this.g=+r,this.b=+t,this.opacity=+n}f(d,"Rgb");S(d,H,W(B,{brighter(e){return e=e==null?Y:Math.pow(Y,e),new d(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?C:Math.pow(C,e),new d(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new d(k(this.r),k(this.g),k(this.b),L(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ce,formatHex:ce,formatHex8:Te,formatRgb:pe,toString:pe}));function ce(){return`#${N(this.r)}${N(this.g)}${N(this.b)}`}f(ce,"rgb_formatHex");function Te(){return`#${N(this.r)}${N(this.g)}${N(this.b)}${N((isNaN(this.opacity)?1:this.opacity)*255)}`}f(Te,"rgb_formatHex8");function pe(){let e=L(this.opacity);return`${e===1?"rgb(":"rgba("}${k(this.r)}, ${k(this.g)}, ${k(this.b)}${e===1?")":`, ${e})`}`}f(pe,"rgb_formatRgb");function L(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}f(L,"clampa");function k(e){return Math.max(0,Math.min(255,Math.round(e)||0))}f(k,"clampi");function N(e){return e=k(e),(e<16?"0":"")+e.toString(16)}f(N,"hex");function he(e,r,t,n){return n<=0?e=r=t=NaN:t<=0||t>=1?e=r=NaN:r<=0&&(e=NaN),new w(e,r,t,n)}f(he,"hsla");function ge(e){if(e instanceof w)return new w(e.h,e.s,e.l,e.opacity);if(e instanceof B||(e=v(e)),!e)return new w;if(e instanceof w)return e;e=e.rgb();var r=e.r/255,t=e.g/255,n=e.b/255,i=Math.min(r,t,n),o=Math.max(r,t,n),a=NaN,s=o-i,x=(o+i)/2;return s?(r===o?a=(t-n)/s+(t<n)*6:t===o?a=(n-r)/s+2:a=(r-t)/s+4,s/=x<.5?o+i:2-o-i,a*=60):s=x>0&&x<1?0:a,new w(a,s,x,e.opacity)}f(ge,"hslConvert");function me(e,r,t,n){return arguments.length===1?ge(e):new w(e,r,t,n??1)}f(me,"hsl");function w(e,r,t,n){this.h=+e,this.s=+r,this.l=+t,this.opacity=+n}f(w,"Hsl");S(w,me,W(B,{brighter(e){return e=e==null?Y:Math.pow(Y,e),new w(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?C:Math.pow(C,e),new w(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,r=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*r,i=2*t-n;return new d(Z(e>=240?e-240:e+120,i,n),Z(e,i,n),Z(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new w(de(this.h),j(this.s),j(this.l),L(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=L(this.opacity);return`${e===1?"hsl(":"hsla("}${de(this.h)}, ${j(this.s)*100}%, ${j(this.l)*100}%${e===1?")":`, ${e})`}`}}));function de(e){return e=(e||0)%360,e<0?e+360:e}f(de,"clamph");function j(e){return Math.max(0,Math.min(1,e||0))}f(j,"clampt");function Z(e,r,t){return(e<60?r+(t-r)*e/60:e<180?t:e<240?r+(t-r)*(240-e)/60:r)*255}f(Z,"hsl2rgb");function F(e,r,t,n,i){var o=e*e,a=o*e;return((1-3*e+3*o-a)*r+(4-6*o+3*a)*t+(1+3*e+3*o-3*a)*n+a*i)/6}f(F,"basis");function J(e){var r=e.length-1;return function(t){var n=t<=0?t=0:t>=1?(t=1,r-1):Math.floor(t*r),i=e[n],o=e[n+1],a=n>0?e[n-1]:2*i-o,s=n<r-1?e[n+2]:2*o-i;return F((t-n/r)*r,a,i,o,s)}}f(J,"default");function U(e){var r=e.length;return function(t){var n=Math.floor(((t%=1)<0?++t:t)*r),i=e[(n+r-1)%r],o=e[n%r],a=e[(n+1)%r],s=e[(n+2)%r];return F((t-n/r)*r,i,o,a,s)}}f(U,"default");var I=f(e=>()=>e,"default");function De(e,r){return function(t){return e+t*r}}f(De,"linear");function Oe(e,r,t){return e=Math.pow(e,t),r=Math.pow(r,t)-e,t=1/t,function(n){return Math.pow(e+n*r,t)}}f(Oe,"exponential");function be(e){return(e=+e)==1?T:function(r,t){return t-r?Oe(r,t,e):I(isNaN(r)?t:r)}}f(be,"gamma");function T(e,r){var t=r-e;return t?De(e,t):I(isNaN(e)?r:e)}f(T,"nogamma");var D=f((function e(r){var t=be(r);function n(i,o){var a=t((i=H(i)).r,(o=H(o)).r),s=t(i.g,o.g),x=t(i.b,o.b),l=T(i.opacity,o.opacity);return function(u){return i.r=a(u),i.g=s(u),i.b=x(u),i.opacity=l(u),i+""}}return f(n,"rgb"),n.gamma=e,n}),"rgbGamma")(1);function we(e){return function(r){var t=r.length,n=new Array(t),i=new Array(t),o=new Array(t),a,s;for(a=0;a<t;++a)s=H(r[a]),n[a]=s.r||0,i[a]=s.g||0,o[a]=s.b||0;return n=e(n),i=e(i),o=e(o),s.opacity=1,function(x){return s.r=n(x),s.g=i(x),s.b=o(x),s+""}}}f(we,"rgbSpline");var ze=we(J),Pe=we(U);function ee(e,r){r||(r=[]);var t=e?Math.min(r.length,e.length):0,n=r.slice(),i;return function(o){for(i=0;i<t;++i)n[i]=e[i]*(1-o)+r[i]*o;return n}}f(ee,"default");function ye(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}f(ye,"isNumberArray");function ve(e,r){var t=r?r.length:0,n=e?Math.min(t,e.length):0,i=new Array(n),o=new Array(t),a;for(a=0;a<n;++a)i[a]=M(e[a],r[a]);for(;a<t;++a)o[a]=r[a];return function(s){for(a=0;a<n;++a)o[a]=i[a](s);return o}}f(ve,"genericArray");function re(e,r){var t=new Date;return e=+e,r=+r,function(n){return t.setTime(e*(1-n)+r*n),t}}f(re,"default");function g(e,r){return e=+e,r=+r,function(t){return e*(1-t)+r*t}}f(g,"default");function te(e,r){var t={},n={},i;(e===null||typeof e!="object")&&(e={}),(r===null||typeof r!="object")&&(r={});for(i in r)i in e?t[i]=M(e[i],r[i]):n[i]=r[i];return function(o){for(i in t)n[i]=t[i](o);return n}}f(te,"default");var fe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ne=new RegExp(fe.source,"g");function Ve(e){return function(){return e}}f(Ve,"zero");function Qe(e){return function(r){return e(r)+""}}f(Qe,"one");function O(e,r){var t=fe.lastIndex=ne.lastIndex=0,n,i,o,a=-1,s=[],x=[];for(e=e+"",r=r+"";(n=fe.exec(e))&&(i=ne.exec(r));)(o=i.index)>t&&(o=r.slice(t,o),s[a]?s[a]+=o:s[++a]=o),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,x.push({i:a,x:g(n,i)})),t=ne.lastIndex;return t<r.length&&(o=r.slice(t),s[a]?s[a]+=o:s[++a]=o),s.length<2?x[0]?Qe(x[0].x):Ve(r):(r=x.length,function(l){for(var u=0,c;u<r;++u)s[(c=x[u]).i]=c.x(l);return s.join("")})}f(O,"default");function M(e,r){var t=typeof r,n;return r==null||t==="boolean"?I(r):(t==="number"?g:t==="string"?(n=v(r))?(r=n,D):O:r instanceof v?D:r instanceof Date?re:ye(r)?ee:Array.isArray(r)?ve:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?te:g)(e,r)}f(M,"default");var Ge=1e-12;function Me(e){return((e=Math.exp(e))+1/e)/2}f(Me,"cosh");function Ke(e){return((e=Math.exp(e))-1/e)/2}f(Ke,"sinh");function We(e){return((e=Math.exp(2*e))-1)/(e+1)}f(We,"tanh");var Ze=f((function e(r,t,n){function i(o,a){var s=o[0],x=o[1],l=o[2],u=a[0],c=a[1],p=a[2],h=u-s,b=c-x,m=h*h+b*b,$,A;if(m<Ge)A=Math.log(p/l)/r,$=f(function(X){return[s+X*h,x+X*b,l*Math.exp(r*X*A)]},"i");else{var Q=Math.sqrt(m),G=(p*p-l*l+n*m)/(2*l*t*Q),K=(p*p-l*l-n*m)/(2*p*t*Q),q=Math.log(Math.sqrt(G*G+1)-G),qe=Math.log(Math.sqrt(K*K+1)-K);A=(qe-q)/r,$=f(function(X){var ie=X*A,ae=Me(q),oe=l/(t*Q)*(ae*We(r*ie+q)-Ke(q));return[s+oe*h,x+oe*b,l*ae/Me(r*ie+q)]},"i")}return $.duration=A*1e3*r/Math.SQRT2,$}return f(i,"zoom"),i.rho=function(o){var a=Math.max(.001,+o),s=a*a,x=s*s;return e(a,s,x)},i}),"zoomRho")(Math.SQRT2,2,4);function $e(e,r){return e=+e,r=+r,function(t){return Math.round(e*(1-t)+r*t)}}f($e,"default");var Ne=180/Math.PI,z={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function P(e,r,t,n,i,o){var a,s,x;return(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a),(x=e*t+r*n)&&(t-=e*x,n-=r*x),(s=Math.sqrt(t*t+n*n))&&(t/=s,n/=s,x/=s),e*n<r*t&&(e=-e,r=-r,x=-x,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(r,e)*Ne,skewX:Math.atan(x)*Ne,scaleX:a,scaleY:s}}f(P,"default");var V;function ke(e){let r=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return r.isIdentity?z:P(r.a,r.b,r.c,r.d,r.e,r.f)}f(ke,"parseCss");function Re(e){return e==null?z:(V||(V=document.createElementNS("http://www.w3.org/2000/svg","g")),V.setAttribute("transform",e),(e=V.transform.baseVal.consolidate())?(e=e.matrix,P(e.a,e.b,e.c,e.d,e.e,e.f)):z)}f(Re,"parseSvg");function He(e,r,t,n){function i(l){return l.length?l.pop()+" ":""}f(i,"pop");function o(l,u,c,p,h,b){if(l!==c||u!==p){var m=h.push("translate(",null,r,null,t);b.push({i:m-4,x:g(l,c)},{i:m-2,x:g(u,p)})}else(c||p)&&h.push("translate("+c+r+p+t)}f(o,"translate");function a(l,u,c,p){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),p.push({i:c.push(i(c)+"rotate(",null,n)-2,x:g(l,u)})):u&&c.push(i(c)+"rotate("+u+n)}f(a,"rotate");function s(l,u,c,p){l!==u?p.push({i:c.push(i(c)+"skewX(",null,n)-2,x:g(l,u)}):u&&c.push(i(c)+"skewX("+u+n)}f(s,"skewX");function x(l,u,c,p,h,b){if(l!==c||u!==p){var m=h.push(i(h)+"scale(",null,",",null,")");b.push({i:m-4,x:g(l,c)},{i:m-2,x:g(u,p)})}else(c!==1||p!==1)&&h.push(i(h)+"scale("+c+","+p+")")}return f(x,"scale"),function(l,u){var c=[],p=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,c,p),a(l.rotate,u.rotate,c,p),s(l.skewX,u.skewX,c,p),x(l.scaleX,l.scaleY,u.scaleX,u.scaleY,c,p),l=u=null,function(h){for(var b=-1,m=p.length,$;++b<m;)c[($=p[b]).i]=$.x(h);return c.join("")}}}f(He,"interpolateTransform");var Fe=He(ke,"px, ","px)","deg)"),Je=He(Re,", ",")",")");function Ae(e,r){r===void 0&&(r=e,e=M);for(var t=0,n=r.length-1,i=r[0],o=new Array(n<0?0:n);t<n;)o[t]=e(i,i=r[++t]);return function(a){var s=Math.max(0,Math.min(n-1,Math.floor(a*=n)));return o[s](a-s)}}f(Ae,"piecewise");export{v as a,D as b,g as c,O as d,M as e,$e as f,Fe as g,Je as h,Ze as i,Ae as j};
@@ -0,0 +1 @@
1
+ import{a as se}from"./chunk-FPI7AMQJ.js";import{i as ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as W}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as G}from"./chunk-4ZEL6BYL.js";import{c as ne}from"./chunk-C5NU4UZY.js";import{g as V}from"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as B}from"./chunk-RWVIV3U7.js";import{a as j,b as D,c as F,d as x,e as i,f as d}from"./chunk-HCTJKP5J.js";import{a as R,e as _}from"./chunk-2IKDEUCX.js";import{d as X,f as Y,g as Z,h as $,m as ee,p as A}from"./chunk-HJHSQPHW.js";import{a as s,d as re,e as oe,g as le}from"./chunk-I26MS5PJ.js";var l=re(oe(),1);var e=re(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],de=["pause","resume","terminate"],ce="WORKFLOWS_NOT_CONFIGURED",ue=s(o=>typeof o=="object"&&o!==null&&o.code===ce,"ce"),me=s(o=>{let a=o.error??o.output;if(a===void 0)return"\u2014";try{return JSON.stringify(a,ee)}catch{return"(unserializable)"}},"ue"),fe=s(({loadDetail:o,loadInstances:a,readOnly:g,runAction:J,workflowName:k})=>{let T=V(),n=X(),[N,v]=(0,l.useState)(null),[C,I]=(0,l.useState)(null),[b,z]=(0,l.useState)(""),[y,p]=(0,l.useState)(null),[L,O]=(0,l.useState)(!1),[P,U]=(0,l.useState)(null),f=(0,l.useRef)(0),h=(0,l.useRef)(0),w=(0,l.useRef)(0),q=o??(r=>T.getWorkflowInstance(r)),E=g?void 0:J??(a===void 0?r=>T.setWorkflowInstanceStatus(r):void 0),K=s(async()=>{h.current+=1;let r=h.current;p(null),O(!1);let c=b===""?void 0:b;try{if(a===void 0){let u=await T.listWorkflowInstances({name:k,status:c});if(r!==h.current)return;if(u.configured===!1){v(null),O(!0);return}v(u.instances);return}let t=await a({name:k,status:c});r===h.current&&v(t)}catch(t){if(r!==h.current)return;v(null),ue(t)?O(!0):p($(t))}},"P");(0,l.useEffect)(()=>{f.current+=1,w.current+=1,I(null),A(K())},[k,b]);let M=s(async r=>{w.current+=1;let c=w.current;p(null);try{let t=await q({id:r,name:k});c===w.current&&I(t)}catch(t){c===w.current&&p($(t))}},"J"),H=s(()=>{w.current+=1,I(null)},"B"),Q=s(async(r,c)=>{if(E===void 0)return;let t=f.current;U(r),p(null);try{await E({action:c,id:r,name:k}),t===f.current&&await K()}catch(u){p($(u))}U(null)},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:n("Instance history")}),(0,e.jsxs)("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:s(r=>{z(r.target.value)},"onChange"),value:b,children:[(0,e.jsx)("option",{value:"",children:n("All statuses")}),ie.map(r=>(0,e.jsx)("option",{value:r,children:r},r))]})]}),y!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:y}),L&&(0,e.jsx)(B,{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")}),!L&&N!==null&&N.length===0&&(0,e.jsx)(B,{description:n("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:n("No instances")}),N!==null&&N.length>0&&(0,e.jsx)(R,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(j,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:n("Instance id")}),(0,e.jsx)(i,{children:n("Status")}),(0,e.jsx)(i,{children:n("Created")}),(0,e.jsx)(i,{children:n("Ended")}),(0,e.jsx)(i,{"aria-label":n("Actions")})]})}),(0,e.jsx)(F,{children:N.map(r=>(0,e.jsxs)(x,{"data-testid":`workflow-instance-${r.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:r.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:r.status}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:r.createdOn??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:r.endedOn??"\u2014"}),(0,e.jsx)(d,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(W,{"data-testid":`workflow-instance-steps-${r.id}`,onClick:s(()=>{A(M(r.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:n("Steps")}),E!==void 0&&de.map(c=>(0,e.jsx)(W,{"data-testid":`workflow-instance-${c}-${r.id}`,disabled:P===r.id,onClick:s(()=>{A(Q(r.id,c))},"onClick"),size:"sm",type:"button",variant:"ghost",children:n(c)},c))]})})]},r.id))})]})})}),C!==null&&(0,e.jsx)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[n("Steps")," \xB7 ",C.id]}),(0,e.jsx)(W,{"data-testid":"workflow-instance-detail-close",onClick:H,size:"xs",type:"button",variant:"ghost",children:n("Close")})]}),C.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:n("This instance has no recorded steps yet.")}):(0,e.jsxs)(j,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:n("Step")}),(0,e.jsx)(i,{children:n("Type")}),(0,e.jsx)(i,{children:n("Attempts")}),(0,e.jsx)(i,{children:n("Started")}),(0,e.jsx)(i,{children:n("Output")})]})}),(0,e.jsx)(F,{children:C.steps.map((r,c)=>(0,e.jsxs)(x,{"data-testid":`workflow-step-${String(c)}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:r.name}),(0,e.jsx)(d,{className:"text-xs text-muted-foreground",children:r.type??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:r.attempts??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:r.start??"\u2014"}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:me(r)})]},`${r.name}:${String(c)}`))})]})]})})]})},"me"),he=Y(G.createWorkflowInstance),pe=Y(G.getWorkflowInstanceStatus),we=s(o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"\u2014";try{return JSON.stringify(o.output,ee)}catch{return"(unserializable)"}},"pe"),xe=s((o,a)=>o.some(g=>g.exportName===a)?a:o[0]?.exportName??"","xe"),$e=s(()=>{let o=V(),a=X(),{data:g,error:J}=ne(G.listWorkflows,{}),[k,T]=(0,l.useState)(""),[n,N]=(0,l.useState)(""),[v,C]=(0,l.useState)(""),[I,b]=(0,l.useState)(!1),[z,y]=(0,l.useState)(null),[p,L]=(0,l.useState)([]),[O,P]=(0,l.useState)(null),U=g!==void 0,f=Array.isArray(g?.workflows)?[...g.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],h=xe(f,k),w=f.find(t=>t.exportName===h),q=s(t=>{L(u=>{let m=u.filter(S=>!(S.exportName===t.exportName&&S.id===t.id));return[t,...m]})},"D"),E=s(async()=>{let t=h;if(t==="")return;let u,m=v.trim();if(m!=="")try{u=JSON.parse(m)}catch{y(a("Params must be valid JSON"));return}b(!0),y(null);try{let S=n.trim(),te=await o.query(he,{exportName:t,id:S===""?void 0:S,params:u},Z(""));q({exportName:t,id:te.id,status:te.status}),N("")}catch(S){y($(S))}b(!1)},"Q"),K=s(()=>{A(E())},"V"),M=s(async(t,u)=>{P(u);try{let m=await o.query(pe,{exportName:t,id:u},Z(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){y($(m))}P(null)},"O"),H=s(t=>{T(t.target.value)},"P"),Q=s(t=>{N(t.target.value)},"J"),r=s(t=>{C(t.target.value)},"B"),c=s(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&A(M(u,m))},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[J!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:J}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:a("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&f.length===0?(0,e.jsx)(B,{description:a("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:a("No workflows defined")}):(0,e.jsx)(R,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(j,{"data-testid":"workflows-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:a("Export")}),(0,e.jsx)(i,{children:a("Name")}),(0,e.jsx)(i,{children:a("Class")})]})}),(0,e.jsx)(F,{children:f.map(t=>(0,e.jsxs)(x,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.className})]},t.exportName))})]})})}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:a("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":a("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:H,value:h,children:f.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(ae,{"aria-label":a("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:Q,placeholder:a("Instance id (optional)"),value:n}),(0,e.jsx)(W,{"data-testid":"workflows-start-button",disabled:I||h==="",onClick:K,children:a(I?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(se,{"aria-label":a("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:r,placeholder:a("Params (JSON, optional)"),value:v})]}),p.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:a("Instances")}),(0,e.jsx)(R,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(j,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(D,{children:(0,e.jsxs)(x,{children:[(0,e.jsx)(i,{children:a("Workflow")}),(0,e.jsx)(i,{children:a("Instance id")}),(0,e.jsx)(i,{children:a("Status")}),(0,e.jsx)(i,{children:a("Output")}),(0,e.jsx)(i,{})]})}),(0,e.jsx)(F,{children:p.map(t=>(0,e.jsxs)(x,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:we(t)}),(0,e.jsx)(d,{children:(0,e.jsx)(W,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:O===t.id,onClick:c,size:"xs",variant:"outline",children:O===t.id?a("Refreshing\u2026"):a("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),w!==void 0&&(0,e.jsx)(fe,{workflowName:w.name})]})},"We");export{$e as default};
@@ -0,0 +1 @@
1
+ import{a as q}from"./chunk-KQSQVNVI.js";import{a as k}from"./chunk-6QTAHSDD.js";import"./chunk-VESGIGMQ.js";import"./chunk-WIASRPIC.js";import"./chunk-AUGKHAMQ.js";import"./chunk-WJRYEML4.js";import{a as A}from"./chunk-R6U22RSY.js";import{a as $}from"./chunk-YVR4SEPU.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-OQ6I6OXT.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as K}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as F}from"./chunk-3CTF6VCQ.js";import"./chunk-NCPW7WHO.js";import"./chunk-VZWZIIP6.js";import"./chunk-55UGUCQ6.js";import{a as T}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-C5NU4UZY.js";import"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as O}from"./chunk-RWVIV3U7.js";import{a as j,e as w}from"./chunk-2IKDEUCX.js";import{d as I,t as E}from"./chunk-HJHSQPHW.js";import{a as p,d as C,f as D,g as H}from"./chunk-I26MS5PJ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
@@ -0,0 +1 @@
1
+ import{a as r,d as p,e as m}from"./chunk-I26MS5PJ.js";function d(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}r(d,"mergeObjects");var y={};function h(e,t,n,o,i){if(!n&&!o&&!i&&!e)return R(t);let c=R(e);return t&&(c=E(c,t)),n&&(c=E(c,n)),o&&(c=E(c,o)),i&&(c=E(c,i)),c}r(h,"mergeProps");function x(e){if(e.length===0)return y;if(e.length===1)return R(e[0]);let t=R(e[0]);for(let n=1;n<e.length;n+=1)t=E(t,e[n]);return t}r(x,"mergePropsN");function R(e){return b(e)?{...T(e,y)}:J(e)}r(R,"createInitialMergedProps");function E(e,t){return b(t)?T(t,e):q(e,t)}r(E,"mergeInto");function J(e){let t={...e};for(let n in t){let o=t[n];O(n,o)&&(t[n]=k(o))}return t}r(J,"copyInitialProps");function q(e,t){if(!t)return e;for(let n in t){let o=t[n];switch(n){case"style":{e[n]=d(e.style,o);break}case"className":{e[n]=g(e.className,o);break}default:O(n,o)?e[n]=K(e[n],o):e[n]=o}}return e}r(q,"mutablyMergeInto");function O(e,t){let n=e.charCodeAt(0),o=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&o===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}r(O,"isEventHandler");function b(e){return typeof e=="function"}r(b,"isPropsGetter");function T(e,t){return b(e)?e(t):e??y}r(T,"resolvePropsGetter");function K(e,t){return t?e?(...n)=>{let o=n[0];if(_(o)){let c=o;M(c);let s=t(...n);return c.baseUIHandlerPrevented||e?.(...n),s}let i=t(...n);return e?.(...n),i}:k(t):e}r(K,"mergeEventHandlers");function k(e){return e&&((...t)=>{let n=t[0];return _(n)&&M(n),e(...t)})}r(k,"wrapEventHandler");function M(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}r(M,"makeEventPreventable");function g(e,t){return t?e?t+" "+e:t:e}r(g,"mergeClassNames");function _(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}r(_,"isSyntheticEvent");function Q(e,t){return r(function(o,...i){let c=new URL(e);return c.searchParams.set("code",o.toString()),i.forEach(s=>c.searchParams.append("args[]",s)),`${t} error #${o}; visit ${c} for the full message.`},"formatErrorMessage")}r(Q,"createFormatErrorMessage");var X=Q("https://base-ui.com/production-error","Base UI"),L=X;var a=p(m(),1);var j=p(m(),1);var V={};function v(e,t){let n=j.useRef(V);return n.current===V&&(n.current=e(t)),n}r(v,"useRefWithInit");function A(e,t,n,o){let i=v(S).current;return ee(i,e,t,n,o)&&$(i,[e,t,n,o]),i.callback}r(A,"useMergedRefs");function U(e){let t=v(S).current;return te(t,e)&&$(t,e),t.callback}r(U,"useMergedRefsN");function S(){return{callback:null,cleanup:null,refs:[]}}r(S,"createForkRef");function ee(e,t,n,o,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==o||e.refs[3]!==i}r(ee,"didChange");function te(e,t){return e.refs.length!==t.length||e.refs.some((n,o)=>n!==t[o])}r(te,"didChangeN");function $(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){let o=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){let c=t[i];if(c!=null)switch(typeof c){case"function":{let s=c(n);typeof s=="function"&&(o[i]=s);break}case"object":{c.current=n;break}default:}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){let c=t[i];if(c!=null)switch(typeof c){case"function":{let s=o[i];typeof s=="function"?s():c(null);break}case"object":{c.current=null;break}default:}}}}}}r($,"update");var z=p(m(),1);var B=p(m(),1);var ne=parseInt(B.version,10);function Y(e){return ne>=e}r(Y,"isReactVersionAtLeast");function N(e){if(!z.isValidElement(e))return null;let t=e,n=t.props;return(Y(19)?n?.ref:t.ref)??null}r(N,"getReactElementRef");function we(){}r(we,"NOOP");var Ce=Object.freeze([]),l=Object.freeze({});function D(e,t){let n={};for(let o in e){let i=e[o];if(t?.hasOwnProperty(o)){let c=t[o](i);c!=null&&Object.assign(n,c);continue}i===!0?n[`data-${o.toLowerCase()}`]="":i&&(n[`data-${o.toLowerCase()}`]=i.toString())}return n}r(D,"getStateAttributesProps");function F(e,t){return typeof e=="function"?e(t):e}r(F,"resolveClassName");function W(e,t){return typeof e=="function"?e(t):e}r(W,"resolveStyle");var P=p(m(),1);function We(e,t,n={}){let o=t.render;n.enabled!==!1&&(o=ce(o));let i=re(t,n,o);if(n.enabled===!1)return null;let c=n.state??l;return se(e,o,i,c)}r(We,"useRenderElement");function re(e,t,n){let{className:o,style:i}=e,{state:c=l,ref:s,props:I,stateAttributesMapping:Z,enabled:f=!0}=t,w=f?F(o,c):void 0,C=f?W(i,c):void 0,G=f?D(c,Z):l,H=f&&I?oe(I):void 0,u=f?d(G,H)??{}:l;return typeof document<"u"&&(f?Array.isArray(s)?u.ref=U([u.ref,N(n),...s]):u.ref=A(u.ref,N(n),s):A(null,null)),f?(w!==void 0&&(u.className=g(u.className,w)),C!==void 0&&(u.style=d(u.style,C)),u):l}r(re,"useRenderElementProps");function oe(e){return Array.isArray(e)?x(e):h(void 0,e)}r(oe,"resolveRenderFunctionProps");var ie=Symbol.for("react.lazy");function ce(e){if(e?.$$typeof!==ie)return e;let t=a.Children.toArray(e)[0];return a.isValidElement(t)?t:e}r(ce,"unwrapLazyRenderProp");function se(e,t,n,o){if(t){if(typeof t=="function")return t(n,o);let i=h(n,t.props);return i.ref=n.ref,a.cloneElement(t,i)}if(e&&typeof e=="string")return ue(e,n);throw new Error(L(8))}r(se,"evaluateRenderProp");function ue(e,t){return e==="button"?(0,P.createElement)("button",{type:"button",...t,key:t.key}):e==="img"?(0,P.createElement)("img",{alt:"",...t,key:t.key}):a.createElement(e,t)}r(ue,"renderTag");export{h as a,M as b,L as c,v as d,A as e,Y as f,we as g,Ce as h,l as i,We as j};
@@ -0,0 +1 @@
1
+ import{i as k}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as q}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as j}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as U}from"./chunk-3CTF6VCQ.js";import"./chunk-NCPW7WHO.js";import"./chunk-VZWZIIP6.js";import"./chunk-55UGUCQ6.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as P}from"./chunk-C5NU4UZY.js";import"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as M}from"./chunk-RWVIV3U7.js";import{a as G,b as H,c as J,d as B,e as x,f as N}from"./chunk-HCTJKP5J.js";import{a as z,e as D}from"./chunk-2IKDEUCX.js";import{d as F,t as O}from"./chunk-HJHSQPHW.js";import{a as A,d as T,e as $,f as X,g as Y}from"./chunk-I26MS5PJ.js";var K=T(X(),1),Q=T($(),1);var t=T(Y(),1);var de=A(()=>{let e=(0,K.c)(39),a=F(),[s,V]=(0,Q.useState)(""),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:C,error:l,errorSource:S,isLoading:E,refetch:_}=P(R.getAuthAuditLog,y),I;if(e[1]!==C?.entries||e[2]!==s){let r=C?.entries??[],v=s.trim().toLowerCase();I=v===""?r:r.filter(w=>w.event.toLowerCase().includes(v)||(w.actorId??"").toLowerCase().includes(v)||(w.actorEmail??"").toLowerCase().includes(v)||(w.ip??"").toLowerCase().includes(v)||w.outcome.toLowerCase().includes(v)),e[1]=C?.entries,e[2]=s,e[3]=I}else I=e[3];let o=I,L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A(r=>{V(r.target.value)},"I"),e[4]=L):L=e[4];let W=L,i;e[5]!==a?(i=a("Filter security events"),e[5]=a,e[6]=i):i=e[6];let n;e[7]!==a?(n=a("filter event, actor, IP"),e[7]=a,e[8]=n):n=e[8];let c;e[9]!==s||e[10]!==i||e[11]!==n?(c=(0,t.jsx)(k,{"aria-label":i,className:"h-8 w-56","data-testid":"aa-search",onChange:W,placeholder:n,value:s}),e[9]=s,e[10]=i,e[11]=n,e[12]=c):c=e[12];let d;e[13]!==_?(d=A(()=>{_()},"m"),e[13]=_,e[14]=d):d=e[14];let m;e[15]!==a?(m=a("Refresh"),e[15]=a,e[16]=m):m=e[16];let u;e[17]!==d||e[18]!==m?(u=(0,t.jsx)(q,{"data-testid":"aa-refresh",onClick:d,size:"xs",type:"button",variant:"ghost",children:m}),e[17]=d,e[18]=m,e[19]=u):u=e[19];let h;e[20]!==c||e[21]!==u?(h=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u]}),e[20]=c,e[21]=u,e[22]=h):h=e[22];let f;e[23]!==l||e[24]!==S?(f=l!==null&&(0,t.jsx)(U,{error:S,testId:"aa-error"}),e[23]=l,e[24]=S,e[25]=f):f=e[25];let p;e[26]!==l||e[27]!==o.length||e[28]!==E||e[29]!==a?(p=l===null&&!E&&o.length===0&&(0,t.jsx)(M,{description:a("Authentication and security events are recorded here."),testId:"aa-empty",title:a("No security events.")}),e[26]=l,e[27]=o.length,e[28]=E,e[29]=a,e[30]=p):p=e[30];let g;e[31]!==o||e[32]!==a?(g=o.length>0&&(0,t.jsx)(z,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"aa-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(x,{children:a("time")}),(0,t.jsx)(x,{children:a("event")}),(0,t.jsx)(x,{children:a("actor")}),(0,t.jsx)(x,{children:a("ip / user agent")}),(0,t.jsx)(x,{children:a("outcome")})]})}),(0,t.jsx)(J,{children:o.map(r=>(0,t.jsxs)(B,{"data-testid":"aa-row",children:[(0,t.jsx)(N,{className:"text-muted-foreground tabular-nums",children:O(r.ts,"\u2014")}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:"secondary",children:r.event})}),(0,t.jsx)(N,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsxs)(N,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),r.userAgent!==void 0&&(0,t.jsxs)("span",{className:"ml-1 opacity-70",children:["\xB7 ",r.userAgent]})]}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:r.outcome==="failure"?"destructive":"outline",children:a(r.outcome)})})]},r.seq))})]})})}),e[31]=o,e[32]=a,e[33]=g):g=e[33];let b;return e[34]!==f||e[35]!==p||e[36]!==g||e[37]!==h?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[h,f,p,g]}),e[34]=f,e[35]=p,e[36]=g,e[37]=h,e[38]=b):b=e[38],b},"ne");export{de as default};
@@ -0,0 +1 @@
1
+ import{b as j,c as v,d as D,g}from"./chunk-23DA2KK5.js";import{f as S,g as w,h as P,p as q}from"./chunk-HJHSQPHW.js";import{a as i,d as A,e as x,f as M}from"./chunk-I26MS5PJ.js";var E=A(M(),1);var p=A(x(),1);var I=300,l=i(t=>typeof t=="string"?t===""?void 0:t:typeof t=="number"||typeof t=="boolean"?String(t):void 0,"a"),u=i(t=>t.filter(r=>r!==void 0).join(" "),"c"),T=i(t=>{let r=Array.isArray(t.filters)?t.filters.length:0,e=typeof t.search=="string"&&t.search!=="";return r===0&&!e?"no predicate":u([r===0?void 0:`${String(r)} filters`,e?"search":void 0])},"q"),N={clearTable:i(t=>u([l(t.table),"whole table"]),"clearTable"),deleteRows:i(t=>u([l(t.table),T(t)]),"deleteRows"),facetColumn:i(t=>u([l(t.table),l(t.column)]),"facetColumn"),importShard:i(t=>{if(!Array.isArray(t.rows))return"";let r=[...new Set(t.rows.filter(e=>typeof e=="object"&&e!==null).map(e=>e.table).filter(e=>typeof e=="string"))].toSorted((e,s)=>e.localeCompare(s));return u([`${String(t.rows.length)} rows`,r.length===0?void 0:`into ${r.join(", ")}`])},"importShard"),lintSql:i(()=>"sql","lintSql"),patchRows:i(t=>u([l(t.table),typeof t.doc=="object"&&t.doc!==null?`set ${Object.keys(t.doc).join(", ")}`:void 0,T(t)]),"patchRows"),pitrRestore:i(t=>u([l(t.time)===void 0?void 0:`to ${String(t.time)}`,typeof t.bookmark=="string"&&t.bookmark!==""?"from bookmark":void 0,t.restart===!0?"restart now":void 0]),"pitrRestore"),readTablePage:i(t=>u([l(t.table),Array.isArray(t.filters)&&t.filters.length>0?`${String(t.filters.length)} filters`:void 0,typeof t.search=="string"&&t.search!==""?"search":void 0,typeof t.limit=="number"?`limit ${String(t.limit)}`:void 0]),"readTablePage"),runMigration:i(t=>u([l(t.id),l(t.direction),t.dryRun===!0?"dry-run":void 0]),"runMigration"),runSql:i(t=>typeof t.sql=="string"?`${String(t.sql.length)} chars`:"","runSql"),schemaVersion:i(t=>typeof t.hash=="string"?t.hash.slice(0,8):"","schemaVersion"),writeRow:i(t=>u([l(t.table),"1 row"]),"writeRow")},$="__lunora_admin__:",F=i((t,r)=>{let e=t.startsWith($)?t.slice($.length):t,s=N[e];if(s!==void 0)return s(r);let n=Object.keys(r);return n.length===0?"":n.join(", ")},"M"),V=i(t=>{if(Array.isArray(t))return t.length;if(!(typeof t!="object"||t===null)){for(let r of Object.values(t))if(Array.isArray(r))return r.length}},"K"),k=class{static{i(this,"x")}entries=[];listeners=new Set;nextSeq=1;getSnapshot=i(()=>this.entries,"getSnapshot");subscribe=i(r=>(this.listeners.add(r),()=>{this.listeners.delete(r)}),"subscribe");start(r,e,s){return this.append(r,e,s,"call","pending")}startSubscription(r,e,s){return this.append(r,e,s,"subscription","live")}recordPush(r){if(this.listeners.size===0){let e=this.entries.find(s=>s.seq===r);e!==void 0&&(e.pushes=(e.pushes??0)+1);return}this.patch(r,e=>({...e,pushes:(e.pushes??0)+1}))}failSubscription(r,e){this.patch(r,s=>({...s,error:e,status:"error"}))}endSubscription(r){this.patch(r,e=>e.status==="error"?e:{...e,durationMs:Date.now()-e.startedAt,status:"closed"})}lastErrorSeq(){return this.entries.findLast(r=>r.status==="error")?.seq}settle(r,e){this.patch(r,s=>({...s,durationMs:Date.now()-s.startedAt,...e.error===void 0?{resultCount:V(e.result),status:"ok"}:{error:e.error,status:"error"}}))}clear(){this.entries=[],this.emit()}append(r,e,s,n,a){let d=this.nextSeq;this.nextSeq+=1;let c={functionPath:r,kind:n,seq:d,shardKey:s,startedAt:Date.now(),status:a,summary:F(r,e),...n==="subscription"?{pushes:0}:{}},o=[...this.entries,c];return this.entries=o.length>I?o.slice(o.length-I):o,this.emit(),d}patch(r,e){let s=this.entries.findIndex(n=>n.seq===r);s!==-1&&(this.entries=this.entries.with(s,e(this.entries[s])),this.emit())}emit(){for(let r of this.listeners)r()}},f=new k,_=i((t,r,e)=>["lunora-admin",t,r,e.trim()],"j"),O=i((t,r)=>[...t,r],"E");function W(t,r,e={}){let s=g(),{enabled:n=!0,keepPreviousData:a=!1,staleTime:d=0}=e,c=O(t,s.clientIdentifier()),o=D({enabled:n,queryFn:r,placeholderData:a?j:void 0,queryKey:c,staleTime:d});return{data:o.data,error:o.error?P(o.error):o.error,errorSource:o.error??void 0,isLoading:o.isLoading,liveError:void 0,refetch:i(()=>{q(o.refetch())},"refetch")}}i(W,"F");function Y(t,r,e={}){let s=g(),n=v(),{enabled:a=!0,keepPreviousData:d=!1,live:c=!1,shardKey:o="",staleTime:R}=e,m=_(t,r,o),C=W(m,()=>s.query(S(t),r,w(o)),{enabled:a,keepPreviousData:d,staleTime:R??(c?Number.POSITIVE_INFINITY:0)}),[K,b]=(0,p.useState)(void 0),L=JSON.stringify(m);return(0,p.useEffect)(()=>{if(!a||!c)return;b(void 0);let y=f.startSubscription(t,r,o),Q=s.subscribe(S(t),r,h=>{f.recordPush(y),b(void 0),n.setQueryData(O(m,s.clientIdentifier()),h)},{...w(o),onError:i(h=>{f.failSubscription(y,h.message),b(h.message)},"onError")});return()=>{f.endSubscription(y),Q()}},[s,L,a,c]),{...C,liveError:a&&c?K:void 0}}i(Y,"U");var B=i(()=>{let t=(0,E.c)(2),r=v(),e;return t[0]!==r?(e=i((s,n,a)=>{let d=n===void 0?["lunora-admin",s]:_(s,n,a??"");q(r.invalidateQueries({queryKey:d}))},"r"),t[0]=r,t[1]=e):e=t[1],e},"W");export{f as a,W as b,Y as c,B as d};
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-I26MS5PJ.js";var u=new Set(["contains","eq","gt","gte","lt","lte","ne"]),a=s(r=>typeof r=="number"&&Number.isSafeInteger(r)?String(r):r,"i"),o=s(r=>{if(typeof r!="string")return;let e=r.trim();return e===""?void 0:e},"e"),v=s(r=>{if(r===null||typeof r!="object")return!1;let e=r;return typeof e.column=="string"&&typeof e.operator=="string"&&u.has(e.operator)},"p"),h=s(r=>{if(typeof r!="string"||r==="")return[];try{let e=JSON.parse(r);return Array.isArray(e)?e.filter(v):[]}catch{return[]}},"f"),g=s(r=>{if(typeof r!="string"||r==="")return;let e=r.lastIndexOf(":");if(e<=0)return;let i=r.slice(0,e),n=r.slice(e+1);if(!(n!=="asc"&&n!=="desc"))return{column:i,direction:n}},"u"),p=/^[\da-f]{16}$/u,b=s(r=>{let e={};if(typeof r.pins=="string"&&r.pins!==""){let c=r.pins.split(",").filter(f=>f!==""&&f.length<=64).slice(0,12);c.length>0&&(e.pins=c.join(","))}r.schema==="global"&&(e.schema="global");let i=o(r.table);i!==void 0&&(e.table=i);let n=o(a(r.shard));n!==void 0&&(e.shard=n);let d=o(a(r.search));d!==void 0&&(e.search=d);let t=o(r.order);t!==void 0&&g(t)!==void 0&&(e.order=t);let l=o(r.filters);return l!==void 0&&h(l).length>0&&(e.filters=l),e},"b"),y=s(r=>{let e=h(r.filters),i=g(r.order);return{filters:e.length>0?e:void 0,orderBy:i,search:o(a(r.search)),shard:o(a(r.shard)),table:o(r.table),tier:r.schema==="global"?"global":"shard"}},"v"),m=s(r=>{let e=r.filters??[];return{filters:e.length>0?JSON.stringify(e):void 0,order:r.orderBy===void 0?void 0:`${r.orderBy.column}:${r.orderBy.direction}`,schema:r.tier==="global"?"global":void 0,search:r.search!==void 0&&r.search!==""?r.search:void 0,shard:r.shard!==void 0&&r.shard!==""?r.shard:void 0,table:r.table!==void 0&&r.table!==""?r.table:void 0}},"y"),S=s(r=>{let{version:e}=r;return typeof e=="string"&&p.test(e)?{version:e}:{}},"S");export{b as a,y as b,m as c,S as d};
@@ -0,0 +1 @@
1
+ import{a as f,d as r,e as m,f as n}from"./chunk-I26MS5PJ.js";var u=r(n(),1),s=r(m(),1);function a(t){let e=(0,u.c)(2),c=(0,s.useRef)(t),o;return e[0]!==t?(o=f(()=>{c.current=t},"t"),e[0]=t,e[1]=o):o=e[1],(0,s.useEffect)(o),c}f(a,"m");export{a};
@@ -0,0 +1 @@
1
+ import{b as P}from"./chunk-3T5F2LKG.js";import{c as K,d as X,e as z,f as L,h as B,i as E,j as G,k as q,l as A,m as O,n as W,o as $,p as D}from"./chunk-WIASRPIC.js";import{a as F,b as H,c as I,d as S,e as J,f as M}from"./chunk-HCTJKP5J.js";import{d as C,o as j}from"./chunk-HJHSQPHW.js";import{a as f,d as T,f as U,g as V}from"./chunk-I26MS5PJ.js";var N=T(U(),1);var t=T(V(),1);var _=50,R={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},Q=f(r=>{let a=r.columns.find(e=>r.rows.length>0&&r.rows.every(n=>typeof n[e]=="number"))??null;return{label:r.columns.find(e=>e!==a)??null,value:a}},"D"),Y=f(r=>{let a=(0,N.c)(3),{data:e,kind:n}=r,l;return a[0]!==e||a[1]!==n?(l=(0,t.jsx)(G,{className:"h-full w-full",config:R,children:n==="area"?(0,t.jsxs)(E,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(z,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):(0,t.jsxs)(B,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(X,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),a[0]=e,a[1]=n,a[2]=l):l=a[2],l},"J"),na=f(r=>{let a=(0,N.c)(21),{axes:e,kind:n,result:l}=r,u=C(),o;a[0]!==l?(o=Q(l),a[0]=l,a[1]=o):o=a[1];let d=o,m;a[2]!==l.columns?(m=new Set(l.columns),a[2]=l.columns,a[3]=m):m=a[3];let s=m,c=e!==void 0&&s.has(e.x)?e.x:d.label,p;a[4]!==e?.y||a[5]!==s?(p=e?.y.find(i=>s.has(i)),a[4]=e?.y,a[5]=s,a[6]=p):p=a[6];let x=p,y=x??d.value,b;a[7]!==c||a[8]!==l.rows||a[9]!==y?(b=y===null?[]:l.rows.slice(0,_).map((i,w)=>({label:c===null?`#${(w+1).toString()}`:j(i[c]),value:Number(i[y])||0})),a[7]=c,a[8]=l.rows,a[9]=y,a[10]=b):b=a[10];let k=b;if(y===null){let i;a[11]!==u?(i=u("No numeric column to chart."),a[11]=u,a[12]=i):i=a[12];let w;return a[13]!==i?(w=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:i}),a[13]=i,a[14]=w):w=a[14],w}let h=n??(e!==void 0&&x!==void 0?e.kind:"bar"),v;a[15]!==k||a[16]!==h?(v=h==="bar"?(0,t.jsxs)(O,{className:"h-full w-full",config:R,data:k,children:[(0,t.jsx)($,{dataKey:"label"}),(0,t.jsx)(W,{dataKey:"value"}),(0,t.jsx)(D,{})]}):(0,t.jsx)(Y,{data:k,kind:h}),a[15]=k,a[16]=h,a[17]=v):v=a[17];let g;return a[18]!==h||a[19]!==v?(g=(0,t.jsx)("div",{className:"h-80 w-full p-3","data-chart-kind":h,"data-testid":"sql-chart",children:v}),a[18]=h,a[19]=v,a[20]=g):g=a[20],g},"oe"),oa=f(r=>{let a=(0,N.c)(19),{result:e}=r,n=C();if(e.columns.length===0){let s;a[0]!==e.rowCount||a[1]!==n?(s=n("{count} rows",{count:e.rowCount}),a[0]=e.rowCount,a[1]=n,a[2]=s):s=a[2];let c;return a[3]!==s?(c=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:s}),a[3]=s,a[4]=c):c=a[4],c}let l;a[5]!==e.columns?(l=e.columns.map(Z),a[5]=e.columns,a[6]=l):l=a[6];let u;a[7]!==l?(u=(0,t.jsx)(H,{className:"sticky top-0 z-10 bg-muted",children:(0,t.jsx)(S,{children:l})}),a[7]=l,a[8]=u):u=a[8];let o;if(a[9]!==e.columns||a[10]!==e.rows){let s;a[12]!==e.columns?(s=f((c,p)=>(0,t.jsx)(S,{"data-testid":"sql-row",children:e.columns.map(x=>(0,t.jsx)(M,{className:"max-w-md truncate font-mono text-xs",children:(0,t.jsx)(P,{value:c[x]})},x))},p),"s"),a[12]=e.columns,a[13]=s):s=a[13],o=e.rows.map(s),a[9]=e.columns,a[10]=e.rows,a[11]=o}else o=a[11];let d;a[14]!==o?(d=(0,t.jsx)(I,{children:o}),a[14]=o,a[15]=d):d=a[15];let m;return a[16]!==u||a[17]!==d?(m=(0,t.jsxs)(F,{"data-testid":"sql-rows",children:[u,d]}),a[16]=u,a[17]=d,a[18]=m):m=a[18],m},"ne");function Z(r){return(0,t.jsx)(J,{children:r},r)}f(Z,"P");export{na as a,oa as b};
@@ -0,0 +1 @@
1
+ import{a as N}from"./chunk-3CTF6VCQ.js";import{a as v,b as w,c as y,d,e as c,f as i}from"./chunk-HCTJKP5J.js";import{a as x,e as b}from"./chunk-2IKDEUCX.js";import{d as h}from"./chunk-HJHSQPHW.js";import{a,d as p,e as I,g as R,i as g}from"./chunk-I26MS5PJ.js";var $=p(I(),1);var e=p(R(),1);var A={ERROR:"error",INFO:"info",WARN:"warning"},q=a(r=>{let n=typeof r.metadata.table=="string"?r.metadata.table:void 0;return{description:`${r.detail} ${r.remediation}`,entity:n,issueType:r.title,key:r.cacheKey,level:A[r.level]}},"z"),C=["error","warning","info"],O={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},S=a((r,n)=>({error:r("Errors"),info:r("Info"),warning:r("Warnings")})[n],"$"),j=a((r,n,o)=>({error:r("{count} errors",{count:o}),info:r("{count} suggestions",{count:o}),warning:r("{count} warnings",{count:o})})[n],"k"),z=a((r,n)=>({error:r("No errors detected"),info:r("No suggestions"),warning:r("No warnings detected")})[n],"V"),F=a(r=>{let n={error:0,info:0,warning:0};for(let o of r??[])n[o.level]+=1;return n},"O"),B=a(({error:r=null,errorSource:n,rows:o,testId:l,toolbar:f})=>{let s=h(),[m,k]=(0,$.useState)("error"),T=F(o),u=(o??[]).filter(t=>t.level===m),E=a(t=>{k(t.currentTarget.dataset.level)},"h");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":l,children:[(0,e.jsx)("div",{className:"flex border-b border-border",role:"tablist",children:C.map(t=>(0,e.jsxs)("button",{"aria-selected":m===t,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":t,"data-testid":`${l}-tab-${t}`,onClick:E,role:"tab",type:"button",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:g("size-2 rounded-sm",O[t])}),S(s,t)]}),(0,e.jsx)("span",{className:"ps-4 text-xs text-muted-foreground",children:j(s,t,T[t])})]},t))}),f!==void 0&&(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:f}),r!==null&&(0,e.jsx)(N,{error:n??r,testId:`${l}-error`}),(0,e.jsx)(x,{className:"overflow-hidden py-0",children:(0,e.jsx)(b,{className:"px-0",children:(0,e.jsxs)(v,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(d,{children:[(0,e.jsx)(c,{children:s("Issue type")}),(0,e.jsx)(c,{children:s("Entity/item")}),(0,e.jsx)(c,{children:s("Description")})]})}),(0,e.jsx)(y,{children:u.length===0?(0,e.jsx)(d,{children:(0,e.jsxs)(i,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${l}-empty`,children:[(0,e.jsx)("span",{className:"block text-sm font-medium text-foreground",children:z(s,m)}),(0,e.jsx)("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(t=>(0,e.jsxs)(d,{children:[(0,e.jsx)(i,{className:"font-medium text-foreground",children:t.issueType}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.entity??"\u2014"}),(0,e.jsxs)(i,{className:"text-muted-foreground",children:[(0,e.jsx)("span",{children:t.description}),t.action!==void 0&&(0,e.jsx)("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:t.action})]})]},t.key))})]})})})]})},"F");export{q as a,B as b};
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-I26MS5PJ.js";var e=i(t=>{let r=Math.floor(t/1e3),o=Math.floor(r/3600),n=Math.floor(r%3600/60),a=r%60;return o>0?`${o.toString()}h ${n.toString()}m`:n>0?`${n.toString()}m ${a.toString()}s`:`${a.toString()}s`},"e"),m=i((t,r)=>{let o=t+r;return o===0?"\u2014":`${(t/o*100).toFixed(1)}%`},"a"),s=i(t=>t<=0?"\u2014":t<1?`${(t*1e3).toFixed(0)}\u03BCs`:t<1e3?`${t.toFixed(1)}ms`:`${(t/1e3).toFixed(2)}s`,"s"),c=i((t,r)=>new Intl.NumberFormat(r,t===0||Math.abs(t)>=1?{currency:"USD",maximumFractionDigits:2,minimumFractionDigits:2,style:"currency"}:{currency:"USD",maximumSignificantDigits:3,style:"currency"}).format(t),"c"),u=i((t,r)=>new Intl.NumberFormat(r,{maximumFractionDigits:0}).format(t),"m");export{e as a,m as b,s as c,c as d,u as e};
@@ -0,0 +1 @@
1
+ import{i as R}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as B}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as S}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as q}from"./chunk-3CTF6VCQ.js";import"./chunk-NCPW7WHO.js";import"./chunk-VZWZIIP6.js";import"./chunk-55UGUCQ6.js";import{a as U}from"./chunk-4ZEL6BYL.js";import{c as O}from"./chunk-C5NU4UZY.js";import"./chunk-23DA2KK5.js";import"./chunk-QAQDMS6R.js";import"./chunk-YLPATGWK.js";import{a as D}from"./chunk-RWVIV3U7.js";import{a as G,b as J,c as K,d as F,e as s,f as o}from"./chunk-HCTJKP5J.js";import{a as V,e as W}from"./chunk-2IKDEUCX.js";import{d as P,t as H}from"./chunk-HJHSQPHW.js";import{a as n,d as j,e as re,f as ae,g as ie}from"./chunk-I26MS5PJ.js";var X=j(ae(),1),M=j(re(),1);var t=j(ie(),1);var ne=n(e=>e==="ok"?"success":e==="failed"?"destructive":e==="expired"?"warning":"secondary","te"),Q=n(e=>e.endpoint??e.id,"M"),ve=n(()=>{let e=(0,X.c)(38),r=P(),[i,Y]=(0,M.useState)("all"),[l,Z]=(0,M.useState)(""),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let{data:I,error:d,errorSource:x,isLoading:_,refetch:v}=O(U.listPushSubscriptions,g),N;if(e[1]!==I?.subscriptions||e[2]!==d||e[3]!==x||e[4]!==_||e[5]!==i||e[6]!==v||e[7]!==l||e[8]!==r){let L=I?.subscriptions??[],T=l.trim().toLowerCase(),A=L.filter(a=>i!=="all"&&a.kind!==i?!1:T===""?!0:`${Q(a)} ${a.userId??""}`.toLowerCase().includes(T)),b;e[10]===Symbol.for("react.memo_cache_sentinel")?(b=n(a=>{Z(a.target.value)},"w"),e[10]=b):b=e[10];let ee=b,w;e[11]!==v?(w=n(()=>{v()},"y"),e[11]=v,e[12]=w):w=e[12];let E=w,k;e[13]===Symbol.for("react.memo_cache_sentinel")?(k=["all","web-push","fcm"],e[13]=k):k=e[13];let te=k,c;e[14]!==i||e[15]!==r?(c=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"nt-kind-filter",role:"tablist",children:te.map(a=>(0,t.jsx)(B,{"aria-selected":i===a,"data-testid":`nt-kind-${a}`,onClick:n(()=>{Y(a)},"onClick"),role:"tab",size:"sm",type:"button",variant:i===a?"secondary":"ghost",children:a==="all"?r("All"):a},a))}),e[14]=i,e[15]=r,e[16]=c):c=e[16];let m;e[17]!==r?(m=r("Filter devices"),e[17]=r,e[18]=m):m=e[18];let h;e[19]!==r?(h=r("filter endpoint, user"),e[19]=r,e[20]=h):h=e[20];let u;e[21]!==l||e[22]!==m||e[23]!==h?(u=(0,t.jsx)(R,{"aria-label":m,className:"h-8 w-56","data-testid":"nt-search",onChange:ee,placeholder:h,value:l}),e[21]=l,e[22]=m,e[23]=h,e[24]=u):u=e[24];let f;e[25]!==r?(f=r("Refresh"),e[25]=r,e[26]=f):f=e[26];let p;e[27]!==E||e[28]!==f?(p=(0,t.jsx)(B,{className:"ml-auto","data-testid":"nt-refresh",onClick:E,size:"sm",type:"button",variant:"outline",children:f}),e[27]=E,e[28]=f,e[29]=p):p=e[29];let $=L.length>0&&(0,t.jsx)(S,{"data-testid":"nt-count",variant:"secondary",children:r("{count} devices",{count:L.length})}),y;e[30]!==p||e[31]!==$||e[32]!==c||e[33]!==u?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,p,$]}),e[30]=p,e[31]=$,e[32]=c,e[33]=u,e[34]=y):y=e[34];let C;e[35]!==d||e[36]!==x?(C=d!==null&&(0,t.jsx)(q,{error:x,testId:"nt-error"}),e[35]=d,e[36]=x,e[37]=C):C=e[37],N=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-notifications",children:[y,C,d===null&&!_&&A.length===0&&(0,t.jsx)(D,{description:r("Registered Web Push / FCM devices appear here. Configure lunora/notify.ts with defineNotify({ store }) and register a device with ctx.push.register(...)."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 0 0-4-5.7V5a2 2 0 1 0-4 0v.3A6 6 0 0 0 6 11v3.2a2 2 0 0 1-.6 1.4L4 17h5m6 0v1a3 3 0 1 1-6 0v-1m6 0H9"})}),testId:"nt-empty",title:r("No registered devices.")}),A.length>0&&(0,t.jsx)(V,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"nt-table",children:[(0,t.jsx)(J,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(s,{children:r("kind")}),(0,t.jsx)(s,{children:r("endpoint")}),(0,t.jsx)(s,{children:r("user")}),(0,t.jsx)(s,{children:r("last seen")}),(0,t.jsx)(s,{children:r("status")}),(0,t.jsx)(s,{children:r("error")})]})}),(0,t.jsx)(K,{children:A.map(a=>{let z=Q(a);return(0,t.jsxs)(F,{"data-testid":"nt-row",children:[(0,t.jsx)(o,{children:(0,t.jsx)(S,{variant:"outline",children:a.kind})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs",title:z,children:z}),(0,t.jsx)(o,{className:"max-w-[16ch] truncate font-mono text-xs",children:a.userId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(o,{className:"text-muted-foreground tabular-nums",children:H(a.lastSeenAt,"\u2014")}),(0,t.jsx)(o,{children:(0,t.jsx)(S,{"data-testid":`nt-status-${a.id}`,variant:ne(a.lastStatus),children:a.lastStatus??r("n/a")})}),(0,t.jsx)(o,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",title:a.lastError??void 0,children:a.lastError??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.id)})})]})})})]}),e[1]=I?.subscriptions,e[2]=d,e[3]=x,e[4]=_,e[5]=i,e[6]=v,e[7]=l,e[8]=r,e[9]=N}else N=e[9];return N},"ge");export{ve as default};