@lunora/studio 1.0.0-alpha.13 → 1.0.0-alpha.131

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 (329) hide show
  1. package/LICENSE.md +6 -0
  2. package/dist/index.d.ts +881 -786
  3. package/dist/index.js +1 -41
  4. package/dist/mount.d.ts +10 -10
  5. package/dist/mount.js +1 -26
  6. package/dist/packem_chunks/AdvisorHealthPanel.js +1 -0
  7. package/dist/packem_chunks/ApiTab.js +1 -0
  8. package/dist/packem_chunks/AuditPanel.js +1 -0
  9. package/dist/packem_chunks/DeploymentHealthPanel.js +1 -0
  10. package/dist/packem_chunks/ExportImportPanel.js +3 -0
  11. package/dist/packem_chunks/FileBrowser.js +4 -0
  12. package/dist/packem_chunks/FunctionRunner.js +1 -0
  13. package/dist/packem_chunks/FunctionStatsPanel.js +1 -0
  14. package/dist/packem_chunks/HealthPanel.js +1 -0
  15. package/dist/packem_chunks/InsightsPanel.js +1 -0
  16. package/dist/packem_chunks/LogsPanel.js +1 -0
  17. package/dist/packem_chunks/MailPanel.js +2 -0
  18. package/dist/packem_chunks/MetricsPanel.js +1 -0
  19. package/dist/packem_chunks/NotificationsPanel.js +1 -0
  20. package/dist/packem_chunks/PitrPanel.js +1 -0
  21. package/dist/packem_chunks/SchemaViewer.js +1 -0
  22. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -0
  23. package/dist/packem_chunks/SettingsPanel.js +1 -0
  24. package/dist/packem_chunks/SqlEditorPanel.js +9 -0
  25. package/dist/packem_chunks/TableEditor.js +1 -0
  26. package/dist/packem_chunks/agents-panel.js +1 -0
  27. package/dist/packem_chunks/analytics-panel.js +1 -0
  28. package/dist/packem_chunks/auth-audit-panel.js +1 -0
  29. package/dist/packem_chunks/auth-config-panel.js +1 -0
  30. package/dist/packem_chunks/auth-sessions-panel.js +1 -0
  31. package/dist/packem_chunks/containers-panel.js +1 -0
  32. package/dist/packem_chunks/dashboards-panel.js +1 -0
  33. package/dist/packem_chunks/evals-panel.js +1 -0
  34. package/dist/packem_chunks/fanout-panel.js +1 -0
  35. package/dist/packem_chunks/flags-panel.js +1 -0
  36. package/dist/packem_chunks/issues-panel.js +1 -0
  37. package/dist/packem_chunks/kv-browser.js +1 -0
  38. package/dist/packem_chunks/log-drains-panel.js +4 -0
  39. package/dist/packem_chunks/migrations-route.js +1 -0
  40. package/dist/packem_chunks/organizations-panel.js +1 -0
  41. package/dist/packem_chunks/payments-panel.js +1 -0
  42. package/dist/packem_chunks/permissions-panel.js +1 -0
  43. package/dist/packem_chunks/queues-panel.js +1 -0
  44. package/dist/packem_chunks/reactors-panel.js +1 -0
  45. package/dist/packem_chunks/rls-panel.js +1 -0
  46. package/dist/packem_chunks/schedule-panel.js +1 -0
  47. package/dist/packem_chunks/sparkline.js +1 -0
  48. package/dist/packem_chunks/storage-rules-panel.js +1 -0
  49. package/dist/packem_chunks/subscriptions-panel.js +1 -0
  50. package/dist/packem_chunks/sync-client-panel.js +1 -0
  51. package/dist/packem_chunks/traces-panel.js +1 -0
  52. package/dist/packem_chunks/users-panel.js +1 -0
  53. package/dist/packem_chunks/vector-browser.js +1 -0
  54. package/dist/packem_chunks/workflows-panel.js +1 -0
  55. package/dist/packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js +1 -0
  56. package/dist/packem_shared/ApiDocsPanel-Du1L7Ysj.js +2 -0
  57. package/dist/packem_shared/ApiReferencePanel-uGgGOBYj.js +1 -0
  58. package/dist/packem_shared/CommandPalette-HqiXrWIm.js +1 -0
  59. package/dist/packem_shared/ConfirmButton-Cj2SOapE.js +1 -0
  60. package/dist/packem_shared/ConnectionBadge-Bh16X9-u.js +1 -0
  61. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js +1 -0
  62. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js +1 -0
  63. package/dist/packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js +1 -0
  64. package/dist/packem_shared/DataBrowser-W5TxvLB8.js +4 -0
  65. package/dist/packem_shared/DataFilters-3nbW0uax.js +1 -0
  66. package/dist/packem_shared/ErrorBoundary-BWNF98VF.js +1 -0
  67. package/dist/packem_shared/GlobalDataBrowser-LFznuyGe.js +1 -0
  68. package/dist/packem_shared/HomePanel-DmB0EKjl.js +1 -0
  69. package/dist/packem_shared/MigrationsPanel-BDNt136v.js +1 -0
  70. package/dist/packem_shared/OpenRpcReferencePanel-DgrpASYD.js +1 -0
  71. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.js +1 -0
  72. package/dist/packem_shared/ScheduledJobs-CiO3eXgI.js +1 -0
  73. package/dist/packem_shared/ShardInput-CdawpUiS.js +1 -0
  74. package/dist/packem_shared/Studio-CkNE_tEy.js +1 -0
  75. package/dist/packem_shared/StudioApp-BZP_0E2n.js +1 -0
  76. package/dist/packem_shared/StudioI18nProvider-Bl547evf.js +1 -0
  77. package/dist/packem_shared/advisor-view-C1KFTXSH.js +1 -0
  78. package/dist/packem_shared/aggregateMetrics-A-Y7OH6R.js +1 -0
  79. package/dist/packem_shared/alert-C2SEhYS9.js +1 -0
  80. package/dist/packem_shared/app.d-D1bPR8FO.d.ts +252 -0
  81. package/dist/packem_shared/badge-cAk9Di1Q.js +1 -0
  82. package/dist/packem_shared/bar-chart-B6gzp_f9.js +6 -0
  83. package/dist/packem_shared/browser-storage-BH1MxLZs.js +1 -0
  84. package/dist/packem_shared/button-BOPLD1un.js +1 -0
  85. package/dist/packem_shared/card-BGlQzQY-.js +1 -0
  86. package/dist/packem_shared/cf-links-CBJ5SywP.js +1 -0
  87. package/dist/packem_shared/checkbox-C5w53W-E.js +1 -0
  88. package/dist/packem_shared/control-button-BOZ5K-FC.js +1 -0
  89. package/dist/packem_shared/data-grid-BFTQnkXq.js +1 -0
  90. package/dist/packem_shared/data-view-params-qoSTqjAj.js +1 -0
  91. package/dist/packem_shared/dropdown-menu-U7Tjg1Nb.js +2 -0
  92. package/dist/packem_shared/empty-state-B939z6K2.js +1 -0
  93. package/dist/packem_shared/error-alert-TYdKetJd.js +1 -0
  94. package/dist/packem_shared/grid-features-jBzZGauv.js +6 -0
  95. package/dist/packem_shared/home-panel-DHOa3sxt.js +3 -0
  96. package/dist/packem_shared/input-CY5W3wzv.js +1 -0
  97. package/dist/packem_shared/internal-CwaF9YNk.js +2 -0
  98. package/dist/packem_shared/label-BOUo-DP0.js +1 -0
  99. package/dist/packem_shared/live-status-Bf7rR8o8.js +1 -0
  100. package/dist/packem_shared/log-fields-SBxKyBug.js +1 -0
  101. package/dist/packem_shared/log-line-UnE93Ovi.js +1 -0
  102. package/dist/packem_shared/modal-shell-wGW4CKEW.js +1 -0
  103. package/dist/packem_shared/operation-console-provider-DoloEvon.js +1 -0
  104. package/dist/packem_shared/quote-identifier-CGiYFBvY.js +1 -0
  105. package/dist/packem_shared/recording-client-CKn4-vUx.js +1 -0
  106. package/dist/packem_shared/reference-view-BU2dNK9Z.js +13 -0
  107. package/dist/packem_shared/schema-diagram-DOaIh1y6.js +2 -0
  108. package/dist/packem_shared/scroll-area-DSJftwu_.js +2 -0
  109. package/dist/packem_shared/select-BPISLTcv.js +2 -0
  110. package/dist/packem_shared/shard-history-DU5b3QDI.js +1 -0
  111. package/dist/packem_shared/shortcuts-lH4Vaqjc.js +1 -0
  112. package/dist/packem_shared/skeleton-DFBBaJU6.js +1 -0
  113. package/dist/packem_shared/sparkline-CYbJzfA1.js +1 -0
  114. package/dist/packem_shared/sql-result-table-CqlZo2QN.js +1 -0
  115. package/dist/packem_shared/stat-card-B9uIvAHg.js +1 -0
  116. package/dist/packem_shared/storage-tier-C2mKwYRj.js +1 -0
  117. package/dist/packem_shared/studio-CXai1O2K.js +2 -0
  118. package/dist/packem_shared/table-BMsuYFhk.js +2 -0
  119. package/dist/packem_shared/table-list-sidebar-BWq_-gtu.js +1 -0
  120. package/dist/packem_shared/textarea-DpO3i-Qo.js +1 -0
  121. package/dist/packem_shared/trace-handoff-z9sy89Ci.js +1 -0
  122. package/dist/packem_shared/use-admin-query-P0RJrjsD.js +1 -0
  123. package/dist/packem_shared/use-async-submit-DdLd0MdK.js +1 -0
  124. package/dist/packem_shared/use-auth-config-z3KRWAqD.js +1 -0
  125. package/dist/packem_shared/use-open-trace-4mqqFWrn.js +1 -0
  126. package/dist/packem_shared/use-shard-key-BsP3o5wT.js +1 -0
  127. package/dist/packem_shared/use-sql-assistant-D1K2LqpO.js +1 -0
  128. package/dist/packem_shared/useDebounced-DVeQ5-oW.js +1 -0
  129. package/dist/packem_shared/utils-bhneXptQ.js +1 -0
  130. package/dist/packem_shared/virtual-rect-D_j7aLxX.js +1 -0
  131. package/dist/packem_shared/wire-codec-Dl3VeNrd.js +1 -0
  132. package/dist/standalone/chunk-26VREVWU.js +1 -0
  133. package/dist/standalone/chunk-2SFSTQS4.js +1 -0
  134. package/dist/standalone/chunk-2VGV6RPS.js +1 -0
  135. package/dist/standalone/chunk-2XOGZAF4.js +3 -0
  136. package/dist/standalone/chunk-333WFRWG.js +1 -0
  137. package/dist/standalone/chunk-362AVHNC.js +1 -0
  138. package/dist/standalone/chunk-3NXFFXQ2.js +1 -0
  139. package/dist/standalone/chunk-3S4VZ2ZM.js +1 -0
  140. package/dist/standalone/chunk-443UDYWL.js +6 -0
  141. package/dist/standalone/chunk-4PZEPCO7.js +1 -0
  142. package/dist/standalone/chunk-4YTSKL4R.js +1 -0
  143. package/dist/standalone/chunk-4ZCENYC3.js +1 -0
  144. package/dist/standalone/chunk-57VX76PR.js +1 -0
  145. package/dist/standalone/chunk-5EW733RQ.js +1 -0
  146. package/dist/standalone/chunk-5JLIP2HH.js +1 -0
  147. package/dist/standalone/chunk-6CBLYGXJ.js +1 -0
  148. package/dist/standalone/chunk-6UPO6ELN.js +1 -0
  149. package/dist/standalone/chunk-6ZPTNC34.js +19 -0
  150. package/dist/standalone/chunk-74ASA4WU.js +1 -0
  151. package/dist/standalone/chunk-76YLMHR3.js +1 -0
  152. package/dist/standalone/chunk-77JLGJ7V.js +1 -0
  153. package/dist/standalone/chunk-7PIHTTND.js +1 -0
  154. package/dist/standalone/chunk-7SROZWKL.js +1 -0
  155. package/dist/standalone/chunk-AFKLFS74.js +1 -0
  156. package/dist/standalone/chunk-AOAJGSYZ.js +2 -0
  157. package/dist/standalone/chunk-AXXNMZQ4.js +1 -0
  158. package/dist/standalone/chunk-BFCUKERU.js +8 -0
  159. package/dist/standalone/chunk-BQK2C2Z4.js +1 -0
  160. package/dist/standalone/chunk-BUIAZFSC.js +1 -0
  161. package/dist/standalone/chunk-BWEXJENB.js +1 -0
  162. package/dist/standalone/chunk-CA5ILAW2.js +14 -0
  163. package/dist/standalone/chunk-CAOUXOL7.js +1 -0
  164. package/dist/standalone/chunk-CKTKI4IY.js +1 -0
  165. package/dist/standalone/chunk-CL76PTLM.js +2 -0
  166. package/dist/standalone/chunk-CN2AINNY.js +1 -0
  167. package/dist/standalone/chunk-CP4ZFBVW.js +1 -0
  168. package/dist/standalone/chunk-CSYDKCNQ.js +1 -0
  169. package/dist/standalone/chunk-CYX3OHJ3.js +1 -0
  170. package/dist/standalone/chunk-DKSLOJDQ.js +1 -0
  171. package/dist/standalone/chunk-DPNEFSEC.js +1 -0
  172. package/dist/standalone/chunk-DUDQV6XJ.js +1 -0
  173. package/dist/standalone/chunk-DZGOHOOE.js +1 -0
  174. package/dist/standalone/chunk-EBI7CCQQ.js +1 -0
  175. package/dist/standalone/chunk-EDHW2EEG.js +1 -0
  176. package/dist/standalone/chunk-EE63P4VX.js +1 -0
  177. package/dist/standalone/chunk-ELO3V35K.js +1 -0
  178. package/dist/standalone/chunk-EVQ6LHI6.js +1 -0
  179. package/dist/standalone/chunk-EYGF6TQS.js +1 -0
  180. package/dist/standalone/chunk-F7JOSNAT.js +1 -0
  181. package/dist/standalone/chunk-FB5DOMZF.js +4 -0
  182. package/dist/standalone/chunk-FDLSPDIC.js +15 -0
  183. package/dist/standalone/chunk-FJ6G6FNE.js +1 -0
  184. package/dist/standalone/chunk-GIQDEWC4.js +1 -0
  185. package/dist/standalone/chunk-GSQURGCT.js +1 -0
  186. package/dist/standalone/chunk-H3BH6X3G.js +1 -0
  187. package/dist/standalone/chunk-H7YVFLA5.js +7 -0
  188. package/dist/standalone/chunk-HAIBZTXF.js +1 -0
  189. package/dist/standalone/chunk-HRD2DVIW.js +1 -0
  190. package/dist/standalone/chunk-IE5S3JMD.js +1 -0
  191. package/dist/standalone/chunk-INQICZYC.js +1 -0
  192. package/dist/standalone/chunk-IYWVSMAY.js +1 -0
  193. package/dist/standalone/chunk-IZXGBTPE.js +1 -0
  194. package/dist/standalone/chunk-JHXEEPRG.js +1 -0
  195. package/dist/standalone/chunk-JURAVSE7.js +1 -0
  196. package/dist/standalone/chunk-JUWOEHDD.js +1 -0
  197. package/dist/standalone/chunk-JV7KTJPY.js +1 -0
  198. package/dist/standalone/chunk-KTXD2N6F.js +1 -0
  199. package/dist/standalone/chunk-KVSQKUWD.js +1 -0
  200. package/dist/standalone/chunk-L4EZAHCD.js +1 -0
  201. package/dist/standalone/chunk-M3NNNOD5.js +1 -0
  202. package/dist/standalone/chunk-MCLM2QJI.js +1 -0
  203. package/dist/standalone/chunk-METRMDIQ.js +1 -0
  204. package/dist/standalone/chunk-MPYVZLYP.js +1 -0
  205. package/dist/standalone/chunk-MSCK3V6U.js +1 -0
  206. package/dist/standalone/chunk-MVZARXDR.js +1 -0
  207. package/dist/standalone/chunk-MYFFCV2R.js +1 -0
  208. package/dist/standalone/chunk-NIX2QSSN.js +1 -0
  209. package/dist/standalone/chunk-NNLNQKT7.js +59 -0
  210. package/dist/standalone/chunk-NSOLPNU7.js +1 -0
  211. package/dist/standalone/chunk-NXXGISFB.js +1 -0
  212. package/dist/standalone/chunk-O5MAFDY2.js +1 -0
  213. package/dist/standalone/chunk-OE4KGVJW.js +4 -0
  214. package/dist/standalone/chunk-OEGE3YDK.js +11 -0
  215. package/dist/standalone/chunk-OG57FC7W.js +1 -0
  216. package/dist/standalone/chunk-PQICDSPP.js +1 -0
  217. package/dist/standalone/chunk-PSPJORP6.js +1 -0
  218. package/dist/standalone/chunk-PZ4QDWTI.js +1 -0
  219. package/dist/standalone/chunk-QHQTOESO.js +1 -0
  220. package/dist/standalone/chunk-QO4SZ4WH.js +1 -0
  221. package/dist/standalone/chunk-R5ZTCHCE.js +1 -0
  222. package/dist/standalone/chunk-RCZTUWG3.js +1 -0
  223. package/dist/standalone/chunk-RJINX3H6.js +1 -0
  224. package/dist/standalone/chunk-RLRTQOFQ.js +1 -0
  225. package/dist/standalone/chunk-RPCMQE4A.js +1 -0
  226. package/dist/standalone/chunk-SJ4CA7QG.js +1 -0
  227. package/dist/standalone/chunk-SPDZUX4P.js +1 -0
  228. package/dist/standalone/chunk-SQMJUXBA.js +1 -0
  229. package/dist/standalone/chunk-SRQP7SLQ.js +1 -0
  230. package/dist/standalone/chunk-TB5N24CM.js +1 -0
  231. package/dist/standalone/chunk-TFMQSCGC.js +1 -0
  232. package/dist/standalone/chunk-TIANWRSD.js +1 -0
  233. package/dist/standalone/chunk-TNKECJW4.js +1 -0
  234. package/dist/standalone/chunk-TPAZM36C.js +1 -0
  235. package/dist/standalone/chunk-TV2M3PHL.js +1 -0
  236. package/dist/standalone/chunk-TVGQ7K5I.js +1 -0
  237. package/dist/standalone/chunk-U7LNRJHZ.js +1 -0
  238. package/dist/standalone/chunk-UANVABQG.js +1 -0
  239. package/dist/standalone/chunk-V6QPVFDL.js +1 -0
  240. package/dist/standalone/chunk-VHXQGKA7.js +1 -0
  241. package/dist/standalone/chunk-VLW547U6.js +1 -0
  242. package/dist/standalone/chunk-VR3UJA7B.js +1 -0
  243. package/dist/standalone/chunk-VZCS5GXZ.js +1 -0
  244. package/dist/standalone/chunk-W2FXNIVC.js +1 -0
  245. package/dist/standalone/chunk-W2JBKQNU.js +1 -0
  246. package/dist/standalone/chunk-WUW4ZHRL.js +1 -0
  247. package/dist/standalone/chunk-WXBTOI6T.js +1 -0
  248. package/dist/standalone/chunk-WY33QRLH.js +9 -0
  249. package/dist/standalone/chunk-XJSWM47N.js +1 -0
  250. package/dist/standalone/chunk-XNBAJ6XA.js +1 -0
  251. package/dist/standalone/chunk-XQS7KSHL.js +1 -0
  252. package/dist/standalone/chunk-Y2YQITGI.js +1 -0
  253. package/dist/standalone/chunk-Z6SECRFO.js +3 -0
  254. package/dist/standalone/chunk-ZHPDAJBM.js +1 -0
  255. package/dist/standalone/chunk-ZPGNTTQ3.js +1 -0
  256. package/dist/standalone/chunk-ZSOLGJFC.js +1 -0
  257. package/dist/standalone/studio.js +9 -378
  258. package/dist/styles.css +2 -2
  259. package/package.json +16 -15
  260. package/dist/packem_shared/ADMIN_FUNCTIONS-CZJCZ4c7.js +0 -47
  261. package/dist/packem_shared/ApiDocsPanel-yEz0fiof.js +0 -842
  262. package/dist/packem_shared/ApiReferencePanel-1vubqG5s.js +0 -229
  263. package/dist/packem_shared/ApiTab-DdubReQI.js +0 -251
  264. package/dist/packem_shared/AuditPanel-CE5ofjCc.js +0 -200
  265. package/dist/packem_shared/CommandPalette-BtgkBzZI.js +0 -373
  266. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  267. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  268. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  269. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  270. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  271. package/dist/packem_shared/DataBrowser-DpL8U-Nf.js +0 -4475
  272. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  273. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  274. package/dist/packem_shared/ExportImportPanel-ChsSUCYZ.js +0 -197
  275. package/dist/packem_shared/FileBrowser-DsRBnVhZ.js +0 -2932
  276. package/dist/packem_shared/FunctionRunner-D4cZ6fuA.js +0 -343
  277. package/dist/packem_shared/FunctionStatsPanel-BVelWgNv.js +0 -375
  278. package/dist/packem_shared/GlobalDataBrowser-3X9uRfdO.js +0 -289
  279. package/dist/packem_shared/HealthPanel-CxUVKfvo.js +0 -648
  280. package/dist/packem_shared/HomePanel-tfqpZxuu.js +0 -1334
  281. package/dist/packem_shared/InsightsPanel-DNg3K9XN.js +0 -461
  282. package/dist/packem_shared/LogsPanel-B4LoSRj0.js +0 -827
  283. package/dist/packem_shared/MailPanel-CcpdyWYs.js +0 -440
  284. package/dist/packem_shared/MetricsPanel-CxoyWbNb.js +0 -1611
  285. package/dist/packem_shared/MigrationsPanel-DGwJGWDA.js +0 -239
  286. package/dist/packem_shared/OpenRpcReferencePanel-vbcYbv3V.js +0 -191
  287. package/dist/packem_shared/PitrPanel-CKUzyyHi.js +0 -252
  288. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  289. package/dist/packem_shared/ScheduledJobs-BWNwIN3I.js +0 -262
  290. package/dist/packem_shared/SchemaViewer-RclXFo9Q.js +0 -2512
  291. package/dist/packem_shared/SecurityAdvisorPanel-Dqql1Z5O.js +0 -92
  292. package/dist/packem_shared/SettingsPanel-D5iTY0YE.js +0 -390
  293. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  294. package/dist/packem_shared/SqlEditorPanel-Dj-In-B3.js +0 -13
  295. package/dist/packem_shared/Studio-VWvKNOw4.js +0 -33
  296. package/dist/packem_shared/StudioApp-BhQ6T2pn.js +0 -657
  297. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  298. package/dist/packem_shared/TableEditor-BY8bTpCl.js +0 -11
  299. package/dist/packem_shared/advisor-view-CGcfMiPq.js +0 -159
  300. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  301. package/dist/packem_shared/app.d-BVJFkXyj.d.ts +0 -300
  302. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  303. package/dist/packem_shared/bar-chart-CzJAgqkp.js +0 -3245
  304. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  305. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  306. package/dist/packem_shared/cf-links-2cktDedA.js +0 -8
  307. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  308. package/dist/packem_shared/data-grid-B5CaV3wS.js +0 -183
  309. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  310. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  311. package/dist/packem_shared/grid-features-CzUfqgsM.js +0 -840
  312. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  313. package/dist/packem_shared/internal-rXJEAhXS.js +0 -68
  314. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  315. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  316. package/dist/packem_shared/reference-view-B4E49Lip.js +0 -2180
  317. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  318. package/dist/packem_shared/sparkline-10dG-_f0.js +0 -93
  319. package/dist/packem_shared/sql-editor-panel-CMdxstu5.js +0 -2562
  320. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  321. package/dist/packem_shared/studio-D8ry3tJR.js +0 -11043
  322. package/dist/packem_shared/table-_RzNvy3R.js +0 -246
  323. package/dist/packem_shared/table-editor-CWx68ZCg.js +0 -407
  324. package/dist/packem_shared/table-list-sidebar-Bg7uzbvC.js +0 -832
  325. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  326. package/dist/packem_shared/use-admin-query-BkbdNFNz.js +0 -105
  327. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  328. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  329. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
@@ -0,0 +1,4 @@
1
+ import{d as Ee}from"./chunk-443UDYWL.js";import{c as Oe}from"./chunk-W2JBKQNU.js";import"./chunk-FJ6G6FNE.js";import"./chunk-CP4ZFBVW.js";import"./chunk-CN2AINNY.js";import{a as ye}from"./chunk-NIX2QSSN.js";import"./chunk-5JLIP2HH.js";import{a as Le}from"./chunk-WUW4ZHRL.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import"./chunk-O5MAFDY2.js";import{a as _e}from"./chunk-OG57FC7W.js";import{a as Te}from"./chunk-TB5N24CM.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as Ce}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as re}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as ae}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as be}from"./chunk-DZGOHOOE.js";import{f as Se}from"./chunk-OEGE3YDK.js";import"./chunk-RCZTUWG3.js";import{a as me}from"./chunk-UANVABQG.js";import{a as Ke,b as $e,c as Fe,d as ie,e as ne,f as ee}from"./chunk-L4EZAHCD.js";import{a as je,e as ze}from"./chunk-IYWVSMAY.js";import{d as Ne,f as fe,g as ge,h as Q,l as pe,o as V,q as De}from"./chunk-6ZPTNC34.js";import"./chunk-FDLSPDIC.js";import{a as g,d as he,e as ft,f as gt,g as pt}from"./chunk-R5ZTCHCE.js";var B=he(gt(),1),j=he(ft(),1);var n=he(pt(),1);var Me=g((d,e,t)=>{let{onCopy:r,onDelete:s,onDownload:o,onToggleSelect:i}=t,c=g(()=>{r(d.key)},"a"),l=g(()=>{o(d.key)},"n"),u=g(()=>{s(d.key)},"d"),m=g(()=>{i(d.key)},"h");return{copy:c,download:l,name:d.key.slice(e.length),remove:u,toggle:m}},"$e"),Be=g(d=>{let e=(0,B.c)(31),{busy:t,buttonClassName:r,copied:s,objectKey:o,onCopy:i,onDelete:c,onDownload:l,t:u}=d,m=`storage-copy-${o}`,h;e[0]!==s||e[1]!==u?(h=u(s?"Copied":"Copy URL"),e[0]=s,e[1]=u,e[2]=h):h=e[2];let f;e[3]!==t||e[4]!==r||e[5]!==i||e[6]!==m||e[7]!==h?(f=(0,n.jsx)(re,{className:r,"data-testid":m,disabled:t,onClick:i,size:"sm",type:"button",variant:"ghost",children:h}),e[3]=t,e[4]=r,e[5]=i,e[6]=m,e[7]=h,e[8]=f):f=e[8];let w=`storage-download-${o}`,a;e[9]!==u?(a=u("Download"),e[9]=u,e[10]=a):a=e[10];let k;e[11]!==t||e[12]!==r||e[13]!==l||e[14]!==w||e[15]!==a?(k=(0,n.jsx)(re,{className:r,"data-testid":w,disabled:t,onClick:l,size:"sm",type:"button",variant:"ghost",children:a}),e[11]=t,e[12]=r,e[13]=l,e[14]=w,e[15]=a,e[16]=k):k=e[16];let N;e[17]!==u?(N=u("Delete object?"),e[17]=u,e[18]=N):N=e[18];let x=`storage-delete-${o}`,b;e[19]!==u?(b=u("Delete"),e[19]=u,e[20]=b):b=e[20];let v;e[21]!==t||e[22]!==c||e[23]!==N||e[24]!==x||e[25]!==b?(v=(0,n.jsx)(_e,{confirmLabel:N,disabled:t,onConfirm:c,testId:x,children:b}),e[21]=t,e[22]=c,e[23]=N,e[24]=x,e[25]=b,e[26]=v):v=e[26];let y;return e[27]!==v||e[28]!==f||e[29]!==k?(y=(0,n.jsxs)(n.Fragment,{children:[f,k,v]}),e[27]=v,e[28]=f,e[29]=k,e[30]=y):y=e[30],y},"Fe"),Ae=g(d=>{let e=(0,B.c)(14),{objectKey:t,references:r,t:s}=d;if(r===void 0)return null;if(r.length===0){let m=`storage-orphan-${t}`,h;e[0]!==s?(h=s("Orphan"),e[0]=s,e[1]=h):h=e[1];let f;return e[2]!==m||e[3]!==h?(f=(0,n.jsx)(ae,{"data-testid":m,variant:"warning",children:h}),e[2]=m,e[3]=h,e[4]=f):f=e[4],f}let o;e[5]!==r?(o=r.map(bt).join(`
2
+ `),e[5]=r,e[6]=o):o=e[6];let i=o,c=`storage-refs-${t}`,l;e[7]!==r.length||e[8]!==s?(l=r.length===1?s("1 record"):s("{count} records",{count:r.length}),e[7]=r.length,e[8]=s,e[9]=l):l=e[9];let u;return e[10]!==i||e[11]!==c||e[12]!==l?(u=(0,n.jsx)(ae,{"data-testid":c,title:i,variant:"secondary",children:l}),e[10]=i,e[11]=c,e[12]=l,e[13]=u):u=e[13],u},"Re"),Pe=g(d=>{let e=(0,B.c)(7),{objectKey:t,onToggle:r,selected:s,t:o}=d,i;e[0]!==o?(i=o("Select row"),e[0]=o,e[1]=i):i=e[1];let c=`storage-select-${t}`,l;return e[2]!==r||e[3]!==s||e[4]!==i||e[5]!==c?(l=(0,n.jsx)(ye,{"aria-label":i,checked:s,"data-testid":c,onCheckedChange:r}),e[2]=r,e[3]=s,e[4]=i,e[5]=c,e[6]=l):l=e[6],l},"ze");function bt(d){return`${d.table}\xB7${d.id}`}g(bt,"yt");var yt=g(d=>{let e=(0,B.c)(10),{colSpan:t,name:r,onEnter:s}=d,o;e[0]!==r||e[1]!==s?(o=g(()=>{s(r)},"l"),e[0]=r,e[1]=s,e[2]=o):o=e[2];let i=o,c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})}),e[3]=c):c=e[3];let l;e[4]!==i||e[5]!==r?(l=(0,n.jsxs)("button",{className:"inline-flex items-center gap-2 font-mono text-xs outline-none hover:text-foreground focus-visible:text-foreground","data-testid":"fb-folder",onClick:i,type:"button",children:[c,r]}),e[4]=i,e[5]=r,e[6]=l):l=e[6];let u;return e[7]!==t||e[8]!==l?(u=(0,n.jsx)(ie,{children:(0,n.jsx)(ee,{colSpan:t,children:l})}),e[7]=t,e[8]=l,e[9]=u):u=e[9],u},"xt"),xt=g(d=>{let e=(0,B.c)(37),{busy:t,copiedKey:r,handlers:s,object:o,prefix:i,references:c,selected:l,showReferences:u,t:m}=d,h;e[0]!==s||e[1]!==o||e[2]!==i?(h=Me(o,i,s),e[0]=s,e[1]=o,e[2]=i,e[3]=h):h=e[3];let{copy:f,download:w,name:a,remove:k,toggle:N}=h,x;e[4]!==o.key||e[5]!==l||e[6]!==m||e[7]!==N?(x=(0,n.jsx)(ee,{className:"w-8",children:(0,n.jsx)(Pe,{objectKey:o.key,onToggle:N,selected:l,t:m})}),e[4]=o.key,e[5]=l,e[6]=m,e[7]=N,e[8]=x):x=e[8];let b;e[9]!==a?(b=(0,n.jsx)(ee,{className:"font-mono text-xs",children:a}),e[9]=a,e[10]=b):b=e[10];let v;e[11]!==o.size?(v=pe(o.size),e[11]=o.size,e[12]=v):v=e[12];let y;e[13]!==v?(y=(0,n.jsx)(ee,{className:"tabular-nums text-muted-foreground",children:v}),e[13]=v,e[14]=y):y=e[14];let z=o.httpMetadata?.contentType??"",S;e[15]!==z?(S=(0,n.jsx)(ee,{children:z}),e[15]=z,e[16]=S):S=e[16];let C;e[17]!==o.key||e[18]!==c||e[19]!==u||e[20]!==m?(C=u&&(0,n.jsx)(ee,{children:(0,n.jsx)(Ae,{objectKey:o.key,references:c,t:m})}),e[17]=o.key,e[18]=c,e[19]=u,e[20]=m,e[21]=C):C=e[21];let K=r===o.key,D;e[22]!==t||e[23]!==f||e[24]!==w||e[25]!==o.key||e[26]!==k||e[27]!==m||e[28]!==K?(D=(0,n.jsx)(ee,{className:"text-right",children:(0,n.jsx)("span",{className:"inline-flex items-center gap-1",children:(0,n.jsx)(Be,{busy:t,copied:K,objectKey:o.key,onCopy:f,onDelete:k,onDownload:w,t:m})})}),e[22]=t,e[23]=f,e[24]=w,e[25]=o.key,e[26]=k,e[27]=m,e[28]=K,e[29]=D):D=e[29];let F;return e[30]!==D||e[31]!==x||e[32]!==b||e[33]!==y||e[34]!==S||e[35]!==C?(F=(0,n.jsxs)(ie,{"data-testid":"fb-row",children:[x,b,y,S,C,D]}),e[30]=D,e[31]=x,e[32]=b,e[33]=y,e[34]=S,e[35]=C,e[36]=F):F=e[36],F},"vt"),vt=g(d=>{let e=(0,B.c)(65),{allSelected:t,busy:r,copiedKey:s,files:o,folders:i,handlers:c,onEnterFolder:l,prefix:u,references:m,selected:h,showReferences:f,someSelected:w,t:a,toggleSelectAll:k}=d,N;e[0]!==a?(N=a("Select all rows"),e[0]=a,e[1]=N):N=e[1];let x;e[2]!==t||e[3]!==w||e[4]!==N||e[5]!==k?(x=(0,n.jsx)(ne,{className:"w-8",children:(0,n.jsx)(ye,{"aria-label":N,checked:t,"data-testid":"storage-select-all",indeterminate:w,onCheckedChange:k})}),e[2]=t,e[3]=w,e[4]=N,e[5]=k,e[6]=x):x=e[6];let b;e[7]!==a?(b=a("key"),e[7]=a,e[8]=b):b=e[8];let v;e[9]!==b?(v=(0,n.jsx)(ne,{children:b}),e[9]=b,e[10]=v):v=e[10];let y;e[11]!==a?(y=a("size"),e[11]=a,e[12]=y):y=e[12];let z;e[13]!==y?(z=(0,n.jsx)(ne,{children:y}),e[13]=y,e[14]=z):z=e[14];let S;e[15]!==a?(S=a("content-type"),e[15]=a,e[16]=S):S=e[16];let C;e[17]!==S?(C=(0,n.jsx)(ne,{children:S}),e[17]=S,e[18]=C):C=e[18];let K;e[19]!==f||e[20]!==a?(K=f&&(0,n.jsx)(ne,{children:a("used by")}),e[19]=f,e[20]=a,e[21]=K):K=e[21];let D;e[22]!==a?(D=a("Actions"),e[22]=a,e[23]=D):D=e[23];let F;e[24]!==D?(F=(0,n.jsx)(ne,{"aria-label":D}),e[24]=D,e[25]=F):F=e[25];let $;e[26]!==F||e[27]!==x||e[28]!==v||e[29]!==z||e[30]!==C||e[31]!==K?($=(0,n.jsx)($e,{children:(0,n.jsxs)(ie,{children:[x,v,z,C,K,F]})}),e[26]=F,e[27]=x,e[28]=v,e[29]=z,e[30]=C,e[31]=K,e[32]=$):$=e[32];let _;if(e[33]!==i||e[34]!==l||e[35]!==f){let L;e[37]!==l||e[38]!==f?(L=g(O=>(0,n.jsx)(yt,{colSpan:f?6:5,name:O,onEnter:l},O),"D"),e[37]=l,e[38]=f,e[39]=L):L=e[39],_=i.map(L),e[33]=i,e[34]=l,e[35]=f,e[36]=_}else _=e[36];let I;if(e[40]!==r||e[41]!==s||e[42]!==o||e[43]!==c||e[44]!==u||e[45]!==m||e[46]!==h||e[47]!==f||e[48]!==a){let L;e[50]!==r||e[51]!==s||e[52]!==c||e[53]!==u||e[54]!==m||e[55]!==h||e[56]!==f||e[57]!==a?(L=g(O=>(0,n.jsx)(xt,{busy:r,copiedKey:s,handlers:c,object:O,prefix:u,references:m[O.key],selected:h.has(O.key),showReferences:f,t:a},O.key),"D"),e[50]=r,e[51]=s,e[52]=c,e[53]=u,e[54]=m,e[55]=h,e[56]=f,e[57]=a,e[58]=L):L=e[58],I=o.map(L),e[40]=r,e[41]=s,e[42]=o,e[43]=c,e[44]=u,e[45]=m,e[46]=h,e[47]=f,e[48]=a,e[49]=I}else I=e[49];let E;e[59]!==_||e[60]!==I?(E=(0,n.jsxs)(Fe,{children:[_,I]}),e[59]=_,e[60]=I,e[61]=E):E=e[61];let U;return e[62]!==$||e[63]!==E?(U=(0,n.jsx)(je,{className:"overflow-hidden py-0",children:(0,n.jsx)(ze,{className:"px-0",children:(0,n.jsxs)(Ke,{"data-testid":"fb-table",children:[$,E]})})}),e[62]=$,e[63]=E,e[64]=U):U=e[64],U},"kt"),kt=[{label:"15m",seconds:900},{label:"1h",seconds:3600},{label:"24h",seconds:86400},{label:"7d",seconds:604800}],wt=3600,Ie=g((d,e)=>{if(e==="size")return d.size;if(e==="type")return d.httpMetadata?.contentType??"";if(e==="date"){if(d.uploaded===void 0)return 0;let t=new Date(d.uploaded).getTime();return Number.isNaN(t)?0:t}return e.startsWith("tag:")?d.customMetadata?.[e.slice(4)]??"":d.key},"ve"),St=g((d,e,t)=>{let r=t==="desc"?-1:1;return d.toSorted((s,o)=>{let i=Ie(s,e),c=Ie(o,e);return(typeof i=="number"&&typeof c=="number"?i-c:String(i).localeCompare(String(c)))*r})},"Ct"),Nt=g((d,e)=>{let t=new Set,r=[];for(let s of d){let o=s.key.slice(e.length),i=o.indexOf("/");i===-1?r.push(s):t.add(o.slice(0,i+1))}return{files:r,folders:[...t].toSorted((s,o)=>s.localeCompare(o))}},"Nt"),Ct=g(d=>{let e=(0,B.c)(59),{bucket:t,buckets:r,busy:s,draftPrefix:o,expiry:i,fileInputRef:c,onBucketChange:l,onExpiryChange:u,onFileChange:m,onList:h,onPrefixChange:f,onUploadClick:w,t:a}=d,k;e[0]!==f?(k=g(P=>{f(P.target.value)},"v"),e[0]=f,e[1]=k):k=e[1];let N=k,x;e[2]!==l?(x=g(P=>{l(P.target.value)},"y"),e[2]=l,e[3]=x):x=e[3];let b=x,v;e[4]!==u?(v=g(P=>{u(Number.parseInt(P.target.value,10))},"x"),e[4]=u,e[5]=v):v=e[5];let y=v,z;e[6]!==t||e[7]!==r||e[8]!==b||e[9]!==a?(z=r.length>0&&(0,n.jsx)("select",{"aria-label":a("Bucket"),className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-bucket",onChange:b,value:t,children:r.map(zt)}),e[6]=t,e[7]=r,e[8]=b,e[9]=a,e[10]=z):z=e[10];let S;e[11]!==a?(S=a("Key prefix"),e[11]=a,e[12]=S):S=e[12];let C;e[13]!==a?(C=a("key prefix (optional)"),e[13]=a,e[14]=C):C=e[14];let K;e[15]!==o||e[16]!==N||e[17]!==S||e[18]!==C?(K=(0,n.jsx)(Ce,{"aria-label":S,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:N,placeholder:C,value:o}),e[15]=o,e[16]=N,e[17]=S,e[18]=C,e[19]=K):K=e[19];let D;e[20]!==a?(D=a("List"),e[20]=a,e[21]=D):D=e[21];let F;e[22]!==s||e[23]!==h||e[24]!==D?(F=(0,n.jsx)(re,{"data-testid":"fb-list",disabled:s,onClick:h,size:"sm",type:"button",children:D}),e[22]=s,e[23]=h,e[24]=D,e[25]=F):F=e[25];let $;e[26]!==s||e[27]!==a?($=a(s?"Uploading\u2026":"Upload"),e[26]=s,e[27]=a,e[28]=$):$=e[28];let _;e[29]!==s||e[30]!==w||e[31]!==$?(_=(0,n.jsx)(re,{"data-testid":"storage-upload",disabled:s,onClick:w,size:"sm",type:"button",variant:"outline",children:$}),e[29]=s,e[30]=w,e[31]=$,e[32]=_):_=e[32];let I;e[33]!==c||e[34]!==m?(I=(0,n.jsx)("input",{className:"hidden","data-testid":"storage-file-input",onChange:m,ref:c,type:"file"}),e[33]=c,e[34]=m,e[35]=I):I=e[35];let E;e[36]!==a?(E=a("Link expiry"),e[36]=a,e[37]=E):E=e[37];let U;e[38]!==a?(U=kt.map(P=>(0,n.jsx)("option",{value:P.seconds,children:a(P.label)},P.seconds)),e[38]=a,e[39]=U):U=e[39];let L;e[40]!==i||e[41]!==y||e[42]!==U?(L=(0,n.jsx)("select",{className:"h-8 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":"storage-expiry",id:"storage-expiry",onChange:y,value:i,children:U}),e[40]=i,e[41]=y,e[42]=U,e[43]=L):L=e[43];let O;e[44]!==E||e[45]!==L?(O=(0,n.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[E,L]}),e[44]=E,e[45]=L,e[46]=O):O=e[46];let M;e[47]!==a?(M=a("Open in Cloudflare"),e[47]=a,e[48]=M):M=e[48];let A;e[49]!==M?(A=(0,n.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:Oe,rel:"noreferrer",target:"_blank",children:M}),e[49]=M,e[50]=A):A=e[50];let W;return e[51]!==_||e[52]!==I||e[53]!==O||e[54]!==A||e[55]!==z||e[56]!==K||e[57]!==F?(W=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[z,K,F,_,I,O,A]}),e[51]=_,e[52]=I,e[53]=O,e[54]=A,e[55]=z,e[56]=K,e[57]=F,e[58]=W):W=e[58],W},"Tt"),jt=g(d=>{let e=(0,B.c)(66),{onSortKeyChange:t,onThumbSizeChange:r,showGrid:s,showList:o,sortDirection:i,sortKey:c,t:l,tagKeys:u,thumbSize:m,toggleSortDirection:h,view:f}=d,w;e[0]!==t?(w=g(G=>{t(G.target.value)},"k"),e[0]=t,e[1]=w):w=e[1];let a=w,k;e[2]!==r?(k=g(G=>{r(Number.parseInt(G.target.value,10))},"v"),e[2]=r,e[3]=k):k=e[3];let N=k,x=f==="list",b;e[4]!==l?(b=l("List"),e[4]=l,e[5]=b):b=e[5];let v;e[6]!==o||e[7]!==x||e[8]!==b?(v=(0,n.jsx)("button",{"aria-pressed":x,className:"px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-list",onClick:o,type:"button",children:b}),e[6]=o,e[7]=x,e[8]=b,e[9]=v):v=e[9];let y=f==="grid",z;e[10]!==l?(z=l("Grid"),e[10]=l,e[11]=z):z=e[11];let S;e[12]!==s||e[13]!==y||e[14]!==z?(S=(0,n.jsx)("button",{"aria-pressed":y,className:"border-s border-border px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-grid",onClick:s,type:"button",children:z}),e[12]=s,e[13]=y,e[14]=z,e[15]=S):S=e[15];let C;e[16]!==v||e[17]!==S?(C=(0,n.jsxs)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[v,S]}),e[16]=v,e[17]=S,e[18]=C):C=e[18];let K;e[19]!==l?(K=l("Sort"),e[19]=l,e[20]=K):K=e[20];let D;e[21]!==l?(D=l("Name"),e[21]=l,e[22]=D):D=e[22];let F;e[23]!==D?(F=(0,n.jsx)("option",{value:"name",children:D}),e[23]=D,e[24]=F):F=e[24];let $;e[25]!==l?($=l("size"),e[25]=l,e[26]=$):$=e[26];let _;e[27]!==$?(_=(0,n.jsx)("option",{value:"size",children:$}),e[27]=$,e[28]=_):_=e[28];let I;e[29]!==l?(I=l("Type"),e[29]=l,e[30]=I):I=e[30];let E;e[31]!==I?(E=(0,n.jsx)("option",{value:"type",children:I}),e[31]=I,e[32]=E):E=e[32];let U;e[33]!==l?(U=l("Modified"),e[33]=l,e[34]=U):U=e[34];let L;e[35]!==U?(L=(0,n.jsx)("option",{value:"date",children:U}),e[35]=U,e[36]=L):L=e[36];let O;e[37]!==u?(O=u.map(Dt),e[37]=u,e[38]=O):O=e[38];let M;e[39]!==a||e[40]!==c||e[41]!==F||e[42]!==_||e[43]!==E||e[44]!==L||e[45]!==O?(M=(0,n.jsxs)("select",{className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-sort",id:"fb-sort",onChange:a,value:c,children:[F,_,E,L,O]}),e[39]=a,e[40]=c,e[41]=F,e[42]=_,e[43]=E,e[44]=L,e[45]=O,e[46]=M):M=e[46];let A;e[47]!==K||e[48]!==M?(A=(0,n.jsxs)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[K,M]}),e[47]=K,e[48]=M,e[49]=A):A=e[49];let W;e[50]!==l?(W=l("Toggle sort direction"),e[50]=l,e[51]=W):W=e[51];let P=i==="asc"?"\u2191":"\u2193",H;e[52]!==W||e[53]!==P||e[54]!==h?(H=(0,n.jsx)("button",{"aria-label":W,className:"flex size-8 items-center justify-center rounded-md border border-border tabular-nums outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"fb-sort-dir",onClick:h,type:"button",children:P}),e[52]=W,e[53]=P,e[54]=h,e[55]=H):H=e[55];let J;e[56]!==N||e[57]!==l||e[58]!==m||e[59]!==f?(J=f==="grid"&&(0,n.jsxs)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[l("Thumbnail size"),(0,n.jsx)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:N,step:8,type:"range",value:m})]}),e[56]=N,e[57]=l,e[58]=m,e[59]=f,e[60]=J):J=e[60];let oe;return e[61]!==A||e[62]!==H||e[63]!==J||e[64]!==C?(oe=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[C,A,H,J]}),e[61]=A,e[62]=H,e[63]=J,e[64]=C,e[65]=oe):oe=e[65],oe},"_t");function zt(d){return(0,n.jsx)("option",{value:d,children:d},d)}g(zt,"Et");function Dt(d){return(0,n.jsx)("option",{value:`tag:${d}`,children:d},d)}g(Dt,"$t");var Tt=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,Kt=g(d=>(d.httpMetadata?.contentType??"").startsWith("image/")||Tt.test(d.key),"Rt"),$t=g(()=>{let d=(0,B.c)(1),e;return d[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-8 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"})}),d[0]=e):e=d[0],e},"zt"),Ft=g(d=>{let e=(0,B.c)(13),{object:t,resolveUrl:r}=d,[s,o]=(0,j.useState)(null),[i,c]=(0,j.useState)(!1),l;e[0]!==t?(l=Kt(t),e[0]=t,e[1]=l):l=e[1];let u=l,m,h;e[2]!==u||e[3]!==t.key||e[4]!==r?(m=g(()=>{if(!u)return;let k={cancelled:!1};return V((async()=>{try{let N=await r(t.key);k.cancelled||o(N)}catch{k.cancelled||c(!0)}})()),()=>{k.cancelled=!0}},"h"),h=[u,t.key,r],e[2]=u,e[3]=t.key,e[4]=r,e[5]=m,e[6]=h):(m=e[5],h=e[6]),(0,j.useEffect)(m,h);let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=g(()=>{c(!0)},"m"),e[7]=f):f=e[7];let w=f,a;return e[8]!==i||e[9]!==u||e[10]!==t.key||e[11]!==s?(a=(0,n.jsx)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:u&&s!==null&&!i?(0,n.jsx)("img",{alt:t.key,className:"size-full object-cover",loading:"lazy",onError:w,src:s}):(0,n.jsx)($t,{})}),e[8]=i,e[9]=u,e[10]=t.key,e[11]=s,e[12]=a):a=e[12],a},"Dt"),_t=g(d=>{let e=(0,B.c)(42),{busy:t,copiedKey:r,handlers:s,object:o,prefix:i,references:c,resolveUrl:l,selected:u,showReferences:m,t:h}=d,f;e[0]!==s||e[1]!==o||e[2]!==i?(f=Me(o,i,s),e[0]=s,e[1]=o,e[2]=i,e[3]=f):f=e[3];let{copy:w,download:a,name:k,remove:N,toggle:x}=f,b;e[4]!==o||e[5]!==l?(b=(0,n.jsx)(Ft,{object:o,resolveUrl:l}),e[4]=o,e[5]=l,e[6]=b):b=e[6];let v;e[7]!==o.key||e[8]!==u||e[9]!==h||e[10]!==x?(v=(0,n.jsx)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,n.jsx)(Pe,{objectKey:o.key,onToggle:x,selected:u,t:h})}),e[7]=o.key,e[8]=u,e[9]=h,e[10]=x,e[11]=v):v=e[11];let y;e[12]!==b||e[13]!==v?(y=(0,n.jsxs)("div",{className:"relative",children:[b,v]}),e[12]=b,e[13]=v,e[14]=y):y=e[14];let z;e[15]!==k?(z=(0,n.jsx)("p",{className:"truncate font-mono text-xs",title:k,children:k}),e[15]=k,e[16]=z):z=e[16];let S;e[17]!==o.size?(S=pe(o.size),e[17]=o.size,e[18]=S):S=e[18];let C;e[19]!==S?(C=(0,n.jsx)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:S}),e[19]=S,e[20]=C):C=e[20];let K;e[21]!==o.key||e[22]!==c||e[23]!==m||e[24]!==h?(K=m&&(0,n.jsx)("div",{className:"mt-1",children:(0,n.jsx)(Ae,{objectKey:o.key,references:c,t:h})}),e[21]=o.key,e[22]=c,e[23]=m,e[24]=h,e[25]=K):K=e[25];let D;e[26]!==z||e[27]!==C||e[28]!==K?(D=(0,n.jsxs)("div",{className:"min-w-0",children:[z,C,K]}),e[26]=z,e[27]=C,e[28]=K,e[29]=D):D=e[29];let F=r===o.key,$;e[30]!==t||e[31]!==w||e[32]!==a||e[33]!==o.key||e[34]!==N||e[35]!==h||e[36]!==F?($=(0,n.jsx)("div",{className:"flex items-center gap-1",children:(0,n.jsx)(Be,{busy:t,buttonClassName:"h-7 px-2 text-xs",copied:F,objectKey:o.key,onCopy:w,onDelete:N,onDownload:a,t:h})}),e[30]=t,e[31]=w,e[32]=a,e[33]=o.key,e[34]=N,e[35]=h,e[36]=F,e[37]=$):$=e[37];let _;return e[38]!==$||e[39]!==y||e[40]!==D?(_=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[y,D,$]}),e[38]=$,e[39]=y,e[40]=D,e[41]=_):_=e[41],_},"jt"),Lt=g(d=>{let e=(0,B.c)(9),{name:t,onEnter:r}=d,s;e[0]!==t||e[1]!==r?(s=g(()=>{r(t)},"o"),e[0]=t,e[1]=r,e[2]=s):s=e[2];let o=s,i;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,n.jsx)("span",{className:"flex aspect-square w-full items-center justify-center rounded-md border border-border bg-muted/30 transition-colors hover:bg-accent",children:(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-10 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"})})}),e[3]=i):i=e[3];let c;e[4]!==t?(c=(0,n.jsx)("span",{className:"truncate font-mono text-xs",title:t,children:t}),e[4]=t,e[5]=c):c=e[5];let l;return e[6]!==o||e[7]!==c?(l=(0,n.jsxs)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:o,type:"button",children:[i,c]}),e[6]=o,e[7]=c,e[8]=l):l=e[8],l},"Kt"),Et=g(d=>{let e=(0,B.c)(34),{busy:t,copiedKey:r,files:s,folders:o,handlers:i,onEnterFolder:c,prefix:l,references:u,resolveUrl:m,selected:h,showReferences:f,size:w,t:a}=d,k;e[0]!==w?(k=w.toString(),e[0]=w,e[1]=k):k=e[1];let N=`repeat(auto-fill, minmax(${k}px, 1fr))`,x;e[2]!==N?(x={gridTemplateColumns:N},e[2]=N,e[3]=x):x=e[3];let b=x,v;if(e[4]!==o||e[5]!==c){let S;e[7]!==c?(S=g(C=>(0,n.jsx)(Lt,{name:C,onEnter:c},C),"S"),e[7]=c,e[8]=S):S=e[8],v=o.map(S),e[4]=o,e[5]=c,e[6]=v}else v=e[6];let y;if(e[9]!==t||e[10]!==r||e[11]!==s||e[12]!==i||e[13]!==l||e[14]!==u||e[15]!==m||e[16]!==h||e[17]!==f||e[18]!==a){let S;e[20]!==t||e[21]!==r||e[22]!==i||e[23]!==l||e[24]!==u||e[25]!==m||e[26]!==h||e[27]!==f||e[28]!==a?(S=g(C=>(0,n.jsx)(_t,{busy:t,copiedKey:r,handlers:i,object:C,prefix:l,references:u[C.key],resolveUrl:m,selected:h.has(C.key),showReferences:f,t:a},C.key),"S"),e[20]=t,e[21]=r,e[22]=i,e[23]=l,e[24]=u,e[25]=m,e[26]=h,e[27]=f,e[28]=a,e[29]=S):S=e[29],y=s.map(S),e[9]=t,e[10]=r,e[11]=s,e[12]=i,e[13]=l,e[14]=u,e[15]=m,e[16]=h,e[17]=f,e[18]=a,e[19]=y}else y=e[19];let z;return e[30]!==b||e[31]!==v||e[32]!==y?(z=(0,n.jsxs)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:b,children:[v,y]}),e[30]=b,e[31]=v,e[32]=y,e[33]=z):z=e[33],z},"Bt"),Ot=g(d=>{let e=(0,B.c)(23),{reference:t,t:r}=d,s=`fb-dangling-${t.table}-${t.id}-${t.column}`,o=`${t.table}\xB7${t.id}`,i;e[0]!==o?(i=(0,n.jsx)(ae,{variant:"secondary",children:o}),e[0]=o,e[1]=i):i=e[1];let c;e[2]!==t.column?(c=(0,n.jsx)("span",{className:"text-muted-foreground",children:t.column}),e[2]=t.column,e[3]=c):c=e[3];let l;e[4]!==r?(l=r("\u2192"),e[4]=r,e[5]=l):l=e[5];let u;e[6]!==l?(u=(0,n.jsx)("span",{className:"text-muted-foreground/60",children:l}),e[6]=l,e[7]=u):u=e[7];let m;e[8]!==t.key?(m=(0,n.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:t.key}),e[8]=t.key,e[9]=m):m=e[9];let h;e[10]!==i||e[11]!==c||e[12]!==u||e[13]!==m?(h=(0,n.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[i,c,u,m]}),e[10]=i,e[11]=c,e[12]=u,e[13]=m,e[14]=h):h=e[14];let f;e[15]!==r?(f=r("Missing object"),e[15]=r,e[16]=f):f=e[16];let w;e[17]!==f?(w=(0,n.jsx)(ae,{className:"border-destructive/40 text-destructive",variant:"outline",children:f}),e[17]=f,e[18]=w):w=e[18];let a;return e[19]!==s||e[20]!==w||e[21]!==h?(a=(0,n.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-border/60 px-3 py-2 text-xs","data-testid":s,children:[h,w]}),e[19]=s,e[20]=w,e[21]=h,e[22]=a):a=e[22],a},"Lt"),It=g(d=>{let e=(0,B.c)(37),{busy:t,onCheck:r,references:s,t:o,truncated:i}=d,c;e[0]!==o?(c=o("Integrity"),e[0]=o,e[1]=c):c=e[1];let l;e[2]!==c?(l=(0,n.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:c}),e[2]=c,e[3]=l):l=e[3];let u;e[4]!==o?(u=o("Orphaned objects"),e[4]=o,e[5]=u):u=e[5];let m;e[6]!==u?(m=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:u}),e[6]=u,e[7]=m):m=e[7];let h;e[8]!==o?(h=o("Find records whose file reference points at an object the bucket no longer has."),e[8]=o,e[9]=h):h=e[9];let f;e[10]!==h?(f=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:h}),e[10]=h,e[11]=f):f=e[11];let w;e[12]!==l||e[13]!==m||e[14]!==f?(w=(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[l,m,f]}),e[12]=l,e[13]=m,e[14]=f,e[15]=w):w=e[15];let a;e[16]!==t||e[17]!==o?(a=o(t?"Checking\u2026":"Check for orphans"),e[16]=t,e[17]=o,e[18]=a):a=e[18];let k;e[19]!==t||e[20]!==r||e[21]!==a?(k=(0,n.jsx)(re,{"data-testid":"fb-orphans-check",disabled:t,onClick:r,size:"sm",type:"button",variant:"outline",children:a}),e[19]=t,e[20]=r,e[21]=a,e[22]=k):k=e[22];let N;e[23]!==w||e[24]!==k?(N=(0,n.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[w,k]}),e[23]=w,e[24]=k,e[25]=N):N=e[25];let x;e[26]!==s?.length||e[27]!==o?(x=s?.length===0&&(0,n.jsx)(me,{description:o("Every record's file reference points at an object that exists in the bucket."),testId:"fb-orphans-empty",title:o("No dangling references.")}),e[26]=s?.length,e[27]=o,e[28]=x):x=e[28];let b;e[29]!==s||e[30]!==o||e[31]!==i?(b=s!==void 0&&s.length>0&&(0,n.jsxs)(n.Fragment,{children:[i&&(0,n.jsx)("p",{className:"text-xs text-warning","data-testid":"fb-orphans-truncated",children:o("Showing the first {count} dangling references \u2014 the scan was truncated.",{count:s.length})}),(0,n.jsx)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:s.map(y=>(0,n.jsx)(Ot,{reference:y,t:o},`${y.table}\xB7${y.id}\xB7${y.column}`))})]}),e[29]=s,e[30]=o,e[31]=i,e[32]=b):b=e[32];let v;return e[33]!==N||e[34]!==x||e[35]!==b?(v=(0,n.jsxs)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[N,x,b]}),e[33]=N,e[34]=x,e[35]=b,e[36]=v):v=e[36],v},"It"),Rt=g(function(d,e){let t=(0,B.c)(18),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=new Set,t[0]=r):r=t[0];let[s,o]=(0,j.useState)(r),i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=g(x=>{o(b=>{let v=new Set(b);return v.has(x)?v.delete(x):v.add(x),v})},"c"),t[1]=i):i=t[1];let c=i,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=g(()=>{o(new Set)},"n"),t[2]=l):l=t[2];let u=l,m,h,f;if(t[3]!==d||t[4]!==e||t[5]!==s){let x;t[9]!==e?(x=g(b=>e(b),"y"),t[9]=e,t[10]=x):x=t[10],h=d.map(x),m=h.length>0&&h.every(b=>s.has(b)),f=!m&&h.some(b=>s.has(b)),t[3]=d,t[4]=e,t[5]=s,t[6]=m,t[7]=h,t[8]=f}else m=t[6],h=t[7],f=t[8];let w=f,a;t[11]!==h?(a=g(()=>{o(x=>h.every(b=>x.has(b))?new Set:new Set(h))},"i"),t[11]=h,t[12]=a):a=t[12];let k=a,N;return t[13]!==m||t[14]!==s||t[15]!==w||t[16]!==k?(N={allSelected:m,clear:u,selected:s,someSelected:w,toggle:c,toggleAll:k},t[13]=m,t[14]=s,t[15]=w,t[16]=k,t[17]=N):N=t[17],N},"Ot"),Ut=fe(be.storageReferences),Mt=fe(be.storageOrphans),Re=1e4,Bt=1e3,At=3600,Pt=g((d,e)=>{if(!("document"in globalThis))return;let t=globalThis.document.createElement("a");t.href=d,t.download=e,t.rel="noopener",globalThis.document.body.append(t),t.click(),t.remove()},"Ht"),Vt=g(d=>d.key,"Pt"),Wt=g(({initialPrefix:d,pageSize:e})=>{let t=Se(),[r,s]=(0,j.useState)(d??""),[o,i]=(0,j.useState)(d??""),[c,l]=(0,j.useState)(wt),[u,m]=(0,j.useState)("list"),[h,f]=(0,j.useState)(128),[w,a]=(0,j.useState)("name"),[k,N]=(0,j.useState)("asc"),[x,b]=(0,j.useState)(void 0),[v,y]=(0,j.useState)(void 0),[z,S]=(0,j.useState)(!1),[C,K]=(0,j.useState)(void 0),[D,F]=(0,j.useState)(void 0),[$,_]=(0,j.useState)(""),[I,E]=(0,j.useState)({}),[U,L]=(0,j.useState)(!1),[O,M]=(0,j.useState)(void 0),[A,W]=(0,j.useState)(!1),[P,H]=(0,j.useState)(!1),[J,oe]=(0,j.useState)([]),[G,xe]=(0,j.useState)(""),le=(0,j.useRef)(0),X=(0,j.useRef)(0);(0,j.useEffect)(()=>{let p={cancelled:!1};return V((async()=>{try{let T=await t.listStorageBuckets();if(!p.cancelled){oe(T);let[R]=T;R!==void 0&&xe(q=>q===""?R:q)}}catch{}})()),()=>{p.cancelled=!0}},[t]);let Z=(0,j.useMemo)(()=>({list:g(p=>t.listStorageObjects({...p,bucket:G}),"list"),remove:g(p=>t.deleteStorageObject(p,{bucket:G}),"remove"),signedUrl:g((p,T)=>t.signedStorageUrl(p,{...T,bucket:G}),"signedUrl"),upload:g(p=>t.uploadStorageObject({...p,bucket:G}),"upload")}),[G,t]),Y=(0,j.useCallback)(async(p,T,R)=>{le.current+=1;let q=le.current;y(void 0),S(!0);try{let te=await Z.list({cursor:T,limit:e,prefix:p});if(q!==le.current)return;b(we=>R&&we!==void 0?[...we,...te.objects]:te.objects),F(te.cursor)}catch(te){if(q!==le.current)return;R||b(void 0),y(Q(te))}finally{q===le.current&&S(!1)}},[e,Z]);(0,j.useEffect)(()=>{V(Y(d??"",void 0,!1))},[Y,d]);let Ve=(x?.length??0)<=e;Le(()=>{V(Y(r,void 0,!1))},Ve);let{files:de,folders:We}=Nt(x??[],r),He=(0,j.useMemo)(()=>{let p=new Set;for(let T of de)for(let R of Object.keys(T.customMetadata??{}))p.add(R);return[...p].toSorted((T,R)=>T.localeCompare(R))},[de]),ce=St(de,w,k),ue=(0,j.useMemo)(()=>[...new Set(ce.map(p=>p.key))].toSorted((p,T)=>p.localeCompare(T)).join(`
3
+ `),[ce]);(0,j.useEffect)(()=>{let p=ue===""?[]:ue.split(`
4
+ `);if(p.length===0){E({});return}let T={current:!0};return V((async()=>{try{let R=await t.query(Ut,{keys:p},ge($));T.current&&(E(R.references??{}),L(Object.keys(R.storageColumns??{}).length>0))}catch{T.current&&(E({}),L(!1))}})()),()=>{T.current=!1}},[t,ue,$]);let{allSelected:qe,clear:se,selected:ve,someSelected:Ge,toggle:Ze,toggleAll:Ye}=Rt(ce,Vt),Je=g(()=>{s(o),se(),V(Y(o,void 0,!1))},"Ae"),Xe=g(()=>{V(Y(r,D,!0))},"Ue"),ke=g(p=>{s(p),i(p),se(),V(Y(p,void 0,!1))},"ye"),Qe=g(p=>{ke(`${r}${p}`)},"Me"),et=g(p=>Z.signedUrl(p,{expiresInSeconds:At}),"Ge"),tt=g(()=>{m("list")},"He"),rt=g(()=>{m("grid")},"Pe"),nt=g(p=>{a(p)},"qe"),ot=g(()=>{N(p=>p==="asc"?"desc":"asc")},"Ve"),lt=g(p=>{f(p)},"We"),st=g(p=>{l(p)},"Ze"),at=g(()=>{y(void 0),S(!0),V((async()=>{try{for(let p of ve)await Z.remove(p);await Y(r,void 0,!1),se()}catch(p){y(Q(p))}S(!1)})())},"Xe"),ct=g(p=>{y(void 0),V((async()=>{try{let T=await Z.signedUrl(p,{expiresInSeconds:c});De(T)&&K(p)}catch(T){y(Q(T))}})())},"Ye"),it=g(p=>{y(void 0),V((async()=>{try{let T=await Z.signedUrl(p,{expiresInSeconds:c}),R=p.slice(p.lastIndexOf("/")+1)||p;Pt(T,R)}catch(T){y(Q(T))}})())},"Je");(0,j.useEffect)(()=>{if(C===void 0)return;let p=globalThis.setTimeout(()=>{K(void 0)},2e3);return()=>{globalThis.clearTimeout(p)}},[C]);let dt=g(p=>{y(void 0),S(!0),V((async()=>{try{await Z.remove(p),await Y(r,void 0,!1)}catch(T){y(Q(T))}S(!1)})())},"Qe"),ut=g(p=>{let T=`${r}${p.name}`;y(void 0),S(!0),V((async()=>{try{let R=await p.arrayBuffer();await Z.upload({body:R,contentType:p.type===""?void 0:p.type,key:T}),await Y(r,void 0,!1)}catch(R){y(Q(R))}S(!1)})())},"et");(0,j.useEffect)(()=>{X.current+=1,M(void 0),H(!1)},[$]);let ht=g(()=>{X.current+=1;let p=X.current;y(void 0),W(!0),V((async()=>{try{let T=[],R;do{let q=await Z.list({cursor:R,limit:Bt});for(let te of q.objects)T.push(te.key);R=T.length>=Re?void 0:q.cursor}while(R!==void 0);if(T.length>=Re)p===X.current&&(M([]),H(!0));else{let q=await t.query(Mt,{liveKeys:T},ge($));p===X.current&&(M(q.references??[]),H(q.truncated===!0))}}catch(T){p===X.current&&(M([]),H(!1),y(Q(T)))}p===X.current&&W(!1)})())},"tt"),mt=g(p=>{le.current+=1,X.current+=1,xe(p),s(d??""),i(d??""),b(void 0),M(void 0),H(!1),se()},"st");return{allSelected:qe,bucket:G,buckets:J,bulkDelete:at,busy:z,checkOrphans:ht,clearSelection:se,copiedKey:C,danglingBusy:A,danglingReferences:O,danglingTruncated:P,draftPrefix:o,enterFolder:Qe,error:v,expiry:c,files:ce,folders:We,hasObjects:x!==void 0&&x.length>0,hasStorageColumns:U,listFirst:Je,loaded:x!==void 0,loadMore:Xe,navigate:ke,nextCursor:D,onCopy:ct,onDelete:dt,onDownload:it,onExpiryChange:st,onFile:ut,onSortKeyChange:nt,onThumbSizeChange:lt,prefix:r,referenceShard:$,references:I,resolveUrl:et,selectBucket:mt,selected:ve,setDraftPrefix:i,setReferenceShard:_,showGrid:rt,showList:tt,someSelected:Ge,sortDirection:k,sortKey:w,tagKeys:He,thumbSize:h,toggleSelect:Ze,toggleSelectAll:Ye,toggleSortDirection:ot,view:u}},"qt"),Ht=100,Ue=g(d=>{let e=(0,B.c)(6),{label:t,onNavigate:r,target:s}=d,o;e[0]!==r||e[1]!==s?(o=g(()=>{r(s)},"l"),e[0]=r,e[1]=s,e[2]=o):o=e[2];let i=o,c;return e[3]!==i||e[4]!==t?(c=(0,n.jsx)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:i,type:"button",children:t}),e[3]=i,e[4]=t,e[5]=c):c=e[5],c},"Se"),qt=g(d=>{let e=(0,B.c)(11),{onNavigate:t,prefix:r,t:s}=d,o;if(e[0]!==t||e[1]!==r||e[2]!==s){let i=r.split("/").filter(Gt),c;e[4]!==s?(c=s("Folder path"),e[4]=s,e[5]=c):c=e[5];let l;e[6]!==s?(l=s("root"),e[6]=s,e[7]=l):l=e[7];let u;e[8]!==t||e[9]!==l?(u=(0,n.jsx)(Ue,{label:l,onNavigate:t,target:""}),e[8]=t,e[9]=l,e[10]=u):u=e[10],o=(0,n.jsxs)("nav",{"aria-label":c,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[u,i.map((m,h)=>(0,n.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,n.jsx)("span",{className:"text-muted-foreground/50",children:"/"}),(0,n.jsx)(Ue,{label:m,onNavigate:t,target:`${i.slice(0,h+1).join("/")}/`})]},`${m}-${h.toString()}`))]}),e[0]=t,e[1]=r,e[2]=s,e[3]=o}else o=e[3];return o},"Wt"),ur=g(({initialPrefix:d,pageSize:e=Ht})=>{let t=Ne(),r=Wt({initialPrefix:d,pageSize:e}),s=(0,j.useRef)(null),{onCopy:o,onDelete:i,onDownload:c,onFile:l,toggleSelect:u}=r,m={onCopy:o,onDelete:i,onDownload:c,onToggleSelect:u},h=g(()=>{s.current?.click()},"u"),f=g(a=>{let k=a.target,N=k.files?.[0];k.value="",N&&l(N)},"m"),w=r.loaded&&!r.hasObjects;return(0,n.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,n.jsx)(Ct,{bucket:r.bucket,buckets:r.buckets,busy:r.busy,draftPrefix:r.draftPrefix,expiry:r.expiry,fileInputRef:s,onBucketChange:r.selectBucket,onExpiryChange:r.onExpiryChange,onFileChange:f,onList:r.listFirst,onPrefixChange:r.setDraftPrefix,onUploadClick:h,t}),r.loaded&&(0,n.jsx)(qt,{onNavigate:r.navigate,prefix:r.prefix,t}),r.hasObjects&&(0,n.jsx)(jt,{onSortKeyChange:r.onSortKeyChange,onThumbSizeChange:r.onThumbSizeChange,showGrid:r.showGrid,showList:r.showList,sortDirection:r.sortDirection,sortKey:r.sortKey,t,tagKeys:r.tagKeys,thumbSize:r.thumbSize,toggleSortDirection:r.toggleSortDirection,view:r.view}),r.hasStorageColumns&&(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,n.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:t("References shard")}),(0,n.jsx)(Te,{id:"fb-reference-shard-input",onChange:r.setReferenceShard,testId:"fb-reference-shard-input",value:r.referenceShard}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:t("Which shard's records are checked for references to these files. Empty = root shard.")})]}),r.hasStorageColumns&&(0,n.jsx)(It,{busy:r.danglingBusy,onCheck:r.checkOrphans,references:r.danglingReferences,t,truncated:r.danglingTruncated}),r.selected.size>0&&(0,n.jsx)(Ee,{count:r.selected.size,editable:!0,onClear:r.clearSelection,onDelete:r.bulkDelete}),r.error!==void 0&&(0,n.jsx)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:r.error}),w&&(0,n.jsx)(me,{description:t("Objects you upload to your R2 buckets will appear here."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"}),(0,n.jsx)("path",{d:"M12 11v5m-2.5-2.5h5"})]}),testId:"fb-empty",title:t("No objects.")}),r.hasObjects&&r.view==="list"&&(0,n.jsx)(vt,{allSelected:r.allSelected,busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:m,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,selected:r.selected,showReferences:r.hasStorageColumns,someSelected:r.someSelected,t,toggleSelectAll:r.toggleSelectAll}),r.hasObjects&&r.view==="grid"&&(0,n.jsx)(Et,{busy:r.busy,copiedKey:r.copiedKey,files:r.files,folders:r.folders,handlers:m,onEnterFolder:r.enterFolder,prefix:r.prefix,references:r.references,resolveUrl:r.resolveUrl,selected:r.selected,showReferences:r.hasStorageColumns,size:r.thumbSize,t}),r.nextCursor!==void 0&&(0,n.jsx)("div",{children:(0,n.jsx)(re,{"data-testid":"fb-next",disabled:r.busy,onClick:r.loadMore,size:"sm",type:"button",variant:"outline",children:t("Load more")})})]})},"ps");function Gt(d){return d!==""}g(Gt,"Zt");export{ur as FileBrowser};
@@ -0,0 +1,15 @@
1
+ import{a}from"./chunk-R5ZTCHCE.js";var r="https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/",n="https://developers.cloudflare.com/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/",_=/string or blob too big/iu,l={BAD_REQUEST:{status:400,title:"Bad request"},UNAUTHORIZED:{status:401,title:"Unauthorized"},FORBIDDEN:{status:403,title:"Forbidden"},NOT_FOUND:{status:404,title:"Not found"},CONFLICT:{hint:["Another write changed this row while your mutation was running (optimistic concurrency conflict).","","Re-read the row and retry the mutation with the fresh value. Lunora serializes a DO's mutations, so a persistent conflict usually means the handler conflicts **with itself** (e.g. a trigger or cascade touching the same row) \u2014 split that work rather than adding a retry loop."],status:409,title:"Conflict"},NOT_UNIQUE:{hint:["`.unique()` matched more than one document \u2014 it expects the query to identify at most one row.","","- If several matches are legitimate, use `.first()` (take one) or `.collect()` (take all) instead.","- Otherwise tighten the query (e.g. filter on a unique/indexed field) so it can only match one row."],status:400,title:"Query matched more than one document"},VALIDATION_ERROR:{status:400,title:"Validation failed"},TOO_MANY_REQUESTS:{status:429,title:"Too many requests"},UNPROCESSABLE:{status:422,title:"Unprocessable"},NOT_IMPLEMENTED:{status:501,title:"Not implemented"},FUNCTION_NOT_FOUND:{status:404,title:"Function not found"},METHOD_NOT_ALLOWED:{status:405,title:"Method not allowed"},PAYLOAD_TOO_LARGE:{status:413,title:"Payload too large"},INTERNAL:{internal:!0,status:500,title:"Internal error"},INTERNAL_SERVER_ERROR:{internal:!0,status:500,title:"Internal error"},RPC_FAILED:{internal:!0,status:500,title:"Internal error"},COUNT_RLS_UNSUPPORTED:{status:422,title:"count() is unsupported under an RLS policy"},MASK_UNSUPPORTED:{status:422,title:"Aggregation over a masked column is unsupported"},RELATION_PREDICATE_UNSUPPORTED:{status:422,title:"Relation predicate is unsupported in a write policy"},RLS_REQUIRED:{hint:["This table is secure-by-default: it has no `.public()` marker and no RLS policy resolved for the caller, so the read fails closed.","","Add a read policy with `.rls(...)`, or mark the table `.public()` if it is intentionally world-readable."],status:403,title:"RLS policy required"},RUN_DEPTH_EXCEEDED:{internal:!0,status:500,title:"Run depth exceeded"},TRANSACTION_LIMIT_EXCEEDED:{hint:["A single mutation may only read and write a bounded amount before it is stopped.","","Narrow the read with an index (`.withIndex(...)`) instead of scanning the table, or split the write across several mutations \u2014 for a large backfill use `defineMigration` + `lunora migrate up`, which batches and checkpoints for you.","","The ceilings are deliberately conservative \u2014 they exist to stop one request taking down the whole shard. A deployment that genuinely needs bigger transactions can raise them by overriding the `transactionLimits()` seam on its generated shard class."],status:413,title:"Transaction limit exceeded"},MIGRATION_NOT_FOUND:{status:404,title:"Data migration not found"},UNKNOWN_TABLE:{status:404,title:"Unknown table"},GLOBAL_TABLE_NOT_EDITABLE:{status:400,title:"Global table is not editable"},SHARD_ERROR:{status:503,title:"Shard error"},SHARD_UNAVAILABLE:{status:503,title:"Shard unavailable"},OFFLINE_IDENTITY_CHANGED:{status:409,title:"Offline identity changed"},CODEGEN_DIAGNOSTIC:{status:500,title:"Codegen diagnostic"},SCHEMA_SNAPSHOT_PARSE:{status:500,title:"Schema snapshot parse error"},ENV_INVALID:{internal:!0,status:500,title:"Invalid environment"},AUTH_HEADERS_MISSING:{internal:!0,status:500,title:"Auth headers missing"},EMAIL_DOMAIN_BLOCKED:{hint:["This address's domain is on the disposable/throwaway blocklist (or your configured deny-list).","","Sign up with a permanent mailbox. To tune the policy, pass `blockDisposable` / `allowDomains` / `denyDomains` to `emailGate(...)` (`@lunora/auth/email-guard`)."],status:400,title:"Email domain not allowed"},EMAIL_UNDELIVERABLE:{hint:["The address's domain publishes no MX (or fallback A/AAAA) records, so it can't receive mail.","","Check for a typo in the domain. MX verification is opt-in (`mx: true`) and needs DNS \u2014 leave it off on the edge path if DNS is unavailable."],status:400,title:"Email domain cannot receive mail"},ANALYTICS_SQL_ERROR:{status:502,title:"Analytics Engine SQL API error"},R2_SQL_ERROR:{status:502,title:"R2 SQL API error"},WORKFLOWS_REST_ERROR:{status:502,title:"Cloudflare Workflows REST API error"},ADMIN_FORBIDDEN:{status:403,title:"Admin access forbidden"},ADMIN_TOKEN_NOT_CONFIGURED:{status:400,title:"Admin token not configured"},AUTH_NOT_CONFIGURED:{status:400,title:"Auth admin not configured"},AUTH_OP_NOT_SUPPORTED:{status:400,title:"Auth admin operation not supported"},BACKUP_NOT_CONFIGURED:{status:500,title:"Scheduled backup not configured"},BACKUP_RETENTION_NOT_CONFIGURED:{hint:["`lunora backup prune` removes snapshots past the retention window, and this worker has no window: set `backupRetain` (how many to keep) and `backupCron` (which decides whose snapshots retention owns) on `createWorker`.","","Nothing was deleted. A default is deliberately not invented here \u2014 retention deleting on its own is exactly what this command exists to replace."],status:400,title:"Backup retention window not configured"},BACKUP_TOO_LARGE:{hint:["The scheduled backup is assembled inside the Worker isolate, so it caps the snapshot it will build. Nothing was written.","","The cap is on the NDJSON, not on peak memory: the export fan-out resolves every shard's rows before the first row is encoded, so a snapshot under the cap can still exhaust the isolate. It is set well below the isolate's limit for that reason.","","Narrow the snapshot with `backupTables`, or take this backup off-platform with `lunora backup create --bucket`, which runs on a machine rather than in an isolate. Backing up more often does not help \u2014 every run is a full snapshot."],status:507,title:"Backup too large to assemble in a Worker"},CRON_JOBS_NOT_CONFIGURED:{status:400,title:"Cron jobs not configured"},CRON_JOB_NOT_FOUND:{status:404,title:"Cron job not found"},EXPORT_TAP_NOT_CONFIGURED:{status:400,title:"Export tap not configured"},FUNCTIONS_NOT_CONFIGURED:{status:400,title:"Functions registry not configured"},GLOBALS_NOT_CONFIGURED:{status:400,title:"Global-table introspector not configured"},KV_NOT_CONFIGURED:{status:400,title:"KV introspector not configured"},MIGRATION_ID_REQUIRED:{status:400,title:"Migration id required"},PITR_UNAVAILABLE:{status:409,title:"Point-in-time recovery unavailable"},SCHEDULER_NOT_CONFIGURED:{status:400,title:"Scheduler not configured"},STORAGE_CHECKSUM_MISMATCH:{hint:["The upload body did not match the declared `expectedSize` or `expectedSha256`, so nothing was written \u2014 this check fails closed.","","Re-read the bytes from the source export and retry the transfer. A persistent mismatch means the source blob is corrupt or truncated; fix the export rather than bypassing the check."],status:400,title:"Storage checksum mismatch"},STORAGE_DELETE_NOT_CONFIGURED:{status:400,title:"Storage delete not configured"},STORAGE_DOWNLOAD_NOT_CONFIGURED:{hint:["`GET /_lunora/admin/storage/object` needs a `storageDownload` function on the worker. The generated app worker wires it up; a hand-written `createWorker({ ... })` has to pass `(key, opts) => pick(opts?.bucket).download(key)` \u2014 forwarding `opts.bucket` to the right bucket, and wrapping rather than passing `createStorage(...).download` itself, whose second parameter is a byte range.","","Without it a bucket-backed `lunora backup restore --bucket` cannot read the snapshot. The object is still readable out of band with `wrangler r2 object get`."],status:400,title:"Storage download not configured"},STORAGE_NOT_CONFIGURED:{status:400,title:"Storage not configured"},STORAGE_OBJECT_NOT_FOUND:{status:404,title:"Storage object not found"},STORAGE_UPLOAD_NOT_CONFIGURED:{status:400,title:"Storage upload not configured"},STORAGE_URL_NOT_CONFIGURED:{status:400,title:"Storage signed URL not configured"},VECTORS_NOT_CONFIGURED:{status:400,title:"Vector index introspector not configured"},VECTOR_QUERY_UNSUPPORTED:{status:400,title:"Vector index querying not enabled"},WORKFLOWS_NOT_CONFIGURED:{status:501,title:"Workflows not configured"},AUTH_AUDIT_NOT_CONFIGURED:{status:400,title:"Auth audit reader not configured"},AUTH_AUDIT_READ_FAILED:{internal:!0,status:500,title:"Auth audit read failed"},CRON_EXPR_INVALID:{status:500,title:"Invalid cron expression"},CRON_EXPR_NOT_STATIC:{status:500,title:"Cron expression is not statically analyzable"},CRON_JOB_FAILED:{internal:!0,status:500,title:"Cron job failed"},CRON_NAME_NOT_STATIC:{status:500,title:"Cron job name is not statically analyzable"},CRON_NON_STATIC_FN:{status:500,title:"Cron function reference is not statically analyzable"},CRON_NON_STATIC_VALUE:{status:500,title:"Cron value is not statically analyzable"},CRON_SCHEDULE_INVALID:{status:500,title:"Invalid cron schedule"},CRON_SCHEDULE_NOT_STATIC:{status:500,title:"Cron schedule is not statically analyzable"},DUPLICATE_CRON_NAME:{status:500,title:"Duplicate cron job name"},DUPLICATE_AGENT_BINDING:{status:500,title:"Duplicate agent binding"},DUPLICATE_AGENT_CLASS:{status:500,title:"Duplicate agent generated class name"},DUPLICATE_AGENT_NAME:{status:500,title:"Duplicate agent name"},DUPLICATE_MIGRATION_ID:{status:500,title:"Duplicate migration id"},DUPLICATE_QUEUE_BINDING:{status:500,title:"Duplicate queue binding"},DUPLICATE_QUEUE_NAME:{status:500,title:"Duplicate queue name"},DUPLICATE_WORKFLOW_CLASS:{status:500,title:"Duplicate workflow generated class name"},MIGRATION_ID_NOT_STATIC:{status:500,title:"Migration id is not statically analyzable"},NAMESPACE_COLLISION:{status:500,title:"Function namespace collision"},BAD_ROW:{status:400,title:"Malformed import row"},BAD_SUBSCRIPTION_ARGS:{status:400,title:"Invalid subscription arguments"},BATCH_LIMIT_EXCEEDED:{status:400,title:"Batch limit exceeded"},CROSS_SHARD_RANK_UNSUPPORTED:{status:400,title:"Cross-shard rank() is unsupported"},FORBIDDEN_FANOUT:{status:403,title:"Fan-out forbidden"},FORBIDDEN_ORIGIN:{status:403,title:"Origin forbidden"},FORBIDDEN_SHARD:{status:403,title:"Shard access forbidden"},GLOBAL_NOT_CONFIGURED:{status:400,title:"Global table import not configured"},INVALID_INPUT:{status:400,title:"Invalid input"},RATE_LIMITED:{status:429,title:"Rate limited"},REPLICA_NOT_READY:{status:421,title:"Replica not caught up"},REPLICA_READ_ONLY:{status:421,title:"Replica is read-only"},SERVICE_UNAVAILABLE:{status:503,title:"Service unavailable"},SHAPE_CROSS_SHARD_JOIN:{status:400,title:"Shape cross-shard join is unsupported"},UNAUTHENTICATED:{status:401,title:"Unauthenticated"},UNKNOWN_COLUMN:{status:404,title:"Unknown column"},CDC_LOG_TRIMMED:{status:409,title:"CDC log trimmed"},CDC_PAYLOAD_COMPACTED:{status:409,title:"CDC payloads compacted"},EXPIRED:{status:404,title:"Session expired"},NESTED_TRANSACTION:{internal:!0,status:500,title:"Nested transaction"},OUT_OF_ORDER:{status:409,title:"Out-of-order mutation"},SHAPE_GLOBAL_TOO_LARGE:{status:413,title:"Global shape too large"},SHAPE_NOT_FOUND:{status:404,title:"Shape not found"},SHAPE_REQUIRES_CDC:{status:409,title:"Shape requires change-data-capture"},SQL_UNAVAILABLE:{internal:!0,status:500,title:"SQL storage unavailable"},STREAM_INTERRUPTED:{status:503,title:"Durable stream interrupted"},STREAM_TOO_LONG:{status:507,title:"Durable stream exceeded its chunk ceiling"},TOKEN_EXPIRED:{status:401,title:"Authentication token expired"},TOO_MANY_STREAMS:{status:429,title:"Too many streams"},UNKNOWN_ADMIN_OP:{status:404,title:"Unknown admin operation"},SOCKET_TAG_BUDGET_EXCEEDED:{status:400,title:"Socket tag budget exceeded"},RELAY_CANNOT_SEED:{status:500,title:"Relay cannot seed"},RELAY_MISCONFIGURED:{status:500,title:"Relay misconfigured"},RELAY_SEED_FAILED:{status:502,title:"Relay seed failed"},RELAY_SHAPE_UNROUTABLE:{status:500,title:"Relay shape unroutable"},MISCONFIGURED:{internal:!0,status:500,title:"Worker misconfigured"},LUNORA_RUNTIME_UNAVAILABLE:{status:500,title:"Lunora runtime unavailable"},INTERNAL_ERROR:{internal:!0,status:500,title:"Internal error"},BROWSER_TIMEOUT:{status:504,title:"Browser operation timed out"},CLIENT_CLOSED:{status:400,title:"Client is closed"},HTTP_STREAM_BAD_CHUNK:{status:502,title:"Malformed HTTP stream chunk"},HTTP_STREAM_INTERRUPTED:{status:502,title:"HTTP stream interrupted"},HTTP_STREAM_MISSING_PARAM:{status:400,title:"HTTP stream missing path parameter"},HTTP_STREAM_NO_BODY:{status:502,title:"HTTP stream response has no body"},HTTP_STREAM_STATUS:{status:502,title:"HTTP stream request failed"},HTTP_STREAM_TRANSPORT:{status:502,title:"HTTP stream transport error"},STREAM_BACKPRESSURE:{status:429,title:"Stream backpressure"},STREAM_DISCONNECTED:{status:503,title:"Stream disconnected"},STREAM_QUEUE_OVERFLOW:{status:429,title:"Stream queue overflow"},UNKNOWN_MUTATION_FN:{status:404,title:"Unknown mutation function"}},f=a(e=>Object.hasOwn(l,e)?l[e]:void 0,"h");var m=[{body:["A single row exceeded the storage engine's per-row ceiling \u2014 2 MB on a Durable Object's SQLite, and 2,000,000 bytes on D1.","","The limit is on the STORED bytes, which are UTF-8: a document of multi-byte text (CJK, emoji) costs up to 3x its character count. `v.bytes()` and `v.bigint()` columns cost more again on a shard-local table, where the row stores both a SQL-comparable projection and the original.","","Keep the large payload out of the row and store a reference to it:","","```ts","const key = `uploads/${crypto.randomUUID()}`;","await ctx.storage.uploads.put(key, bytes);",'await ctx.db.insert("documents", { storageKey: key, title });',"```","","R2 has no practical object-size ceiling, and the row stays small enough to read, index, and replicate."].join(`
2
+ `),header:"Row too large for the storage engine",id:"lunora-row-too-big",test:a(e=>_.test(e),"test")},{body:["Lunora codegen couldn't find a schema to generate from.","","Create `lunora/schema.ts` exporting a `defineSchema(...)` call:","","```ts",'import { defineSchema, defineTable, v } from "@lunora/server";',"","export default defineSchema({"," messages: defineTable({ body: v.string() }),","});","```","","Or run `lunora init` to scaffold Lunora (a sample `lunora/schema.ts` included) into your app."].join(`
3
+ `),header:"No Lunora schema found",id:"lunora-schema-missing",test:a(e=>e.includes("defineSchema() not found")||e.includes("schema.ts not found at"),"test")},{body:["`defineSchema(...)` must be called with an **inline object literal** mapping table names to `defineTable(...)`:","","```ts","export default defineSchema({"," todos: defineTable({ title: v.string(), done: v.boolean() }),","});","```","","Codegen reads the schema statically, so it can't follow a variable or a spread \u2014 pass the object literal directly."].join(`
4
+ `),header:"`defineSchema()` needs an inline object literal",id:"lunora-schema-not-object-literal",test:a(e=>e.includes("defineSchema() expects an object literal"),"test")},{body:["This table name collides with a built-in `ctx.db` member, so the generated client can't expose it.","","Rename the table to anything that isn't a reserved name (the error lists them) \u2014 e.g. `userAccounts` instead of `insert`."].join(`
5
+ `),header:"Table name is reserved",id:"lunora-table-reserved",test:a(e=>e.includes("is reserved")&&e.includes("ctx.db"),"test")},{body:["Two tables resolve to the same name \u2014 usually a base table and a schema **extension** both defining it.","","Rename one of them, or drop the duplicate from the extension. Each table name must be unique across `defineSchema(...)` and every `.extend(...)`."].join(`
6
+ `),header:"Duplicate table name",id:"lunora-table-duplicate",test:a(e=>e.includes("already exists")&&e.includes(".extend("),"test")},{body:['`.jurisdiction(...)` accepts only a **string literal** of `"eu"`, `"us"`, or `"fedramp"`:',"","```ts",'defineSchema({ /* \u2026 */ }).jurisdiction("eu");',"```"].join(`
7
+ `),header:"Invalid `.jurisdiction(...)` value",id:"lunora-jurisdiction",test:a(e=>e.includes("unknown jurisdiction")||e.includes("jurisdiction")&&e.includes('"eu", "us", or "fedramp"'),"test")},{body:["The `unique` flag on an index must be a **literal** `true` or `false`, not a computed value \u2014 codegen needs to read it statically:","","```ts",'defineTable({ email: v.string() }).index("by_email", ["email"], { unique: true });',"```"].join(`
8
+ `),header:"`unique` must be a literal",id:"lunora-unique-literal",test:a(e=>e.includes("must be a literal")&&e.includes("unique"),"test")},{body:["A declared container/workflow class isn't re-exported by your worker entry, so `wrangler deploy` would reject it.","","Add the generated re-export shown in the error to your worker entry (e.g. `src/index.ts`):","","```ts",'export * from "./lunora/_generated/containers";',"```"].join(`
9
+ `),header:"Binding not exported by your worker entry",id:"lunora-worker-entry-export-gap",test:a(e=>e.includes("not exported by your worker entry"),"test")},{body:["A row with the same value already exists in a `unique` index.","","- If you meant to upsert, use `ctx.db.<table>().upsert(...)` (or `.patch(...)` an existing row) instead of `.insert(...)`.",`- Otherwise pick a value that isn't already taken, and consider surfacing a friendly "already exists" message to the user.`].join(`
10
+ `),header:"Unique constraint violation",id:"lunora-runtime-unique",test:a(e=>e.includes("unique constraint violation on"),"test")},{body:l.CONFLICT.hint.join(`
11
+ `),header:"Optimistic concurrency conflict",id:"lunora-runtime-occ",test:a(e=>e.includes("optimistic concurrency conflict"),"test")}],u=[{causes:"the origin returned an empty, unknown, or malformed response Cloudflare couldn't interpret (often an origin crash or an oversized response header)",code:"520",docsUrl:r,family:"5xx",fix:"check your origin's logs for a crash, ensure it returns a valid HTTP response, and keep response headers under the size limit",summary:"Cloudflare got an unknown/empty response from your origin web server.",title:"Web server returns an unknown error"},{causes:"the origin refused the connection \u2014 the web server is down, or a firewall is blocking Cloudflare's IP ranges",code:"521",docsUrl:r,family:"5xx",fix:"confirm the origin process is running and allowlist Cloudflare's published IP ranges in your firewall/security groups",summary:"Cloudflare could not connect to your origin because it refused the connection.",title:"Web server is down"},{causes:"Cloudflare could not establish a TCP connection to the origin in time \u2014 the origin is overloaded, a firewall is dropping packets, or the origin IP is wrong",code:"522",docsUrl:r,family:"5xx",fix:"verify the origin is reachable and not overloaded, and that the DNS record points at the correct origin IP",summary:"The connection to your origin timed out before it was established.",title:"Connection timed out"},{causes:"Cloudflare cannot route to the origin at all \u2014 a bad DNS record, an origin IP that changed, or invalid routing",code:"523",docsUrl:r,family:"5xx",fix:"verify the DNS A/AAAA record points at a reachable origin IP and that no upstream network is blocking Cloudflare",summary:"Cloudflare could not reach your origin server.",title:"Origin is unreachable"},{causes:"Cloudflare made a TCP connection but the origin did not return an HTTP response within 100 seconds \u2014 a slow handler or long-running request",code:"524",docsUrl:r,family:"5xx",fix:"speed up the slow origin handler, or move long work off the request path into a background job (a Durable Object, Queue, or Workflow)",summary:"Cloudflare connected to your origin but it did not respond in time.",title:"A timeout occurred"},{causes:"the TLS handshake between Cloudflare and the origin failed \u2014 a missing/invalid origin certificate, or a cipher/SNI mismatch under Full (Strict) SSL",code:"525",docsUrl:r,family:"5xx",fix:"install a valid certificate on the origin and align your Cloudflare SSL/TLS mode with the origin's certificate setup",summary:"The SSL handshake with your origin failed.",title:"SSL handshake failed"},{causes:"Cloudflare could not validate the origin's certificate under Full (Strict) SSL \u2014 it is expired, self-signed, or issued for the wrong hostname",code:"526",docsUrl:r,family:"5xx",fix:"install a valid, publicly-trusted certificate on the origin (or use a Cloudflare Origin CA cert), matching the request hostname",summary:"Cloudflare could not validate your origin's SSL certificate.",title:"Invalid SSL certificate"},{causes:"a DNS record points at a Cloudflare IP or another prohibited address instead of your real origin",code:"1000",docsUrl:n,family:"1xxx",fix:"point the DNS record at your real origin IP, not a Cloudflare-owned or loopback address",summary:"DNS points to a prohibited IP.",title:"DNS points to prohibited IP"},{causes:"Cloudflare could not resolve the requested hostname \u2014 a Worker fetched an unresolvable host, or a DNS record is misconfigured",code:"1001",docsUrl:n,family:"1xxx",fix:"check the hostname you're requesting and the DNS records for the zone resolve to a valid origin",summary:"Cloudflare could not resolve the origin DNS.",title:"DNS resolution error"},{causes:"a Worker or DNS record targets a restricted IP (for example a Cloudflare-owned or loopback address)",code:"1002",docsUrl:n,family:"1xxx",fix:"change the Worker fetch target or DNS record to a valid, non-restricted origin address",summary:"DNS points to a prohibited IP (Worker/restricted).",title:"DNS points to a prohibited IP"},{causes:"the visitor's IP was blocked by an IP Access Rule, WAF rule, or security configuration on the zone",code:"1006",docsUrl:n,family:"1xxx",fix:"review the zone's Firewall/WAF and IP Access Rules to see why the address was banned, and adjust if it was blocked in error",summary:"Access denied: the visitor's IP has been banned.",title:"Access denied: your IP has been banned"},{causes:"your Worker threw an unhandled JavaScript exception during the request",code:"1101",docsUrl:n,family:"1xxx",fix:"reproduce with `wrangler tail` (or the Workers Logs / Studio Logs panel) to get the stack trace, then handle the throwing code path",summary:"A Worker threw a JavaScript exception.",title:"Worker threw a JavaScript exception"},{causes:"the Worker used more CPU time than a single invocation is allowed \u2014 usually a hot loop or heavy synchronous work",code:"1102",docsUrl:n,family:"1xxx",fix:"reduce per-request CPU (optimize hot loops, avoid heavy synchronous work) or offload the heavy work to a Durable Object, Queue, or Workflow",summary:"A Worker exceeded its CPU-time resource limit.",title:"Worker exceeded resource limits"}],d=a(e=>e!==void 0&&e>="0"&&e<="9","l"),T=a((e,t)=>{for(let i=e.indexOf(t);i!==-1;i=e.indexOf(t,i+t.length))if(!d(e[i-1])&&!d(e[i+t.length]))return!0;return!1},"_"),O=a((e,t)=>{for(let i of[`error ${t}`,`error: ${t}`])for(let o=e.indexOf(i);o!==-1;o=e.indexOf(i,o+i.length))if(!d(e[o+i.length]))return!0;return!1},"p"),g=/error|cloudflare/iu,h=a(e=>({body:[e.summary,"",`**Likely cause:** ${e.causes}.`,"",`**Fix:** ${e.fix}.`,"",`See [Cloudflare's ${e.family} error docs](${e.docsUrl}).`].join(`
12
+ `),header:`Cloudflare Error ${e.code}: ${e.title}`,id:`cloudflare-error-${e.code}`}),"c"),p=a(e=>{if(!g.test(e))return;let t=e.toLowerCase(),i=t.includes("error"),o=t.includes("cloudflare");if(i){for(let s of u)if(O(t,s.code))return h(s)}if(o){for(let s of u)if(T(t,s.code))return h(s)}},"T"),A=a(e=>(typeof e=="string"?e:e.join(`
13
+ `)).split(`
14
+ `).filter(t=>!t.startsWith("```")).join(`
15
+ `).replaceAll(/\*\*(.+?)\*\*/gu,"$1").replaceAll(/`([^`]+)`/gu,"$1"),"N"),E=a(e=>{for(let t of m)if(t.test(e))return{body:t.body,header:t.header,id:t.id}},"u"),N=a(e=>E(e)??p(e),"g");var c=class extends Error{static{a(this,"l")}type="VisulimaError";hint;title;loc;code;status;docsUrl;data;constructor(t,i,o={}){let s=f(t);super(i??t,o.cause===void 0?void 0:{cause:o.cause}),this.name=o.name??"LunoraError",this.hint=o.hint??s?.hint,this.title=o.title??s?.title,this.loc=o.location,this.code=t,this.status=o.status??s?.status??500,this.docsUrl=o.docsUrl??s?.docsUrl,this.data=o.data}};export{A as a,N as b,c};
@@ -0,0 +1 @@
1
+ import{a as ce,b as Zo,c as en}from"./chunk-CP4ZFBVW.js";import{a as tn}from"./chunk-CN2AINNY.js";import{a as lo,b as So,d as No,e as Oo,f as Do,g as Lo,h as Jo,i as Xo}from"./chunk-EDHW2EEG.js";import{$ as ko,A as nt,C as po,E as mo,F as fo,H as go,J as Ro,K as xo,N as Mo,O as ho,P as bo,Q as Co,S as vo,T as Io,U as Eo,V as yo,X as Po,Z as To,aa as rt,ba as wo,ca as _o,da as st,ea as Vo,fa as At,ga as Bo,ha as at,ja as Fo,ka as Go,ma as Ho,n as Dt,na as jo,oa as Yo,p as no,pa as zo,q as ro,ra as Ko,s as so,sa as $o,t as et,ta as Wo,u as tt,v as io,w as ot,x as ao,y as uo,z as co}from"./chunk-ZSOLGJFC.js";import{b as Uo}from"./chunk-DUDQV6XJ.js";import{i as qo,k as Qo}from"./chunk-DKSLOJDQ.js";import{B as ye,G as to,H as Ge,J as oo,K as Qe,L as Ze,N as v,O as se,d as wt,e as te,h as qe,o as _t}from"./chunk-AOAJGSYZ.js";import{a as it,b as Ao,c as Ue}from"./chunk-74ASA4WU.js";import{a as he,c as Fe,i as Qt,q as Zt,t as eo,w as ze}from"./chunk-XQS7KSHL.js";import{a as Me,c as F,d as qt,e as Xe,g as Le,h as Ye,i as ue,j as N}from"./chunk-7PIHTTND.js";import{a as o,c as Zn,d as M,e as C,f as er,g as me,i as Be}from"./chunk-R5ZTCHCE.js";var _e=M(er(),1);var oe={};Zn(oe,{Arrow:()=>nn,Backdrop:()=>sn,CheckboxItem:()=>dn,CheckboxItemIndicator:()=>pn,Group:()=>fn,GroupLabel:()=>Rn,Handle:()=>Je,Item:()=>Mn,LinkItem:()=>hn,Popup:()=>Cn,Portal:()=>En,Positioner:()=>yn,RadioGroup:()=>Sn,RadioItem:()=>Tn,RadioItemIndicator:()=>kn,Root:()=>Ot,Separator:()=>tn,SubmenuRoot:()=>Bn,SubmenuTrigger:()=>zn,Trigger:()=>Hn,Viewport:()=>Yn,createHandle:()=>Kn});var on=M(C(),1);var ut=M(C(),1);var Vt=ut.createContext(void 0);function W(t){let e=ut.useContext(Vt);if(e===void 0&&!t)throw new Error(F(33));return e}o(W,"useMenuPositionerContext");var ct=M(C(),1);var Bt=ct.createContext(void 0);function k(t){let e=ct.useContext(Bt);if(e===void 0&&!t)throw new Error(F(36));return e}o(k,"useMenuRootContext");var nn=on.forwardRef(o(function(e,n){let{render:i,className:u,style:a,...d}=e,{store:p}=k(),{arrowRef:r,side:m,align:g,arrowUncentered:R,arrowStyles:h}=W(),I={open:p.useState("open"),side:m,align:g,uncentered:R};return N("div",e,{ref:[r,n],stateAttributesMapping:Bo,state:I,props:{style:h,"aria-hidden":!0,...d}})},"MenuArrow"));var rn=M(C(),1);var dt=M(C(),1);var tr=dt.createContext(void 0);function Pe(t=!0){let e=dt.useContext(tr);if(e===void 0&&!t)throw new Error(F(25));return e}o(Pe,"useContextMenuRootContext");var sn=rn.forwardRef(o(function(e,n){let{render:i,className:u,style:a,...d}=e,{store:p}=k(),r=p.useState("open"),m=p.useState("mounted"),g=p.useState("transitionStatus"),R=p.useState("lastOpenChangeReason"),h=Pe(),x={open:r,transitionStatus:g};return N("div",e,{ref:h?.backdropRef?[n,h.backdropRef]:n,state:x,stateAttributesMapping:at,props:[{role:"presentation",hidden:!m,style:{pointerEvents:R===v.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},d]})},"MenuBackdrop"));var mt=M(C(),1);var pt=M(C(),1);var Lt=pt.createContext(void 0);function an(){let t=pt.useContext(Lt);if(t===void 0)throw new Error(F(30));return t}o(an,"useMenuCheckboxItemContext");var He=M(C(),1);var un=M(C(),1);function lt(t){let{closeOnClick:e,highlighted:n,id:i,nodeId:u,store:a,typingRef:d,itemRef:p,itemMetadata:r}=t,{events:m}=a.useState("floatingTreeRoot"),g=a.useState("open"),R=Pe(!0),h=R!==void 0;return un.useMemo(()=>({id:i,role:"menuitem",tabIndex:g&&n?0:-1,onKeyDown(x){x.key===" "&&d?.current&&x.preventDefault()},onMouseMove(x){u&&m.emit("itemhover",{nodeId:u,target:x.currentTarget})},onClick(x){e&&m.emit("close",{domEvent:x,reason:v.itemPress})},onMouseUp(x){if(R){let I=R.initialCursorPointRef.current;if(R.initialCursorPointRef.current=null,h&&I&&Math.abs(x.clientX-I.x)<=1&&Math.abs(x.clientY-I.y)<=1||h&&!qe.os.mac&&x.button===2)return}p.current&&a.context.allowMouseUpTriggerRef.current&&(!h||x.button===2)&&r.type==="regular-item"&&Ao(p.current,x,{detail:1})}}),[e,n,i,m,u,g,a,d,p,R,h,r])}o(lt,"useMenuItemCommonProps");var Se={type:"regular-item"};function Ne(t){let{closeOnClick:e,disabled:n,highlighted:i,id:u,store:a,typingRef:d=a.context.typingRef,nativeButton:p,itemMetadata:r,nodeId:m}=t,g=He.useRef(null),{getButtonProps:R,buttonRef:h}=Ue({disabled:n,focusableWhenDisabled:!0,native:p,composite:!0}),x=lt({closeOnClick:e,highlighted:i,id:u,nodeId:m,store:a,typingRef:d,itemRef:g,itemMetadata:r}),I=He.useCallback(_=>Me(x,{onMouseEnter(){r.type==="submenu-trigger"&&r.setActive()}},_,R),[x,R,r]),y=Xe(g,h);return He.useMemo(()=>({getItemProps:I,itemRef:y}),[I,y])}o(Ne,"useMenuItem");var Ft=(function(t){return t.checked="data-checked",t.unchecked="data-unchecked",t.disabled="data-disabled",t.highlighted="data-highlighted",t})({});var Oe={checked(t){return t?{[Ft.checked]:""}:{[Ft.unchecked]:""}},...oo};var cn=M(me(),1);var dn=mt.forwardRef(o(function(e,n){let{render:i,className:u,id:a,label:d,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!1,checked:g,defaultChecked:R,onCheckedChange:h,style:x,...I}=e,y=ce({guess:!0,label:d}),_=W(!0),c=te(a),{store:f}=k(),l=f.useState("disabled"),D=r||l,E=f.useState("isActive",y.index),s=f.useState("itemProps"),[V,b]=Ze({controlled:g,default:R??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:H,itemRef:A}=Ne({closeOnClick:m,disabled:D,highlighted:E,id:c,store:f,nativeButton:p,nodeId:_?.context.nodeId,itemMetadata:Se}),P=mt.useMemo(()=>({disabled:D,highlighted:E,checked:V}),[D,E,V]);function L(z){let j=se(v.itemPress,z.nativeEvent,void 0,{preventUnmountOnClose:Le});h?.(!V,j),!j.isCanceled&&b(O=>!O)}o(L,"handleClick");let G=N("div",e,{state:P,stateAttributesMapping:Oe,props:[s,{role:"menuitemcheckbox","aria-checked":V,onClick:L},I,H],ref:[A,n,y.ref]});return(0,cn.jsx)(Lt.Provider,{value:P,children:G})},"MenuCheckboxItem"));var ft=M(C(),1);var pn=ft.forwardRef(o(function(e,n){let{render:i,className:u,style:a,keepMounted:d=!1,...p}=e,r=an(),m=ft.useRef(null),{transitionStatus:g,mounted:R,setMounted:h}=Qe(r.checked);Ge({open:r.checked,ref:m,onComplete(){r.checked||h(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:g};return N("span",e,{state:x,ref:[n,m],stateAttributesMapping:Oe,props:{"aria-hidden":!0,...p},enabled:d||R})},"MenuCheckboxItemIndicator"));var Rt=M(C(),1);var gt=M(C(),1);var Ke=gt.createContext(void 0);function ln(){let t=gt.useContext(Ke);if(t===void 0)throw new Error(F(31));return t}o(ln,"useMenuGroupRootContext");var mn=M(me(),1);var fn=Rt.forwardRef(o(function(e,n){let{render:i,className:u,style:a,...d}=e,[p,r]=Rt.useState(void 0),m=N("div",e,{ref:n,props:{role:"group","aria-labelledby":p,...d}});return(0,mn.jsx)(Ke.Provider,{value:r,children:m})},"MenuGroup"));var gn=M(C(),1);var Rn=gn.forwardRef(o(function(e,n){let{render:i,className:u,style:a,id:d,...p}=e,r=te(d),m=ln();return he(()=>(m(r),()=>{m(g=>g===r?void 0:g)}),[m,r]),N("div",e,{ref:n,props:{id:r,role:"presentation",...p}})},"MenuGroupLabel"));var xn=M(C(),1);var Mn=xn.forwardRef(o(function(e,n){let{render:i,className:u,id:a,label:d,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!0,style:g,...R}=e,h=ce({guess:!0,label:d}),x=W(!0),I=te(a),{store:y}=k(),_=y.useState("disabled"),c=r||_,f=y.useState("isActive",h.index),l=y.useState("itemProps"),{getItemProps:D,itemRef:E}=Ne({closeOnClick:m,disabled:c,highlighted:f,id:I,store:y,nativeButton:p,nodeId:x?.context.nodeId,itemMetadata:Se});return N("div",e,{state:{disabled:c,highlighted:f},props:[l,R,D],ref:[E,n,h.ref]})},"MenuItem"));var xt=M(C(),1);var hn=xt.forwardRef(o(function(e,n){let{render:i,className:u,id:a,label:d,closeOnClick:p=!1,style:r,...m}=e,g=xt.useRef(null),R=ce({guess:!0,label:d}),x=W(!0)?.context.nodeId,I=te(a),{store:y}=k(),_=y.useState("isActive",R.index),c=y.useState("itemProps"),f=y.context.typingRef,{getButtonProps:l,buttonRef:D}=Ue({native:!1,composite:!0}),E=lt({closeOnClick:p,highlighted:_,id:I,nodeId:x,store:y,typingRef:f,itemRef:g,itemMetadata:Se});function s(b){return Me(E,b,l)}return o(s,"getItemProps"),N("a",e,{state:{highlighted:_},props:[c,m,s],ref:[g,D,n,R.ref]})},"MenuLinkItem"));var Mt=M(C(),1);var bn=M(me(),1);var Cn=Mt.forwardRef(o(function(e,n){let{render:i,className:u,style:a,finalFocus:d,...p}=e,{store:r}=k(),{side:m,align:g}=W(),R=Wo(!0)!=null,h=r.useState("open"),x=r.useState("transitionStatus"),I=r.useState("popupProps"),y=r.useState("mounted"),_=r.useState("instantType"),c=r.useState("activeTriggerElement"),f=r.useState("parent"),l=r.useState("lastOpenChangeReason"),D=r.useState("rootId"),E=r.useState("floatingRootContext"),s=r.useState("floatingTreeRoot"),V=r.useState("closeDelay"),b=r.useState("hoverEnabled"),H=r.useState("disabled"),A=r.useState("openMethod"),P=f.type==="context-menu";Ge({open:h,ref:r.context.popupRef,onComplete(){h&&r.context.onOpenChangeComplete?.(!0)}}),Mt.useEffect(()=>{function O(fe){r.setOpen(!1,se(fe.reason,fe.domEvent))}return o(O,"handleClose"),s.events.on("close",O),()=>{s.events.off("close",O)}},[s.events,r]),ko(E,{enabled:b&&!H&&!P&&f.type!=="menubar",closeDelay:V});let L=r.useStateSetter("popupElement"),G={transitionStatus:x,side:m,align:g,open:h,nested:f.type==="menu",instant:_},z=N("div",e,{state:G,ref:[n,r.context.popupRef,L],stateAttributesMapping:at,props:[I,{onKeyDown(O){R&&$o.has(O.key)&&O.stopPropagation()}},Yo(x),p,{"data-rootownerid":D}]}),j=f.type===void 0||P;return(c||f.type==="menubar"&&l!==v.outsidePress)&&(j=!0),(0,bn.jsx)(co,{context:E,openInteractionType:A,modal:P,disabled:!y,returnFocus:d===void 0?j:d,initialFocus:f.type!=="menu",restoreFocus:!0,externalTree:f.type!=="menubar"?s:void 0,previousFocusableElement:c,nextFocusableElement:f.type===void 0?r.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:f.type===void 0?r.context.beforeContentFocusGuardRef:void 0,children:z})},"MenuPopup"));var In=M(C(),1);var ht=M(C(),1);var Gt=ht.createContext(void 0);function vn(){let t=ht.useContext(Gt);if(t===void 0)throw new Error(F(32));return t}o(vn,"useMenuPortalContext");var Ut=M(me(),1);var En=In.forwardRef(o(function(e,n){let{keepMounted:i=!1,...u}=e,{store:a}=k();return a.useState("mounted")||i?(0,Ut.jsx)(Gt.Provider,{value:i,children:(0,Ut.jsx)(so,{ref:n,...u})}):null},"MenuPortal"));var be=M(C(),1);var je=M(me(),1);var yn=be.forwardRef(o(function(e,n){let{anchor:i,positionMethod:u="absolute",className:a,render:d,side:p,align:r,sideOffset:m=0,alignOffset:g=0,collisionBoundary:R="clipping-ancestors",collisionPadding:h=5,arrowPadding:x=5,sticky:I=!1,disableAnchorTracking:y=!1,collisionAvoidance:_=no,style:c,...f}=e,{store:l}=k(),D=vn(),E=Pe(!0),s=l.useState("parent"),V=l.useState("floatingRootContext"),b=l.useState("floatingTreeRoot"),H=l.useState("mounted"),A=l.useState("open"),P=l.useState("modal"),L=l.useState("openMethod"),G=l.useState("activeTriggerElement"),z=l.useState("transitionStatus"),j=l.useState("positionerElement"),O=l.useState("instantType"),fe=l.useState("adaptiveOrigin"),T=l.useState("lastOpenChangeReason"),X=l.useState("floatingNodeId"),Ee=l.useState("floatingParentNodeId"),ne=V.useState("domReferenceElement"),ge=be.useRef(null),ie=to(j),re=i,Re=m,ve=g,xe=r,de=_;s.type==="context-menu"&&(re=i??s.context?.anchor,xe=xe??"start",!p&&xe!=="center"&&(ve=e.alignOffset??2,Re=e.sideOffset??-5));let q=p,pe=xe;s.type==="menu"?(q=q??"inline-end",pe=pe??"start",de=e.collisionAvoidance??ro):s.type==="menubar"&&(q=q??(s.context.orientation==="vertical"?"inline-end":"bottom"),pe=pe??"start");let Y=s.type==="context-menu",K=Ho({anchor:re,floatingRootContext:V,positionMethod:E?"fixed":u,mounted:H,side:q,sideOffset:Re,align:pe,alignOffset:ve,arrowPadding:Y?0:x,collisionBoundary:R,collisionPadding:h,sticky:I,nodeId:X,keepMounted:D,disableAnchorTracking:y,collisionAvoidance:de,shift:Y?{crossAxis:!("side"in de&&de.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:b,adaptiveOrigin:fe});be.useEffect(()=>{function B(w){w.open&&(w.parentNodeId===X&&l.set("hoverEnabled",!1),w.nodeId!==X&&w.parentNodeId===l.select("floatingParentNodeId")&&l.setOpen(!1,se(v.siblingOpen)))}return o(B,"onMenuOpenChange"),b.events.on("menuopenchange",B),()=>{b.events.off("menuopenchange",B)}},[l,b.events,X]),be.useEffect(()=>{if(l.select("floatingParentNodeId")==null)return;function B(w){if(w.open||w.nodeId!==l.select("floatingParentNodeId"))return;let Ie=w.reason??v.siblingOpen;l.setOpen(!1,se(Ie))}return o(B,"onParentClose"),b.events.on("menuopenchange",B),()=>{b.events.off("menuopenchange",B)}},[b.events,l]);let ae=ye();be.useEffect(()=>{A||ae.clear()},[A,ae]),be.useEffect(()=>{function B(w){if(!(!A||w.nodeId!==l.select("floatingParentNodeId")))if(w.target&&G&&G!==w.target){let Ie=l.select("closeDelay");Ie>0?ae.isStarted()||ae.start(Ie,()=>{l.setOpen(!1,se(v.siblingOpen))}):l.setOpen(!1,se(v.siblingOpen))}else ae.clear()}return o(B,"onItemHover"),b.events.on("itemhover",B),()=>{b.events.off("itemhover",B)}},[b.events,A,G,l,ae]),be.useEffect(()=>{let B={open:A,nodeId:X,parentNodeId:Ee,reason:l.select("lastOpenChangeReason")};b.events.emit("menuopenchange",B)},[b.events,A,l,X,Ee]),he(()=>{let B=ne,w=ge.current;if(B&&(ge.current=B),w&&B&&B!==w){l.set("instantType",void 0);let Ie=new AbortController;return ie(()=>{l.set("instantType","trigger-change")},Ie.signal),()=>{Ie.abort()}}},[ne,ie,l]);let De={open:A,side:K.side,align:K.align,anchorHidden:K.anchorHidden,nested:s.type==="menu",instant:O},we=s.type==="menubar"&&s.context.modal,le=P&&T!==v.triggerHover;Ko(A&&(we||le),L==="touch",j,G);let Ae=zo(e,De,{styles:K.positionerStyles,transitionStatus:z,props:f,refs:[n,l.useStateSetter("positionerElement")],hidden:!H,inert:!A}),Ve=H&&s.type!=="menu"&&(s.type!=="menubar"&&P&&T!==v.triggerHover||s.type==="menubar"&&s.context.modal),Z=null;return s.type==="menubar"?Z=s.context.contentElement:s.type===void 0&&(Z=G),(0,je.jsxs)(Vt.Provider,{value:K,children:[Ve&&(0,je.jsx)(jo,{ref:s.type==="context-menu"||s.type==="nested-context-menu"?s.context.internalBackdropRef:null,inert:Go(!A),cutout:Z}),(0,je.jsx)(ao,{id:X,children:(0,je.jsx)(Zo,{elementsRef:l.context.itemDomElements,labelsRef:l.context.itemLabels,children:Ae})})]})},"MenuPositioner"));var Te=M(C(),1);var bt=M(C(),1);var Ht=bt.createContext(void 0);function Pn(){let t=bt.useContext(Ht);if(t===void 0)throw new Error(F(34));return t}o(Pn,"useMenuRadioGroupContext");var jt=M(me(),1);var Sn=Te.memo(Te.forwardRef(o(function(e,n){let{render:i,className:u,value:a,defaultValue:d,onValueChange:p,disabled:r=!1,style:m,"aria-labelledby":g,...R}=e,[h,x]=Te.useState(void 0),[I,y]=Ze({controlled:a,default:d,name:"MenuRadioGroup"}),_=Fe((D,E)=>{p?.(D,E),!E.isCanceled&&y(D)}),f=N("div",e,{state:{disabled:r},ref:n,props:{role:"group","aria-labelledby":g??h,"aria-disabled":r||void 0,...R}}),l=Te.useMemo(()=>({value:I,setValue:_,disabled:r}),[I,_,r]);return(0,jt.jsx)(Ke.Provider,{value:x,children:(0,jt.jsx)(Ht.Provider,{value:l,children:f})})},"MenuRadioGroup")));var vt=M(C(),1);var Ct=M(C(),1);var Yt=Ct.createContext(void 0);function Nn(){let t=Ct.useContext(Yt);if(t===void 0)throw new Error(F(35));return t}o(Nn,"useMenuRadioItemContext");var On=M(me(),1);var Tn=vt.forwardRef(o(function(e,n){let{render:i,className:u,id:a,label:d,nativeButton:p=!1,disabled:r=!1,closeOnClick:m=!1,value:g,style:R,...h}=e,x=ce({guess:!0,label:d}),I=W(!0),y=te(a),{store:_}=k(),c=_.useState("isActive",x.index),f=_.useState("itemProps"),{value:l,setValue:D,disabled:E}=Pn(),s=_.useState("disabled"),V=r||E||s,b=l===g,{getItemProps:H,itemRef:A}=Ne({closeOnClick:m,disabled:V,highlighted:c,id:y,store:_,nativeButton:p,nodeId:I?.context.nodeId,itemMetadata:Se}),P=vt.useMemo(()=>({disabled:V,highlighted:c,checked:b}),[V,c,b]);function L(z){let j=se(v.itemPress,z.nativeEvent,void 0,{preventUnmountOnClose:Le});D(g,j)}o(L,"handleClick");let G=N("div",e,{state:P,stateAttributesMapping:Oe,props:[f,{role:"menuitemradio","aria-checked":b,onClick:L},h,H],ref:[A,n,x.ref]});return(0,On.jsx)(Yt.Provider,{value:P,children:G})},"MenuRadioItem"));var It=M(C(),1);var kn=It.forwardRef(o(function(e,n){let{render:i,className:u,style:a,keepMounted:d=!1,...p}=e,r=Nn(),m=It.useRef(null),{transitionStatus:g,mounted:R,setMounted:h}=Qe(r.checked);Ge({open:r.checked,ref:m,onComplete(){r.checked||h(!1)}});let x={checked:r.checked,disabled:r.disabled,highlighted:r.highlighted,transitionStatus:g};return N("span",e,{state:x,stateAttributesMapping:Oe,ref:[n,m],props:{"aria-hidden":!0,...p},enabled:d||R})},"MenuRadioItemIndicator"));var U=M(C(),1);var Et=M(C(),1);var or=Et.createContext(null);function yt(t){let e=Et.useContext(or);if(e===null&&!t)throw new Error(F(5));return e}o(yt,"useMenubarContext");var $e=M(C(),1);var wn={...No,disabled:o(t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled,"disabled"),modal:o(t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0),"modal"),openMethod:o(t=>t.openMethod,"openMethod"),allowMouseEnter:o(t=>t.allowMouseEnter,"allowMouseEnter"),highlightItemOnHover:o(t=>t.highlightItemOnHover,"highlightItemOnHover"),parent:o(t=>t.parent,"parent"),rootId:o(t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId,"rootId"),activeIndex:o(t=>t.activeIndex,"activeIndex"),isActive:o((t,e)=>t.activeIndex===e,"isActive"),hoverEnabled:o(t=>t.hoverEnabled,"hoverEnabled"),instantType:o(t=>t.instantType,"instantType"),lastOpenChangeReason:o(t=>t.openChangeReason,"lastOpenChangeReason"),floatingTreeRoot:o(t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot,"floatingTreeRoot"),floatingNodeId:o(t=>t.floatingNodeId,"floatingNodeId"),floatingParentNodeId:o(t=>t.floatingParentNodeId,"floatingParentNodeId"),itemProps:o(t=>t.itemProps,"itemProps"),closeDelay:o(t=>t.closeDelay,"closeDelay"),adaptiveOrigin:o(t=>t.adaptiveOrigin,"adaptiveOrigin"),keyboardEventRelay:o(t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")},"keyboardEventRelay")},Pt=class extends go{static{o(this,"MenuStore")}constructor(e){super({...An(),...e},Dn(),wn),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){let i=n.store.select("rootId"),u=n.store.select("floatingTreeRoot"),a=n.store.select("keyboardEventRelay");this.unsubscribeParentListener=n.store.subscribe(()=>{let d=n.store.select("rootId"),p=n.store.select("floatingTreeRoot"),r=n.store.select("keyboardEventRelay");i===d&&u===p&&a===r||(i=d,u=p,a=r,this.notifyAll())}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:n})}unsubscribeParentListener=null};function _n(){let t=new Do(Object.freeze(An()),Object.freeze(Dn()),wn);return Object.assign(t,{setOpen:Le})}o(_n,"createNullMenuStore");function Dn(){return{positionerRef:$e.createRef(),popupRef:$e.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:$e.createRef(),beforeContentFocusGuardRef:$e.createRef(),onOpenChangeComplete:void 0,triggerElements:new Po}}o(Dn,"createInitialContext");function An(){return{...So(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new et,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:ue,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}o(An,"createInitialState");var St=M(C(),1);var zt=St.createContext(void 0);function Nt(){return St.useContext(zt)}o(Nt,"useMenuSubmenuRootContext");var We=M(me(),1);var Ot=mo(o(function(e){let{children:n,open:i,onOpenChange:u,onOpenChangeComplete:a,defaultOpen:d=!1,disabled:p=!1,modal:r,loopFocus:m=!0,orientation:g="vertical",actionsRef:R,closeParentOnEsc:h=!1,handle:x,triggerId:I,defaultTriggerId:y=null,highlightItemOnHover:_=!0}=e,c=Pe(!0),f=k(!0),l=yt(!0),D=Nt(),E=U.useMemo(()=>D&&f?{type:"menu",store:f.store}:l?{type:"menubar",context:l}:c&&!f?{type:"context-menu",context:c}:{type:void 0},[c,f,l,D]),s=nr({open:d,openProp:i,activeTriggerId:y,triggerIdProp:I,parent:E});s.useControlledProp("openProp",i),s.useControlledProp("triggerIdProp",I),s.useContextCallback("onOpenChangeComplete",a);let V=wt(),b=wt(),H=s.useState("floatingTreeRoot"),A=ot(H),P=tt(),L=s.useState("open"),G=s.useState("activeTriggerElement"),z=s.useState("positionerElement"),j=s.useState("hoverEnabled"),O=s.useState("disabled"),fe=s.useState("lastOpenChangeReason"),T=s.useState("parent"),X=s.useState("activeIndex"),Ee=s.useState("payload"),ne=s.useState("floatingParentNodeId"),ge=U.useRef(null),ie=U.useRef(T.type!=="context-menu"),re=ye(),Re=U.useRef(!0),ve=ye(),xe=ne!=null,{openMethod:de,triggerProps:q}=Fo(L);s.useSyncedValues({disabled:p,highlightItemOnHover:_,modal:T.type===void 0?r:void 0,openMethod:de,rootId:V}),Io(s);let{forceUnmount:pe}=Eo(L,s,()=>{s.set("allowMouseEnter",!1)});he(()=>{c&&!f?s.update({parent:{type:"context-menu",context:c},floatingNodeId:A,floatingParentNodeId:P}):f&&s.update({floatingNodeId:A,floatingParentNodeId:P})},[c,f,A,P,s]),U.useEffect(()=>{if(L||(ge.current=null),T.type==="context-menu"){if(!L){re.clear(),ie.current=!1;return}re.start(500,()=>{ie.current=!0})}},[re,L,T.type]),he(()=>{!L&&!j&&s.set("hoverEnabled",!0)},[L,j,s]);let Y=Fe((S,$)=>{let ee=$.reason;if(!S&&!s.select("open")||L===S&&$.trigger===G&&fe===ee)return;let qn=Co($);if(!S&&$.trigger==null&&($.trigger=G??void 0),u?.(S,$),$.isCanceled)return;s.state.floatingRootContext.dispatchOpenChange(S,$);let kt=$.event;if(S===!1&&kt?.type==="click"&&kt.pointerType==="touch"&&!Re.current)return;S&&ee===v.triggerFocus?(Re.current=!1,ve.start(300,()=>{Re.current=!0})):(Re.current=!0,ve.clear());let Jt=(ee===v.triggerPress||ee===v.itemPress)&&kt.detail===0,Qn=!S&&(ee===v.escapeKey||ee==null),Xt={open:S,openChangeReason:ee};ge.current=$.event,bo(Xt,S,$.trigger,qn()),s.update(Xt),T.type==="menubar"&&(ee===v.triggerFocus||ee===v.focusOut||ee===v.triggerHover||ee===v.listNavigation||ee===v.siblingOpen)?s.set("instantType","group"):Jt||Qn?s.set("instantType",Jt?"click":"dismiss"):s.set("instantType",void 0)}),K=Ro({popupStore:s,floatingId:b,nested:P!=null,onOpenChange:Y}),ae=K.context.events;he(()=>{let S=o(({open:$,eventDetails:ee})=>Y($,ee),"handleSetOpenEvent");return ae.on("setOpen",S),()=>{ae?.off("setOpen",S)}},[ae,Y]);let De=U.useCallback(()=>{s.setOpen(!1,se(v.imperativeAction))},[s]);U.useImperativeHandle(R,()=>({unmount:pe,close:De}),[pe,De]);let we;T.type==="context-menu"&&(we=T.context),U.useImperativeHandle(we?.positionerRef,()=>z,[z]),U.useImperativeHandle(we?.actionsRef,()=>({setOpen:Y}),[Y]);let le=po(K,{enabled:!O,bubbles:{escapeKey:h&&T.type==="menu"},outsidePress(){return T.type!=="context-menu"||ge.current?.type==="contextmenu"?!0:ie.current},externalTree:xe?H:void 0}),Ae=Uo(),Ve=U.useCallback(S=>{s.select("activeIndex")!==S&&s.set("activeIndex",S)},[s]),Z=wo(K,{enabled:!O,listRef:s.context.itemDomElements,activeIndex:X,nested:T.type!==void 0,loopFocus:m,orientation:g,parentOrientation:T.type==="menubar"?T.context.orientation:void 0,rtl:Ae==="rtl",disabledIndices:Ye,onNavigate:Ve,openOnArrowKeyDown:T.type!=="context-menu",externalTree:xe?H:void 0,focusItemOnHover:_}),B=U.useCallback(S=>{s.context.typingRef.current=S},[s]),w=_o(K,{enabled:!O,listRef:s.context.itemLabels,elementsRef:s.context.itemDomElements,activeIndex:X,resetMs:500,onMatch:o(S=>{L&&S!==X&&s.set("activeIndex",S)},"onMatch"),onTyping:B}),Ie=U.useMemo(()=>{let S=Me(w.reference,Z.reference,le.reference,{onMouseMove(){s.set("allowMouseEnter",!0)}},q);return S["aria-haspopup"]="menu",S["aria-expanded"]=L,S},[s,w.reference,Z.reference,le.reference,q,L]),$n=U.useMemo(()=>{let S=Me(Z.trigger,le.trigger,q);return S["aria-haspopup"]="menu",S["aria-expanded"]=!1,S},[Z.trigger,le.trigger,q]),Wn=U.useMemo(()=>Me(xo,{id:b,role:"menu","aria-labelledby":G?.id,onMouseMove(){s.set("allowMouseEnter",!0),T.type==="menu"&&s.set("hoverEnabled",!1)},onClick(){s.select("hoverEnabled")&&s.set("hoverEnabled",!1)},onKeyDown(S){let $=s.select("keyboardEventRelay");$&&!S.isPropagationStopped()&&$(S)}},w.floating,Z.floating,le.floating),[G,b,T.type,s,w.floating,Z.floating,le.floating]),Jn=Z.item??ue;yo(s,{floatingRootContext:K,activeTriggerProps:Ie,inactiveTriggerProps:$n,popupProps:Wn,itemProps:Jn});let Xn=U.useMemo(()=>({store:s,parent:E}),[s,E]),Wt=(0,We.jsxs)(Bt.Provider,{value:Xn,children:[x&&(0,We.jsx)(Mo,{handle:x,store:s}),typeof n=="function"?n({payload:Ee}):n]});return T.type===void 0||T.type==="context-menu"?(0,We.jsx)(uo,{externalTree:H,children:Wt}):Wt},"MenuRoot"));function nr(t){return qt(()=>new Pt(t)).current}o(nr,"useMenuRootStore");var Vn=M(C(),1);var Kt=M(me(),1);function Bn(t){let e=k().store,n=Vn.useMemo(()=>({parentMenu:e}),[e]);return(0,Kt.jsx)(zt.Provider,{value:n,children:(0,Kt.jsx)(Ot,{...t})})}o(Bn,"MenuSubmenuRoot");var J=M(C(),1);var Ln=M(C(),1);function Fn(t={}){let{highlightItemOnHover:e,highlightedIndex:n,onHighlightedIndexChange:i}=it(),{ref:u,index:a}=ce(t),d=n===a,p=Ln.useRef(null),r=Xe(u,p);return{compositeProps:{tabIndex:d?0:-1,onFocus(){i(a)},onMouseMove(){let g=p.current;if(!e||!g)return;let R=g.hasAttribute("disabled")||g.ariaDisabled==="true";!d&&!R&&g.focus()}},compositeRef:r,index:a}}o(Fn,"useCompositeItem");function Gn(t){let{render:e,className:n,style:i,state:u=ue,props:a=Ye,refs:d=Ye,metadata:p,stateAttributesMapping:r,tag:m="div",...g}=t,{compositeProps:R,compositeRef:h}=Fn({metadata:p});return N(m,t,{state:u,ref:[h,...d],props:[R,...a,g],stateAttributesMapping:r})}o(Gn,"CompositeItem");function $t(t){if(Qt(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid");if(!Zt(t))return $t(eo(t))}o($t,"findRootOwnerId");var Tt=M(C(),1);function Un(t){let{enabled:e=!0,mouseDownAction:n,open:i}=t,u=Tt.useRef(!1);return Tt.useMemo(()=>e?{onMouseDown:o(a=>{(n==="open"&&!i||n==="close"&&i)&&(u.current=!0,ze(a.currentTarget).addEventListener("click",()=>{u.current=!1},{once:!0}))},"onMouseDown"),onClick:o(a=>{u.current&&(u.current=!1,a.preventBaseUIHandler())},"onClick")}:ue,[e,n,i])}o(Un,"useMixedToggleClickHandler");var ke=M(me(),1);var Hn=fo(o(function(e,n){let{render:i,className:u,style:a,disabled:d=!1,nativeButton:p=!0,id:r,openOnHover:m,delay:g=100,closeDelay:R=0,handle:h,payload:x,...I}=e,y=k(!0),c=Oo(h)??y?.store;if(!c)throw new Error(F(85));let f=te(r),l=c.useState("isTriggerActive",f),D=c.useState("floatingRootContext"),E=c.useState("isOpenedByTrigger",f),s=c.useState("triggerPopupId",f),V=J.useRef(null),b=sr(),H=it(!0),A=io(),P=J.useMemo(()=>A??new et,[A]),L=ot(P),G=tt(),{registerTrigger:z,isMountedByThisTrigger:j}=vo(f,V,c,{payload:x,closeDelay:R,parent:b,floatingTreeRoot:P,floatingNodeId:L,floatingParentNodeId:G,keyboardEventRelay:H?.relayKeyboardEvent}),O=b.type==="menubar",fe=c.useState("disabled"),T=d||fe||O&&b.context.disabled,{getButtonProps:X,buttonRef:Ee}=Ue({disabled:T,native:p});J.useEffect(()=>{!E&&b.type===void 0&&(c.context.allowMouseUpTriggerRef.current=!1)},[c,E,b.type]);let ne=J.useRef(null),ge=ye(),ie=Fe(B=>{if(!ne.current)return;ge.clear(),c.context.allowMouseUpTriggerRef.current=!1;let w=B.target;_t(ne.current,w)||_t(c.select("positionerElement"),w)||w===ne.current||w!=null&&$t(w)===c.select("rootId")||en(B,ne.current)||P.events.emit("close",{domEvent:B,reason:v.cancelOpen})});J.useEffect(()=>{E&&c.select("lastOpenChangeReason")===v.triggerHover&&ze(ne.current).addEventListener("mouseup",ie,{once:!0})},[E,ie,c]);let re=O&&b.context.hasSubmenuOpen,ve=rt(D,{enabled:(m??re)&&!T&&(!O||re&&!j),handleClose:st({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:b.type===void 0?g:void 0,delay:{close:R},triggerElementRef:V,externalTree:P,isActiveTrigger:l,isClosing:o(()=>c.select("transitionStatus")==="ending","isClosing")}),xe=rr(E,c.select("lastOpenChangeReason")),de=nt(D,{enabled:!T,event:E&&O?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:b.type===void 0?xe:!1}),q=To(D,{enabled:!T&&re}),pe=Un({open:E,enabled:O,mouseDownAction:"open"}),Y=J.useMemo(()=>Me(q.reference,de.reference),[q.reference,de.reference]),K=c.useState("triggerProps",j),{preFocusGuardRef:ae,handlePreFocusGuardFocus:De,handleFocusTargetFocus:we}=Lo(c,V),le={disabled:T,open:E},Ae=[ne,n,Ee,z,V],Ve=[Y,ve??ue,K,{"aria-haspopup":"menu","aria-controls":s,id:f,onMouseDown:o(B=>{if(c.select("open"))return;ge.start(200,()=>{c.context.allowMouseUpTriggerRef.current=!0}),ze(B.currentTarget).addEventListener("mouseup",ie,{once:!0})},"onMouseDown")},O?{role:"menuitem"}:{},pe,I,X],Z=N("button",e,{enabled:!O,stateAttributesMapping:At,state:le,ref:Ae,props:Ve});return O?(0,ke.jsx)(Gn,{tag:"button",render:i,className:u,style:a,state:le,refs:Ae,props:Ve,stateAttributesMapping:At}):E?(0,ke.jsxs)(J.Fragment,{children:[(0,ke.jsx)(Dt,{ref:ae,onFocus:De},`${f}-pre-focus-guard`),(0,ke.jsx)(J.Fragment,{children:Z},f),(0,ke.jsx)(Dt,{ref:c.context.triggerFocusTargetRef,onFocus:we},`${f}-post-focus-guard`)]}):(0,ke.jsx)(J.Fragment,{children:Z},f)},"MenuTrigger"));function rr(t,e){let n=ye(),[i,u]=J.useState(!1);return he(()=>{t&&e===v.triggerHover?(u(!0),n.start(500,()=>{u(!1)})):t||(n.clear(),u(!1))},[t,e,n]),i}o(rr,"useStickIfOpen");function sr(){let t=yt(!0);return J.useMemo(()=>t?{type:"menubar",context:t}:{type:void 0},[t])}o(sr,"useMenuParent");var jn=M(C(),1);var Yn=jn.forwardRef(o(function(e,n){let{render:i,className:u,style:a,children:d,...p}=e,{store:r}=k(),{side:m}=W(),g=r.useState("instantType"),{children:R,state:h}=Xo({store:r,side:m,children:d}),x={activationDirection:h.activationDirection,transitioning:h.transitioning,instant:g};return N("div",e,{state:x,ref:n,props:[p,{children:R}],stateAttributesMapping:Jo})},"MenuViewport"));var Ce=M(C(),1);var ir={"aria-expanded":void 0},zn=Ce.forwardRef(o(function(e,n){let{render:i,className:u,style:a,label:d,id:p,nativeButton:r=!1,openOnHover:m=!0,delay:g=100,closeDelay:R=0,disabled:h=!1,...x}=e,I=Nt();if(!I?.parentMenu)throw new Error(F(37));let y=ce({guess:!0,label:d}),_=W(),{store:c}=k(),f=te(p),l=c.useState("open"),D=c.useState("floatingRootContext"),E=c.useState("floatingTreeRoot"),s=c.useState("triggerPopupId",f),V=ho(f,c),b=Ce.useCallback(Y=>{let K=V(Y);return Y!==null&&c.select("open")&&c.select("activeTriggerId")==null&&c.update({activeTriggerId:f,activeTriggerElement:Y,closeDelay:R}),K},[V,R,c,f]),H=Ce.useRef(null),A=Ce.useCallback(Y=>{H.current=Y,c.set("activeTriggerElement",Y)},[c]);c.useSyncedValue("closeDelay",R);let P=I.parentMenu,L=c.useState("disabled"),G=P.useState("disabled"),z=h||L||G,j=P.useState("itemProps"),O=P.useState("isActive",y.index),fe=Ce.useMemo(()=>({type:"submenu-trigger",setActive(){P.select("highlightItemOnHover")&&P.set("activeIndex",y.index)}}),[P,y.index]),{getItemProps:T,itemRef:X}=Ne({closeOnClick:!1,disabled:z,highlighted:O,id:f,store:c,typingRef:P.context.typingRef,nativeButton:r,itemMetadata:fe,nodeId:_?.context.nodeId}),Ee=c.useState("hoverEnabled"),ne=rt(D,{enabled:Ee&&m&&!z,handleClose:st({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:g,delay:{open:g,close:R},shouldOpen:g>0?()=>P.select("allowMouseEnter"):void 0,triggerElementRef:H,externalTree:E,isClosing:o(()=>c.select("transitionStatus")==="ending","isClosing"),guardStaleOpen:!0}),ie=nt(D,{enabled:!z,event:"mousedown",toggle:!m,ignoreMouse:m,stickIfOpen:!1}).reference??ue,re=c.useState("triggerProps",!0);delete re.id;let Re={disabled:z,highlighted:O,open:l},ve=c.useState("openMethod"),de=c.useState("lastOpenChangeReason")===v.listNavigation||ve==="keyboard",q=l&&de&&qe.screenReader.voiceOver;return N("div",e,{state:Re,stateAttributesMapping:Vo,props:[ie,ne,re,j,q?ir:void 0,{"aria-controls":s,tabIndex:l||O?0:-1,onBlur(){O&&P.set("activeIndex",null)}},x,T],ref:[n,y.ref,X,b,A]})},"MenuSubmenuTrigger"));var Je=class extends lo{static{o(this,"MenuHandle")}constructor(){super(_n(),"Menu")}open(e){this.openByTrigger(e)}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select("open")??!1}};function Kn(){return new Je}o(Kn,"createMenuHandle");var Q=M(me(),1);function Hc(t){let e=(0,_e.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let i;return e[2]!==n?(i=(0,Q.jsx)(oe.Root,{"data-slot":"dropdown-menu",...n}),e[2]=n,e[3]=i):i=e[3],i}o(Hc,"N");function jc(t){let e=(0,_e.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let i;return e[2]!==n?(i=(0,Q.jsx)(oe.Trigger,{"data-slot":"dropdown-menu-trigger",...n}),e[2]=n,e[3]=i):i=e[3],i}o(jc,"z");function Yc({align:t="start",alignOffset:e=0,side:n="bottom",sideOffset:i=4,className:u,...a}){return(0,Q.jsx)(oe.Portal,{children:(0,Q.jsx)(oe.Positioner,{className:"isolate z-50 outline-none",align:t,alignOffset:e,side:n,sideOffset:i,children:(0,Q.jsx)(oe.Popup,{"data-slot":"dropdown-menu-content",className:Be("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!",u),...a})})})}o(Yc,"D");function zc(t){let e=(0,_e.c)(4),n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let i;return e[2]!==n?(i=(0,Q.jsx)(oe.Group,{"data-slot":"dropdown-menu-group",...n}),e[2]=n,e[3]=i):i=e[3],i}o(zc,"M");function Kc(t){let e=(0,_e.c)(10),n,i,u;e[0]!==t?({className:n,inset:i,...u}=t,e[0]=t,e[1]=n,e[2]=i,e[3]=u):(n=e[1],i=e[2],u=e[3]);let a;e[4]!==n?(a=Be("px-2 py-2 text-xs text-muted-foreground data-inset:ps-7",n),e[4]=n,e[5]=a):a=e[5];let d;return e[6]!==i||e[7]!==u||e[8]!==a?(d=(0,Q.jsx)(oe.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":i,className:a,...u}),e[6]=i,e[7]=u,e[8]=a,e[9]=d):d=e[9],d}o(Kc,"y");function $c({className:t,inset:e,variant:n="default",...i}){return(0,Q.jsx)(oe.Item,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:Be("group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-md px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",t),...i})}o($c,"I");function Wc(t){let e=(0,_e.c)(15),n,i,u,a,d;e[0]!==t?({className:u,children:i,checked:n,inset:a,...d}=t,e[0]=t,e[1]=n,e[2]=i,e[3]=u,e[4]=a,e[5]=d):(n=e[1],i=e[2],u=e[3],a=e[4],d=e[5]);let p;e[6]!==u?(p=Be("relative flex cursor-default items-center gap-2 rounded-md py-2 pe-8 ps-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:ps-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",u),e[6]=u,e[7]=p):p=e[7];let r;e[8]===Symbol.for("react.memo_cache_sentinel")?(r=(0,Q.jsx)("span",{className:"pointer-events-none absolute end-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:(0,Q.jsx)(oe.CheckboxItemIndicator,{children:(0,Q.jsx)(Qo,{icon:qo,strokeWidth:2})})}),e[8]=r):r=e[8];let m;return e[9]!==n||e[10]!==i||e[11]!==a||e[12]!==d||e[13]!==p?(m=(0,Q.jsxs)(oe.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":a,className:p,checked:n,...d,children:[r,i]}),e[9]=n,e[10]=i,e[11]=a,e[12]=d,e[13]=p,e[14]=m):m=e[14],m}o(Wc,"_");function Jc(t){let e=(0,_e.c)(8),n,i;e[0]!==t?({className:n,...i}=t,e[0]=t,e[1]=n,e[2]=i):(n=e[1],i=e[2]);let u;e[3]!==n?(u=Be("-mx-1 h-px bg-border",n),e[3]=n,e[4]=u):u=e[4];let a;return e[5]!==i||e[6]!==u?(a=(0,Q.jsx)(oe.Separator,{"data-slot":"dropdown-menu-separator",className:u,...i}),e[5]=i,e[6]=u,e[7]=a):a=e[7],a}o(Jc,"C");export{Hc as a,jc as b,Yc as c,zc as d,Kc as e,$c as f,Wc as g,Jc as h};
@@ -0,0 +1 @@
1
+ import{a as L}from"./chunk-UANVABQG.js";import{a as O,b as v,c as N,d as E,e as _,f as M}from"./chunk-L4EZAHCD.js";import{a as q}from"./chunk-IYWVSMAY.js";import{d as x,h as T,m as k,o as I}from"./chunk-6ZPTNC34.js";import{c as R}from"./chunk-FDLSPDIC.js";import{a as u,d as b,e as Y,f as U,g as W}from"./chunk-R5ZTCHCE.js";var $=b(U(),1);var F="https://api.cloudflare.com/client/v4/accounts",H=6e4,f=class extends R{static{u(this,"r")}constructor(t,p){super("ANALYTICS_SQL_ERROR",`Analytics Engine SQL API returned ${String(t)}: ${p}`,{name:"AnalyticsSqlError",status:t})}},C=u(a=>{let t=a.fetch??globalThis.fetch,p=`${F}/${encodeURIComponent(a.accountId)}/analytics_engine/sql`,m=a.timeoutMs??H;return{query:u(async c=>{let l=new AbortController,r=setTimeout(()=>{l.abort()},m);try{let e=await t(p,{body:c,headers:{Authorization:`Bearer ${a.apiToken}`,"Content-Type":"text/plain"},method:"POST",signal:l.signal});if(!e.ok)throw new f(e.status,await e.text().catch(()=>"<error body unavailable: the request deadline fired before it was read>"));let o;try{o=await e.json()}catch(d){throw l.signal.aborted?d:new f(e.status,"Analytics Engine SQL API returned a non-JSON body.")}let s=o,i=s.data??[];return{columns:s.meta??[],rowCount:s.rows??i.length,rows:i}}catch(e){throw l.signal.aborted&&!(e instanceof f)?new f(504,`query timed out after ${String(m)}ms (AnalyticsSqlConfig.timeoutMs)`):e}finally{clearTimeout(r)}},"query")}},"p");var y=b(Y(),1);var n=b(W(),1);var Q="ANALYTICS",D=[{key:"volume",sql:u(a=>`SELECT blob2 AS fn, count() AS calls FROM ${a} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:u(a=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${a} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:u(a=>`SELECT blob3 AS shard, count() AS calls FROM ${a} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],j={error:null,loading:!0,result:null},G=u(a=>{let t=(0,$.c)(27),{state:p,title:m}=a,c=x(),{error:l,loading:r,result:e}=p,o=`analytics-panel-${m}`,s;t[0]!==c||t[1]!==m?(s=c(m),t[0]=c,t[1]=m,t[2]=s):s=t[2];let i;t[3]!==s?(i=(0,n.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s})}),t[3]=s,t[4]=i):i=t[4];let d;t[5]!==r||t[6]!==c?(d=r&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:c("Loading\u2026")}),t[5]=r,t[6]=c,t[7]=d):d=t[7];let h;t[8]!==l||t[9]!==r?(h=!r&&l!==null&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:l}),t[8]=l,t[9]=r,t[10]=h):h=t[10];let A;t[11]!==l||t[12]!==r||t[13]!==e||t[14]!==c?(A=!r&&l===null&&e!==null&&e.rows.length===0&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:c("No data points yet.")}),t[11]=l,t[12]=r,t[13]=e,t[14]=c,t[15]=A):A=t[15];let g;t[16]!==l||t[17]!==r||t[18]!==e?(g=!r&&l===null&&e!==null&&e.rows.length>0&&(0,n.jsxs)(O,{children:[(0,n.jsx)(v,{children:(0,n.jsx)(E,{children:e.columns.map(V)})}),(0,n.jsx)(N,{children:e.rows.map((B,P)=>(0,n.jsx)(E,{children:e.columns.map(w=>(0,n.jsx)(M,{className:"font-mono text-xs",children:k(B[w.name])},w.name))},P))})]}),t[16]=l,t[17]=r,t[18]=e,t[19]=g):g=t[19];let S;return t[20]!==o||t[21]!==i||t[22]!==d||t[23]!==h||t[24]!==A||t[25]!==g?(S=(0,n.jsxs)(q,{className:"gap-0 py-0","data-testid":o,children:[i,d,h,A,g]}),t[20]=o,t[21]=i,t[22]=d,t[23]=h,t[24]=A,t[25]=g,t[26]=S):S=t[26],S},"H"),ot=u(({config:a,dataset:t=Q,runQuery:p}={})=>{let m=x(),[c,l]=(0,y.useState)({}),r=(0,y.useMemo)(()=>{if(p!==void 0)return p;if(a===void 0)return null;let o=C({accountId:a.accountId,apiToken:a.apiToken});return s=>o.query(s)},[a,p]),e=(0,y.useCallback)(async o=>{if(r!==null)for(let s of D){if(o.cancelled)return;l(i=>({...i,[s.key]:{error:null,loading:!0,result:null}}));try{let i=await r(s.sql(t));o.cancelled||l(d=>({...d,[s.key]:{error:null,loading:!1,result:i}}))}catch(i){o.cancelled||l(d=>({...d,[s.key]:{error:T(i),loading:!1,result:null}}))}}},[r,t]);return(0,y.useEffect)(()=>{let o={cancelled:!1};return I(e(o)),()=>{o.cancelled=!0}},[e]),r===null?(0,n.jsx)(L,{description:m("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,n.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"})}),testId:"analytics-not-configured",title:m("Analytics is not configured.")}):(0,n.jsx)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:D.map(o=>(0,n.jsx)(G,{state:c[o.key]??j,title:o.title},o.key))})},"Q");function V(a){return(0,n.jsx)(_,{children:a.name},a.name)}u(V,"W");export{ot as AnalyticsPanel};
@@ -0,0 +1 @@
1
+ import{a as Ce,b as Ne}from"./chunk-HAIBZTXF.js";import{a as ye}from"./chunk-RLRTQOFQ.js";import"./chunk-NNLNQKT7.js";import"./chunk-JV7KTJPY.js";import"./chunk-DPNEFSEC.js";import{e as ke,g as we}from"./chunk-ZHPDAJBM.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as X}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{a as le}from"./chunk-PZ4QDWTI.js";import{a as pe}from"./chunk-DZGOHOOE.js";import"./chunk-PSPJORP6.js";import{f as he}from"./chunk-OEGE3YDK.js";import"./chunk-RCZTUWG3.js";import{a as me}from"./chunk-UANVABQG.js";import"./chunk-L4EZAHCD.js";import{a as oe,b as ue,c as ge,e as ae}from"./chunk-IYWVSMAY.js";import{d as te,f as ve,g as be,h as fe,m as xe,o as ne}from"./chunk-6ZPTNC34.js";import"./chunk-FDLSPDIC.js";import{a as g,d as ie,e as Se,f as Ke,g as Le}from"./chunk-R5ZTCHCE.js";var Y=ie(Ke(),1),G=ie(Se(),1);var a=ie(Le(),1);var Me=ve(pe.runSql),qe=g((f,e)=>{let t=(0,Y.c)(11),n=he(),[l,d]=(0,G.useState)(void 0),[s,i]=(0,G.useState)(void 0),[h,x]=(0,G.useState)(!0),m;t[0]!==n||t[1]!==e||t[2]!==f?(m=g(async u=>{x(!0);try{let C=await n.query(Me,{sql:f},be(e));u.cancelled||(d(C),i(void 0))}catch(C){let k=C;u.cancelled||(d(void 0),i(fe(k)))}u.cancelled||x(!1)},"h"),t[0]=n,t[1]=e,t[2]=f,t[3]=m):m=t[3];let r=m,o,v;t[4]!==r?(o=g(()=>{let u={cancelled:!1};return ne(r(u)),()=>{u.cancelled=!0}},"l"),v=[r],t[4]=r,t[5]=o,t[6]=v):(o=t[5],v=t[6]),(0,G.useEffect)(o,v);let S;return t[7]!==s||t[8]!==h||t[9]!==l?(S={error:s,loading:h,result:l},t[7]=s,t[8]=h,t[9]=l,t[10]=S):S=t[10],S},"Le"),Ee=g(f=>{f.preventDefault()},"Me"),ce=g(f=>f.kind??"chart","le"),Re=g(f=>{let e=(0,Y.c)(80),{actions:t,children:n,draggedRef:l,first:d,last:s,onEdit:i,onMove:h,onRemove:x,onReorder:m,widget:r}=f,o=te(),v;e[0]!==h||e[1]!==r.id?(v=g(()=>{h(r.id,-1)},"g"),e[0]=h,e[1]=r.id,e[2]=v):v=e[2];let S=v,u;e[3]!==h||e[4]!==r.id?(u=g(()=>{h(r.id,1)},"f"),e[3]=h,e[4]=r.id,e[5]=u):u=e[5];let C=u,k;e[6]!==i||e[7]!==r.id?(k=g(()=>{i(r.id)},"x"),e[6]=i,e[7]=r.id,e[8]=k):k=e[8];let E=k,O;e[9]!==x||e[10]!==r.id?(O=g(()=>{x(r.id)},"O"),e[9]=x,e[10]=r.id,e[11]=O):O=e[11];let j=O,T;e[12]!==l||e[13]!==r.id?(T=g(()=>{l.current=r.id},"z"),e[12]=l,e[13]=r.id,e[14]=T):T=e[14];let w=T,K;e[15]!==l||e[16]!==m||e[17]!==r.id?(K=g(()=>{let de=l.current;l.current=null,de!==null&&de!==r.id&&m(de,r.id)},"K"),e[15]=l,e[16]=m,e[17]=r.id,e[18]=K):K=e[18];let _=K,R=`dashboards-widget-${r.id}`,y;e[19]!==r.title?(y=(0,a.jsx)(ge,{className:"min-w-0 cursor-grab truncate",title:r.title,children:r.title}),e[19]=r.title,e[20]=y):y=e[20];let N;e[21]!==o?(N=o("Move widget up"),e[21]=o,e[22]=N):N=e[22];let F=`dashboards-move-up-${r.id}`,H;e[23]!==o?(H=o("Move widget up"),e[23]=o,e[24]=H):H=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m6 15 6-6 6 6"})}),e[25]=D):D=e[25];let W;e[26]!==d||e[27]!==S||e[28]!==F||e[29]!==H||e[30]!==N?(W=(0,a.jsx)(X,{"aria-label":N,"data-testid":F,disabled:d,onClick:S,size:"icon-xs",title:H,type:"button",variant:"ghost",children:D}),e[26]=d,e[27]=S,e[28]=F,e[29]=H,e[30]=N,e[31]=W):W=e[31];let L;e[32]!==o?(L=o("Move widget down"),e[32]=o,e[33]=L):L=e[33];let $=`dashboards-move-down-${r.id}`,M;e[34]!==o?(M=o("Move widget down"),e[34]=o,e[35]=M):M=e[35];let z;e[36]===Symbol.for("react.memo_cache_sentinel")?(z=(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m6 9 6 6 6-6"})}),e[36]=z):z=e[36];let q;e[37]!==s||e[38]!==C||e[39]!==L||e[40]!==$||e[41]!==M?(q=(0,a.jsx)(X,{"aria-label":L,"data-testid":$,disabled:s,onClick:C,size:"icon-xs",title:M,type:"button",variant:"ghost",children:z}),e[37]=s,e[38]=C,e[39]=L,e[40]=$,e[41]=M,e[42]=q):q=e[42];let B;e[43]!==o?(B=o("Edit widget"),e[43]=o,e[44]=B):B=e[44];let I=`dashboards-widget-edit-${r.id}`,A;e[45]!==o?(A=o("Edit widget"),e[45]=o,e[46]=A):A=e[46];let p;e[47]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M4 20h4L18 10l-4-4L4 16v4ZM14 6l4 4"})}),e[47]=p):p=e[47];let b;e[48]!==E||e[49]!==B||e[50]!==I||e[51]!==A?(b=(0,a.jsx)(X,{"aria-label":B,"data-testid":I,onClick:E,size:"icon-xs",title:A,type:"button",variant:"ghost",children:p}),e[48]=E,e[49]=B,e[50]=I,e[51]=A,e[52]=b):b=e[52];let c;e[53]!==o?(c=o("Remove widget"),e[53]=o,e[54]=c):c=e[54];let J=`dashboards-widget-remove-${r.id}`,V;e[55]!==o?(V=o("Remove widget"),e[55]=o,e[56]=V):V=e[56];let U;e[57]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[57]=U):U=e[57];let Q;e[58]!==j||e[59]!==c||e[60]!==J||e[61]!==V?(Q=(0,a.jsx)(X,{"aria-label":c,"data-testid":J,onClick:j,size:"icon-xs",title:V,type:"button",variant:"ghost",children:U}),e[58]=j,e[59]=c,e[60]=J,e[61]=V,e[62]=Q):Q=e[62];let Z;e[63]!==t||e[64]!==W||e[65]!==q||e[66]!==b||e[67]!==Q?(Z=(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[t,W,q,b,Q]}),e[63]=t,e[64]=W,e[65]=q,e[66]=b,e[67]=Q,e[68]=Z):Z=e[68];let P;e[69]!==Z||e[70]!==y?(P=(0,a.jsxs)(ue,{className:"flex flex-row items-start justify-between gap-2 border-b pb-3",children:[y,Z]}),e[69]=Z,e[70]=y,e[71]=P):P=e[71];let ee;e[72]!==n?(ee=(0,a.jsx)(ae,{className:"min-h-32 py-2",children:n}),e[72]=n,e[73]=ee):ee=e[73];let re;return e[74]!==w||e[75]!==_||e[76]!==P||e[77]!==ee||e[78]!==R?(re=(0,a.jsxs)(oe,{"data-testid":R,draggable:!0,onDragOver:Ee,onDragStart:w,onDrop:_,children:[P,ee]}),e[74]=w,e[75]=_,e[76]=P,e[77]=ee,e[78]=R,e[79]=re):re=e[79],re},"ce"),je=g(f=>{let e=(0,Y.c)(10),{result:t}=f,n=te(),l=t.columns[0],d=l===void 0?void 0:t.rows[0]?.[l],s;e[0]!==d||e[1]!==n?(s=d===void 0?n("\u2014"):xe(d),e[0]=d,e[1]=n,e[2]=s):s=e[2];let i;e[3]!==s?(i=(0,a.jsx)("p",{className:"truncate font-mono text-3xl font-semibold text-foreground",children:s}),e[3]=s,e[4]=i):i=e[4];let h;e[5]!==l?(h=l!==void 0&&(0,a.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:l}),e[5]=l,e[6]=h):h=e[6];let x;return e[7]!==i||e[8]!==h?(x=(0,a.jsxs)("div",{className:"flex h-full flex-col justify-center gap-1 p-4","data-testid":"dashboards-kpi",children:[i,h]}),e[7]=i,e[8]=h,e[9]=x):x=e[9],x},"qe"),ze=g(f=>{let e=(0,Y.c)(12),{draggedRef:t,first:n,last:l,onEdit:d,onMove:s,onRemove:i,onReorder:h,widget:x}=f,m=x.text??"",r;e[0]!==m?(r=(0,a.jsx)("p",{className:"p-2 text-sm whitespace-pre-wrap text-muted-foreground","data-testid":"dashboards-text",children:m}),e[0]=m,e[1]=r):r=e[1];let o;return e[2]!==t||e[3]!==n||e[4]!==l||e[5]!==d||e[6]!==s||e[7]!==i||e[8]!==h||e[9]!==r||e[10]!==x?(o=(0,a.jsx)(Re,{draggedRef:t,first:n,last:l,onEdit:d,onMove:s,onRemove:i,onReorder:h,widget:x,children:r}),e[2]=t,e[3]=n,e[4]=l,e[5]=d,e[6]=s,e[7]=i,e[8]=h,e[9]=r,e[10]=x,e[11]=o):o=e[11],o},"Ee"),Ae=g(f=>{let e=(0,Y.c)(52),{draggedRef:t,first:n,inferring:l,last:d,onEdit:s,onMove:i,onRemove:h,onReorder:x,onSuggest:m,widget:r}=f,o=te(),{error:v,loading:S,result:u}=qe(r.sql,r.shardKey??""),C;e[0]!==r?(C=ce(r),e[0]=r,e[1]=C):C=e[1];let k=C,E;e[2]!==m||e[3]!==u||e[4]!==r.id?(E=g(()=>{u!==void 0&&m?.(r.id,u)},"q"),e[2]=m,e[3]=u,e[4]=r.id,e[5]=E):E=e[5];let O=E,j;e[6]!==l||e[7]!==k||e[8]!==m||e[9]!==O||e[10]!==u||e[11]!==o||e[12]!==r.id?(j=k==="chart"&&m!==void 0&&u!==void 0?(0,a.jsx)(X,{"aria-label":o("Suggest chart"),"data-testid":`dashboards-widget-suggest-${r.id}`,disabled:l,onClick:O,size:"icon-xs",title:o(l?"Suggesting\u2026":"Suggest chart"),type:"button",variant:"ghost",children:(0,a.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m12 3 1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3ZM18 15l.9 2.1 2.1.9-2.1.9L18 21l-.9-2.1-2.1-.9 2.1-.9L18 15Z"})})}):void 0,e[6]=l,e[7]=k,e[8]=m,e[9]=O,e[10]=u,e[11]=o,e[12]=r.id,e[13]=j):j=e[13];let T=j,w;e[14]!==v||e[15]!==r.id?(w=v!==void 0&&(0,a.jsx)(le,{className:"font-mono text-xs",testId:`dashboards-widget-error-${r.id}`,variant:"destructive",children:v}),e[14]=v,e[15]=r.id,e[16]=w):w=e[16];let K;e[17]!==v||e[18]!==S||e[19]!==u||e[20]!==o||e[21]!==r.id?(K=v===void 0&&S&&u===void 0&&(0,a.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":`dashboards-widget-loading-${r.id}`,children:o("Running\u2026")}),e[17]=v,e[18]=S,e[19]=u,e[20]=o,e[21]=r.id,e[22]=K):K=e[22];let _;e[23]!==v||e[24]!==k||e[25]!==u||e[26]!==r.chartAxes||e[27]!==r.chartKind?(_=v===void 0&&u!==void 0&&k==="chart"&&(0,a.jsx)(Ce,{axes:r.chartAxes,kind:r.chartKind,result:u}),e[23]=v,e[24]=k,e[25]=u,e[26]=r.chartAxes,e[27]=r.chartKind,e[28]=_):_=e[28];let R;e[29]!==v||e[30]!==k||e[31]!==u?(R=v===void 0&&u!==void 0&&k==="kpi"&&(0,a.jsx)(je,{result:u}),e[29]=v,e[30]=k,e[31]=u,e[32]=R):R=e[32];let y;e[33]!==v||e[34]!==k||e[35]!==u?(y=v===void 0&&u!==void 0&&k==="table"&&(0,a.jsx)("div",{className:"max-h-72 overflow-auto",children:(0,a.jsx)(Ne,{result:u})}),e[33]=v,e[34]=k,e[35]=u,e[36]=y):y=e[36];let N;return e[37]!==t||e[38]!==n||e[39]!==d||e[40]!==s||e[41]!==i||e[42]!==h||e[43]!==x||e[44]!==T||e[45]!==w||e[46]!==K||e[47]!==_||e[48]!==R||e[49]!==y||e[50]!==r?(N=(0,a.jsxs)(Re,{actions:T,draggedRef:t,first:n,last:d,onEdit:s,onMove:i,onRemove:h,onReorder:x,widget:r,children:[w,K,_,R,y]}),e[37]=t,e[38]=n,e[39]=d,e[40]=s,e[41]=i,e[42]=h,e[43]=x,e[44]=T,e[45]=w,e[46]=K,e[47]=_,e[48]=R,e[49]=y,e[50]=r,e[51]=N):N=e[51],N},"Ae"),_e=g(f=>{let e=(0,Y.c)(11),{draggedRef:t,first:n,inferring:l,last:d,onEdit:s,onMove:i,onRemove:h,onReorder:x,onSuggest:m,widget:r}=f,o;return e[0]!==t||e[1]!==n||e[2]!==l||e[3]!==d||e[4]!==s||e[5]!==i||e[6]!==h||e[7]!==x||e[8]!==m||e[9]!==r?(o=ce(r)==="text"?(0,a.jsx)(ze,{draggedRef:t,first:n,last:d,onEdit:s,onMove:i,onRemove:h,onReorder:x,widget:r}):(0,a.jsx)(Ae,{draggedRef:t,first:n,inferring:l,last:d,onEdit:s,onMove:i,onRemove:h,onReorder:x,onSuggest:m,widget:r}),e[0]=t,e[1]=n,e[2]=l,e[3]=d,e[4]=s,e[5]=i,e[6]=h,e[7]=x,e[8]=m,e[9]=r,e[10]=o):o=e[10],o},"Te"),We=["bar","line","area"],$e=["chart","kpi","table","text"],Be="lunora-studio-dashboards",se={chartKind:"bar",kind:"chart",shardKey:"",sql:"",text:"",title:""},Ie=g((f,e)=>t=>t.map(n=>n.id===f?{...n,chartAxes:e,chartKind:e.kind}:n),"De"),Te=g((f,e)=>t=>{let n=t.find(s=>s.id===f),l=t.filter(s=>s.id!==f),d=l.findIndex(s=>s.id===e);return n===void 0||d===-1?t:[...l.slice(0,d),n,...l.slice(d)]},"je"),De=g((f,e)=>e(f==="line"?"Line":f==="area"?"Area":"Bar"),"ze"),Oe=g((f,e)=>e(f==="kpi"?"Single value":f==="table"?"Table":f==="text"?"Text":"Chart"),"Be"),Fe=g(f=>{let e=(0,Y.c)(82),{draft:t,editing:n,onCancel:l,onChange:d,onSubmit:s}=f,i=te(),h;e[0]!==t||e[1]!==d?(h=g(c=>{d({...t,title:c.target.value})},"c"),e[0]=t,e[1]=d,e[2]=h):h=e[2];let x=h,m;e[3]!==t||e[4]!==d?(m=g(c=>{d({...t,sql:c.target.value})},"h"),e[3]=t,e[4]=d,e[5]=m):m=e[5];let r=m,o;e[6]!==t||e[7]!==d?(o=g(c=>{d({...t,text:c.target.value})},"l"),e[6]=t,e[7]=d,e[8]=o):o=e[8];let v=o,S;e[9]!==t||e[10]!==d?(S=g(c=>{d({...t,shardKey:c.target.value})},"N"),e[9]=t,e[10]=d,e[11]=S):S=e[11];let u=S,C;e[12]!==t||e[13]!==d?(C=g(c=>{d({...t,chartKind:c.target.value})},"y"),e[12]=t,e[13]=d,e[14]=C):C=e[14];let k=C,E;e[15]!==t||e[16]!==d?(E=g(c=>{d({...t,kind:c.target.value})},"q"),e[15]=t,e[16]=d,e[17]=E):E=e[17];let O=E,j;e[18]!==s?(j=g(()=>{s()},"E"),e[18]=s,e[19]=j):j=e[19];let T=j,w=t.kind==="text",K;e[20]!==t.sql||e[21]!==t.text||e[22]!==t.title||e[23]!==w?(K=t.title.trim()!==""&&(w?t.text.trim()!=="":t.sql.trim()!==""),e[20]=t.sql,e[21]=t.text,e[22]=t.title,e[23]=w,e[24]=K):K=e[24];let _=K,R;e[25]!==i?(R=i("Widget title"),e[25]=i,e[26]=R):R=e[26];let y;e[27]!==i?(y=i("Widget title"),e[27]=i,e[28]=y):y=e[28];let N;e[29]!==t.title||e[30]!==x||e[31]!==y||e[32]!==R?(N=(0,a.jsx)("input",{"aria-label":R,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-title",onChange:x,placeholder:y,type:"text",value:t.title}),e[29]=t.title,e[30]=x,e[31]=y,e[32]=R,e[33]=N):N=e[33];let F;e[34]!==i?(F=i("Widget type"),e[34]=i,e[35]=F):F=e[35];let H=t.kind,D;e[36]!==i?(D=$e.map(c=>(0,a.jsx)("option",{value:c,children:Oe(c,i)},c)),e[36]=i,e[37]=D):D=e[37];let W;e[38]!==t.kind||e[39]!==O||e[40]!==F||e[41]!==D?(W=(0,a.jsx)("select",{"aria-label":F,className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-widget-kind",onChange:O,value:H,children:D}),e[38]=t.kind,e[39]=O,e[40]=F,e[41]=D,e[42]=W):W=e[42];let L;e[43]!==t.sql||e[44]!==t.text||e[45]!==w||e[46]!==r||e[47]!==v||e[48]!==i?(L=w?(0,a.jsx)("textarea",{"aria-label":i("Text"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-text",onChange:v,placeholder:i("Notes for whoever reads this dashboard."),value:t.text}):(0,a.jsx)("textarea",{"aria-label":i("SQL query"),className:"min-h-24 resize-y rounded-md border border-border bg-background p-2 font-mono text-xs leading-5 outline-none focus-visible:border-ring","data-testid":"dashboards-form-sql",onChange:r,placeholder:"SELECT author, COUNT(*) AS messages FROM \u2026",spellCheck:!1,value:t.sql}),e[43]=t.sql,e[44]=t.text,e[45]=w,e[46]=r,e[47]=v,e[48]=i,e[49]=L):L=e[49];let $;e[50]!==t.chartKind||e[51]!==t.kind||e[52]!==k||e[53]!==i?($=t.kind==="chart"&&(0,a.jsx)("select",{"aria-label":i("Chart type"),className:"h-8 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-kind",onChange:k,value:t.chartKind,children:We.map(c=>(0,a.jsx)("option",{value:c,children:De(c,i)},c))}),e[50]=t.chartKind,e[51]=t.kind,e[52]=k,e[53]=i,e[54]=$):$=e[54];let M;e[55]!==t.shardKey||e[56]!==w||e[57]!==u||e[58]!==i?(M=!w&&(0,a.jsx)("input",{"aria-label":i("Shard key (optional)"),className:"h-8 rounded-md border border-border bg-background px-2 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"dashboards-form-shard",onChange:u,placeholder:i("Shard key (optional)"),type:"text",value:t.shardKey}),e[55]=t.shardKey,e[56]=w,e[57]=u,e[58]=i,e[59]=M):M=e[59];let z;e[60]!==i?(z=i("Cancel"),e[60]=i,e[61]=z):z=e[61];let q;e[62]!==l||e[63]!==z?(q=(0,a.jsx)(X,{"data-testid":"dashboards-form-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:z}),e[62]=l,e[63]=z,e[64]=q):q=e[64];let B=!_,I;e[65]!==n||e[66]!==i?(I=i(n?"Save widget":"Add widget"),e[65]=n,e[66]=i,e[67]=I):I=e[67];let A;e[68]!==T||e[69]!==B||e[70]!==I?(A=(0,a.jsx)(X,{"data-testid":"dashboards-form-save",disabled:B,onClick:T,size:"sm",type:"button",children:I}),e[68]=T,e[69]=B,e[70]=I,e[71]=A):A=e[71];let p;e[72]!==q||e[73]!==A?(p=(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[q,A]}),e[72]=q,e[73]=A,e[74]=p):p=e[74];let b;return e[75]!==N||e[76]!==W||e[77]!==L||e[78]!==$||e[79]!==M||e[80]!==p?(b=(0,a.jsx)(oe,{"data-testid":"dashboards-form",children:(0,a.jsxs)(ae,{className:"flex flex-col gap-3 py-4",children:[N,W,L,$,M,p]})}),e[75]=N,e[76]=W,e[77]=L,e[78]=$,e[79]=M,e[80]=p,e[81]=b):b=e[81],b},"Fe"),tt=g(f=>{let e=(0,Y.c)(53),{initialShardKey:t}=f,n=te(),[l,d]=ke(Be),[s,i]=(0,G.useState)(se),[h,x]=(0,G.useState)(null),[m,r]=(0,G.useState)(!1),o=ye(t??""),[v,S]=(0,G.useState)(null),u=(0,G.useRef)(null),C;e[0]!==t?(C=g(()=>{x(null),i({...se,shardKey:t??""}),r(!0)},"y"),e[0]=t,e[1]=C):C=e[1];let k=C,E;e[2]===Symbol.for("react.memo_cache_sentinel")?(E=g(()=>{r(!1),x(null),i(se)},"q"),e[2]=E):E=e[2];let O=E,j;e[3]!==l?(j=g(p=>{let b=l.find(c=>c.id===p);b!==void 0&&(x(p),i({chartKind:b.chartKind??"bar",kind:ce(b),shardKey:b.shardKey??"",sql:b.sql,text:b.text??"",title:b.title}),r(!0))},"E"),e[3]=l,e[4]=j):j=e[4];let T=j,w;e[5]!==o||e[6]!==d?(w=g((p,b)=>{S(p),ne((async()=>{let c=await o.inferChart({columns:b.columns,rowCount:b.rowCount});c!==void 0&&d(Ie(p,c))})().finally(()=>{S(c=>c===p?null:c)}))},"C"),e[5]=o,e[6]=d,e[7]=w):w=e[7];let K=w,_;e[8]!==d?(_=g(p=>{d(b=>b.filter(c=>c.id!==p))},"W"),e[8]=d,e[9]=_):_=e[9];let R=_,y;e[10]!==d?(y=g((p,b)=>{d(Te(p,b))},"k"),e[10]=d,e[11]=y):y=e[11];let N=y,F;e[12]!==d?(F=g((p,b)=>{d(c=>{let J=c.findIndex(P=>P.id===p),V=J+b;if(J===-1||V<0||V>=c.length)return c;let U=[...c],Q=U[J],Z=U[V];return Q===void 0||Z===void 0?c:(U[J]=Z,U[V]=Q,U)})},"_"),e[12]=d,e[13]=F):F=e[13];let H=F,D;e[14]!==s||e[15]!==h||e[16]!==d?(D=g(()=>{let p=s.title.trim(),b=s.sql.trim(),c=s.text.trim(),{chartKind:J,kind:V}=s;if(p===""||(V==="text"?c==="":b===""))return;let U={chartKind:J,kind:V,shardKey:s.shardKey.trim(),sql:b,text:c,title:p};d(h===null?Q=>[...Q,{...U,id:we("w")}]:Q=>Q.map(Z=>Z.id===h?{...Z,...U}:Z)),O()},"B"),e[14]=s,e[15]=h,e[16]=d,e[17]=D):D=e[17];let W=D,L;e[18]!==n?(L=n("Charts, values, tables, and notes. Drag a tile to reorder."),e[18]=n,e[19]=L):L=e[19];let $;e[20]!==L?($=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:L}),e[20]=L,e[21]=$):$=e[21];let M;e[22]!==m||e[23]!==k||e[24]!==n?(M=!m&&(0,a.jsx)(X,{"data-testid":"dashboards-add",onClick:k,size:"sm",type:"button",children:n("Add widget")}),e[22]=m,e[23]=k,e[24]=n,e[25]=M):M=e[25];let z;e[26]!==$||e[27]!==M?(z=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[$,M]}),e[26]=$,e[27]=M,e[28]=z):z=e[28];let q;e[29]!==o||e[30]!==n?(q=o.reason("chart")!==void 0&&(0,a.jsx)(le,{className:"text-xs",testId:"dashboards-suggest-error",variant:"destructive",children:n("Could not suggest a chart for that result.")}),e[29]=o,e[30]=n,e[31]=q):q=e[31];let B;e[32]!==s||e[33]!==h||e[34]!==m||e[35]!==W?(B=m&&(0,a.jsx)(Fe,{draft:s,editing:h!==null,onCancel:O,onChange:i,onSubmit:W}),e[32]=s,e[33]=h,e[34]=m,e[35]=W,e[36]=B):B=e[36];let I;e[37]!==o.unavailable||e[38]!==m||e[39]!==v||e[40]!==T||e[41]!==H||e[42]!==R||e[43]!==N||e[44]!==K||e[45]!==n||e[46]!==l?(I=l.length===0&&!m?(0,a.jsx)(me,{description:n("Add a chart, a single value, a table, or a note. Everything is saved on this browser."),testId:"dashboards-empty",title:n("No widgets yet")}):(0,a.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3","data-testid":"dashboards-grid",children:l.map((p,b)=>(0,a.jsx)(_e,{draggedRef:u,first:b===0,inferring:v===p.id,last:b===l.length-1,onEdit:T,onMove:H,onRemove:R,onReorder:N,onSuggest:o.unavailable?void 0:K,widget:p},p.id))}),e[37]=o.unavailable,e[38]=m,e[39]=v,e[40]=T,e[41]=H,e[42]=R,e[43]=N,e[44]=K,e[45]=n,e[46]=l,e[47]=I):I=e[47];let A;return e[48]!==z||e[49]!==q||e[50]!==B||e[51]!==I?(A=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-dashboards",children:[z,q,B,I]}),e[48]=z,e[49]=q,e[50]=B,e[51]=I,e[52]=A):A=e[52],A},"it");export{tt as default};
@@ -0,0 +1 @@
1
+ import{a as C}from"./chunk-O5MAFDY2.js";import{a as Z}from"./chunk-OG57FC7W.js";import{a as W}from"./chunk-CKTKI4IY.js";import{a as V}from"./chunk-TB5N24CM.js";import{b as G}from"./chunk-KVSQKUWD.js";import{a as Q}from"./chunk-TNKECJW4.js";import{e as P}from"./chunk-4YTSKL4R.js";import"./chunk-ZHPDAJBM.js";import"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{b as ee,c as te}from"./chunk-QHQTOESO.js";import{a as _,b as Y}from"./chunk-MPYVZLYP.js";import{a as z}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import"./chunk-Y2YQITGI.js";import"./chunk-PZ4QDWTI.js";import"./chunk-VLW547U6.js";import"./chunk-F7JOSNAT.js";import{a as $}from"./chunk-DZGOHOOE.js";import{c as M}from"./chunk-PSPJORP6.js";import{f as J}from"./chunk-OEGE3YDK.js";import"./chunk-RCZTUWG3.js";import"./chunk-L4EZAHCD.js";import"./chunk-IYWVSMAY.js";import{d as A,f as H,g as K,o as k}from"./chunk-6ZPTNC34.js";import"./chunk-FDLSPDIC.js";import{a as l,d as L,e as he,f as me,g as pe}from"./chunk-R5ZTCHCE.js";var F=L(me(),1);var u=L(he(),1);var I=L(pe(),1);var be=l(t=>{let{suggestedIndex:e,table:r}=t;return!(typeof r!="string"||r.length===0||typeof e!="object"||e===null||!Array.isArray(e.fields)||e.fields.length===0)},"xe"),ge=l((t,e,r)=>{let n=C(t),a=C(e),o=r.map(c=>C(c)).join(", ");return`CREATE INDEX IF NOT EXISTS ${a} ON ${n} (${o});`},"ye"),ve=l(t=>{let e=(0,F.c)(19),{fields:r,indexName:n,table:a,testId:o}=t,c=A(),[T,p]=(0,u.useState)(!1),f;e[0]!==r||e[1]!==n||e[2]!==a?(f=l(()=>{let S="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if(S===void 0)return;let x=ge(a,n,r);k(S.writeText(x)),p(!0)},"u"),e[0]=r,e[1]=n,e[2]=a,e[3]=f):f=e[3];let v=f;if(T){let S=`${o}-applied`,x;e[4]!==c?(x=c("CREATE INDEX SQL copied to clipboard."),e[4]=c,e[5]=x):x=e[5];let E;return e[6]!==S||e[7]!==x?(E=(0,I.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":S,children:x}),e[6]=S,e[7]=x,e[8]=E):E=e[8],E}let w;e[9]!==c?(w=c("Apply?"),e[9]=c,e[10]=w):w=e[10];let h;e[11]!==c||e[12]!==a?(h=c("Apply index on {table}",{table:a}),e[11]=c,e[12]=a,e[13]=h):h=e[13];let y;return e[14]!==v||e[15]!==w||e[16]!==h||e[17]!==o?(y=(0,I.jsx)(Z,{confirmLabel:w,onConfirm:v,testId:o,children:h}),e[14]=v,e[15]=w,e[16]=h,e[17]=o,e[18]=y):y=e[18],y},"ve"),ye=l((t,e)=>{let r=new Map;for(let n of e){let a=`${n.table} ${n.index}`;r.set(a,(r.get(a)??0)+n.reads)}return t.map(n=>({index:n.index,reads:r.get(`${n.table} ${n.index}`)??0,table:n.table}))},"Se"),xe=l(t=>{let e=new Map;for(let r of t)for(let n of r.scannedTables??[])e.set(n.table,(e.get(n.table)??0)+n.scans);return[...e].map(([r,n])=>({scans:n,table:r}))},"Te"),ne=l((t,e)=>e.map(r=>({index:r.name,table:t})),"X"),we=l(t=>{let e=ye(t.declaredIndexes??[],t.indexHits??[]),r=xe(t.functions??[]),n=t.shardTraffic??[],a=t.analyticsMetrics,o=a&&a.indexHits.length>0?a.indexHits:e,c=a&&a.tableScans.length>0?a.tableScans:r,T=a&&a.shardTraffic.length>0?a.shardTraffic:n,p=te({indexHits:o,schema:{tables:[]},shardTraffic:T,tableScans:c},{lints:ee,source:"runtime"}),f=t.suppressHotScanTables;return(f===void 0?p:p.filter(v=>!(v.metadata.kind==="hot_scan"&&typeof v.metadata.table=="string"&&f.has(v.metadata.table)))).map(v=>_(v))},"ge"),Se=H($.listTables),Te=H($.listTableIndexes),Ie=H($.listTablesIndexes),j=l(t=>`${(t*100).toFixed(1)}%`,"H"),ae=l(t=>`${(t/1e3).toFixed(2)}s`,"P"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ee"),Ee=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function")})[e.kind],"$e"),re=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:j(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:j(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:j(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:ae(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:ae(e.value)})})[e.kind],"V"),Ne=l(t=>{let e=(0,F.c)(10),{onJump:r,table:n}=t,a=A(),o;e[0]!==r||e[1]!==n?(o=l(()=>{r(n)},"i"),e[0]=r,e[1]=n,e[2]=o):o=e[2];let c=o,T=`in-add-index-${n}`,p;e[3]!==a||e[4]!==n?(p=a("Add index on {table}",{table:n}),e[3]=a,e[4]=n,e[5]=p):p=e[5];let f;return e[6]!==c||e[7]!==T||e[8]!==p?(f=(0,I.jsx)(z,{"data-testid":T,onClick:c,size:"sm",type:"button",variant:"outline",children:p}),e[6]=c,e[7]=T,e[8]=p,e[9]=f):f=e[9],f},"Ne"),Ue=l(({initialShardKey:t,loadShardTraffic:e})=>{let r=J(),n=P(),a=A(),{queryShardKey:o,setShardKey:c,shardKey:T}=W(t),[p,f]=(0,u.useState)(null),[v,w]=(0,u.useState)(null),h=(0,u.useRef)(""),y=M($.getMetrics,{},{live:!0,shardKey:o}),S=M($.getFunctionStats,{},{live:!0,shardKey:o}),x=M($.getAdvisories,{},{live:!0,shardKey:o}),E=y.data??null,O=S.data?.functions??null,R=x.data?.advisories??null,se=y.data?.indexHits??null,B=y.error!==null&&S.error!==null?y.error:null,ie=e??(s=>r.shardTraffic(s)),oe=l(async(s,b)=>{let i=s[0];if(i===void 0||i===""){h.current===b&&w(null);return}try{let m=await ie(i);if(h.current!==b)return;let d=new Map;for(let g of m.shards)d.has(g.shardKey)||d.set(g.shardKey,{requests:g.requests,shardKey:g.shardKey});w([...d.values()])}catch{h.current===b&&w(null)}},"W"),le=l(async(s,b)=>{let i=await Promise.allSettled(s.map(async d=>[d,await r.query(Te,{table:d},K(b))])),m=[];for(let d of i)if(d.status==="fulfilled"){let[g,N]=d.value;m.push(...ne(g,N.indexes))}return m},"Y"),D=(0,u.useEffectEvent)(async s=>{h.current=s;let b=[];try{let i=await r.query(Se,{},K(s));if(h.current!==s)return;G(s),b=i.map(d=>d.name);let m=[];if(b.length>0)try{let d=await r.query(Ie,{tables:b},K(s));if(h.current!==s)return;for(let[g,N]of Object.entries(d.indexesByTable))m.push(...ne(g,N))}catch{if(m=await le(b,s),h.current!==s)return}f(m)}catch{h.current===s&&f(null)}await oe(b,s)});(0,u.useEffect)(()=>{k(D(o))},[o]);let ce=(0,u.useEffectEvent)(()=>{y.refetch(),S.refetch(),x.refetch(),k(D(o))});(0,u.useEffect)(()=>{let s=l(()=>{document.visibilityState==="visible"&&ce()},"a");return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s)}},[]);let U=(0,u.useCallback)(s=>{k(n({search:{table:s},to:"/schema"}))},[n]),q=Q(E,O),de=new Set(q.filter(s=>s.kind==="missing-index").flatMap(s=>s.tables??[])),X=we({declaredIndexes:p??[],functions:O,indexHits:se,shardTraffic:v,suppressHotScanTables:de}),ue=(0,u.useMemo)(()=>{let s=q.map(i=>{let m=i.kind==="missing-index"?i.tables??[]:[];return{action:m.length>0?m.map(d=>(0,I.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:i.message===void 0?re(a,i):`${re(a,i)} \u2014 ${i.message}`,entity:i.fn,issueType:Ee(a,i),key:`${i.kind}:${i.fn??""}`,level:i.severity}}),b=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(R??[]).map(i=>{let m=_(i);if(b.has(i.name)&&be(i.metadata)){let{table:d,suggestedIndex:g}=i.metadata,N=`in-apply-index-${d}-${g.name}`;return{...m,action:(0,I.jsx)(ve,{fields:g.fields,indexName:g.name,table:d,testId:N})}}return m}),...X,...s]},[R,q,U,X,a]),fe=(0,I.jsx)(V,{onChange:c,testId:"in-shard-input",value:T});return(0,I.jsx)(Y,{error:B,errorSource:B===null?void 0:y.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Ue");export{Ue as InsightsPanel};