@lunora/studio 1.0.0-alpha.381 → 1.0.0-alpha.382

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 (190) hide show
  1. package/dist/index.mjs +1 -1
  2. package/dist/mount.mjs +1 -1
  3. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
  4. package/dist/packem_chunks/ApiTab.mjs +1 -1
  5. package/dist/packem_chunks/AuditPanel.mjs +1 -1
  6. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -1
  7. package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
  8. package/dist/packem_chunks/FileBrowser.mjs +1 -1
  9. package/dist/packem_chunks/FunctionRunner.mjs +1 -1
  10. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
  11. package/dist/packem_chunks/HealthPanel.mjs +1 -1
  12. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  13. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  14. package/dist/packem_chunks/MailPanel.mjs +1 -1
  15. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  16. package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
  17. package/dist/packem_chunks/PitrPanel.mjs +1 -1
  18. package/dist/packem_chunks/SchemaViewer.mjs +1 -1
  19. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
  20. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  21. package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
  22. package/dist/packem_chunks/TableEditor.mjs +1 -1
  23. package/dist/packem_chunks/agents-panel.mjs +1 -1
  24. package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
  25. package/dist/packem_chunks/analytics-panel.mjs +1 -1
  26. package/dist/packem_chunks/architecture-panel.mjs +1 -1
  27. package/dist/packem_chunks/assistant-panel.mjs +2 -2
  28. package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
  29. package/dist/packem_chunks/auth-config-panel.mjs +1 -1
  30. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
  31. package/dist/packem_chunks/containers-panel.mjs +1 -1
  32. package/dist/packem_chunks/dashboards-panel.mjs +1 -1
  33. package/dist/packem_chunks/evals-panel.mjs +1 -1
  34. package/dist/packem_chunks/fanout-panel.mjs +1 -1
  35. package/dist/packem_chunks/flags-panel.mjs +1 -1
  36. package/dist/packem_chunks/issues-panel.mjs +1 -1
  37. package/dist/packem_chunks/kv-browser.mjs +1 -1
  38. package/dist/packem_chunks/log-drains-panel.mjs +1 -1
  39. package/dist/packem_chunks/migrations-route.mjs +1 -1
  40. package/dist/packem_chunks/organizations-panel.mjs +1 -1
  41. package/dist/packem_chunks/payments-panel.mjs +1 -1
  42. package/dist/packem_chunks/permissions-panel.mjs +1 -1
  43. package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
  44. package/dist/packem_chunks/queues-panel.mjs +1 -1
  45. package/dist/packem_chunks/reactors-panel.mjs +1 -1
  46. package/dist/packem_chunks/rls-panel.mjs +1 -1
  47. package/dist/packem_chunks/schedule-panel.mjs +1 -1
  48. package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
  49. package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
  50. package/dist/packem_chunks/sync-client-panel.mjs +1 -1
  51. package/dist/packem_chunks/traces-panel.mjs +1 -1
  52. package/dist/packem_chunks/users-panel.mjs +1 -1
  53. package/dist/packem_chunks/vector-browser.mjs +1 -1
  54. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  55. package/dist/packem_shared/ApiDocsPanel-BZNuHTR8.mjs +2 -0
  56. package/dist/packem_shared/{ApiReferencePanel-CQxU1Ocx.mjs → ApiReferencePanel-DDvLw7c1.mjs} +1 -1
  57. package/dist/packem_shared/{CommandPalette-BZCHLpst.mjs → CommandPalette-BjHFgNA6.mjs} +1 -1
  58. package/dist/packem_shared/{DEFAULT_AUTO_REFRESH_MS-B9kGlqXE.mjs → DEFAULT_AUTO_REFRESH_MS-jK7srdI4.mjs} +1 -1
  59. package/dist/packem_shared/{DataBrowser-CkVOu6py.mjs → DataBrowser-Dp8ayK1S.mjs} +1 -1
  60. package/dist/packem_shared/{GlobalDataBrowser-l2ECwXCm.mjs → GlobalDataBrowser-VehUMwUK.mjs} +1 -1
  61. package/dist/packem_shared/{HomePanel-c7as4tvl.mjs → HomePanel-D5-wWLAj.mjs} +1 -1
  62. package/dist/packem_shared/{MigrationsPanel-BQol4Un1.mjs → MigrationsPanel-CTd2YSSk.mjs} +1 -1
  63. package/dist/packem_shared/{OpenRpcReferencePanel-BFDG91tn.mjs → OpenRpcReferencePanel-dXFl95w8.mjs} +1 -1
  64. package/dist/packem_shared/{ScheduledJobs-Du8ZGL7v.mjs → ScheduledJobs-DPQHuiy6.mjs} +1 -1
  65. package/dist/packem_shared/Studio-CrfDOmdv.mjs +1 -0
  66. package/dist/packem_shared/{StudioApp-CsyDnrg2.mjs → StudioApp-DKBDIF7N.mjs} +1 -1
  67. package/dist/packem_shared/{advisor-view-gtf_DhUU.mjs → advisor-view-y9c2z5w1.mjs} +1 -1
  68. package/dist/packem_shared/{assistant-provider-Dw0roZh3.mjs → assistant-provider-b2GtJb5K.mjs} +1 -1
  69. package/dist/packem_shared/{data-grid-B5m1OosL.mjs → data-grid-GQLHcpMI.mjs} +1 -1
  70. package/dist/packem_shared/{diagram-export-panel-Vdt-DZnO.mjs → diagram-export-panel-miFPsocM.mjs} +1 -1
  71. package/dist/packem_shared/{error-alert-3AR_-s_s.mjs → error-alert-BxCd81tw.mjs} +1 -1
  72. package/dist/packem_shared/{grid-features-Drvfswwy.mjs → grid-features-Cdy2nWxA.mjs} +2 -2
  73. package/dist/packem_shared/{home-panel-TpxiaHgB.mjs → home-panel-BlvQ0xK2.mjs} +1 -1
  74. package/dist/packem_shared/{internal-hIuTpSbx.mjs → internal-BT5tH08j.mjs} +1 -1
  75. package/dist/packem_shared/{log-line-CYJQf6P-.mjs → log-line-BmYn49u1.mjs} +1 -1
  76. package/dist/packem_shared/{recording-client-z4CBi0y8.mjs → recording-client-D_-eNapT.mjs} +1 -1
  77. package/dist/packem_shared/{reference-view-DENugPcj.mjs → reference-view-CRtrtDMy.mjs} +3 -3
  78. package/dist/packem_shared/{schema-diagram-CtVPhOGj.mjs → schema-diagram-Dbs7-jSJ.mjs} +1 -1
  79. package/dist/packem_shared/{sql-result-table-DCwooMGW.mjs → sql-result-table-BuOHHoFG.mjs} +1 -1
  80. package/dist/packem_shared/{studio-DZlpp4Vx.mjs → studio-CwelGawN.mjs} +1 -1
  81. package/dist/packem_shared/{table-list-sidebar-Bfmg04MD.mjs → table-list-sidebar-Cw7ll9yK.mjs} +1 -1
  82. package/dist/packem_shared/{use-admin-query-CaOm4JS3.mjs → use-admin-query-DMnTt_hg.mjs} +1 -1
  83. package/dist/packem_shared/{use-admin-spec-CK7mk3Ui.mjs → use-admin-spec-Cokw73Ks.mjs} +1 -1
  84. package/dist/packem_shared/use-assistant-rpc-DLsuqTPB.mjs +1 -0
  85. package/dist/packem_shared/{use-async-submit-D0r7-m2J.mjs → use-async-submit-CBFJevkc.mjs} +1 -1
  86. package/dist/packem_shared/{use-auth-config-DameIc6y.mjs → use-auth-config-xzSMjhOV.mjs} +1 -1
  87. package/dist/packem_shared/{use-open-trace-BJKMJjeS.mjs → use-open-trace-trRfFb77.mjs} +1 -1
  88. package/dist/standalone/{chunk-F2DVDJV6.js → chunk-26XOFIV4.js} +1 -1
  89. package/dist/standalone/{chunk-MTBY4GXM.js → chunk-2AKEF2E6.js} +1 -1
  90. package/dist/standalone/chunk-2BX4MJK6.js +1 -0
  91. package/dist/standalone/{chunk-XBHRAFJA.js → chunk-2DDDI4IG.js} +1 -1
  92. package/dist/standalone/{chunk-Z4BLDRDD.js → chunk-2YQF4QCI.js} +1 -1
  93. package/dist/standalone/{chunk-SBQT2ZSX.js → chunk-3CDQYHJX.js} +1 -1
  94. package/dist/standalone/{chunk-FKOAI6VV.js → chunk-3CHHMX6A.js} +1 -1
  95. package/dist/standalone/{chunk-YL5ZAR3P.js → chunk-3CUQWI5A.js} +1 -1
  96. package/dist/standalone/{chunk-7MQQPZQC.js → chunk-3DIKPPNZ.js} +1 -1
  97. package/dist/standalone/{chunk-WVURFBJS.js → chunk-3JLFCEXX.js} +1 -1
  98. package/dist/standalone/{chunk-FPODRWDZ.js → chunk-3SRQFKDT.js} +1 -1
  99. package/dist/standalone/{chunk-ML6YSDEQ.js → chunk-4EZ3YMBU.js} +1 -1
  100. package/dist/standalone/{chunk-SADHW6WJ.js → chunk-4NRWZ3IK.js} +1 -1
  101. package/dist/standalone/{chunk-3QNDJXLL.js → chunk-4UDH2YI4.js} +1 -1
  102. package/dist/standalone/{chunk-AY4DPAPO.js → chunk-57JJA4FO.js} +1 -1
  103. package/dist/standalone/{chunk-K7GU4AIX.js → chunk-6HVMODID.js} +1 -1
  104. package/dist/standalone/{chunk-I7PUGF3D.js → chunk-6XU2QUI3.js} +1 -1
  105. package/dist/standalone/{chunk-HBEZGCPB.js → chunk-73WXN7SZ.js} +1 -1
  106. package/dist/standalone/{chunk-I626YY7T.js → chunk-75LZZADZ.js} +1 -1
  107. package/dist/standalone/{chunk-4TGALJHR.js → chunk-7MM2SI65.js} +1 -1
  108. package/dist/standalone/{chunk-AWFFXR6S.js → chunk-A27GQYC7.js} +1 -1
  109. package/dist/standalone/{chunk-W3WGVJNJ.js → chunk-AE4LQOKG.js} +1 -1
  110. package/dist/standalone/{chunk-2VGEYQJ5.js → chunk-AMX5BC24.js} +1 -1
  111. package/dist/standalone/{chunk-JXUU3BD2.js → chunk-CAEQ6OOD.js} +1 -1
  112. package/dist/standalone/{chunk-UUOEHNMP.js → chunk-CCJUOPWR.js} +1 -1
  113. package/dist/standalone/{chunk-4YEGXH2V.js → chunk-CHYLD556.js} +1 -1
  114. package/dist/standalone/{chunk-WDR3BJ2C.js → chunk-CLZSERWW.js} +1 -1
  115. package/dist/standalone/{chunk-IMM6HPPD.js → chunk-CNPADLAP.js} +1 -1
  116. package/dist/standalone/{chunk-XOLTLG4I.js → chunk-D3YEERHT.js} +1 -1
  117. package/dist/standalone/{chunk-3NYU3CCO.js → chunk-D57SW6H5.js} +1 -1
  118. package/dist/standalone/{chunk-GCYQOJYI.js → chunk-DLF6VPZK.js} +1 -1
  119. package/dist/standalone/{chunk-NPZG7XK5.js → chunk-EFJ5SREG.js} +1 -1
  120. package/dist/standalone/{chunk-VGKDC2OQ.js → chunk-EG45XFL3.js} +1 -1
  121. package/dist/standalone/{chunk-RAJ327CY.js → chunk-EI2FSTI3.js} +1 -1
  122. package/dist/standalone/{chunk-KQVY73EU.js → chunk-F4ZN2DRL.js} +3 -3
  123. package/dist/standalone/{chunk-DELDS72W.js → chunk-F7SJ4DOF.js} +1 -1
  124. package/dist/standalone/{chunk-ZZA6VQDG.js → chunk-FNWWGQVC.js} +1 -1
  125. package/dist/standalone/{chunk-NQ727GVM.js → chunk-FOXLEMWC.js} +1 -1
  126. package/dist/standalone/{chunk-337EJGCU.js → chunk-G62WODKV.js} +1 -1
  127. package/dist/standalone/{chunk-2KREOMPV.js → chunk-GMKV6EAQ.js} +1 -1
  128. package/dist/standalone/{chunk-V4JKKAAZ.js → chunk-GTW3JPQQ.js} +1 -1
  129. package/dist/standalone/{chunk-XSFGXEYO.js → chunk-GWJ57WD2.js} +1 -1
  130. package/dist/standalone/{chunk-MICDQTTJ.js → chunk-HFDKQBIZ.js} +1 -1
  131. package/dist/standalone/{chunk-WONKLAKW.js → chunk-HVKGOO4E.js} +1 -1
  132. package/dist/standalone/{chunk-JELTLAEP.js → chunk-I4AZTCAA.js} +1 -1
  133. package/dist/standalone/{chunk-274SZA4F.js → chunk-I4EVK4EW.js} +1 -1
  134. package/dist/standalone/{chunk-76D454G5.js → chunk-JEYIP5MS.js} +1 -1
  135. package/dist/standalone/{chunk-XEIJUQ4B.js → chunk-JI4WZ5K5.js} +1 -1
  136. package/dist/standalone/{chunk-MGYRQPAY.js → chunk-JNB2EV3N.js} +1 -1
  137. package/dist/standalone/{chunk-ZBLG4UAV.js → chunk-JR66YIA4.js} +1 -1
  138. package/dist/standalone/{chunk-RPRNYCFT.js → chunk-KB75JASP.js} +1 -1
  139. package/dist/standalone/{chunk-5NPU6VPX.js → chunk-KNZGU3CE.js} +1 -1
  140. package/dist/standalone/{chunk-OVPS52RO.js → chunk-KS2ZCKZ2.js} +1 -1
  141. package/dist/standalone/{chunk-WU2ST74V.js → chunk-L645XKP6.js} +1 -1
  142. package/dist/standalone/{chunk-QCG2G6IF.js → chunk-LAQNOLYC.js} +1 -1
  143. package/dist/standalone/{chunk-EVUVQB4Q.js → chunk-M2X2UFAA.js} +1 -1
  144. package/dist/standalone/{chunk-AE3ABYCE.js → chunk-MSW4QPCU.js} +1 -1
  145. package/dist/standalone/{chunk-X474JV2D.js → chunk-N36AT4CI.js} +1 -1
  146. package/dist/standalone/{chunk-ELWBGGS7.js → chunk-NCDS5OJ4.js} +1 -1
  147. package/dist/standalone/{chunk-O65QTRXU.js → chunk-NIHVUGDE.js} +1 -1
  148. package/dist/standalone/{chunk-VTTS5L36.js → chunk-NLRCYQUM.js} +1 -1
  149. package/dist/standalone/{chunk-UOFMFYZ7.js → chunk-NX6JHCY5.js} +2 -2
  150. package/dist/standalone/{chunk-2DKLUTH2.js → chunk-OKDHAG2Y.js} +1 -1
  151. package/dist/standalone/{chunk-LHQFTCOS.js → chunk-OYO74NM4.js} +1 -1
  152. package/dist/standalone/{chunk-Q7KRCKCE.js → chunk-PBHKQULL.js} +1 -1
  153. package/dist/standalone/{chunk-GDAZWXQW.js → chunk-PFIATRRO.js} +1 -1
  154. package/dist/standalone/{chunk-66IUCD6W.js → chunk-PSPK6BZ2.js} +1 -1
  155. package/dist/standalone/{chunk-NDIEUO4N.js → chunk-QKWIY6JW.js} +1 -1
  156. package/dist/standalone/{chunk-YTLKHICM.js → chunk-QLMDHJMC.js} +1 -1
  157. package/dist/standalone/{chunk-KXUK7CSR.js → chunk-QQ4LEH7V.js} +1 -1
  158. package/dist/standalone/{chunk-ZZ6ZCOD4.js → chunk-QQENKHRS.js} +1 -1
  159. package/dist/standalone/{chunk-RK3HQKPW.js → chunk-QT3W5POL.js} +1 -1
  160. package/dist/standalone/{chunk-A2LKDNNA.js → chunk-QTG3KGNJ.js} +1 -1
  161. package/dist/standalone/{chunk-DWKKQ75U.js → chunk-ROHVLVGW.js} +1 -1
  162. package/dist/standalone/{chunk-5QK3ZHNZ.js → chunk-RQHLJCG7.js} +1 -1
  163. package/dist/standalone/{chunk-OOUGGYHQ.js → chunk-RRDXY56O.js} +1 -1
  164. package/dist/standalone/{chunk-MULFKWTQ.js → chunk-RWEEBORY.js} +1 -1
  165. package/dist/standalone/{chunk-MNXXIISC.js → chunk-RY6I3E2K.js} +1 -1
  166. package/dist/standalone/{chunk-DJPK4PZV.js → chunk-S3LW4HCF.js} +1 -1
  167. package/dist/standalone/{chunk-O4SDDSDL.js → chunk-S63YTOR5.js} +1 -1
  168. package/dist/standalone/{chunk-KVQ2GMJR.js → chunk-SGIW3B4R.js} +1 -1
  169. package/dist/standalone/{chunk-LYNQHGQ4.js → chunk-SOKPPTFJ.js} +1 -1
  170. package/dist/standalone/{chunk-4E6DQHFK.js → chunk-SOTNC2VE.js} +1 -1
  171. package/dist/standalone/{chunk-OJO6ERJ4.js → chunk-TMIYU26C.js} +1 -1
  172. package/dist/standalone/{chunk-D2LGOQ32.js → chunk-TY5MXKUY.js} +1 -1
  173. package/dist/standalone/{chunk-UFFUDDK7.js → chunk-VTAHI7AZ.js} +1 -1
  174. package/dist/standalone/{chunk-JQBZDS6X.js → chunk-VX6ZBLXB.js} +1 -1
  175. package/dist/standalone/{chunk-ZPQFM3A7.js → chunk-WD6TOMHJ.js} +1 -1
  176. package/dist/standalone/{chunk-ZHZHI6KX.js → chunk-WHIWJD5H.js} +1 -1
  177. package/dist/standalone/{chunk-QOK2UU3L.js → chunk-WUK2O2KI.js} +1 -1
  178. package/dist/standalone/{chunk-NYLSD5LR.js → chunk-XEZ7LEII.js} +1 -1
  179. package/dist/standalone/{chunk-4W7SB3SF.js → chunk-YFZFL4XI.js} +1 -1
  180. package/dist/standalone/{chunk-OR4RO6V4.js → chunk-YIVDW4BV.js} +1 -1
  181. package/dist/standalone/{chunk-5MIJ3KEK.js → chunk-Z7HICJ3Z.js} +1 -1
  182. package/dist/standalone/chunk-ZBXY4FVL.js +14 -0
  183. package/dist/standalone/studio.js +1 -1
  184. package/package.json +2 -2
  185. package/dist/packem_shared/ApiDocsPanel-sEDqUNQq.mjs +0 -2
  186. package/dist/packem_shared/Studio-BmbkaUrx.mjs +0 -1
  187. package/dist/packem_shared/use-assistant-rpc-AKu8hvPm.mjs +0 -1
  188. package/dist/standalone/chunk-A4F3YMBV.js +0 -1
  189. package/dist/standalone/chunk-AQ6LY5RO.js +0 -14
  190. /package/dist/standalone/{chunk-VJQP4ARP.js → chunk-ITS5LMYJ.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{c as U}from"react/compiler-runtime";import{flattenHint as D}from"@lunora/errors";import{useT as V}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{e as $,a as K,b as E}from"./internal-hIuTpSbx.mjs";import{o as M}from"./recording-client-z4CBi0y8.mjs";import{u as W}from"./assistant-provider-Dw0roZh3.mjs";import{u as _}from"./operation-console-provider-DoloEvon.mjs";import{A as z}from"./alert-PB5W11MM.mjs";import{jsx as x,jsxs as B}from"react/jsx-runtime";const Z=H=>{const e=U(51),{className:I,error:t,shardKey:T,testId:O}=H,s=V(),o=_(),v=W(),j=v!==void 0&&!v.unavailable;let l,a,n,c,m,u,d,r,i,f;if(e[0]!==v||e[1]!==I||e[2]!==t||e[3]!==o||e[4]!==T||e[5]!==s||e[6]!==O){const w=$(t);let y;e[17]!==t?(y=K(t),e[17]=t,e[18]=y):y=e[18],n=y;let A;e[19]!==t?(A=M(t),e[19]=t,e[20]=A):A=e[20];const q=A,N=t?.why;let C;e[21]!==o||e[22]!==q?(C=()=>{o?.openConsole({errorsOnly:!0,seq:q})},e[21]=o,e[22]=q,e[23]=C):C=e[23],c=C,a=()=>{const S=w===void 0?"":`
1
+ import{c as U}from"react/compiler-runtime";import{flattenHint as D}from"@lunora/errors";import{useT as V}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{e as $,a as K,b as E}from"./internal-BT5tH08j.mjs";import{o as M}from"./recording-client-D_-eNapT.mjs";import{u as W}from"./assistant-provider-b2GtJb5K.mjs";import{u as _}from"./operation-console-provider-DoloEvon.mjs";import{A as z}from"./alert-PB5W11MM.mjs";import{jsx as x,jsxs as B}from"react/jsx-runtime";const Z=H=>{const e=U(51),{className:I,error:t,shardKey:T,testId:O}=H,s=V(),o=_(),v=W(),j=v!==void 0&&!v.unavailable;let l,a,n,c,m,u,d,r,i,f;if(e[0]!==v||e[1]!==I||e[2]!==t||e[3]!==o||e[4]!==T||e[5]!==s||e[6]!==O){const w=$(t);let y;e[17]!==t?(y=K(t),e[17]=t,e[18]=y):y=e[18],n=y;let A;e[19]!==t?(A=M(t),e[19]=t,e[20]=A):A=e[20];const q=A,N=t?.why;let C;e[21]!==o||e[22]!==q?(C=()=>{o?.openConsole({errorsOnly:!0,seq:q})},e[21]=o,e[22]=q,e[23]=C):C=e[23],c=C,a=()=>{const S=w===void 0?"":`
2
2
 
3
3
  ${s("The studio suggested: {hint}",{hint:D(w)})}`;v?.openAssistant({ask:s(`The studio reported this error:
4
4
  {message}{detail}
@@ -1,6 +1,6 @@
1
- import{c as v}from"react/compiler-runtime";import{useState as A,useEffect as Y}from"react";import{ConfirmButton as z}from"./ConfirmButton-CIXYF6Mg.mjs";import{D as Q,a as I,b as O,c as H,d as P,e as V,f as U,g as F}from"./dropdown-menu-jLZenfWH.mjs";import{M as X}from"./modal-shell-CDztwLnv.mjs";import{useT as E}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{l as B,g as Z,k as W,f as ee}from"./internal-hIuTpSbx.mjs";import{C as L}from"./control-button-BOZ5K-FC.mjs";import{jsx as m,jsxs as j}from"react/jsx-runtime";const q=l=>`"${l.replaceAll('"','""')}"`,te=/["\n\r,]/u,le=/^[=+\-@\t\r]/u,J=l=>{if(l==null)return"";let e;return typeof l=="string"?e=le.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=B(l),te.test(e)?`"${e.replaceAll('"','""')}"`:e},ne=(l,e)=>{const n=l.map(t=>J(t)).join(","),o=e.map(t=>l.map(c=>J(t[c])).join(","));return[n,...o].join(`
1
+ import{c as v}from"react/compiler-runtime";import{useState as A,useEffect as Y}from"react";import{ConfirmButton as z}from"./ConfirmButton-CIXYF6Mg.mjs";import{D as Q,a as I,b as O,c as H,d as P,e as V,f as U,g as F}from"./dropdown-menu-jLZenfWH.mjs";import{M as X}from"./modal-shell-CDztwLnv.mjs";import{useT as E}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{k as B,l as Z,j as W,f as ee}from"./internal-BT5tH08j.mjs";import{C as L}from"./control-button-BOZ5K-FC.mjs";import{jsx as m,jsxs as T}from"react/jsx-runtime";const q=l=>`"${l.replaceAll('"','""')}"`,te=/["\n\r,]/u,le=/^[=+\-@\t\r]/u,J=l=>{if(l==null)return"";let e;return typeof l=="string"?e=le.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=B(l),te.test(e)?`"${e.replaceAll('"','""')}"`:e},ne=(l,e)=>{const n=l.map(t=>J(t)).join(","),o=e.map(t=>l.map(c=>J(t[c])).join(","));return[n,...o].join(`
2
2
  `)},oe=l=>JSON.stringify(l,W,2),G=500,K=l=>l==null?"NULL":typeof l=="number"?Number.isFinite(l)?String(l):"NULL":typeof l=="bigint"?String(l):typeof l=="boolean"?l?"1":"0":`'${(typeof l=="string"?l:B(l)).replaceAll("'","''")}'`,D="__doc__",se=(l,e,n,o)=>{if(e.length===0||n.length===0)return"";const t=o?.includes(D)===!0&&!e.includes(D)?e.filter(a=>!o.includes(a)):void 0,c=t===void 0?e:o,i=(a,u)=>K(t===void 0||u!==D?a[u]:JSON.stringify(Object.fromEntries(t.map(f=>[f,a[f]])),W)),s=c.map(a=>q(a)).join(", "),r=[];for(let a=0;a<n.length;a+=G){const u=n.slice(a,a+G).map(f=>` (${c.map(d=>i(f,d)).join(", ")})`).join(`,
3
3
  `);r.push(`INSERT INTO ${q(l)} (${s}) VALUES
4
4
  ${u};`)}return r.join(`
5
5
 
6
- `)},M=(l,e,n)=>{if(!("document"in globalThis))return;const o=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:n})),t=globalThis.document.createElement("a");t.href=o,t.download=l,globalThis.document.body.append(t),t.click(),t.remove(),globalThis.URL.revokeObjectURL(o)},ie=l=>{const e=v(37),{columns:n,name:o,rows:t,sqlColumns:c}=l,i=E();let s;e[0]!==n||e[1]!==o||e[2]!==t?(s=()=>{M(`${o}.csv`,ne(n,t),"text/csv;charset=utf-8")},e[0]=n,e[1]=o,e[2]=t,e[3]=s):s=e[3];const r=s;let a;e[4]!==o||e[5]!==t?(a=()=>{M(`${o}.json`,oe(t),"application/json")},e[4]=o,e[5]=t,e[6]=a):a=e[6];const u=a;let f;e[7]!==n||e[8]!==o||e[9]!==t||e[10]!==c?(f=()=>{M(`${o}.sql`,se(o,n,t,c),"application/sql;charset=utf-8")},e[7]=n,e[8]=o,e[9]=t,e[10]=c,e[11]=f):f=e[11];const d=f,N=t.length===0;let p;e[12]!==N?(p=m(Q,{className:L,"data-testid":"grid-export",disabled:N,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[12]=N,e[13]=p):p=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=m(I,{children:"Export loaded rows"}),e[14]=C):C=e[14];let g;e[15]!==i?(g=i("CSV"),e[15]=i,e[16]=g):g=e[16];let y;e[17]!==r||e[18]!==g?(y=m(O,{"data-testid":"grid-export-csv",onClick:r,children:g}),e[17]=r,e[18]=g,e[19]=y):y=e[19];let k;e[20]!==i?(k=i("JSON"),e[20]=i,e[21]=k):k=e[21];let x;e[22]!==u||e[23]!==k?(x=m(O,{"data-testid":"grid-export-json",onClick:u,children:k}),e[22]=u,e[23]=k,e[24]=x):x=e[24];let S;e[25]!==i?(S=i("SQL"),e[25]=i,e[26]=S):S=e[26];let h;e[27]!==d||e[28]!==S?(h=m(O,{"data-testid":"grid-export-sql",onClick:d,children:S}),e[27]=d,e[28]=S,e[29]=h):h=e[29];let b;e[30]!==x||e[31]!==h||e[32]!==y?(b=j(H,{align:"end",children:[C,y,x,h]}),e[30]=x,e[31]=h,e[32]=y,e[33]=b):b=e[33];let w;return e[34]!==b||e[35]!==p?(w=j(P,{children:[p,b]}),e[34]=b,e[35]=p,e[36]=w):w=e[36],w},re=l=>{const e=v(9),{column:n}=l;let o;e[0]!==n?(o=()=>{n.toggleVisibility()},e[0]=n,e[1]=o):o=e[1];const t=o;let c;e[2]!==n?(c=n.getIsVisible(),e[2]=n,e[3]=c):c=e[3];const i=`grid-column-${n.id}`;let s;return e[4]!==n.id||e[5]!==t||e[6]!==c||e[7]!==i?(s=m(U,{checked:c,closeOnClick:!1,"data-testid":i,onCheckedChange:t,children:n.id}),e[4]=n.id,e[5]=t,e[6]=c,e[7]=i,e[8]=s):s=e[8],s},ce=[],ae=({backRelations:l=ce,enabledBackRelations:e,onToggleBackRelation:n,table:o})=>{const t=E(),c=o.getIsAllColumnsVisible(),i=()=>{o.toggleAllColumnsVisible(!c)};return j(P,{children:[m(Q,{className:L,"data-testid":"grid-columns",children:t("Columns")}),j(H,{align:"end",className:"max-h-80 overflow-y-auto",children:[j(V,{children:[m(I,{children:t("Columns")}),m(U,{checked:c,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:i,children:t(c?"Hide all":"Show all")}),m(F,{}),o.getAllLeafColumns().filter(s=>!s.id.startsWith("__back__:")).map(s=>m(re,{column:s},s.id))]}),l.length>0&&n!==void 0&&j(V,{children:[m(F,{}),m(I,{children:t("Related")}),l.map(s=>{const r=`${s.table}.${s.column}`;return m(U,{checked:e?.has(r)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${r}`,onCheckedChange:()=>{n(r)},children:`← ${s.table}.${s.column}`},r)})]})]})]})},de=l=>{const e=v(19),{count:n,editable:o,onClear:t,onDelete:c}=l,i=E();let s;e[0]!==n||e[1]!==i?(s=i("{count} selected",{count:n}),e[0]=n,e[1]=i,e[2]=s):s=e[2];let r;e[3]!==s?(r=m("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:s}),e[3]=s,e[4]=r):r=e[4];let a;e[5]!==i?(a=i("Clear"),e[5]=i,e[6]=a):a=e[6];let u;e[7]!==t||e[8]!==a?(u=m("button",{className:L,"data-testid":"grid-selection-clear",onClick:t,type:"button",children:a}),e[7]=t,e[8]=a,e[9]=u):u=e[9];let f;e[10]!==n||e[11]!==o||e[12]!==c||e[13]!==i?(f=o&&m(z,{confirmLabel:i("Delete {count} rows and everything that cascades?",{count:n}),onConfirm:c,testId:"grid-selection-delete",children:i("Delete {count}",{count:n})}),e[10]=n,e[11]=o,e[12]=c,e[13]=i,e[14]=f):f=e[14];let d;return e[15]!==r||e[16]!==u||e[17]!==f?(d=j("div",{className:"flex items-center gap-2 rounded-md border border-border bg-accent/40 px-3 py-1.5 text-xs","data-testid":"grid-selection-bar",children:[r,u,f]}),e[15]=r,e[16]=u,e[17]=f,e[18]=d):d=e[18],d},fe=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,me=l=>{const e=v(9),{bucket:n,objectKey:o,resolveUrl:t}=l,[c,i]=A(null),[s,r]=A(!1);let a,u;e[0]!==n||e[1]!==o||e[2]!==t?(a=()=>{const p={cancelled:!1};return ee((async()=>{try{const C=await t(o,n);p.cancelled||i(C)}catch{p.cancelled||r(!0)}})()),()=>{p.cancelled=!0}},u=[n,o,t],e[0]=n,e[1]=o,e[2]=t,e[3]=a,e[4]=u):(a=e[3],u=e[4]),Y(a,u);let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{r(!0)},e[5]=f):f=e[5];const d=f;if(c===null||s)return null;let N;return e[6]!==o||e[7]!==c?(N=m("div",{className:"flex max-h-64 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:m("img",{alt:o,className:"max-h-64 object-contain","data-testid":"grid-cell-image",onError:d,src:c})}),e[6]=o,e[7]=c,e[8]=N):N=e[8],N},ke=l=>{const e=v(41),{bucket:n,column:o,onClose:t,onFilter:c,resolveUrl:i,value:s}=l,r=E(),[a,u]=A(!1);let f;e[0]!==s?(f=B(s),e[0]=s,e[1]=f):f=e[1];const d=f;let N;e[2]!==d?(N=()=>{Z(d)&&u(!0)},e[2]=d,e[3]=N):N=e[3];const p=N;let C;e[4]!==r?(C=r("Cell value"),e[4]=r,e[5]=C):C=e[5];let g;e[6]!==o?(g=m("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:o}),e[6]=o,e[7]=g):g=e[7];let y;e[8]!==c||e[9]!==r?(y=c!==void 0&&m("button",{className:L,"data-testid":"grid-cell-filter",onClick:c,type:"button",children:r("Filter by this value")}),e[8]=c,e[9]=r,e[10]=y):y=e[10];let k;e[11]!==a||e[12]!==r?(k=r(a?"Copied":"Copy"),e[11]=a,e[12]=r,e[13]=k):k=e[13];let x;e[14]!==p||e[15]!==k?(x=m("button",{className:L,"data-testid":"grid-cell-copy",onClick:p,type:"button",children:k}),e[14]=p,e[15]=k,e[16]=x):x=e[16];let S;e[17]!==r?(S=r("Close"),e[17]=r,e[18]=S):S=e[18];let h;e[19]!==t||e[20]!==S?(h=m("button",{className:L,"data-testid":"grid-cell-close",onClick:t,type:"button",children:S}),e[19]=t,e[20]=S,e[21]=h):h=e[21];let b;e[22]!==y||e[23]!==x||e[24]!==h?(b=j("div",{className:"flex items-center gap-1.5",children:[y,x,h]}),e[22]=y,e[23]=x,e[24]=h,e[25]=b):b=e[25];let w;e[26]!==b||e[27]!==g?(w=j("div",{className:"flex items-center justify-between",children:[g,b]}),e[26]=b,e[27]=g,e[28]=w):w=e[28];let _;e[29]!==n||e[30]!==i||e[31]!==s?(_=i!==void 0&&typeof s=="string"&&fe.test(s)&&m(me,{bucket:n,objectKey:s,resolveUrl:i}),e[29]=n,e[30]=i,e[31]=s,e[32]=_):_=e[32];let $;e[33]!==d?($=m("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs whitespace-pre-wrap","data-testid":"grid-cell-value",children:d}),e[33]=d,e[34]=$):$=e[34];let T;return e[35]!==t||e[36]!==w||e[37]!==_||e[38]!==$||e[39]!==C?(T=j(X,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:C,onClose:t,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[w,_,$]}),e[35]=t,e[36]=w,e[37]=_,e[38]=$,e[39]=C,e[40]=T):T=e[40],T},Se=l=>{const e=v(37),{backRelations:n,enabledBackRelations:o,onToggleBackRelation:t,columns:c,editable:i,name:s,onBulkDelete:r,onToggleTranspose:a,rows:u,sqlColumns:f,table:d,transposed:N}=l,p=E();let C;e[0]!==d?(C=d.getSelectedRowModel(),e[0]=d,e[1]=C):C=e[1];const g=C.rows;let y;e[2]!==d?(y=()=>{d.resetRowSelection()},e[2]=d,e[3]=y):y=e[3];const k=y;let x;e[4]!==r||e[5]!==g||e[6]!==d?(x=()=>{r(g.map(ue)),d.resetRowSelection()},e[4]=r,e[5]=g,e[6]=d,e[7]=x):x=e[7];const S=x;let h;e[8]!==c||e[9]!==s||e[10]!==u||e[11]!==f?(h=m(ie,{columns:c,name:s,rows:u,sqlColumns:f}),e[8]=c,e[9]=s,e[10]=u,e[11]=f,e[12]=h):h=e[12];let b;e[13]!==n||e[14]!==o||e[15]!==t||e[16]!==d?(b=m(ae,{backRelations:n,enabledBackRelations:o,onToggleBackRelation:t,table:d}),e[13]=n,e[14]=o,e[15]=t,e[16]=d,e[17]=b):b=e[17];let w;e[18]!==p?(w=p("Swap rows and columns"),e[18]=p,e[19]=w):w=e[19];let _;e[20]!==p?(_=p("Transpose"),e[20]=p,e[21]=_):_=e[21];let $;e[22]!==a||e[23]!==w||e[24]!==_||e[25]!==N?($=m("button",{"aria-pressed":N,className:L,"data-testid":"grid-transpose",onClick:a,title:w,type:"button",children:_}),e[22]=a,e[23]=w,e[24]=_,e[25]=N,e[26]=$):$=e[26];let T;e[27]!==i||e[28]!==k||e[29]!==S||e[30]!==g.length?(T=g.length>0&&m(de,{count:g.length,editable:i,onClear:k,onDelete:S}),e[27]=i,e[28]=k,e[29]=S,e[30]=g.length,e[31]=T):T=e[31];let R;return e[32]!==h||e[33]!==b||e[34]!==$||e[35]!==T?(R=j("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[h,b,$,T]}),e[32]=h,e[33]=b,e[34]=$,e[35]=T,e[36]=R):R=e[36],R};function ue(l){return l.id}export{ke as C,ie as E,Se as G,de as S,M as d};
6
+ `)},M=(l,e,n)=>{if(!("document"in globalThis))return;const o=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:n})),t=globalThis.document.createElement("a");t.href=o,t.download=l,globalThis.document.body.append(t),t.click(),t.remove(),globalThis.URL.revokeObjectURL(o)},ie=l=>{const e=v(37),{columns:n,name:o,rows:t,sqlColumns:c}=l,i=E();let s;e[0]!==n||e[1]!==o||e[2]!==t?(s=()=>{M(`${o}.csv`,ne(n,t),"text/csv;charset=utf-8")},e[0]=n,e[1]=o,e[2]=t,e[3]=s):s=e[3];const r=s;let a;e[4]!==o||e[5]!==t?(a=()=>{M(`${o}.json`,oe(t),"application/json")},e[4]=o,e[5]=t,e[6]=a):a=e[6];const u=a;let f;e[7]!==n||e[8]!==o||e[9]!==t||e[10]!==c?(f=()=>{M(`${o}.sql`,se(o,n,t,c),"application/sql;charset=utf-8")},e[7]=n,e[8]=o,e[9]=t,e[10]=c,e[11]=f):f=e[11];const d=f,N=t.length===0;let p;e[12]!==N?(p=m(Q,{className:L,"data-testid":"grid-export",disabled:N,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[12]=N,e[13]=p):p=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=m(I,{children:"Export loaded rows"}),e[14]=C):C=e[14];let g;e[15]!==i?(g=i("CSV"),e[15]=i,e[16]=g):g=e[16];let y;e[17]!==r||e[18]!==g?(y=m(O,{"data-testid":"grid-export-csv",onClick:r,children:g}),e[17]=r,e[18]=g,e[19]=y):y=e[19];let k;e[20]!==i?(k=i("JSON"),e[20]=i,e[21]=k):k=e[21];let x;e[22]!==u||e[23]!==k?(x=m(O,{"data-testid":"grid-export-json",onClick:u,children:k}),e[22]=u,e[23]=k,e[24]=x):x=e[24];let S;e[25]!==i?(S=i("SQL"),e[25]=i,e[26]=S):S=e[26];let h;e[27]!==d||e[28]!==S?(h=m(O,{"data-testid":"grid-export-sql",onClick:d,children:S}),e[27]=d,e[28]=S,e[29]=h):h=e[29];let b;e[30]!==x||e[31]!==h||e[32]!==y?(b=T(H,{align:"end",children:[C,y,x,h]}),e[30]=x,e[31]=h,e[32]=y,e[33]=b):b=e[33];let w;return e[34]!==b||e[35]!==p?(w=T(P,{children:[p,b]}),e[34]=b,e[35]=p,e[36]=w):w=e[36],w},re=l=>{const e=v(9),{column:n}=l;let o;e[0]!==n?(o=()=>{n.toggleVisibility()},e[0]=n,e[1]=o):o=e[1];const t=o;let c;e[2]!==n?(c=n.getIsVisible(),e[2]=n,e[3]=c):c=e[3];const i=`grid-column-${n.id}`;let s;return e[4]!==n.id||e[5]!==t||e[6]!==c||e[7]!==i?(s=m(U,{checked:c,closeOnClick:!1,"data-testid":i,onCheckedChange:t,children:n.id}),e[4]=n.id,e[5]=t,e[6]=c,e[7]=i,e[8]=s):s=e[8],s},ce=[],ae=({backRelations:l=ce,enabledBackRelations:e,onToggleBackRelation:n,table:o})=>{const t=E(),c=o.getIsAllColumnsVisible(),i=()=>{o.toggleAllColumnsVisible(!c)};return T(P,{children:[m(Q,{className:L,"data-testid":"grid-columns",children:t("Columns")}),T(H,{align:"end",className:"max-h-80 overflow-y-auto",children:[T(V,{children:[m(I,{children:t("Columns")}),m(U,{checked:c,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:i,children:t(c?"Hide all":"Show all")}),m(F,{}),o.getAllLeafColumns().filter(s=>!s.id.startsWith("__back__:")).map(s=>m(re,{column:s},s.id))]}),l.length>0&&n!==void 0&&T(V,{children:[m(F,{}),m(I,{children:t("Related")}),l.map(s=>{const r=`${s.table}.${s.column}`;return m(U,{checked:e?.has(r)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${r}`,onCheckedChange:()=>{n(r)},children:`← ${s.table}.${s.column}`},r)})]})]})]})},de=l=>{const e=v(19),{count:n,editable:o,onClear:t,onDelete:c}=l,i=E();let s;e[0]!==n||e[1]!==i?(s=i("{count} selected",{count:n}),e[0]=n,e[1]=i,e[2]=s):s=e[2];let r;e[3]!==s?(r=m("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:s}),e[3]=s,e[4]=r):r=e[4];let a;e[5]!==i?(a=i("Clear"),e[5]=i,e[6]=a):a=e[6];let u;e[7]!==t||e[8]!==a?(u=m("button",{className:L,"data-testid":"grid-selection-clear",onClick:t,type:"button",children:a}),e[7]=t,e[8]=a,e[9]=u):u=e[9];let f;e[10]!==n||e[11]!==o||e[12]!==c||e[13]!==i?(f=o&&m(z,{confirmLabel:i("Delete {count} rows and everything that cascades?",{count:n}),onConfirm:c,testId:"grid-selection-delete",children:i("Delete {count}",{count:n})}),e[10]=n,e[11]=o,e[12]=c,e[13]=i,e[14]=f):f=e[14];let d;return e[15]!==r||e[16]!==u||e[17]!==f?(d=T("div",{className:"flex items-center gap-2 rounded-md border border-border bg-accent/40 px-3 py-1.5 text-xs","data-testid":"grid-selection-bar",children:[r,u,f]}),e[15]=r,e[16]=u,e[17]=f,e[18]=d):d=e[18],d},fe=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,me=l=>{const e=v(9),{bucket:n,objectKey:o,resolveUrl:t}=l,[c,i]=A(null),[s,r]=A(!1);let a,u;e[0]!==n||e[1]!==o||e[2]!==t?(a=()=>{const p={cancelled:!1};return ee((async()=>{try{const C=await t(o,n);p.cancelled||i(C)}catch{p.cancelled||r(!0)}})()),()=>{p.cancelled=!0}},u=[n,o,t],e[0]=n,e[1]=o,e[2]=t,e[3]=a,e[4]=u):(a=e[3],u=e[4]),Y(a,u);let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{r(!0)},e[5]=f):f=e[5];const d=f;if(c===null||s)return null;let N;return e[6]!==o||e[7]!==c?(N=m("div",{className:"flex max-h-64 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:m("img",{alt:o,className:"max-h-64 object-contain","data-testid":"grid-cell-image",onError:d,src:c})}),e[6]=o,e[7]=c,e[8]=N):N=e[8],N},ke=l=>{const e=v(41),{bucket:n,column:o,onClose:t,onFilter:c,resolveUrl:i,value:s}=l,r=E(),[a,u]=A(!1);let f;e[0]!==s?(f=B(s),e[0]=s,e[1]=f):f=e[1];const d=f;let N;e[2]!==d?(N=()=>{Z(d)&&u(!0)},e[2]=d,e[3]=N):N=e[3];const p=N;let C;e[4]!==r?(C=r("Cell value"),e[4]=r,e[5]=C):C=e[5];let g;e[6]!==o?(g=m("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:o}),e[6]=o,e[7]=g):g=e[7];let y;e[8]!==c||e[9]!==r?(y=c!==void 0&&m("button",{className:L,"data-testid":"grid-cell-filter",onClick:c,type:"button",children:r("Filter by this value")}),e[8]=c,e[9]=r,e[10]=y):y=e[10];let k;e[11]!==a||e[12]!==r?(k=r(a?"Copied":"Copy"),e[11]=a,e[12]=r,e[13]=k):k=e[13];let x;e[14]!==p||e[15]!==k?(x=m("button",{className:L,"data-testid":"grid-cell-copy",onClick:p,type:"button",children:k}),e[14]=p,e[15]=k,e[16]=x):x=e[16];let S;e[17]!==r?(S=r("Close"),e[17]=r,e[18]=S):S=e[18];let h;e[19]!==t||e[20]!==S?(h=m("button",{className:L,"data-testid":"grid-cell-close",onClick:t,type:"button",children:S}),e[19]=t,e[20]=S,e[21]=h):h=e[21];let b;e[22]!==y||e[23]!==x||e[24]!==h?(b=T("div",{className:"flex items-center gap-1.5",children:[y,x,h]}),e[22]=y,e[23]=x,e[24]=h,e[25]=b):b=e[25];let w;e[26]!==b||e[27]!==g?(w=T("div",{className:"flex items-center justify-between",children:[g,b]}),e[26]=b,e[27]=g,e[28]=w):w=e[28];let _;e[29]!==n||e[30]!==i||e[31]!==s?(_=i!==void 0&&typeof s=="string"&&fe.test(s)&&m(me,{bucket:n,objectKey:s,resolveUrl:i}),e[29]=n,e[30]=i,e[31]=s,e[32]=_):_=e[32];let $;e[33]!==d?($=m("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs whitespace-pre-wrap","data-testid":"grid-cell-value",children:d}),e[33]=d,e[34]=$):$=e[34];let j;return e[35]!==t||e[36]!==w||e[37]!==_||e[38]!==$||e[39]!==C?(j=T(X,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:C,onClose:t,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[w,_,$]}),e[35]=t,e[36]=w,e[37]=_,e[38]=$,e[39]=C,e[40]=j):j=e[40],j},Se=l=>{const e=v(37),{backRelations:n,enabledBackRelations:o,onToggleBackRelation:t,columns:c,editable:i,name:s,onBulkDelete:r,onToggleTranspose:a,rows:u,sqlColumns:f,table:d,transposed:N}=l,p=E();let C;e[0]!==d?(C=d.getSelectedRowModel(),e[0]=d,e[1]=C):C=e[1];const g=C.rows;let y;e[2]!==d?(y=()=>{d.resetRowSelection()},e[2]=d,e[3]=y):y=e[3];const k=y;let x;e[4]!==r||e[5]!==g||e[6]!==d?(x=()=>{r(g.map(ue)),d.resetRowSelection()},e[4]=r,e[5]=g,e[6]=d,e[7]=x):x=e[7];const S=x;let h;e[8]!==c||e[9]!==s||e[10]!==u||e[11]!==f?(h=m(ie,{columns:c,name:s,rows:u,sqlColumns:f}),e[8]=c,e[9]=s,e[10]=u,e[11]=f,e[12]=h):h=e[12];let b;e[13]!==n||e[14]!==o||e[15]!==t||e[16]!==d?(b=m(ae,{backRelations:n,enabledBackRelations:o,onToggleBackRelation:t,table:d}),e[13]=n,e[14]=o,e[15]=t,e[16]=d,e[17]=b):b=e[17];let w;e[18]!==p?(w=p("Swap rows and columns"),e[18]=p,e[19]=w):w=e[19];let _;e[20]!==p?(_=p("Transpose"),e[20]=p,e[21]=_):_=e[21];let $;e[22]!==a||e[23]!==w||e[24]!==_||e[25]!==N?($=m("button",{"aria-pressed":N,className:L,"data-testid":"grid-transpose",onClick:a,title:w,type:"button",children:_}),e[22]=a,e[23]=w,e[24]=_,e[25]=N,e[26]=$):$=e[26];let j;e[27]!==i||e[28]!==k||e[29]!==S||e[30]!==g.length?(j=g.length>0&&m(de,{count:g.length,editable:i,onClear:k,onDelete:S}),e[27]=i,e[28]=k,e[29]=S,e[30]=g.length,e[31]=j):j=e[31];let R;return e[32]!==h||e[33]!==b||e[34]!==$||e[35]!==j?(R=T("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[h,b,$,j]}),e[32]=h,e[33]=b,e[34]=$,e[35]=j,e[36]=R):R=e[36],R};function ue(l){return l.id}export{ke as C,ie as E,Se as G,de as S,M as d};
@@ -1,3 +1,3 @@
1
- import{c as _}from"react/compiler-runtime";import{useNavigate as Xe}from"@tanstack/react-router";import{B as et}from"./badge-r_5B4LHP.mjs";import{C as P,a as tt}from"./card-By2O8ULa.mjs";import{E as nt}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-CaOm4JS3.mjs";import{useT as T}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as ye}from"./ADMIN_FUNCTIONS-DAHZ35kM.mjs";import{c as lt,f as Ne,d as at,w as rt,g as ot,n as it}from"./internal-hIuTpSbx.mjs";import{c as st}from"./utils-bhneXptQ.mjs";import{deriveInsights as ct}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useState as Ue,useEffect as qe}from"react";import{u as Ke}from"./use-studio-client-DCA50tF2.mjs";import{jsx as a,jsxs as h}from"react/jsx-runtime";import{B as He}from"./button-q0UYSmrn.mjs";const dt=lt(ye.studioFeatures),We={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,privacy:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},ut=t=>{if(t===null||typeof t!="object")return;const{id:e,name:n,unsupported:s}=t;if(!(typeof e!="string"||typeof n!="string"||!Array.isArray(s)))return{id:e,name:n,unsupported:s.filter(l=>typeof l=="string")}},mt=t=>{if(t===null||typeof t!="object")return We;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),privacy:n("privacy"),platform:ut(e.platform),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ft={...We,settled:!1},pt=()=>{const t=_(3),e=Ke(),[n,s]=Ue(void 0);let l,r;return t[0]!==e?(l=()=>{const i=new AbortController;return Ne((async()=>{let o;try{o={...mt(await e.query(dt,{},at(""))),settled:!0}}catch{o={...We,settled:!0}}i.signal.aborted||s({client:e,features:o})})()),()=>{i.abort()}},r=[e],t[0]=e,t[1]=l,t[2]=r):(l=t[1],r=t[2]),qe(l,r),n?.client===e?n.features:ft},ht=()=>{const t=_(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:a("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},gt=t=>{const e=_(24),{group:n}=t,s=T(),l=Xe();let r;e[0]!==n.tab||e[1]!==l?(r=()=>{Ne(l({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=l,e[2]=r):r=e[2];const i=r,o=n.bindings.length;let c;e[3]!==n.label?(c=a("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=a(ht,{}),e[5]=u):u=e[5];let m;e[6]!==c?(m=h("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=m):m=e[7];let d;e[8]!==o||e[9]!==s?(d=o===1?s("1 binding"):s("{count} bindings",{count:o}),e[8]=o,e[9]=s,e[10]=d):d=e[10];let f;e[11]!==d?(f=a("span",{className:"text-xs text-muted-foreground",children:d}),e[11]=d,e[12]=f):f=e[12];let p;e[13]!==o||e[14]!==n.bindings?(p=o>0&&a("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(yt)}),e[13]=o,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==m||e[17]!==f||e[18]!==p?(g=h(tt,{className:"flex flex-col gap-2 py-4",children:[m,f,p]}),e[16]=m,e[17]=f,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==i||e[22]!==g?(x=a(P,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:i,children:g}),e[20]=n.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},Ve=["kv","files","vectors"],xt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>Ve.indexOf(n.tab)-Ve.indexOf(s.tab)),bt=()=>{const t=_(19),e=Ke(),n=pt(),s=T();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],t[0]=l):l=t[0];const[r,i]=Ue(l);let o,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(o=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(vt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(Nt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Ne((async()=>{try{const v=await b.load();if(!g.cancelled){const S={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(w=>xt(w,S))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=o,t[7]=c):(o=t[6],c=t[7]),qe(o,c),r.length===0)return null;let u;t[8]!==s?(u=s("Bindings"),t[8]=s,t[9]=u):u=t[9];let m;t[10]!==u?(m=a("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=m):m=t[11];let d;t[12]!==r?(d=r.map(_t),t[12]=r,t[13]=d):d=t[13];let f;t[14]!==d?(f=a("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:d}),t[14]=d,t[15]=f):f=t[15];let p;return t[16]!==m||t[17]!==f?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[m,f]}),t[16]=m,t[17]=f,t[18]=p):p=t[18],p};function yt(t){return a(et,{variant:"secondary",children:t},t)}function vt(t){return t.binding}function Nt(t){return t.name}function _t(t){return a(gt,{group:t},t.tab)}const St=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],wt=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=St.map(n=>`- ${n.name} — ${n.summary}`).join(`
1
+ import{c as _}from"react/compiler-runtime";import{useNavigate as Xe}from"@tanstack/react-router";import{B as et}from"./badge-r_5B4LHP.mjs";import{C as P,a as tt}from"./card-By2O8ULa.mjs";import{E as nt}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-DMnTt_hg.mjs";import{useT as T}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as ye}from"./ADMIN_FUNCTIONS-DAHZ35kM.mjs";import{d as lt,f as Ne,g as at,w as rt,l as ot,n as it}from"./internal-BT5tH08j.mjs";import{c as st}from"./utils-bhneXptQ.mjs";import{deriveInsights as ct}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useState as Ue,useEffect as qe}from"react";import{u as Ke}from"./use-studio-client-DCA50tF2.mjs";import{jsx as a,jsxs as h}from"react/jsx-runtime";import{B as He}from"./button-q0UYSmrn.mjs";const dt=lt(ye.studioFeatures),We={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,privacy:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},ut=t=>{if(t===null||typeof t!="object")return;const{id:e,name:n,unsupported:s}=t;if(!(typeof e!="string"||typeof n!="string"||!Array.isArray(s)))return{id:e,name:n,unsupported:s.filter(l=>typeof l=="string")}},mt=t=>{if(t===null||typeof t!="object")return We;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),privacy:n("privacy"),platform:ut(e.platform),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ft={...We,settled:!1},pt=()=>{const t=_(3),e=Ke(),[n,s]=Ue(void 0);let l,r;return t[0]!==e?(l=()=>{const i=new AbortController;return Ne((async()=>{let o;try{o={...mt(await e.query(dt,{},at(""))),settled:!0}}catch{o={...We,settled:!0}}i.signal.aborted||s({client:e,features:o})})()),()=>{i.abort()}},r=[e],t[0]=e,t[1]=l,t[2]=r):(l=t[1],r=t[2]),qe(l,r),n?.client===e?n.features:ft},ht=()=>{const t=_(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:a("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},gt=t=>{const e=_(24),{group:n}=t,s=T(),l=Xe();let r;e[0]!==n.tab||e[1]!==l?(r=()=>{Ne(l({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=l,e[2]=r):r=e[2];const i=r,o=n.bindings.length;let c;e[3]!==n.label?(c=a("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=a(ht,{}),e[5]=u):u=e[5];let m;e[6]!==c?(m=h("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=m):m=e[7];let d;e[8]!==o||e[9]!==s?(d=o===1?s("1 binding"):s("{count} bindings",{count:o}),e[8]=o,e[9]=s,e[10]=d):d=e[10];let f;e[11]!==d?(f=a("span",{className:"text-xs text-muted-foreground",children:d}),e[11]=d,e[12]=f):f=e[12];let p;e[13]!==o||e[14]!==n.bindings?(p=o>0&&a("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(yt)}),e[13]=o,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==m||e[17]!==f||e[18]!==p?(g=h(tt,{className:"flex flex-col gap-2 py-4",children:[m,f,p]}),e[16]=m,e[17]=f,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==i||e[22]!==g?(x=a(P,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:i,children:g}),e[20]=n.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},Ve=["kv","files","vectors"],xt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>Ve.indexOf(n.tab)-Ve.indexOf(s.tab)),bt=()=>{const t=_(19),e=Ke(),n=pt(),s=T();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=[],t[0]=l):l=t[0];const[r,i]=Ue(l);let o,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(o=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(vt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(Nt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Ne((async()=>{try{const v=await b.load();if(!g.cancelled){const S={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(w=>xt(w,S))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=o,t[7]=c):(o=t[6],c=t[7]),qe(o,c),r.length===0)return null;let u;t[8]!==s?(u=s("Bindings"),t[8]=s,t[9]=u):u=t[9];let m;t[10]!==u?(m=a("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=m):m=t[11];let d;t[12]!==r?(d=r.map(_t),t[12]=r,t[13]=d):d=t[13];let f;t[14]!==d?(f=a("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:d}),t[14]=d,t[15]=f):f=t[15];let p;return t[16]!==m||t[17]!==f?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[m,f]}),t[16]=m,t[17]=f,t[18]=p):p=t[18],p};function yt(t){return a(et,{variant:"secondary",children:t},t)}function vt(t){return t.binding}function Nt(t){return t.name}function _t(t){return a(gt,{group:t},t.tab)}const St=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],wt=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=St.map(n=>`- ${n.name} — ${n.summary}`).join(`
2
2
  `);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
3
3
  `)},Ct=1500,At=()=>{const t=_(40),e=T(),{url:n}=Ke();let s;t[0]!==n?(s=rt(n),t[0]=n,t[1]=s):s=t[1];const l=s,[r,i]=Ue(null);let o,c;t[2]!==r?(o=()=>{if(r===null)return;const I=globalThis.setTimeout(()=>{i(null)},Ct);return()=>{globalThis.clearTimeout(I)}},c=[r],t[2]=r,t[3]=o,t[4]=c):(o=t[3],c=t[4]),qe(o,c);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(I,L)=>{ot(L)&&i(I)},t[5]=u):u=t[5];const m=u;let d;t[6]!==l?(d=()=>{m("config",wt(l))},t[6]=l,t[7]=d):d=t[7];const f=d;let p;t[8]!==l?(p=()=>{m("prompt",kt(l))},t[8]=l,t[9]=p):p=t[9];const g=p;let x;t[10]!==e?(x=e("Connect an AI agent"),t[10]=e,t[11]=x):x=t[11];let b;t[12]!==x?(b=a("span",{className:"text-sm font-medium text-foreground",children:x}),t[12]=x,t[13]=b):b=t[13];let v;t[14]!==e?(v=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[14]=e,t[15]=v):v=t[15];let S;t[16]!==v?(S=a("span",{className:"text-xs text-muted-foreground",children:v}),t[16]=v,t[17]=S):S=t[17];let w;t[18]!==b||t[19]!==S?(w=h("div",{className:"flex flex-col gap-1.5 p-4",children:[b,S]}),t[18]=b,t[19]=S,t[20]=w):w=t[20];let $;t[21]===Symbol.for("react.memo_cache_sentinel")?($=a("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[21]=$):$=t[21];let y;t[22]!==r||t[23]!==e?(y=e(r==="config"?"Copied":"Copy MCP config"),t[22]=r,t[23]=e,t[24]=y):y=t[24];let k;t[25]!==f||t[26]!==y?(k=a(He,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:y}),t[25]=f,t[26]=y,t[27]=k):k=t[27];let C;t[28]!==r||t[29]!==e?(C=e(r==="prompt"?"Copied":"Copy agent prompt"),t[28]=r,t[29]=e,t[30]=C):C=t[30];let A;t[31]!==g||t[32]!==C?(A=a(He,{"data-testid":"home-connect-agent-copy-prompt",onClick:g,size:"xs",variant:"outline",children:C}),t[31]=g,t[32]=C,t[33]=A):A=t[33];let N;t[34]!==k||t[35]!==A?(N=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[$,h("div",{className:"flex flex-wrap gap-2",children:[k,A]})]}),t[34]=k,t[35]=A,t[36]=N):N=t[36];let M;return t[37]!==w||t[38]!==N?(M=h(P,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[w,N]}),t[37]=w,t[38]=N,t[39]=M):M=t[39],M},Mt=112,Qe=32,Le=5,Ge=1,$t=3,It=t=>{const e=t.slice(-16),n=Math.max(0,...e),s=Qe-Le*2,l=(Mt-Le*2)/e.length;return e.map((r,i)=>{const o=n>0?Math.max(0,r)/n*s:0;return{height:Math.max(0,o-$t),width:Math.max(0,l-Ge*2),x:Le+i*l+Ge,y:Qe-Le-o}})},Tt=t=>{const e=_(4),{data:n}=t;let s;e[0]!==n?(s=It(n).map(Lt),e[0]=n,e[1]=s):s=e[1];let l;return e[2]!==s?(l=a("svg",{"aria-hidden":"true",className:"h-8 w-28 fill-foreground","data-testid":"home-sparkline",viewBox:"0 0 112 32",children:s}),e[2]=s,e[3]=l):l=e[3],l};function Lt(t){return a("rect",{height:t.height,rx:2,width:t.width,x:t.x,y:t.y},t.x)}const Ot=3,Rt=(t,e)=>{if(e==null)return t("cache not enabled");const n=e.hits+e.misses;return n===0?t("no cache traffic yet"):`${Math.round(e.hits/n*100).toString()}% ${t("cache hit")}`},Fe=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},Et=(t,e)=>{const n=Math.max(0,Math.round((e-t)/1e3));if(n<60)return`${String(n)}s ago`;const s=Math.round(n/60);if(s<60)return`${String(s)}m ago`;const l=Math.round(s/60);return l<24?`${String(l)}h ago`:`${String(Math.round(l/24))}d ago`},Je=(t,e)=>{if(t===void 0||t.length===0)return[];const n=new Map;for(const s of t)n.set(s.bucketMs,(n.get(s.bucketMs)??0)+s[e]);return[...n.entries()].toSorted(([s],[l])=>s-l).map(([,s])=>s)},Ye=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((i,o)=>i+o,0),l=t.slice(n).reduce((i,o)=>i+o,0);if(s===0)return null;const r=(l-s)/s*100;return{positive:e?r>=0:r<=0,text:`${r>=0?"+":""}${r.toFixed(1)}%`}},Oe=t=>{const e=_(24),{delta:n,footer:s,label:l,trend:r,unit:i,value:o}=t,c=T();let u;e[0]!==l?(u=a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=u):u=e[1];let m;e[2]!==o?(m=a("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[2]=o,e[3]=m):m=e[3];let d;e[4]!==i?(d=i!==void 0&&a("span",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=d):d=e[5];let f;e[6]!==m||e[7]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[m,d]}),e[6]=m,e[7]=d,e[8]=f):f=e[8];let p;e[9]!==r?(p=r!==void 0&&r.length>=Ot&&a(Tt,{data:r}),e[9]=r,e[10]=p):p=e[10];let g;e[11]!==f||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[f,p]}),e[11]=f,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n||e[18]!==s||e[19]!==c?(b=n==null?s!=null&&a("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s}):h("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[a("span",{className:st("font-semibold",n.positive?"text-success":"text-destructive"),children:n.text})," ",a("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=n,e[18]=s,e[19]=c,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=h(P,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},Bt=()=>{const t=_(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=a("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:a("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},je=t=>{const e=_(7),{command:n,label:s}=t;let l;e[0]!==s?(l=a("div",{className:"p-4",children:a("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=l):l=e[1];let r;e[2]!==n?(r=a("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:a("code",{className:"font-mono text-xs text-muted-foreground",children:n})}),e[2]=n,e[3]=r):r=e[3];let i;return e[4]!==l||e[5]!==r?(i=h(P,{className:"justify-between gap-0 py-0",children:[l,r]}),e[4]=l,e[5]=r,e[6]=i):i=e[6],i},Ze=t=>{const e=_(18),{count:n,onView:s,testId:l,title:r}=t,i=T();let o;e[0]!==r?(o=a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=o):o=e[1];let c;e[2]!==n||e[3]!==i?(c=n===null?a("span",{className:"text-xs text-muted-foreground",children:i("No data yet")}):a(et,{variant:n>0?"destructive":"success",children:n>0?n:i("All clear")}),e[2]=n,e[3]=i,e[4]=c):c=e[4];let u;e[5]!==o||e[6]!==c?(u=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[o,c]}),e[5]=o,e[6]=c,e[7]=u):u=e[7];let m;e[8]!==i?(m=i("View"),e[8]=i,e[9]=m):m=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=a(Bt,{}),e[10]=d):d=e[10];let f;e[11]!==s||e[12]!==m?(f=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:s,type:"button",children:[m,d]}),e[11]=s,e[12]=m,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f||e[16]!==l?(p=h(P,{className:"justify-between gap-0 py-0","data-testid":l,children:[u,f]}),e[14]=u,e[15]=f,e[16]=l,e[17]=p):p=e[17],p},Pt=t=>{const e=_(7),{functions:n}=t,s=T();let l;if(e[0]!==n||e[1]!==s){const r=[...n].toSorted(Ut).slice(0,5);let i;e[3]!==s?(i=s("Top functions"),e[3]=s,e[4]=i):i=e[4];let o;e[5]!==i?(o=a("div",{className:"border-b border-border px-4 py-3",children:a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],l=h(P,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[o,r.length===0?a("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No functions called yet.")}):h("div",{className:"divide-y divide-border",children:[h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[a("span",{children:s("Function")}),a("span",{className:"text-end",children:s("Calls")}),a("span",{className:"w-12 text-end",children:s("Avg")}),a("span",{className:"w-8 text-end",children:s("Err")})]}),r.map(qt)]})]}),e[0]=n,e[1]=s,e[2]=l}else l=e[2];return l},Dt=t=>{const e=_(26),{subs:n}=t,s=T();let l;e[0]!==s?(l=s("Live connections"),e[0]=s,e[1]=l):l=e[1];let r;e[2]!==l?(r=a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[2]=l,e[3]=r):r=e[3];const i=n?.totalConnections??0;let o;e[4]!==i?(o=i.toLocaleString(),e[4]=i,e[5]=o):o=e[5];let c;e[6]!==o?(c=a("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[6]=o,e[7]=c):c=e[7];let u;e[8]!==s?(u=s("sockets"),e[8]=s,e[9]=u):u=e[9];let m;e[10]!==u?(m=a("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=m):m=e[11];let d;e[12]!==c||e[13]!==m?(d=h("span",{className:"flex items-baseline gap-1.5",children:[c,m]}),e[12]=c,e[13]=m,e[14]=d):d=e[14];const f=n?.totalSubscriptions??0;let p;e[15]!==f?(p=f.toLocaleString(),e[15]=f,e[16]=p):p=e[16];let g;e[17]!==s?(g=s("active subscriptions"),e[17]=s,e[18]=g):g=e[18];let x;e[19]!==p||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[p," ",g]}),e[19]=p,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==r||e[24]!==d?(b=a(P,{"data-testid":"home-live-connections",children:h(tt,{className:"flex flex-col gap-2.5 py-4",children:[r,d,x]})}),e[22]=x,e[23]=r,e[24]=d,e[25]=b):b=e[25],b},jt=t=>{const e=_(7),{entries:n}=t,s=T();let l;if(e[0]!==n||e[1]!==s){const r=Date.now();let i;e[3]!==s?(i=s("Recent activity"),e[3]=s,e[4]=i):i=e[4];let o;e[5]!==i?(o=a("div",{className:"border-b border-border px-4 py-3",children:a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],l=h(P,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[o,n.length===0?a("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No recent activity.")}):a("ul",{className:"divide-y divide-border",children:n.slice(0,5).map(c=>h("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[h("span",{className:"flex min-w-0 items-center gap-2",children:[a("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),h("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&h("span",{className:"text-muted-foreground",children:[" · ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),a("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Et(c.ts,r)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=l}else l=e[2];return l},Ft=t=>{const e=t.reduce((n,s)=>n+s.calls,0);return e===0?null:t.reduce((n,s)=>n+s.totalDurationMs,0)/e},as=t=>{const e=_(149),{initialShardKey:n}=t,s=T(),l=Xe(),r=n??"";let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let o;e[1]!==r?(o={shardKey:r},e[1]=r,e[2]=o):o=e[2];const c=ve(ye.getMetrics,i,o);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let m;e[4]!==r?(m={shardKey:r},e[4]=r,e[5]=m):m=e[5];const d=ve(ye.getFunctionStats,u,m);let f,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},p={shardKey:""},e[6]=f,e[7]=p):(f=e[6],p=e[7]);const g=ve(ye.getSecurityAudit,f,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==r?(b={shardKey:r},e[9]=r,e[10]=b):b=e[10];const v=ve(ye.listSubscriptions,x,b);let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S={},e[11]=S):S=e[11];let w;e[12]!==r?(w={shardKey:r},e[12]=r,e[13]=w):w=e[13];const $=ve(ye.getAuditLog,S,w),y=c.data??null;let k,C,A,N,M,I,L,O,R,D,j,F,E,B,U,q,K,W;if(e[14]!==$.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==l||e[19]!==d.data||e[20]!==v.data||e[21]!==s){N=Array.isArray(d.data?.functions)?d.data.functions:[],L=v.data??null;let ke;e[40]!==$.data?(ke=Array.isArray($.data?.entries)?$.data.entries:[],e[40]=$.data,e[41]=ke):ke=e[41],C=ke,M=c.data===void 0||d.data===void 0?null:ct(y,N).length,I=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ce;e[42]!==l?(Ce=()=>{Ne(l({to:"/security"}))},e[42]=l,e[43]=Ce):Ce=e[43],W=Ce;let Ae;e[44]!==l?(Ae=()=>{Ne(l({to:"/insights"}))},e[44]=l,e[45]=Ae):Ae=e[45],K=Ae;const Me=Je(y?.history,"calls"),$e=Je(y?.history,"errors"),ze=Ft(N),Ie=Math.max(0,...N.map(Kt));let Te;e[46]!==y||e[47]!==s?(Te=y===null?void 0:Rt(s,y.cache),e[46]=y,e[47]=s,e[48]=Te):Te=e[48],A=Te,U="flex flex-col gap-6",q="lunora-home",j="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",F="home-health";const Ee=Ye(Me);let he;e[49]!==s?(he=s("Requests"),e[49]=s,e[50]=he):he=e[50];const Be=y?.requests??0;let ge;e[51]!==Be?(ge=Be.toLocaleString(),e[51]=Be,e[52]=ge):ge=e[52],e[53]!==Me||e[54]!==Ee||e[55]!==he||e[56]!==ge?(E=a(Oe,{delta:Ee,label:he,trend:Me,value:ge}),e[53]=Me,e[54]=Ee,e[55]=he,e[56]=ge,e[57]=E):E=e[57];const Pe=Ye($e,!1);let xe;e[58]!==s?(xe=s("Errors"),e[58]=s,e[59]=xe):xe=e[59];const De=y?.errors??0;let be;e[60]!==De?(be=De.toLocaleString(),e[60]=De,e[61]=be):be=e[61],e[62]!==$e||e[63]!==Pe||e[64]!==xe||e[65]!==be?(B=a(Oe,{delta:Pe,label:xe,trend:$e,value:be}),e[62]=$e,e[63]=Pe,e[64]=xe,e[65]=be,e[66]=B):B=e[66],k=Oe,e[67]!==Ie||e[68]!==s?(O=Ie>0?`${s("max")} ${Fe(Ie)}`:void 0,e[67]=Ie,e[68]=s,e[69]=O):O=e[69],e[70]!==s?(R=s("Avg latency"),e[70]=s,e[71]=R):R=e[71],D=ze===null?"—":Fe(ze),e[14]=$.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=l,e[19]=d.data,e[20]=v.data,e[21]=s,e[22]=k,e[23]=C,e[24]=A,e[25]=N,e[26]=M,e[27]=I,e[28]=L,e[29]=O,e[30]=R,e[31]=D,e[32]=j,e[33]=F,e[34]=E,e[35]=B,e[36]=U,e[37]=q,e[38]=K,e[39]=W}else k=e[22],C=e[23],A=e[24],N=e[25],M=e[26],I=e[27],L=e[28],O=e[29],R=e[30],D=e[31],j=e[32],F=e[33],E=e[34],B=e[35],U=e[36],q=e[37],K=e[38],W=e[39];let z;e[72]!==k||e[73]!==O||e[74]!==R||e[75]!==D?(z=a(k,{footer:O,label:R,value:D}),e[72]=k,e[73]=O,e[74]=R,e[75]=D,e[76]=z):z=e[76];let H;e[77]!==s?(H=s("Database size"),e[77]=s,e[78]=H):H=e[78];const Re=y?.databaseSize??null;let V;e[79]!==Re?(V=it(Re),e[79]=Re,e[80]=V):V=e[80];let Q;e[81]!==A||e[82]!==H||e[83]!==V?(Q=a(Oe,{footer:A,label:H,value:V}),e[81]=A,e[82]=H,e[83]=V,e[84]=Q):Q=e[84];let G;e[85]!==j||e[86]!==F||e[87]!==E||e[88]!==B||e[89]!==z||e[90]!==Q?(G=h("div",{className:j,"data-testid":F,children:[E,B,z,Q]}),e[85]=j,e[86]=F,e[87]=E,e[88]=B,e[89]=z,e[90]=Q,e[91]=G):G=e[91];let _e;e[92]===Symbol.for("react.memo_cache_sentinel")?(_e=a(bt,{}),e[92]=_e):_e=e[92];let J;e[93]!==N?(J=a("div",{className:"lg:col-span-2",children:a(Pt,{functions:N})}),e[93]=N,e[94]=J):J=e[94];let Y;e[95]!==L?(Y=a(Dt,{subs:L}),e[95]=L,e[96]=Y):Y=e[96];let Z;e[97]!==C?(Z=a(jt,{entries:C}),e[97]=C,e[98]=Z):Z=e[98];let X;e[99]!==Y||e[100]!==Z?(X=h("div",{className:"flex flex-col gap-3",children:[Y,Z]}),e[99]=Y,e[100]=Z,e[101]=X):X=e[101];let ee;e[102]!==J||e[103]!==X?(ee=h("div",{className:"grid gap-3 lg:grid-cols-3",children:[J,X]}),e[102]=J,e[103]=X,e[104]=ee):ee=e[104];let te;e[105]!==s?(te=s("Advisors"),e[105]=s,e[106]=te):te=e[106];let se;e[107]!==te?(se=a("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:te}),e[107]=te,e[108]=se):se=e[108];let ne;e[109]!==M||e[110]!==I||e[111]!==s||e[112]!==K||e[113]!==W?(ne=I===0&&M===0?a(nt,{description:s("No security or performance issues detected."),icon:h("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[a("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),a("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:s("No issues found")}):h("div",{className:"grid gap-3 sm:grid-cols-2",children:[a(Ze,{count:I,onView:W,testId:"home-security",title:s("Security findings")}),a(Ze,{count:M,onView:K,testId:"home-performance",title:s("Performance issues")})]}),e[109]=M,e[110]=I,e[111]=s,e[112]=K,e[113]=W,e[114]=ne):ne=e[114];let le;e[115]!==se||e[116]!==ne?(le=h("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[se,ne]}),e[115]=se,e[116]=ne,e[117]=le):le=e[117];let ae;e[118]!==s?(ae=s("Get connected"),e[118]=s,e[119]=ae):ae=e[119];let re;e[120]!==ae?(re=a("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[120]=ae,e[121]=re):re=e[121];let oe;e[122]!==s?(oe=s("Client SDK"),e[122]=s,e[123]=oe):oe=e[123];let ie;e[124]!==oe?(ie=a(je,{command:"npm i @lunora/client",label:oe}),e[124]=oe,e[125]=ie):ie=e[125];let ce;e[126]!==s?(ce=s("React"),e[126]=s,e[127]=ce):ce=e[127];let de;e[128]!==ce?(de=a(je,{command:"npm i @lunora/react",label:ce}),e[128]=ce,e[129]=de):de=e[129];let ue;e[130]!==s?(ue=s("CLI"),e[130]=s,e[131]=ue):ue=e[131];let me;e[132]!==ue?(me=a(je,{command:"lunora dev",label:ue}),e[132]=ue,e[133]=me):me=e[133];let fe;e[134]!==ie||e[135]!==de||e[136]!==me?(fe=h("div",{className:"grid gap-3 sm:grid-cols-3",children:[ie,de,me]}),e[134]=ie,e[135]=de,e[136]=me,e[137]=fe):fe=e[137];let Se;e[138]===Symbol.for("react.memo_cache_sentinel")?(Se=a(At,{}),e[138]=Se):Se=e[138];let pe;e[139]!==re||e[140]!==fe?(pe=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[re,fe,Se]}),e[139]=re,e[140]=fe,e[141]=pe):pe=e[141];let we;return e[142]!==U||e[143]!==q||e[144]!==G||e[145]!==ee||e[146]!==le||e[147]!==pe?(we=h("div",{className:U,"data-testid":q,children:[G,_e,ee,le,pe]}),e[142]=U,e[143]=q,e[144]=G,e[145]=ee,e[146]=le,e[147]=pe,e[148]=we):we=e[148],we};function Ut(t,e){return e.calls-t.calls}function qt(t){return h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[a("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),a("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),a("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Fe(t.calls>0?t.totalDurationMs/t.calls:0)}),a("span",{className:st("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function Kt(t){return t.maxDurationMs}export{as as H,Rt as c,pt as u};
@@ -1,2 +1,2 @@
1
1
  import{resolveHint as e}from"@lunora/errors";const a=t=>{if(typeof t=="string")return[t];if(!Array.isArray(t))return;const n=t.filter(r=>typeof r=="string");return n.length>0?n:void 0},s=t=>{if(t!==void 0)return typeof t=="string"?t:t.join(`
2
- `)},f=new Set(["ADMIN_FORBIDDEN","FORBIDDEN","UNAUTHORIZED"]),p=(t,n,r,o,i)=>{switch(n){case"action":return t.action(r,o,i);case"mutation":return t.mutation(r,o,{...i,onlineOnly:!0});default:return t.query(r,o,i)}},m=t=>({__lunoraRef:t}),h=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},b=t=>t instanceof Error?t.message:String(t),u=t=>{if(t===null||typeof t!="object"||!("code"in t))return;const{code:n}=t;return typeof n=="string"?n:void 0},B=t=>{const n=u(t);return n!==void 0&&f.has(n)},w=t=>{if(typeof t=="string")return s(e(t));if(t===null||typeof t!="object")return;const{code:n,hint:r,message:o}=t;return s(e({code:typeof n=="string"?n:void 0,hint:a(r),message:typeof o=="string"?o:void 0}))},T=t=>{if(t===null||typeof t!="object"||!("docsUrl"in t))return;const n=t.docsUrl;if(typeof n=="string")try{const{protocol:r}=new URL(n);return r==="http:"||r==="https:"?n:void 0}catch{return}},c=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,o=0;for(;r>=1024&&o<n.length-1;)r/=1024,o+=1;return`${r.toFixed(1)} ${n[o]??"TB"}`},d=(t,n)=>typeof n=="bigint"?n.toString():n instanceof ArrayBuffer||ArrayBuffer.isView(n)?`<bytes: ${c(n.byteLength)}>`:n,S=t=>typeof t=="bigint"?t.toString():t,A=t=>{if(t==null)return"";switch(typeof t){case"bigint":case"boolean":case"number":return t.toString();case"string":return t;case"symbol":return t.toString();default:return t instanceof ArrayBuffer||ArrayBuffer.isView(t)?`<bytes: ${c(t.byteLength)}>`:JSON.stringify(t,d)}},g=(t,n)=>{t.catch(r=>{n?.(r)})},l=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},D=t=>{let n=l(t);for(;n.endsWith("/");)n=n.slice(0,-1);return n},N=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(g(n.writeText(t)),!0)},O=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{T as a,b,m as c,h as d,w as e,g as f,N as g,O as h,B as i,u as j,d as k,A as l,p as m,c as n,S as o,l as r,D as w};
2
+ `)},f=new Set(["ADMIN_FORBIDDEN","FORBIDDEN","UNAUTHORIZED"]),p=(t,n,r,o,i)=>{switch(n){case"action":return t.action(r,o,i);case"mutation":return t.mutation(r,o,{...i,onlineOnly:!0});default:return t.query(r,o,i)}},m=t=>({__lunoraRef:t}),h=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},b=t=>t instanceof Error?t.message:String(t),u=t=>{if(t===null||typeof t!="object"||!("code"in t))return;const{code:n}=t;return typeof n=="string"?n:void 0},B=t=>{const n=u(t);return n!==void 0&&f.has(n)},w=t=>{if(typeof t=="string")return s(e(t));if(t===null||typeof t!="object")return;const{code:n,hint:r,message:o}=t;return s(e({code:typeof n=="string"?n:void 0,hint:a(r),message:typeof o=="string"?o:void 0}))},T=t=>{if(t===null||typeof t!="object"||!("docsUrl"in t))return;const n=t.docsUrl;if(typeof n=="string")try{const{protocol:r}=new URL(n);return r==="http:"||r==="https:"?n:void 0}catch{return}},c=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,o=0;for(;r>=1024&&o<n.length-1;)r/=1024,o+=1;return`${r.toFixed(1)} ${n[o]??"TB"}`},d=(t,n)=>typeof n=="bigint"?n.toString():n instanceof ArrayBuffer||ArrayBuffer.isView(n)?`<bytes: ${c(n.byteLength)}>`:n,S=t=>typeof t=="bigint"?t.toString():t,A=t=>{if(t==null)return"";switch(typeof t){case"bigint":case"boolean":case"number":return t.toString();case"string":return t;case"symbol":return t.toString();default:return t instanceof ArrayBuffer||ArrayBuffer.isView(t)?`<bytes: ${c(t.byteLength)}>`:JSON.stringify(t,d)}},g=(t,n)=>{t.catch(r=>{n?.(r)})},l=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},D=t=>{let n=l(t);for(;n.endsWith("/");)n=n.slice(0,-1);return n},N=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(g(n.writeText(t)),!0)},O=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{T as a,b,O as c,m as d,w as e,g as f,h as g,u as h,B as i,d as j,A as k,N as l,p as m,c as n,S as o,l as r,D as w};
@@ -1 +1 @@
1
- import{c as x}from"react/compiler-runtime";import{f as v,r as w}from"./log-fields-CV-9O0nh.mjs";import{B as N}from"./badge-r_5B4LHP.mjs";import{h as b}from"./internal-hIuTpSbx.mjs";import{useState as k}from"react";import{useT as L}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{jsx as f,jsxs as h,Fragment as y}from"react/jsx-runtime";const E={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},_=u=>{const e=x(19),{errors:t}=u,a=L(),[r,m]=k(!1);let l,c;if(e[0]!==t||e[1]!==r||e[2]!==a){const g=t.map(j).join(", ");l=r,c=a(r?"Hide the stack and cause of {field}":"Show the stack and cause of {field}",{field:g}),e[0]=t,e[1]=r,e[2]=a,e[3]=l,e[4]=c}else l=e[3],c=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{m(F)},e[5]=i):i=e[5];const p=r?"▾":"▸";let s;e[6]!==a?(s=a("Error details"),e[6]=a,e[7]=s):s=e[7];let o;e[8]!==l||e[9]!==c||e[10]!==p||e[11]!==s?(o=h("button",{"aria-expanded":l,"aria-label":c,className:"shrink-0 pl-2 text-[11px] text-destructive underline-offset-2 hover:underline","data-testid":"lg-error-toggle",onClick:i,type:"button",children:[p," ",s]}),e[8]=l,e[9]=c,e[10]=p,e[11]=s,e[12]=o):o=e[12];let n;e[13]!==t||e[14]!==r?(n=r?f("pre",{className:"order-last mt-1 basis-full overflow-x-auto whitespace-pre rounded-md bg-muted/50 p-2 font-mono text-[11px] leading-snug text-muted-foreground","data-testid":"lg-error-detail",children:v(t)}):null,e[13]=t,e[14]=r,e[15]=n):n=e[15];let d;return e[16]!==o||e[17]!==n?(d=h(y,{children:[o,n]}),e[16]=o,e[17]=n,e[18]=d):d=e[18],d};function j(u){const[e]=u;return e}function F(u){return!u}const D=u=>{const e=x(24),{entry:t}=u;let a;e[0]!==t.fields?(a=w(t.fields),e[0]=t.fields,e[1]=a):a=e[1];const r=a;let m;e[2]!==t.timestamp?(m=b(t.timestamp),e[2]=t.timestamp,e[3]=m):m=e[3];let l;e[4]!==m?(l=f("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:m}),e[4]=m,e[5]=l):l=e[5];const c=E[t.level];let i;e[6]!==t.level||e[7]!==c?(i=f("span",{className:"w-20 shrink-0",role:"gridcell",children:f(N,{variant:c,children:t.level})}),e[6]=t.level,e[7]=c,e[8]=i):i=e[8];const p=t.functionPath??"—";let s;e[9]!==p?(s=f("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:p}),e[9]=p,e[10]=s):s=e[10];let o;e[11]!==r.text?(o=r.text===""?null:f("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:r.text}),e[11]=r.text,e[12]=o):o=e[12];let n;e[13]!==t.message||e[14]!==o?(n=h("span",{className:"min-w-0 flex-1 truncate",role:"gridcell",children:[t.message,o]}),e[13]=t.message,e[14]=o,e[15]=n):n=e[15];let d;e[16]!==r.errors?(d=r.errors.length===0?null:f("span",{className:"contents",role:"gridcell",children:f(_,{errors:r.errors})}),e[16]=r.errors,e[17]=d):d=e[17];let g;return e[18]!==d||e[19]!==l||e[20]!==i||e[21]!==s||e[22]!==n?(g=h("div",{className:"flex min-w-0 flex-1 flex-wrap items-center",role:"none",children:[l,i,s,n,d]}),e[18]=d,e[19]=l,e[20]=i,e[21]=s,e[22]=n,e[23]=g):g=e[23],g};export{D as L,E as a,_ as b};
1
+ import{c as x}from"react/compiler-runtime";import{f as v,r as w}from"./log-fields-CV-9O0nh.mjs";import{B as N}from"./badge-r_5B4LHP.mjs";import{c as b}from"./internal-BT5tH08j.mjs";import{useState as k}from"react";import{useT as L}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{jsx as f,jsxs as h,Fragment as y}from"react/jsx-runtime";const E={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},_=u=>{const e=x(19),{errors:t}=u,a=L(),[r,m]=k(!1);let l,c;if(e[0]!==t||e[1]!==r||e[2]!==a){const g=t.map(j).join(", ");l=r,c=a(r?"Hide the stack and cause of {field}":"Show the stack and cause of {field}",{field:g}),e[0]=t,e[1]=r,e[2]=a,e[3]=l,e[4]=c}else l=e[3],c=e[4];let i;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{m(F)},e[5]=i):i=e[5];const p=r?"▾":"▸";let s;e[6]!==a?(s=a("Error details"),e[6]=a,e[7]=s):s=e[7];let o;e[8]!==l||e[9]!==c||e[10]!==p||e[11]!==s?(o=h("button",{"aria-expanded":l,"aria-label":c,className:"shrink-0 pl-2 text-[11px] text-destructive underline-offset-2 hover:underline","data-testid":"lg-error-toggle",onClick:i,type:"button",children:[p," ",s]}),e[8]=l,e[9]=c,e[10]=p,e[11]=s,e[12]=o):o=e[12];let n;e[13]!==t||e[14]!==r?(n=r?f("pre",{className:"order-last mt-1 basis-full overflow-x-auto whitespace-pre rounded-md bg-muted/50 p-2 font-mono text-[11px] leading-snug text-muted-foreground","data-testid":"lg-error-detail",children:v(t)}):null,e[13]=t,e[14]=r,e[15]=n):n=e[15];let d;return e[16]!==o||e[17]!==n?(d=h(y,{children:[o,n]}),e[16]=o,e[17]=n,e[18]=d):d=e[18],d};function j(u){const[e]=u;return e}function F(u){return!u}const D=u=>{const e=x(24),{entry:t}=u;let a;e[0]!==t.fields?(a=w(t.fields),e[0]=t.fields,e[1]=a):a=e[1];const r=a;let m;e[2]!==t.timestamp?(m=b(t.timestamp),e[2]=t.timestamp,e[3]=m):m=e[3];let l;e[4]!==m?(l=f("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:m}),e[4]=m,e[5]=l):l=e[5];const c=E[t.level];let i;e[6]!==t.level||e[7]!==c?(i=f("span",{className:"w-20 shrink-0",role:"gridcell",children:f(N,{variant:c,children:t.level})}),e[6]=t.level,e[7]=c,e[8]=i):i=e[8];const p=t.functionPath??"—";let s;e[9]!==p?(s=f("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:p}),e[9]=p,e[10]=s):s=e[10];let o;e[11]!==r.text?(o=r.text===""?null:f("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:r.text}),e[11]=r.text,e[12]=o):o=e[12];let n;e[13]!==t.message||e[14]!==o?(n=h("span",{className:"min-w-0 flex-1 truncate",role:"gridcell",children:[t.message,o]}),e[13]=t.message,e[14]=o,e[15]=n):n=e[15];let d;e[16]!==r.errors?(d=r.errors.length===0?null:f("span",{className:"contents",role:"gridcell",children:f(_,{errors:r.errors})}),e[16]=r.errors,e[17]=d):d=e[17];let g;return e[18]!==d||e[19]!==l||e[20]!==i||e[21]!==s||e[22]!==n?(g=h("div",{className:"flex min-w-0 flex-1 flex-wrap items-center",role:"none",children:[l,i,s,n,d]}),e[18]=d,e[19]=l,e[20]=i,e[21]=s,e[22]=n,e[23]=g):g=e[23],g};export{D as L,E as a,_ as b};
@@ -1 +1 @@
1
- import{o as u}from"./use-admin-query-CaOm4JS3.mjs";const h="__lunora_admin__:",p=new Set(["action","mutation","query","streamRpc"]),y=Symbol("lunora.operationSeq"),R=t=>{if(typeof t!="object"||t===null)return;const n=t[y];return typeof n=="number"?n:void 0},O=(t,n)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,y,{configurable:!0,enumerable:!1,value:n,writable:!0})}catch{}},_=t=>{if(typeof t!="object"||t===null)return;const n=t.__lunoraRef;return typeof n=="string"&&n.startsWith(h)?n:void 0},l=t=>{if(typeof t!="object"||t===null)return"";const{shardKey:n}=t;return typeof n=="string"?n:""},E=t=>new Proxy(t,{get(n,c,b){const s=Reflect.get(n,c,b);if(typeof s!="function"||typeof c!="string"||!p.has(c))return typeof s=="function"?s.bind(n):s;const a=s;return async(...e)=>{const r=_(e[0]);if(r===void 0)return a.apply(n,e);const f=typeof e[1]=="object"&&e[1]!==null?e[1]:{},d=l(e[2])||(c==="streamRpc"?l(f):""),i=u.start(r,f,d);try{const o=await a.apply(n,e);return u.settle(i,{result:o}),o}catch(o){throw u.settle(i,{error:o instanceof Error?o.message:String(o)}),O(o,i),o}}}});export{R as o,E as w};
1
+ import{o as u}from"./use-admin-query-DMnTt_hg.mjs";const h="__lunora_admin__:",p=new Set(["action","mutation","query","streamRpc"]),y=Symbol("lunora.operationSeq"),R=t=>{if(typeof t!="object"||t===null)return;const n=t[y];return typeof n=="number"?n:void 0},O=(t,n)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,y,{configurable:!0,enumerable:!1,value:n,writable:!0})}catch{}},_=t=>{if(typeof t!="object"||t===null)return;const n=t.__lunoraRef;return typeof n=="string"&&n.startsWith(h)?n:void 0},l=t=>{if(typeof t!="object"||t===null)return"";const{shardKey:n}=t;return typeof n=="string"?n:""},E=t=>new Proxy(t,{get(n,c,b){const s=Reflect.get(n,c,b);if(typeof s!="function"||typeof c!="string"||!p.has(c))return typeof s=="function"?s.bind(n):s;const a=s;return async(...e)=>{const r=_(e[0]);if(r===void 0)return a.apply(n,e);const f=typeof e[1]=="object"&&e[1]!==null?e[1]:{},d=l(e[2])||(c==="streamRpc"?l(f):""),i=u.start(r,f,d);try{const o=await a.apply(n,e);return u.settle(i,{result:o}),o}catch(o){throw u.settle(i,{error:o instanceof Error?o.message:String(o)}),O(o,i),o}}}});export{R as o,E as w};
@@ -1,13 +1,13 @@
1
- import{c as P}from"react/compiler-runtime";import{SentIcon as ie,Copy01Icon as ae,Search01Icon as le}from"@hugeicons/core-free-icons";import{HugeiconsIcon as F}from"@hugeicons/react";import{useState as B,createContext as de,use as ce}from"react";import{I as ue}from"./input-CXhxesPC.mjs";import{useT as J}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{B as W}from"./button-q0UYSmrn.mjs";import{g as X,f as fe,b as H,m as me,c as pe,d as he,k as ge}from"./internal-hIuTpSbx.mjs";import{jsx as i,jsxs as N,Fragment as xe}from"react/jsx-runtime";import{B as ye}from"./badge-r_5B4LHP.mjs";import{ShardInput as be}from"./ShardInput-CoySruKZ.mjs";import{L as U}from"./label-DKFzyHq6.mjs";import{T as ve}from"./textarea--40GKAyz.mjs";import{LunoraError as Ne}from"@lunora/errors";import{u as Se}from"./use-studio-client-DCA50tF2.mjs";import{c as Y}from"./utils-bhneXptQ.mjs";const we=t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string",Q=t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},z=t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>z(e)).join(" | "):t.type==="array"?`array<${z(t.items)}>`:t.type??"any",ke=t=>{const e=Q(t);return e!==void 0?t.type??we(e[0]):z(t)},Oe=t=>{const e=Q(t);return e===void 0?void 0:e.map(r=>JSON.stringify(r)).join(" | ")},$e=t=>{const e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} ≤`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);const r=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`≤ ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);const s=e.length>(r?2:1);return r||s?e.join(" "):void 0},Te=t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},D=t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return D(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{const e={};for(const[r,s]of Object.entries(t.properties??{}))e[r]=D(s);return e}case"string":return"";default:return null}},K=t=>{const e=P(7),{label:r,value:s}=t;let n;e[0]!==r?(n=i("span",{className:"text-muted-foreground",children:r}),e[0]=r,e[1]=n):n=e[1];let o;e[2]!==s?(o=i("span",{className:"text-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==n||e[5]!==o?(l=N("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,o]}),e[4]=n,e[5]=o,e[6]=l):l=e[6],l},Ce=t=>{const e=P(40),{name:r,required:s,schema:n}=t,o=J();let l;e[0]!==n?(l=$e(n),e[0]=n,e[1]=l):l=e[1];const a=l;let y;e[2]!==n?(y=Oe(n),e[2]=n,e[3]=y):y=e[3];const d=y,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let b;e[4]!==n?(b=Te(n),e[4]=n,e[5]=b):b=e[5];const x=b,f=s?"*":"?";let m;e[6]!==f?(m=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=m):m=e[7];let v;e[8]!==r||e[9]!==m?(v=N("span",{className:"font-mono text-foreground",children:[r,m]}),e[8]=r,e[9]=m,e[10]=v):v=e[10];let w;e[11]!==n?(w=ke(n),e[11]=n,e[12]=w):w=e[12];let p;e[13]!==w?(p=i("span",{className:"font-mono text-muted-foreground",children:w}),e[13]=w,e[14]=p):p=e[14];let h;e[15]!==v||e[16]!==p?(h=N("div",{className:"flex items-baseline gap-2",children:[v,p]}),e[15]=v,e[16]=p,e[17]=h):h=e[17];let g;e[18]!==n.description?(g=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=g):g=e[19];let S;e[20]!==u||e[21]!==a||e[22]!==c||e[23]!==n.format||e[24]!==o||e[25]!==d?(S=u&&N("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&i(K,{label:o("Format"),value:n.format}),a!==void 0&&i(K,{label:o("Range"),value:a}),d!==void 0&&i(K,{label:o("Value in"),value:d}),c!==void 0&&i(K,{label:o("relation"),value:c})]}),e[20]=u,e[21]=a,e[22]=c,e[23]=n.format,e[24]=o,e[25]=d,e[26]=S):S=e[26];let O;e[27]!==g||e[28]!==S||e[29]!==h?(O=N("div",{className:"flex flex-col gap-1 py-2",children:[h,g,S]}),e[27]=g,e[28]=S,e[29]=h,e[30]=O):O=e[30];const k=O;if(x===void 0){let $;return e[31]!==k?($=i("div",{className:"border-b border-border/50 last:border-b-0",children:k}),e[31]=k,e[32]=$):$=e[32],$}let T;e[33]!==k?(T=i("summary",{className:"cursor-pointer marker:text-muted-foreground",children:k}),e[33]=k,e[34]=T):T=e[34];let R;e[35]!==x?(R=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(Z,{schema:x})}),e[35]=x,e[36]=R):R=e[36];let C;return e[37]!==T||e[38]!==R?(C=N("details",{className:"border-b border-border/50 last:border-b-0",children:[T,R]}),e[37]=T,e[38]=R,e[39]=C):C=e[39],C},Z=t=>{const e=P(7),{schema:r}=t;let s;e[0]!==r.required?(s=new Set(r.required),e[0]=r.required,e[1]=s):s=e[1];const n=s;let o;e[2]!==r.properties?(o=Object.entries(r.properties??{}),e[2]=r.properties,e[3]=o):o=e[3];const l=o;let a;return e[4]!==n||e[5]!==l?(a=i("div",{className:"flex flex-col",children:l.map(y=>{const[d,c]=y;return i(Ce,{name:d,required:n.has(d),schema:c},d)})}),e[4]=n,e[5]=l,e[6]=a):a=e[6],a},V=t=>{const e=P(10),{schema:r,testId:s}=t;if(r?.type!=="object"||Object.keys(r.properties??{}).length===0){let l;e[0]!==r?(l=z(r),e[0]=r,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==s?(a=i("p",{className:"font-mono text-xs text-muted-foreground","data-testid":s,children:l}),e[2]=l,e[3]=s,e[4]=a):a=e[4],a}let n;e[5]!==r?(n=i(Z,{schema:r}),e[5]=r,e[6]=n):n=e[6];let o;return e[7]!==n||e[8]!==s?(o=i("div",{className:"text-xs","data-testid":s,children:n}),e[7]=n,e[8]=s,e[9]=o):o=e[9],o},Ee=["curl","javascript","lunora"],Re={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},Ae=t=>`api.${t.replaceAll(/[/:]/g,".")}`,je=t=>{const e=D(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},Ie=(t,e,r)=>{const s=`${r}${e.httpPath}`,n=JSON.stringify(je(e),void 0,2),o=JSON.stringify(D(e.argsSchema)??{},void 0,2);switch(t){case"curl":{const l=e.method!=="GET"&&e.method!=="HEAD",a=[`curl -X ${e.method} ${JSON.stringify(s)}`];return l&&a.push(' -H "Content-Type: application/json"',` -d '${n}'`),a.join(` \\
1
+ import{c as P}from"react/compiler-runtime";import{SentIcon as ie,Copy01Icon as ae,Search01Icon as le}from"@hugeicons/core-free-icons";import{HugeiconsIcon as F}from"@hugeicons/react";import{useState as B,createContext as de,use as ce}from"react";import{I as ue}from"./input-CXhxesPC.mjs";import{useT as J}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{B as W}from"./button-q0UYSmrn.mjs";import{l as X,f as fe,b as H,m as me,d as pe,g as he,j as ge}from"./internal-BT5tH08j.mjs";import{jsx as i,jsxs as N,Fragment as xe}from"react/jsx-runtime";import{B as ye}from"./badge-r_5B4LHP.mjs";import{ShardInput as be}from"./ShardInput-CoySruKZ.mjs";import{L as U}from"./label-DKFzyHq6.mjs";import{T as ve}from"./textarea--40GKAyz.mjs";import{LunoraError as Ne}from"@lunora/errors";import{u as Se}from"./use-studio-client-DCA50tF2.mjs";import{c as Y}from"./utils-bhneXptQ.mjs";const we=t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string",Q=t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},z=t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>z(e)).join(" | "):t.type==="array"?`array<${z(t.items)}>`:t.type??"any",ke=t=>{const e=Q(t);return e!==void 0?t.type??we(e[0]):z(t)},Oe=t=>{const e=Q(t);return e===void 0?void 0:e.map(r=>JSON.stringify(r)).join(" | ")},$e=t=>{const e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} ≤`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);const r=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`≤ ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);const s=e.length>(r?2:1);return r||s?e.join(" "):void 0},Te=t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},D=t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return D(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{const e={};for(const[r,s]of Object.entries(t.properties??{}))e[r]=D(s);return e}case"string":return"";default:return null}},K=t=>{const e=P(7),{label:r,value:s}=t;let n;e[0]!==r?(n=i("span",{className:"text-muted-foreground",children:r}),e[0]=r,e[1]=n):n=e[1];let o;e[2]!==s?(o=i("span",{className:"text-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==n||e[5]!==o?(l=N("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,o]}),e[4]=n,e[5]=o,e[6]=l):l=e[6],l},Ce=t=>{const e=P(40),{name:r,required:s,schema:n}=t,o=J();let l;e[0]!==n?(l=$e(n),e[0]=n,e[1]=l):l=e[1];const a=l;let y;e[2]!==n?(y=Oe(n),e[2]=n,e[3]=y):y=e[3];const d=y,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let b;e[4]!==n?(b=Te(n),e[4]=n,e[5]=b):b=e[5];const x=b,f=s?"*":"?";let m;e[6]!==f?(m=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=m):m=e[7];let v;e[8]!==r||e[9]!==m?(v=N("span",{className:"font-mono text-foreground",children:[r,m]}),e[8]=r,e[9]=m,e[10]=v):v=e[10];let w;e[11]!==n?(w=ke(n),e[11]=n,e[12]=w):w=e[12];let p;e[13]!==w?(p=i("span",{className:"font-mono text-muted-foreground",children:w}),e[13]=w,e[14]=p):p=e[14];let h;e[15]!==v||e[16]!==p?(h=N("div",{className:"flex items-baseline gap-2",children:[v,p]}),e[15]=v,e[16]=p,e[17]=h):h=e[17];let g;e[18]!==n.description?(g=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=g):g=e[19];let S;e[20]!==u||e[21]!==a||e[22]!==c||e[23]!==n.format||e[24]!==o||e[25]!==d?(S=u&&N("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&i(K,{label:o("Format"),value:n.format}),a!==void 0&&i(K,{label:o("Range"),value:a}),d!==void 0&&i(K,{label:o("Value in"),value:d}),c!==void 0&&i(K,{label:o("relation"),value:c})]}),e[20]=u,e[21]=a,e[22]=c,e[23]=n.format,e[24]=o,e[25]=d,e[26]=S):S=e[26];let O;e[27]!==g||e[28]!==S||e[29]!==h?(O=N("div",{className:"flex flex-col gap-1 py-2",children:[h,g,S]}),e[27]=g,e[28]=S,e[29]=h,e[30]=O):O=e[30];const k=O;if(x===void 0){let $;return e[31]!==k?($=i("div",{className:"border-b border-border/50 last:border-b-0",children:k}),e[31]=k,e[32]=$):$=e[32],$}let T;e[33]!==k?(T=i("summary",{className:"cursor-pointer marker:text-muted-foreground",children:k}),e[33]=k,e[34]=T):T=e[34];let R;e[35]!==x?(R=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(Z,{schema:x})}),e[35]=x,e[36]=R):R=e[36];let C;return e[37]!==T||e[38]!==R?(C=N("details",{className:"border-b border-border/50 last:border-b-0",children:[T,R]}),e[37]=T,e[38]=R,e[39]=C):C=e[39],C},Z=t=>{const e=P(7),{schema:r}=t;let s;e[0]!==r.required?(s=new Set(r.required),e[0]=r.required,e[1]=s):s=e[1];const n=s;let o;e[2]!==r.properties?(o=Object.entries(r.properties??{}),e[2]=r.properties,e[3]=o):o=e[3];const l=o;let a;return e[4]!==n||e[5]!==l?(a=i("div",{className:"flex flex-col",children:l.map(y=>{const[d,c]=y;return i(Ce,{name:d,required:n.has(d),schema:c},d)})}),e[4]=n,e[5]=l,e[6]=a):a=e[6],a},V=t=>{const e=P(10),{schema:r,testId:s}=t;if(r?.type!=="object"||Object.keys(r.properties??{}).length===0){let l;e[0]!==r?(l=z(r),e[0]=r,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==s?(a=i("p",{className:"font-mono text-xs text-muted-foreground","data-testid":s,children:l}),e[2]=l,e[3]=s,e[4]=a):a=e[4],a}let n;e[5]!==r?(n=i(Z,{schema:r}),e[5]=r,e[6]=n):n=e[6];let o;return e[7]!==n||e[8]!==s?(o=i("div",{className:"text-xs","data-testid":s,children:n}),e[7]=n,e[8]=s,e[9]=o):o=e[9],o},Ee=["curl","javascript","lunora"],Re={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},je=t=>`api.${t.replaceAll(/[/:]/g,".")}`,Ae=t=>{const e=D(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},Ie=(t,e,r)=>{const s=`${r}${e.httpPath}`,n=JSON.stringify(Ae(e),void 0,2),o=JSON.stringify(D(e.argsSchema)??{},void 0,2);switch(t){case"curl":{const l=e.method!=="GET"&&e.method!=="HEAD",a=[`curl -X ${e.method} ${JSON.stringify(s)}`];return l&&a.push(' -H "Content-Type: application/json"',` -d '${n}'`),a.join(` \\
2
2
  `)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
3
3
  import { api } from "./_generated/api";
4
4
 
5
5
  const client = useLunora();
6
- await client.${e.kind??"query"}(${Ae(e.functionPath)}, ${o});`;default:{const a=e.method!=="GET"&&e.method!=="HEAD"?`{
6
+ await client.${e.kind??"query"}(${je(e.functionPath)}, ${o});`;default:{const a=e.method!=="GET"&&e.method!=="HEAD"?`{
7
7
  method: ${JSON.stringify(e.method)},
8
8
  headers: { "Content-Type": "application/json" },
9
9
  body: JSON.stringify(${n}),
10
10
  }`:`{ method: ${JSON.stringify(e.method)} }`;return`const response = await fetch(${JSON.stringify(s)}, ${a});
11
11
  const data = await response.json();`}}},Pe=t=>{const e=P(24),{operation:r,server:s}=t,n=J(),[o,l]=B("curl");let a;e[0]!==r||e[1]!==o||e[2]!==s?(a=Ie(o,r,s),e[0]=r,e[1]=o,e[2]=s,e[3]=a):a=e[3];const y=a;let d;e[4]!==y?(d=()=>{X(y)},e[4]=y,e[5]=d):d=e[5];const c=d;let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=g=>{l(g.currentTarget.dataset.sample)},e[6]=u):u=e[6];const b=u;let x;e[7]!==o?(x=Ee.map(g=>i("button",{"aria-selected":o===g,className:"rounded px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium aria-selected:text-foreground","data-sample":g,"data-testid":`api-sample-${g}`,onClick:b,role:"tab",type:"button",children:Re[g]},g)),e[7]=o,e[8]=x):x=e[8];let f;e[9]!==x?(f=i("div",{className:"flex gap-1",role:"tablist",children:x}),e[9]=x,e[10]=f):f=e[10];let m;e[11]!==n?(m=n("Copy"),e[11]=n,e[12]=m):m=e[12];let v;e[13]!==c||e[14]!==m?(v=i(W,{"data-testid":"api-sample-copy",onClick:c,size:"xs",type:"button",variant:"ghost",children:m}),e[13]=c,e[14]=m,e[15]=v):v=e[15];let w;e[16]!==f||e[17]!==v?(w=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[f,v]}),e[16]=f,e[17]=v,e[18]=w):w=e[18];let p;e[19]!==y?(p=i("pre",{className:"overflow-auto px-3 pb-3 font-mono text-xs","data-testid":"api-sample-source",children:y}),e[19]=y,e[20]=p):p=e[20];let h;return e[21]!==w||e[22]!==p?(h=N("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card","data-testid":"api-code-samples",children:[w,p]}),e[21]=w,e[22]=p,e[23]=h):h=e[23],h},Le={blue:"text-info",emerald:"text-success",neutral:"text-muted-foreground",orange:"text-warning",red:"text-destructive",violet:"text-royal-amethyst"},_e=t=>{switch(t.toUpperCase()){case"DELETE":return"red";case"GET":return"emerald";case"PATCH":return"orange";case"POST":return"blue";case"PUT":return"orange";default:return"neutral"}},Be=t=>{switch(t){case"action":return"violet";case"mutation":return"orange";case"query":return"emerald";default:return"neutral"}},q=t=>{const e=P(7),{kind:r,method:s,testId:n}=t;let o;e[0]!==r||e[1]!==s?(o=r??s.toUpperCase(),e[0]=r,e[1]=s,e[2]=o):o=e[2];const l=o,a=r===void 0?_e(s):Be(r),y=`${Le[a]} font-mono text-[10px] tracking-wide uppercase`;let d;return e[3]!==l||e[4]!==y||e[5]!==n?(d=i(ye,{className:y,"data-testid":n,variant:"ghost",children:l}),e[3]=l,e[4]=y,e[5]=n,e[6]=d):d=e[6],d},ee=t=>t.startsWith("2")?"text-emerald-600 dark:text-emerald-400":t==="default"||t.startsWith("4")||t.startsWith("5")?"text-red-600 dark:text-red-400":"text-muted-foreground",te=t=>t.startsWith("2")?"bg-emerald-500":t==="default"||t.startsWith("4")||t.startsWith("5")?"bg-red-500":"bg-muted-foreground",Me=new Set([" ",`
12
12
  `,"\r"]),G=" ",Je=t=>{let e="";for(const n of t)Me.has(n)||(e+=n);let r=0,s=e.length;for(;r<s&&(e[r]??"")<=G;)r+=1;for(;s>r&&(e[s-1]??"")<=G;)s-=1;return e.slice(r,s)},De=/^(?:[a-z][\d+.a-z-]*:)?\/\//i,Ke=(t,e)=>{const r=globalThis.location?.origin??"",s=e===""?r:e,n=Je(t);if(s===""){if(De.test(n))throw new Error(`restDispatch: refusing to send the admin token off-origin (${n} names its own host and there is no origin to check it against)`);return n}const o=new URL(n,s);if(o.origin!==new URL(s).origin)throw new Error(`restDispatch: refusing to send the admin token off-origin (${o.origin} is not ${s})`);return o.toString()},ze=async(t,e,r,s)=>{const n=t.method!=="GET"&&t.method!=="HEAD",o=Ke(t.httpPath,r),a=await(await fetch(o,{body:n?JSON.stringify(e):void 0,headers:{...n?{"content-type":"application/json"}:{},...s===null||s===""?{}:{authorization:`Bearer ${s}`}},method:t.method})).text();try{return JSON.parse(a)}catch{return a}},Fe=t=>JSON.stringify(D(t.argsSchema)??{},void 0,2),re=de(null),se=()=>{const t=ce(re);if(t===null)throw new Ne("INTERNAL","useOperationRun must be used within an OperationRunProvider");return t},We=({children:t,operation:e})=>{const r=J(),s=Se(),[n,o]=B(()=>Fe(e)),[l,a]=B(""),[y,d]=B("idle"),[c,u]=B(void 0),[b,x]=B(null),[f,m]=B(null),v=async()=>{let h;try{h=n.trim()===""?{}:JSON.parse(n)}catch(S){d("error"),u(void 0),m(null),x(r("Invalid JSON args: {message}",{message:H(S)}));return}d("running"),x(null);const g=performance.now();try{const S=await(e.functionPath===void 0?ze(e,h,s.url,s.getAuthToken()):me(s,e.kind,pe(e.functionPath),h,he(l)));u(S),m(Math.round(performance.now()-g)),d("success")}catch(S){u(void 0),m(Math.round(performance.now()-g)),x(H(S)),d("error")}};return i(re,{value:{argsText:n,durationMs:f,error:b,operation:e,response:c,send:()=>{fe(v())},setArgsText:o,setShardKey:a,shardKey:l,status:y},children:t})},qe=()=>{const t=P(48),e=J(),{argsText:r,operation:s,send:n,setArgsText:o,setShardKey:l,shardKey:a,status:y}=se();let d;t[0]!==o?(d=E=>{o(E.target.value)},t[0]=o,t[1]=d):d=t[1];const c=d;let u;t[2]!==n?(u=E=>{E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),n())},t[2]=n,t[3]=u):u=t[3];const b=u,x=y==="running";let f;t[4]!==s.kind||t[5]!==s.method?(f=i(q,{kind:s.kind,method:s.method,testId:"api-try-method"}),t[4]=s.kind,t[5]=s.method,t[6]=f):f=t[6];const m=s.functionPath??s.httpPath;let v;t[7]!==m?(v=i("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:m}),t[7]=m,t[8]=v):v=t[8];const w=x?"animate-pulse":void 0;let p;t[9]!==w?(p=i(F,{className:w,icon:ie,strokeWidth:2}),t[9]=w,t[10]=p):p=t[10];let h;t[11]!==x||t[12]!==e?(h=e(x?"Sending…":"Send"),t[11]=x,t[12]=e,t[13]=h):h=t[13];let g;t[14]!==x||t[15]!==n||t[16]!==p||t[17]!==h?(g=N(W,{"data-testid":"api-try-send",disabled:x,onClick:n,size:"sm",type:"button",children:[p,h]}),t[14]=x,t[15]=n,t[16]=p,t[17]=h,t[18]=g):g=t[18];let S;t[19]!==f||t[20]!==v||t[21]!==g?(S=N("div",{className:"flex items-center gap-2 border-b border-border bg-muted px-3 py-2",children:[f,v,g]}),t[19]=f,t[20]=v,t[21]=g,t[22]=S):S=t[22];let O;t[23]!==e?(O=e("Arguments (JSON)"),t[23]=e,t[24]=O):O=t[24];let k;t[25]!==O?(k=i(U,{htmlFor:"api-try-args",children:O}),t[25]=O,t[26]=k):k=t[26];let T;t[27]!==r?(T=r.split(`
13
- `),t[27]=r,t[28]=T):T=t[28];const R=Math.min(12,Math.max(3,T.length));let C;t[29]!==r||t[30]!==c||t[31]!==b||t[32]!==R?(C=i(ve,{className:"font-mono text-xs","data-testid":"api-try-args",id:"api-try-args",onChange:c,onKeyDown:b,rows:R,spellCheck:!1,value:r}),t[29]=r,t[30]=c,t[31]=b,t[32]=R,t[33]=C):C=t[33];let $;t[34]!==k||t[35]!==C?($=N("div",{className:"flex flex-col gap-1.5",children:[k,C]}),t[34]=k,t[35]=C,t[36]=$):$=t[36];let A;t[37]!==s.functionPath||t[38]!==l||t[39]!==a||t[40]!==e?(A=s.functionPath!==void 0&&N("div",{className:"flex flex-col gap-1.5",children:[i(U,{htmlFor:"shard-input",children:e("Shard key (optional)")}),i(be,{id:"shard-input",onChange:l,testId:"shard-input",value:a})]}),t[37]=s.functionPath,t[38]=l,t[39]=a,t[40]=e,t[41]=A):A=t[41];let j;t[42]!==$||t[43]!==A?(j=N("div",{className:"flex flex-col gap-3 p-3",children:[$,A]}),t[42]=$,t[43]=A,t[44]=j):j=t[44];let I;return t[45]!==j||t[46]!==S?(I=N("div",{className:"overflow-hidden rounded-xl border border-border bg-card","data-testid":"api-try-it",children:[S,j]}),t[45]=j,t[46]=S,t[47]=I):I=t[47],I},He=t=>{const e=P(51),{operation:r}=t,s=J(),n=`api-operation-${r.operationId}`,o=r.key;let l;e[0]!==r.kind||e[1]!==r.method?(l=i(q,{kind:r.kind,method:r.method,testId:"api-operation-method"}),e[0]=r.kind,e[1]=r.method,e[2]=l):l=e[2];const a=r.functionPath??r.httpPath;let y;e[3]!==a?(y=i("code",{className:"truncate font-mono text-xs text-muted-foreground",children:a}),e[3]=a,e[4]=y):y=e[4];let d;e[5]!==l||e[6]!==y?(d=N("div",{className:"flex items-center gap-2",children:[l,y]}),e[5]=l,e[6]=y,e[7]=d):d=e[7];let c;e[8]!==r.title?(c=i("h1",{className:"text-lg font-semibold text-foreground","data-testid":"api-operation-title",children:r.title}),e[8]=r.title,e[9]=c):c=e[9];let u;e[10]!==r.description?(u=r.description!==void 0&&i("p",{className:"text-sm text-muted-foreground",children:r.description}),e[10]=r.description,e[11]=u):u=e[11];let b;e[12]!==d||e[13]!==c||e[14]!==u?(b=N("header",{className:"sticky top-0 z-10 -mx-6 -mt-6 flex flex-col gap-2 border-b border-border bg-background px-6 pt-6 pb-3",children:[d,c,u]}),e[12]=d,e[13]=c,e[14]=u,e[15]=b):b=e[15];let x;e[16]!==s?(x=s("Try it"),e[16]=s,e[17]=x):x=e[17];let f;e[18]!==x?(f=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x}),e[18]=x,e[19]=f):f=e[19];let m;e[20]===Symbol.for("react.memo_cache_sentinel")?(m=i(qe,{}),e[20]=m):m=e[20];let v;e[21]!==f?(v=N("section",{className:"flex flex-col gap-2",children:[f,m]}),e[21]=f,e[22]=v):v=e[22];let w;e[23]!==s?(w=s("Request arguments"),e[23]=s,e[24]=w):w=e[24];let p;e[25]!==w?(p=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:w}),e[25]=w,e[26]=p):p=e[26];let h;e[27]!==r.argsSchema?(h=i(V,{schema:r.argsSchema,testId:"api-operation-args"}),e[27]=r.argsSchema,e[28]=h):h=e[28];let g;e[29]!==p||e[30]!==h?(g=N("section",{className:"flex flex-col gap-2",children:[p,h]}),e[29]=p,e[30]=h,e[31]=g):g=e[31];let S;e[32]!==s?(S=s("Response body"),e[32]=s,e[33]=S):S=e[33];let O;e[34]!==S?(O=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),e[34]=S,e[35]=O):O=e[35];let k;if(e[36]!==r.responses||e[37]!==s){let C;e[39]!==s?(C=$=>N("div",{className:"flex flex-col gap-1.5 rounded-xl border border-border bg-card p-3",children:[N("div",{className:"flex items-center justify-between gap-2",children:[N("span",{className:`inline-flex items-center gap-1.5 font-mono text-xs font-semibold ${ee($.status)}`,children:[i("span",{className:`size-1.5 rounded-full ${te($.status)}`}),$.status]}),$.schema!==void 0&&i("span",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:s("application/json")})]}),$.description!==void 0&&i("p",{className:"text-xs text-muted-foreground",children:$.description}),$.schema!==void 0&&i(V,{schema:$.schema,testId:`api-response-${$.status}`})]},$.status),e[39]=s,e[40]=C):C=e[40],k=r.responses.map(C),e[36]=r.responses,e[37]=s,e[38]=k}else k=e[38];let T;e[41]!==O||e[42]!==k?(T=N("section",{className:"flex flex-col gap-3",children:[O,k]}),e[41]=O,e[42]=k,e[43]=T):T=e[43];let R;return e[44]!==r.key||e[45]!==n||e[46]!==v||e[47]!==g||e[48]!==T||e[49]!==b?(R=N("div",{className:"flex flex-col gap-6 duration-200 animate-in fade-in-0 slide-in-from-bottom-1","data-testid":n,children:[b,v,g,T]},o),e[44]=r.key,e[45]=n,e[46]=v,e[47]=g,e[48]=T,e[49]=b,e[50]=R):R=e[50],R},Ue={boolean:"text-royal-amethyst",key:"text-sky-sapphire",number:"text-warning",plain:"",string:"text-success"},Ve=/"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?/g,Ge=/^\s*:/,Xe=(t,e,r)=>r.startsWith('"')?Ge.test(t.slice(e))?"key":"string":r==="true"||r==="false"||r==="null"?"boolean":"number",Ye=t=>{const e=[];let r=0;for(const s of t.matchAll(Ve)){const{index:n}=s,o=s[0],l=n+o.length;n>r&&e.push({kind:"plain",start:r,text:t.slice(r,n)}),e.push({kind:Xe(t,l,o),start:n,text:o}),r=l}return r<t.length&&e.push({kind:"plain",start:r,text:t.slice(r)}),e},Qe=t=>{const e=P(4),{code:r}=t;let s;e[0]!==r?(s=Ye(r).map(Ze),e[0]=r,e[1]=s):s=e[1];let n;return e[2]!==s?(n=i(xe,{children:s}),e[2]=s,e[3]=n):n=e[3],n};function Ze(t){return i("span",{className:Ue[t.kind],children:t.text},t.start)}const ne="__live__",et=t=>t.schema===void 0?"":JSON.stringify(D(t.schema),void 0,2),tt=(t,e,r)=>r?t??"":e===void 0?"":JSON.stringify(e,ge,2),rt=t=>{const e=P(18),{active:r,running:s,showError:n}=t,o=J();if(s){let u;e[0]!==o?(u=o("Sending…"),e[0]=o,e[1]=u):u=e[1];let b;return e[2]!==u?(b=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-running",children:u}),e[2]=u,e[3]=b):b=e[3],b}if(r===void 0||r.body===""){let u;e[4]!==r?.live||e[5]!==o?(u=r?.live===!0?o("Send a request to see the response."):o("No example for this response."),e[4]=r?.live,e[5]=o,e[6]=u):u=e[6];let b;return e[7]!==u?(b=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-idle",children:u}),e[7]=u,e[8]=b):b=e[8],b}const l=n&&"text-destructive";let a;e[9]!==l?(a=Y("max-h-[28rem] overflow-auto px-3 py-3 font-mono text-xs",l),e[9]=l,e[10]=a):a=e[10];const y=n?"api-response-error":"api-response-body";let d;e[11]!==r.body||e[12]!==n?(d=n?r.body:i(Qe,{code:r.body}),e[11]=r.body,e[12]=n,e[13]=d):d=e[13];let c;return e[14]!==a||e[15]!==y||e[16]!==d?(c=i("pre",{className:a,"data-testid":y,children:d}),e[14]=a,e[15]=y,e[16]=d,e[17]=c):c=e[17],c},st=({durationMs:t,error:e,failed:r,operation:s,ran:n,response:o,t:l})=>{const a=s.responses.map(d=>({body:et(d),durationMs:null,id:d.status,label:d.status,live:!1,status:d.status}));return n?[{body:tt(e,o,r),durationMs:t,id:ne,label:l("Live"),live:!0,status:r?"error":"200"},...a]:a},nt=()=>{const t=P(19),e=J(),{durationMs:r,error:s,operation:n,response:o,status:l}=se(),a=l==="running",y=l==="error",d=l==="success"||y,c=st({durationMs:r,error:s,failed:y,operation:n,ran:d,response:o,t:e}),u=d?ne:c.find(ot)?.id??c[0]?.id??"",[b,x]=B(null),f=c.find(E=>E.id===(b??u))??c[0];let m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=E=>{const{id:L}=E.currentTarget.dataset;L!==void 0&&x(L)},t[0]=m):m=t[0];const v=m,w=()=>{f!==void 0&&X(f.body)},p=f?.live===!0?f.durationMs:null,h=f?.live===!0&&f.status==="error",g="flex min-h-0 flex-col rounded-xl border border-border bg-card",S="api-response-panel";let O;t[1]!==e?(O=e("Response"),t[1]=e,t[2]=O):O=t[2];let k;t[3]!==O?(k=i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:O}),t[3]=O,t[4]=k):k=t[4];const T=p!==null&&i("span",{className:"font-mono text-[10px] text-muted-foreground",children:e("{ms} ms",{ms:p})}),R=f!==void 0&&f.body!==""&&i(W,{"aria-label":e("Copy"),"data-testid":"api-response-copy",onClick:w,size:"icon-xs",type:"button",variant:"ghost",children:i(F,{icon:ae,strokeWidth:2})});let C;t[5]!==T||t[6]!==R?(C=N("div",{className:"flex items-center gap-2",children:[T,R]}),t[5]=T,t[6]=R,t[7]=C):C=t[7];let $;t[8]!==k||t[9]!==C?($=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[k,C]}),t[8]=k,t[9]=C,t[10]=$):$=t[10];const A=c.length>0&&i("div",{className:"flex gap-1 overflow-x-auto border-b border-border px-2 py-1.5",role:"tablist",children:c.map(E=>{const L=E.id===f?.id;return N("button",{"aria-selected":L,className:Y("inline-flex items-center gap-1.5 rounded px-2 py-0.5 font-mono text-xs transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium",L?ee(E.status):"text-muted-foreground"),"data-id":E.id,"data-testid":E.live?"api-response-tab-live":`api-response-tab-${E.status}`,onClick:v,role:"tab",type:"button",children:[i("span",{className:`size-1.5 rounded-full ${te(E.status)}`}),E.label]},E.id)})});let j;t[11]!==f||t[12]!==a||t[13]!==h?(j=i(rt,{active:f,running:a,showError:h}),t[11]=f,t[12]=a,t[13]=h,t[14]=j):j=t[14];let I;return t[15]!==j||t[16]!==$||t[17]!==A?(I=N("div",{className:g,"data-testid":S,children:[$,A,j]}),t[15]=j,t[16]=$,t[17]=A,t[18]=I):I=t[18],I};function ot(t){return t.status.startsWith("2")}const it=(t,e)=>{const r=e.trim().toLowerCase();return r===""?t:t.map(s=>({...s,operations:s.operations.filter(n=>`${n.summary} ${n.operationId}`.toLowerCase().includes(r))})).filter(s=>s.operations.length>0)},wt=t=>{const e=P(53),{model:r}=t,s=J(),n=r.groups[0]?.operations[0]?.key??"",[o,l]=B(n),[a,y]=B("");let d;e[0]!==n||e[1]!==r.operationByKey||e[2]!==o?(d=r.operationByKey.get(o)??r.operationByKey.get(n),e[0]=n,e[1]=r.operationByKey,e[2]=o,e[3]=d):d=e[3];const c=d;let u,b,x,f,m,v,w,p,h,g;if(e[4]!==a||e[5]!==r.groups||e[6]!==r.server||e[7]!==c?.key||e[8]!==s){u=it(r.groups,a);let C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=M=>{const{key:_}=M.currentTarget.dataset;_!==void 0&&l(_)},e[19]=C):C=e[19];const $=C;let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=M=>{y(M.target.value)},e[20]=A):A=e[20];const j=A;b=r.server??"",h="grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[16rem_minmax(0,1fr)_22rem]",g="api-reference",e[21]!==s?(m=s("API operations"),e[21]=s,e[22]=m):m=e[22],v="flex min-h-0 flex-col overflow-y-auto border-r border-border",w="api-reference-nav";let I;e[23]===Symbol.for("react.memo_cache_sentinel")?(I=i(F,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground",icon:le,strokeWidth:2}),e[23]=I):I=e[23];let E;e[24]!==s?(E=s("Filter operations"),e[24]=s,e[25]=E):E=e[25],e[26]!==a||e[27]!==E?(p=i("div",{className:"sticky top-0 z-10 border-b border-border bg-sidebar p-2",children:N("div",{className:"relative",children:[I,i(ue,{className:"h-7 pl-7","data-testid":"api-filter",onChange:j,placeholder:E,value:a})]})}),e[26]=a,e[27]=E,e[28]=p):p=e[28],x="flex flex-col gap-4 p-2";let L;e[29]!==c?.key||e[30]!==s?(L=M=>N("div",{className:"flex flex-col gap-1",children:[N("div",{className:"flex items-center justify-between px-2",children:[i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M.name||s("(root)")}),i("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:M.operations.length})]}),M.operations.map(_=>{const oe=_.key===c?.key;return N("button",{"aria-current":oe?"page":void 0,className:"flex items-center justify-between gap-2 rounded-md border-l-2 border-transparent px-2 py-1 text-start text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:border-primary aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-key":_.key,"data-testid":`api-nav-${_.operationId}`,onClick:$,type:"button",children:[i("span",{className:"truncate",children:_.summary}),i(q,{kind:_.kind,method:_.method})]},_.key)})]},M.name),e[29]=c?.key,e[30]=s,e[31]=L):L=e[31],f=u.map(L),e[4]=a,e[5]=r.groups,e[6]=r.server,e[7]=c?.key,e[8]=s,e[9]=u,e[10]=b,e[11]=x,e[12]=f,e[13]=m,e[14]=v,e[15]=w,e[16]=p,e[17]=h,e[18]=g}else u=e[9],b=e[10],x=e[11],f=e[12],m=e[13],v=e[14],w=e[15],p=e[16],h=e[17],g=e[18];let S;e[32]!==u.length||e[33]!==s?(S=u.length===0&&i("p",{className:"px-2 py-1 text-xs text-muted-foreground","data-testid":"api-nav-empty",children:s("No operations match your filter.")}),e[32]=u.length,e[33]=s,e[34]=S):S=e[34];let O;e[35]!==S||e[36]!==x||e[37]!==f?(O=N("div",{className:x,children:[f,S]}),e[35]=S,e[36]=x,e[37]=f,e[38]=O):O=e[38];let k;e[39]!==O||e[40]!==m||e[41]!==v||e[42]!==w||e[43]!==p?(k=N("nav",{"aria-label":m,className:v,"data-testid":w,children:[p,O]}),e[39]=O,e[40]=m,e[41]=v,e[42]=w,e[43]=p,e[44]=k):k=e[44];let T;e[45]!==c||e[46]!==b?(T=c===void 0?i("div",{className:"lg:col-span-2"}):N(We,{operation:c,children:[i("div",{className:"min-w-0 overflow-y-auto p-6","data-testid":"api-reference-main",children:i(He,{operation:c})}),N("aside",{className:"flex min-w-0 flex-col gap-4 overflow-y-auto border-border p-4 lg:border-l","data-testid":"api-reference-aside",children:[i(Pe,{operation:c,server:b}),i(nt,{})]})]},c.key),e[45]=c,e[46]=b,e[47]=T):T=e[47];let R;return e[48]!==k||e[49]!==T||e[50]!==h||e[51]!==g?(R=N("div",{className:h,"data-testid":g,children:[k,T]}),e[48]=k,e[49]=T,e[50]=h,e[51]=g,e[52]=R):R=e[52],R};export{wt as R};
13
+ `),t[27]=r,t[28]=T):T=t[28];const R=Math.min(12,Math.max(3,T.length));let C;t[29]!==r||t[30]!==c||t[31]!==b||t[32]!==R?(C=i(ve,{className:"font-mono text-xs","data-testid":"api-try-args",id:"api-try-args",onChange:c,onKeyDown:b,rows:R,spellCheck:!1,value:r}),t[29]=r,t[30]=c,t[31]=b,t[32]=R,t[33]=C):C=t[33];let $;t[34]!==k||t[35]!==C?($=N("div",{className:"flex flex-col gap-1.5",children:[k,C]}),t[34]=k,t[35]=C,t[36]=$):$=t[36];let j;t[37]!==s.functionPath||t[38]!==l||t[39]!==a||t[40]!==e?(j=s.functionPath!==void 0&&N("div",{className:"flex flex-col gap-1.5",children:[i(U,{htmlFor:"shard-input",children:e("Shard key (optional)")}),i(be,{id:"shard-input",onChange:l,testId:"shard-input",value:a})]}),t[37]=s.functionPath,t[38]=l,t[39]=a,t[40]=e,t[41]=j):j=t[41];let A;t[42]!==$||t[43]!==j?(A=N("div",{className:"flex flex-col gap-3 p-3",children:[$,j]}),t[42]=$,t[43]=j,t[44]=A):A=t[44];let I;return t[45]!==A||t[46]!==S?(I=N("div",{className:"overflow-hidden rounded-xl border border-border bg-card","data-testid":"api-try-it",children:[S,A]}),t[45]=A,t[46]=S,t[47]=I):I=t[47],I},He=t=>{const e=P(51),{operation:r}=t,s=J(),n=`api-operation-${r.operationId}`,o=r.key;let l;e[0]!==r.kind||e[1]!==r.method?(l=i(q,{kind:r.kind,method:r.method,testId:"api-operation-method"}),e[0]=r.kind,e[1]=r.method,e[2]=l):l=e[2];const a=r.functionPath??r.httpPath;let y;e[3]!==a?(y=i("code",{className:"truncate font-mono text-xs text-muted-foreground",children:a}),e[3]=a,e[4]=y):y=e[4];let d;e[5]!==l||e[6]!==y?(d=N("div",{className:"flex items-center gap-2",children:[l,y]}),e[5]=l,e[6]=y,e[7]=d):d=e[7];let c;e[8]!==r.title?(c=i("h1",{className:"text-lg font-semibold text-foreground","data-testid":"api-operation-title",children:r.title}),e[8]=r.title,e[9]=c):c=e[9];let u;e[10]!==r.description?(u=r.description!==void 0&&i("p",{className:"text-sm text-muted-foreground",children:r.description}),e[10]=r.description,e[11]=u):u=e[11];let b;e[12]!==d||e[13]!==c||e[14]!==u?(b=N("header",{className:"sticky top-0 z-10 -mx-6 -mt-6 flex flex-col gap-2 border-b border-border bg-background px-6 pt-6 pb-3",children:[d,c,u]}),e[12]=d,e[13]=c,e[14]=u,e[15]=b):b=e[15];let x;e[16]!==s?(x=s("Try it"),e[16]=s,e[17]=x):x=e[17];let f;e[18]!==x?(f=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x}),e[18]=x,e[19]=f):f=e[19];let m;e[20]===Symbol.for("react.memo_cache_sentinel")?(m=i(qe,{}),e[20]=m):m=e[20];let v;e[21]!==f?(v=N("section",{className:"flex flex-col gap-2",children:[f,m]}),e[21]=f,e[22]=v):v=e[22];let w;e[23]!==s?(w=s("Request arguments"),e[23]=s,e[24]=w):w=e[24];let p;e[25]!==w?(p=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:w}),e[25]=w,e[26]=p):p=e[26];let h;e[27]!==r.argsSchema?(h=i(V,{schema:r.argsSchema,testId:"api-operation-args"}),e[27]=r.argsSchema,e[28]=h):h=e[28];let g;e[29]!==p||e[30]!==h?(g=N("section",{className:"flex flex-col gap-2",children:[p,h]}),e[29]=p,e[30]=h,e[31]=g):g=e[31];let S;e[32]!==s?(S=s("Response body"),e[32]=s,e[33]=S):S=e[33];let O;e[34]!==S?(O=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),e[34]=S,e[35]=O):O=e[35];let k;if(e[36]!==r.responses||e[37]!==s){let C;e[39]!==s?(C=$=>N("div",{className:"flex flex-col gap-1.5 rounded-xl border border-border bg-card p-3",children:[N("div",{className:"flex items-center justify-between gap-2",children:[N("span",{className:`inline-flex items-center gap-1.5 font-mono text-xs font-semibold ${ee($.status)}`,children:[i("span",{className:`size-1.5 rounded-full ${te($.status)}`}),$.status]}),$.schema!==void 0&&i("span",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:s("application/json")})]}),$.description!==void 0&&i("p",{className:"text-xs text-muted-foreground",children:$.description}),$.schema!==void 0&&i(V,{schema:$.schema,testId:`api-response-${$.status}`})]},$.status),e[39]=s,e[40]=C):C=e[40],k=r.responses.map(C),e[36]=r.responses,e[37]=s,e[38]=k}else k=e[38];let T;e[41]!==O||e[42]!==k?(T=N("section",{className:"flex flex-col gap-3",children:[O,k]}),e[41]=O,e[42]=k,e[43]=T):T=e[43];let R;return e[44]!==r.key||e[45]!==n||e[46]!==v||e[47]!==g||e[48]!==T||e[49]!==b?(R=N("div",{className:"flex flex-col gap-6 duration-200 animate-in fade-in-0 slide-in-from-bottom-1","data-testid":n,children:[b,v,g,T]},o),e[44]=r.key,e[45]=n,e[46]=v,e[47]=g,e[48]=T,e[49]=b,e[50]=R):R=e[50],R},Ue=/"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?/g,Ve=/^\s*:/,Ge=(t,e,r)=>r.startsWith('"')?Ve.test(t.slice(e))?"key":"string":r==="true"||r==="false"||r==="null"?"boolean":"number",Xe=t=>{const e=[];let r=0;for(const s of t.matchAll(Ue)){const{index:n}=s,o=s[0],l=n+o.length;n>r&&e.push({kind:"plain",start:r,text:t.slice(r,n)}),e.push({kind:Ge(t,l,o),start:n,text:o}),r=l}return r<t.length&&e.push({kind:"plain",start:r,text:t.slice(r)}),e},Ye={boolean:"text-royal-amethyst",key:"text-sky-sapphire",number:"text-warning",plain:"",string:"text-success"},Qe=t=>{const e=P(4),{code:r}=t;let s;e[0]!==r?(s=Xe(r).map(Ze),e[0]=r,e[1]=s):s=e[1];let n;return e[2]!==s?(n=i(xe,{children:s}),e[2]=s,e[3]=n):n=e[3],n};function Ze(t){return i("span",{className:Ye[t.kind],children:t.text},t.start)}const ne="__live__",et=t=>t.schema===void 0?"":JSON.stringify(D(t.schema),void 0,2),tt=(t,e,r)=>r?t??"":e===void 0?"":JSON.stringify(e,ge,2),rt=t=>{const e=P(18),{active:r,running:s,showError:n}=t,o=J();if(s){let u;e[0]!==o?(u=o("Sending…"),e[0]=o,e[1]=u):u=e[1];let b;return e[2]!==u?(b=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-running",children:u}),e[2]=u,e[3]=b):b=e[3],b}if(r===void 0||r.body===""){let u;e[4]!==r?.live||e[5]!==o?(u=r?.live===!0?o("Send a request to see the response."):o("No example for this response."),e[4]=r?.live,e[5]=o,e[6]=u):u=e[6];let b;return e[7]!==u?(b=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-idle",children:u}),e[7]=u,e[8]=b):b=e[8],b}const l=n&&"text-destructive";let a;e[9]!==l?(a=Y("max-h-[28rem] overflow-auto px-3 py-3 font-mono text-xs",l),e[9]=l,e[10]=a):a=e[10];const y=n?"api-response-error":"api-response-body";let d;e[11]!==r.body||e[12]!==n?(d=n?r.body:i(Qe,{code:r.body}),e[11]=r.body,e[12]=n,e[13]=d):d=e[13];let c;return e[14]!==a||e[15]!==y||e[16]!==d?(c=i("pre",{className:a,"data-testid":y,children:d}),e[14]=a,e[15]=y,e[16]=d,e[17]=c):c=e[17],c},st=({durationMs:t,error:e,failed:r,operation:s,ran:n,response:o,t:l})=>{const a=s.responses.map(d=>({body:et(d),durationMs:null,id:d.status,label:d.status,live:!1,status:d.status}));return n?[{body:tt(e,o,r),durationMs:t,id:ne,label:l("Live"),live:!0,status:r?"error":"200"},...a]:a},nt=()=>{const t=P(19),e=J(),{durationMs:r,error:s,operation:n,response:o,status:l}=se(),a=l==="running",y=l==="error",d=l==="success"||y,c=st({durationMs:r,error:s,failed:y,operation:n,ran:d,response:o,t:e}),u=d?ne:c.find(ot)?.id??c[0]?.id??"",[b,x]=B(null),f=c.find(E=>E.id===(b??u))??c[0];let m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=E=>{const{id:L}=E.currentTarget.dataset;L!==void 0&&x(L)},t[0]=m):m=t[0];const v=m,w=()=>{f!==void 0&&X(f.body)},p=f?.live===!0?f.durationMs:null,h=f?.live===!0&&f.status==="error",g="flex min-h-0 flex-col rounded-xl border border-border bg-card",S="api-response-panel";let O;t[1]!==e?(O=e("Response"),t[1]=e,t[2]=O):O=t[2];let k;t[3]!==O?(k=i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:O}),t[3]=O,t[4]=k):k=t[4];const T=p!==null&&i("span",{className:"font-mono text-[10px] text-muted-foreground",children:e("{ms} ms",{ms:p})}),R=f!==void 0&&f.body!==""&&i(W,{"aria-label":e("Copy"),"data-testid":"api-response-copy",onClick:w,size:"icon-xs",type:"button",variant:"ghost",children:i(F,{icon:ae,strokeWidth:2})});let C;t[5]!==T||t[6]!==R?(C=N("div",{className:"flex items-center gap-2",children:[T,R]}),t[5]=T,t[6]=R,t[7]=C):C=t[7];let $;t[8]!==k||t[9]!==C?($=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[k,C]}),t[8]=k,t[9]=C,t[10]=$):$=t[10];const j=c.length>0&&i("div",{className:"flex gap-1 overflow-x-auto border-b border-border px-2 py-1.5",role:"tablist",children:c.map(E=>{const L=E.id===f?.id;return N("button",{"aria-selected":L,className:Y("inline-flex items-center gap-1.5 rounded px-2 py-0.5 font-mono text-xs transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium",L?ee(E.status):"text-muted-foreground"),"data-id":E.id,"data-testid":E.live?"api-response-tab-live":`api-response-tab-${E.status}`,onClick:v,role:"tab",type:"button",children:[i("span",{className:`size-1.5 rounded-full ${te(E.status)}`}),E.label]},E.id)})});let A;t[11]!==f||t[12]!==a||t[13]!==h?(A=i(rt,{active:f,running:a,showError:h}),t[11]=f,t[12]=a,t[13]=h,t[14]=A):A=t[14];let I;return t[15]!==A||t[16]!==$||t[17]!==j?(I=N("div",{className:g,"data-testid":S,children:[$,j,A]}),t[15]=A,t[16]=$,t[17]=j,t[18]=I):I=t[18],I};function ot(t){return t.status.startsWith("2")}const it=(t,e)=>{const r=e.trim().toLowerCase();return r===""?t:t.map(s=>({...s,operations:s.operations.filter(n=>`${n.summary} ${n.operationId}`.toLowerCase().includes(r))})).filter(s=>s.operations.length>0)},wt=t=>{const e=P(53),{model:r}=t,s=J(),n=r.groups[0]?.operations[0]?.key??"",[o,l]=B(n),[a,y]=B("");let d;e[0]!==n||e[1]!==r.operationByKey||e[2]!==o?(d=r.operationByKey.get(o)??r.operationByKey.get(n),e[0]=n,e[1]=r.operationByKey,e[2]=o,e[3]=d):d=e[3];const c=d;let u,b,x,f,m,v,w,p,h,g;if(e[4]!==a||e[5]!==r.groups||e[6]!==r.server||e[7]!==c?.key||e[8]!==s){u=it(r.groups,a);let C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=M=>{const{key:_}=M.currentTarget.dataset;_!==void 0&&l(_)},e[19]=C):C=e[19];const $=C;let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=M=>{y(M.target.value)},e[20]=j):j=e[20];const A=j;b=r.server??"",h="grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[16rem_minmax(0,1fr)_22rem]",g="api-reference",e[21]!==s?(m=s("API operations"),e[21]=s,e[22]=m):m=e[22],v="flex min-h-0 flex-col overflow-y-auto border-r border-border",w="api-reference-nav";let I;e[23]===Symbol.for("react.memo_cache_sentinel")?(I=i(F,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground",icon:le,strokeWidth:2}),e[23]=I):I=e[23];let E;e[24]!==s?(E=s("Filter operations"),e[24]=s,e[25]=E):E=e[25],e[26]!==a||e[27]!==E?(p=i("div",{className:"sticky top-0 z-10 border-b border-border bg-sidebar p-2",children:N("div",{className:"relative",children:[I,i(ue,{className:"h-7 pl-7","data-testid":"api-filter",onChange:A,placeholder:E,value:a})]})}),e[26]=a,e[27]=E,e[28]=p):p=e[28],x="flex flex-col gap-4 p-2";let L;e[29]!==c?.key||e[30]!==s?(L=M=>N("div",{className:"flex flex-col gap-1",children:[N("div",{className:"flex items-center justify-between px-2",children:[i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M.name||s("(root)")}),i("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:M.operations.length})]}),M.operations.map(_=>{const oe=_.key===c?.key;return N("button",{"aria-current":oe?"page":void 0,className:"flex items-center justify-between gap-2 rounded-md border-l-2 border-transparent px-2 py-1 text-start text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:border-primary aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-key":_.key,"data-testid":`api-nav-${_.operationId}`,onClick:$,type:"button",children:[i("span",{className:"truncate",children:_.summary}),i(q,{kind:_.kind,method:_.method})]},_.key)})]},M.name),e[29]=c?.key,e[30]=s,e[31]=L):L=e[31],f=u.map(L),e[4]=a,e[5]=r.groups,e[6]=r.server,e[7]=c?.key,e[8]=s,e[9]=u,e[10]=b,e[11]=x,e[12]=f,e[13]=m,e[14]=v,e[15]=w,e[16]=p,e[17]=h,e[18]=g}else u=e[9],b=e[10],x=e[11],f=e[12],m=e[13],v=e[14],w=e[15],p=e[16],h=e[17],g=e[18];let S;e[32]!==u.length||e[33]!==s?(S=u.length===0&&i("p",{className:"px-2 py-1 text-xs text-muted-foreground","data-testid":"api-nav-empty",children:s("No operations match your filter.")}),e[32]=u.length,e[33]=s,e[34]=S):S=e[34];let O;e[35]!==S||e[36]!==x||e[37]!==f?(O=N("div",{className:x,children:[f,S]}),e[35]=S,e[36]=x,e[37]=f,e[38]=O):O=e[38];let k;e[39]!==O||e[40]!==m||e[41]!==v||e[42]!==w||e[43]!==p?(k=N("nav",{"aria-label":m,className:v,"data-testid":w,children:[p,O]}),e[39]=O,e[40]=m,e[41]=v,e[42]=w,e[43]=p,e[44]=k):k=e[44];let T;e[45]!==c||e[46]!==b?(T=c===void 0?i("div",{className:"lg:col-span-2"}):N(We,{operation:c,children:[i("div",{className:"min-w-0 overflow-y-auto p-6","data-testid":"api-reference-main",children:i(He,{operation:c})}),N("aside",{className:"flex min-w-0 flex-col gap-4 overflow-y-auto border-border p-4 lg:border-l","data-testid":"api-reference-aside",children:[i(Pe,{operation:c,server:b}),i(nt,{})]})]},c.key),e[45]=c,e[46]=b,e[47]=T):T=e[47];let R;return e[48]!==k||e[49]!==T||e[50]!==h||e[51]!==g?(R=N("div",{className:h,"data-testid":g,children:[k,T]}),e[48]=k,e[49]=T,e[50]=h,e[51]=g,e[52]=R):R=e[52],R};export{wt as R};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{c as y}from"react/compiler-runtime";import{Handle as L,Position as R,useNodesState as q,useEdgesState as Q,ReactFlow as Z,Background as J,Panel as k,Controls as X,MiniMap as ee,useNodesInitialized as te,useReactFlow as se}from"@xyflow/react";import{useState as D,useMemo as _,useRef as oe,useEffect as w}from"react";import{D as ae}from"./diagram-export-panel-Vdt-DZnO.mjs";import{S as ne,T as x}from"./storage-tier-C2mKwYRj.mjs";import{B as E}from"./badge-r_5B4LHP.mjs";import{B as A}from"./button-q0UYSmrn.mjs";import{I as re}from"./input-CXhxesPC.mjs";import{useT as M}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{f as le}from"./internal-hIuTpSbx.mjs";import{c as N}from"./utils-bhneXptQ.mjs";import{jsx as c,jsxs as h}from"react/jsx-runtime";function ie(s){const e=y(10);let t,n,o;e[0]!==s?({className:t,selected:o,...n}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=o):(t=e[1],n=e[2],o=e[3]);const r=o===!0?"":void 0;let a;e[4]!==t?(a=N("rounded-md border border-border bg-card text-card-foreground shadow-sm transition-colors","data-[selected]:border-ring data-[selected]:ring-[3px] data-[selected]:ring-ring/30",t),e[4]=t,e[5]=a):a=e[5];let l;return e[6]!==n||e[7]!==r||e[8]!==a?(l=c("div",{"data-slot":"base-node","data-selected":r,className:a,...n}),e[6]=n,e[7]=r,e[8]=a,e[9]=l):l=e[9],l}function ce(s){const e=y(8);let t,n;e[0]!==s?({className:t,...n}=s,e[0]=s,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let o;e[3]!==t?(o=N("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=o):o=e[4];let r;return e[5]!==n||e[6]!==o?(r=c("div",{"data-slot":"base-node-header",className:o,...n}),e[5]=n,e[6]=o,e[7]=r):r=e[7],r}function de(s){const e=y(8);let t,n;e[0]!==s?({className:t,...n}=s,e[0]=s,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let o;e[3]!==t?(o=N("flex flex-col",t),e[3]=t,e[4]=o):o=e[4];let r;return e[5]!==n||e[6]!==o?(r=c("div",{"data-slot":"base-node-content",className:o,...n}),e[5]=n,e[6]=o,e[7]=r):r=e[7],r}const me=3,fe=(s,e,t)=>{const n=e?s:s.slice(0,me),o=n.map(a=>JSON.stringify(a)).join(" | "),r=s.length-n.length;return r>0?`${o} ${t("+{count} more",{count:r})}`:o},H=(s,e,t)=>{const n=s.enumValues??[],o=n.length===0?s.type:fe(n,e,t),r=s.ref===void 0?o:`${o} → ${s.ref}`;return s.optional===!0?`${r}?`:r},ue=s=>{const e=y(23),{data:t,selected:n}=s,o=M();let r;e[0]!==t.label||e[1]!==t.loadError||e[2]!==o?(r=t.loadError===!0?c("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:o("Columns unavailable")}):c("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"—"}),e[0]=t.label,e[1]=t.loadError,e[2]=o,e[3]=r):r=e[3];const a=r,l=`sd-node-${t.label}`;let d;e[4]!==t.label?(d=c("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=d):d=e[5];let m;e[6]!==t.tier?(m=c("span",{className:"ms-auto",children:c(ne,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let i;e[8]!==d||e[9]!==m?(i=h(ce,{children:[d,m]}),e[8]=d,e[9]=m,e[10]=i):i=e[10];let f;e[11]!==t.columns||e[12]!==t.label||e[13]!==a||e[14]!==o?(f=t.columns.length===0?a:t.columns.map(p=>h("div",{className:N("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",p.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${p.name}`,children:[c(L,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:p.name,isConnectable:!1,position:R.Left,type:"target"}),c("span",{className:"truncate font-mono",title:p.name,children:p.name}),p.pk===!0&&c(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),p.ref!==void 0&&c(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),c("span",{className:"ms-auto truncate text-muted-foreground",title:H(p,!0,o),children:H(p,!1,o)}),c(L,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:p.name,isConnectable:!1,position:R.Right,type:"source"})]},p.name)),e[11]=t.columns,e[12]=t.label,e[13]=a,e[14]=o,e[15]=f):f=e[15];let u;e[16]!==f?(u=c(de,{children:f}),e[16]=f,e[17]=u):u=e[17];let b;return e[18]!==n||e[19]!==l||e[20]!==i||e[21]!==u?(b=h(ie,{className:"w-64 overflow-hidden","data-testid":l,selected:n,children:[i,u]}),e[18]=n,e[19]=l,e[20]=i,e[21]=u,e[22]=b):b=e[22],b},F=256,z=112,O=36,v=24,pe=480,he=1.4,ge=s=>{const e=Math.max(1,Math.round(Math.sqrt(he*s/(F+z))));return Math.max(pe,s/e)},be=38,xe=28,B=s=>be+Math.max(1,s)*xe,Ne=(s,e)=>{const t=new Map;for(const a of s)t.set(a,[]);for(const a of e)a.to!==a.from&&t.has(a.from)&&t.has(a.to)&&t.get(a.from)?.push(a.to);const n=new Map,o=new Set,r=a=>{const l=n.get(a);if(l!==void 0)return l;if(o.has(a))return 0;o.add(a);let d=0;for(const m of t.get(a)??[])d=Math.max(d,r(m)+1);return o.delete(a),n.set(a,d),d};for(const a of s)r(a);return n},ye=(s,e,t)=>{const n=Ne(s,e),o=new Map;for(const m of s){const i=n.get(m)??0,f=o.get(i);f===void 0?o.set(i,[m]):f.push(m)}const r=s.reduce((m,i)=>m+B(t.get(i)??0)+O,0),a=ge(r),l=[];let d=0;for(const m of[...o.keys()].toSorted((i,f)=>i-f)){let i=0,f=v;for(const u of o.get(m)??[]){const b=B(t.get(u)??0);f>v&&f+b>a&&(i+=1,f=v),l.push({name:u,x:v+(d+i)*(F+z),y:f}),f+=b+O}d+=i+1}return l},ve={databaseSchema:ue},G={backgroundColor:x.shard.color},I={backgroundColor:x.global.color},Ee={global:!0,shard:!0},Se={},_e=s=>{const e=s.find(t=>t.pk===!0)?.name;return e!==void 0?e:s.some(t=>t.name==="_id")?"_id":s.some(t=>t.name==="id")?"id":s[0]?.name??"_id"},K=s=>s.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),we=(s,e,t)=>{const n=s.map(l=>l.name),o=new Map(s.map(l=>[l.name,l.columns.length])),r=ye(n,K(s),o),a=new Map(s.map(l=>[l.name,l]));return r.flatMap(({name:l,x:d,y:m})=>{const i=a.get(l);return i===void 0?[]:[{className:t[l],data:{columns:i.columns,label:l,loadError:e,tier:i.tier},id:l,position:{x:d,y:m},type:"databaseSchema"}]})},Me=s=>{const e=new Map(s.map(t=>[t.name,t.columns]));return K(s).flatMap(t=>{const n=e.get(t.to)??[],o=e.get(t.from)??[],r=_e(n);return!n.some(a=>a.name===r)||!o.some(a=>a.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:r,target:t.from,targetHandle:t.column}]})},Ce=()=>{const s=y(15),e=M();let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=h("span",{className:"flex items-center gap-1",children:[c("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:G}),x.shard.label]}),s[0]=t):t=s[0];let n;s[1]===Symbol.for("react.memo_cache_sentinel")?(n=h("span",{className:"flex items-center gap-1",children:[c("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:I}),x.global.label]}),s[1]=n):n=s[1];let o;s[2]===Symbol.for("react.memo_cache_sentinel")?(o=c(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),s[2]=o):o=s[2];let r;s[3]!==e?(r=e("Primary key"),s[3]=e,s[4]=r):r=s[4];let a;s[5]!==r?(a=h("span",{className:"flex items-center gap-1",children:[o,r]}),s[5]=r,s[6]=a):a=s[6];let l;s[7]===Symbol.for("react.memo_cache_sentinel")?(l=c(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),s[7]=l):l=s[7];let d;s[8]!==e?(d=e("Foreign key"),s[8]=e,s[9]=d):d=s[9];let m;s[10]!==d?(m=h("span",{className:"flex items-center gap-1",children:[l,d]}),s[10]=d,s[11]=m):m=s[11];let i;return s[12]!==a||s[13]!==m?(i=h("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-xl border border-border bg-card/95 px-2.5 py-1.5 text-[11px] text-muted-foreground shadow-xs",children:[t,n,a,m]}),s[12]=a,s[13]=m,s[14]=i):i=s[14],i},$e=12,Te=s=>{const e=y(9),{containerRef:t,seedKey:n}=s,o=te(),{fitView:r}=se();let a;e[0]!==t||e[1]!==r||e[2]!==o?(a=()=>{if(!o)return;const d=()=>{le(r({duration:0,maxZoom:1.6,padding:.14}))};d();const m=t.current;if(m===null)return;const i=new ResizeObserver(()=>{d()});return i.observe(m),()=>{i.disconnect()}},e[0]=t,e[1]=r,e[2]=o,e[3]=a):a=e[3];let l;return e[4]!==t||e[5]!==r||e[6]!==o||e[7]!==n?(l=[t,r,o,n],e[4]=t,e[5]=r,e[6]=o,e[7]=n,e[8]=l):l=e[8],w(a,l),null},Ke=({columnsError:s,fill:e=!1,nodeClasses:t,tables:n,testIdPrefix:o})=>{const r=M(),[a,l]=D(Ee),[d,m]=D(""),i=_(()=>{const g=d.trim().toLowerCase();return n.filter(T=>a[T.tier]&&T.name.toLowerCase().includes(g))},[n,a,d]),f=_(()=>we(i,s??!1,t??Se),[i,s,t]),u=_(()=>Me(i),[i]),b=i.map(g=>g.name).join(","),[p,C,P]=q(f),[U,$,j]=Q(u),S=oe(null);w(()=>{C(f)},[f,C]),w(()=>{$(u)},[u,$]);const V=g=>{m(g.target.value)},W=()=>{l(g=>({...g,shard:!g.shard}))},Y=()=>{l(g=>({...g,global:!g.global}))};return n.length===0?c("section",{className:"flex flex-col gap-2","data-testid":`${o}-section`,children:c("p",{className:"text-sm text-muted-foreground","data-testid":`${o}-empty`,children:r("No tables to graph.")})}):c("section",{className:N("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${o}-section`,children:c("div",{className:N("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${o}-canvas`,ref:S,children:h(Z,{edges:U,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:p,nodesConnectable:!1,nodeTypes:ve,onEdgesChange:j,onNodesChange:P,children:[c(J,{}),c(k,{position:"top-left",children:h("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[c(re,{"aria-label":r("Find table…"),className:"h-7 w-44 text-xs","data-testid":`${o}-find`,onChange:V,placeholder:r("Find table…"),value:d}),h("div",{"aria-label":r("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[h(A,{"aria-pressed":a.shard,className:"gap-1.5","data-testid":`${o}-tier-shard`,onClick:W,size:"xs",type:"button",variant:a.shard?"default":"outline",children:[c("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:G}),x.shard.label]}),h(A,{"aria-pressed":a.global,className:"gap-1.5","data-testid":`${o}-tier-global`,onClick:Y,size:"xs",type:"button",variant:a.global?"default":"outline",children:[c("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:I}),x.global.label]})]})]})}),c(k,{position:"bottom-center",children:c(Ce,{})}),c(X,{showInteractive:!1}),i.length>$e&&c(ee,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),c(ae,{containerRef:S,filenameBase:`${o}-schema-diagram`,testIdPrefix:o}),c(Te,{containerRef:S,seedKey:b})]})})})};export{Ke as S};
2
+ import{c as y}from"react/compiler-runtime";import{Handle as L,Position as R,useNodesState as q,useEdgesState as Q,ReactFlow as Z,Background as J,Panel as k,Controls as X,MiniMap as ee,useNodesInitialized as te,useReactFlow as se}from"@xyflow/react";import{useState as D,useMemo as _,useRef as oe,useEffect as w}from"react";import{D as ae}from"./diagram-export-panel-miFPsocM.mjs";import{S as ne,T as x}from"./storage-tier-C2mKwYRj.mjs";import{B as E}from"./badge-r_5B4LHP.mjs";import{B as A}from"./button-q0UYSmrn.mjs";import{I as re}from"./input-CXhxesPC.mjs";import{useT as M}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{f as le}from"./internal-BT5tH08j.mjs";import{c as N}from"./utils-bhneXptQ.mjs";import{jsx as c,jsxs as h}from"react/jsx-runtime";function ie(s){const e=y(10);let t,n,o;e[0]!==s?({className:t,selected:o,...n}=s,e[0]=s,e[1]=t,e[2]=n,e[3]=o):(t=e[1],n=e[2],o=e[3]);const r=o===!0?"":void 0;let a;e[4]!==t?(a=N("rounded-md border border-border bg-card text-card-foreground shadow-sm transition-colors","data-[selected]:border-ring data-[selected]:ring-[3px] data-[selected]:ring-ring/30",t),e[4]=t,e[5]=a):a=e[5];let l;return e[6]!==n||e[7]!==r||e[8]!==a?(l=c("div",{"data-slot":"base-node","data-selected":r,className:a,...n}),e[6]=n,e[7]=r,e[8]=a,e[9]=l):l=e[9],l}function ce(s){const e=y(8);let t,n;e[0]!==s?({className:t,...n}=s,e[0]=s,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let o;e[3]!==t?(o=N("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=o):o=e[4];let r;return e[5]!==n||e[6]!==o?(r=c("div",{"data-slot":"base-node-header",className:o,...n}),e[5]=n,e[6]=o,e[7]=r):r=e[7],r}function de(s){const e=y(8);let t,n;e[0]!==s?({className:t,...n}=s,e[0]=s,e[1]=t,e[2]=n):(t=e[1],n=e[2]);let o;e[3]!==t?(o=N("flex flex-col",t),e[3]=t,e[4]=o):o=e[4];let r;return e[5]!==n||e[6]!==o?(r=c("div",{"data-slot":"base-node-content",className:o,...n}),e[5]=n,e[6]=o,e[7]=r):r=e[7],r}const me=3,fe=(s,e,t)=>{const n=e?s:s.slice(0,me),o=n.map(a=>JSON.stringify(a)).join(" | "),r=s.length-n.length;return r>0?`${o} ${t("+{count} more",{count:r})}`:o},H=(s,e,t)=>{const n=s.enumValues??[],o=n.length===0?s.type:fe(n,e,t),r=s.ref===void 0?o:`${o} → ${s.ref}`;return s.optional===!0?`${r}?`:r},ue=s=>{const e=y(23),{data:t,selected:n}=s,o=M();let r;e[0]!==t.label||e[1]!==t.loadError||e[2]!==o?(r=t.loadError===!0?c("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:o("Columns unavailable")}):c("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"—"}),e[0]=t.label,e[1]=t.loadError,e[2]=o,e[3]=r):r=e[3];const a=r,l=`sd-node-${t.label}`;let d;e[4]!==t.label?(d=c("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=d):d=e[5];let m;e[6]!==t.tier?(m=c("span",{className:"ms-auto",children:c(ne,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let i;e[8]!==d||e[9]!==m?(i=h(ce,{children:[d,m]}),e[8]=d,e[9]=m,e[10]=i):i=e[10];let f;e[11]!==t.columns||e[12]!==t.label||e[13]!==a||e[14]!==o?(f=t.columns.length===0?a:t.columns.map(p=>h("div",{className:N("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",p.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${p.name}`,children:[c(L,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:p.name,isConnectable:!1,position:R.Left,type:"target"}),c("span",{className:"truncate font-mono",title:p.name,children:p.name}),p.pk===!0&&c(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),p.ref!==void 0&&c(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),c("span",{className:"ms-auto truncate text-muted-foreground",title:H(p,!0,o),children:H(p,!1,o)}),c(L,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:p.name,isConnectable:!1,position:R.Right,type:"source"})]},p.name)),e[11]=t.columns,e[12]=t.label,e[13]=a,e[14]=o,e[15]=f):f=e[15];let u;e[16]!==f?(u=c(de,{children:f}),e[16]=f,e[17]=u):u=e[17];let b;return e[18]!==n||e[19]!==l||e[20]!==i||e[21]!==u?(b=h(ie,{className:"w-64 overflow-hidden","data-testid":l,selected:n,children:[i,u]}),e[18]=n,e[19]=l,e[20]=i,e[21]=u,e[22]=b):b=e[22],b},F=256,z=112,O=36,v=24,pe=480,he=1.4,ge=s=>{const e=Math.max(1,Math.round(Math.sqrt(he*s/(F+z))));return Math.max(pe,s/e)},be=38,xe=28,B=s=>be+Math.max(1,s)*xe,Ne=(s,e)=>{const t=new Map;for(const a of s)t.set(a,[]);for(const a of e)a.to!==a.from&&t.has(a.from)&&t.has(a.to)&&t.get(a.from)?.push(a.to);const n=new Map,o=new Set,r=a=>{const l=n.get(a);if(l!==void 0)return l;if(o.has(a))return 0;o.add(a);let d=0;for(const m of t.get(a)??[])d=Math.max(d,r(m)+1);return o.delete(a),n.set(a,d),d};for(const a of s)r(a);return n},ye=(s,e,t)=>{const n=Ne(s,e),o=new Map;for(const m of s){const i=n.get(m)??0,f=o.get(i);f===void 0?o.set(i,[m]):f.push(m)}const r=s.reduce((m,i)=>m+B(t.get(i)??0)+O,0),a=ge(r),l=[];let d=0;for(const m of[...o.keys()].toSorted((i,f)=>i-f)){let i=0,f=v;for(const u of o.get(m)??[]){const b=B(t.get(u)??0);f>v&&f+b>a&&(i+=1,f=v),l.push({name:u,x:v+(d+i)*(F+z),y:f}),f+=b+O}d+=i+1}return l},ve={databaseSchema:ue},G={backgroundColor:x.shard.color},I={backgroundColor:x.global.color},Ee={global:!0,shard:!0},Se={},_e=s=>{const e=s.find(t=>t.pk===!0)?.name;return e!==void 0?e:s.some(t=>t.name==="_id")?"_id":s.some(t=>t.name==="id")?"id":s[0]?.name??"_id"},K=s=>s.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),we=(s,e,t)=>{const n=s.map(l=>l.name),o=new Map(s.map(l=>[l.name,l.columns.length])),r=ye(n,K(s),o),a=new Map(s.map(l=>[l.name,l]));return r.flatMap(({name:l,x:d,y:m})=>{const i=a.get(l);return i===void 0?[]:[{className:t[l],data:{columns:i.columns,label:l,loadError:e,tier:i.tier},id:l,position:{x:d,y:m},type:"databaseSchema"}]})},Me=s=>{const e=new Map(s.map(t=>[t.name,t.columns]));return K(s).flatMap(t=>{const n=e.get(t.to)??[],o=e.get(t.from)??[],r=_e(n);return!n.some(a=>a.name===r)||!o.some(a=>a.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:r,target:t.from,targetHandle:t.column}]})},Ce=()=>{const s=y(15),e=M();let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=h("span",{className:"flex items-center gap-1",children:[c("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:G}),x.shard.label]}),s[0]=t):t=s[0];let n;s[1]===Symbol.for("react.memo_cache_sentinel")?(n=h("span",{className:"flex items-center gap-1",children:[c("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:I}),x.global.label]}),s[1]=n):n=s[1];let o;s[2]===Symbol.for("react.memo_cache_sentinel")?(o=c(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),s[2]=o):o=s[2];let r;s[3]!==e?(r=e("Primary key"),s[3]=e,s[4]=r):r=s[4];let a;s[5]!==r?(a=h("span",{className:"flex items-center gap-1",children:[o,r]}),s[5]=r,s[6]=a):a=s[6];let l;s[7]===Symbol.for("react.memo_cache_sentinel")?(l=c(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),s[7]=l):l=s[7];let d;s[8]!==e?(d=e("Foreign key"),s[8]=e,s[9]=d):d=s[9];let m;s[10]!==d?(m=h("span",{className:"flex items-center gap-1",children:[l,d]}),s[10]=d,s[11]=m):m=s[11];let i;return s[12]!==a||s[13]!==m?(i=h("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-xl border border-border bg-card/95 px-2.5 py-1.5 text-[11px] text-muted-foreground shadow-xs",children:[t,n,a,m]}),s[12]=a,s[13]=m,s[14]=i):i=s[14],i},$e=12,Te=s=>{const e=y(9),{containerRef:t,seedKey:n}=s,o=te(),{fitView:r}=se();let a;e[0]!==t||e[1]!==r||e[2]!==o?(a=()=>{if(!o)return;const d=()=>{le(r({duration:0,maxZoom:1.6,padding:.14}))};d();const m=t.current;if(m===null)return;const i=new ResizeObserver(()=>{d()});return i.observe(m),()=>{i.disconnect()}},e[0]=t,e[1]=r,e[2]=o,e[3]=a):a=e[3];let l;return e[4]!==t||e[5]!==r||e[6]!==o||e[7]!==n?(l=[t,r,o,n],e[4]=t,e[5]=r,e[6]=o,e[7]=n,e[8]=l):l=e[8],w(a,l),null},Ke=({columnsError:s,fill:e=!1,nodeClasses:t,tables:n,testIdPrefix:o})=>{const r=M(),[a,l]=D(Ee),[d,m]=D(""),i=_(()=>{const g=d.trim().toLowerCase();return n.filter(T=>a[T.tier]&&T.name.toLowerCase().includes(g))},[n,a,d]),f=_(()=>we(i,s??!1,t??Se),[i,s,t]),u=_(()=>Me(i),[i]),b=i.map(g=>g.name).join(","),[p,C,P]=q(f),[U,$,j]=Q(u),S=oe(null);w(()=>{C(f)},[f,C]),w(()=>{$(u)},[u,$]);const V=g=>{m(g.target.value)},W=()=>{l(g=>({...g,shard:!g.shard}))},Y=()=>{l(g=>({...g,global:!g.global}))};return n.length===0?c("section",{className:"flex flex-col gap-2","data-testid":`${o}-section`,children:c("p",{className:"text-sm text-muted-foreground","data-testid":`${o}-empty`,children:r("No tables to graph.")})}):c("section",{className:N("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${o}-section`,children:c("div",{className:N("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${o}-canvas`,ref:S,children:h(Z,{edges:U,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:p,nodesConnectable:!1,nodeTypes:ve,onEdgesChange:j,onNodesChange:P,children:[c(J,{}),c(k,{position:"top-left",children:h("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[c(re,{"aria-label":r("Find table…"),className:"h-7 w-44 text-xs","data-testid":`${o}-find`,onChange:V,placeholder:r("Find table…"),value:d}),h("div",{"aria-label":r("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[h(A,{"aria-pressed":a.shard,className:"gap-1.5","data-testid":`${o}-tier-shard`,onClick:W,size:"xs",type:"button",variant:a.shard?"default":"outline",children:[c("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:G}),x.shard.label]}),h(A,{"aria-pressed":a.global,className:"gap-1.5","data-testid":`${o}-tier-global`,onClick:Y,size:"xs",type:"button",variant:a.global?"default":"outline",children:[c("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:I}),x.global.label]})]})]})}),c(k,{position:"bottom-center",children:c(Ce,{})}),c(X,{showInteractive:!1}),i.length>$e&&c(ee,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),c(ae,{containerRef:S,filenameBase:`${o}-schema-diagram`,testIdPrefix:o}),c(Te,{containerRef:S,seedKey:b})]})})})};export{Ke as S};
@@ -1 +1 @@
1
- import{c as k}from"react/compiler-runtime";import{AreaChart as R,CartesianGrid as g,XAxis as N,Area as B,LineChart as X,Line as $}from"recharts";import{useT as S}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{l as E}from"./internal-hIuTpSbx.mjs";import{E as H,X as _,B as j,T as G,C as O,a as A,b as K}from"./bar-chart-BCsEIQoQ.mjs";import{jsx as l,jsxs as T}from"react/jsx-runtime";import{c as V,a as z,b as L,e as F,d as I,T as M}from"./table-D0SBiDu-.mjs";import{C as U}from"./data-grid-B5m1OosL.mjs";const W=50,q={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},D=o=>{const e=o.columns.find(n=>o.rows.length>0&&o.rows.every(a=>typeof a[n]=="number"))??null;return{label:o.columns.find(n=>n!==e)??null,value:e}},J=o=>{const e=k(3),{data:t,kind:n}=o;let a;return e[0]!==t||e[1]!==n?(a=l(O,{className:"h-full w-full",config:q,children:n==="area"?T(R,{data:t,children:[l(g,{vertical:!1}),l(N,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(K,{})}),l(B,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):T(X,{data:t,children:[l(g,{vertical:!1}),l(N,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(K,{})}),l($,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),e[0]=t,e[1]=n,e[2]=a):a=e[2],a},oe=o=>{const e=k(21),{axes:t,kind:n,result:a}=o,u=S();let r;e[0]!==a?(r=D(a),e[0]=a,e[1]=r):r=e[1];const d=r;let m;e[2]!==a.columns?(m=new Set(a.columns),e[2]=a.columns,e[3]=m):m=e[3];const s=m,i=t!==void 0&&s.has(t.x)?t.x:d.label;let h;e[4]!==t?.y||e[5]!==s?(h=t?.y.find(c=>s.has(c)),e[4]=t?.y,e[5]=s,e[6]=h):h=e[6];const b=h,C=b??d.value;let w;e[7]!==i||e[8]!==a.rows||e[9]!==C?(w=C===null?[]:a.rows.slice(0,W).map((c,v)=>({label:i===null?`#${(v+1).toString()}`:E(c[i]),value:Number(c[C])||0})),e[7]=i,e[8]=a.rows,e[9]=C,e[10]=w):w=e[10];const x=w;if(C===null){let c;e[11]!==u?(c=u("No numeric column to chart."),e[11]=u,e[12]=c):c=e[12];let v;return e[13]!==c?(v=l("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:c}),e[13]=c,e[14]=v):v=e[14],v}const f=n??(t!==void 0&&b!==void 0?t.kind:"bar");let p;e[15]!==x||e[16]!==f?(p=f==="bar"?T(H,{className:"h-full w-full",config:q,data:x,children:[l(_,{dataKey:"label"}),l(j,{dataKey:"value"}),l(G,{})]}):l(J,{data:x,kind:f}),e[15]=x,e[16]=f,e[17]=p):p=e[17];let y;return e[18]!==f||e[19]!==p?(y=l("div",{className:"h-80 w-full p-3","data-chart-kind":f,"data-testid":"sql-chart",children:p}),e[18]=f,e[19]=p,e[20]=y):y=e[20],y},ne=o=>{const e=k(19),{result:t}=o,n=S();if(t.columns.length===0){let s;e[0]!==t.rowCount||e[1]!==n?(s=n("{count} rows",{count:t.rowCount}),e[0]=t.rowCount,e[1]=n,e[2]=s):s=e[2];let i;return e[3]!==s?(i=l("p",{className:"p-4 text-sm text-muted-foreground",children:s}),e[3]=s,e[4]=i):i=e[4],i}let a;e[5]!==t.columns?(a=t.columns.map(P),e[5]=t.columns,e[6]=a):a=e[6];let u;e[7]!==a?(u=l(z,{className:"sticky top-0 z-10 bg-muted",children:l(L,{children:a})}),e[7]=a,e[8]=u):u=e[8];let r;if(e[9]!==t.columns||e[10]!==t.rows){let s;e[12]!==t.columns?(s=(i,h)=>l(L,{"data-testid":"sql-row",children:t.columns.map(b=>l(F,{className:"max-w-md truncate font-mono text-xs",children:l(U,{value:i[b]})},b))},h),e[12]=t.columns,e[13]=s):s=e[13],r=t.rows.map(s),e[9]=t.columns,e[10]=t.rows,e[11]=r}else r=e[11];let d;e[14]!==r?(d=l(I,{children:r}),e[14]=r,e[15]=d):d=e[15];let m;return e[16]!==u||e[17]!==d?(m=T(M,{"data-testid":"sql-rows",children:[u,d]}),e[16]=u,e[17]=d,e[18]=m):m=e[18],m};function P(o){return l(V,{children:o},o)}export{oe as S,ne as a};
1
+ import{c as T}from"react/compiler-runtime";import{AreaChart as R,CartesianGrid as g,XAxis as N,Area as B,LineChart as X,Line as $}from"recharts";import{useT as S}from"./DEFAULT_LOCALE-BQ3jRT74.mjs";import{k as E}from"./internal-BT5tH08j.mjs";import{E as H,X as _,B as j,T as G,C as O,a as A,b as K}from"./bar-chart-BCsEIQoQ.mjs";import{jsx as l,jsxs as k}from"react/jsx-runtime";import{c as V,a as z,b as L,e as F,d as I,T as M}from"./table-D0SBiDu-.mjs";import{C as U}from"./data-grid-GQLHcpMI.mjs";const W=50,q={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},D=o=>{const e=o.columns.find(n=>o.rows.length>0&&o.rows.every(a=>typeof a[n]=="number"))??null;return{label:o.columns.find(n=>n!==e)??null,value:e}},J=o=>{const e=T(3),{data:t,kind:n}=o;let a;return e[0]!==t||e[1]!==n?(a=l(O,{className:"h-full w-full",config:q,children:n==="area"?k(R,{data:t,children:[l(g,{vertical:!1}),l(N,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(K,{})}),l(B,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):k(X,{data:t,children:[l(g,{vertical:!1}),l(N,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(K,{})}),l($,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),e[0]=t,e[1]=n,e[2]=a):a=e[2],a},oe=o=>{const e=T(21),{axes:t,kind:n,result:a}=o,u=S();let r;e[0]!==a?(r=D(a),e[0]=a,e[1]=r):r=e[1];const d=r;let m;e[2]!==a.columns?(m=new Set(a.columns),e[2]=a.columns,e[3]=m):m=e[3];const s=m,i=t!==void 0&&s.has(t.x)?t.x:d.label;let h;e[4]!==t?.y||e[5]!==s?(h=t?.y.find(c=>s.has(c)),e[4]=t?.y,e[5]=s,e[6]=h):h=e[6];const b=h,C=b??d.value;let w;e[7]!==i||e[8]!==a.rows||e[9]!==C?(w=C===null?[]:a.rows.slice(0,W).map((c,v)=>({label:i===null?`#${(v+1).toString()}`:E(c[i]),value:Number(c[C])||0})),e[7]=i,e[8]=a.rows,e[9]=C,e[10]=w):w=e[10];const x=w;if(C===null){let c;e[11]!==u?(c=u("No numeric column to chart."),e[11]=u,e[12]=c):c=e[12];let v;return e[13]!==c?(v=l("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:c}),e[13]=c,e[14]=v):v=e[14],v}const f=n??(t!==void 0&&b!==void 0?t.kind:"bar");let p;e[15]!==x||e[16]!==f?(p=f==="bar"?k(H,{className:"h-full w-full",config:q,data:x,children:[l(_,{dataKey:"label"}),l(j,{dataKey:"value"}),l(G,{})]}):l(J,{data:x,kind:f}),e[15]=x,e[16]=f,e[17]=p):p=e[17];let y;return e[18]!==f||e[19]!==p?(y=l("div",{className:"h-80 w-full p-3","data-chart-kind":f,"data-testid":"sql-chart",children:p}),e[18]=f,e[19]=p,e[20]=y):y=e[20],y},ne=o=>{const e=T(19),{result:t}=o,n=S();if(t.columns.length===0){let s;e[0]!==t.rowCount||e[1]!==n?(s=n("{count} rows",{count:t.rowCount}),e[0]=t.rowCount,e[1]=n,e[2]=s):s=e[2];let i;return e[3]!==s?(i=l("p",{className:"p-4 text-sm text-muted-foreground",children:s}),e[3]=s,e[4]=i):i=e[4],i}let a;e[5]!==t.columns?(a=t.columns.map(P),e[5]=t.columns,e[6]=a):a=e[6];let u;e[7]!==a?(u=l(z,{className:"sticky top-0 z-10 bg-muted",children:l(L,{children:a})}),e[7]=a,e[8]=u):u=e[8];let r;if(e[9]!==t.columns||e[10]!==t.rows){let s;e[12]!==t.columns?(s=(i,h)=>l(L,{"data-testid":"sql-row",children:t.columns.map(b=>l(F,{className:"max-w-md truncate font-mono text-xs",children:l(U,{value:i[b]})},b))},h),e[12]=t.columns,e[13]=s):s=e[13],r=t.rows.map(s),e[9]=t.columns,e[10]=t.rows,e[11]=r}else r=e[11];let d;e[14]!==r?(d=l(I,{children:r}),e[14]=r,e[15]=d):d=e[15];let m;return e[16]!==u||e[17]!==d?(m=k(M,{"data-testid":"sql-rows",children:[u,d]}),e[16]=u,e[17]=d,e[18]=m):m=e[18],m};function P(o){return l(V,{children:o},o)}export{oe as S,ne as a};