@lunora/studio 1.0.0-alpha.15 → 1.0.0-alpha.150

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 (333) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/index.d.mts +1527 -0
  4. package/dist/index.d.ts +923 -803
  5. package/dist/index.mjs +1 -0
  6. package/dist/mount.d.mts +22 -0
  7. package/dist/mount.d.ts +11 -10
  8. package/dist/mount.mjs +1 -0
  9. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
  10. package/dist/packem_chunks/ApiTab.mjs +1 -0
  11. package/dist/packem_chunks/AuditPanel.mjs +1 -0
  12. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
  13. package/dist/packem_chunks/ExportImportPanel.mjs +3 -0
  14. package/dist/packem_chunks/FileBrowser.mjs +4 -0
  15. package/dist/packem_chunks/FunctionRunner.mjs +1 -0
  16. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
  17. package/dist/packem_chunks/HealthPanel.mjs +1 -0
  18. package/dist/packem_chunks/InsightsPanel.mjs +1 -0
  19. package/dist/packem_chunks/LogsPanel.mjs +1 -0
  20. package/dist/packem_chunks/MailPanel.mjs +2 -0
  21. package/dist/packem_chunks/MetricsPanel.mjs +1 -0
  22. package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
  23. package/dist/packem_chunks/PitrPanel.mjs +1 -0
  24. package/dist/packem_chunks/SchemaViewer.mjs +1 -0
  25. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
  26. package/dist/packem_chunks/SettingsPanel.mjs +1 -0
  27. package/dist/packem_chunks/SqlEditorPanel.mjs +8 -0
  28. package/dist/packem_chunks/TableEditor.mjs +1 -0
  29. package/dist/packem_chunks/agents-panel.mjs +1 -0
  30. package/dist/packem_chunks/analytics-panel.mjs +1 -0
  31. package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
  32. package/dist/packem_chunks/auth-config-panel.mjs +1 -0
  33. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
  34. package/dist/packem_chunks/containers-panel.mjs +1 -0
  35. package/dist/packem_chunks/dashboards-panel.mjs +1 -0
  36. package/dist/packem_chunks/evals-panel.mjs +1 -0
  37. package/dist/packem_chunks/fanout-panel.mjs +1 -0
  38. package/dist/packem_chunks/flags-panel.mjs +1 -0
  39. package/dist/packem_chunks/issues-panel.mjs +1 -0
  40. package/dist/packem_chunks/kv-browser.mjs +1 -0
  41. package/dist/packem_chunks/log-drains-panel.mjs +4 -0
  42. package/dist/packem_chunks/migrations-route.mjs +1 -0
  43. package/dist/packem_chunks/organizations-panel.mjs +1 -0
  44. package/dist/packem_chunks/payments-panel.mjs +1 -0
  45. package/dist/packem_chunks/permissions-panel.mjs +1 -0
  46. package/dist/packem_chunks/queues-panel.mjs +1 -0
  47. package/dist/packem_chunks/reactors-panel.mjs +1 -0
  48. package/dist/packem_chunks/rls-panel.mjs +1 -0
  49. package/dist/packem_chunks/schedule-panel.mjs +1 -0
  50. package/dist/packem_chunks/sparkline.mjs +1 -0
  51. package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
  52. package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
  53. package/dist/packem_chunks/sync-client-panel.mjs +1 -0
  54. package/dist/packem_chunks/traces-panel.mjs +1 -0
  55. package/dist/packem_chunks/users-panel.mjs +1 -0
  56. package/dist/packem_chunks/vector-browser.mjs +1 -0
  57. package/dist/packem_chunks/workflows-panel.mjs +1 -0
  58. package/dist/packem_shared/ADMIN_FUNCTIONS-B8yyk5BX.mjs +1 -0
  59. package/dist/packem_shared/ApiDocsPanel-BImfQhyJ.mjs +2 -0
  60. package/dist/packem_shared/ApiReferencePanel-B4i-KeOf.mjs +1 -0
  61. package/dist/packem_shared/CommandPalette-CSdz9zax.mjs +1 -0
  62. package/dist/packem_shared/ConfirmButton-DU4p72Er.mjs +1 -0
  63. package/dist/packem_shared/ConnectionBadge-B_8fcft2.mjs +1 -0
  64. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs +1 -0
  65. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
  66. package/dist/packem_shared/DEFAULT_LOCALE-A1Yg5ORA.mjs +1 -0
  67. package/dist/packem_shared/DataBrowser-B0XdZT2Z.mjs +4 -0
  68. package/dist/packem_shared/DataFilters-3nbW0uax.mjs +1 -0
  69. package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
  70. package/dist/packem_shared/GlobalDataBrowser-BTbqR6Wc.mjs +1 -0
  71. package/dist/packem_shared/HomePanel-_BwLI4TQ.mjs +1 -0
  72. package/dist/packem_shared/MigrationsPanel-BPWzFdxC.mjs +1 -0
  73. package/dist/packem_shared/OpenRpcReferencePanel-BKJEX7we.mjs +1 -0
  74. package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
  75. package/dist/packem_shared/ScheduledJobs-B4DPADwk.mjs +1 -0
  76. package/dist/packem_shared/ShardInput-C6mjgAh4.mjs +1 -0
  77. package/dist/packem_shared/Studio-CcWQdYrV.mjs +1 -0
  78. package/dist/packem_shared/StudioApp-B5jLGbeH.mjs +1 -0
  79. package/dist/packem_shared/StudioI18nProvider-fVsCSs5L.mjs +1 -0
  80. package/dist/packem_shared/advisor-view-CPgOok_h.mjs +1 -0
  81. package/dist/packem_shared/aggregateMetrics-CY05xrYU.mjs +1 -0
  82. package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
  83. package/dist/packem_shared/app.d-BbmO2HA2.d.mts +301 -0
  84. package/dist/packem_shared/app.d-BbmO2HA2.d.ts +301 -0
  85. package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
  86. package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
  87. package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
  88. package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
  89. package/dist/packem_shared/card--2hKx4L2.mjs +1 -0
  90. package/dist/packem_shared/cf-links-CBJ5SywP.mjs +1 -0
  91. package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
  92. package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
  93. package/dist/packem_shared/data-grid-DTBAKZlm.mjs +1 -0
  94. package/dist/packem_shared/data-view-params-qoSTqjAj.mjs +1 -0
  95. package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
  96. package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
  97. package/dist/packem_shared/error-alert-tf5zvSLV.mjs +1 -0
  98. package/dist/packem_shared/grid-features-Dl7bCGRN.mjs +6 -0
  99. package/dist/packem_shared/home-panel-DCUKd8Uk.mjs +3 -0
  100. package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
  101. package/dist/packem_shared/internal-B6haJbiP.mjs +2 -0
  102. package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
  103. package/dist/packem_shared/live-status-BuJdUZFU.mjs +1 -0
  104. package/dist/packem_shared/log-fields-SBxKyBug.mjs +1 -0
  105. package/dist/packem_shared/log-line-BoObzuue.mjs +1 -0
  106. package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
  107. package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
  108. package/dist/packem_shared/recording-client-BXUIyBL4.mjs +1 -0
  109. package/dist/packem_shared/reference-view-AC9FgXSz.mjs +13 -0
  110. package/dist/packem_shared/schema-diagram-CDj_69jF.mjs +2 -0
  111. package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
  112. package/dist/packem_shared/select-DPyS18Vy.mjs +2 -0
  113. package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
  114. package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
  115. package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
  116. package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
  117. package/dist/packem_shared/sql-result-table-C5y0jwaK.mjs +1 -0
  118. package/dist/packem_shared/stat-card-D0Fe04cX.mjs +1 -0
  119. package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
  120. package/dist/packem_shared/studio-OqNyRY1N.mjs +2 -0
  121. package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
  122. package/dist/packem_shared/table-list-sidebar-DHG1UJC4.mjs +1 -0
  123. package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
  124. package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
  125. package/dist/packem_shared/use-admin-query-BKXiqLci.mjs +1 -0
  126. package/dist/packem_shared/use-async-submit-BTr3w2-K.mjs +1 -0
  127. package/dist/packem_shared/use-auth-config-BQKGdSFh.mjs +1 -0
  128. package/dist/packem_shared/use-open-trace-BCW0c9qq.mjs +1 -0
  129. package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
  130. package/dist/packem_shared/use-sql-assistant-BhIMDQHV.mjs +1 -0
  131. package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
  132. package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
  133. package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
  134. package/dist/packem_shared/wire-codec-oeb8YWV3.mjs +1 -0
  135. package/dist/standalone/chunk-25NFR6EB.js +1 -0
  136. package/dist/standalone/chunk-2ES4GR4C.js +1 -0
  137. package/dist/standalone/chunk-2LN3T5HY.js +15 -0
  138. package/dist/standalone/chunk-2POTU437.js +1 -0
  139. package/dist/standalone/chunk-35DM4JJG.js +1 -0
  140. package/dist/standalone/chunk-36KY3PTX.js +14 -0
  141. package/dist/standalone/chunk-3ES7RN3O.js +1 -0
  142. package/dist/standalone/chunk-3TNEWUWJ.js +1 -0
  143. package/dist/standalone/chunk-46ZJ3TM4.js +2 -0
  144. package/dist/standalone/chunk-4A6H7VLZ.js +1 -0
  145. package/dist/standalone/chunk-4GTO7FL5.js +1 -0
  146. package/dist/standalone/chunk-4L4WTGN5.js +1 -0
  147. package/dist/standalone/chunk-4ZEL6BYL.js +1 -0
  148. package/dist/standalone/chunk-5GFSKIB2.js +1 -0
  149. package/dist/standalone/chunk-5JDWLCSH.js +1 -0
  150. package/dist/standalone/chunk-5WJXVZMZ.js +1 -0
  151. package/dist/standalone/chunk-652ULANV.js +1 -0
  152. package/dist/standalone/chunk-66UGPQVC.js +1 -0
  153. package/dist/standalone/chunk-6HCSE2X7.js +4 -0
  154. package/dist/standalone/chunk-6NY2NC3H.js +1 -0
  155. package/dist/standalone/chunk-7DOPYCLK.js +1 -0
  156. package/dist/standalone/chunk-7RIRJD2P.js +1 -0
  157. package/dist/standalone/chunk-A4UOWQOI.js +8 -0
  158. package/dist/standalone/chunk-AJURTLI3.js +1 -0
  159. package/dist/standalone/chunk-BOTGXX4H.js +1 -0
  160. package/dist/standalone/chunk-C3TOZ4LG.js +1 -0
  161. package/dist/standalone/chunk-CBQTFTJC.js +2 -0
  162. package/dist/standalone/chunk-CSUROWL2.js +1 -0
  163. package/dist/standalone/chunk-D27D4UUI.js +1 -0
  164. package/dist/standalone/chunk-DDNGDORN.js +1 -0
  165. package/dist/standalone/chunk-DWSRRE2V.js +7 -0
  166. package/dist/standalone/chunk-DX6FAHR2.js +1 -0
  167. package/dist/standalone/chunk-DYFJMRLR.js +1 -0
  168. package/dist/standalone/chunk-EA2JKR5D.js +1 -0
  169. package/dist/standalone/chunk-EBWXFG4H.js +1 -0
  170. package/dist/standalone/chunk-EHSU2WDS.js +1 -0
  171. package/dist/standalone/chunk-F7UC63UN.js +1 -0
  172. package/dist/standalone/chunk-FIGP4KJN.js +1 -0
  173. package/dist/standalone/chunk-FKVZRPV5.js +1 -0
  174. package/dist/standalone/chunk-FNZC62LN.js +1 -0
  175. package/dist/standalone/chunk-FO26ZU7E.js +1 -0
  176. package/dist/standalone/chunk-FODLDLE2.js +19 -0
  177. package/dist/standalone/chunk-FSRSK4LY.js +1 -0
  178. package/dist/standalone/chunk-G53FJKCM.js +1 -0
  179. package/dist/standalone/chunk-GZ525PHR.js +1 -0
  180. package/dist/standalone/chunk-HEAQVSNS.js +1 -0
  181. package/dist/standalone/chunk-HSQFTY37.js +3 -0
  182. package/dist/standalone/chunk-I52I2DJG.js +1 -0
  183. package/dist/standalone/chunk-I6SFPRHU.js +1 -0
  184. package/dist/standalone/chunk-IABM4BFJ.js +1 -0
  185. package/dist/standalone/chunk-IF2RWXTR.js +1 -0
  186. package/dist/standalone/chunk-IMOHEGMV.js +1 -0
  187. package/dist/standalone/chunk-INWAISDG.js +6 -0
  188. package/dist/standalone/chunk-J5A6T372.js +1 -0
  189. package/dist/standalone/chunk-JAKYTDUH.js +59 -0
  190. package/dist/standalone/chunk-JOQ7QICC.js +8 -0
  191. package/dist/standalone/chunk-JRFMYRSK.js +1 -0
  192. package/dist/standalone/chunk-JVUZEYKQ.js +1 -0
  193. package/dist/standalone/chunk-K7AJEMKE.js +1 -0
  194. package/dist/standalone/chunk-LBRCRFC7.js +1 -0
  195. package/dist/standalone/chunk-LJYUUOBB.js +1 -0
  196. package/dist/standalone/chunk-LQQMVCEE.js +1 -0
  197. package/dist/standalone/chunk-M3C4GMLC.js +1 -0
  198. package/dist/standalone/chunk-MNAASONZ.js +1 -0
  199. package/dist/standalone/chunk-MPMVG5EM.js +1 -0
  200. package/dist/standalone/chunk-MXL3RBMK.js +1 -0
  201. package/dist/standalone/chunk-MZDJBR3M.js +11 -0
  202. package/dist/standalone/chunk-NCCAMFB6.js +1 -0
  203. package/dist/standalone/chunk-NL3S6OMD.js +1 -0
  204. package/dist/standalone/chunk-NPERN4YF.js +1 -0
  205. package/dist/standalone/chunk-O3D7LAG3.js +1 -0
  206. package/dist/standalone/chunk-OG32J5CM.js +1 -0
  207. package/dist/standalone/chunk-OGUKYRFM.js +1 -0
  208. package/dist/standalone/chunk-OKG3HWSJ.js +1 -0
  209. package/dist/standalone/chunk-OVTMYZN2.js +1 -0
  210. package/dist/standalone/chunk-OYMQJN7D.js +1 -0
  211. package/dist/standalone/chunk-PL664H45.js +1 -0
  212. package/dist/standalone/chunk-PLQNPVGT.js +1 -0
  213. package/dist/standalone/chunk-PNDBXKC4.js +1 -0
  214. package/dist/standalone/chunk-PYT4RZJH.js +1 -0
  215. package/dist/standalone/chunk-Q443C75G.js +1 -0
  216. package/dist/standalone/chunk-Q4CAKBWN.js +1 -0
  217. package/dist/standalone/chunk-QKEJLVC5.js +1 -0
  218. package/dist/standalone/chunk-QWHMIFOZ.js +1 -0
  219. package/dist/standalone/chunk-RCDHVEJZ.js +1 -0
  220. package/dist/standalone/chunk-REDAHOJT.js +1 -0
  221. package/dist/standalone/chunk-RLLKECZT.js +1 -0
  222. package/dist/standalone/chunk-RPQL45FL.js +1 -0
  223. package/dist/standalone/chunk-S3CRZLGS.js +1 -0
  224. package/dist/standalone/chunk-SB35BJ7A.js +1 -0
  225. package/dist/standalone/chunk-SCOUV4FW.js +3 -0
  226. package/dist/standalone/chunk-SU737V7V.js +1 -0
  227. package/dist/standalone/chunk-SUDJTC4S.js +1 -0
  228. package/dist/standalone/chunk-SUP63Z2J.js +1 -0
  229. package/dist/standalone/chunk-SWDTL2C5.js +1 -0
  230. package/dist/standalone/chunk-T6RCP25V.js +1 -0
  231. package/dist/standalone/chunk-T6S2F46N.js +1 -0
  232. package/dist/standalone/chunk-TCZ7ZOBB.js +1 -0
  233. package/dist/standalone/chunk-TGHH7ZFA.js +1 -0
  234. package/dist/standalone/chunk-TIUMFAN2.js +1 -0
  235. package/dist/standalone/chunk-TJRQUJFS.js +1 -0
  236. package/dist/standalone/chunk-TNQQCHK2.js +1 -0
  237. package/dist/standalone/chunk-TQEHSBYQ.js +1 -0
  238. package/dist/standalone/chunk-TWTNWOJU.js +1 -0
  239. package/dist/standalone/chunk-U5JDESCI.js +1 -0
  240. package/dist/standalone/chunk-UAZ3QMWC.js +1 -0
  241. package/dist/standalone/chunk-UDCVU3Z5.js +1 -0
  242. package/dist/standalone/chunk-ULIQFBZU.js +1 -0
  243. package/dist/standalone/chunk-UYEZR3BI.js +1 -0
  244. package/dist/standalone/chunk-VVOVVU53.js +1 -0
  245. package/dist/standalone/chunk-VYIK5F67.js +1 -0
  246. package/dist/standalone/chunk-WPBNZXI3.js +1 -0
  247. package/dist/standalone/chunk-WPWHJRJ2.js +1 -0
  248. package/dist/standalone/chunk-WQYWA7U6.js +1 -0
  249. package/dist/standalone/chunk-WTFZV4A3.js +1 -0
  250. package/dist/standalone/chunk-WUWBZPUK.js +1 -0
  251. package/dist/standalone/chunk-XZMOZFE6.js +1 -0
  252. package/dist/standalone/chunk-Y5JLYANQ.js +1 -0
  253. package/dist/standalone/chunk-Y6CXU7T4.js +1 -0
  254. package/dist/standalone/chunk-YKXDMIHQ.js +1 -0
  255. package/dist/standalone/chunk-YWJSG462.js +1 -0
  256. package/dist/standalone/chunk-Z5ZA5WBK.js +1 -0
  257. package/dist/standalone/chunk-Z7WIE3QU.js +1 -0
  258. package/dist/standalone/chunk-ZLPC3XZF.js +4 -0
  259. package/dist/standalone/studio.js +9 -378
  260. package/dist/styles.css +2 -2
  261. package/package.json +21 -18
  262. package/dist/index.js +0 -41
  263. package/dist/mount.js +0 -26
  264. package/dist/packem_shared/ADMIN_FUNCTIONS-CZJCZ4c7.js +0 -47
  265. package/dist/packem_shared/ApiDocsPanel-yEz0fiof.js +0 -842
  266. package/dist/packem_shared/ApiReferencePanel-1vubqG5s.js +0 -229
  267. package/dist/packem_shared/ApiTab-DdubReQI.js +0 -251
  268. package/dist/packem_shared/AuditPanel-CE5ofjCc.js +0 -200
  269. package/dist/packem_shared/CommandPalette-BtgkBzZI.js +0 -373
  270. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
  271. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
  272. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
  273. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
  274. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
  275. package/dist/packem_shared/DataBrowser-DpL8U-Nf.js +0 -4475
  276. package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
  277. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
  278. package/dist/packem_shared/ExportImportPanel-ChsSUCYZ.js +0 -197
  279. package/dist/packem_shared/FileBrowser-DsRBnVhZ.js +0 -2932
  280. package/dist/packem_shared/FunctionRunner-D4cZ6fuA.js +0 -343
  281. package/dist/packem_shared/FunctionStatsPanel-BVelWgNv.js +0 -375
  282. package/dist/packem_shared/GlobalDataBrowser-3X9uRfdO.js +0 -289
  283. package/dist/packem_shared/HealthPanel-CxUVKfvo.js +0 -648
  284. package/dist/packem_shared/HomePanel-tfqpZxuu.js +0 -1334
  285. package/dist/packem_shared/InsightsPanel-DNg3K9XN.js +0 -461
  286. package/dist/packem_shared/LogsPanel-B4LoSRj0.js +0 -827
  287. package/dist/packem_shared/MailPanel-CcpdyWYs.js +0 -440
  288. package/dist/packem_shared/MetricsPanel-CxoyWbNb.js +0 -1611
  289. package/dist/packem_shared/MigrationsPanel-DGwJGWDA.js +0 -239
  290. package/dist/packem_shared/OpenRpcReferencePanel-vbcYbv3V.js +0 -191
  291. package/dist/packem_shared/PitrPanel-CKUzyyHi.js +0 -252
  292. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
  293. package/dist/packem_shared/ScheduledJobs-BWNwIN3I.js +0 -262
  294. package/dist/packem_shared/SchemaViewer-RclXFo9Q.js +0 -2512
  295. package/dist/packem_shared/SecurityAdvisorPanel-Dqql1Z5O.js +0 -92
  296. package/dist/packem_shared/SettingsPanel-D5iTY0YE.js +0 -390
  297. package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
  298. package/dist/packem_shared/SqlEditorPanel-Dj-In-B3.js +0 -13
  299. package/dist/packem_shared/Studio-VWvKNOw4.js +0 -33
  300. package/dist/packem_shared/StudioApp-BhQ6T2pn.js +0 -657
  301. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
  302. package/dist/packem_shared/TableEditor-BY8bTpCl.js +0 -11
  303. package/dist/packem_shared/advisor-view-CGcfMiPq.js +0 -159
  304. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
  305. package/dist/packem_shared/app.d-BVJFkXyj.d.ts +0 -300
  306. package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
  307. package/dist/packem_shared/bar-chart-CzJAgqkp.js +0 -3245
  308. package/dist/packem_shared/button-BhsN2uZH.js +0 -49
  309. package/dist/packem_shared/card-DURq3ElK.js +0 -175
  310. package/dist/packem_shared/cf-links-2cktDedA.js +0 -8
  311. package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
  312. package/dist/packem_shared/data-grid-B5CaV3wS.js +0 -183
  313. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
  314. package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
  315. package/dist/packem_shared/grid-features-CzUfqgsM.js +0 -840
  316. package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
  317. package/dist/packem_shared/internal-rXJEAhXS.js +0 -68
  318. package/dist/packem_shared/label-D8ykjn5J.js +0 -46
  319. package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
  320. package/dist/packem_shared/reference-view-B4E49Lip.js +0 -2180
  321. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  322. package/dist/packem_shared/sparkline-10dG-_f0.js +0 -93
  323. package/dist/packem_shared/sql-editor-panel-CMdxstu5.js +0 -2562
  324. package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
  325. package/dist/packem_shared/studio-D8ry3tJR.js +0 -11043
  326. package/dist/packem_shared/table-_RzNvy3R.js +0 -246
  327. package/dist/packem_shared/table-editor-CWx68ZCg.js +0 -407
  328. package/dist/packem_shared/table-list-sidebar-Bg7uzbvC.js +0 -832
  329. package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
  330. package/dist/packem_shared/use-admin-query-BkbdNFNz.js +0 -105
  331. package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
  332. package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
  333. package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
@@ -0,0 +1,8 @@
1
+ import{a as nt,b as rt}from"./chunk-Z7WIE3QU.js";import{c as tt}from"./chunk-INWAISDG.js";import{a as et}from"./chunk-RCDHVEJZ.js";import"./chunk-TJRQUJFS.js";import"./chunk-TWTNWOJU.js";import"./chunk-WQYWA7U6.js";import"./chunk-XZMOZFE6.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import{a as Ze}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-JAKYTDUH.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import"./chunk-SU737V7V.js";import{a as Xe}from"./chunk-IABM4BFJ.js";import{b as Ve}from"./chunk-OGUKYRFM.js";import{c as Ke,d as qe,e as Ee,f as _e,g as Pe}from"./chunk-OKG3HWSJ.js";import{P as Ye}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{a as Je}from"./chunk-ULIQFBZU.js";import{a as Ne}from"./chunk-4ZEL6BYL.js";import"./chunk-T6S2F46N.js";import{f as Le}from"./chunk-MZDJBR3M.js";import"./chunk-FSRSK4LY.js";import"./chunk-2LN3T5HY.js";import"./chunk-HEAQVSNS.js";import{d as ce,f as we,g as ke,h as Ge,o as ue}from"./chunk-FODLDLE2.js";import{a as l,d as We,e as wt,f as kt,g as Nt,i as me}from"./chunk-YKXDMIHQ.js";var G=We(kt(),1);var z=We(wt(),1);var d=We(Nt(),1);var qt="x",ot=" ",Ct={'"':'"',"'":"'","[":"]","`":"`"},ct=l((s,e)=>{let n=e+2;for(;n<s.length&&s[n]!==`
2
+ `;)n+=1;return n},"tt"),dt=l((s,e)=>{let n=s.indexOf("*/",e+2);return n===-1?-1:n+2},"nt"),ut=l(s=>{let e=s.split(""),n=0;for(;n<s.length;){let t=s[n]??"",o=Ct[t];if(t==="-"&&s[n+1]==="-"){let r=ct(s,n);e.fill(ot,n,r),n=r}else if(t==="/"&&s[n+1]==="*"){let r=dt(s,n);if(r===-1)return;e.fill(ot,n,r),n=r}else if(o!==void 0){let r=n+1;for(;r<s.length;)if(s[r]!==o)r+=1;else if(o!=="]"&&s[r+1]===o)r+=2;else break;if(r>=s.length)return;e.fill(qt,n,r+1),n=r+1}else n+=1}for(let t=0;t<s.length;t+=1)s[t]===`
3
+ `&&(e[t]=`
4
+ `);return e.join("")},"st"),Tt=/^(?:explain\s+(?:query\s+plan\s+)?)?(?:select|with)\b/iu,It=/\b(?:alter|attach|create|delete|detach|drop|insert|pragma|reindex|replace|truncate|update|vacuum)\b/iu,Rt=/^\w+/u,Lt=/;\s*$/u,Et=/\s/u,mt=l(s=>{let e=0;for(;e<s.length;){let n=s[e];if(n!==void 0&&Et.test(n))e+=1;else if(n==="-"&&s[e+1]==="-")e=ct(s,e);else if(n==="/"&&s[e+1]==="*"){let t=dt(s,e);if(t===-1)break;e=t}else break}return e},"ot"),_t=l(s=>{let e=mt(s),n=s.slice(e).trimEnd();if(n==="")return{code:"SQL_EMPTY",message:"the query is empty"};let t=(ut(n)??n).replace(Lt,""),o=n.slice(0,t.length),r=t.indexOf(";");if(r!==-1)return{code:"SQL_MULTIPLE_STATEMENTS",length:1,message:"only a single statement may be run",offset:e+r};let a="the SQL editor is read-only \u2014 only SELECT / WITH / EXPLAIN queries are allowed";if(!Tt.test(o))return{code:"SQL_NOT_READONLY",length:Rt.exec(o)?.[0].length??1,message:a,offset:e};let c=It.exec(o);if(c!==null)return{code:"SQL_NOT_READONLY",length:c[0].length,message:`${a} (\`${c[0].toUpperCase()}\` is not allowed)`,offset:e+c.index}},"Ot"),Ot=/^explain\b/iu,Dt=l(s=>Ot.test(s.slice(mt(s)))?s:`EXPLAIN QUERY PLAN ${s}`,"Mt"),Qe=l((s,e)=>{let n=s.trim();if(n==="")return[];let t=e+s.indexOf(n),o=_t(n);return o?.code==="SQL_EMPTY"?[]:[o===void 0?{offset:t,sql:n}:{offset:t,rejection:o,sql:n}]},"Fe"),ft=l(s=>{let e=ut(s);if(e===void 0)return Qe(s,0);let n=[],t=0;for(let o=0;o<=e.length;o+=1)o!==e.length&&e[o]!==";"||(n.push(...Qe(s.slice(t,o),t)),t=o+1);return n},"lt"),Mt=["ORDER BY","GROUP BY","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN","EXPLAIN QUERY PLAN","SELECT","DISTINCT","FROM","WHERE","HAVING","LIMIT","OFFSET","JOIN","ON","AND","OR","AS","ASC","DESC","WITH","UNION","EXPLAIN"],At=["FROM","WHERE","ORDER BY","GROUP BY","HAVING","LIMIT","OFFSET","UNION","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","CROSS JOIN"],Me=String.fromCodePoint(0),$t=new RegExp(`${Me}${String.raw`(\d+)`}${Me}`,"gu"),Bt=Mt.map(s=>({pattern:new RegExp(String.raw`\b${s.replaceAll(" ",String.raw`\s+`)}\b`,"giu"),replacement:s})),Ht=At.map(s=>({pattern:new RegExp(String.raw`\s+${s.replaceAll(" ",String.raw`\s+`)}\b`,"gu"),replacement:`
5
+ ${s}`})),Wt=l(s=>{let e=[],n=s.replaceAll(/'(?:[^']|'')*'/gu,t=>(e.push(t),`${Me}${(e.length-1).toString()}${Me}`)).replaceAll(/\s+/gu," ").trim();for(let{pattern:t,replacement:o}of Bt)n=n.replaceAll(t,o);for(let{pattern:t,replacement:o}of Ht)n=n.replaceAll(t,o);return n=n.replaceAll($t,(t,o)=>e[Number(o)]??""),n},"Ft"),Pt=/\b(?:from|join)\s+([a-z_][\w$]*)(?:\s+(?:as\s+)?([a-z_][\w$]*))?/giu,jt=/(?:\bwith\s+(?:recursive\s+)?|,\s*)([a-z_][\w$]*)\s+as\s*\(/giu,Qt=new Set(["cross","full","group","having","inner","join","left","limit","offset","on","order","right","union","using","where","window"]),Ft=/[^\n]/gu,zt=l((s,e)=>{let n=s[e];if(n==="'"){let t=e+1;for(;t<s.length&&s[t]!=="'";)t+=1;return Math.min(t+1,s.length)}if(n==="-"&&s[e+1]==="-"){let t=s.indexOf(`
6
+ `,e);return t===-1?s.length:t}if(n==="/"&&s[e+1]==="*"){let t=s.indexOf("*/",e+2);return t===-1?s.length:t+2}return-1},"Yt"),Ut=l(s=>{let e="",n=0;for(;n<s.length;){let t=zt(s,n);t===-1?(e+=s.slice(n,n+1),n+=1):(e+=s.slice(n,t).replaceAll(Ft," "),n=t)}return e},"Kt"),Yt=l(s=>{let e=new Set;for(let n of s.matchAll(jt))e.add((n[1]??"").toLowerCase());return e},"Gt"),Gt=l((s,e)=>{let n=new Map;for(let t of s.matchAll(Pt)){let o=(t[1]??"").toLowerCase(),r=(t[2]??"").toLowerCase();e.has(o)&&(n.set(o,o),r!==""&&!Qt.has(r)&&n.set(r,o))}return n},"Jt"),ht=l((s,e)=>{let n=Ut(s),t=new Set(e.map(o=>o.toLowerCase()));return{ctes:Yt(n),masked:n,targets:Gt(n,t)}},"rt"),Kt=/^(?:__lunora|sqlite_)/iu,Vt=/\b(?:from|join)\s+([a-z_][\w$]*)/giu,Xt=/\b([a-z_][\w$]*)\.([a-z_][\w$]*)/giu,Jt=new Set(["cross","full","group","having","inner","join","lateral","left","limit","offset","order","right","select","union","where","window"]),Zt=l((s,e,n)=>{let t=[];for(let o of s.matchAll(Vt)){let r=o[1]??"",a=r.toLowerCase();!e.has(a)&&!n.has(a)&&!Jt.has(a)&&!Kt.test(r)&&t.push({length:r.length,message:`unknown table \`${r}\``,offset:o.index+o[0].length-r.length,severity:"error",source:"schema"})}return t},"tn"),en=l((s,e,n)=>{let t=[],o=new Map;for(let[r,a]of Object.entries(e.columns))o.set(r.toLowerCase(),new Set(a.map(c=>c.toLowerCase())));for(let r of s.matchAll(Xt)){let a=(r[1]??"").toLowerCase(),c=r[2]??"",i=n.get(a),u=i===void 0?void 0:o.get(i);u!==void 0&&!u.has(c.toLowerCase())&&t.push({length:c.length,message:`\`${i??""}\` has no column \`${c}\``,offset:r.index+r[0].length-c.length,severity:"error",source:"schema"})}return t},"nn"),tn=l((s,e)=>{if(s.trim()==="")return[];let n=ft(s),t=new Set(e.tables.map(r=>r.toLowerCase())),o=[];for(let r of n){let{offset:a,rejection:c}=r;if(c!==void 0){o.push({length:c.length,message:c.message,offset:c.offset===void 0?a:a+c.offset,severity:"error",source:"gate"});continue}let{ctes:i,masked:u,targets:p}=ht(r.sql,e.tables);o.push(...[...Zt(u,t,i),...en(u,e,p)].map(h=>({...h,offset:h.offset===void 0?a:a+h.offset})))}return o},"sn"),nn=we(Ne.lintSql),rn=600,on=l((s,e,n)=>{let t=Le(),[o,r]=(0,z.useState)([]),a=(0,z.useMemo)(()=>tn(s,e),[s,e]),c=Ze(s,rn),i=a.some(h=>h.source==="gate")||c.trim()==="",u=(0,z.useCallback)(async h=>{try{let g=await t.query(nn,{sql:c},ke(n));h.cancelled||r(g.diagnostics??[])}catch{h.cancelled||r([])}},[t,c,n]);(0,z.useEffect)(()=>{if(i){r([]);return}let h={cancelled:!1};return ue(u(h)),()=>{h.cancelled=!0}},[u,i]);let p=c===s;return(0,z.useMemo)(()=>p?[...a,...o]:a,[a,o,p])},"rn"),Oe=8,sn=["AND","ASC","AS","BY","COUNT","DESC","DISTINCT","EXPLAIN","FROM","GROUP","HAVING","INNER","JOIN","LEFT","LIKE","LIMIT","NOT","NULL","OFFSET","ON","ORDER","OR","QUERY","SELECT","WHERE","WITH"],ln=new Set(["AND","BY","HAVING","ON","OR","SELECT","WHERE"]),an=/[\w$]/,pt=l(s=>s!==void 0&&an.test(s),"it"),bt=l(s=>{let e=s.length;for(;e>0&&pt(s[e-1]);)e-=1;return s.slice(e)},"at"),gt=l((s,e)=>{let n=e;for(;n>0&&pt(s[n-1]);)n-=1;return{end:e,start:n,text:s.slice(n,e)}},"ct"),st=l((s,e)=>{let n=s.slice(0,e).trimEnd();return n.endsWith(".")||ln.has(bt(n).toUpperCase())},"Je"),cn=l((s,e,n)=>{let t=s.slice(0,e);if(!t.endsWith("."))return;let o=bt(t.slice(0,-1));if(o!=="")return ht(s,n).targets.get(o.toLowerCase())??o},"un"),Fe=l((s,e)=>s.toLowerCase().startsWith(e.toLowerCase()),"je"),lt=l((s,e,n,t)=>{let o=[];for(let r of s)if(Fe(r,e)&&(o.push(t(r)),o.length>=n))break;return o},"Ve"),dn=l((s,e,n)=>{let t=new Map;for(let[o,r]of Object.entries(s.columns))for(let a of r)if(Fe(a,e)&&!t.has(a)&&(t.set(a,o),t.size>=n))return[...t].map(([c,i])=>({detail:i,kind:"column",label:c}));return[...t].map(([o,r])=>({detail:r,kind:"column",label:o}))},"fn"),un=l((s,e,n)=>{let t=gt(s,e),o=cn(s,t.start,n.tables);if(o!==void 0){let i=n.columns[o]??n.columns[o.toLowerCase()]??[];return lt(i,t.text,Oe,u=>({detail:o,kind:"column",label:u}))}if(t.text===""&&!st(s,t.start))return[];let r=lt(n.tables,t.text,Oe,i=>({kind:"table",label:i})),a=dn(n,t.text,Oe),c=sn.flatMap(i=>t.text!==""&&Fe(i,t.text)&&i.toLowerCase()!==t.text.toLowerCase()?[{kind:"keyword",label:i}]:[]);return(st(s,t.start)?[...a,...r,...c]:[...r,...a,...c]).slice(0,Oe)},"mn"),mn=l((s,e,n)=>{let t=gt(s,e),o=s.slice(0,t.start)+n.label+s.slice(t.end);return{caret:t.start+n.label.length,value:o}},"hn"),fn=["boxSizing","borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textTransform","width","wordSpacing"],hn=l((s,e)=>{let n=globalThis.getComputedStyle(s),t=globalThis.document.createElement("div"),{style:o}=t;o.position="absolute",o.visibility="hidden",o.whiteSpace="pre-wrap",o.overflowWrap="break-word";for(let i of fn)o[i]=n[i];t.textContent=s.value.slice(0,Math.max(0,e));let r=globalThis.document.createElement("span");r.textContent=s.value.slice(Math.max(0,e))||".",t.append(r),globalThis.document.body.append(t);let a=r.offsetLeft-s.scrollLeft,c=r.offsetTop-s.scrollTop;return t.remove(),{left:a,top:c}},"bn"),pn=l((s,e,n)=>{let t=(0,G.c)(16),[o,r]=(0,z.useState)(null),a;t[0]!==s||t[1]!==e?(a=l((v,b)=>{let k=un(v,b,s);if(k.length===0){r(null);return}let S=e.current,{left:x,top:q}=S===null?{left:0,top:0}:hn(S,b);r(C=>C!==null&&C.active===0&&C.left===x&&C.top===q&&C.suggestions.length===k.length&&C.suggestions.every((R,T)=>{let _=k.at(T);return R.kind===_?.kind&&R.label===_.label&&R.detail===_.detail})?C:{active:0,left:x,suggestions:k,top:q})},"r"),t[0]=s,t[1]=e,t[2]=a):a=t[2];let c=a,i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=l(()=>{r(null)},"c"),t[3]=i):i=t[3];let u=i,p;t[4]===Symbol.for("react.memo_cache_sentinel")?(p=l(v=>{r(b=>{if(b===null)return b;let k=b.suggestions.length,S=(b.active+v+k)%k;return{...b,active:S}})},"m"),t[4]=p):p=t[4];let h=p,g;t[5]!==n||t[6]!==o||t[7]!==e?(g=l(v=>{let b=e.current;if(o===null||b===null)return!1;let k=o.suggestions[v??o.active];if(k===void 0)return!1;let S=mn(b.value,b.selectionStart,k);return n(S.value),r(null),requestAnimationFrame(()=>{let x=e.current;x!==null&&(x.focus(),x.setSelectionRange(S.caret,S.caret))}),!0},"f"),t[5]=n,t[6]=o,t[7]=e,t[8]=g):g=t[8];let y=g,m;t[9]!==y?(m=l(()=>y(),"d"),t[9]=y,t[10]=m):m=t[10];let w=m,f;return t[11]!==w||t[12]!==y||t[13]!==c||t[14]!==o?(f={close:u,commit:w,commitAt:y,move:h,refresh:c,state:o},t[11]=w,t[12]=y,t[13]=c,t[14]=o,t[15]=f):f=t[15],f},"gn"),bn={column:"column",keyword:"keyword",table:"table"},gn=20,xn=l(s=>{let e=(0,G.c)(17),{listboxId:n,onPick:t,state:o}=s,r=ce(),a;e[0]!==o?(a=o===null?void 0:{left:o.left,top:o.top+gn},e[0]=o,e[1]=a):a=e[1];let c=a;if(o===null)return null;let i;if(e[2]!==n||e[3]!==t||e[4]!==o.active||e[5]!==o.suggestions||e[6]!==r){let p;e[8]!==n||e[9]!==t||e[10]!==o.active||e[11]!==r?(p=l((h,g)=>(0,d.jsxs)("li",{"aria-selected":g===o.active,className:me("flex cursor-pointer items-center gap-2 px-2 py-1 text-[13px]",g===o.active?"bg-accent text-accent-foreground":"text-foreground"),"data-testid":"sql-autocomplete-item",id:`${n}-opt-${g.toString()}`,onMouseDown:l(y=>{y.preventDefault(),t(g)},"onMouseDown"),role:"option",children:[(0,d.jsx)("span",{className:"truncate font-mono",children:h.label}),h.detail!==void 0&&(0,d.jsx)("span",{className:"ms-auto truncate text-xs text-muted-foreground",children:h.detail}),(0,d.jsx)("span",{className:"shrink-0 font-mono text-[10px] tracking-wide text-muted-foreground/70 uppercase",children:r(bn[h.kind])})]},`${h.kind}:${h.label}`),"m"),e[8]=n,e[9]=t,e[10]=o.active,e[11]=r,e[12]=p):p=e[12],i=o.suggestions.map(p),e[2]=n,e[3]=t,e[4]=o.active,e[5]=o.suggestions,e[6]=r,e[7]=i}else i=e[7];let u;return e[13]!==n||e[14]!==c||e[15]!==i?(u=(0,d.jsx)("ul",{className:"absolute z-30 max-h-56 w-72 overflow-auto rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-autocomplete",id:n,role:"listbox",style:c,children:i}),e[13]=n,e[14]=c,e[15]=i,e[16]=u):u=e[16],u},"yn"),vn=we(Ne.listTables),yn=we(Ne.readTablePage),Sn=l(s=>{let e=(0,G.c)(16),n=Le(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];let[o,r]=(0,z.useState)(t),a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={},e[1]=a):a=e[1];let[c,i]=(0,z.useState)(a),u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=new Set,e[2]=u):u=e[2];let p=(0,z.useRef)(u),h,g;e[3]!==n||e[4]!==s?(h=l(()=>{let b={cancelled:!1};return ue((async()=>{try{let k=await n.query(vn,{},ke(s));b.cancelled||(r(k.map(kn)),i({}),p.current=new Set)}catch{b.cancelled||(r([]),i({}),p.current=new Set)}})()),()=>{b.cancelled=!0}},"g"),g=[n,s],e[3]=n,e[4]=s,e[5]=h,e[6]=g):(h=e[5],g=e[6]),(0,z.useEffect)(h,g);let y;e[7]!==n||e[8]!==s?(y=l(b=>{p.current.has(b)||(p.current.add(b),ue((async()=>{try{let k=await n.query(yn,{limit:1,offset:0,table:b},ke(s));i(S=>({...S,[b]:k.columns}))}catch{p.current.delete(b)}})()))},"v"),e[7]=n,e[8]=s,e[9]=y):y=e[9];let m=y,w;e[10]!==c||e[11]!==o?(w={columns:c,tables:o},e[10]=c,e[11]=o,e[12]=w):w=e[12];let f=w,v;return e[13]!==m||e[14]!==f?(v={probe:m,schema:f},e[13]=m,e[14]=f,e[15]=v):v=e[15],v},"Cn"),je=/\b(?:from|join|update|into)\s+([a-z_][\w$]*)|\b([a-z_][\w$]*)\s*\./gi,wn=l(s=>{let e=new Set;je.lastIndex=0;let n=je.exec(s);for(;n!==null;)e.add(n[1]??n[2]),n=je.exec(s);return[...e]},"Nn");function kn(s){return s.name}l(kn,"kn");var Nn=l(s=>{let e=(0,G.c)(34),{onSubmit:n,probe:t,schema:o,setDraft:r}=s,a=(0,z.useId)(),c=(0,z.useRef)(null),i=(0,z.useRef)(null),u=(0,z.useRef)(null),p=pn(o,u,r),{close:h,commit:g,commitAt:y,move:m,refresh:w,state:f}=p,v;e[0]!==y?(v=l(N=>{y(N)},"x"),e[0]=y,e[1]=v):v=e[1];let b=v,k;e[2]!==w?(k=l(()=>{let N=u.current;N!==null&&N===document.activeElement&&w(N.value,N.selectionStart)},"C"),e[2]=w,e[3]=k):k=e[3];let S;e[4]!==w||e[5]!==o?(S=[w,o],e[4]=w,e[5]=o,e[6]=S):S=e[6],(0,z.useEffect)(k,S);let x;e[7]!==t||e[8]!==w||e[9]!==r?(x=l(N=>{let{selectionStart:j,value:I}=N.target;r(I);for(let $ of wn(I))t($);w(I,j)},"p"),e[7]=t,e[8]=w,e[9]=r,e[10]=x):x=e[10];let q=x,C;e[11]!==w?(C=l(N=>{let j=N.currentTarget;w(j.value,j.selectionStart)},"N"),e[11]=w,e[12]=C):C=e[12];let R=C,T;e[13]!==f||e[14]!==h||e[15]!==g||e[16]!==m||e[17]!==n?(T=l(N=>{if(f!==null){if(N.key==="ArrowDown"){N.preventDefault(),m(1);return}if(N.key==="ArrowUp"){N.preventDefault(),m(-1);return}if(N.key==="Escape"){N.preventDefault(),h();return}if((N.key==="Enter"||N.key==="Tab")&&!N.metaKey&&!N.ctrlKey&&g()){N.preventDefault();return}}(N.metaKey||N.ctrlKey)&&N.key==="Enter"&&(N.preventDefault(),n())},"T"),e[13]=f,e[14]=h,e[15]=g,e[16]=m,e[17]=n,e[18]=T):T=e[18];let _=T,L;e[19]!==h?(L=l(()=>{requestAnimationFrame(()=>{h()})},"E"),e[19]=h,e[20]=L):L=e[20];let O=L,D;e[21]===Symbol.for("react.memo_cache_sentinel")?(D=l(N=>{let{scrollLeft:j,scrollTop:I}=N.currentTarget;c.current!==null&&(c.current.scrollTop=I),i.current!==null&&(i.current.scrollTop=I,i.current.scrollLeft=j)},"_"),e[21]=D):D=e[21];let E=D,B;e[22]===Symbol.for("react.memo_cache_sentinel")?(B=l(N=>{let j=u.current;j===null||N.offset===void 0||(j.focus(),j.setSelectionRange(N.offset,N.offset+(N.length??0)))},"B"),e[22]=B):B=e[22];let A=B,P;e[23]!==q||e[24]!==O||e[25]!==_||e[26]!==R?(P={onBlur:O,onChange:q,onKeyDown:_,onScroll:E,onSelect:R},e[23]=q,e[24]=O,e[25]=_,e[26]=R,e[27]=P):P=e[27];let M;return e[28]!==f||e[29]!==h||e[30]!==a||e[31]!==b||e[32]!==P?(M={autocompleteState:f,closeAutocomplete:h,handlers:P,listboxId:a,onPickSuggestion:b,editorRef:u,gutterRef:c,overlayRef:i,revealDiagnostic:A},e[28]=f,e[29]=h,e[30]=a,e[31]=b,e[32]=P,e[33]=M):M=e[33],M},"En"),qn="lunora-studio-sql-tabs",Cn="lunora-studio-sql-active-tab",ze=12,Ce=l((s="",e="")=>({activeId:null,id:Pe("tab"),name:e,sql:s}),"we"),Tn=l(()=>_e(Cn,""),"Ln"),In=l(s=>{let e=(0,G.c)(16),[n,t]=Ee(qn),[o,r]=Tn(),[a]=(0,z.useState)(s),c,i;e[0]!==a||e[1]!==t||e[2]!==n.length?(c=l(()=>{n.length===0&&t([a])},"i"),i=[a,t,n.length],e[0]=a,e[1]=t,e[2]=n.length,e[3]=c,e[4]=i):(c=e[3],i=e[4]),(0,z.useEffect)(c,i);let u;e[5]!==a||e[6]!==n?(u=n.length===0?[a]:n,e[5]=a,e[6]=n,e[7]=u):u=e[7];let p=u,h;e[8]!==o||e[9]!==p?(h=p.some(m=>m.id===o)?o:p[0]?.id??"",e[8]=o,e[9]=p,e[10]=h):h=e[10];let g=h,y;return e[11]!==g||e[12]!==r||e[13]!==t||e[14]!==p?(y={activeId:g,setActiveId:r,setTabs:t,tabs:p},e[11]=g,e[12]=r,e[13]=t,e[14]=p,e[15]=y):y=e[15],y},"In"),xt=l(s=>s.activeId===null&&s.sql.trim()!=="","dt"),Rn=l((s,e)=>[...s,e].slice(-ze),"qn"),Ln=l((s,e,n)=>{let t=s.findIndex(r=>r.id===e);if(t===-1)return{activeId:s[0]?.id??"",tabs:[...s]};let o=s.filter(r=>r.id!==e);if(o.length===0){let r=n();return{activeId:r.id,tabs:[r]}}return{activeId:o[Math.min(t,o.length-1)].id,tabs:o}},"An"),En=l((s,e)=>{let n=s.filter(t=>t.id===e);return n.length===0?{activeId:s[0]?.id??"",tabs:[...s]}:{activeId:e,tabs:n}},"_n"),_n=l((s,e,n)=>{let t=s.findIndex(r=>r.id===e);if(t===-1)return{activeId:n,tabs:[...s]};let o=s.slice(0,t+1);return{activeId:o.some(r=>r.id===n)?n:e,tabs:o}},"On"),On=l(s=>{let e=s();return{activeId:e.id,tabs:[e]}},"Dn"),Dn=l((s,e,n)=>{if(s==="others")return e.filter(t=>t.id!==n);if(s==="right"){let t=e.findIndex(o=>o.id===n);return t===-1?[]:e.slice(t+1)}return[...e]},"Mn"),at={error:null,pane:"results",result:null,running:!1},Mn=l(s=>{let e=(0,G.c)(66),{activeId:n,setActiveId:t,setTabs:o,tabs:r}=In(s),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let[c,i]=(0,z.useState)(a),[u,p]=(0,z.useState)(null),[h,g]=(0,z.useState)(null),y;e[1]!==n||e[2]!==r?(y=r.find(W=>W.id===n)??r[0]??Ce(),e[1]=n,e[2]=r,e[3]=y):y=e[3];let m=y,w=c[m.id]??at,f;e[4]!==m.id||e[5]!==o?(f=l(W=>{o(U=>U.map(Y=>Y.id===m.id?{...Y,...W}:Y))},"u"),e[4]=m.id,e[5]=o,e[6]=f):f=e[6];let v=f,b;e[7]!==m.id?(b=l(W=>{i(U=>{let Y=U[m.id]??at;return{...U,[m.id]:{...Y,...W}}})},"h"),e[7]=m.id,e[8]=b):b=e[8];let k=b,S;e[9]!==t||e[10]!==o||e[11]!==r.length?(S=l(()=>{if(r.length>=ze)return;let W=Ce();o(U=>Rn(U,W)),t(W.id)},"y"),e[9]=t,e[10]=o,e[11]=r.length,e[12]=S):S=e[12];let x=S,q;e[13]!==t||e[14]!==o?(q=l(W=>{p(null),g(null),o(W.tabs),t(W.activeId);let U=new Set(W.tabs.map(An));i(Y=>Object.fromEntries(Object.entries(Y).filter(X=>{let[fe]=X;return U.has(fe)})))},"k"),e[13]=t,e[14]=o,e[15]=q):q=e[15];let C=q,R;e[16]!==C||e[17]!==r?(R=l(W=>{C(Ln(r,W,Ce))},"L"),e[16]=C,e[17]=r,e[18]=R):R=e[18];let T=R,_;e[19]!==n||e[20]!==C||e[21]!==r?(_=l((W,U)=>{C(W==="others"?En(r,U):W==="right"?_n(r,U,n):On(Ce))},"q"),e[19]=n,e[20]=C,e[21]=r,e[22]=_):_=e[22];let L=_,O;e[23]!==L||e[24]!==u||e[25]!==r?(O=l(W=>{u!==null&&(Dn(W,r,u.id).some($n)?g(W):L(W,u.id))},"A"),e[23]=L,e[24]=u,e[25]=r,e[26]=O):O=e[26];let D=O,E;e[27]===Symbol.for("react.memo_cache_sentinel")?(E=l((W,U)=>{U.preventDefault(),g(null),p({id:W,x:U.clientX,y:U.clientY})},"I"),e[27]=E):E=e[27];let B=E,A;e[28]===Symbol.for("react.memo_cache_sentinel")?(A=l(()=>{p(null),g(null)},"D"),e[28]=A):A=e[28];let P=A,M;e[29]===Symbol.for("react.memo_cache_sentinel")?(M=l(W=>{W.preventDefault(),p(null),g(null)},"O"),e[29]=M):M=e[29];let N=M,j;e[30]!==D?(j=l(()=>{D("others")},"W"),e[30]=D,e[31]=j):j=e[31];let I=j,$;e[32]!==D?($=l(()=>{D("right")},"M"),e[32]=D,e[33]=$):$=e[33];let F=$,H;e[34]!==D?(H=l(()=>{D("all")},"$"),e[34]=D,e[35]=H):H=e[35];let J=H,Z;e[36]!==L||e[37]!==h||e[38]!==u?(Z=l(()=>{u!==null&&h!==null&&L(h,u.id),g(null)},"Z"),e[36]=L,e[37]=h,e[38]=u,e[39]=Z):Z=e[39];let ee=Z,te;e[40]===Symbol.for("react.memo_cache_sentinel")?(te=l(()=>{g(null)},"te"),e[40]=te):te=e[40];let ie=te,V;e[41]!==u?(V=u===null?void 0:{left:u.x,top:u.y},e[41]=u,e[42]=V):V=e[42];let Q=V,ne;e[43]!==o?(ne=l(W=>{o(U=>U.map(Y=>Y.activeId===W?{...Y,activeId:null}:Y))},"ne"),e[43]=o,e[44]=ne):ne=e[44];let re=ne,oe;e[45]!==o?(oe=l((W,U)=>{o(Y=>Y.map(X=>X.id===W?{...X,name:U}:X))},"oe"),e[45]=o,e[46]=oe):oe=e[46];let se=oe,le;return e[47]!==m||e[48]!==n||e[49]!==x||e[50]!==T||e[51]!==ee||e[52]!==J||e[53]!==I||e[54]!==F||e[55]!==w||e[56]!==k||e[57]!==v||e[58]!==h||e[59]!==se||e[60]!==t||e[61]!==u||e[62]!==Q||e[63]!==r||e[64]!==re?(le={activeTab:m,activeTabId:n,addEditorTab:x,cancelBulk:ie,closeEditorTab:T,closeTabMenu:P,confirmBulk:ee,menuStyle:Q,onBackdropContextMenu:N,onCloseAll:J,onCloseOthers:I,onCloseToRight:F,openTabMenu:B,output:w,patchActiveOutput:k,patchActiveTab:v,pendingBulk:h,renameTab:se,setActiveTabId:t,tabMenu:u,tabs:r,unlinkQuery:re},e[47]=m,e[48]=n,e[49]=x,e[50]=T,e[51]=ee,e[52]=J,e[53]=I,e[54]=F,e[55]=w,e[56]=k,e[57]=v,e[58]=h,e[59]=se,e[60]=t,e[61]=u,e[62]=Q,e[63]=r,e[64]=re,e[65]=le):le=e[65],le},"$n");function An(s){return s.id}l(An,"Bn");function $n(s){return xt(s)}l($n,"Hn");var Bn="lunora-studio-sql-queries",Se="lunora-studio-sql-history",Hn="lunora-studio-sql-remember-history",Wn=25,Pn=l(s=>{let e=(0,G.c)(41),{loadIntoActiveTab:n,unlinkQuery:t}=s,o=ce(),[r,a]=Ee(Bn),[c,i]=_e(Hn,!1),[u,p]=Ee(Se,c?"local":"session"),h,g;e[0]!==c?(h=l(()=>{c||qe(Se,"local")},"g"),g=[c],e[0]=c,e[1]=h,e[2]=g):(h=e[1],g=e[2]),(0,z.useEffect)(h,g);let[y,m]=(0,z.useState)(""),w=(0,z.useRef)(null),f;e[3]!==p?(f=l(I=>{p($=>$[0]?.sql===I?$:[{at:Date.now(),sql:I},...$.filter(F=>F.sql!==I)].slice(0,Wn))},"u"),e[3]=p,e[4]=f):f=e[4];let v=f,b;e[5]!==n||e[6]!==a||e[7]!==o?(b=l(()=>{let I={id:Pe("q"),name:o("Untitled query"),sql:""};a($=>[I,...$]),n("",I.id)},"h"),e[5]=n,e[6]=a,e[7]=o,e[8]=b):b=e[8];let k=b,S;e[9]!==n||e[10]!==r?(S=l(I=>{let $=r.find(F=>F.id===I);$!==void 0&&(n($.sql,I),w.current?.querySelector(`[data-testid="sql-query-${I}"]`)?.scrollIntoView({block:"nearest"}))},"y"),e[9]=n,e[10]=r,e[11]=S):S=e[11];let x=S,q;e[12]!==a||e[13]!==t?(q=l(I=>{a($=>$.filter(F=>F.id!==I)),t(I)},"k"),e[12]=a,e[13]=t,e[14]=q):q=e[14];let C=q,R;e[15]!==n?(R=l(I=>{n(I.currentTarget.dataset.sql??"",null)},"L"),e[15]=n,e[16]=R):R=e[16];let T=R,_;e[17]!==n?(_=l(I=>{n(I.currentTarget.dataset.sql??"",null)},"q"),e[17]=n,e[18]=_):_=e[18];let L=_,O;e[19]!==p?(O=l(()=>{p([]),qe(Se,"local"),qe(Se,"session")},"A"),e[19]=p,e[20]=O):O=e[20];let D=O,E;e[21]!==u||e[22]!==i?(E=l(I=>{Ke(Se,u,I?"local":"session"),I||qe(Se,"local"),i(I)},"I"),e[21]=u,e[22]=i,e[23]=E):E=e[23];let B=E,A;e[24]===Symbol.for("react.memo_cache_sentinel")?(A=l(I=>{m(I.target.value)},"D"),e[24]=A):A=e[24];let P=A,M;e[25]!==a?(M=l((I,$)=>{a(F=>F.map(H=>H.id===I?{...H,sql:$}:H))},"O"),e[25]=a,e[26]=M):M=e[26];let N=M,j;return e[27]!==D||e[28]!==C||e[29]!==u||e[30]!==L||e[31]!==T||e[32]!==k||e[33]!==r||e[34]!==v||e[35]!==c||e[36]!==y||e[37]!==x||e[38]!==B||e[39]!==N?(j={clearHistory:D,deleteQuery:C,history:u,listRef:w,loadFromHistory:L,loadTemplate:T,newQuery:k,onSearchChange:P,queries:r,recordHistory:v,rememberHistory:c,search:y,selectQuery:x,setRememberHistory:B,updateQuerySql:N},e[27]=D,e[28]=C,e[29]=u,e[30]=L,e[31]=T,e[32]=k,e[33]=r,e[34]=v,e[35]=c,e[36]=y,e[37]=x,e[38]=B,e[39]=N,e[40]=j):j=e[40],j},"Qn"),vt="p-3 font-mono text-xs leading-5 whitespace-pre-wrap break-words",jn=l((s,e)=>{let n=[];for(let o of s){if(o.offset===void 0||o.length===void 0||o.length<=0)continue;let r=Math.max(0,Math.min(o.offset,e)),a=Math.max(r,Math.min(o.offset+o.length,e));r!==a&&n.push({end:a,severity:o.severity,start:r})}n.sort((o,r)=>o.start-r.start);let t=[];for(let o of n)o.start>=(t.at(-1)?.end??0)&&t.push(o);return t},"Un"),Qn=l(s=>s==="unsafe-response"?"The model returned a statement that is not read-only, so it was discarded.":s==="empty-response"?"The model returned nothing usable.":"The model could not be reached.","jn"),Fn=l(s=>{let e=(0,G.c)(51),{assistant:n,failed:t,onGenerated:o}=s,r=ce(),[a,c]=(0,z.useState)("");if(n.unavailable)return null;let i;e[0]!==n?(i=n.pending("sql"),e[0]=n,e[1]=i):i=e[1];let u=i,p;if(e[2]!==n||e[3]!==t||e[4]!==o||e[5]!==u||e[6]!==a||e[7]!==r){let h=n.reason("sql"),g;e[9]!==n||e[10]!==t||e[11]!==o||e[12]!==a?(g=l(L=>{let O=a.trim();O===""&&!L||ue((async()=>{let D=await n.generate(O===""?"fix the failing statement":O,L?t:void 0);D!==void 0&&o(D)})())},"f"),e[9]=n,e[10]=t,e[11]=o,e[12]=a,e[13]=g):g=e[13];let y=g,m;e[14]!==r?(m=r("Describe the query you want"),e[14]=r,e[15]=m):m=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=l(L=>{c(L.target.value)},"S"),e[16]=w):w=e[16];let f;e[17]!==y?(f=l(L=>{L.key==="Enter"&&(L.preventDefault(),y(!1))},"u"),e[17]=y,e[18]=f):f=e[18];let v;e[19]!==r?(v=r("Describe the query you want"),e[19]=r,e[20]=v):v=e[20];let b;e[21]!==u||e[22]!==a||e[23]!==m||e[24]!==f||e[25]!==v?(b=(0,d.jsx)(Ye,{"aria-label":m,className:"h-7 flex-1 text-xs","data-testid":"sql-assistant-prompt",disabled:u,onChange:w,onKeyDown:f,placeholder:v,value:a}),e[21]=u,e[22]=a,e[23]=m,e[24]=f,e[25]=v,e[26]=b):b=e[26];let k=u&&"opacity-60",S;e[27]!==k?(S=me("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",k),e[27]=k,e[28]=S):S=e[28];let x;e[29]!==u||e[30]!==a?(x=u||a.trim()==="",e[29]=u,e[30]=a,e[31]=x):x=e[31];let q;e[32]!==y?(q=l(()=>{y(!1)},"k"),e[32]=y,e[33]=q):q=e[33];let C;e[34]!==u||e[35]!==r?(C=r(u?"Thinking\u2026":"Draft SQL"),e[34]=u,e[35]=r,e[36]=C):C=e[36];let R;e[37]!==S||e[38]!==x||e[39]!==q||e[40]!==C?(R=(0,d.jsx)("button",{className:S,"data-testid":"sql-assistant-generate",disabled:x,onClick:q,type:"button",children:C}),e[37]=S,e[38]=x,e[39]=q,e[40]=C,e[41]=R):R=e[41];let T;e[42]!==t||e[43]!==u||e[44]!==y||e[45]!==r?(T=t!==void 0&&(0,d.jsx)("button",{className:"rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-assistant-fix",disabled:u,onClick:l(()=>{y(!0)},"onClick"),type:"button",children:r("Fix this")}),e[42]=t,e[43]=u,e[44]=y,e[45]=r,e[46]=T):T=e[46];let _;e[47]!==R||e[48]!==T||e[49]!==b?(_=(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[b,R,T]}),e[47]=R,e[48]=T,e[49]=b,e[50]=_):_=e[50],p=(0,d.jsxs)("div",{className:"flex flex-col gap-1 border-b border-border px-3 py-2","data-testid":"sql-assistant",children:[_,h!==void 0&&(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"sql-assistant-reason",role:"status",children:Qn(h)})]}),e[2]=n,e[3]=t,e[4]=o,e[5]=u,e[6]=a,e[7]=r,e[8]=p}else p=e[8];return p},"zn"),zn=l(s=>{let e=(0,G.c)(8),{diagnostics:n,draft:t,scrollRef:o}=s,r,a;if(e[0]!==n||e[1]!==t){a=Symbol.for("react.early_return_sentinel");e:{let u=jn(n,t.length);if(u.length===0){a=null;break e}r=[];let p=0;for(let[h,g]of u.entries())g.start>p&&r.push(t.slice(p,g.start)),r.push((0,d.jsx)("span",{className:me("decoration-wavy underline underline-offset-4",g.severity==="error"?"decoration-destructive":"decoration-amber-500"),children:t.slice(g.start,g.end)},`${g.start.toString()}-${h.toString()}`)),p=g.end;r.push(t.slice(p))}e[0]=n,e[1]=t,e[2]=r,e[3]=a}else r=e[2],a=e[3];if(a!==Symbol.for("react.early_return_sentinel"))return a;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=me("pointer-events-none absolute inset-0 overflow-hidden text-transparent",vt),e[4]=c):c=e[4];let i;return e[5]!==r||e[6]!==o?(i=(0,d.jsx)("div",{"aria-hidden":"true",className:c,"data-testid":"sql-diagnostics-overlay",ref:o,children:r}),e[5]=r,e[6]=o,e[7]=i):i=e[7],i},"Yn"),Un={gate:"read-only",plan:"plan",schema:"schema",syntax:"syntax"},Yn=l(s=>{let e=(0,G.c)(10),{diagnostics:n,onSelect:t}=s,o=ce();if(n.length===0)return null;let r;e[0]!==o?(r=o("SQL problems"),e[0]=o,e[1]=r):r=e[1];let a;if(e[2]!==n||e[3]!==t){let i;e[5]!==t?(i=l((u,p)=>(0,d.jsx)("li",{children:(0,d.jsxs)("button",{className:"flex w-full items-start gap-2 px-3 py-1 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-problem",onClick:l(()=>{t(u)},"onClick"),type:"button",children:[(0,d.jsx)("span",{className:me("mt-px shrink-0 rounded px-1 font-mono text-[10px] uppercase",u.severity==="error"?"bg-destructive/15 text-destructive":"bg-amber-500/15 text-amber-600"),children:Un[u.source]}),(0,d.jsx)("span",{className:"min-w-0 text-muted-foreground",children:u.message})]})},`${u.source}-${(u.offset??p).toString()}-${p.toString()}`),"c"),e[5]=t,e[6]=i):i=e[6],a=n.map(i),e[2]=n,e[3]=t,e[4]=a}else a=e[4];let c;return e[7]!==r||e[8]!==a?(c=(0,d.jsx)("ul",{"aria-label":r,className:"max-h-24 shrink-0 overflow-y-auto border-t border-border bg-muted/30","data-testid":"sql-problems",children:a}),e[7]=r,e[8]=a,e[9]=c):c=e[9],c},"Gn"),Gn={minWidth:"2.75rem",paddingInline:"0.5rem"},Kn=l(s=>{let e=(0,G.c)(64),{assistant:n,autocomplete:t,diagnostics:o,draft:r,failed:a,handlers:c,editorRef:i,gutterRef:u,listboxId:p,onGenerated:h,onPickSuggestion:g,onRevealDiagnostic:y,overlayRef:m}=s,w=ce(),f,v,b,k,S,x,q,C;if(e[0]!==n||e[1]!==r||e[2]!==a||e[3]!==u||e[4]!==h){let j=r.split(`
7
+ `).length;q="flex min-h-0 min-w-0 flex-1 flex-col",e[13]!==n||e[14]!==a||e[15]!==h?(C=(0,d.jsx)(Fn,{assistant:n,failed:a,onGenerated:h}),e[13]=n,e[14]=a,e[15]=h,e[16]=C):C=e[16],x="flex min-h-0 min-w-0 flex-1",f="true",v="shrink-0 select-none overflow-hidden border-e border-border bg-muted/30 py-3 text-end font-mono text-xs leading-5 text-muted-foreground/60",b=u,k=Gn,S=Array.from({length:j},Vn),e[0]=n,e[1]=r,e[2]=a,e[3]=u,e[4]=h,e[5]=f,e[6]=v,e[7]=b,e[8]=k,e[9]=S,e[10]=x,e[11]=q,e[12]=C}else f=e[5],v=e[6],b=e[7],k=e[8],S=e[9],x=e[10],q=e[11],C=e[12];let R;e[17]!==f||e[18]!==v||e[19]!==b||e[20]!==k||e[21]!==S?(R=(0,d.jsx)("div",{"aria-hidden":f,className:v,ref:b,style:k,children:S}),e[17]=f,e[18]=v,e[19]=b,e[20]=k,e[21]=S,e[22]=R):R=e[22];let T;e[23]!==o||e[24]!==r||e[25]!==m?(T=(0,d.jsx)(zn,{diagnostics:o,draft:r,scrollRef:m}),e[23]=o,e[24]=r,e[25]=m,e[26]=T):T=e[26];let _;e[27]!==t||e[28]!==p?(_=t===null?void 0:`${p}-opt-${t.active.toString()}`,e[27]=t,e[28]=p,e[29]=_):_=e[29];let L=t===null?void 0:p,O=t!==null,D;e[30]!==w?(D=w("SQL query"),e[30]=w,e[31]=D):D=e[31];let E;e[32]!==r||e[33]!==i||e[34]!==c.onBlur||e[35]!==c.onChange||e[36]!==c.onKeyDown||e[37]!==c.onScroll||e[38]!==c.onSelect||e[39]!==_||e[40]!==L||e[41]!==O||e[42]!==D?(E=(0,d.jsx)("textarea",{"aria-activedescendant":_,"aria-autocomplete":"list","aria-controls":L,"aria-expanded":O,"aria-label":D,className:`relative size-full resize-none bg-transparent outline-none ${vt}`,"data-testid":"sql-input",onBlur:c.onBlur,onChange:c.onChange,onKeyDown:c.onKeyDown,onScroll:c.onScroll,onSelect:c.onSelect,placeholder:"SELECT * FROM \u2026",ref:i,role:"combobox",spellCheck:!1,value:r}),e[32]=r,e[33]=i,e[34]=c.onBlur,e[35]=c.onChange,e[36]=c.onKeyDown,e[37]=c.onScroll,e[38]=c.onSelect,e[39]=_,e[40]=L,e[41]=O,e[42]=D,e[43]=E):E=e[43];let B;e[44]!==t||e[45]!==p||e[46]!==g?(B=(0,d.jsx)(xn,{listboxId:p,onPick:g,state:t}),e[44]=t,e[45]=p,e[46]=g,e[47]=B):B=e[47];let A;e[48]!==T||e[49]!==E||e[50]!==B?(A=(0,d.jsxs)("div",{className:"relative min-w-0 flex-1 bg-background",children:[T,E,B]}),e[48]=T,e[49]=E,e[50]=B,e[51]=A):A=e[51];let P;e[52]!==A||e[53]!==x||e[54]!==R?(P=(0,d.jsxs)("div",{className:x,children:[R,A]}),e[52]=A,e[53]=x,e[54]=R,e[55]=P):P=e[55];let M;e[56]!==o||e[57]!==y?(M=(0,d.jsx)(Yn,{diagnostics:o,onSelect:y}),e[56]=o,e[57]=y,e[58]=M):M=e[58];let N;return e[59]!==P||e[60]!==M||e[61]!==q||e[62]!==C?(N=(0,d.jsxs)("div",{className:q,children:[C,P,M]}),e[59]=P,e[60]=M,e[61]=q,e[62]=C,e[63]=N):N=e[63],N},"Vn");function Vn(s,e){return(0,d.jsx)("div",{children:e+1},e)}l(Vn,"Xn");var yt=[{label:"List tables",sql:"SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name;"},{label:"Table row count",sql:"SELECT COUNT(*) AS rows FROM messages;"},{label:"Recent rows",sql:"SELECT id, _creationTime, __doc__ FROM messages ORDER BY _creationTime DESC LIMIT 50;"},{label:"Index list",sql:"SELECT name, tbl_name FROM sqlite_master WHERE type = 'index' ORDER BY tbl_name;"}],Xn=l(s=>{let e=(0,G.c)(29),{active:n,onDelete:t,onSelect:o,query:r}=s,a=ce(),c;e[0]!==o||e[1]!==r.id?(c=l(()=>{o(r.id)},"i"),e[0]=o,e[1]=r.id,e[2]=c):c=e[2];let i=c,u;e[3]!==t||e[4]!==r.id?(u=l(q=>{q.stopPropagation(),t(r.id)},"a"),e[3]=t,e[4]=r.id,e[5]=u):u=e[5];let p=u,h=n?"bg-sidebar-accent font-medium text-foreground":"text-muted-foreground",g;e[6]!==h?(g=me("flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] outline-none transition-colors hover:bg-sidebar-accent focus-visible:bg-sidebar-accent",h),e[6]=h,e[7]=g):g=e[7];let y=`sql-query-${r.id}`,m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=(0,d.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M4 6h16M4 12h10M4 18h7"})}),e[8]=m):m=e[8];let w;e[9]!==r.name?(w=(0,d.jsx)("span",{className:"truncate",children:r.name}),e[9]=r.name,e[10]=w):w=e[10];let f;e[11]!==n||e[12]!==i||e[13]!==g||e[14]!==y||e[15]!==w?(f=(0,d.jsxs)("button",{"aria-pressed":n,className:g,"data-testid":y,onClick:i,type:"button",children:[m,w]}),e[11]=n,e[12]=i,e[13]=g,e[14]=y,e[15]=w,e[16]=f):f=e[16];let v;e[17]!==a?(v=a("Delete query"),e[17]=a,e[18]=v):v=e[18];let b;e[19]!==a?(b=a("Delete query"),e[19]=a,e[20]=b):b=e[20];let k;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=(0,d.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M5 7h14M9 7V5h6v2m-1 0v12H10V7M7 7v13h10V7"})}),e[21]=k):k=e[21];let S;e[22]!==p||e[23]!==b||e[24]!==v?(S=(0,d.jsx)("button",{"aria-label":v,className:"me-1 hidden size-6 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive group-hover/q:flex",onClick:p,title:b,type:"button",children:k}),e[22]=p,e[23]=b,e[24]=v,e[25]=S):S=e[25];let x;return e[26]!==S||e[27]!==f?(x=(0,d.jsxs)("li",{className:"group/q flex items-center",children:[f,S]}),e[26]=S,e[27]=f,e[28]=x):x=e[28],x},"Zn"),it="sql-history-remember",Jn=l((s,e)=>{let n=e.trim().toLowerCase();return n===""?[...s]:s.filter(t=>t.name.toLowerCase().includes(n))},"es"),Zn=l(s=>{let e=(0,G.c)(66),{activeId:n,history:t,listRef:o,onClearHistory:r,onDelete:a,onLoadHistory:c,onLoadTemplate:i,onNew:u,onSearchChange:p,onSelect:h,onToggleRememberHistory:g,queries:y,rememberHistory:m,search:w}=s,f=ce(),v,b,k,S,x;if(e[0]!==n||e[1]!==o||e[2]!==a||e[3]!==u||e[4]!==p||e[5]!==h||e[6]!==g||e[7]!==y||e[8]!==w||e[9]!==f){let E=Jn(y,w),B;e[15]!==g?(B=l(H=>{g(H.target.checked)},"B"),e[15]=g,e[16]=B):B=e[16],v=B,k="flex h-full w-64 shrink-0 flex-col border-e border-border bg-sidebar";let A;e[17]!==f?(A=f("Search queries\u2026"),e[17]=f,e[18]=A):A=e[18];let P;e[19]!==p||e[20]!==w||e[21]!==A?(P=(0,d.jsx)("input",{className:"h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"sql-search",onChange:p,placeholder:A,type:"text",value:w}),e[19]=p,e[20]=w,e[21]=A,e[22]=P):P=e[22];let M;e[23]!==f?(M=f("New query"),e[23]=f,e[24]=M):M=e[24];let N;e[25]!==f?(N=f("New query"),e[25]=f,e[26]=N):N=e[26];let j;e[27]===Symbol.for("react.memo_cache_sentinel")?(j=(0,d.jsx)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14"})}),e[27]=j):j=e[27];let I;e[28]!==u||e[29]!==M||e[30]!==N?(I=(0,d.jsx)("button",{"aria-label":M,className:"flex size-8 shrink-0 items-center justify-center rounded-md border border-border text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"sql-new",onClick:u,title:N,type:"button",children:j}),e[28]=u,e[29]=M,e[30]=N,e[31]=I):I=e[31],e[32]!==I||e[33]!==P?(S=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border p-2",children:[P,I]}),e[32]=I,e[33]=P,e[34]=S):S=e[34],b="flex flex-1 flex-col gap-4 overflow-y-auto p-2";let $;e[35]!==f?($=f("Private"),e[35]=f,e[36]=$):$=e[36];let F;e[37]!==$?(F=(0,d.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:$}),e[37]=$,e[38]=F):F=e[38],x=(0,d.jsxs)("div",{children:[F,E.length===0?(0,d.jsx)("p",{className:"px-1 py-2 text-xs text-muted-foreground","data-testid":"sql-private-empty",children:f("No saved queries yet \u2014 they save to this browser as you type.")}):(0,d.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-private",ref:o,children:E.map(H=>(0,d.jsx)(Xn,{active:n===H.id,onDelete:a,onSelect:h,query:H},H.id))})]}),e[0]=n,e[1]=o,e[2]=a,e[3]=u,e[4]=p,e[5]=h,e[6]=g,e[7]=y,e[8]=w,e[9]=f,e[10]=v,e[11]=b,e[12]=k,e[13]=S,e[14]=x}else v=e[10],b=e[11],k=e[12],S=e[13],x=e[14];let q;e[39]!==f?(q=f("Reference"),e[39]=f,e[40]=q):q=e[40];let C;e[41]!==q?(C=(0,d.jsx)("p",{className:"px-1 pb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:q}),e[41]=q,e[42]=C):C=e[42];let R;e[43]!==i?(R=yt.map(E=>(0,d.jsx)("li",{children:(0,d.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":E.sql,onClick:i,type:"button",children:[(0,d.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M7 4h7l4 4v12H7zM14 4v4h4"})}),E.label]})},E.label)),e[43]=i,e[44]=R):R=e[44];let T;e[45]!==R?(T=(0,d.jsx)("ul",{className:"flex flex-col gap-px",children:R}),e[45]=R,e[46]=T):T=e[46];let _;e[47]!==C||e[48]!==T?(_=(0,d.jsxs)("div",{children:[C,T]}),e[47]=C,e[48]=T,e[49]=_):_=e[49];let L;e[50]!==t||e[51]!==r||e[52]!==c||e[53]!==v||e[54]!==m||e[55]!==f?(L=t.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-1 pb-1",children:[(0,d.jsx)("p",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f("History")}),(0,d.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"sql-history-clear",onClick:r,type:"button",children:f("Clear history")})]}),(0,d.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 px-1 pb-1.5 text-[11px] text-muted-foreground",htmlFor:it,children:[(0,d.jsx)("input",{checked:m,"data-testid":"sql-history-remember",id:it,onChange:v,type:"checkbox"}),f("Keep history on this browser")]}),(0,d.jsx)("ul",{className:"flex flex-col gap-px","data-testid":"sql-history",children:t.map(E=>(0,d.jsx)("li",{children:(0,d.jsxs)("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-[13px] text-muted-foreground outline-none transition-colors hover:bg-sidebar-accent hover:text-foreground focus-visible:bg-sidebar-accent","data-sql":E.sql,"data-testid":"sql-history-item",onClick:c,title:E.sql,type:"button",children:[(0,d.jsx)("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0 opacity-70",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 8v4l3 2M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"})}),(0,d.jsx)("span",{className:"truncate font-mono",children:E.sql})]})},`${E.at.toString()}:${E.sql}`))})]}),e[50]=t,e[51]=r,e[52]=c,e[53]=v,e[54]=m,e[55]=f,e[56]=L):L=e[56];let O;e[57]!==b||e[58]!==L||e[59]!==x||e[60]!==_?(O=(0,d.jsxs)("div",{className:b,children:[x,_,L]}),e[57]=b,e[58]=L,e[59]=x,e[60]=_,e[61]=O):O=e[61];let D;return e[62]!==O||e[63]!==k||e[64]!==S?(D=(0,d.jsxs)("aside",{className:k,children:[S,O]}),e[62]=O,e[63]=k,e[64]=S,e[65]=D):D=e[65],D},"ts"),De=l(s=>`border-b-2 px-3 py-2 text-sm outline-none transition-colors ${s?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,"Ie"),er=l(s=>{let e=(0,G.c)(96),{assistant:n,chart:t,className:o,error:r,onFormat:a,onInferChart:c,onRun:i,onSelectStatement:u,onShardKeyChange:p,onShowChart:h,onShowExplain:g,onShowResults:y,onToggleSplit:m,pane:w,result:f,running:v,script:b,shardKey:k,splitView:S}=s,x=ce(),q=w==="results",C;e[0]!==q?(C=De(q),e[0]=q,e[1]=C):C=e[1];let R;e[2]!==x?(R=x("Results"),e[2]=x,e[3]=R):R=e[3];let T;e[4]!==y||e[5]!==C||e[6]!==R?(T=(0,d.jsx)("button",{className:C,"data-testid":"sql-tab-results",onClick:y,type:"button",children:R}),e[4]=y,e[5]=C,e[6]=R,e[7]=T):T=e[7];let _=w==="chart",L;e[8]!==_?(L=De(_),e[8]=_,e[9]=L):L=e[9];let O;e[10]!==x?(O=x("Chart"),e[10]=x,e[11]=O):O=e[11];let D;e[12]!==h||e[13]!==L||e[14]!==O?(D=(0,d.jsx)("button",{className:L,"data-testid":"sql-tab-chart",onClick:h,type:"button",children:O}),e[12]=h,e[13]=L,e[14]=O,e[15]=D):D=e[15];let E;e[16]!==n||e[17]!==c||e[18]!==w||e[19]!==f||e[20]!==x?(E=!n.unavailable&&w==="chart"&&f!==null&&(0,d.jsx)("button",{className:De(!1),"data-testid":"sql-infer-chart",disabled:n.pending("chart"),onClick:c,type:"button",children:n.pending("chart")?x("Thinking\u2026"):x("Suggest chart")}),e[16]=n,e[17]=c,e[18]=w,e[19]=f,e[20]=x,e[21]=E):E=e[21];let B=w==="explain",A;e[22]!==B?(A=De(B),e[22]=B,e[23]=A):A=e[23];let P;e[24]!==x?(P=x("Explain"),e[24]=x,e[25]=P):P=e[25];let M;e[26]!==g||e[27]!==A||e[28]!==P?(M=(0,d.jsx)("button",{className:A,"data-testid":"sql-tab-explain",onClick:g,type:"button",children:P}),e[26]=g,e[27]=A,e[28]=P,e[29]=M):M=e[29];let N;e[30]!==x?(N=x("Split editor and results"),e[30]=x,e[31]=N):N=e[31];let j=`inline-flex items-center rounded-md border border-border px-2 py-1.5 outline-none transition-colors hover:bg-accent focus-visible:bg-accent ${S?"bg-accent text-foreground":"text-muted-foreground"}`,I;e[32]!==x?(I=x("Split editor and results"),e[32]=x,e[33]=I):I=e[33];let $;e[34]===Symbol.for("react.memo_cache_sentinel")?($=(0,d.jsxs)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:[(0,d.jsx)("rect",{height:"16",rx:"2",width:"18",x:"3",y:"4"}),(0,d.jsx)("path",{d:"M12 4v16"})]}),e[34]=$):$=e[34];let F;e[35]!==m||e[36]!==S||e[37]!==N||e[38]!==j||e[39]!==I?(F=(0,d.jsx)("button",{"aria-label":N,"aria-pressed":S,className:j,"data-testid":"sql-split-toggle",onClick:m,title:I,type:"button",children:$}),e[35]=m,e[36]=S,e[37]=N,e[38]=j,e[39]=I,e[40]=F):F=e[40];let H;e[41]!==f?(H=f!==null&&f.columns.length>0&&(0,d.jsx)(tt,{columns:f.columns,name:"query-result",rows:f.rows}),e[41]=f,e[42]=H):H=e[42];let J;e[43]!==x?(J=x("Format"),e[43]=x,e[44]=J):J=e[44];let Z;e[45]!==a||e[46]!==v||e[47]!==J?(Z=(0,d.jsx)("button",{className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-format",disabled:v,onClick:a,type:"button",children:J}),e[45]=a,e[46]=v,e[47]=J,e[48]=Z):Z=e[48];let ee;e[49]!==p||e[50]!==k?(ee=(0,d.jsx)(Xe,{onChange:p,testId:"sql-shard-input",value:k}),e[49]=p,e[50]=k,e[51]=ee):ee=e[51];let te;e[52]!==v||e[53]!==x?(te=x(v?"Running\u2026":"Run"),e[52]=v,e[53]=x,e[54]=te):te=e[54];let ie;e[55]===Symbol.for("react.memo_cache_sentinel")?(ie=(0,d.jsx)("kbd",{className:"rounded border border-primary-foreground/30 px-1 font-sans text-[10px]",children:"\u2318\u21B5"}),e[55]=ie):ie=e[55];let V;e[56]!==i||e[57]!==v||e[58]!==te?(V=(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"sql-run",disabled:v,onClick:i,type:"button",children:[te,ie]}),e[56]=i,e[57]=v,e[58]=te,e[59]=V):V=e[59];let Q;e[60]!==F||e[61]!==H||e[62]!==Z||e[63]!==ee||e[64]!==V?(Q=(0,d.jsxs)("div",{className:"ms-auto flex items-center gap-2",children:[F,H,Z,ee,V]}),e[60]=F,e[61]=H,e[62]=Z,e[63]=ee,e[64]=V,e[65]=Q):Q=e[65];let ne;e[66]!==M||e[67]!==Q||e[68]!==T||e[69]!==D||e[70]!==E?(ne=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-border pe-2",children:[T,D,E,M,Q]}),e[66]=M,e[67]=Q,e[68]=T,e[69]=D,e[70]=E,e[71]=ne):ne=e[71];let re;e[72]!==u||e[73]!==b?(re=b!==void 0&&(0,d.jsx)("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-border px-3 py-1.5","data-testid":"sql-statements",children:b.runs.map((Y,X)=>(0,d.jsx)("button",{"aria-pressed":X===b.selected,className:`rounded-md border px-2 py-0.5 font-mono text-[11px] outline-none transition-colors ${X===b.selected?"border-foreground text-foreground":"border-border text-muted-foreground hover:text-foreground"} ${Y.error===null?"":"border-destructive/50 text-destructive"}`,"data-testid":`sql-statement-${X.toString()}`,onClick:l(()=>{u(X)},"onClick"),title:Y.sql,type:"button",children:X+1},`${X.toString()}:${Y.sql}`))}),e[72]=u,e[73]=b,e[74]=re):re=e[74];let oe;e[75]!==r?(oe=r!==null&&(0,d.jsx)(Je,{className:"m-3 font-mono text-xs",testId:"sql-error",variant:"destructive",children:r}),e[75]=r,e[76]=oe):oe=e[76];let se;e[77]!==r||e[78]!==f||e[79]!==x?(se=r===null&&f===null&&(0,d.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-empty",children:x("Click Run to execute your query.")}),e[77]=r,e[78]=f,e[79]=x,e[80]=se):se=e[80];let le;e[81]!==t||e[82]!==r||e[83]!==w||e[84]!==f||e[85]!==x?(le=r===null&&f!==null&&(0,d.jsxs)("div",{"data-testid":"sql-result",children:[w==="chart"?(0,d.jsx)(nt,{axes:t,result:f}):(0,d.jsx)(rt,{result:f}),(0,d.jsx)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground","data-testid":"sql-count",children:f.truncated?x("Showing the first {max} of {count} rows.",{count:f.rowCount,max:f.rows.length}):x("{count} rows",{count:f.rowCount})})]}),e[81]=t,e[82]=r,e[83]=w,e[84]=f,e[85]=x,e[86]=le):le=e[86];let W;e[87]!==oe||e[88]!==se||e[89]!==le?(W=(0,d.jsxs)("div",{className:"min-h-0 flex-1 overflow-auto",children:[oe,se,le]}),e[87]=oe,e[88]=se,e[89]=le,e[90]=W):W=e[90];let U;return e[91]!==o||e[92]!==ne||e[93]!==re||e[94]!==W?(U=(0,d.jsxs)("div",{className:o,children:[ne,re,W]}),e[91]=o,e[92]=ne,e[93]=re,e[94]=W,e[95]=U):U=e[95],U},"ns"),tr=l((s,e)=>s.trim()===""?e:(s.split(`
8
+ `)[0]??s).slice(0,24),"ss"),nr=l(s=>{s?.focus(),s?.select()},"os"),rr=l(s=>{let e=(0,G.c)(14),{initial:n,onCancel:t,onCommit:o,placeholder:r,testId:a}=s,c=ce(),i;e[0]!==o?(i=l(m=>{o(m.currentTarget.value.trim())},"c"),e[0]=o,e[1]=i):i=e[1];let u=i,p;e[2]!==t||e[3]!==o?(p=l(m=>{m.key==="Enter"?o(m.currentTarget.value.trim()):m.key==="Escape"&&t()},"m"),e[2]=t,e[3]=o,e[4]=p):p=e[4];let h=p,g;e[5]!==c?(g=c("Tab title"),e[5]=c,e[6]=g):g=e[6];let y;return e[7]!==n||e[8]!==u||e[9]!==h||e[10]!==r||e[11]!==g||e[12]!==a?(y=(0,d.jsx)("input",{"aria-label":g,className:"w-40 rounded border border-ring bg-background px-1 py-0.5 text-xs outline-none","data-testid":a,defaultValue:n,onBlur:u,onKeyDown:h,placeholder:r,ref:nr,type:"text"}),e[7]=n,e[8]=u,e[9]=h,e[10]=r,e[11]=g,e[12]=a,e[13]=y):y=e[13],y},"ls"),or=l(s=>{let e=(0,G.c)(29),{idBase:n,onDiscard:t,onKeep:o}=s,r=ce(),a=`sql-tab-close-prompt-${n}`,c;e[0]!==r?(c=r("Discard?"),e[0]=r,e[1]=c):c=e[1];let i;e[2]!==c?(i=(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:c}),e[2]=c,e[3]=i):i=e[3];let u;e[4]!==r?(u=r("Discard changes"),e[4]=r,e[5]=u):u=e[5];let p=`sql-tab-close-confirm-${n}`,h;e[6]!==r?(h=r("Discard changes"),e[6]=r,e[7]=h):h=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=(0,d.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M5 13l4 4L19 7"})}),e[8]=g):g=e[8];let y;e[9]!==t||e[10]!==u||e[11]!==p||e[12]!==h?(y=(0,d.jsx)("button",{"aria-label":u,className:"flex size-5 items-center justify-center rounded text-destructive hover:bg-destructive/10","data-testid":p,onClick:t,title:h,type:"button",children:g}),e[9]=t,e[10]=u,e[11]=p,e[12]=h,e[13]=y):y=e[13];let m;e[14]!==r?(m=r("Keep editing"),e[14]=r,e[15]=m):m=e[15];let w=`sql-tab-close-cancel-${n}`,f;e[16]!==r?(f=r("Keep editing"),e[16]=r,e[17]=f):f=e[17];let v;e[18]===Symbol.for("react.memo_cache_sentinel")?(v=(0,d.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.4,viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})}),e[18]=v):v=e[18];let b;e[19]!==o||e[20]!==w||e[21]!==f||e[22]!==m?(b=(0,d.jsx)("button",{"aria-label":m,className:"flex size-5 items-center justify-center rounded text-muted-foreground hover:bg-accent","data-testid":w,onClick:o,title:f,type:"button",children:v}),e[19]=o,e[20]=w,e[21]=f,e[22]=m,e[23]=b):b=e[23];let k;return e[24]!==a||e[25]!==b||e[26]!==i||e[27]!==y?(k=(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1","data-testid":a,role:"group",children:[i,y,b]}),e[24]=a,e[25]=b,e[26]=i,e[27]=y,e[28]=k):k=e[28],k},"rs"),sr=l(s=>{let e=(0,G.c)(47),{active:n,canClose:t,onClose:o,onMenu:r,onRename:a,onSelect:c,tab:i}=s,u=ce(),[p,h]=(0,z.useState)(!1),[g,y]=(0,z.useState)(!1),m;e[0]!==r||e[1]!==i.id?(m=l(H=>{r(i.id,H)},"d"),e[0]=r,e[1]=i.id,e[2]=m):m=e[2];let w=m,f;e[3]!==c||e[4]!==i.id?(f=l(()=>{c(i.id)},"u"),e[3]=c,e[4]=i.id,e[5]=f):f=e[5];let v=f,b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=l(()=>{h(!0)},"h"),e[6]=b):b=e[6];let k=b,S;e[7]!==o||e[8]!==i?(S=l(H=>{H.stopPropagation(),xt(i)?y(!0):o(i.id)},"y"),e[7]=o,e[8]=i,e[9]=S):S=e[9];let x=S,q;e[10]!==o||e[11]!==i.id?(q=l(H=>{H.stopPropagation(),y(!1),o(i.id)},"k"),e[10]=o,e[11]=i.id,e[12]=q):q=e[12];let C=q,R;e[13]===Symbol.for("react.memo_cache_sentinel")?(R=l(H=>{H.stopPropagation(),y(!1)},"L"),e[13]=R):R=e[13];let T=R,_;e[14]!==a||e[15]!==i.id?(_=l(H=>{a(i.id,H),h(!1)},"q"),e[14]=a,e[15]=i.id,e[16]=_):_=e[16];let L=_,O;e[17]===Symbol.for("react.memo_cache_sentinel")?(O=l(()=>{h(!1)},"A"),e[17]=O):O=e[17];let D=O,E;e[18]!==i.name?(E=i.name.trim(),e[18]=i.name,e[19]=E):E=e[19];let B=E,A;e[20]!==u||e[21]!==i.sql?(A=tr(i.sql,u("Untitled")),e[20]=u,e[21]=i.sql,e[22]=A):A=e[22];let P=A,M=n?"bg-background text-foreground":"bg-muted/40 text-muted-foreground hover:text-foreground",N;e[23]!==M?(N=me("group/tab flex shrink-0 items-center gap-1 border-e border-border ps-3 pe-1.5 text-xs",M),e[23]=M,e[24]=N):N=e[24];let j=`sql-tab-${i.id}`,I;e[25]!==n||e[26]!==L||e[27]!==B||e[28]!==P||e[29]!==p||e[30]!==v||e[31]!==u||e[32]!==i.id?(I=p?(0,d.jsx)(rr,{initial:B,onCancel:D,onCommit:L,placeholder:P,testId:`sql-tab-rename-${i.id}`}):(0,d.jsx)("button",{"aria-pressed":n,className:"max-w-40 truncate py-1.5 outline-none","data-testid":`sql-tab-select-${i.id}`,onClick:v,onDoubleClick:k,title:u("Double-click to rename"),type:"button",children:B===""?P:B}),e[25]=n,e[26]=L,e[27]=B,e[28]=P,e[29]=p,e[30]=v,e[31]=u,e[32]=i.id,e[33]=I):I=e[33];let $;e[34]!==t||e[35]!==C||e[36]!==g||e[37]!==x||e[38]!==u||e[39]!==i.id?($=t&&(g?(0,d.jsx)(or,{idBase:i.id,onDiscard:C,onKeep:T}):(0,d.jsx)("button",{"aria-label":u("Close tab"),className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-destructive/10 hover:text-destructive","data-testid":`sql-tab-close-${i.id}`,onClick:x,title:u("Close tab"),type:"button",children:(0,d.jsx)("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M6 6l12 12M18 6 6 18"})})})),e[34]=t,e[35]=C,e[36]=g,e[37]=x,e[38]=u,e[39]=i.id,e[40]=$):$=e[40];let F;return e[41]!==w||e[42]!==N||e[43]!==j||e[44]!==I||e[45]!==$?(F=(0,d.jsxs)("div",{className:N,"data-testid":j,onContextMenu:w,children:[I,$]}),e[41]=w,e[42]=N,e[43]=j,e[44]=I,e[45]=$,e[46]=F):F=e[46],F},"is"),lr=l(s=>{let e=(0,G.c)(43),{model:n,onSelect:t}=s,o=ce(),{activeTab:r,addEditorTab:a,cancelBulk:c,closeEditorTab:i,closeTabMenu:u,confirmBulk:p,menuStyle:h,onBackdropContextMenu:g,onCloseAll:y,onCloseOthers:m,onCloseToRight:w,openTabMenu:f,pendingBulk:v,renameTab:b,tabMenu:k,tabs:S}=n,x;if(e[0]!==r||e[1]!==i||e[2]!==t||e[3]!==f||e[4]!==b||e[5]!==S){let E;e[7]!==r||e[8]!==i||e[9]!==t||e[10]!==f||e[11]!==b||e[12]!==S.length?(E=l(B=>(0,d.jsx)(sr,{active:B.id===r.id,canClose:S.length>1,onClose:i,onMenu:f,onRename:b,onSelect:t,tab:B},B.id),"I"),e[7]=r,e[8]=i,e[9]=t,e[10]=f,e[11]=b,e[12]=S.length,e[13]=E):E=e[13],x=S.map(E),e[0]=r,e[1]=i,e[2]=t,e[3]=f,e[4]=b,e[5]=S,e[6]=x}else x=e[6];let q;e[14]!==o?(q=o("New tab"),e[14]=o,e[15]=q):q=e[15];let C=S.length>=ze,R;e[16]!==o?(R=o("New tab"),e[16]=o,e[17]=R):R=e[17];let T;e[18]===Symbol.for("react.memo_cache_sentinel")?(T=(0,d.jsx)("svg",{"aria-hidden":"true",className:"size-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.7,viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14"})}),e[18]=T):T=e[18];let _;e[19]!==a||e[20]!==q||e[21]!==C||e[22]!==R?(_=(0,d.jsx)("button",{"aria-label":q,className:"flex size-8 shrink-0 items-center justify-center text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-add",disabled:C,onClick:a,title:R,type:"button",children:T}),e[19]=a,e[20]=q,e[21]=C,e[22]=R,e[23]=_):_=e[23];let L;e[24]!==x||e[25]!==_?(L=(0,d.jsxs)("div",{className:"flex shrink-0 items-stretch overflow-x-auto border-b border-border bg-muted/30","data-testid":"sql-tab-strip",role:"tablist",children:[x,_]}),e[24]=x,e[25]=_,e[26]=L):L=e[26];let O;e[27]!==c||e[28]!==u||e[29]!==p||e[30]!==h||e[31]!==g||e[32]!==y||e[33]!==m||e[34]!==w||e[35]!==v||e[36]!==o||e[37]!==k||e[38]!==S?(O=k!==null&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"fixed inset-0 z-40","data-testid":"sql-tab-menu-backdrop",onClick:u,onContextMenu:g,role:"presentation"}),(0,d.jsx)("div",{className:"fixed z-50 min-w-44 rounded-md border border-border bg-popover py-1 text-popover-foreground shadow-md","data-testid":"sql-tab-menu",role:"menu",style:h,children:v===null?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-others",disabled:S.length<=1,onClick:m,role:"menuitem",type:"button",children:o("Close other tabs")}),(0,d.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-40","data-testid":"sql-tab-menu-close-right",disabled:S.findIndex(E=>E.id===k.id)>=S.length-1,onClick:w,role:"menuitem",type:"button",children:o("Close tabs to the right")}),(0,d.jsx)("button",{className:"flex w-full items-center px-3 py-1.5 text-start text-xs outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-close-all",onClick:y,role:"menuitem",type:"button",children:o("Close all tabs")})]}):(0,d.jsxs)("div",{className:"px-3 py-1.5","data-testid":"sql-tab-menu-confirm",children:[(0,d.jsx)("p",{className:"pb-1.5 text-xs text-muted-foreground",children:o("Discard unsaved tabs?")}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("button",{className:"rounded px-2 py-1 text-xs font-medium text-destructive outline-none hover:bg-destructive/10 focus-visible:bg-destructive/10","data-testid":"sql-tab-menu-confirm-discard",onClick:p,type:"button",children:o("Discard")}),(0,d.jsx)("button",{className:"rounded px-2 py-1 text-xs text-muted-foreground outline-none hover:bg-accent focus-visible:bg-accent","data-testid":"sql-tab-menu-confirm-cancel",onClick:c,type:"button",children:o("Cancel")})]})]})})]}),e[27]=c,e[28]=u,e[29]=p,e[30]=h,e[31]=g,e[32]=y,e[33]=m,e[34]=w,e[35]=v,e[36]=o,e[37]=k,e[38]=S,e[39]=O):O=e[39];let D;return e[40]!==L||e[41]!==O?(D=(0,d.jsxs)(d.Fragment,{children:[L,O]}),e[40]=L,e[41]=O,e[42]=D):D=e[42],D},"as"),ar=we(Ne.runSql),ir="lunora-studio-sql-split-view",cr=l(()=>Ce(yt[0]?.sql??""),"us"),Nr=l(s=>{let e=(0,G.c)(112),{initialShardKey:n}=s,t=Le(),o=Mn(cr),{activeTab:r,output:a,patchActiveOutput:c,patchActiveTab:i,setActiveTabId:u,unlinkQuery:p}=o,h;e[0]!==c||e[1]!==i?(h=l((K,ae)=>{i({activeId:ae,sql:K}),c({chart:void 0,error:null,failed:void 0,result:null,script:void 0})},"g"),e[0]=c,e[1]=i,e[2]=h):h=e[2];let g=h,y;e[3]!==g||e[4]!==p?(y={loadIntoActiveTab:g,unlinkQuery:p},e[3]=g,e[4]=p,e[5]=y):y=e[5];let m=Pn(y),{recordHistory:w,updateQuerySql:f}=m,v=r.sql,{activeId:b}=r,{chart:k,error:S,failed:x,result:q,running:C}=a,R=a.pane,[T,_]=(0,z.useState)(n??""),[L,O]=_e(ir,!1),{probe:D,schema:E}=Sn(T),B;e[6]!==b||e[7]!==i||e[8]!==f?(B=l(K=>{i({sql:K}),b!==null&&f(b,K)},"B"),e[6]=b,e[7]=i,e[8]=f,e[9]=B):B=e[9];let A=B,P=on(v,E,T),M=et(T),N;e[10]!==M||e[11]!==c||e[12]!==q?(N=l(()=>{q!==null&&ue((async()=>{let K=await M.inferChart({columns:q.columns,rowCount:q.rowCount,types:Object.fromEntries(q.columns.map(ae=>[ae,typeof(q.rows[0]?.[ae]??"")]))});c({chart:K})})())},"w"),e[10]=M,e[11]=c,e[12]=q,e[13]=N):N=e[13];let j=N,I;e[14]!==t||e[15]!==w||e[16]!==T?(I=l(async K=>{try{let ae=await t.query(ar,{sql:K},ke(T));return w(K),{error:null,result:ae,sql:K}}catch(ae){return{error:Ge(ae),result:null,sql:K}}},"R"),e[14]=t,e[15]=w,e[16]=T,e[17]=I):I=e[17];let $=I,F;e[18]!==v||e[19]!==c||e[20]!==$||e[21]!==T?(F=l(async K=>{if(v.trim()==="")return;c({running:!0});let ae=K==="explain"?Qe(Dt(v),0):ft(v),de=[];for(let Re of ae){let St={error:Re.rejection?.message??"",result:null,sql:Re.sql};de.push(Re.rejection===void 0?await $(Re.sql):St)}Ve(T);let Ue=Math.max(de.length-1,0),ye=de[Ue];c({chart:void 0,error:ye?.error??null,failed:ye?.error===null||ye===void 0?void 0:{error:ye.error,sql:ye.sql},pane:K,result:ye?.result??null,running:!1,script:de.length>1?{runs:de,selected:Ue}:void 0})},"U"),e[18]=v,e[19]=c,e[20]=$,e[21]=T,e[22]=F):F=e[22];let H=F,J;e[23]!==a.script?.runs||e[24]!==c?(J=l(K=>{let ae=a.script?.runs,de=ae?.[K];ae===void 0||de===void 0||c({chart:void 0,error:de.error,failed:de.error===null?void 0:{error:de.error,sql:de.sql},result:de.result,script:{runs:ae,selected:K}})},"X"),e[23]=a.script?.runs,e[24]=c,e[25]=J):J=e[25];let Z=J,ee;e[26]!==H?(ee=l(()=>{ue(H("results"))},"ee"),e[26]=H,e[27]=ee):ee=e[27];let te=ee,ie;e[28]!==a.pane||e[29]!==H?(ie=l(()=>{ue(H(a.pane))},"ie"),e[28]=a.pane,e[29]=H,e[30]=ie):ie=e[30];let V;e[31]!==D||e[32]!==E||e[33]!==A||e[34]!==ie?(V={onSubmit:ie,probe:D,schema:E,setDraft:A},e[31]=D,e[32]=E,e[33]=A,e[34]=ie,e[35]=V):V=e[35];let Q=Nn(V),{closeAutocomplete:ne}=Q,re;e[36]!==v||e[37]!==A?(re=l(()=>{A(Wt(v))},"se"),e[36]=v,e[37]=A,e[38]=re):re=e[38];let oe=re,se;e[39]!==ne||e[40]!==u?(se=l(K=>{ne(),u(K)},"le"),e[39]=ne,e[40]=u,e[41]=se):se=e[41];let le=se,W;e[42]!==c?(W=l(()=>{c({pane:"results"})},"H"),e[42]=c,e[43]=W):W=e[43];let U=W,Y;e[44]!==H?(Y=l(()=>{ue(H("explain"))},"z"),e[44]=H,e[45]=Y):Y=e[45];let X=Y,fe;e[46]!==c?(fe=l(()=>{c({pane:"chart"})},"me"),e[46]=c,e[47]=fe):fe=e[47];let Ae=fe,Te;e[48]!==O||e[49]!==L?(Te=l(()=>{O(!L)},"ke"),e[48]=O,e[49]=L,e[50]=Te):Te=e[50];let $e=Te,Be=L?"flex min-h-0 flex-1 flex-row":"flex min-h-0 flex-1 flex-col",He=L?"flex w-2/5 min-h-0 min-w-0 shrink-0 flex-col border-s border-border":"flex h-2/5 min-h-0 shrink-0 flex-col border-t border-border",he;e[51]!==b||e[52]!==m.clearHistory||e[53]!==m.deleteQuery||e[54]!==m.history||e[55]!==m.listRef||e[56]!==m.loadFromHistory||e[57]!==m.loadTemplate||e[58]!==m.newQuery||e[59]!==m.onSearchChange||e[60]!==m.queries||e[61]!==m.rememberHistory||e[62]!==m.search||e[63]!==m.selectQuery||e[64]!==m.setRememberHistory?(he=(0,d.jsx)(Zn,{activeId:b,history:m.history,listRef:m.listRef,onClearHistory:m.clearHistory,onDelete:m.deleteQuery,onLoadHistory:m.loadFromHistory,onLoadTemplate:m.loadTemplate,onNew:m.newQuery,onSearchChange:m.onSearchChange,onSelect:m.selectQuery,onToggleRememberHistory:m.setRememberHistory,queries:m.queries,rememberHistory:m.rememberHistory,search:m.search}),e[51]=b,e[52]=m.clearHistory,e[53]=m.deleteQuery,e[54]=m.history,e[55]=m.listRef,e[56]=m.loadFromHistory,e[57]=m.loadTemplate,e[58]=m.newQuery,e[59]=m.onSearchChange,e[60]=m.queries,e[61]=m.rememberHistory,e[62]=m.search,e[63]=m.selectQuery,e[64]=m.setRememberHistory,e[65]=he):he=e[65];let pe;e[66]!==o||e[67]!==le?(pe=(0,d.jsx)(lr,{model:o,onSelect:le}),e[66]=o,e[67]=le,e[68]=pe):pe=e[68];let be;e[69]!==M||e[70]!==P||e[71]!==v||e[72]!==x||e[73]!==A||e[74]!==Q.autocompleteState||e[75]!==Q.editorRef||e[76]!==Q.gutterRef||e[77]!==Q.handlers||e[78]!==Q.listboxId||e[79]!==Q.onPickSuggestion||e[80]!==Q.overlayRef||e[81]!==Q.revealDiagnostic?(be=(0,d.jsx)(Kn,{assistant:M,autocomplete:Q.autocompleteState,diagnostics:P,draft:v,editorRef:Q.editorRef,failed:x,gutterRef:Q.gutterRef,handlers:Q.handlers,listboxId:Q.listboxId,onGenerated:A,onPickSuggestion:Q.onPickSuggestion,onRevealDiagnostic:Q.revealDiagnostic,overlayRef:Q.overlayRef}),e[69]=M,e[70]=P,e[71]=v,e[72]=x,e[73]=A,e[74]=Q.autocompleteState,e[75]=Q.editorRef,e[76]=Q.gutterRef,e[77]=Q.handlers,e[78]=Q.listboxId,e[79]=Q.onPickSuggestion,e[80]=Q.overlayRef,e[81]=Q.revealDiagnostic,e[82]=be):be=e[82];let ge;e[83]!==M||e[84]!==S||e[85]!==oe||e[86]!==j||e[87]!==k||e[88]!==te||e[89]!==Z||e[90]!==a.script||e[91]!==q||e[92]!==He||e[93]!==C||e[94]!==T||e[95]!==Ae||e[96]!==X||e[97]!==U||e[98]!==L||e[99]!==R||e[100]!==$e?(ge=(0,d.jsx)(er,{assistant:M,chart:k,className:He,error:S,onFormat:oe,onInferChart:j,onRun:te,onSelectStatement:Z,onShardKeyChange:_,onShowChart:Ae,onShowExplain:X,onShowResults:U,onToggleSplit:$e,pane:R,result:q,running:C,script:a.script,shardKey:T,splitView:L}),e[83]=M,e[84]=S,e[85]=oe,e[86]=j,e[87]=k,e[88]=te,e[89]=Z,e[90]=a.script,e[91]=q,e[92]=He,e[93]=C,e[94]=T,e[95]=Ae,e[96]=X,e[97]=U,e[98]=L,e[99]=R,e[100]=$e,e[101]=ge):ge=e[101];let xe;e[102]!==be||e[103]!==ge||e[104]!==Be?(xe=(0,d.jsxs)("div",{className:Be,children:[be,ge]}),e[102]=be,e[103]=ge,e[104]=Be,e[105]=xe):xe=e[105];let ve;e[106]!==pe||e[107]!==xe?(ve=(0,d.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[pe,xe]}),e[106]=pe,e[107]=xe,e[108]=ve):ve=e[108];let Ie;return e[109]!==he||e[110]!==ve?(Ie=(0,d.jsxs)("div",{className:"flex h-full min-w-0","data-testid":"lunora-sql-editor",children:[he,ve]}),e[109]=he,e[110]=ve,e[111]=Ie):Ie=e[111],Ie},"Ls");export{Nr as SqlEditorPanel};
@@ -0,0 +1 @@
1
+ import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-U5JDESCI.js";import"./chunk-I52I2DJG.js";import"./chunk-TWTNWOJU.js";import{a as Ve}from"./chunk-TIUMFAN2.js";import{a as qe}from"./chunk-BOTGXX4H.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import{a as Le}from"./chunk-S3CRZLGS.js";import{a as _e}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{P as ke}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as ie}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as me}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import"./chunk-35DM4JJG.js";import{a as U}from"./chunk-4ZEL6BYL.js";import{c as Ee}from"./chunk-T6S2F46N.js";import{f as Ne}from"./chunk-MZDJBR3M.js";import"./chunk-FSRSK4LY.js";import{b as Ie,c as $e}from"./chunk-2LN3T5HY.js";import{a as Ae}from"./chunk-FKVZRPV5.js";import{a as ze,b as Re,c as je,d as pe,e as B,f as z}from"./chunk-HEAQVSNS.js";import{a as Me,e as Ce}from"./chunk-WUWBZPUK.js";import{d as ue,f as re,g as be,h as Ke,o as le,r as Te}from"./chunk-FODLDLE2.js";import{a as d,d as ye,e as Oe,f as Ge,g as He}from"./chunk-YKXDMIHQ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Se="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=re(U.resolveIssue),Xe=re(U.ignoreIssue),Fe=re(U.assignIssue),Ye=re(U.setIssueSeverity),Ze=re(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=Ne(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=Ve(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},I=await i.query(Ze,g,be($));o(I)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let L=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Ie(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==L||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(ie,{"data-testid":b,disabled:_,onClick:L,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=L,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(z,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let S;return e[41]!==c||e[42]!==E?(S=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=S):S=e[43],S},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Se?null:ae;le(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let L=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();le(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(z,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let S=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let I;e[33]!==s.status||e[34]!==S||e[35]!==g?(I=(0,t.jsx)(z,{children:(0,t.jsx)(me,{"data-testid":S,variant:g,children:s.status})}),e[33]=s.status,e[34]=S,e[35]=g,e[36]=I):I=e[36];let j=s.severity??Se,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,V;e[39]!==a?(V=a("\u2014"),e[39]=a,e[40]=V):V=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==V||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:V,children:N}),e[44]=V,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Se,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==L||e[58]!==j||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(z,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:L,value:j,children:[q,D]})}),e[56]=u,e[57]=L,e[58]=j,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(z,{children:(0,t.jsx)(ke,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Te(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(z,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(ie,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(ie,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(ie,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==I||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,I,F,H,J,Q,ee]}),e[103]=c,e[104]=I,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=Ne(),{queryShardKey:i,setShardKey:l,shardKey:a}=Le(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,L]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ee(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,V)=>{L(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...V,hash:r},be(i))}catch(N){let C=Ke(N);L(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"S"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let S;e[27]!==x?(S=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=S):S=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(ie,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let I;e[32]!==g?(I=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=I):I=e[33];let j;e[34]!==I||e[35]!==c||e[36]!==S?(j=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,S,I]}),e[34]=I,e[35]=c,e[36]=S,e[37]=j):j=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,j,M&&y.length===0?(0,t.jsx)(Ae,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(je,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
@@ -0,0 +1 @@
1
+ import{b as Nr}from"./chunk-Y6CXU7T4.js";import{a as Or}from"./chunk-4L4WTGN5.js";import{a,d as k,e as B,g as Z}from"./chunk-YKXDMIHQ.js";var zo=k(B(),1),ae=zo.createContext(null);var Ho=k(B(),1);function N(t){return Ho.useContext(ae)}a(N,"useRouter");var Ue=k(B(),1),bt=Ue.createContext(void 0),jo=Ue.createContext(void 0);function dt(t){return t[t.length-1]}a(dt,"last");function Dr(t){return typeof t=="function"}a(Dr,"isFunction");function J(t,e){return Dr(t)?t(e):t}a(J,"functionalUpdate");var Jo=Object.prototype.hasOwnProperty,Fr=Object.prototype.propertyIsEnumerable;function ht(t){for(let e in t)if(Jo.call(t,e))return!0;return!1}a(ht,"hasKeys");var Ar=a(()=>Object.create(null),"createNull"),pt=a((t,e)=>st(t,e,Ar),"nullReplaceEqualDeep");function st(t,e,o=()=>({}),r=0){if(!1)return e;if(t===e)return t;if(r>500)return e;let n=e,s=Ve(t)&&Ve(n);if(!s&&!(jt(t)&&jt(n)))return n;let u=s?t:Ko(t);if(!u)return n;let i=s?n:Ko(n);if(!i)return n;let l=u.length,c=i.length,f=s?new Array(c):o(),d=0;for(let h=0;h<c;h++){let m=s?h:i[h],g=t[m],p=n[m];if(g===p){f[m]=g,(s?h<l:Jo.call(t,m))&&d++;continue}if(g===null||p===null||typeof g!="object"||typeof p!="object"){f[m]=p;continue}let v=st(g,p,o,r+1);f[m]=v,v===g&&d++}return l===c&&d===l?t:f}a(st,"replaceEqualDeep");function Ko(t){let e=Object.keys(t);if(e.length!==Object.getOwnPropertyNames(t).length)return!1;let o=Object.getOwnPropertySymbols(t);if(o.length===0)return e;for(let r of o){if(!Fr.call(t,r))return!1;e.push(r)}return e}a(Ko,"getEnumerableOwnKeys");function jt(t){if(!qo(t))return!1;let e=t.constructor;if(typeof e>"u")return!0;let o=e.prototype;return!(!qo(o)||!o.hasOwnProperty("isPrototypeOf"))}a(jt,"isPlainObject");function qo(t){return Object.prototype.toString.call(t)==="[object Object]"}a(qo,"hasObjectPrototype");function Ve(t){return Array.isArray(t)&&t.length===Object.keys(t).length}a(Ve,"isPlainArray");function Q(t,e,o){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let r=0,n=t.length;r<n;r++)if(!Q(t[r],e[r],o))return!1;return!0}if(jt(t)&&jt(e)){let r=o?.ignoreUndefined??!0;if(o?.partial){for(let u in e)if((!r||e[u]!==void 0)&&!Q(t[u],e[u],o))return!1;return!0}let n=0;if(!r)n=Object.keys(t).length;else for(let u in t)t[u]!==void 0&&n++;let s=0;for(let u in e)if((!r||e[u]!==void 0)&&(s++,s>n||!Q(t[u],e[u],o)))return!1;return n===s}return!1}a(Q,"deepEqual");var $r=/[\x00-\x1f\x7f"<>`{}]/g;function Br(t){return t.replace($r,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}a(Br,"sanitizePathSegment");function Go(t){let e;try{e=decodeURI(t)}catch{e=t.replaceAll(/%[0-9A-F]{2}/gi,o=>{try{return decodeURI(o)}catch{return o}})}return Br(e)}a(Go,"decodeSegment");var We=["http:","https:","mailto:","tel:"];function it(t,e){if(!t)return!1;try{let o=new URL(t);return!e.has(o.protocol)}catch{return!1}}a(it,"isDangerousProtocol");function Nt(t){if(!t)return{path:t,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(t)&&!t.startsWith("//"))return{path:t,handledProtocolRelativeURL:!1};let e=/%25|%5C/gi,o=0,r="",n;for(;(n=e.exec(t))!==null;)r+=Go(t.slice(o,n.index))+n[0],o=e.lastIndex;r=r+Go(o?t.slice(o):t);let s=!1;return r.startsWith("//")&&(s=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:s}}a(Nt,"decodePath");function Yo(t){return/\s|[^\u0000-\u007F]/.test(t)?t.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):t}a(Yo,"encodePathLikeUrl");function Xo(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}a(Xo,"arraysEqual");function mt(){throw new Error("Invariant failed")}a(mt,"invariant");function Dt(t){let e=new Map,o,r,n=a(s=>{s.next&&(s.prev?(s.prev.next=s.next,s.next.prev=s.prev,s.next=void 0,r&&(r.next=s,s.prev=r)):(s.next.prev=void 0,o=s.next,s.next=void 0,r&&(s.prev=r,r.next=s)),r=s)},"touch");return{get(s){let u=e.get(s);if(u)return n(u),u.value},set(s,u){if(e.size>=t&&o){let l=o;e.delete(l.key),l.next&&(o=l.next,l.next.prev=void 0),l===r&&(r=void 0)}let i=e.get(s);if(i)i.value=u,n(i);else{let l={key:s,value:u,prev:r};r&&(r.next=l),r=l,o||(o=l),e.set(s,l)}},clear(){e.clear(),o=void 0,r=void 0}}}a(Dt,"createLRUCache");var gt=4,Qo=5;function Ur(t){let e=t.indexOf("{");if(e===-1)return null;let o=t.indexOf("}",e);return o===-1||e+1>=t.length?null:[e,o]}a(Ur,"getOpenAndCloseBraces");function ze(t,e,o=new Uint16Array(6)){let r=t.indexOf("/",e),n=r===-1?t.length:r,s=t.substring(e,n);if(!s||!s.includes("$"))return o[0]=0,o[1]=e,o[2]=e,o[3]=n,o[4]=n,o[5]=n,o;if(s==="$"){let i=t.length;return o[0]=2,o[1]=e,o[2]=e,o[3]=i,o[4]=i,o[5]=i,o}if(s.charCodeAt(0)===36)return o[0]=1,o[1]=e,o[2]=e+1,o[3]=n,o[4]=n,o[5]=n,o;let u=Ur(s);if(u){let[i,l]=u,c=s.charCodeAt(i+1);if(c===45){if(i+2<s.length&&s.charCodeAt(i+2)===36){let f=i+3,d=l;if(f<d)return o[0]=3,o[1]=e+i,o[2]=e+f,o[3]=e+d,o[4]=e+l+1,o[5]=n,o}}else if(c===36){let f=i+1,d=i+2;return d===l?(o[0]=2,o[1]=e+i,o[2]=e+f,o[3]=e+d,o[4]=e+l+1,o[5]=t.length,o):(o[0]=1,o[1]=e+i,o[2]=e+d,o[3]=e+l,o[4]=e+l+1,o[5]=n,o)}}return o[0]=0,o[1]=e,o[2]=e,o[3]=n,o[4]=n,o[5]=n,o}a(ze,"parseSegment");function ue(t,e,o,r,n,s,u,i){i?.(o);let l=r;{let c=o.fullPath??o.from,f=o.options,d=c.length,h=f?.caseSensitive??t,m=f?.params?.parse??f?.parseParams;for(;l<d;){let p=ze(c,l,e),v,S=l,y=p[5];l=y+1,s++;let w=p[0];switch(w){case 0:{let R=c.substring(p[2],p[3]),L=R,x;h?x=n.static??=new Map:(L=R.toLowerCase(),x=n.staticInsensitive??=new Map);let _=x.get(L);if(_)v=_;else{let b=Ft(c);b.parent=n,b.depth=s,v=b,x.set(L,b)}break}case 1:case 3:case 2:{let R=c.substring(S,p[1]),L=c.substring(p[4],y),x=h&&!!(R||L),_=R?x?R:R.toLowerCase():void 0,b=L?x?L:L.toLowerCase():void 0,P=w===1?n.dynamic:w===3?n.optional:n.wildcard,E=w!==2&&!m&&P?.find(C=>!C.parse&&C.caseSensitive===x&&C.prefix===_&&C.suffix===b);if(E)v=E;else{let C=Vr(w,c,x,_,b);v=C,C.parent=n,C.depth=s;let T;w===1?T=n.dynamic??=[]:w===3?T=n.optional??=[]:T=n.wildcard??=[],T.push(C),T.length===2&&u?.push(T)}break}}n=v}if(m&&o.children&&!o.isRoot&&o.id&&o.id.charCodeAt(o.id.lastIndexOf("/")+1)===95){let p=Ft(c);p.kind=Qo,p.parent=n,s++,p.depth=s,n.pathless??=[],n.pathless.push(p),n=p}let g=(o.path||!o.children)&&!o.isRoot;if(g&&c.endsWith("/")){let p=Ft(c);p.kind=gt,p.parent=n,s++,p.depth=s,n.index=p,n=p}n.parse=m??null,n.priority=f?.params?.priority??0,g&&!n.route&&(n.route=o,n.fullPath=c)}if(o.children)for(let c of o.children)ue(t,e,c,l,n,s,u,i)}a(ue,"parseSegments");function tn(t,e){if(t.parse&&!e.parse)return-1;if(!t.parse&&e.parse)return 1;if(t.parse&&e.parse&&(t.priority||e.priority))return e.priority-t.priority;if(t.prefix&&e.prefix&&t.prefix!==e.prefix){if(t.prefix.startsWith(e.prefix))return-1;if(e.prefix.startsWith(t.prefix))return 1}if(t.suffix&&e.suffix&&t.suffix!==e.suffix){if(t.suffix.endsWith(e.suffix))return-1;if(e.suffix.endsWith(t.suffix))return 1}return t.prefix&&!e.prefix?-1:!t.prefix&&e.prefix?1:t.suffix&&!e.suffix?-1:!t.suffix&&e.suffix?1:t.caseSensitive&&!e.caseSensitive?-1:!t.caseSensitive&&e.caseSensitive?1:0}a(tn,"sortDynamic");function Ft(t){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0}}a(Ft,"createStaticNode");function Vr(t,e,o,r,n){return{kind:t,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0,caseSensitive:o,prefix:r,suffix:n}}a(Vr,"createDynamicNode");function en(t,e){let o=Ft("/"),r=new Uint16Array(6),n=[];for(let s of t)ue(!1,r,s,1,o,0,n);for(let s of n)s.sort(tn);e.masksTree=o,e.flatCache=Dt(1e3)}a(en,"processRouteMasks");function on(t,e){t||="/";let o=e.flatCache.get(t);if(o)return o;let r=He(t,e.masksTree);return e.flatCache.set(t,r),r}a(on,"findFlatMatch");function nn(t,e,o,r,n){t||="/",r||="/";let s=e?`case\0${t}`:t,u=n.singleCache.get(s);return u||(u=Ft("/"),ue(e,new Uint16Array(6),{from:t},1,u,0),n.singleCache.set(s,u)),He(r,u,o)}a(nn,"findSingleMatch");function rn(t,e,o=!1){let r=o?t:`nofuzz\0${t}`,n=e.matchCache.get(r);if(n!==void 0)return n;t||="/";let s;try{s=He(t,e.segmentTree,o)}catch(u){if(u instanceof URIError)s=null;else throw u}return s&&(s.branch=je(s.route)),e.matchCache.set(r,s),s}a(rn,"findRouteMatch");function Wr(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}a(Wr,"trimPathRight");function sn(t,e=!1,o){let r=Ft(t.fullPath),n=new Uint16Array(6),s=[],u={},i={},l=0;ue(e,n,t,1,r,0,s,c=>{if(o?.(c,l),c.id in u&&mt(),u[c.id]=c,l!==0&&c.path){let f=Wr(c.fullPath);(!i[f]||c.fullPath.endsWith("/"))&&(i[f]=c)}l++});for(let c of s)c.sort(tn);return{processedTree:{segmentTree:r,singleCache:Dt(1e3),matchCache:Dt(1e3),flatCache:null,masksTree:null},routesById:u,routesByPath:i}}a(sn,"processRouteTree");function He(t,e,o=!1){let r=t.split("/"),n=Hr(t,r,e,o);if(!n)return null;let[s]=an(t,r,n);return{route:n.node.route,rawParams:s}}a(He,"findMatch");function an(t,e,o){let r=zr(o.node),n=null,s=Object.create(null),u=o.extract?.part??0,i=o.extract?.node??0,l=o.extract?.path??0,c=o.extract?.segment??0;for(;i<r.length;u++,i++,l++,c++){let f=r[i];if(f.kind===gt)break;if(f.kind===Qo){c--,u--,l--;continue}let d=e[u],h=l;if(d&&(l+=d.length),f.kind===1){n??=o.node.fullPath.split("/");let m=n[c],g=f.prefix?.length??0;if(m.charCodeAt(g)===123){let p=f.suffix?.length??0,v=m.substring(g+2,m.length-p-1),S=d.substring(g,d.length-p);s[v]=decodeURIComponent(S)}else{let p=m.substring(1);s[p]=decodeURIComponent(d)}}else if(f.kind===3){if(o.skipped&1<<i){u--,l=h-1;continue}n??=o.node.fullPath.split("/");let m=n[c],g=f.prefix?.length??0,p=f.suffix?.length??0,v=m.substring(g+3,m.length-p-1),S=f.suffix||f.prefix?d.substring(g,d.length-p):d;S&&(s[v]=decodeURIComponent(S))}else if(f.kind===2){let m=f,g=t.substring(h+(m.prefix?.length??0),t.length-(m.suffix?.length??0)),p=decodeURIComponent(g);s["*"]=p,s._splat=p;break}}return o.rawParams&&Object.assign(s,o.rawParams),[s,{part:u,node:i,path:l,segment:c}]}a(an,"extractParams");function je(t){let e=[t];for(;t.parentRoute;)t=t.parentRoute,e.push(t);return e.reverse(),e}a(je,"buildRouteBranch");function zr(t){let e=Array(t.depth+1);do e[t.depth]=t,t=t.parent;while(t);return e}a(zr,"buildBranch");function Hr(t,e,o,r){if(t==="/"&&o.index)return{node:o.index,skipped:0};let n=!dt(e),s=n&&t!=="/",u=e.length-(n?1:0),i=[{node:o,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],l=null,c=null;for(;i.length;){let f=i.pop(),{node:d,index:h,skipped:m,statics:g,dynamics:p,optionals:v}=f,{extract:S,rawParams:y}=f;if(d.kind===2&&d.route&&!le(c,f))continue;if(d.parse){if(!Zo(t,e,f))continue;y=f.rawParams,S=f.extract}r&&d.route&&d.kind!==gt&&le(l,f)&&(l=f);let w=h===u;if(w&&(d.route&&(!s||d.kind===gt||d.kind===2)&&le(c,f)&&(c=f),!d.optional&&!d.wildcard&&!d.index&&!d.pathless))continue;let R=w?void 0:e[h],L;if(w&&d.index){let x={node:d.index,index:h,skipped:m,statics:g,dynamics:p,optionals:v,extract:S,rawParams:y},_=!0;if(d.index.parse&&(Zo(t,e,x)||(_=!1)),_){if(!p&&!v&&!m&&jr(g,u))return x;le(c,x)&&(c=x)}}if(d.wildcard)for(let x=d.wildcard.length-1;x>=0;x--){let _=d.wildcard[x],{prefix:b,suffix:P}=_;if(!(b&&(w||!(_.caseSensitive?R:L??=R.toLowerCase()).startsWith(b)))){if(P){if(w)continue;let E=e.slice(h).join("/").slice(-P.length);if((_.caseSensitive?E:E.toLowerCase())!==P)continue}i.push({node:_,index:u,skipped:m,statics:g,dynamics:p,optionals:v,extract:S,rawParams:y})}}if(d.optional){let x=m|1<<d.depth+1;for(let _=d.optional.length-1;_>=0;_--){let b=d.optional[_];i.push({node:b,index:h,skipped:x,statics:g,dynamics:p,optionals:v,extract:S,rawParams:y})}if(!w)for(let _=d.optional.length-1;_>=0;_--){let b=d.optional[_],{prefix:P,suffix:E}=b;if(P||E){let C=b.caseSensitive?R:L??=R.toLowerCase();if(P&&!C.startsWith(P)||E&&!C.endsWith(E))continue}i.push({node:b,index:h+1,skipped:m,statics:g,dynamics:p,optionals:v+ce(u,h),extract:S,rawParams:y})}}if(!w&&d.dynamic&&R)for(let x=d.dynamic.length-1;x>=0;x--){let _=d.dynamic[x],{prefix:b,suffix:P}=_;if(b||P){let E=_.caseSensitive?R:L??=R.toLowerCase();if(b&&!E.startsWith(b)||P&&!E.endsWith(P))continue}i.push({node:_,index:h+1,skipped:m,statics:g,dynamics:p+ce(u,h),optionals:v,extract:S,rawParams:y})}if(!w&&d.staticInsensitive){let x=d.staticInsensitive.get(L??=R.toLowerCase());x&&i.push({node:x,index:h+1,skipped:m,statics:g+ce(u,h),dynamics:p,optionals:v,extract:S,rawParams:y})}if(!w&&d.static){let x=d.static.get(R);x&&i.push({node:x,index:h+1,skipped:m,statics:g+ce(u,h),dynamics:p,optionals:v,extract:S,rawParams:y})}if(d.pathless)for(let x=d.pathless.length-1;x>=0;x--){let _=d.pathless[x];i.push({node:_,index:h,skipped:m,statics:g,dynamics:p,optionals:v,extract:S,rawParams:y})}}if(c)return c;if(r&&l){let f=l.index;for(let h=0;h<l.index;h++)f+=e[h].length;let d=f===t.length?"/":t.slice(f);return l.rawParams??=Object.create(null),l.rawParams["**"]=decodeURIComponent(d),l}return null}a(Hr,"getNodeMatch");function ce(t,e){return 2**(t-e-1)}a(ce,"segmentScore");function jr(t,e){return t===2**(e-1)-1}a(jr,"isPerfectStaticMatch");function Zo(t,e,o){let r,n;try{[r,n]=an(t,e,o)}catch{return null}if(o.rawParams=r,o.extract=n,!o.node.parse)return!0;try{if(o.node.parse(r)===!1)return null}catch{}return!0}a(Zo,"validateParseParams");function le(t,e){return t?e.statics>t.statics||e.statics===t.statics&&(e.dynamics>t.dynamics||e.dynamics===t.dynamics&&(e.optionals>t.optionals||e.optionals===t.optionals&&((e.node.kind===gt)>(t.node.kind===gt)||e.node.kind===gt==(t.node.kind===gt)&&e.node.depth>t.node.depth))):!0}a(le,"isFrameMoreSpecific");function Pt(t){return qt(t.filter(e=>e!==void 0).join("/"))}a(Pt,"joinPaths");function qt(t){return t.replace(/\/{2,}/g,"/")}a(qt,"cleanPath");function fe(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}a(fe,"trimPathLeft");function Y(t){let e=t.length;return e>1&&t[e-1]==="/"?t.replace(/\/{1,}$/,""):t}a(Y,"trimPathRight");function Gt(t){return Y(fe(t))}a(Gt,"trimPath");function vt(t,e){return t?.endsWith("/")&&t!=="/"&&t!==`${e}/`?t.slice(0,-1):t}a(vt,"removeTrailingSlash");function de(t,e,o){return vt(t,o)===vt(e,o)}a(de,"exactPathTest");function Ke({base:t,to:e,trailingSlash:o="never",cache:r}){let n=e===".",s=e.startsWith("/"),u;if(r){u=s?e:n?t:t+"\0"+e;let c=r.get(u);if(c)return c}let i;if(n)i=t.split("/");else if(s)i=e.split("/");else{for(i=t.split("/");i.length>1&&dt(i)==="";)i.pop();let c=e.split("/");for(let f=0,d=c.length;f<d;f++){let h=c[f];h===""?f?f===d-1&&i.push(h):i=[h]:h===".."?i.length>1?i.pop():i=[""]:h==="."||i.push(h)}}i.length>1&&(dt(i)===""?o==="never"&&i.pop():o==="always"&&i.push(""));let l=qt(i.join("/"))||"/";return u&&r&&r.set(u,l),l}a(Ke,"resolvePath");function ln(t){let e=new Map(t.map(n=>[encodeURIComponent(n),n])),o=Array.from(e.keys()).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(o,"g");return n=>n.replace(r,s=>e.get(s)??s)}a(ln,"compileDecodeCharMap");function Kt(t,e,o){let r=e[t];return typeof r!="string"?r:t==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(n=>cn(n,o)).join("/"):cn(r,o)}a(Kt,"encodeParam");function he({path:t,params:e,decoder:o,...r}){let n=!1,s=Object.create(null);if(!t||t==="/")return{interpolatedPath:"/",usedParams:s,isMissingParams:n};if(!t.includes("$"))return{interpolatedPath:t,usedParams:s,isMissingParams:n};if(!1){let f=t.length,d=0,h="";for(;d<f;){for(;d<f&&t.charCodeAt(d)===47;)d++;if(d>=f)break;let m=d,g=t.indexOf("/",d);g===-1&&(g=f),d=g;let p=t.substring(m,g);if(p)if(p.charCodeAt(0)===36)if(p.length===1){let v=e._splat;if(s._splat=v,s["*"]=v,!v){n=!0;continue}let S=Kt("_splat",e,o);h+="/"+S}else{let v=p.substring(1);!n&&!(v in e)&&(n=!0),s[v]=e[v];let S=Kt(v,e,o)??"undefined";h+="/"+S}else h+="/"+p}return t.endsWith("/")&&(h+="/"),{usedParams:s,interpolatedPath:h||"/",isMissingParams:n}}let u=t.length,i=0,l,c="";for(;i<u;){let f=i;l=ze(t,f,l);let d=l[5];if(i=d+1,f===d)continue;let h=l[0];if(h===0){c+="/"+t.substring(f,d);continue}if(h===2){let m=e._splat;s._splat=m,s["*"]=m;let g=t.substring(f,l[1]),p=t.substring(l[4],d);if(!m){n=!0,(g||p)&&(c+="/"+g+p);continue}let v=Kt("_splat",e,o);c+="/"+g+v+p;continue}if(h===1){let m=t.substring(l[2],l[3]);!n&&!(m in e)&&(n=!0),s[m]=e[m];let g=t.substring(f,l[1]),p=t.substring(l[4],d),v=Kt(m,e,o)??"undefined";c+="/"+g+v+p;continue}if(h===3){let m=t.substring(l[2],l[3]),g=e[m];if(g==null)continue;s[m]=g;let p=t.substring(f,l[1]),v=t.substring(l[4],d),S=Kt(m,e,o)??"";c+="/"+p+S+v;continue}}return t.endsWith("/")&&(c+="/"),{usedParams:s,interpolatedPath:c||"/",isMissingParams:n}}a(he,"interpolatePath");function cn(t,e){let o=encodeURIComponent(t);return e?.(o)??o}a(cn,"encodePathParam");function K(t){return t?.isNotFound===!0}a(K,"isNotFound");function Kr(){try{return sessionStorage}catch{return}}a(Kr,"getSafeSessionStorage");var qr="tsr-scroll-restoration-v1_3",dn=Kr();function Gr(){try{return JSON.parse(dn?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}a(Gr,"createScrollRestorationCache");function Jr(){try{dn?.setItem(qr,JSON.stringify(At))}catch{}}a(Jr,"persistScrollRestorationCache");var At=Gr(),un="data-scroll-restoration-id",Yr=a(t=>t.state.__TSR_key||t.href,"defaultGetScrollRestorationKey");function Xr(t){let e=t.getAttribute(un);if(e)return`[${un}="${e}"]`;let o="",r=t,n;for(;n=r.parentNode;){let s=1,u=r;for(;u=u.previousElementSibling;)s++;let i=`${r.localName}:nth-child(${s})`;o=o?`${i} > ${o}`:i,r=n}return o}a(Xr,"getScrollRestorationSelector");var pe=!1,me="window";function qe(t){try{return typeof t=="function"?t():document.querySelector(t)}catch{}}a(qe,"getElement");function fn(t){let e=new Set;for(let o of t){if(o===me)continue;let r=qe(o);r&&e.add(r)}return e}a(fn,"getScrollToTopElements");function hn(t,e){let o=e??t.options.scrollRestoration,r=t._scroll;if(o&&(r.restoring=!0),!1)return;let n=t.options.getScrollRestorationKey||Yr,s=new Set,u=a(i=>{let l=At[i]||={};for(let c of s)c===document?l[me]={scrollX,scrollY}:c.isConnected&&(l[Xr(c)]={scrollX:c.scrollLeft,scrollY:c.scrollTop})},"snapshotCurrentScrollTargets");o&&!r.restoration&&(r.restoration=!0,pe=!1,history.scrollRestoration="manual",document.addEventListener("scroll",i=>{pe||s.add(i.target)},!0),t.subscribe("onBeforeLoad",i=>{i.fromLocation&&u(n(i.fromLocation)),s.clear()}),addEventListener("pagehide",()=>{u(n(t.stores.resolvedLocation.get()??t.stores.location.get())),Jr()})),!r.reset&&(r.reset=!0,t.subscribe("onRendered",i=>{let l=t.options.scrollRestorationBehavior,c=t.options.scrollToTopSelectors,f=r.next,d=r.hash,h;if(s.clear(),r.next=!0,r.hash=!1,typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return;let m=n(i.toLocation),g=i.fromLocation&&n(i.fromLocation);if(r.restoring&&g&&g!==m){let p=At[g];if(p){let v=At[m];for(let S in p){if(S===me){if(f)continue}else{let y=qe(S);if(!y||f&&c&&(h??=fn(c),h.has(y)))continue}v||(v=At[m]={}),v[S]??=p[S]}}}pe=!0;try{let p=i.toLocation.hash,v=i.toLocation.state.__hashScrollIntoViewOptions??!0,S=!1;if(f){!p&&c&&(h??=fn(c));let y=p&&v&&d,w=r.restoring?At[m]:void 0;if(w)for(let R in w){let{scrollX:L,scrollY:x}=w[R];if(R===me){if(y)continue;scrollTo({top:x,left:L,behavior:l}),S=!0}else{let _=qe(R);_&&(_.scrollLeft=L,_.scrollTop=x,h?.delete(_))}}if(!p){let R={top:0,left:0,behavior:l};if(S||scrollTo(R),h)for(let L of h)L.scrollTo(R)}}!S&&p&&v&&document.getElementById(p)?.scrollIntoView(v)}finally{pe=!1}}))}a(hn,"setupScrollRestoration");function pn(t,e=String){let o=new URLSearchParams;for(let r in t){let n=t[r];n!==void 0&&o.set(r,e(n))}return o.toString()}a(pn,"encode");function Ge(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}a(Ge,"toValue");function mn(t){let e=new URLSearchParams(t),o=Object.create(null);for(let[r,n]of e.entries()){let s=o[r];s==null?o[r]=Ge(n):Array.isArray(s)?s.push(Ge(n)):o[r]=[s,Ge(n)]}return o}a(mn,"decode");var Zr=/^(?:\s|["[{\d-]|fa|nu|tr)/,gn=Qr(JSON.parse),vn=ts(JSON.stringify,JSON.parse);function Qr(t){return e=>{e[0]==="?"&&(e=e.substring(1));let o=mn(e);for(let r in o){let n=o[r];if(typeof n=="string")try{o[r]=t(n)}catch{}}return o}}a(Qr,"parseSearchWith");function ts(t,e){let o=e===JSON.parse;function r(n){if(n&&typeof n=="object")try{return t(n)}catch{}else if(e&&typeof n=="string"){if(o&&!Zr.test(n))return n;try{return e(n),t(n)}catch{}}return n}return a(r,"stringifyValue"),n=>{let s=pn(n,r);return s?`?${s}`:""}}a(ts,"stringifySearchWith");var tt="__root__";function yn(t){if(t.statusCode=t.statusCode||t.code||307,!t._builtLocation&&!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}let e=new Headers(t.headers);t.href&&e.get("Location")===null&&e.set("Location",t.href);let o=new Response(null,{status:t.statusCode,headers:e});if(o.options=t,t.throw)throw o;return o}a(yn,"redirect");function Jt(t){return t instanceof Response&&!!t.options}a(Jt,"isRedirect");function _n(t){return{input:a(({url:e})=>{for(let o of t)e=ge(o,e);return e},"input"),output:a(({url:e})=>{for(let o=t.length-1;o>=0;o--)e=Je(t[o],e);return e},"output")}}a(_n,"composeRewrites");function Sn(t){let e=Gt(t.basepath),o=`/${e}`,r=t.caseSensitive?o:o.toLowerCase(),n=`${r}/`;return{input:a(({url:s})=>{let u=t.caseSensitive?s.pathname:s.pathname.toLowerCase();return u===r?s.pathname="/":u.startsWith(n)&&(s.pathname=s.pathname.slice(o.length)),s},"input"),output:a(({url:s})=>(s.pathname=Pt(["/",e,s.pathname]),s),"output")}}a(Sn,"rewriteBasepath");function ge(t,e){let o=t?.input?.({url:e});if(o){if(typeof o=="string")return new URL(o);if(o instanceof URL)return o}return e}a(ge,"executeRewriteInput");function Je(t,e){let o=t?.output?.({url:e});if(o){if(typeof o=="string")return new URL(o);if(o instanceof URL)return o}return e}a(Je,"executeRewriteOutput");function Ye(t){let e=t;return{get(){return e},set(o){e=J(o,e)}}}a(Ye,"createNonReactiveMutableStore");function Xe(t){return{get(){return t()}}}a(Xe,"createNonReactiveReadonlyStore");function Rn(t,e){let{createMutableStore:o,createReadonlyStore:r,batch:n}=e,s=new Map,u=o("idle"),i=o(t),l=o(void 0),c=o([]),f=r(()=>c.get().map(p=>s.get(p).get())),d=r(()=>({status:u.get(),isLoading:u.get()==="pending",matches:f.get(),location:i.get(),resolvedLocation:l.get()}));function h(p){let v=s.get(p);return v||(v=o(void 0),s.set(p,v)),v}a(h,"getMatchStore");let m={status:u,location:i,resolvedLocation:l,ids:c,matches:f,byRoute:s,__store:d,getMatchStore:h,setMatches:g};function g(p){let v=c.get(),S=p.map(y=>y.routeId);n(()=>{Xo(v,S)||c.set(S);for(let y of v)S.includes(y)||s.get(y).set(()=>{});for(let y of p){let w=h(y.routeId);w.get()!==y&&w.set(y)}})}return a(g,"setMatches"),m}a(Rn,"createRouterStores");var yt="__TSR_index",wn="popstate",xn="beforeunload";function Qe(t){let e=t.getLocation(),o=new Set,r=a(u=>{e=t.getLocation(),o.forEach(i=>i({location:e,action:u}))},"notify"),n=a(u=>{t.notifyOnIndexChange??!0?r(u):e=t.getLocation()},"handleIndexChange"),s=a(async({task:u,navigateOpts:i,...l})=>{if(i?.ignoreBlocker??!1){u();return}let c=t.getBlockers?.()??[],f=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&c.length&&f)for(let d of c){let h=$t(l.path,l.state);if(await d.blockerFn({currentLocation:e,nextLocation:h,action:l.type})){t.onBlocked?.();return}}u()},"tryNavigation");return{get location(){return e},get length(){return t.getLength()},subscribers:o,subscribe:a(u=>(o.add(u),()=>{o.delete(u)}),"subscribe"),push:a((u,i,l)=>{let c=e.state[yt];i=Ze(c+1,i),s({task:a(()=>{t.pushState(u,i),r({type:"PUSH"})},"task"),navigateOpts:l,type:"PUSH",path:u,state:i})},"push"),replace:a((u,i,l)=>{let c=e.state[yt];i=Ze(c,i),s({task:a(()=>{t.replaceState(u,i),r({type:"REPLACE"})},"task"),navigateOpts:l,type:"REPLACE",path:u,state:i})},"replace"),go:a((u,i)=>{s({task:a(()=>{t.go(u),n({type:"GO",index:u})},"task"),navigateOpts:i,type:"GO"})},"go"),back:a(u=>{s({task:a(()=>{t.back(u?.ignoreBlocker??!1),n({type:"BACK"})},"task"),navigateOpts:u,type:"BACK"})},"back"),forward:a(u=>{s({task:a(()=>{t.forward(u?.ignoreBlocker??!1),n({type:"FORWARD"})},"task"),navigateOpts:u,type:"FORWARD"})},"forward"),canGoBack:a(()=>e.state[yt]!==0,"canGoBack"),createHref:a(u=>t.createHref(u),"createHref"),block:a(u=>{if(!t.setBlockers)return()=>{};let i=t.getBlockers?.()??[];return t.setBlockers([...i,u]),()=>{let l=t.getBlockers?.()??[];t.setBlockers?.(l.filter(c=>c!==u))}},"block"),flush:a(()=>t.flush?.(),"flush"),destroy:a(()=>t.destroy?.(),"destroy"),notify:r}}a(Qe,"createHistory");function Ze(t,e){e||(e={});let o=eo();return{...e,key:o,__TSR_key:o,[yt]:t}}a(Ze,"assignKeyAndIndex");function to(t){let e=t?.window??(typeof document<"u"?window:void 0),o=e.history.pushState,r=e.history.replaceState,n=[],s=a(()=>n,"_getBlockers"),u=a(_=>n=_,"_setBlockers"),i=t?.createHref??(_=>_),l=t?.parseLocation??(()=>$t(`${e.location.pathname}${e.location.search}${e.location.hash}`,e.history.state));if(!e.history.state?.__TSR_key&&!e.history.state?.key){let _=eo();e.history.replaceState({[yt]:0,key:_,__TSR_key:_},"")}let c=l(),f,d=!1,h=!1,m=!1,g=!1,p=a(()=>c,"getLocation"),v,S=a(()=>{v&&(x._ignoreSubscribers=!0,(v[2]?e.history.pushState:e.history.replaceState)(v[1],"",v[0]),x._ignoreSubscribers=!1,v=void 0,f=void 0)},"flush"),y=a((_,b,P)=>{let E=i(b),C=!!v;C||(f=c),c=$t(b,P),v=[E,P,v?.[2]||_],C||queueMicrotask(()=>S())},"queueHistoryAction"),w=a(_=>{c=l(),x.notify({type:_})},"onPushPop"),R=a(async()=>{if(h){h=!1;return}let _=l(),b=_.state[yt]-c.state[yt],P=b===1,E=b===-1,C=!P&&!E||d;d=!1;let T=C?"GO":E?"BACK":"FORWARD",D=C?{type:"GO",index:b}:{type:E?"BACK":"FORWARD"};if(m)m=!1;else{let wt=s();if(typeof document<"u"&&wt.length){for(let rt of wt)if(await rt.blockerFn({currentLocation:c,nextLocation:_,action:T})){h=!0,e.history.go(1),x.notify(D);return}}}c=l(),x.notify(D)},"onPushPopEvent"),L=a(_=>{if(g){g=!1;return}let b=!1,P=s();if(typeof document<"u"&&P.length)for(let E of P){let C=E.enableBeforeUnload??!0;if(C===!0){b=!0;break}if(typeof C=="function"&&C()===!0){b=!0;break}}if(b)return _.preventDefault(),_.returnValue=""},"onBeforeUnload"),x=Qe({getLocation:p,getLength:a(()=>e.history.length,"getLength"),pushState:a((_,b)=>y(!0,_,b),"pushState"),replaceState:a((_,b)=>y(!1,_,b),"replaceState"),back:a(_=>(_&&(m=!0),g=!0,e.history.back()),"back"),forward:a(_=>{_&&(m=!0),g=!0,e.history.forward()},"forward"),go:a(_=>{d=!0,e.history.go(_)},"go"),createHref:a(_=>i(_),"createHref"),flush:S,destroy:a(()=>{e.history.pushState=o,e.history.replaceState=r,e.removeEventListener(xn,L,{capture:!0}),e.removeEventListener(wn,R)},"destroy"),onBlocked:a(()=>{f&&c!==f&&(c=f)},"onBlocked"),getBlockers:s,setBlockers:u,notifyOnIndexChange:!1});return e.addEventListener(xn,L,{capture:!0}),e.addEventListener(wn,R),e.history.pushState=function(..._){let b=o.apply(e.history,_);return x._ignoreSubscribers||w("PUSH"),b},e.history.replaceState=function(..._){let b=r.apply(e.history,_);return x._ignoreSubscribers||w("REPLACE"),b},x}a(to,"createBrowserHistory");function es(t={initialEntries:["/"]}){let e=t.initialEntries,o=t.initialIndex?Math.min(Math.max(t.initialIndex,0),e.length-1):e.length-1,r=e.map((l,c)=>Ze(c,void 0)),n=a(()=>$t(e[o],r[o]),"getLocation"),s=[];return Qe({getLocation:n,getLength:a(()=>e.length,"getLength"),pushState:a((l,c)=>{o<e.length-1&&(e.splice(o+1),r.splice(o+1)),r.push(c),e.push(l),o=Math.max(e.length-1,0)},"pushState"),replaceState:a((l,c)=>{r[o]=c,e[o]=l},"replaceState"),back:a(()=>{o=Math.max(o-1,0)},"back"),forward:a(()=>{o=Math.min(o+1,e.length-1)},"forward"),go:a(l=>{o=Math.min(Math.max(o+l,0),e.length-1)},"go"),createHref:a(l=>l,"createHref"),getBlockers:a(()=>s,"_getBlockers"),setBlockers:a(l=>s=l,"_setBlockers")})}a(es,"createMemoryHistory");function os(t){let e=t.replace(/[\x00-\x1f\x7f]/g,"");return e.startsWith("//")&&(e="/"+e.replace(/^\/+/,"")),e}a(os,"sanitizePath");function $t(t,e){let o=os(t),r=o.indexOf("#"),n=o.indexOf("?"),s=eo();return{href:o,pathname:o.substring(0,r>0?n>0?Math.min(r,n):r:n>0?n:o.length),hash:r>-1?o.substring(r):"",search:n>-1?o.slice(n,r===-1?void 0:r):"",state:e||{[yt]:0,key:s,__TSR_key:s}}}a($t,"parseHref");function eo(){return(Math.random()+1).toString(36).substring(7)}a(eo,"createRandomKey");function bn(t){return t.options.loader||t.options.beforeLoad||t.lazyFn||t.options.component?.preload||t.options.pendingComponent?.preload}a(bn,"routeNeedsLoad");function Ct(t,e){return{fromLocation:e,toLocation:t,pathChanged:e?.pathname!==t.pathname,hrefChanged:e?.href!==t.href,hashChanged:e?.hash!==t.hash}}a(Ct,"getLocationChangeInfo");function Pn({key:t,__TSR_key:e,__TSR_index:o,__hashScrollIntoViewOptions:r,...n}){return n}a(Pn,"_getUserHistoryState");function En(t,e,o,r){for(let n of e){if(r?.()===!1)return;o.some(s=>s.routeId===n.routeId)||t.routesById[n.routeId].options.onLeave?.(n)}for(let n of o){if(r?.()===!1)return;t.routesById[n.routeId].options[e.some(s=>s.routeId===n.routeId)?"onStay":"onEnter"]?.(n)}}a(En,"runRouteLifecycle");var oo=class{static{a(this,"RouterCore")}constructor(t,e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async o=>(o(),!1),this.update=o=>{let r=this.options,n=this.basepath??r?.basepath??"/",s=this.basepath===void 0,u=r?.rewrite;if(this.options={...r,...o},this.isServer=this.options.isServer??!1??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=ln(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=to()),this.origin=this.options.origin,this.origin||(!!1&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let c;if(!1){let f=globalThis.__TSR_CACHE__;this.resolvePathCache=f.resolvePathCache,c=f.processRouteTreeResult}else this.resolvePathCache=Dt(1e3),c=this.buildRouteTree(),!1;this.setRoutes(c)}if(!this.stores&&this.latestLocation){let c=this.getStoreConfig(this);this.batch=c.batch,this.stores=Rn(this.latestLocation,c),hn(this)}let i=this.options.basepath??"/",l=this.options.rewrite;if(s||n!==i||u!==l){this.basepath=i;let c=[],f=Gt(i);f&&f!=="/"&&c.push(Sn({basepath:i})),l&&c.push(l),this.rewrite=c.length===0?void 0:c.length===1?c[0]:_n(c),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let o=sn(this.routeTree,this.options.caseSensitive,(r,n)=>{r.init({originalIndex:n})});return this.options.routeMasks&&en(this.options.routeMasks,o.processedTree),o},this.subscribe=(o,r)=>{let n={eventType:o,fn:r};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=o=>{for(let r of this.subscribers)if(r.eventType===o.type)try{r.fn(o)}catch(n){console.error(n)}},this.parseLocation=(o,r)=>{let n=a(({pathname:l,search:c,hash:f,href:d,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){let S=this.options.parseSearch(c),y=this.options.stringifySearch(S);return{href:l+y+f,publicHref:l+y+f,pathname:Nt(l).path,external:!1,searchStr:y,search:pt(r?.search,S),hash:Nt(f.slice(1)).path,state:st(r?.state,h)}}let m=new URL(d,this.origin),g=ge(this.rewrite,m),p=this.options.parseSearch(g.search),v=this.options.stringifySearch(p);return g.search=v,{href:g.href.replace(g.origin,""),publicHref:d,pathname:Nt(g.pathname).path,external:!!this.rewrite&&g.origin!==this.origin,searchStr:v,search:pt(r?.search,p),hash:Nt(g.hash.slice(1)).path,state:st(r?.state,h)}},"parse"),s=n(o),{__tempLocation:u,__tempKey:i}=s.state;if(u&&(!i||i===this.tempLocationKey)){let l=n(u);return l.state.key=s.state.key,l.state.__TSR_key=s.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:s}}return s},this.resolvePathWithBase=(o,r)=>Ke({base:o,to:r.includes("//")?qt(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(o,r,n)=>typeof o=="string"?this.matchRoutesInternal({pathname:o,search:r},n):this.matchRoutesInternal(o,r),this.getMatchedRoutes=o=>{let r=Object.create(null),n=rn(Y(o),this.processedTree,!0);return n&&Object.assign(r,n.rawParams),[n?.branch||[this.routesById.__root__],r,n?.route]},this.buildLocation=o=>{let r=a((s={})=>{let u=s._fromLocation||this._pendingLocation||this.latestLocation,i=this.matchRoutesLightweight(u);s.from;let l=s.unsafeRelative==="path"?u.pathname:s.from??i[1],c=s.to?`${s.to}`:void 0,f=i[2],d=Object.assign(Object.create(null),i[3]),h=c?.charCodeAt(0)===47?"/":this.resolvePathWithBase(l,"."),m=c?this.resolvePathWithBase(h,c):h,g=Cn(s.params,d),p=this.routesByPath[Y(m)],v;if(p)v=this.getRouteBranch(p);else if(m.includes("$"))v=[];else{let[C,T,D]=this.getMatchedRoutes(m);v=C,this.options.notFoundRoute&&(!D||D.path!=="/"&&T["**"])&&(v=[...v,this.options.notFoundRoute])}if(v.length&&ht(g))for(let C of v){let T=C.options.params?.stringify??C.options.stringifyParams;if(T)try{Object.assign(g,T(g))}catch{}}let S=o.leaveParams?m:Nt(he({path:m,params:g,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,y=f;if(o._includeValidateSearch&&this.options.search?.strict){let C={};v.forEach(T=>{if(T.options.validateSearch)try{Object.assign(C,ve(T.options.validateSearch,{...C,...y}))}catch{}}),y=C}y=ns(y,s,v,o._includeValidateSearch),y=pt(f,y);let w=this.options.stringifySearch(y),R=s.hash===!0?u.hash:s.hash?J(s.hash,u.hash):void 0,L=R?`#${R}`:"",x=s.state===!0?u.state:s.state?J(s.state,u.state):{};x=st(u.state,x);let _=`${S}${w}${L}`,b,P,E=!1;if(this.rewrite){let C=new URL(_,this.origin),T=Je(this.rewrite,C);b=C.href.replace(C.origin,""),T.origin!==this.origin?(P=T.href,E=!0):P=T.pathname+T.search+T.hash}else b=Yo(_),P=b;return{publicHref:P,href:b,pathname:S,search:y,searchStr:w,state:x,hash:R??"",external:E,unmaskOnReload:s.unmaskOnReload}},"build"),n=a((s={},u)=>{let i=r(s),l=u?r(u):void 0;if(!l){let c=Object.create(null);if(this.options.routeMasks){let f=on(i.pathname,this.processedTree);if(f){Object.assign(c,f.rawParams);let{from:d,params:h,...m}=f.route,g=Cn(h,c);u={from:o.from,...m,params:g},l=r(u)}}}return l&&(i.maskedLocation=l),i},"buildWithMatches");return o.mask?n(o,{from:o.from,...o.mask}):n(o)},this.commitLocation=async({viewTransition:o,ignoreBlocker:r,...n})=>{let s,u=Y(this.latestLocation.href)===Y(n.href)&&Q(Pn(n.state),Pn(this.latestLocation.state)),i=this._commitPromise,l,c=new Promise(f=>{l=f});if(c.resolve=()=>{l(),i?.resolve()},this._commitPromise=c,u)this.load();else{let{maskedLocation:f,hashScrollIntoView:d,...h}=n;f&&(h={...f,state:{...f.state,__tempKey:void 0,__tempLocation:{...h,search:h.searchStr,state:{...h.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(h.unmaskOnReload??this.options.unmaskOnReload??!1)&&(h.state.__tempKey=this.tempLocationKey)),h.state.__hashScrollIntoViewOptions=d??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=o,s=n.replace?"REPLACE":"PUSH",this.history[s==="REPLACE"?"replace":"push"](h.publicHref,h.state,{ignoreBlocker:r}),this.history.subscribers.size||this.load({action:{type:s}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:o,resetScroll:r,hashScrollIntoView:n,viewTransition:s,ignoreBlocker:u,_redirects:i,href:l,...c}={})=>{if(l){let h=this.history.location.state.__TSR_index,m=$t(l,{__TSR_index:o?h:h+1}),g=new URL(m.pathname,this.origin);c.to=ge(this.rewrite,g).pathname,c.search=this.options.parseSearch(m.search),c.hash=m.hash.slice(1)}let f=this.buildLocation({...c,_includeValidateSearch:!0});i&&(f._redirects=i),this._pendingLocation=f;let d=this.commitLocation({...f,viewTransition:s,replace:o,resetScroll:r,hashScrollIntoView:n,ignoreBlocker:u});return queueMicrotask(()=>{this._pendingLocation===f&&(this._pendingLocation=void 0)}),d},this.navigate=async({to:o,reloadDocument:r,href:n,publicHref:s,...u})=>{let i=!1;if(n)try{new URL(`${n}`),i=!0}catch{}if(i&&!r&&(r=!0),r){if(o!==void 0||!n){let c=this.buildLocation({to:o,...u});n=n??c.publicHref,s=s??c.publicHref}let l=!i&&s?s:n;if(it(l,this.protocolAllowlist))return;if(!u.ignoreBlocker){let c=this.history.getBlockers?.()??[];for(let f of c)if(f?.blockerFn&&await f.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}u.replace?window.location.replace(l):window.location.href=l;return}return this.buildAndCommitLocation({...u,href:n,to:o,_isNavigate:!0})},this.load=async o=>{if(!1)return(void 0)(this,o);this.updateLatestLocation(),o?.action&&(this._scroll.hash=o.action.type==="PUSH"||o.action.type==="REPLACE"),await In(this,o)},this.startViewTransition=o=>{let r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&!!1&&typeof document.startViewTransition=="function"){let n;if(typeof r=="object"&&window.CSS?.supports?.("selector(:active-view-transition-type(a))")){let s=this.latestLocation,u=this.stores.resolvedLocation.get(),i=typeof r.types=="function"?r.types(Ct(s,u)):r.types;if(i===!1)return o();n={update:o,types:i}}else n=o;return document.startViewTransition(n).updateCallbackDone}return o()},this.invalidate=o=>{let r=this._committed,n=o?.filter,s=this._preloads,u=new Set([...r,...this._cache.values(),...[...s?.values()??[]].flat(),...this._tx?.[3]??[]].filter(c=>!n||n(c)).map(c=>c.id)),i=[];for(let[c,f]of s??[])f.some(d=>u.has(d.id))&&(s.delete(c),i.push(c));let l=a(c=>{if(u.has(c.id)){let f=this.routesById[c.routeId],d={...c,invalid:!0,...(o?.forcePending||c.status==="error"||c.status==="notFound")&&bn(f)?{status:"pending",error:void 0}:void 0};return c._flight=void 0,d}return c},"invalidate");this._committed=r.map(l);for(let[c,f]of this._cache)u.has(c)&&(f.invalid=!0,o?.forcePending&&(f.status="pending"));for(let c of u)this._flights?.delete(c);for(let c of i)c.abort();return this.shouldViewTransition=!1,this.load({sync:o?.sync})},this.resolveRedirect=o=>{let r=o.headers.get("Location");if(!o.options.href||o.options._builtLocation){let n=(o.options._builtLocation??this.buildLocation(o.options)).publicHref||"/";o.options.href=n,o.headers.set("Location",n)}else if(r)try{let n=new URL(r);if(this.origin&&n.origin===this.origin){let s=n.pathname+n.search+n.hash;o.options.href=s,o.headers.set("Location",s)}}catch{}if(o.options.href&&!o.options._builtLocation&&it(o.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return o.headers.get("Location")||o.headers.set("Location",o.options.href),o},this.clearCache=o=>{let r=this._cache,n=this._preloads,s=o?.filter,u=[],i=[];for(let[c,f]of r)(!s||s(f))&&(i.push(c),u.push(f));let l=[];for(let[c,f]of n??[])(!s||f.some(s))&&(l.push(c),u.push(...f));for(let c of i)r.delete(c);for(let c of l)n.delete(c);for(let c of u){let f=c._flight;c._flight=void 0,f&&!--f[2]&&(this._flights?.get(c.id)===f&&this._flights.delete(c.id),l.push(f[1]))}for(let c of l)c.abort()},this.loadRouteChunk=Lt,this.preloadRoute=o=>no(this,o),this.matchRoute=(o,r)=>{let n={...o,to:o.to?this.resolvePathWithBase(o.from||"",o.to):void 0,params:o.params||{},leaveParams:!0},s=this.buildLocation(n),u=this.stores.status.get()==="pending";if(r?.pending&&!u)return!1;let i=r?.pending??!u?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),l=nn(s.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,i.pathname,this.processedTree);return!l||o.params&&!Q(l.rawParams,o.params,{partial:!0})?!1:r?.includeSearch??!0?Q(i.search,s.search,{partial:!0})?l.rawParams:!1:l.rawParams},this.getStoreConfig=e,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??vn,parseSearch:t.parseSearch??gn,protocolAllowlist:t.protocolAllowlist??We}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:t,routesByPath:e,processedTree:o}){this.routesById=t,this.routesByPath=e,this.processedTree=o;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(t){let e=this.routeBranchCache.get(t);return e||(e=je(t),this.routeBranchCache.set(t,e)),e}matchRoutesInternal(t,e){let[o,r,n]=this.getMatchedRoutes(t.pathname),s=o,u=!1;(n?n.path!=="/"&&r["**"]:Y(t.pathname))&&(this.options.notFoundRoute?s=[...s,this.options.notFoundRoute]:u=!0);let i=u?rs(this.options.notFoundMode,s):void 0,l=new Array(s.length),c=this._committed,f=a((h,m)=>{let g=c[m];return g?.routeId===h.id?g:h===this.options.notFoundRoute?c.find(p=>p.routeId===h.id):void 0},"previousAt"),d;for(let h=0;h<s.length;h++){let m=s[h],g=l[h-1],p,v,S;{let D=g?.search??t.search,wt=g?._strictSearch??void 0;try{let rt=ve(m.options.validateSearch,{...D})??void 0;p={...D,...rt},v={...wt,...rt}}catch(rt){let re=rt;if(rt instanceof Yt||(re=new Yt(rt.message,{cause:rt})),e?.throwOnError)throw re;p=D,v={},S=re}}let y="",w="";try{y=m.options.loaderDeps?.({search:p})??"",w=y&&JSON.stringify(y)||""}catch(D){if(e?.throwOnError)throw D;S??=D}let{interpolatedPath:R,usedParams:L}=he({path:m.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),x=m.id+R+w,_=f(m,h),b=this._cache.get(x)??(_?.id===x?_:void 0);d=b?._strictParams??Object.assign(L,d);let P;if(!b)try{Ln(m,d)}catch(D){if(K(D)||Jt(D)?P=D:P=new kn(D.message,{cause:D}),e?.throwOnError)throw P}let E=_?"stay":"enter",C;if(b)C={...b,cause:E,search:_?pt(_.search,p):pt(b.search,p),_strictSearch:v,searchError:S};else{let D=bn(m)?"pending":"success";C={id:x,ssr:m.options.ssr,index:h,routeId:m.id,params:_?.params??d,_strictParams:d,pathname:R,updatedAt:Date.now(),search:_?pt(_.search,p):p,_strictSearch:v,searchError:S,status:D,isFetching:!1,error:void 0,paramsError:P,context:{},abortController:e?._controller??new AbortController,cause:E,loaderDeps:_?st(_.loaderDeps,y):y,invalid:!1,preload:!1,staticData:m.options.staticData||{},fullPath:m.fullPath}}let T=i===m.id;C._notFound&&!T&&(C.error=void 0),C._notFound=T,l[h]=C}for(let h=0;h<l.length;h++){let m=l[h];m.params=m.cause==="stay"?pt(m.params,d):d,e?._controller&&(m.context={})}return l}matchRoutesLightweight(t){let e=dt(this.stores.ids.get()),o=e?this.stores.byRoute.get(e).get():void 0,r=o?.id,n=this.lightweightCache.get(t);if(n&&n[0]===r)return n[1];let[s,u]=this.getMatchedRoutes(t.pathname),i=dt(s),l={...t.search};for(let h of s)try{Object.assign(l,ve(h.options.validateSearch,l))}catch{}let c=o&&o.routeId===i.id&&o.pathname===t.pathname,f;if(c)f=o.params;else{let h=Object.assign(Object.create(null),u);for(let m of s)try{Ln(m,h)}catch{}f=h}let d=[s,i.fullPath,l,f];return this.lightweightCache.set(t,[r,d]),d}},Yt=class extends Error{static{a(this,"SearchParamError")}},kn=class extends Error{static{a(this,"PathParamError")}};function ve(t,e){if(t==null)return{};if("~standard"in t){let o=t["~standard"].validate(e);if(o instanceof Promise)throw new Yt("Async validation not supported");if(o.issues)throw new Yt(JSON.stringify(o.issues,void 0,2),{cause:o});return o.value}return"parse"in t?t.parse(e):typeof t=="function"?t(e):{}}a(ve,"validateSearch");function ns(t,e,o,r){let n=[];for(let u of o){let i=u.options;if("search"in i)i.search?.middlewares&&n.push(...i.search.middlewares);else if(i.preSearchFilters||i.postSearchFilters){let c=a(({search:f,next:d})=>{let h=d(i.preSearchFilters?i.preSearchFilters.reduce((m,g)=>g(m),f):f);return i.postSearchFilters?i.postSearchFilters.reduce((m,g)=>g(m),h):h},"legacyMiddleware");n.push(c)}let l=i.validateSearch;if(l){let c=a(({search:f,next:d,meta:h})=>{let m=d(f);if(r)try{let g=ve(l,m);if(h&&g)for(let p in g)p in m||(h.defaulted||=new Map).set(p,g[p]);return{...m,...g}}catch{}return m},"validate");n.push(c)}}let s=a((u,i,l)=>{if(u>=n.length){if(!e.search)return{};if(e.search===!0)return i;let f=J(e.search,i);return l&&(l.explicit=f),f}let c=a((f,d)=>{if(d){let h=l||{};return{search:s(u+1,f,h),meta:h}}return s(u+1,f,l)},"next");return n[u]({search:i,next:c,meta:l})},"applyNext");return s(0,t)}a(ns,"applySearchMiddleware");function rs(t,e){if(t!=="root"){let o;for(let r=e.length-1;r>=0;r--){let n=e[r];if(n.options.notFoundComponent)return n.id;o||=n.children&&n.id}if(o)return o}return tt}a(rs,"findGlobalNotFoundRouteId");function Cn(t,e){return t===!1||t===null?Object.create(null):(t??!0)===!0?e:Object.assign(e,J(t,e))}a(Cn,"resolveNextParams");function Ln(t,e){let o=t.options.params?.parse??t.options.parseParams;o&&Object.assign(e,o(e))}a(Ln,"extractStrictParams");function ro(t,e){return t.options[e]?.preload?.()}a(ro,"preloadComponent");function ss(t,e){let o=ro(t,"component"),r=ro(t,"pendingComponent"),n=e&&r?r.then(e):r;return e&&!r&&e(),o&&n?Promise.all([o,n]).then(()=>{}):o??n}a(ss,"loadComponents");function Lt(t,e,o){let r=a(()=>e===!1?void 0:e?ro(t,e):ss(t,o),"afterLazy"),n=t._lazy;if(n)return n===!0?r():n.then(r);if(!t.lazyFn)return r();let s=t.lazyFn().then(u=>{{let{id:i,...l}=u.options;Object.assign(t.options,l),t._lazy=!0}},u=>{throw t._lazy=void 0,u});return t._lazy=s,s.then(r)}a(Lt,"loadRouteChunk");function Fn(t){let e=t.findIndex(o=>o.status!=="success"||o._notFound)+1;return e&&e<t.length?t.slice(0,e):t}a(Fn,"_getRenderedMatches");var at=0,_t=1,_e=2,et=3,kt=4;function Zt(t){return typeof t[0]=="number"}a(Zt,"isControl");function St(t,e){return e.aborted?Promise.race([Promise.reject(e),t]):new Promise((o,r)=>{let n=a(()=>r(e),"abort");e.addEventListener("abort",n,{once:!0}),Promise.resolve(t).then(o,r).finally(()=>e.removeEventListener("abort",n))})}a(St,"waitFor");function It(t,e){return t.routesById[e.routeId]}a(It,"getRoute");function Qt(t,e,o){return Jt(t)?[et,t]:K(t)?(t.routeId||=o,[_e,t]):(e&&typeof t?.then=="function"&&(t=new Error("A Promise was thrown",{cause:t})),e?[_t,t]:[at,t])}a(Qt,"normalize");function An(t,e){let o=Qt(e,!0,t.id);if(o[0]!==_t)return o;try{t.options.onError?.(o[1])}catch(r){o=Qt(r,!0,t.id)}return o}a(An,"normalizeError");function Xt(t,e,o){return o[0].signal.aborted||!o[2]()?(o[0].abort(),[kt]):An(t,e)}a(Xt,"normalizeLaneError");function $n(t,e){return o=>t.navigate({...o,_fromLocation:e})}a($n,"navigateFrom");async function is(t,e,o,r,n,s){let[u,i]=e,l=o[0].signal,c=!!o[4];for(let f=o[7]??0;f<r;f++){let d=i[f],h=It(t,d);d.abortController=o[0];let m=i[f-1]?.context??t.options.context??{},g={params:d.params,location:u,navigate:$n(t,u),buildLocation:t.buildLocation,cause:c?"preload":d.cause,abortController:o[0],preload:c,matches:i,routeId:h.id},p=m;try{let R=d._ctx;!R&&h.options.context&&(R=d._ctx=h.options.context({...g,deps:d.loaderDeps,context:m})||{}),p={...m,...R},d.context=p}catch(R){return ut(t,d),[f,Xt(h,R,o)]}if(l.aborted||!o[2]())return o[0].abort(),[f,[kt]];let v=d.paramsError??d.searchError;if(v!==void 0)return ut(t,d),[f,Xt(h,v,o)];let S=h.options.beforeLoad;if(!S)continue;let y={...g,search:d.search,context:p,...t.options.additionalContext},w=d.status;w==="success"&&f>=s&&(d.status="pending"),o[8]?.();try{te(t,d,"beforeLoad",o[0]);let R=await St(S(y),l);if(!o[2]())return o[0].abort(),[f,[kt]];let L=Qt(R,!1,h.id);if(L[0]!==at)return ut(t,d),[f,L];d.context={...p,...R}}catch(R){return ut(t,d),[f,Xt(h,R,o)]}finally{w==="success"&&d.status==="pending"&&(d.status="success"),te(t,d,!1,o[0])}}n()}a(is,"contextualize");function ao(t,e,o){if(!(!o||--o[2])){if(t._flights?.get(e.id)===o){let r=t._tx;if(r&&!r[0].signal.aborted&&!r[3].includes(e)&&r[3].some(n=>n.id===e.id)&&r[3].some(n=>n.isFetching==="beforeLoad"))return;t._flights.delete(e.id)}return o[1]}}a(ao,"releaseOwnedFlight");function ut(t,e){let o=e._flight;e._flight=void 0,ao(t,e,o)?.abort()}a(ut,"releaseFlight");function q(t,e,o,r){let n=[];for(let s of e)if(!o?.includes(s)){let u=s._flight;if(s._flight=void 0,r&&u?.[2]===1&&t._flights?.get(s.id)===u&&o?.some(i=>i.id===s.id))u[2]=0;else{let i=ao(t,s,u);i&&n.push(i)}}for(let s of n)s.abort()}a(q,"transferMatchResources");function co(t){for(let e of t){let o=e._flight;o&&o[2]++}}a(co,"acquireMatchResources");function te(t,e,o,r){if(e.isFetching=o,r&&t._tx?.[0]!==r)return;let n=t.stores.byRoute.get(e.routeId),s=n?.get();s?.id===e.id&&n.set({...s,isFetching:o})}a(te,"setFetching");function Bn(t,e,o,r,n,s,u){let i=e[0];return{params:o.params,location:i,navigate:$n(t,i),cause:u?"preload":o.cause,abortController:n,preload:u,deps:o.loaderDeps,parentMatchPromise:s,context:o.context,route:r,...t.options.additionalContext}}a(Bn,"getLoaderContext");async function Tn(t,e,o,r,n,s,u,i){let l=i.signal;if(l.aborted)return[kt];if(!n)return[at,void 0];let c=o._flight;te(t,o,"loader",i);try{if(!c){let f=new AbortController;c=[Promise.resolve().then(()=>n(Bn(t,e,o,r,f,s,u))).then(d=>Qt(d,!1,r.id),d=>Qt(d,!0,r.id)).then(d=>(d[0]!==at&&t._flights?.get(o.id)===c&&(t._flights.delete(o.id),c[2]||f.abort()),d[0]===_t&&c[2]?An(r,d[1]):d)),f,1],(t._flights??=new Map).set(o.id,c)}return o._flight=c,o.abortController=c[1],await St(c[0],l)}catch(f){if(f!==l)throw f;return ut(t,o),[kt]}finally{te(t,o,!1,i)}}a(Tn,"loadResource");function Mn(t,e,o){e[0]===at?(t.loaderData=e[1],t.error=void 0,t.status="success",t.invalid=!1,t.updatedAt=Date.now(),t.preload=o):e[0]!==et&&(t.status="success",t.error=void 0,t.invalid=!0)}a(Mn,"settleInto");function as(t,e,o){let r=t._cache.get(e.id);if(r!==o||t._committed.some(s=>s.id===e.id&&s._flight===e._flight))return;let n={...e,_notFound:void 0,context:{}};n._flight&&n._flight[2]++,t._cache.set(e.id,n),r&&ut(t,r)}a(as,"cacheLoaderMatch");function On(t,e){return e[0]===_t||e[0]===_e?{...t,status:e[0]===_t?"error":"notFound",error:e[1],_flight:void 0}:t}a(On,"getParentSnapshot");function cs(t,e,o,r,n,s,u){let i=e[1][o],l=It(t,i),c=!!s[4],f=c?t._cache.get(i.id):void 0,d,h=!1,m;try{if(i.status==="success"&&(d=l.options.shouldReload,typeof d=="function"&&(d=d(Bn(t,e,i,l,s[0],n,c))),s[2]()||(s[0].abort(),m=[kt])),!m)if(i.status!=="success")h=!0;else{let P=s[4]||i.preload?l.options.preloadStaleTime??t.options.defaultPreloadStaleTime??3e4:l.options.staleTime??t.options.defaultStaleTime??0;h=!!(i.invalid||d||d===void 0&&Date.now()-i.updatedAt>=P&&(s[6]||i.cause==="enter"||s[3].some(E=>E.routeId===i.routeId&&E.id!==i.id)))}}catch(P){i.invalid=!0,ut(t,i),m=Xt(l,P,s)}let g=l.options.loader,p=typeof g=="function"?g:g?.handler,v=(!c||l.options.preload!==!1)&&g?t._flights?.get(i.id):void 0;v===i._flight||m?v=void 0:v&&!h&&!c&&d===void 0?h=!0:h||(v=void 0);let S=!!(g&&h&&i.status==="success"&&!c&&!s[5]&&((typeof g=="function"?void 0:g?.staleReloadMode)??t.options.defaultStaleReloadMode)!=="blocking"),y=h&&(!c||l.options.preload!==!1),w=y&&!S&&(i.status!=="success"||!!g),R=l.lazyFn&&l._lazy!==!0?s[8]:void 0;if(y&&!g&&(i.invalid=!1,i.updatedAt=Date.now()),v&&v[2]++,w){let P=i._flight;i._flight=v,ao(t,i,P)?.abort(),i.status==="success"&&o>=u&&(i.status="pending"),s[8]?.()}y||(i.isFetching=!1);let L=(m?Promise.resolve(m):w?Tn(t,e,i,l,p,n,c,s[0]):Promise.resolve([at,i.loaderData])).then(P=>(w&&(Mn(i,P,c),P[0]===at&&(c&&g&&!s[0].signal.aborted&&as(t,i,f),i.status="pending")),P)),x=St(Promise.resolve().then(()=>Lt(l,void 0,R)),s[0].signal).then(()=>{},P=>[o,Xt(l,P,s)]).then(P=>L.then(E=>(w&&!P&&E[0]===at&&i.status==="pending"&&s[2]()&&(i.status="success",s[8]?.()),P)));if(r.push([o,L,x]),!S)return L.then(P=>On(i,P));let _={...i,status:"pending",preload:!1,_flight:v};i.invalid=!1,i.isFetching="loader";let b=Tn(t,e,_,l,p,n,!1,s[0]).then(P=>(i.isFetching=!1,Mn(_,P,!1),P));return(e[2]??=[]).push([o,b,x,_]),b.then(P=>On(_,P))}a(cs,"createLoaderTask");async function so(t,e,o,r,n=0){let s=o?.[1][1],u=s?.routeId?e.findIndex(i=>i.routeId===s.routeId):o?.[0]??e.length-1;u<0&&(u=0);for(let i=u;i>=0;i--){let l=It(t,e[i]),c=Lt(l,!1);if(c)try{await St(c,r)}catch(f){if(f===r)throw f}if(l.options.notFoundComponent)return i}return s?.routeId?u:n}a(so,"getNotFoundBoundary");function Bt(t,e){e[2]&&(q(t,e[2].map(o=>o[3])),e[2]=void 0)}a(Bt,"discardBackground");async function Nn(t,e,o,r){let n;try{await Promise.all(t.map(s=>s[1].then(async u=>{let i=s[0];if(!(r&&i>=await r)){if(u[0]>=et)throw[i,u];!n&&u[0]!==at&&(n=[i,u],await Promise.all((o??[]).map(l=>{if(!(l[0]<=i))return l[1].then(c=>{if(c[0]===et)throw[l[0],c]})})))}})))}catch(s){return s}return e??n}a(Nn,"settleTasks");async function Un(t,e,o,r,n,s,u){let i=e[1],l=await s,c=!1,f=i.findIndex(g=>g._notFound),d=a(g=>g[1][0]===_e?so(t,i,g,r.signal):g[0],"boundaryOf"),h=f<0?i.length:f;if((l?.[1][0]??0)>=et)h=0;else if(l){h=l[2]??=await d(l);for(let g of o){if(g[0]>=h)break;let p=await g[1];if(p[0]!==at&&p[0]<et&&!("loaderData"in i[g[0]])){l=[g[0],p],h=l[2]=await d(l);break}}}for(let g of o){if(g[0]>=h)break;let p=await g[2];if(p){l=p;break}}if((l?.[1][0]??0)>=et){let g=l[1];if(g[0]!==et||g[1].options.reloadDocument||n<20)return Bt(t,e),g;c=!0,l=[0,[_t,new Error("Too many redirects")]]}let m=l?l[2]??await d(l):f;if(m>=0){let g=l?.[1],p=g?.[0],v=i[m],S=g?.[1],y=a(()=>{g&&(v._notFound=void 0,p===_t?v.status="error":(S.routeId=v.routeId,v.routeId===t.routeTree.id?(v.status="success",v._notFound=!0):v.status="notFound"),v.error=S,v.isFetching=!1)},"install");y();let w=It(t,v);try{await St(g?Promise.resolve().then(()=>Lt(w,p===_t?"errorComponent":"notFoundComponent")):Promise.all([Lt(w),Lt(w,"notFoundComponent")]),r.signal)}catch(R){if(R===r.signal)return Bt(t,e),[kt]}g?c&&(r.abort(),await Promise.all([...o.map(R=>R[1]),...o.map(R=>R[2]),...(e[2]??[]).map(R=>R[1])]),Bt(t,e),q(t,i),y()):(v.status="success",u?.())}return e}a(Un,"reduceLane");async function Vn(t,e,o,r=0,n=e[1].length){let s=e[1];for(let u=r;u<n;u++){let i=s[u],l=It(t,i).options;if(l.head||l.scripts)try{let c={ssr:t.options.ssr,matches:s,match:i,params:i.params,loaderData:i.loaderData},[f,d]=await St(Promise.all([l.head?.(c),l.scripts?.(c)]),o);i.meta=f?.meta,i.links=f?.links,i.headScripts=f?.scripts,i.styles=f?.styles,i.scripts=d}catch(c){if(c===o)break;console.error(c)}if(i.status!=="success"||i._notFound)break}return e}a(Vn,"projectLane");async function Wn(t,e,o,r){let n=[e,o],s=t.stores.matches.get(),u=o.findIndex(p=>p._notFound);if(t.options.notFoundMode!=="root"&&u>=0){let p=await so(t,n[1],void 0,r[0].signal,u);p!==u&&(o[u]._notFound=void 0,o[p]._notFound=!0),u=p}let i=u<0?o.length:u+1,l=0;for(;l<i&&l!==u;){let p=o[l],v=r[3][l],S=s[l];if(v?.id!==p.id||v.status!=="success"||v._notFound||p.preload||S?.id!==p.id||S.status!=="success"||S._notFound)break;l++}let c=[],f=r[7]??0,d=f?Promise.resolve(n[1][f-1]):void 0,h=a(()=>{for(let p=f;p<i&&!r[0].signal.aborted;p++)d=cs(t,n,p,c,d,r,l)},"planSuccessfulLane"),m=await is(t,n,r,i,h,l);if(m&&(r[5]=!0,i=m[0],m[1][0]===_e?(m[2]=await so(t,n[1],m,r[0].signal),i=Math.min(i,m[2]+1)):m[1][0]>=et&&(i=0),h()),r[2]()&&!r[4]){let p=[];for(let[v,S]of t._flights??[])S[2]||(t._flights.delete(v),p.push(S[1]));for(let v of p)v.abort()}let g;try{let p=Un(t,n,c,r[0],r[1],Nn(c,m,n[2]),r[8]);n[2]?.length&&(n[3]=Nn(n[2],void 0,void 0,p.then(v=>Zt(v)?0:Fn(v[1]).length,()=>0))),g=await p}catch(p){throw Bt(t,n),p}return Zt(g)?g:Vn(t,g,r[0].signal,r[7]===g[1].length?r[7]:0)}a(Wn,"executeClientLane");function io(t,e){if(t._tx!==e)return;let o=t._pending,r=!1,n=o?.[0][3][o[1]]?.id;o?.[0]!==e&&(o&&e[3][o[1]]?.id===n?(o[0]=e,r=!0):(clearTimeout(o?.[3]),t._pending=o=void 0));let s=e[3],u=t.stores.matches.get(),i=-1,l,c,f,d=!1;for(let p=0;p<s.length;p++){let v=s[p],S=v.status==="success";if(d=u[p]?.id===v.id&&u[p]?.status==="pending",S&&!d)continue;let y=It(t,v);if(l=S&&d||v.invalid?0:y.options.pendingMs??t.options.defaultPendingMs,f=y.options.pendingComponent??t.options.defaultPendingComponent,!f||typeof l!="number"||l===1/0)return;i=p,c=y.options.pendingMinMs??t.options.defaultPendingMinMs??0;break}if(i<0)return;let h=s[i].id;if((!o||o[1]!==i||n!==h)&&(clearTimeout(o?.[3]),t._pending=o=[e,i,d?Date.now()+c:e[4]+l,void 0,d?Promise.resolve(!0):void 0,f]),o[4]&&!r&&o[5]===f)return;if(o[5]=f,!o[4]){clearTimeout(o[3]);let p=o[2]-Date.now();if(p>0){o[3]=setTimeout(()=>io(t,e),p);return}o[2]=0}let m=s.map(p=>({...p,_flight:void 0}));m[i].status="pending";let g=t.startTransition(()=>t.stores.setMatches(m),m).then(p=>(p&&t._pending===o&&o[4]===g&&!o[2]&&(o[2]=Date.now()+c),p));o[4]=g}a(io,"offerPending");function ye(t,e){let o=t._pending;o?.[0]===e&&(clearTimeout(o[3]),t._pending=void 0)}a(ye,"finishPending");function zn(t,e){t._committed=e,t.stores.setMatches(e)}a(zn,"publishMatches");function Dn(t,e){q(t,e[1]),Bt(t,e)}a(Dn,"discardLane");function ls(t,e,o,r){let n=t._committed,s=t._cache;for(let c of o)c.preload=!1,r&&(c._assetEnd=void 0);let u=Fn(o).length,i=new Map,l=Date.now();for(let c of[...n,...s.values()]){if(c.status!=="success"||o.some((d,h)=>d.id===c.id&&(h<u||d.status==="success")))continue;let f=It(t,c);!f.options.loader||l-c.updatedAt>=(c.preload?f.options.preloadGcTime??t.options.defaultPreloadGcTime??3e5:f.options.gcTime??t.options.defaultGcTime??3e5)||i.set(c.id,s.get(c.id)===c?c:{...c,_flight:void 0,isFetching:!1,context:{}})}e[3]=[],t._cache=i,zn(t,o),q(t,[...s.values(),...n],[...o,...i.values()]),En(t,n,o,()=>t._tx===e)}a(ls,"commitMatches");async function Et(t,e){let o=t._tx;for(;o&&o!==e;){if(await o[5],t._tx===o)return;o=t._tx}}a(Et,"awaitCurrent");async function Hn(t,e,o){await t.navigate({...o.options,replace:!0,ignoreBlocker:!0,_redirects:e[1]+1})}a(Hn,"followRedirect");function jn(t,e){ye(t,e),e[0].abort(),q(t,e[3]),e[3]=[],t._tx===e&&(t.batch(()=>{t.stores.status.set("idle"),t.stores.setMatches(t._committed)}),t._tx===e&&(t._commitPromise?.resolve(),t._commitPromise=void 0))}a(jn,"restoreCommitted");async function us(t,e,o,r,n){let s=o.map(c=>({...c}));co(s);for(let c of r)ut(t,s[c[0]]),s[c[0]]=c[3];let u=[e[2],s],i;try{i=await Un(t,u,r,e[0],e[1],n)}catch(c){throw q(t,s),c}if(Zt(i)){q(t,s),i[0]===et&&t._tx===e&&t._committed===o&&await Hn(t,e,i[1]);return}let l=await Vn(t,i,e[0].signal);if(t._tx!==e||t._committed!==o){q(t,l[1]);return}for(let c of l[1]){let f=t._cache.get(c.id);f?._flight&&f._flight===c._flight&&(t._cache.delete(c.id),ut(t,f))}zn(t,l[1]),q(t,o,l[1])}a(us,"runBackground");async function fs(t,e,o,r,n,s){let u=[e[0],e[1],()=>t._tx===e&&!!e[3].length,t._committed,void 0,n,o,s,r],i=await Wn(t,e[2],e[3],u);if(Zt(i)){i[0]===et&&t._tx===e?(ye(t,e),q(t,e[3]),e[3]=[],t._tx===e&&await Hn(t,e,i[1])):jn(t,e);return}let l=t._pending;if(l?.[0]===e&&(clearTimeout(l[3]),l[4])){let h=e[0].signal,m=!1;try{m=await St(l[4],h)}catch(g){if(g!==h)throw g}if(m&&t._pending===l&&l[0]===e){let g=l[2]-Date.now();if(g>0){try{await St(new Promise(p=>{l[3]=setTimeout(p,g)}),h)}catch{}clearTimeout(l[3])}}}if(t._tx!==e){ye(t,e),Dn(t,i);return}let c=e[2],f=Ct(c,t.stores.resolvedLocation.get()),d=i[2];await t.startViewTransition(async()=>{if(t._tx!==e){Dn(t,i);return}let h=a(()=>{ye(t,e),ls(t,e,i[1],s),t._tx===e&&(t.emit({type:"onLoad",...f}),t._tx===e&&t.emit({type:"onBeforeRouteMount",...f}))},"commit"),m=await t.startTransition(h,i[1]);if(t._tx!==e){Bt(t,i);return}d?.length&&us(t,e,i[1],d,i[3]).catch(console.error),t.batch(()=>{t.stores.resolvedLocation.set(c),t.stores.status.set("idle"),t._tx===e&&t.emit({type:"onResolved",...f}),m&&t._tx===e&&t.emit({type:"onRendered",...f})}),t._tx===e&&(t._commitPromise?.resolve(),t._commitPromise=void 0)})}a(fs,"runClientTransaction");async function In(t,e){let o=!1,r=o?t.stores.matches.get():void 0,n=t._tx,s=t.stores.resolvedLocation.get(),u=s??t.stores.location.get(),i=t.latestLocation,l=t._pendingLocation,c=l?.href===i.href?l._redirects??0:0,f=t._handoff,d=o?void 0:f?.[0](),h=new AbortController,m=t._preflight;if(t._preflight=h,!o&&!d&&f?.[1](),m?.abort(),h.signal.aborted){await Et(t,n);return}let g=Ct(i,s);if(t.emit({type:"onBeforeNavigate",...g}),h.signal.aborted||t.emit({type:"onBeforeLoad",...g}),h.signal.aborted){await Et(t,n);return}let p=u.href===i.href,v,S=h;try{v=t.matchRoutes(i,{_controller:h}),co(v)}catch(R){if(h.abort(),!Jt(R)){await Et(t),t._commitPromise?.resolve(),t._commitPromise=void 0;return}await t.navigate({...R.options,replace:!0,ignoreBlocker:!0}),await Et(t,n);return}let y=d?f[1](v):void 0;if(y?S=d:d?.abort(),h.signal.aborted){q(t,v),await Et(t,n);return}t._preflight=void 0;let w=[S,c,i,v,Date.now(),Promise.resolve().then(()=>fs(t,w,p,()=>io(t,w),e?.sync,y)).catch(()=>{t._tx===w&&jn(t,w)})];if(t._tx=w,n){for(let R of t.stores.matches.get()){if(t._tx!==w)break;R.isFetching&&te(t,R,!1)}n[0].abort(),q(t,n[3],w[3],!0)}if(t._tx!==w){q(t,w[3]),w[3]=[],await Et(t,w);return}t.batch(()=>{t.stores.status.set("pending"),t.stores.location.set(i)}),!s&&!v.some(R=>R._notFound)&&io(t,w);try{await w[5]}finally{await Et(t,w)}}a(In,"loadClientRoute");async function no(t,e,o=0){if(o>20)return;let r=e._builtLocation??t.buildLocation(e),n=t._committed,s=new AbortController,u;try{u=t.matchRoutes(r,{_controller:s}),co(u)}catch(l){s.abort(),K(l)||console.error(l);return}(t._preloads??=new Map).set(s,u);let i;try{let l;try{l=await Wn(t,r,u,[s,o,()=>!0,n,!0])}finally{i=t._preloads.delete(s),q(t,u),s.abort()}if(!Zt(l))return l[1];if(i&&l[0]===et&&!l[1].options.reloadDocument)return no(t,{...l[1].options,_fromLocation:r},o+1)}catch(l){K(l)||console.error(l)}}a(no,"preloadClientRoute");var lo="Error preloading route! \u261D\uFE0F";var Se=class{static{a(this,"BaseRoute")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(t){if(this.init=e=>{this.originalIndex=e.originalIndex;let o=this.options,r=!o?.path&&!o?.id;this.parentRoute=this.options.getParentRoute?.(),r?this._path=tt:this.parentRoute||mt();let n=r?tt:o?.path;n&&n!=="/"&&(n=fe(n));let s=o?.id||n,u=r?tt:Pt([this.parentRoute.id==="__root__"?"":this.parentRoute.id,s]);n==="__root__"&&(n="/"),u!=="__root__"&&(u=Pt(["/",u]));let i=u==="__root__"?"/":Pt([this.parentRoute.fullPath,n]);this._path=n,this._id=u,this._fullPath=i,this._to=Y(i)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e=="object"&&e!==null&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>yn({from:this.fullPath,...e}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}};var uo=class extends Se{static{a(this,"BaseRootRoute")}constructor(t){super(t)}};var Pe=k(B(),1);var O=(t=>(t[t.None=0]="None",t[t.Mutable=1]="Mutable",t[t.Watching=2]="Watching",t[t.RecursedCheck=4]="RecursedCheck",t[t.Recursed=8]="Recursed",t[t.Dirty=16]="Dirty",t[t.Pending=32]="Pending",t))(O||{});function Kn({update:t,notify:e,unwatched:o}){return{link:r,unlink:n,propagate:s,checkDirty:u,shallowPropagate:i};function r(c,f,d){let h=f.depsTail;if(h!==void 0&&h.dep===c)return;let m=h!==void 0?h.nextDep:f.deps;if(m!==void 0&&m.dep===c){m.version=d,f.depsTail=m;return}let g=c.subsTail;if(g!==void 0&&g.version===d&&g.sub===f)return;let p=f.depsTail=c.subsTail={version:d,dep:c,sub:f,prevDep:h,nextDep:m,prevSub:g,nextSub:void 0};m!==void 0&&(m.prevDep=p),h!==void 0?h.nextDep=p:f.deps=p,g!==void 0?g.nextSub=p:c.subs=p}function n(c,f=c.sub){let d=c.dep,h=c.prevDep,m=c.nextDep,g=c.nextSub,p=c.prevSub;return m!==void 0?m.prevDep=h:f.depsTail=h,h!==void 0?h.nextDep=m:f.deps=m,g!==void 0?g.prevSub=p:d.subsTail=p,p!==void 0?p.nextSub=g:(d.subs=g)===void 0&&o(d),m}function s(c){let f=c.nextSub,d;t:do{let h=c.sub,m=h.flags;if(m&60?m&12?m&4?!(m&48)&&l(c,h)?(h.flags=m|40,m&=1):m=0:h.flags=m&-9|32:m=0:h.flags=m|32,m&2&&e(h),m&1){let g=h.subs;if(g!==void 0){let p=(c=g).nextSub;p!==void 0&&(d={value:f,prev:d},f=p);continue}}if((c=f)!==void 0){f=c.nextSub;continue}for(;d!==void 0;)if(c=d.value,d=d.prev,c!==void 0){f=c.nextSub;continue t}break}while(!0)}function u(c,f){let d,h=0,m=!1;t:do{let g=c.dep,p=g.flags;if(f.flags&16)m=!0;else if((p&17)===17){if(t(g)){let v=g.subs;v.nextSub!==void 0&&i(v),m=!0}}else if((p&33)===33){(c.nextSub!==void 0||c.prevSub!==void 0)&&(d={value:c,prev:d}),c=g.deps,f=g,++h;continue}if(!m){let v=c.nextDep;if(v!==void 0){c=v;continue}}for(;h--;){let v=f.subs,S=v.nextSub!==void 0;if(S?(c=d.value,d=d.prev):c=v,m){if(t(f)){S&&i(v),f=c.sub;continue}m=!1}else f.flags&=-33;f=c.sub;let y=c.nextDep;if(y!==void 0){c=y;continue t}}return m}while(!0)}function i(c){do{let f=c.sub,d=f.flags;(d&48)===32&&(f.flags=d|16,(d&6)===2&&e(f))}while((c=c.nextSub)!==void 0)}function l(c,f){let d=f.depsTail;for(;d!==void 0;){if(d===c)return!0;d=d.prevDep}return!1}}a(Kn,"createReactiveSystem");function Jn(t,e,o){let r=typeof t=="object",n=r?t:void 0;return{next:(r?t.next:t)?.bind(n),error:(r?t.error:e)?.bind(n),complete:(r?t.complete:o)?.bind(n)}}a(Jn,"toObserver");var fo=[],we=0,{link:qn,unlink:ps,propagate:ms,checkDirty:Yn,shallowPropagate:Gn}=Kn({update(t){return t._update()},notify(t){fo[ho++]=t,t.flags&=~O.Watching},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=O.Mutable|O.Dirty,xe(t))}}),Re=0,ho=0,ct,po=0;function mo(t){try{++po,t()}finally{--po||go()}}a(mo,"batch");function xe(t){let e=t.depsTail,o=e!==void 0?e.nextDep:t.deps;for(;o!==void 0;)o=ps(o,t)}a(xe,"purgeDeps");function go(){if(!(po>0)){for(;Re<ho;){let t=fo[Re];fo[Re++]=void 0,t.notify()}Re=0,ho=0}}a(go,"flush");function be(t,e){let o=typeof t=="function",r=t,n={_snapshot:o?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:o?O.None:O.Mutable,get(){return ct!==void 0&&qn(n,ct,we),n._snapshot},subscribe(s){let u=Jn(s),i={current:!1},l=gs(()=>{n.get(),i.current?u.next?.(n._snapshot):i.current=!0});return{unsubscribe:a(()=>{l.stop()},"unsubscribe")}},_update(s){let u=ct,i=e?.compare??Object.is;if(o)ct=n,++we,n.depsTail=void 0;else if(s===void 0)return!1;o&&(n.flags=O.Mutable|O.RecursedCheck);try{let l=n._snapshot,c=typeof s=="function"?s(l):s===void 0&&o?r(l):s;return l===void 0||!i(l,c)?(n._snapshot=c,!0):!1}finally{ct=u,o&&(n.flags&=~O.RecursedCheck),xe(n)}}};return o?(n.flags=O.Mutable|O.Dirty,n.get=function(){let s=n.flags;if(s&O.Dirty||s&O.Pending&&Yn(n.deps,n)){if(n._update()){let u=n.subs;u!==void 0&&Gn(u)}}else s&O.Pending&&(n.flags=s&~O.Pending);return ct!==void 0&&qn(n,ct,we),n._snapshot}):n.set=function(s){if(n._update(s)){let u=n.subs;u!==void 0&&(ms(u),Gn(u),go())}},n}a(be,"createAtom");function gs(t){let e=a(()=>{let r=ct;ct=o,++we,o.depsTail=void 0,o.flags=O.Watching|O.RecursedCheck;try{return t()}finally{ct=r,o.flags&=~O.RecursedCheck,xe(o)}},"run"),o={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:O.Watching|O.RecursedCheck,notify(){let r=this.flags;r&O.Dirty||r&O.Pending&&Yn(this.deps,this)?e():this.flags=O.Watching},stop(){this.flags=O.None,this.depsTail=void 0,xe(this)}};return e(),o}a(gs,"effect");var vo=k(B(),1),Xn=k(Nr(),1);function vs(t,e){return t===e}a(vs,"defaultCompare");function W(t,e,o=vs){let r=(0,vo.useCallback)(u=>{if(!t)return()=>{};let{unsubscribe:i}=t.subscribe(u);return i},[t]),n=(0,vo.useCallback)(()=>t?.get(),[t]);return(0,Xn.useSyncExternalStoreWithSelector)(r,n,n,e,o)}a(W,"useStore");var Zn={};function yo(t,e){let o=Pe.useRef();return r=>{let n=t?.select?t.select(r):r;return t?.structuralSharing??e.options.defaultStructuralSharing?o.current=st(o.current,n):n}}a(yo,"useStructuralSharing");function X(t){let e=N(),o=Pe.useContext(t.from?jo:bt),r=t.from??o,n=e.stores.getMatchStore(r);if(!1){let i=n.get();if(!i){(t.shouldThrow??!0)&&mt();return}return t.select?t.select(i):i}let s=yo(t,e),u=W(n,i=>i?s(i):Zn);if(u!==Zn)return u;(t.shouldThrow??!0)&&mt()}a(X,"useMatch");function Ce(t){return X({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:a(e=>t.select?t.select(e.search):e.search,"select")})}a(Ce,"useSearch");var lt=k(B(),1);var Le=lt.useLayoutEffect;function Qn(t,e,o={},r){lt.useEffect(()=>{if(!t.current||r||typeof IntersectionObserver!="function")return;let n=new IntersectionObserver(([s])=>{e(s)},o);return n.observe(t.current),()=>{n.disconnect()}},[e,r,o,t])}a(Qn,"useIntersectionObserver");function tr(t){let e=lt.useRef(null);return lt.useImperativeHandle(t,()=>e.current,[]),e}a(tr,"useForwardedRef");var _o=k(B(),1);function Ee(t){let e=N();return _o.useCallback(o=>e.navigate({...o,from:o.from??t?.from}),[t?.from,e])}a(Ee,"useNavigate");var Ut=k(B(),1),nt=k(Z(),1);function Tt(t){return(0,nt.jsx)(ys,{...t})}a(Tt,"CatchBoundary");var ys=class extends Ut.Component{static{a(this,"CatchBoundaryImpl")}constructor(...t){super(...t),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(t,e){let o=t.getResetKey();return e.error&&e.resetKey!==o?{resetKey:o,error:null}:{resetKey:o}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,e){this.props.onCatch?.(t,e)}render(){let t=this.state.error;return t?Ut.createElement(this.props.errorComponent??So,{error:t,reset:this.reset}):this.props.children}};function So({error:t}){let[e,o]=Ut.useState(!1);return(0,nt.jsxs)("div",{style:{padding:".5rem",maxWidth:"100%"},children:[(0,nt.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[(0,nt.jsx)("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),(0,nt.jsx)("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:a(()=>o(r=>!r),"onClick"),children:e?"Hide Error":"Show Error"})]}),(0,nt.jsx)("div",{style:{height:".25rem"}}),e?(0,nt.jsx)("div",{children:(0,nt.jsx)("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?(0,nt.jsx)("code",{children:t.message}):null})}):null]})}a(So,"ErrorComponent");var Ro=k(B(),1),er=k(Z(),1);function or({children:t,fallback:e=null}){return(0,er.jsx)(Ro.default.Fragment,{children:wo()?t:e})}a(or,"ClientOnly");function wo(){return Ro.default.useSyncExternalStore(_s,()=>!0,()=>!1)}a(wo,"useHydrated");function _s(){return()=>{}}a(_s,"subscribe");function xo(t){return X({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:a(e=>t.select?t.select(e.loaderData):e.loaderData,"select")})}a(xo,"useLoaderData");function bo(t){let{select:e,...o}=t;return X({...o,select:a(r=>e?e(r.loaderDeps):r.loaderDeps,"select")})}a(bo,"useLoaderDeps");function Po(t){return X({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:a(e=>{let o=t.strict===!1?e.params:e._strictParams;return t.select?t.select(o):o},"select")})}a(Po,"useParams");function Co(t){return X({...t,select:a(e=>t.select?t.select(e.context):e.context,"select")})}a(Co,"useRouteContext");var U=k(B(),1);var Ss=k(Z(),1);var ar=k(Or(),1);function Lo(t){let e=U.useRef(t);return Q(e.current,t,{ignoreUndefined:!1})||(e.current=t),e.current}a(Lo,"useValueStable");function Rs(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}a(Rs,"compareLinkState");function ws(t,e,o){if(t?.external)return it(t.href,o)?void 0:t.href;if(!cr(e)&&!(typeof e!="string"||e.indexOf(":")===-1))try{return new URL(e),it(e,o)?void 0:e}catch{}}a(ws,"resolveExternalLink");function xs(t,e,o,r,n,s){if(s)return!1;if(o?.exact){if(!de(t.pathname,e.pathname,r))return!1}else{let u=vt(t.pathname,r),i=vt(e.pathname,r);if(!(u.startsWith(i)&&(u.length===i.length||u[i.length]==="/")))return!1}return(o?.includeSearch??!0)&&!Q(t.search,e.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?n&&t.hash===e.hash:!0}a(xs,"resolveIsActive");function bs(t,e){let o=N(),r=tr(e),{activeProps:n,inactiveProps:s,activeOptions:u,to:i,preload:l,preloadDelay:c,preloadIntentProximity:f,hashScrollIntoView:d,replace:h,startTransition:m,resetScroll:g,viewTransition:p,children:v,target:S,disabled:y,style:w,className:R,onClick:L,onBlur:x,onFocus:_,onMouseEnter:b,onMouseLeave:P,onTouchStart:E,ignoreBlocker:C,params:T,search:D,hash:wt,state:rt,mask:re,reloadDocument:Ds,unsafeRelative:Fs,from:As,_fromLocation:$s,...Mt}=t;if(!1){let F=cr(i);if(typeof i=="string"&&!F&&i.indexOf(":")>-1)try{return new URL(i),it(i,o.protocolAllowlist)?{...Mt,ref:r,href:void 0,...v&&{children:v},...S&&{target:S},...y&&{disabled:y},...w&&{style:w},...R&&{className:R}}:{...Mt,ref:r,href:i,...v&&{children:v},...S&&{target:S},...y&&{disabled:y},...w&&{style:w},...R&&{className:R}}}catch{}let I=o.buildLocation({...t,from:t.from}),z=ir(I.maskedLocation?I.maskedLocation.publicHref:I.publicHref,I.maskedLocation?I.maskedLocation.external:I.external,o.history,y),ft=(()=>{if(z?.external)return it(z.href,o.protocolAllowlist)?void 0:z.href;if(!F&&typeof i=="string"&&i.indexOf(":")>-1)try{return new URL(i),it(i,o.protocolAllowlist)?void 0:i}catch{}})(),Ae=(()=>{if(ft)return!1;let $=o.stores.location.get(),H=u?.exact??!1;if(H){if(!de($.pathname,I.pathname,o.basepath))return!1}else{let V=vt($.pathname,o.basepath),j=vt(I.pathname,o.basepath);if(!(V.startsWith(j)&&(V.length===j.length||V[j.length]==="/")))return!1}if((u?.includeSearch??!0)&&$.search!==I.search){let V=!$.search||typeof $.search=="object"&&!ht($.search),j=!I.search||typeof I.search=="object"&&!ht(I.search);if(!(V&&j)&&!Q($.search,I.search,{partial:!H,ignoreUndefined:!u?.explicitUndefined}))return!1}return!u?.includeHash})();if(ft)return{...Mt,ref:r,href:ft,...v&&{children:v},...S&&{target:S},...y&&{disabled:y},...w&&{style:w},...R&&{className:R}};let $e=Ae?J(n,{})??nr:Vt,Be=Ae?Vt:J(s,{})??Vt,Vo=(()=>{let $=w,H=$e.style,V=Be.style;if(!(!$&&!H&&!V))return $&&!H&&!V?$:!$&&H&&!V?H:!$&&!H&&V?V:{...$,...H,...V}})(),Wo=(()=>{let $=R,H=$e.className,V=Be.className;if(!$&&!H&&!V)return"";let j="";return $&&(j=$),H&&(j=j?`${j} ${H}`:H),V&&(j=j?`${j} ${V}`:V),j})();return{...Mt,...$e,...Be,href:z?.href,ref:r,disabled:!!y,target:S,...Vo&&{style:Vo},...Wo&&{className:Wo},...y&&rr,...Ae&&sr}}let Oe=wo(),Cr=Lo(t.search),Lr=Lo(t.params),No=Lo(u),Ht=U.useMemo(()=>t,[o,t.from,t._fromLocation,t.hash,t.to,Cr,Lr,t.state,t.mask,t.unsafeRelative]),Er=U.useCallback(F=>{let I=o.buildLocation({_fromLocation:F,...Ht}),z=ir(I.maskedLocation?I.maskedLocation.publicHref:I.publicHref,I.maskedLocation?I.maskedLocation.external:I.external,o.history,y),ft=ws(z,i,o.protocolAllowlist);return[z?.href,ft,xs(F,I,No,o.basepath,Oe,ft!==void 0)]},[No,y,Oe,Ht,o,i]),[kr,Ne,De]=W(o.stores.location,Er,Rs),se=De?J(n,{})??nr:Vt,ie=De?Vt:J(s,{})??Vt,Do=[R,se.className,ie.className].filter(Boolean).join(" "),Fo=(w||se.style||ie.style)&&{...w,...se.style,...ie.style},[Ir,Ao]=U.useState(!1),$o=U.useRef(!1),Ot=t.reloadDocument||Ne?!1:l??o.options.defaultPreload,Fe=c??o.options.defaultPreloadDelay??0,xt=U.useCallback(()=>{o.preloadRoute(Ht).catch(F=>{console.warn(F),console.warn(lo)})},[o,Ht]);Qn(r,U.useCallback(F=>{F?.isIntersecting&&xt()},[xt]),Cs,!!y||Ot!=="viewport"),U.useEffect(()=>{$o.current||!y&&Ot==="render"&&(xt(),$o.current=!0)},[y,xt,Ot]);let Tr=a(F=>{let I=F.currentTarget.getAttribute("target"),z=S!==void 0?S:I;if(!y&&!Ls(F)&&!F.defaultPrevented&&(!z||z==="_self")&&F.button===0){F.preventDefault(),(0,ar.flushSync)(()=>{Ao(!0)});let ft=o.subscribe("onResolved",()=>{ft(),Ao(!1)});o.navigate({...Ht,replace:h,resetScroll:g,hashScrollIntoView:d,startTransition:m,viewTransition:p,ignoreBlocker:C})}},"handleClick");if(Ne)return{...Mt,ref:r,href:Ne,...v&&{children:v},...S&&{target:S},...y&&{disabled:y},...w&&{style:w},...R&&{className:R},...L&&{onClick:L},...x&&{onBlur:x},..._&&{onFocus:_},...b&&{onMouseEnter:b},...P&&{onMouseLeave:P},...E&&{onTouchStart:E}};let Bo=a(F=>{if(y||Ot!=="intent")return;if(!Fe){xt();return}let I=F.currentTarget;if(ee.has(I))return;let z=setTimeout(()=>{ee.delete(I),xt()},Fe);ee.set(I,z)},"enqueueIntentPreload"),Mr=a(F=>{y||Ot!=="intent"||xt()},"handleTouchStart"),Uo=a(F=>{if(y||!Ot||!Fe)return;let I=F.currentTarget,z=ee.get(I);z&&(clearTimeout(z),ee.delete(I))},"handleLeave");return{...Mt,...se,...ie,href:kr,ref:r,onClick:Wt([L,Tr]),onBlur:Wt([x,Uo]),onFocus:Wt([_,Bo]),onMouseEnter:Wt([b,Bo]),onMouseLeave:Wt([P,Uo]),onTouchStart:Wt([E,Mr]),disabled:!!y,target:S,...Fo&&{style:Fo},...Do&&{className:Do},...y&&rr,...De&&sr,...Oe&&Ir&&Ps}}a(bs,"useLinkProps");var Vt={},nr={className:"active"},rr={role:"link","aria-disabled":!0},sr={"data-status":"active","aria-current":"page"},Ps={"data-transitioning":"transitioning"},ee=new WeakMap,Cs={rootMargin:"100px"},Wt=a(t=>e=>{for(let o of t)if(o){if(e.defaultPrevented)return;o(e)}},"composeHandlers");function ir(t,e,o,r){if(!r)return e?{href:t,external:!0}:{href:o.createHref(t)||"/",external:!1}}a(ir,"getHrefOption");function cr(t){if(typeof t!="string")return!1;let e=t.charCodeAt(0);return e===47?t.charCodeAt(1)!==47:e===46}a(cr,"isSafeInternal");var Eo=U.forwardRef((t,e)=>{let{_asChild:o,...r}=t,{type:n,...s}=bs(r,e),u=typeof r.children=="function"?r.children({isActive:s["data-status"]==="active"}):r.children;if(!o){let{disabled:i,...l}=s;return U.createElement("a",l,u)}return U.createElement(o,s,u)});function Ls(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}a(Ls,"isCtrlEvent");var ko=k(B(),1),Io=k(Z(),1);var lr=class extends Se{static{a(this,"Route")}constructor(t){super(t),this.useMatch=e=>X({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Co({...e,from:this.id}),this.useSearch=e=>Ce({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Po({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>bo({...e,from:this.id}),this.useLoaderData=e=>xo({...e,from:this.id}),this.useNavigate=()=>Ee({from:this.fullPath}),this.Link=ko.default.forwardRef((e,o)=>(0,Io.jsx)(Eo,{ref:o,from:this.fullPath,...e}))}};function Es(t){return new lr(t)}a(Es,"createRoute");var ur=class extends uo{static{a(this,"RootRoute")}constructor(t){super(t),this.useMatch=e=>X({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Co({...e,from:this.id}),this.useSearch=e=>Ce({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Po({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>bo({...e,from:this.id}),this.useLoaderData=e=>xo({...e,from:this.id}),this.useNavigate=()=>Ee({from:this.fullPath}),this.Link=ko.default.forwardRef((e,o)=>(0,Io.jsx)(Eo,{ref:o,from:this.fullPath,...e}))}};function ks(t){return new ur(t)}a(ks,"createRootRoute");var Bc=k(B(),1);var ke=k(Z(),1);function fr(t){let e=N();if(!1){let r=`not-found-${e.stores.location.get().pathname}-${e.stores.status.get()}`;return(0,ke.jsx)(Tt,{getResetKey:a(()=>r,"getResetKey"),onCatch:a((n,s)=>{if(K(n))t.onCatch?.(n,s);else throw n},"onCatch"),errorComponent:a(({error:n})=>{if(K(n))return t.fallback?.(n);throw n},"errorComponent"),children:t.children})}let o=`not-found-${W(e.stores.location,r=>r.pathname)}-${W(e.stores.status,r=>r)}`;return(0,ke.jsx)(Tt,{getResetKey:a(()=>o,"getResetKey"),onCatch:a((r,n)=>{if(K(r))t.onCatch?.(r,n);else throw r},"onCatch"),errorComponent:a(({error:r})=>{if(K(r))return t.fallback?.(r);throw r},"errorComponent"),children:t.children})}a(fr,"CatchNotFound");function dr(){return(0,ke.jsx)("p",{children:"Not Found"})}a(dr,"DefaultGlobalNotFound");var hr=k(Z(),1);function pr({children:t}){let e=N();return null}a(pr,"ScriptOnce");var Kc=k(B(),1),Ie=k(Z(),1);function Rt(t){return(0,Ie.jsx)(Ie.Fragment,{children:t.children})}a(Rt,"SafeFragment");var Yc=k(B(),1),Te=k(Z(),1);function To(t,e,o){return e.options.notFoundComponent?(0,Te.jsx)(e.options.notFoundComponent,{...o}):t.options.defaultNotFoundComponent?(0,Te.jsx)(t.options.defaultNotFoundComponent,{...o}):(0,Te.jsx)(dr,{})}a(To,"renderRouteNotFound");var gr=k(Z(),1);function mr(t){return null}a(mr,"getScrollRestorationScriptForRouter");function vr(){let t=mr(N());return t?(0,gr.jsx)(pr,{children:t}):null}a(vr,"ScrollRestoration");var G=k(B(),1);var A=k(Z(),1);function oe(t,e){let o=e?.options.pendingComponent??t.options.defaultPendingComponent;return o?(0,A.jsx)(o,{}):null}a(oe,"renderPending");var Is=a((t,e)=>t[0]===e[0]&&t[1]===e[1],"outletMatchSelectionEqual"),Me=G.memo(a(function({routeId:e}){let o=N();return(0,A.jsx)(yr,{router:o,match:W(o.stores.getMatchStore(e),r=>r)})},"MatchImpl"));function yr({router:t,match:e}){let o=t.routesById[e.routeId],r=oe(t,o),n=o.options.errorComponent??t.options.defaultErrorComponent,s=o.options.onCatch??t.options.defaultOnCatch,u=o.isRoot?o.options.notFoundComponent??t.options.notFoundRoute?.options.component:o.options.notFoundComponent,i=e.ssr===!1||e.ssr==="data-only",l=o.options.wrapInSuspense??r??(o.options.errorComponent?.preload||i)?G.Suspense:Rt,c=n?Tt:Rt,f=u?fr:Rt;return(0,A.jsxs)(o.isRoot?o.options.shellComponent??Rt:Rt,{children:[(0,A.jsx)(bt.Provider,{value:e.routeId,children:(0,A.jsx)(l,{fallback:r,children:(0,A.jsx)(c,{getResetKey:a(()=>e,"getResetKey"),errorComponent:n,onCatch:a((d,h)=>{if(K(d))throw d.routeId??=e.routeId,d;s?.(d,h)},"onCatch"),children:(0,A.jsx)(f,{fallback:a(d=>{if(d.routeId??=e.routeId,d.routeId!==e.routeId)throw d;return G.createElement(u,d)},"fallback"),children:i?(0,A.jsx)(or,{fallback:r,children:(0,A.jsx)(_r,{match:e})}):(0,A.jsx)(_r,{match:e})})})})}),null]})}a(yr,"MatchView");var _r=G.memo(a(function({match:e}){let o=N(),r=e.routeId,n=o.routesById[r],s=G.useMemo(()=>{let i=(n.options.remountDeps??o.options.defaultRemountDeps)?.({routeId:r,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[r,e.loaderDeps,e._strictParams,e._strictSearch,n.options.remountDeps,o.options.defaultRemountDeps]),u=G.useMemo(()=>{let i=n.options.component??o.options.defaultComponent;return i?(0,A.jsx)(i,{},s):(0,A.jsx)(Sr,{})},[s,n.options.component,o.options.defaultComponent]);if(e.status==="pending"){if(o._tx)throw o._tx[5];return oe(o,n)}if(e.status==="notFound")return To(o,n,e.error);if(e.status==="error"){if(!1)return(0,A.jsx)((n.options.errorComponent??o.options.defaultErrorComponent)||So,{error:e.error,reset:void 0,info:{componentStack:""}});throw e.error}return u},"MatchInnerImpl")),Sr=G.memo(a(function(){let e=N(),o=G.useContext(bt),r,n,s;if(!1){let i=e.stores.matches.get(),l=i.findIndex(f=>f.routeId===o),c=i[l];r=!!c._notFound,n=c.error,s=i[l+1]?.routeId}else{let i=e.stores.getMatchStore(o);[r,n]=W(i,l=>[!!l._notFound,l.error],Is),s=W(e.stores.ids,l=>l[l.indexOf(o)+1])}if(r)return To(e,e.routesById[o],n);if(!s)return null;let u=(0,A.jsx)(Me,{routeId:s});return o===tt?(0,A.jsx)(G.Suspense,{fallback:oe(e),children:u}):u},"OutletImpl"));var Mo=k(B(),1);function Oo(t,e){let o=t[1];t.length=0,o?.(e)}a(Oo,"settleOwner");function Rr({t}){let e=N(),o=e._rendered??=[],r=void 0;return e.startTransition=(n,s)=>new Promise((u,i)=>{Oo(o,!1),o.push(s,u),t(e),Mo.startTransition(()=>{try{n()}catch(l){o[1]===u&&(o.length=0),i(l)}})}),Le(()=>{let n=e.history.subscribe(e.load);if(r?.current)return n;r&&(r.current=!0),e.updateLatestLocation();let s=e.latestLocation,u=e.buildLocation({to:s.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(Y(s.publicHref)!==Y(u.publicHref))return e.commitLocation({...u,replace:!0,ignoreBlocker:!0}),n;let i=e.stores.resolvedLocation.get();return i?.href===s.href&&i.state.__TSR_key===s.state.__TSR_key?o.push(e.stores.matches.get(),l=>{l&&e.emit({type:"onRendered",...Ct(i,i)})}):e._tx||e.load().catch(console.error),n},[e,e.history]),null}a(Rr,"Transitioner");var zt=k(B(),1);var ot=k(Z(),1);function wr(){let t=N(),e=t.routesById[tt],o=oe(t,e),r=t.ssr?Rt:zt.Suspense,n=(0,ot.jsxs)(ot.Fragment,{children:[!!1&&(0,ot.jsx)(Rr,{t:zt.useState()[1]}),(0,ot.jsx)(r,{fallback:o,children:(0,ot.jsx)(Ts,{})})]});return t.options.InnerWrap?(0,ot.jsx)(t.options.InnerWrap,{children:n}):n}a(wr,"Matches");function Ts(){let t=N(),e=t._rendered,o=W(t.stores.matches,u=>e[0]??u),r=o[0],n=r?.routeId;Le(()=>{e[0]===o&&Oo(e,!0)},[e,o]);let s=n?(0,ot.jsx)(Me,{routeId:n}):null;return(0,ot.jsx)(bt.Provider,{value:n,children:t.options.disableGlobalCatchBoundary?s:(0,ot.jsx)(Tt,{getResetKey:a(()=>r,"getResetKey"),onCatch:void 0,children:s})})}a(Ts,"MatchesInner");var xr=a(t=>({createMutableStore:be,createReadonlyStore:be,batch:mo}),"getStoreFactory");var Ms=a(t=>new br(t),"createRouter"),br=class extends oo{static{a(this,"Router")}constructor(t){super(t,xr)}};var Kl=k(B(),1),ne=k(Z(),1);function Pr({router:t,children:e,...o}){ht(o)&&t.update({...t.options,...o,context:{...t.options.context,...o.context}});let r=(0,ne.jsx)(ae.Provider,{value:t,children:e});return t.options.Wrap?(0,ne.jsx)(t.options.Wrap,{children:r}):r}a(Pr,"RouterContextProvider");function Os({router:t,...e}){return(0,ne.jsx)(Pr,{router:t,...e,children:(0,ne.jsx)(wr,{})})}a(Os,"RouterProvider");function Ns(t){let e=N({warn:t?.router===void 0}),o=t?.router||e;if(!1){let r=o.stores.__store.get();return t?.select?t.select(r):r}return W(o.stores.__store,yo(t,o))}a(Ns,"useRouterState");export{to as a,es as b,N as c,Ce as d,Ee as e,Es as f,ks as g,Sr as h,Ms as i,Os as j,Ns as k};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-YKXDMIHQ.js";var u={highErrorRate:.05,highWriteContention:.1,lowCacheHitRate:.5,minCacheSamples:10,minConflictCalls:5,minErrorCalls:5,slowFunctionMs:1e3,storageCriticalBytes:5368709120,storageWarnBytes:1073741824},h={error:0,info:2,warning:1},g=e((a,i)=>{let s=[];if(a.maxDurationMs>=i.slowFunctionMs){let t=a.scannedTables??[];t.length>0?s.push({fn:a.path,kind:"missing-index",severity:"warning",tables:t.map(r=>r.table),value:a.maxDurationMs}):s.push({fn:a.path,kind:"slow-function",severity:"info",value:a.maxDurationMs})}a.calls>=i.minErrorCalls&&a.errors/a.calls>=i.highErrorRate&&s.push({fn:a.path,kind:"high-error-rate",message:a.lastErrorMessage??void 0,severity:"error",value:a.errors/a.calls});let n=a.conflicts??0;return n>0&&a.calls>=i.minConflictCalls&&n/a.calls>=i.highWriteContention&&s.push({fn:a.path,kind:"high-write-contention",severity:"warning",value:n/a.calls}),s},"h"),v=e((a,i,s=u)=>{let n=[];if(typeof a?.databaseSize=="number"&&a.databaseSize>=s.storageWarnBytes&&n.push({kind:"storage-headroom",severity:a.databaseSize>=s.storageCriticalBytes?"error":"warning",value:a.databaseSize}),a?.cache){let{evictions:t,hits:r,misses:c}=a.cache,o=r+c;if(o>=s.minCacheSamples){let l=r/o;l<s.lowCacheHitRate&&n.push({kind:"low-cache-hit-rate",severity:"warning",value:l})}t>0&&t>r&&n.push({kind:"high-evictions",severity:"warning",value:t})}for(let t of i??[])n.push(...g(t,s));return n.toSorted((t,r)=>h[t.severity]-h[r.severity])},"u");export{v as a};
@@ -0,0 +1 @@
1
+ import{a as te}from"./chunk-EA2JKR5D.js";import{P as Z}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as O}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-25NFR6EB.js";import{a as K}from"./chunk-4ZEL6BYL.js";import{c as ee}from"./chunk-T6S2F46N.js";import{f as M}from"./chunk-MZDJBR3M.js";import"./chunk-FSRSK4LY.js";import"./chunk-2LN3T5HY.js";import{a as P}from"./chunk-FKVZRPV5.js";import{a as D,b as F,c as L,d as h,e as o,f as i}from"./chunk-HEAQVSNS.js";import{a as E,e as _}from"./chunk-WUWBZPUK.js";import{d as H,f as Q,g as V,h as W,o as $}from"./chunk-FODLDLE2.js";import{a as n,d as Y,e as ne,g as le}from"./chunk-YKXDMIHQ.js";var c=Y(ne(),1);var e=Y(le(),1);var oe=["queued","running","paused","waiting","complete","errored","terminated"],ie=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=n(l=>typeof l=="object"&&l!==null&&l.code===de,"ie"),me=n(l=>{let r=l.error??l.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r)}catch{return"(unserializable)"}},"de"),ue=n(({loadDetail:l,loadInstances:r,readOnly:N,runAction:j,workflowName:g})=>{let A=M(),s=H(),[p,k]=(0,c.useState)(null),[S,C]=(0,c.useState)(null),[v,z]=(0,c.useState)(""),[b,f]=(0,c.useState)(null),[J,I]=(0,c.useState)(!1),[R,U]=(0,c.useState)(null),x=l??(a=>A.getWorkflowInstance(a)),w=N?void 0:j??(r===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),T=n(async()=>{f(null),I(!1);let a=v===""?void 0:v;try{if(r===void 0){let d=await A.listWorkflowInstances({name:g,status:a});if(d.configured===!1){k(null),I(!0);return}k(d.instances);return}k(await r({name:g,status:a}))}catch(d){k(null),ce(d)?I(!0):f(W(d))}},"L");(0,c.useEffect)(()=>{C(null),$(T())},[g,v]);let q=n(async a=>{f(null);try{C(await x({id:a,name:g}))}catch(d){f(W(d))}},"K"),B=n(async(a,d)=>{if(w!==void 0){U(a),f(null);try{await w({action:d,id:a,name:g}),await T()}catch(G){f(W(G))}U(null)}},"q");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:s("Instance history")}),(0,e.jsxs)("select",{"aria-label":s("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:n(a=>{z(a.target.value)},"onChange"),value:v,children:[(0,e.jsx)("option",{value:"",children:s("All statuses")}),oe.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),b!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:b}),J&&(0,e.jsx)(P,{description:s("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:s("Workflow inspection not configured")}),!J&&p!==null&&p.length===0&&(0,e.jsx)(P,{description:s("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:s("No instances")}),p!==null&&p.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Instance id")}),(0,e.jsx)(o,{children:s("Status")}),(0,e.jsx)(o,{children:s("Created")}),(0,e.jsx)(o,{children:s("Ended")}),(0,e.jsx)(o,{"aria-label":s("Actions")})]})}),(0,e.jsx)(L,{children:p.map(a=>(0,e.jsxs)(h,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(i,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(O,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:n(()=>{$(q(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:s("Steps")}),w!==void 0&&ie.map(d=>(0,e.jsx)(O,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:R===a.id,onClick:n(()=>{$(B(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:s(d)},d))]})})]},a.id))})]})})}),S!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[s("Steps")," \xB7 ",S.id]}),(0,e.jsx)(O,{"data-testid":"workflow-instance-detail-close",onClick:n(()=>{C(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Close")})]}),S.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s("This instance has no recorded steps yet.")}):(0,e.jsxs)(D,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:s("Step")}),(0,e.jsx)(o,{children:s("Type")}),(0,e.jsx)(o,{children:s("Attempts")}),(0,e.jsx)(o,{children:s("Started")}),(0,e.jsx)(o,{children:s("Output")})]})}),(0,e.jsx)(L,{children:S.steps.map((a,d)=>(0,e.jsxs)(h,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(i,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:me(a)})]},`${a.name}:${String(d)}`))})]})]})})]})},"ce"),fe=Q(K.createWorkflowInstance),he=Q(K.getWorkflowInstanceStatus),pe=n(l=>{if(l.error)return`${l.error.name}: ${l.error.message}`;if(l.output===void 0)return"\u2014";try{return JSON.stringify(l.output)}catch{return"(unserializable)"}},"fe"),xe=n((l,r)=>l.some(N=>N.exportName===r)?r:l[0]?.exportName??"","he"),We=n(()=>{let l=M(),r=H(),{data:N,error:j}=ee(K.listWorkflows,{}),[g,A]=(0,c.useState)(""),[s,p]=(0,c.useState)(""),[k,S]=(0,c.useState)(""),[C,v]=(0,c.useState)(!1),[z,b]=(0,c.useState)(null),[f,J]=(0,c.useState)([]),[I,R]=(0,c.useState)(null),U=N!==void 0,x=Array.isArray(N?.workflows)?[...N.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],w=xe(x,g),T=x.find(t=>t.exportName===w),q=n(t=>{J(u=>{let m=u.filter(y=>!(y.exportName===t.exportName&&y.id===t.id));return[t,...m]})},"C"),B=n(async()=>{let t=w;if(t==="")return;let u,m=k.trim();if(m!=="")try{u=JSON.parse(m)}catch{b(r("Params must be valid JSON"));return}v(!0),b(null);try{let y=s.trim(),X=await l.query(fe,{exportName:t,id:y===""?void 0:y,params:u},V(""));q({exportName:t,id:X.id,status:X.status}),p("")}catch(y){b(W(y))}v(!1)},"L"),a=n(()=>{$(B())},"K"),d=n(async(t,u)=>{R(u);try{let m=await l.query(he,{exportName:t,id:u},V(""));q({error:m.error,exportName:t,id:m.id,output:m.output,status:m.status})}catch(m){b(W(m))}R(null)},"q"),G=n(t=>{A(t.target.value)},"r"),ae=n(t=>{p(t.target.value)},"l"),re=n(t=>{S(t.target.value)},"G"),se=n(t=>{let{export:u,id:m}=t.currentTarget.dataset;u!==void 0&&m!==void 0&&$(d(u,m))},"ee");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:j}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&x.length===0?(0,e.jsx)(P,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Export")}),(0,e.jsx)(o,{children:r("Name")}),(0,e.jsx)(o,{children:r("Class")}),(0,e.jsx)(o,{children:r("Binding")})]})}),(0,e.jsx)(L,{children:x.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding})]},t.exportName))})]})})}),x.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:G,value:w,children:x.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(Z,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:ae,placeholder:r("Instance id (optional)"),value:s}),(0,e.jsx)(O,{"data-testid":"workflows-start-button",disabled:C||w==="",onClick:a,children:r(C?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(te,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:re,placeholder:r("Params (JSON, optional)"),value:k})]}),f.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(_,{className:"px-0",children:(0,e.jsxs)(D,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(F,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(o,{children:r("Workflow")}),(0,e.jsx)(o,{children:r("Instance id")}),(0,e.jsx)(o,{children:r("Status")}),(0,e.jsx)(o,{children:r("Output")}),(0,e.jsx)(o,{})]})}),(0,e.jsx)(L,{children:f.map(t=>(0,e.jsxs)(h,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(i,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(i,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(i,{className:"font-mono text-xs text-muted-foreground",children:pe(t)}),(0,e.jsx)(i,{children:(0,e.jsx)(O,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:I===t.id,onClick:se,size:"xs",variant:"outline",children:I===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),T!==void 0&&(0,e.jsx)(ue,{workflowName:T.name})]})},"Te");export{We as default};
@@ -0,0 +1 @@
1
+ import{m as h,n as v}from"./chunk-JAKYTDUH.js";import{a as u,d as p,f as x,g as y,i as g}from"./chunk-YKXDMIHQ.js";var b=p(x(),1);var n=p(y(),1);var w={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},j=u(i=>{let a=(0,b.c)(12),{ariaLabel:c,className:m,series:l,testId:d}=i;if(l.length<2)return null;let t;a[0]!==l?(t=l.slice(-40).map(N),a[0]=l,a[1]=t):t=a[1];let f=t,e;a[2]!==m?(e=g("h-6 w-[120px]",m),a[2]=m,a[3]=e):e=a[3];let o;a[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(v,{dataKey:"value"}),a[4]=o):o=a[4];let r;a[5]!==f?(r=(0,n.jsx)(h,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:w,data:f,children:o}),a[5]=f,a[6]=r):r=a[6];let s;return a[7]!==c||a[8]!==e||a[9]!==r||a[10]!==d?(s=(0,n.jsx)("div",{"aria-label":c,className:e,"data-testid":d,role:"img",children:r}),a[7]=c,a[8]=e,a[9]=r,a[10]=d,a[11]=s):s=a[11],s},"w");function N(i,a){return{index:a,value:i}}u(N,"b");export{j as a};
@@ -0,0 +1 @@
1
+ import{a as ke}from"./chunk-EA2JKR5D.js";import{a as A}from"./chunk-IMOHEGMV.js";import{a as Pe}from"./chunk-BOTGXX4H.js";import{a as be}from"./chunk-IABM4BFJ.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{P as M}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as T}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as j}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as ge}from"./chunk-AJURTLI3.js";import"./chunk-ULIQFBZU.js";import"./chunk-PNDBXKC4.js";import"./chunk-35DM4JJG.js";import{a as Z}from"./chunk-4ZEL6BYL.js";import{c as ae}from"./chunk-T6S2F46N.js";import{f as oe}from"./chunk-MZDJBR3M.js";import"./chunk-FSRSK4LY.js";import"./chunk-2LN3T5HY.js";import{a as de}from"./chunk-FKVZRPV5.js";import{a as Ne,b as ve,c as we,d as ce,e as le,f as re}from"./chunk-HEAQVSNS.js";import{a as se,b as pe,c as fe,d as ue,e as ne}from"./chunk-WUWBZPUK.js";import{d as V,f as he,g as xe,h as ye,o as te}from"./chunk-FODLDLE2.js";import{a as d,d as ie,e as _e,f as Fe,g as Te}from"./chunk-YKXDMIHQ.js";var p=ie(_e(),1);var me=ie(Fe(),1);var t=ie(Te(),1);var Ce=["read","insert","update","delete"],Ae=d((e,a)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[a],"_e"),Ee=d(e=>{let a=new Set;for(let i of e?.advisories??[])if(i.name==="rls_uncovered_table"){let{table:s}=i.metadata;typeof s=="string"&&s!==""&&a.add(s)}return a},"Ie"),$e=d((e,a,i)=>{let s=new Map,l=d(n=>{let o=s.get(n);if(o!==void 0)return o;let f={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:new Set,table:n,uncovered:i.has(n)};return s.set(n,f),f},"l");for(let n of e)l(n.table).cells[n.on]={procedure:n.procedure};for(let n of a)l(n.table).maskedColumns.add(n.column);for(let n of i)l(n);return[...s.values()].toSorted((n,o)=>n.table.localeCompare(o.table))},"Ee"),ze=d(e=>{let a=(0,me.c)(17),i;a[0]!==e?(i=e===void 0?{}:e,a[0]=e,a[1]=i):i=a[1];let{onProbe:s}=i,l=V(),n,o;a[2]===Symbol.for("react.memo_cache_sentinel")?(n={},o={live:!0},a[2]=n,a[3]=o):(n=a[2],o=a[3]);let f=ae(Z.rlsPolicies,n,o),r;a[4]===Symbol.for("react.memo_cache_sentinel")?(r={},a[4]=r):r=a[4];let b=ae(Z.maskPolicies,r),h;a[5]===Symbol.for("react.memo_cache_sentinel")?(h={},a[5]=h):h=a[5];let g=ae(Z.getAdvisories,h),N;if(a[6]!==g.data||a[7]!==b.data||a[8]!==s||a[9]!==f||a[10]!==l){let v=null;f.data!==void 0&&(v=Array.isArray(f.data.policies)?f.data.policies:[]);let E=Array.isArray(b.data?.columns)?b.data.columns:[],O=g.data??null,{error:C,errorSource:w,liveError:S}=f,_=v===null?[]:$e(v,E,Ee(O)),k;a[12]!==S?(k=(0,t.jsx)("div",{className:"flex items-center justify-end",children:(0,t.jsx)(Pe,{message:S,prefix:"pm"})}),a[12]=S,a[13]=k):k=a[13];let x;a[14]!==C||a[15]!==w?(x=C!==null&&(0,t.jsx)(ge,{error:w,testId:"pm-error"}),a[14]=C,a[15]=w,a[16]=x):x=a[16],N=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[k,x,v!==null&&_.length===0?(0,t.jsx)(de,{description:l("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:l("No policy")}):(0,t.jsxs)(Ne,{"data-testid":"pm-table",children:[(0,t.jsx)(ve,{children:(0,t.jsxs)(ce,{children:[(0,t.jsx)(le,{children:l("Table")}),Ce.map(c=>(0,t.jsx)(le,{children:Ae(l,c)},c)),(0,t.jsx)(le,{children:l("Masked columns")})]})}),(0,t.jsx)(we,{children:_.map(c=>(0,t.jsxs)(ce,{"data-testid":`pm-row-${c.table}`,children:[(0,t.jsx)(re,{className:"font-mono text-xs",children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[c.table,c.uncovered&&(0,t.jsx)(j,{"data-testid":`pm-uncovered-${c.table}`,title:l("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:l("Uncovered \u2014 reachable without a policy")})]})}),Ce.map(I=>{let y=c.cells[I];return(0,t.jsx)(re,{"data-testid":`pm-cell-${c.table}-${I}`,children:y.procedure===void 0?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("No policy")}):(0,t.jsxs)("span",{className:"flex flex-col gap-1",children:[(0,t.jsx)(j,{variant:"secondary",children:l("Covered by {procedure}",{procedure:y.procedure})}),s!==void 0&&(0,t.jsx)(T,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${c.table}-${I}`,onClick:d(()=>{s(c.table,I,y.procedure??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Probe this")})]})},I)}),(0,t.jsx)(re,{children:c.maskedColumns.size===0?(0,t.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)("span",{className:"flex flex-wrap gap-1",children:[...c.maskedColumns].map(Re)})})]},c.table))})]})]}),a[6]=g.data,a[7]=b.data,a[8]=s,a[9]=f,a[10]=l,a[11]=N}else N=a[11];return N},"Fe");function Re(e){return(0,t.jsx)(j,{variant:"outline",children:e},e)}d(Re,"Re");var Le=he(Z.runAs),Oe=d(()=>{let e=oe();return async({args:a,functionPath:i,shardKey:s="",userId:l})=>{let n=Le;try{return{kind:"allowed",value:await e.query(n,{args:a,functionPath:i,userId:l},xe(s))}}catch(o){return{kind:"denied",message:o instanceof Error?o.message:String(o)}}}},"Le"),je=d(e=>e===void 0?"undefined":JSON.stringify(e,null,2),"Me"),Me=d(({functions:e,prefill:a,runAsIdentity:i=!1}={})=>{let s=oe(),l=V(),n=Oe(),[o,f]=(0,p.useState)(null),[r,b]=(0,p.useState)(null),h=e??o??[],[g,N]=(0,p.useState)(""),[v,E]=(0,p.useState)("{}"),[O,C]=(0,p.useState)(""),[w,S]=(0,p.useState)(""),[_,k]=(0,p.useState)(!1),[x,c]=(0,p.useState)(null),[I,y]=(0,p.useState)(null),F=(0,p.useRef)(-1);(0,p.useEffect)(()=>{if(e!==void 0)return;let m=!1;return s.listFunctions().then(u=>(m||f(u),u)).catch(u=>{m||b(ye(u))}),()=>{m=!0}},[s,e]),(0,p.useEffect)(()=>{if(a===void 0||F.current===a.nonce)return;F.current=a.nonce;let m=a.functionPath;queueMicrotask(()=>{N(m),c(null)})},[a]);let P=g===""?h[0]?.path??"":g,$=d(async()=>{if(P==="")return;let m;try{m=v.trim()===""?{}:JSON.parse(v)}catch(u){y(l("Invalid JSON args: {message}",{message:u.message})),c(null);return}y(null),k(!0);try{let u=await n({args:m,functionPath:P,shardKey:O.trim(),userId:w.trim()});c(u)}finally{k(!1)}},"E"),z=d(()=>{te($())},"F"),Y=d(m=>{N(m.target.value)},"Y"),R=d(m=>{E(m.target.value)},"R"),L=d(m=>{S(m.target.value)},"O");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[r!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:r}),!i&&(0,t.jsx)(de,{description:l("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:l("Set `runAsIdentity` to forge an identity and probe access.")}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(A,{htmlFor:"pp-function",children:l("Function")}),(0,t.jsx)("select",{"aria-label":l("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:Y,value:P,children:h.map(m=>(0,t.jsxs)("option",{value:m.path,children:[m.path," (",m.kind,")"]},m.path))})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(A,{htmlFor:"pp-args",children:l("Arguments")}),(0,t.jsx)(ke,{"aria-label":l("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:R,value:v})]}),(0,t.jsx)(be,{onChange:C,testId:"pp-shard",value:O}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(A,{htmlFor:"pp-user",children:l("Run as (userId)")}),(0,t.jsx)(M,{"aria-label":l("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:L,placeholder:l("Leave empty to run as admin"),value:w})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(T,{"data-testid":"pp-run",disabled:!i||_||P==="",onClick:z,type:"button",children:l(_?"Probing\u2026":"Run probe")}),w.trim()!==""&&(0,t.jsx)(j,{"data-testid":"pp-as-badge",variant:"secondary",children:l("as {userId}",{userId:w.trim()})})]})]}),I!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:I}),x!==null&&x.kind==="allowed"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,t.jsx)(j,{variant:"secondary",children:l("Allowed")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:je(x.value)})]}),x!==null&&x.kind==="denied"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,t.jsx)(j,{variant:"destructive",children:l("Denied")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:x.message})]})]})},"$e"),De="/__lunora/policy-scaffold",Ue={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},qe=d(async e=>{let a=await fetch(De,{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"}),i=await a.json();if(i.needsManualEdit===!0)return{kind:"needs-manual-edit",message:i.message??"This change must be made by hand."};if(a.ok)return{diagnostics:i.diagnostics??[],kind:"ok",label:i.fileName??i.exportName??""};let s=i.error;return{kind:"error",message:s===void 0?`policy scaffold failed (${String(a.status)})`:Ue[s]??s}},"Ue"),Se={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},Je=d(()=>{let e=(0,me.c)(69),a=V(),[i,s]=(0,p.useState)(null),[l,n]=(0,p.useState)(!1),[o,f]=(0,p.useState)(null),[r,b]=(0,p.useState)(Se),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=d(ee=>{let G=ee.target.name,{value:H}=ee.target;b(Ie=>({...Ie,[G]:H}))},"u"),e[0]=h):h=e[0];let g=h,N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=d(()=>{s(null),b(Se)},"v"),e[1]=N):N=e[1];let v=N,E;e[2]===Symbol.for("react.memo_cache_sentinel")?(E=d(async ee=>{n(!0),f(null);try{let G=await qe(ee);f(G),G.kind==="ok"&&v()}catch(G){let H=G;f({kind:"error",message:H instanceof Error?H.message:String(H)})}n(!1)},"I"),e[2]=E):E=e[2];let O=E,C;e[3]!==r.policyName||e[4]!==r.tableName?(C=d(()=>{te(O({kind:"scaffoldPolicy",name:r.policyName.trim(),table:r.tableName.trim()}))},"P"),e[3]=r.policyName,e[4]=r.tableName,e[5]=C):C=e[5];let w=C,S;e[6]!==r.exportName||e[7]!==r.filePath||e[8]!==r.policies?(S=d(()=>{te(O({exportName:r.exportName.trim(),filePath:r.filePath.trim(),kind:"wireRls",policies:r.policies.trim()}))},"w"),e[6]=r.exportName,e[7]=r.filePath,e[8]=r.policies,e[9]=S):S=e[9];let _=S,k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=d(()=>{f(null),s("scaffold")},"S"),e[10]=k):k=e[10];let x=k,c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=d(()=>{f(null),s("wire")},"d"),e[11]=c):c=e[11];let I=c,y;e[12]!==a?(y=a("Scaffold access rules"),e[12]=a,e[13]=y):y=e[13];let F;e[14]!==y?(F=(0,t.jsx)(fe,{children:y}),e[14]=y,e[15]=F):F=e[15];let P;e[16]!==a?(P=a("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only."),e[16]=a,e[17]=P):P=e[17];let $;e[18]!==P?($=(0,t.jsx)(ue,{children:P}),e[18]=P,e[19]=$):$=e[19];let z;e[20]!==$||e[21]!==F?(z=(0,t.jsxs)(pe,{children:[F,$]}),e[20]=$,e[21]=F,e[22]=z):z=e[22];let Y=i==="scaffold"?"default":"outline",R;e[23]!==a?(R=a("New policy file"),e[23]=a,e[24]=R):R=e[24];let L;e[25]!==Y||e[26]!==R?(L=(0,t.jsx)(T,{"data-testid":"policy-scaffolder-new",onClick:x,size:"xs",type:"button",variant:Y,children:R}),e[25]=Y,e[26]=R,e[27]=L):L=e[27];let m=i==="wire"?"default":"outline",u;e[28]!==a?(u=a("Wire into a procedure"),e[28]=a,e[29]=u):u=e[29];let D;e[30]!==m||e[31]!==u?(D=(0,t.jsx)(T,{"data-testid":"policy-scaffolder-wire",onClick:I,size:"xs",type:"button",variant:m,children:u}),e[30]=m,e[31]=u,e[32]=D):D=e[32];let U;e[33]!==L||e[34]!==D?(U=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[L,D]}),e[33]=L,e[34]=D,e[35]=U):U=e[35];let q;e[36]!==l||e[37]!==r.policyName||e[38]!==r.tableName||e[39]!==i||e[40]!==w||e[41]!==a?(q=i==="scaffold"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-name",children:a("Policy name")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:g,value:r.policyName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-table",children:a("Table name")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:g,value:r.tableName})]}),(0,t.jsx)(T,{"data-testid":"policy-scaffolder-create",disabled:l||r.policyName.trim()===""||r.tableName.trim()==="",onClick:w,size:"xs",type:"button",children:a(l?"Creating\u2026":"Create policy file")}),(0,t.jsx)(T,{onClick:v,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[36]=l,e[37]=r.policyName,e[38]=r.tableName,e[39]=i,e[40]=w,e[41]=a,e[42]=q):q=e[42];let J;e[43]!==l||e[44]!==r.exportName||e[45]!==r.filePath||e[46]!==r.policies||e[47]!==i||e[48]!==_||e[49]!==a?(J=i==="wire"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-file",children:a("Procedure file path")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:g,value:r.filePath})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-export",children:a("Exported procedure")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:g,value:r.exportName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-policies",children:a("Policy set identifier")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:g,value:r.policies})]}),(0,t.jsx)(T,{"data-testid":"policy-scaffolder-apply",disabled:l||r.filePath.trim()===""||r.exportName.trim()===""||r.policies.trim()==="",onClick:_,size:"xs",type:"button",children:a(l?"Wiring\u2026":"Wire RLS")}),(0,t.jsx)(T,{onClick:v,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[43]=l,e[44]=r.exportName,e[45]=r.filePath,e[46]=r.policies,e[47]=i,e[48]=_,e[49]=a,e[50]=J):J=e[50];let W;e[51]!==o?(W=o?.kind==="error"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:o.message}),e[51]=o,e[52]=W):W=e[52];let B;e[53]!==o?.kind||e[54]!==a?(B=o?.kind==="needs-manual-edit"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:a("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")}),e[53]=o?.kind,e[54]=a,e[55]=B):B=e[55];let K;e[56]!==o||e[57]!==a?(K=o?.kind==="ok"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,t.jsx)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:a("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:o.label})}),o.diagnostics.length>0&&(0,t.jsx)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:o.diagnostics.map(We)})]}),e[56]=o,e[57]=a,e[58]=K):K=e[58];let Q;e[59]!==U||e[60]!==q||e[61]!==J||e[62]!==W||e[63]!==B||e[64]!==K?(Q=(0,t.jsxs)(ne,{children:[U,q,J,W,B,K]}),e[59]=U,e[60]=q,e[61]=J,e[62]=W,e[63]=B,e[64]=K,e[65]=Q):Q=e[65];let X;return e[66]!==z||e[67]!==Q?(X=(0,t.jsxs)(se,{"data-testid":"policy-scaffolder",size:"sm",children:[z,Q]}),e[66]=z,e[67]=Q,e[68]=X):X=e[68],X},"je");function We(e){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:e},e)}d(We,"Be");var st=d(({functions:e,runAsIdentity:a=!1,schemaEditable:i=!1}={})=>{let s=V(),[l,n]=(0,p.useState)(void 0),o=d((f,r,b)=>{b!==""&&n(h=>({functionPath:b,nonce:(h?.nonce??0)+1}))},"o");return(0,t.jsxs)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,t.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Permissions")})}),(0,t.jsx)(ze,{onProbe:o})]}),(0,t.jsx)("section",{className:"flex flex-col gap-3",children:(0,t.jsxs)(se,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Probe")})}),(0,t.jsxs)(ne,{className:"px-4 py-4",children:[(0,t.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:s("Pick a function and an identity, then run it to see the access outcome.")}),(0,t.jsx)(Me,{functions:e,prefill:l,runAsIdentity:a})]})]})}),i&&(0,t.jsx)("section",{className:"flex flex-col gap-2",children:(0,t.jsx)(Je,{})})]})},"nt");export{st as PermissionsPanel};
@@ -0,0 +1 @@
1
+ import{a as H}from"./chunk-66UGPQVC.js";import{b as x}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as z}from"./chunk-T6S2F46N.js";import{f as O}from"./chunk-MZDJBR3M.js";import"./chunk-FSRSK4LY.js";import"./chunk-2LN3T5HY.js";import{a as _}from"./chunk-FKVZRPV5.js";import{a as q,b as B,c as E,d as S,e as i,f as s}from"./chunk-HEAQVSNS.js";import{a as A,e as L}from"./chunk-WUWBZPUK.js";import{d as W}from"./chunk-FODLDLE2.js";import{a as R,d as M,f as $,g as D}from"./chunk-YKXDMIHQ.js";var I=M($(),1);var n=M(D(),1);var F=2e3,G=new Set(["open"]),ie=R(Q=>{let e=(0,I.c)(41),{read:y}=Q,t=W(),j=O(),v;e[0]!==j||e[1]!==y?(v=R(()=>Promise.resolve(y?y():j.debug()),"T"),e[0]=j,e[1]=y,e[2]=v):v=e[2];let V=v,K=y?"injected":"live",b;e[3]!==K?(b=["lunora-studio","sync-client-debug",K],e[3]=K,e[4]=b):b=e[4];let{data:c,refetch:Y}=z(b,V);if(H(Y,!0,F),!c){let r;e[5]!==t?(r=t("Reading the sync client's state\u2026"),e[5]=t,e[6]=r):r=e[6];let g;e[7]!==t?(g=t("Sync client"),e[7]=t,e[8]=g):g=e[8];let T;return e[9]!==r||e[10]!==g?(T=(0,n.jsx)(A,{children:(0,n.jsx)(L,{children:(0,n.jsx)(_,{description:r,title:g})})}),e[9]=r,e[10]=g,e[11]=T):T=e[11],T}let{pendingWrites:k,shards:N,subscriptions:w}=c,a;e[12]!==t?(a=t("This Studio session's sync client"),e[12]=t,e[13]=a):a=e[13];let l;e[14]!==a?(l=(0,n.jsx)("span",{className:"text-sm font-medium",children:a}),e[14]=a,e[15]=l):l=e[15];let P=c.connectionStatus==="connected"?"default":"secondary",o;e[16]!==c.connectionStatus||e[17]!==P?(o=(0,n.jsx)(x,{variant:P,children:c.connectionStatus}),e[16]=c.connectionStatus,e[17]=P,e[18]=o):o=e[18];let d;e[19]!==k||e[20]!==t?(d=k>0?(0,n.jsx)(x,{variant:"secondary",children:t("{count} pending writes",{count:k})}):null,e[19]=k,e[20]=t,e[21]=d):d=e[21];let h;e[22]!==l||e[23]!==o||e[24]!==d?(h=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[l,o,d]}),e[22]=l,e[23]=o,e[24]=d,e[25]=h):h=e[25];let u;e[26]!==t?(u=t("Reads client.debug() for the client running in this page \u2014 not your application's client. Call client.debug() in your app to diagnose a specific stuck overlay there."),e[26]=t,e[27]=u):u=e[27];let m;e[28]!==u?(m=(0,n.jsx)("p",{className:"text-muted-foreground text-xs",children:u}),e[28]=u,e[29]=m):m=e[29];let p;e[30]!==N||e[31]!==t?(p=N.length===0?(0,n.jsx)(_,{description:t("No shard connection has been opened yet."),title:t("No shards")}):(0,n.jsxs)(q,{children:[(0,n.jsx)(B,{children:(0,n.jsxs)(S,{children:[(0,n.jsx)(i,{children:t("Shard")}),(0,n.jsx)(i,{children:t("Socket")}),(0,n.jsx)(i,{children:t("Confirmed watermark")})]})}),(0,n.jsx)(E,{children:N.map(r=>(0,n.jsxs)(S,{children:[(0,n.jsx)(s,{children:r.shardKey??t("(default)")}),(0,n.jsx)(s,{children:(0,n.jsx)(x,{variant:G.has(r.wsState)?"default":"secondary",children:r.wsState})}),(0,n.jsx)(s,{children:r.confirmedMutationWatermark})]},r.shardKey??"__default__"))})]}),e[30]=N,e[31]=t,e[32]=p):p=e[32];let f;e[33]!==w||e[34]!==t?(f=w.length===0?(0,n.jsx)(_,{description:t("This client holds no live queries or shapes."),title:t("No subscriptions")}):(0,n.jsxs)(q,{children:[(0,n.jsx)(B,{children:(0,n.jsxs)(S,{children:[(0,n.jsx)(i,{children:t("Subscription")}),(0,n.jsx)(i,{children:t("Kind")}),(0,n.jsx)(i,{children:t("Acked")}),(0,n.jsx)(i,{children:t("Cursor")}),(0,n.jsx)(i,{children:t("Pending overlays")})]})}),(0,n.jsx)(E,{children:w.map(r=>(0,n.jsxs)(S,{children:[(0,n.jsx)(s,{className:"font-mono text-xs",children:r.functionPath}),(0,n.jsx)(s,{children:r.kind}),(0,n.jsx)(s,{children:(0,n.jsx)(x,{variant:r.acked?"default":"secondary",children:r.acked?t("yes"):t("no")})}),(0,n.jsx)(s,{children:r.serverCursor??"\u2014"}),(0,n.jsx)(s,{children:r.pendingOptimisticLayers})]},r.id))})]}),e[33]=w,e[34]=t,e[35]=f):f=e[35];let C;return e[36]!==m||e[37]!==p||e[38]!==f||e[39]!==h?(C=(0,n.jsx)(A,{children:(0,n.jsxs)(L,{className:"flex flex-col gap-4",children:[h,m,p,f]})}),e[36]=m,e[37]=p,e[38]=f,e[39]=h,e[40]=C):C=e[40],C},"ie");export{ie as default};