@lunora/studio 1.0.0-alpha.146 → 1.0.0-alpha.148

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 (175) hide show
  1. package/dist/index.d.mts +3 -3
  2. package/dist/index.d.ts +3 -3
  3. package/dist/index.mjs +1 -1
  4. package/dist/mount.mjs +1 -1
  5. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
  6. package/dist/packem_chunks/ApiTab.mjs +1 -1
  7. package/dist/packem_chunks/AuditPanel.mjs +1 -1
  8. package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -1
  9. package/dist/packem_chunks/ExportImportPanel.mjs +3 -3
  10. package/dist/packem_chunks/FileBrowser.mjs +1 -1
  11. package/dist/packem_chunks/FunctionRunner.mjs +1 -1
  12. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
  13. package/dist/packem_chunks/HealthPanel.mjs +1 -1
  14. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  15. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  16. package/dist/packem_chunks/MailPanel.mjs +1 -1
  17. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  18. package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
  19. package/dist/packem_chunks/PitrPanel.mjs +1 -1
  20. package/dist/packem_chunks/SchemaViewer.mjs +1 -1
  21. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
  22. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  23. package/dist/packem_chunks/SqlEditorPanel.mjs +7 -8
  24. package/dist/packem_chunks/TableEditor.mjs +1 -1
  25. package/dist/packem_chunks/agents-panel.mjs +1 -1
  26. package/dist/packem_chunks/analytics-panel.mjs +1 -1
  27. package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
  28. package/dist/packem_chunks/auth-config-panel.mjs +1 -1
  29. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
  30. package/dist/packem_chunks/containers-panel.mjs +1 -1
  31. package/dist/packem_chunks/dashboards-panel.mjs +1 -1
  32. package/dist/packem_chunks/evals-panel.mjs +1 -1
  33. package/dist/packem_chunks/fanout-panel.mjs +1 -1
  34. package/dist/packem_chunks/flags-panel.mjs +1 -1
  35. package/dist/packem_chunks/issues-panel.mjs +1 -1
  36. package/dist/packem_chunks/kv-browser.mjs +1 -1
  37. package/dist/packem_chunks/log-drains-panel.mjs +1 -1
  38. package/dist/packem_chunks/migrations-route.mjs +1 -1
  39. package/dist/packem_chunks/organizations-panel.mjs +1 -1
  40. package/dist/packem_chunks/payments-panel.mjs +1 -1
  41. package/dist/packem_chunks/permissions-panel.mjs +1 -1
  42. package/dist/packem_chunks/queues-panel.mjs +1 -1
  43. package/dist/packem_chunks/reactors-panel.mjs +1 -1
  44. package/dist/packem_chunks/rls-panel.mjs +1 -1
  45. package/dist/packem_chunks/schedule-panel.mjs +1 -1
  46. package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
  47. package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
  48. package/dist/packem_chunks/sync-client-panel.mjs +1 -1
  49. package/dist/packem_chunks/traces-panel.mjs +1 -1
  50. package/dist/packem_chunks/users-panel.mjs +1 -1
  51. package/dist/packem_chunks/vector-browser.mjs +1 -1
  52. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  53. package/dist/packem_shared/{ApiDocsPanel-CHCIjzZu.mjs → ApiDocsPanel-BImfQhyJ.mjs} +1 -1
  54. package/dist/packem_shared/{ApiReferencePanel-Cqy9Z7mO.mjs → ApiReferencePanel-B4i-KeOf.mjs} +1 -1
  55. package/dist/packem_shared/{CommandPalette-DtLEYVhX.mjs → CommandPalette-CSdz9zax.mjs} +1 -1
  56. package/dist/packem_shared/DataBrowser-B0XdZT2Z.mjs +4 -0
  57. package/dist/packem_shared/{GlobalDataBrowser-CDpzXZxj.mjs → GlobalDataBrowser-BTbqR6Wc.mjs} +1 -1
  58. package/dist/packem_shared/{HomePanel-4gpRjcch.mjs → HomePanel-_BwLI4TQ.mjs} +1 -1
  59. package/dist/packem_shared/{MigrationsPanel-Cz0x3Pv6.mjs → MigrationsPanel-BPWzFdxC.mjs} +1 -1
  60. package/dist/packem_shared/{OpenRpcReferencePanel-DZicbIOf.mjs → OpenRpcReferencePanel-BKJEX7we.mjs} +1 -1
  61. package/dist/packem_shared/{ScheduledJobs-BWziDVZO.mjs → ScheduledJobs-B4DPADwk.mjs} +1 -1
  62. package/dist/packem_shared/{Studio-C_yEjXcG.mjs → Studio-CcWQdYrV.mjs} +1 -1
  63. package/dist/packem_shared/{StudioApp-BQAxVB3v.mjs → StudioApp-B5jLGbeH.mjs} +1 -1
  64. package/dist/packem_shared/{advisor-view-DyXQCN4y.mjs → advisor-view-CPgOok_h.mjs} +1 -1
  65. package/dist/packem_shared/{data-grid-B8WGnT-5.mjs → data-grid-DTBAKZlm.mjs} +1 -1
  66. package/dist/packem_shared/{error-alert-ClpDVYvo.mjs → error-alert-tf5zvSLV.mjs} +1 -1
  67. package/dist/packem_shared/{grid-features-CGs2pKcr.mjs → grid-features-Dl7bCGRN.mjs} +4 -4
  68. package/dist/packem_shared/{home-panel-CHtt8k50.mjs → home-panel-DCUKd8Uk.mjs} +1 -1
  69. package/dist/packem_shared/internal-B6haJbiP.mjs +2 -0
  70. package/dist/packem_shared/{log-line-DpRfHaVQ.mjs → log-line-BoObzuue.mjs} +1 -1
  71. package/dist/packem_shared/{recording-client-CMvFFEC0.mjs → recording-client-BXUIyBL4.mjs} +1 -1
  72. package/dist/packem_shared/{reference-view-DS7FFPpP.mjs → reference-view-AC9FgXSz.mjs} +1 -1
  73. package/dist/packem_shared/{schema-diagram-C27ETi10.mjs → schema-diagram-CDj_69jF.mjs} +1 -1
  74. package/dist/packem_shared/{sql-result-table-BLIMecXM.mjs → sql-result-table-C5y0jwaK.mjs} +1 -1
  75. package/dist/packem_shared/{studio-DF0GqQBP.mjs → studio-OqNyRY1N.mjs} +1 -1
  76. package/dist/packem_shared/table-list-sidebar-DHG1UJC4.mjs +1 -0
  77. package/dist/packem_shared/{use-admin-query-BvZH4unR.mjs → use-admin-query-BKXiqLci.mjs} +1 -1
  78. package/dist/packem_shared/{use-async-submit-C1A11ka9.mjs → use-async-submit-BTr3w2-K.mjs} +1 -1
  79. package/dist/packem_shared/{use-auth-config-DocoJ5uQ.mjs → use-auth-config-BQKGdSFh.mjs} +1 -1
  80. package/dist/packem_shared/{use-open-trace-CTQIPjo9.mjs → use-open-trace-BCW0c9qq.mjs} +1 -1
  81. package/dist/packem_shared/{use-sql-assistant-BGoWYcGL.mjs → use-sql-assistant-BhIMDQHV.mjs} +1 -1
  82. package/dist/packem_shared/wire-codec-oeb8YWV3.mjs +1 -0
  83. package/dist/standalone/{chunk-6T3STPM7.js → chunk-2ES4GR4C.js} +1 -1
  84. package/dist/standalone/chunk-2LN3T5HY.js +15 -0
  85. package/dist/standalone/{chunk-EX33M5EE.js → chunk-3WOJTY4R.js} +1 -1
  86. package/dist/standalone/{chunk-H3UCYGKY.js → chunk-4FRHYJK4.js} +1 -1
  87. package/dist/standalone/{chunk-7B3OQXWL.js → chunk-4MDOVJ4W.js} +1 -1
  88. package/dist/standalone/{chunk-XABVLLMA.js → chunk-66I57F5M.js} +1 -1
  89. package/dist/standalone/{chunk-447V2Q3F.js → chunk-6C4VJUM5.js} +1 -1
  90. package/dist/standalone/{chunk-JRN7SEJN.js → chunk-6DX7WXXT.js} +1 -1
  91. package/dist/standalone/chunk-6UKUXEBW.js +8 -0
  92. package/dist/standalone/{chunk-DMPVOWA7.js → chunk-7ROGUMLR.js} +1 -1
  93. package/dist/standalone/{chunk-YL7OENDU.js → chunk-7WRJROPR.js} +1 -1
  94. package/dist/standalone/{chunk-HLE46T7J.js → chunk-7ZETHOUS.js} +1 -1
  95. package/dist/standalone/{chunk-KLQEN4KA.js → chunk-A4UOWQOI.js} +1 -1
  96. package/dist/standalone/{chunk-CZU3LZ2O.js → chunk-AHK42KDL.js} +1 -1
  97. package/dist/standalone/chunk-AMZKMGKY.js +1 -0
  98. package/dist/standalone/{chunk-HQPQTWW4.js → chunk-APXBR22Z.js} +1 -1
  99. package/dist/standalone/{chunk-46XX646F.js → chunk-AUWQMDAX.js} +1 -1
  100. package/dist/standalone/{chunk-IYYZMNOB.js → chunk-AX2APCG6.js} +1 -1
  101. package/dist/standalone/{chunk-5JEYBOS6.js → chunk-BOTGXX4H.js} +1 -1
  102. package/dist/standalone/{chunk-YWYJLVEP.js → chunk-C4YXQWPA.js} +1 -1
  103. package/dist/standalone/{chunk-EDYGNYP2.js → chunk-CVZI7XHR.js} +1 -1
  104. package/dist/standalone/{chunk-MDVH5C5A.js → chunk-D3PZ6MIM.js} +1 -1
  105. package/dist/standalone/{chunk-2IRZXHAZ.js → chunk-DCUJOJLT.js} +1 -1
  106. package/dist/standalone/{chunk-E6LDY3TC.js → chunk-DEXFM45H.js} +1 -1
  107. package/dist/standalone/{chunk-PEEGF7YA.js → chunk-DRYRBVT5.js} +2 -2
  108. package/dist/standalone/{chunk-CKKZCUAV.js → chunk-DSFSMWDN.js} +1 -1
  109. package/dist/standalone/{chunk-L3JA4OKZ.js → chunk-DX6FAHR2.js} +1 -1
  110. package/dist/standalone/{chunk-SMVAE2AQ.js → chunk-EHSU2WDS.js} +1 -1
  111. package/dist/standalone/{chunk-RNZ7XXND.js → chunk-FLNL5VTQ.js} +1 -1
  112. package/dist/standalone/{chunk-NXKPFGOP.js → chunk-FODLDLE2.js} +8 -8
  113. package/dist/standalone/{chunk-VXWAQW3F.js → chunk-GB2JAHPX.js} +1 -1
  114. package/dist/standalone/{chunk-IAWCSJRR.js → chunk-GJZHLAVK.js} +1 -1
  115. package/dist/standalone/{chunk-CIQRB2ET.js → chunk-GV7UT4HH.js} +1 -1
  116. package/dist/standalone/{chunk-GMEE5NFG.js → chunk-H5ZCOPNG.js} +1 -1
  117. package/dist/standalone/{chunk-E723DEAW.js → chunk-IABM4BFJ.js} +1 -1
  118. package/dist/standalone/{chunk-ZZENQM5W.js → chunk-INWAISDG.js} +4 -4
  119. package/dist/standalone/{chunk-JOQUDV7F.js → chunk-IODDEC5H.js} +1 -1
  120. package/dist/standalone/{chunk-HDWOQTDN.js → chunk-J5NCVH3C.js} +1 -1
  121. package/dist/standalone/{chunk-DDI4VSJH.js → chunk-J77YHYKR.js} +1 -1
  122. package/dist/standalone/{chunk-VSHZE77Y.js → chunk-JAKYTDUH.js} +1 -1
  123. package/dist/standalone/{chunk-VHMOFAJT.js → chunk-JKUQYLWD.js} +1 -1
  124. package/dist/standalone/chunk-K5F2JKWT.js +1 -0
  125. package/dist/standalone/{chunk-6NO6WOSN.js → chunk-KASSSQS4.js} +1 -1
  126. package/dist/standalone/{chunk-RFTFYKFL.js → chunk-KB45MOFE.js} +1 -1
  127. package/dist/standalone/chunk-KCQPXMOO.js +1 -0
  128. package/dist/standalone/chunk-KLME5CLU.js +1 -0
  129. package/dist/standalone/{chunk-3BFUVYWS.js → chunk-KRXMPCR7.js} +1 -1
  130. package/dist/standalone/{chunk-B5WPIRI3.js → chunk-L47XJL6L.js} +1 -1
  131. package/dist/standalone/{chunk-MJG6GTPL.js → chunk-LJYUUOBB.js} +1 -1
  132. package/dist/standalone/{chunk-H5PZ7JXM.js → chunk-N6EJBSDR.js} +1 -1
  133. package/dist/standalone/{chunk-MHLBCDVW.js → chunk-NOVVYTNU.js} +1 -1
  134. package/dist/standalone/chunk-OVTMYZN2.js +1 -0
  135. package/dist/standalone/{chunk-IDB7SMQU.js → chunk-P4CS3RZR.js} +1 -1
  136. package/dist/standalone/{chunk-OUD7BAWE.js → chunk-PL664H45.js} +1 -1
  137. package/dist/standalone/{chunk-5L3SHBMK.js → chunk-PUP4LTHC.js} +1 -1
  138. package/dist/standalone/{chunk-XGPF7VOP.js → chunk-QFS5WAWF.js} +1 -1
  139. package/dist/standalone/{chunk-UZ5QI3PB.js → chunk-SFIEPF3L.js} +1 -1
  140. package/dist/standalone/chunk-SFLWRGXV.js +1 -0
  141. package/dist/standalone/{chunk-JSXJND3V.js → chunk-SI7NMHGS.js} +1 -1
  142. package/dist/standalone/{chunk-TWXJF4C2.js → chunk-SU737V7V.js} +1 -1
  143. package/dist/standalone/{chunk-3JV5F5SY.js → chunk-TIUMFAN2.js} +1 -1
  144. package/dist/standalone/{chunk-7MJY23GU.js → chunk-V23FBXTK.js} +1 -1
  145. package/dist/standalone/{chunk-V5M356X3.js → chunk-VEWOXE6L.js} +1 -1
  146. package/dist/standalone/chunk-VO3YI35Z.js +1 -0
  147. package/dist/standalone/chunk-VZRWYNKZ.js +3 -0
  148. package/dist/standalone/{chunk-2KAH7DVZ.js → chunk-XFZGJQY4.js} +1 -1
  149. package/dist/standalone/{chunk-PWHV7BUN.js → chunk-XJDQG6VV.js} +1 -1
  150. package/dist/standalone/chunk-XTLR2A7C.js +11 -0
  151. package/dist/standalone/{chunk-AJQKSUVQ.js → chunk-XVONF2UL.js} +1 -1
  152. package/dist/standalone/{chunk-BN5TOI5O.js → chunk-YSX56MFQ.js} +1 -1
  153. package/dist/standalone/chunk-ZD7TZD5E.js +7 -0
  154. package/dist/standalone/{chunk-3DL3MLWV.js → chunk-ZLPC3XZF.js} +1 -1
  155. package/dist/standalone/{chunk-BQ4P3PLU.js → chunk-ZXRRPWQV.js} +1 -1
  156. package/dist/standalone/studio.js +1 -1
  157. package/package.json +6 -6
  158. package/dist/packem_shared/DataBrowser-Bf32rBcr.mjs +0 -4
  159. package/dist/packem_shared/internal-D4gBuklE.mjs +0 -2
  160. package/dist/packem_shared/quote-identifier-CGiYFBvY.mjs +0 -1
  161. package/dist/packem_shared/table-list-sidebar-DKpSAP6p.mjs +0 -1
  162. package/dist/packem_shared/wire-codec-BE-vgg1L.mjs +0 -1
  163. package/dist/standalone/chunk-2IUHQB2Q.js +0 -9
  164. package/dist/standalone/chunk-2L64LHIR.js +0 -1
  165. package/dist/standalone/chunk-3HEXTCWR.js +0 -1
  166. package/dist/standalone/chunk-5AUOM7FK.js +0 -1
  167. package/dist/standalone/chunk-7AU5QSY7.js +0 -1
  168. package/dist/standalone/chunk-FZKQX74O.js +0 -1
  169. package/dist/standalone/chunk-IB3MWLG4.js +0 -1
  170. package/dist/standalone/chunk-JMNCMGSE.js +0 -1
  171. package/dist/standalone/chunk-L2OWXMYF.js +0 -1
  172. package/dist/standalone/chunk-QPVND4TE.js +0 -3
  173. package/dist/standalone/chunk-RIO2HPN7.js +0 -15
  174. package/dist/standalone/chunk-UKQTCLDK.js +0 -7
  175. package/dist/standalone/chunk-W3Q32C24.js +0 -11
@@ -1,3 +1,3 @@
1
- import{c as $}from"react/compiler-runtime";import{useNavigate as He}from"@tanstack/react-router";import{useState as Pe,useEffect as qe,Suspense as et,lazy as tt}from"react";import{B as Ge}from"./badge-r_5B4LHP.mjs";import{C as F,a as Je}from"./card--2hKx4L2.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-BvZH4unR.mjs";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ye}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as nt,f as Ne,d as lt,r as at,g as ot,l as rt}from"./internal-D4gBuklE.mjs";import{c as Ye}from"./utils-bhneXptQ.mjs";import{deriveInsights as it}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useLunora as Ze}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ke}from"./button-q0UYSmrn.mjs";const ct=nt(ye.studioFeatures),Xe={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},dt=t=>{if(t===null||typeof t!="object")return Xe;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"),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ut=()=>{const t=$(3),e=Ze(),[n,s]=Pe(Xe);let a,o;return t[0]!==e?(a=()=>{Ne((async()=>{try{s(dt(await e.query(ct,{},lt(""))))}catch{}})())},o=[e],t[0]=e,t[1]=a,t[2]=o):(a=t[1],o=t[2]),qe(a,o),n},mt=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},ft=t=>{const e=$(24),{group:n}=t,s=I(),a=He();let o;e[0]!==n.tab||e[1]!==a?(o=()=>{Ne(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=o):o=e[2];const r=o,i=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(mt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(gt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Je,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==r||e[22]!==g?(x=l(F,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:r,children:g}),e[20]=n.testId,e[21]=r,e[22]=g,e[23]=x):x=e[23],x},ze=["kv","files","vectors"],pt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>ze.indexOf(n.tab)-ze.indexOf(s.tab)),ht=()=>{const t=$(19),e=Ze(),n=ut(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[o,r]=Pe(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(xt),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(bt),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 _={bindings:v,label:b.label,tab:b.tab,testId:b.testId};r(A=>pt(A,_))}}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]=i,t[7]=c):(i=t[6],c=t[7]),qe(i,c),o.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==o?(f=o.map(yt),t[12]=o,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function gt(t){return l(Ge,{variant:"secondary",children:t},t)}function xt(t){return t.binding}function bt(t){return t.name}function yt(t){return l(ft,{group:t},t.tab)}const vt=[{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"}],Nt=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),_t=t=>{const e=vt.map(n=>`- ${n.name} — ${n.summary}`).join(`
1
+ import{c as $}from"react/compiler-runtime";import{useNavigate as He}from"@tanstack/react-router";import{useState as Pe,useEffect as qe,Suspense as et,lazy as tt}from"react";import{B as Ge}from"./badge-r_5B4LHP.mjs";import{C as F,a as Je}from"./card--2hKx4L2.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-BKXiqLci.mjs";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ye}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as nt,f as Ne,d as lt,r as at,g as ot,l as rt}from"./internal-B6haJbiP.mjs";import{c as Ye}from"./utils-bhneXptQ.mjs";import{deriveInsights as it}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useLunora as Ze}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ke}from"./button-q0UYSmrn.mjs";const ct=nt(ye.studioFeatures),Xe={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},dt=t=>{if(t===null||typeof t!="object")return Xe;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"),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ut=()=>{const t=$(3),e=Ze(),[n,s]=Pe(Xe);let a,o;return t[0]!==e?(a=()=>{Ne((async()=>{try{s(dt(await e.query(ct,{},lt(""))))}catch{}})())},o=[e],t[0]=e,t[1]=a,t[2]=o):(a=t[1],o=t[2]),qe(a,o),n},mt=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},ft=t=>{const e=$(24),{group:n}=t,s=I(),a=He();let o;e[0]!==n.tab||e[1]!==a?(o=()=>{Ne(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=o):o=e[2];const r=o,i=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(mt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(gt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Je,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==r||e[22]!==g?(x=l(F,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:r,children:g}),e[20]=n.testId,e[21]=r,e[22]=g,e[23]=x):x=e[23],x},ze=["kv","files","vectors"],pt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>ze.indexOf(n.tab)-ze.indexOf(s.tab)),ht=()=>{const t=$(19),e=Ze(),n=ut(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[o,r]=Pe(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(xt),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(bt),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 _={bindings:v,label:b.label,tab:b.tab,testId:b.testId};r(A=>pt(A,_))}}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]=i,t[7]=c):(i=t[6],c=t[7]),qe(i,c),o.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==o?(f=o.map(yt),t[12]=o,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function gt(t){return l(Ge,{variant:"secondary",children:t},t)}function xt(t){return t.binding}function bt(t){return t.name}function yt(t){return l(ft,{group:t},t.tab)}const vt=[{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"}],Nt=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),_t=t=>{const e=vt.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
  `)},St=1500,kt=()=>{const t=$(35),e=I();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=at(),t[0]=n):n=t[0];const s=n,[a,o]=Pe(null);let r,i;t[1]!==a?(r=()=>{if(a===null)return;const L=globalThis.setTimeout(()=>{o(null)},St);return()=>{globalThis.clearTimeout(L)}},i=[a],t[1]=a,t[2]=r,t[3]=i):(r=t[2],i=t[3]),qe(r,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=(L,M)=>{ot(M)&&o(L)},t[4]=c):c=t[4];const m=c;let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{m("config",Nt(s))},t[5]=d):d=t[5];const f=d;let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{m("prompt",_t(s))},t[6]=u):u=t[6];const p=u;let g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=l("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=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[11]=e,t[12]=b):b=t[12];let v;t[13]!==b?(v=l("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=v):v=t[14];let _;t[15]!==x||t[16]!==v?(_=h("div",{className:"flex flex-col gap-1.5 p-4",children:[x,v]}),t[15]=x,t[16]=v,t[17]=_):_=t[17];let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A=l("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=A):A=t[18];let S;t[19]!==a||t[20]!==e?(S=e(a==="config"?"Copied":"Copy MCP config"),t[19]=a,t[20]=e,t[21]=S):S=t[21];let y;t[22]!==S?(y=l(Ke,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:S}),t[22]=S,t[23]=y):y=t[23];let k;t[24]!==a||t[25]!==e?(k=e(a==="prompt"?"Copied":"Copy agent prompt"),t[24]=a,t[25]=e,t[26]=k):k=t[26];let C;t[27]!==k?(C=l(Ke,{"data-testid":"home-connect-agent-copy-prompt",onClick:p,size:"xs",variant:"outline",children:k}),t[27]=k,t[28]=C):C=t[28];let w;t[29]!==y||t[30]!==C?(w=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,h("div",{className:"flex flex-wrap gap-2",children:[y,C]})]}),t[29]=y,t[30]=C,t[31]=w):w=t[31];let N;return t[32]!==_||t[33]!==w?(N=h(F,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[_,w]}),t[32]=_,t[33]=w,t[34]=N):N=t[34],N},Ct=tt(()=>import("../packem_chunks/sparkline.mjs")),wt=(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")}`},De=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},$t=(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 a=Math.round(s/60);return a<24?`${String(a)}h ago`:`${String(Math.round(a/24))}d ago`},Ve=(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],[a])=>s-a).map(([,s])=>s)},We=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((r,i)=>r+i,0),a=t.slice(n).reduce((r,i)=>r+i,0);if(s===0)return null;const o=(a-s)/s*100;return{positive:e?o>=0:o<=0,text:`${o>=0?"+":""}${o.toFixed(1)}%`}},Te=t=>{const e=$(24),{delta:n,footer:s,label:a,trend:o,unit:r,value:i}=t,c=I();let m;e[0]!==a?(m=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=m):m=e[1];let d;e[2]!==i?(d=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==r?(f=r!==void 0&&l("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=h("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let p;e[9]!==o?(p=o!==void 0&&l(et,{fallback:l("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:l(Ct,{data:o})}),e[9]=o,e[10]=p):p=e[10];let g;e[11]!==u||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[u,p]}),e[11]=u,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==m||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[m,g]}),e[14]=m,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&&l("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:[l("span",{className:Ye("font-semibold",n.positive?"text-success":"text-destructive"),children:n.text})," ",l("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(F,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},At=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("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:l("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},Be=t=>{const e=$(7),{command:n,label:s}=t;let a;e[0]!==s?(a=l("div",{className:"p-4",children:l("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=a):a=e[1];let o;e[2]!==n?(o=l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:l("code",{className:"font-mono text-xs text-muted-foreground",children:n})}),e[2]=n,e[3]=o):o=e[3];let r;return e[4]!==a||e[5]!==o?(r=h(F,{className:"justify-between gap-0 py-0",children:[a,o]}),e[4]=a,e[5]=o,e[6]=r):r=e[6],r},Qe=t=>{const e=$(18),{count:n,onView:s,testId:a,title:o}=t,r=I();let i;e[0]!==o?(i=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o}),e[0]=o,e[1]=i):i=e[1];let c;e[2]!==n||e[3]!==r?(c=n===null?l("span",{className:"text-xs text-muted-foreground",children:r("No data yet")}):l(Ge,{variant:n>0?"destructive":"success",children:n>0?n:r("All clear")}),e[2]=n,e[3]=r,e[4]=c):c=e[4];let m;e[5]!==i||e[6]!==c?(m=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=m):m=e[7];let d;e[8]!==r?(d=r("View"),e[8]=r,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=l(At,{}),e[10]=f):f=e[10];let u;e[11]!==s||e[12]!==d?(u=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:[d,f]}),e[11]=s,e[12]=d,e[13]=u):u=e[13];let p;return e[14]!==m||e[15]!==u||e[16]!==a?(p=h(F,{className:"justify-between gap-0 py-0","data-testid":a,children:[m,u]}),e[14]=m,e[15]=u,e[16]=a,e[17]=p):p=e[17],p},Lt=t=>{const e=$(7),{functions:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const o=[...n].toSorted(Ot).slice(0,5);let r;e[3]!==s?(r=s("Top functions"),e[3]=s,e[4]=r):r=e[4];let i;e[5]!==r?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r})}),e[5]=r,e[6]=i):i=e[6],a=h(F,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,o.length===0?l("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:[l("span",{children:s("Function")}),l("span",{className:"text-end",children:s("Calls")}),l("span",{className:"w-12 text-end",children:s("Avg")}),l("span",{className:"w-8 text-end",children:s("Err")})]}),o.map(Rt)]})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Mt=t=>{const e=$(26),{subs:n}=t,s=I();let a;e[0]!==s?(a=s("Live connections"),e[0]=s,e[1]=a):a=e[1];let o;e[2]!==a?(o=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[2]=a,e[3]=o):o=e[3];const r=n?.totalConnections??0;let i;e[4]!==r?(i=r.toLocaleString(),e[4]=r,e[5]=i):i=e[5];let c;e[6]!==i?(c=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==s?(m=s("sockets"),e[8]=s,e[9]=m):m=e[9];let d;e[10]!==m?(d=l("span",{className:"text-xs text-muted-foreground",children:m}),e[10]=m,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];const u=n?.totalSubscriptions??0;let p;e[15]!==u?(p=u.toLocaleString(),e[15]=u,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]!==o||e[24]!==f?(b=l(F,{"data-testid":"home-live-connections",children:h(Je,{className:"flex flex-col gap-2.5 py-4",children:[o,f,x]})}),e[22]=x,e[23]=o,e[24]=f,e[25]=b):b=e[25],b},It=t=>{const e=$(7),{entries:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const o=Date.now();let r;e[3]!==s?(r=s("Recent activity"),e[3]=s,e[4]=r):r=e[4];let i;e[5]!==r?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r})}),e[5]=r,e[6]=i):i=e[6],a=h(F,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,n.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No recent activity.")}):l("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:[l("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}`]})]})]}),l("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:$t(c.ts,o)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Tt=t=>{const e=t.reduce((n,s)=>n+s.calls,0);return e===0?null:t.reduce((n,s)=>n+s.totalDurationMs,0)/e},Yt=t=>{const e=$(149),{initialShardKey:n}=t,s=I(),a=He(),o=n??"";let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];let i;e[1]!==o?(i={shardKey:o},e[1]=o,e[2]=i):i=e[2];const c=ve(ye.getMetrics,r,i);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m={},e[3]=m):m=e[3];let d;e[4]!==o?(d={shardKey:o},e[4]=o,e[5]=d):d=e[5];const f=ve(ye.getFunctionStats,m,d);let u,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},p={shardKey:""},e[6]=u,e[7]=p):(u=e[6],p=e[7]);const g=ve(ye.getSecurityAudit,u,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==o?(b={shardKey:o},e[9]=o,e[10]=b):b=e[10];const v=ve(ye.listSubscriptions,x,b);let _;e[11]===Symbol.for("react.memo_cache_sentinel")?(_={},e[11]=_):_=e[11];let A;e[12]!==o?(A={shardKey:o},e[12]=o,e[13]=A):A=e[13];const S=ve(ye.getAuditLog,_,A),y=c.data??null;let k,C,w,N,L,M,j,T,O,B,D,P,R,E,q,U,K,z;if(e[14]!==S.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==a||e[19]!==f.data||e[20]!==v.data||e[21]!==s){N=Array.isArray(f.data?.functions)?f.data.functions:[],j=v.data??null;let Ce;e[40]!==S.data?(Ce=Array.isArray(S.data?.entries)?S.data.entries:[],e[40]=S.data,e[41]=Ce):Ce=e[41],C=Ce,L=c.data===void 0||f.data===void 0?null:it(y,N).length,M=Array.isArray(g.data?.findings)?g.data.findings.length:null;let we;e[42]!==a?(we=()=>{Ne(a({to:"/security"}))},e[42]=a,e[43]=we):we=e[43],z=we;let $e;e[44]!==a?($e=()=>{Ne(a({to:"/insights"}))},e[44]=a,e[45]=$e):$e=e[45],K=$e;const Ae=Ve(y?.history,"calls"),Le=Ve(y?.history,"errors"),Ue=Tt(N),Me=Math.max(0,...N.map(Et));let Ie;e[46]!==y||e[47]!==s?(Ie=y===null?void 0:wt(s,y.cache),e[46]=y,e[47]=s,e[48]=Ie):Ie=e[48],w=Ie,q="flex flex-col gap-6",U="lunora-home",D="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",P="home-health";const Re=We(Ae);let he;e[49]!==s?(he=s("Requests"),e[49]=s,e[50]=he):he=e[50];const Ee=y?.requests??0;let ge;e[51]!==Ee?(ge=Ee.toLocaleString(),e[51]=Ee,e[52]=ge):ge=e[52],e[53]!==Ae||e[54]!==Re||e[55]!==he||e[56]!==ge?(R=l(Te,{delta:Re,label:he,trend:Ae,value:ge}),e[53]=Ae,e[54]=Re,e[55]=he,e[56]=ge,e[57]=R):R=e[57];const Fe=We(Le,!1);let xe;e[58]!==s?(xe=s("Errors"),e[58]=s,e[59]=xe):xe=e[59];const je=y?.errors??0;let be;e[60]!==je?(be=je.toLocaleString(),e[60]=je,e[61]=be):be=e[61],e[62]!==Le||e[63]!==Fe||e[64]!==xe||e[65]!==be?(E=l(Te,{delta:Fe,label:xe,trend:Le,value:be}),e[62]=Le,e[63]=Fe,e[64]=xe,e[65]=be,e[66]=E):E=e[66],k=Te,e[67]!==Me||e[68]!==s?(T=Me>0?`${s("max")} ${De(Me)}`:void 0,e[67]=Me,e[68]=s,e[69]=T):T=e[69],e[70]!==s?(O=s("Avg latency"),e[70]=s,e[71]=O):O=e[71],B=Ue===null?"—":De(Ue),e[14]=S.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=a,e[19]=f.data,e[20]=v.data,e[21]=s,e[22]=k,e[23]=C,e[24]=w,e[25]=N,e[26]=L,e[27]=M,e[28]=j,e[29]=T,e[30]=O,e[31]=B,e[32]=D,e[33]=P,e[34]=R,e[35]=E,e[36]=q,e[37]=U,e[38]=K,e[39]=z}else k=e[22],C=e[23],w=e[24],N=e[25],L=e[26],M=e[27],j=e[28],T=e[29],O=e[30],B=e[31],D=e[32],P=e[33],R=e[34],E=e[35],q=e[36],U=e[37],K=e[38],z=e[39];let V;e[72]!==k||e[73]!==T||e[74]!==O||e[75]!==B?(V=l(k,{footer:T,label:O,value:B}),e[72]=k,e[73]=T,e[74]=O,e[75]=B,e[76]=V):V=e[76];let W;e[77]!==s?(W=s("Database size"),e[77]=s,e[78]=W):W=e[78];const Oe=y?.databaseSize??null;let Q;e[79]!==Oe?(Q=rt(Oe),e[79]=Oe,e[80]=Q):Q=e[80];let H;e[81]!==w||e[82]!==W||e[83]!==Q?(H=l(Te,{footer:w,label:W,value:Q}),e[81]=w,e[82]=W,e[83]=Q,e[84]=H):H=e[84];let G;e[85]!==D||e[86]!==P||e[87]!==R||e[88]!==E||e[89]!==V||e[90]!==H?(G=h("div",{className:D,"data-testid":P,children:[R,E,V,H]}),e[85]=D,e[86]=P,e[87]=R,e[88]=E,e[89]=V,e[90]=H,e[91]=G):G=e[91];let _e;e[92]===Symbol.for("react.memo_cache_sentinel")?(_e=l(ht,{}),e[92]=_e):_e=e[92];let J;e[93]!==N?(J=l("div",{className:"lg:col-span-2",children:l(Lt,{functions:N})}),e[93]=N,e[94]=J):J=e[94];let Y;e[95]!==j?(Y=l(Mt,{subs:j}),e[95]=j,e[96]=Y):Y=e[96];let Z;e[97]!==C?(Z=l(It,{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=l("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]!==L||e[110]!==M||e[111]!==s||e[112]!==K||e[113]!==z?(ne=M===0&&L===0?l(st,{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:[l("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),l("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:[l(Qe,{count:M,onView:z,testId:"home-security",title:s("Security findings")}),l(Qe,{count:L,onView:K,testId:"home-performance",title:s("Performance issues")})]}),e[109]=L,e[110]=M,e[111]=s,e[112]=K,e[113]=z,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 oe;e[120]!==ae?(oe=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[120]=ae,e[121]=oe):oe=e[121];let re;e[122]!==s?(re=s("Client SDK"),e[122]=s,e[123]=re):re=e[123];let ie;e[124]!==re?(ie=l(Be,{command:"npm i @lunora/client",label:re}),e[124]=re,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=l(Be,{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=l(Be,{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=l(kt,{}),e[138]=Se):Se=e[138];let pe;e[139]!==oe||e[140]!==fe?(pe=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[oe,fe,Se]}),e[139]=oe,e[140]=fe,e[141]=pe):pe=e[141];let ke;return e[142]!==q||e[143]!==U||e[144]!==G||e[145]!==ee||e[146]!==le||e[147]!==pe?(ke=h("div",{className:q,"data-testid":U,children:[G,_e,ee,le,pe]}),e[142]=q,e[143]=U,e[144]=G,e[145]=ee,e[146]=le,e[147]=pe,e[148]=ke):ke=e[148],ke};function Ot(t,e){return e.calls-t.calls}function Rt(t){return h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[l("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),l("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),l("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:De(t.calls>0?t.totalDurationMs/t.calls:0)}),l("span",{className:Ye("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function Et(t){return t.maxDurationMs}export{Yt as H,wt as c,ut as u};
@@ -0,0 +1,2 @@
1
+ const a=(t,n,r,i,o)=>{switch(n){case"action":return t.action(r,i,o);case"mutation":return t.mutation(r,i,o);default:return t.query(r,i,o)}},f=t=>({__lunoraRef:t}),u=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},d=t=>t instanceof Error?t.message:String(t),g=t=>{if(t===null||typeof t!="object"||!("code"in t))return;const{code:n}=t;return typeof n=="string"?n:void 0},l=t=>{if(t===null||typeof t!="object"||!("hint"in t))return;const{hint:n}=t;return typeof n=="string"?n:Array.isArray(n)?n.filter(r=>typeof r=="string").join(`
2
+ `):void 0},y=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}},e=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,i=0;for(;r>=1024&&i<n.length-1;)r/=1024,i+=1;return`${r.toFixed(1)} ${n[i]??"TB"}`},s=(t,n)=>typeof n=="bigint"?n.toString():n instanceof ArrayBuffer||ArrayBuffer.isView(n)?`<bytes: ${e(n.byteLength)}>`:n,h=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: ${e(t.byteLength)}>`:JSON.stringify(t,s)}},c=(t,n)=>{t.catch(r=>{n?.(r)})},m=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},p=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},b=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{y as a,d as b,f as c,u as d,l as e,c as f,p as g,b as h,h as i,s as j,a as k,e as l,g as m,m as r};
@@ -1 +1 @@
1
- import{c as h}from"react/compiler-runtime";import{f as v}from"./log-fields-SBxKyBug.mjs";import{B as x}from"./badge-r_5B4LHP.mjs";import{i as L}from"./internal-D4gBuklE.mjs";import{jsx as o,jsxs as g,Fragment as N}from"react/jsx-runtime";const w={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},B=p=>{const e=h(21),{entry:t}=p;let m;e[0]!==t.fields?(m=v(t.fields),e[0]=t.fields,e[1]=m):m=e[1];const c=m;let l;e[2]!==t.timestamp?(l=L(t.timestamp),e[2]=t.timestamp,e[3]=l):l=e[3];let s;e[4]!==l?(s=o("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:l}),e[4]=l,e[5]=s):s=e[5];const f=w[t.level];let r;e[6]!==t.level||e[7]!==f?(r=o("span",{className:"w-20 shrink-0",role:"gridcell",children:o(x,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=r):r=e[8];const u=t.functionPath??"—";let i;e[9]!==u?(i=o("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[9]=u,e[10]=i):i=e[10];let a;e[11]!==c?(a=c===""?null:o("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c}),e[11]=c,e[12]=a):a=e[12];let n;e[13]!==t.message||e[14]!==a?(n=g("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,a]}),e[13]=t.message,e[14]=a,e[15]=n):n=e[15];let d;return e[16]!==s||e[17]!==r||e[18]!==i||e[19]!==n?(d=g(N,{children:[s,r,i,n]}),e[16]=s,e[17]=r,e[18]=i,e[19]=n,e[20]=d):d=e[20],d};export{B as L,w as a};
1
+ import{c as h}from"react/compiler-runtime";import{f as v}from"./log-fields-SBxKyBug.mjs";import{B as x}from"./badge-r_5B4LHP.mjs";import{h as L}from"./internal-B6haJbiP.mjs";import{jsx as o,jsxs as g,Fragment as N}from"react/jsx-runtime";const w={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},B=p=>{const e=h(21),{entry:t}=p;let m;e[0]!==t.fields?(m=v(t.fields),e[0]=t.fields,e[1]=m):m=e[1];const c=m;let l;e[2]!==t.timestamp?(l=L(t.timestamp),e[2]=t.timestamp,e[3]=l):l=e[3];let s;e[4]!==l?(s=o("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:l}),e[4]=l,e[5]=s):s=e[5];const f=w[t.level];let r;e[6]!==t.level||e[7]!==f?(r=o("span",{className:"w-20 shrink-0",role:"gridcell",children:o(x,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=r):r=e[8];const u=t.functionPath??"—";let a;e[9]!==u?(a=o("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[9]=u,e[10]=a):a=e[10];let i;e[11]!==c?(i=c===""?null:o("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c}),e[11]=c,e[12]=i):i=e[12];let n;e[13]!==t.message||e[14]!==i?(n=g("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,i]}),e[13]=t.message,e[14]=i,e[15]=n):n=e[15];let d;return e[16]!==s||e[17]!==r||e[18]!==a||e[19]!==n?(d=g(N,{children:[s,r,a,n]}),e[16]=s,e[17]=r,e[18]=a,e[19]=n,e[20]=d):d=e[20],d};export{B as L,w as a};
@@ -1 +1 @@
1
- import{o as u}from"./use-admin-query-BvZH4unR.mjs";const b="__lunora_admin__:",d=new Set(["action","mutation","query"]),r=Symbol("lunora.operationSeq"),g=t=>{if(typeof t!="object"||t===null)return;const n=t[r];return typeof n=="number"?n:void 0},h=(t,n)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,r,{configurable:!0,enumerable:!1,value:n,writable:!0})}catch{}},p=t=>{if(typeof t!="object"||t===null)return;const n=t.__lunoraRef;return typeof n=="string"&&n.startsWith(b)?n:void 0},O=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,a){const i=Reflect.get(n,c,a);if(typeof i!="function"||typeof c!="string"||!d.has(c))return typeof i=="function"?i.bind(n):i;const f=i;return async(...e)=>{const l=p(e[0]);if(l===void 0)return f.apply(n,e);const y=typeof e[1]=="object"&&e[1]!==null?e[1]:{},s=u.start(l,y,O(e[2]));try{const o=await f.apply(n,e);return u.settle(s,{result:o}),o}catch(o){throw u.settle(s,{error:o instanceof Error?o.message:String(o)}),h(o,s),o}}}});export{g as o,E as w};
1
+ import{o as u}from"./use-admin-query-BKXiqLci.mjs";const b="__lunora_admin__:",d=new Set(["action","mutation","query"]),r=Symbol("lunora.operationSeq"),g=t=>{if(typeof t!="object"||t===null)return;const n=t[r];return typeof n=="number"?n:void 0},h=(t,n)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,r,{configurable:!0,enumerable:!1,value:n,writable:!0})}catch{}},p=t=>{if(typeof t!="object"||t===null)return;const n=t.__lunoraRef;return typeof n=="string"&&n.startsWith(b)?n:void 0},O=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,a){const i=Reflect.get(n,c,a);if(typeof i!="function"||typeof c!="string"||!d.has(c))return typeof i=="function"?i.bind(n):i;const f=i;return async(...e)=>{const l=p(e[0]);if(l===void 0)return f.apply(n,e);const y=typeof e[1]=="object"&&e[1]!==null?e[1]:{},s=u.start(l,y,O(e[2]));try{const o=await f.apply(n,e);return u.settle(s,{result:o}),o}catch(o){throw u.settle(s,{error:o instanceof Error?o.message:String(o)}),h(o,s),o}}}});export{g as o,E as w};
@@ -1,4 +1,4 @@
1
- import{c as P}from"react/compiler-runtime";import{useState as L,useEffect as ie,createContext as ae,use as le}from"react";import{b as z,g as X,f as de,k as ce,c as ue,d as fe}from"./internal-D4gBuklE.mjs";import{SentIcon as me,Copy01Icon as pe,Search01Icon as he}from"@hugeicons/core-free-icons";import{HugeiconsIcon as W}from"@hugeicons/react";import{I as ge}from"./input-CXhxesPC.mjs";import{useT as J}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{B as q}from"./button-q0UYSmrn.mjs";import{jsx as i,jsxs as N,Fragment as xe}from"react/jsx-runtime";import{B as be}from"./badge-r_5B4LHP.mjs";import{ShardInput as ve}from"./ShardInput-C6mjgAh4.mjs";import{L as U}from"./label-DKFzyHq6.mjs";import{T as ye}from"./textarea--40GKAyz.mjs";import{LunoraError as Ne}from"@lunora/errors";import{useLunora as Se}from"@lunora/react";import{c as Y}from"./utils-bhneXptQ.mjs";const kt=function(t,e,r){const s=P(10);let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},s[0]=n):n=s[0];const[o,l]=L(n);let a,m;s[1]!==r||s[2]!==e||s[3]!==t?(a=()=>{if(t!==void 0)return;let c=!1;return e().then(u=>(c||l(r(u)),u)).catch(u=>{c||l({kind:"error",message:z(u)})}),()=>{c=!0}},m=[r,e,t],s[1]=r,s[2]=e,s[3]=t,s[4]=a,s[5]=m):(a=s[4],m=s[5]),ie(a,m);let d;return s[6]!==r||s[7]!==o||s[8]!==t?(d=t===void 0?o:r(t),s[6]=r,s[7]=o,s[8]=t,s[9]=d):d=s[9],d},ke=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)},F=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=>F(e)).join(" | "):t.type==="array"?`array<${F(t.items)}>`:t.type??"any",we=t=>{const e=Q(t);return e!==void 0?t.type??ke(e[0]):F(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},Ee=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 m;e[2]!==n?(m=Oe(n),e[2]=n,e[3]=m):m=e[3];const d=m,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let v;e[4]!==n?(v=Te(n),e[4]=n,e[5]=v):v=e[5];const b=v,f=s?"*":"?";let p;e[6]!==f?(p=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=p):p=e[7];let y;e[8]!==r||e[9]!==p?(y=N("span",{className:"font-mono text-foreground",children:[r,p]}),e[8]=r,e[9]=p,e[10]=y):y=e[10];let k;e[11]!==n?(k=we(n),e[11]=n,e[12]=k):k=e[12];let h;e[13]!==k?(h=i("span",{className:"font-mono text-muted-foreground",children:k}),e[13]=k,e[14]=h):h=e[14];let g;e[15]!==y||e[16]!==h?(g=N("div",{className:"flex items-baseline gap-2",children:[y,h]}),e[15]=y,e[16]=h,e[17]=g):g=e[17];let x;e[18]!==n.description?(x=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=x):x=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]!==x||e[28]!==S||e[29]!==g?(O=N("div",{className:"flex flex-col gap-1 py-2",children:[g,x,S]}),e[27]=x,e[28]=S,e[29]=g,e[30]=O):O=e[30];const w=O;if(b===void 0){let $;return e[31]!==w?($=i("div",{className:"border-b border-border/50 last:border-b-0",children:w}),e[31]=w,e[32]=$):$=e[32],$}let T;e[33]!==w?(T=i("summary",{className:"cursor-pointer marker:text-muted-foreground",children:w}),e[33]=w,e[34]=T):T=e[34];let A;e[35]!==b?(A=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(Z,{schema:b})}),e[35]=b,e[36]=A):A=e[36];let E;return e[37]!==T||e[38]!==A?(E=N("details",{className:"border-b border-border/50 last:border-b-0",children:[T,A]}),e[37]=T,e[38]=A,e[39]=E):E=e[39],E},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(m=>{const[d,c]=m;return i(Ee,{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=F(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},Ce=["curl","javascript","lunora"],Ae={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},Ie=t=>`api.${t.replaceAll(/[/:]/g,".")}`,Re=t=>{const e=D(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},je=(t,e,r)=>{const s=`${r}${e.httpPath}`,n=JSON.stringify(Re(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{useState as L,useEffect as ie,createContext as ae,use as le}from"react";import{b as z,g as X,f as de,k as ce,c as ue,d as fe}from"./internal-B6haJbiP.mjs";import{SentIcon as me,Copy01Icon as pe,Search01Icon as he}from"@hugeicons/core-free-icons";import{HugeiconsIcon as W}from"@hugeicons/react";import{I as ge}from"./input-CXhxesPC.mjs";import{useT as J}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{B as q}from"./button-q0UYSmrn.mjs";import{jsx as i,jsxs as N,Fragment as xe}from"react/jsx-runtime";import{B as be}from"./badge-r_5B4LHP.mjs";import{ShardInput as ve}from"./ShardInput-C6mjgAh4.mjs";import{L as U}from"./label-DKFzyHq6.mjs";import{T as ye}from"./textarea--40GKAyz.mjs";import{LunoraError as Ne}from"@lunora/errors";import{useLunora as Se}from"@lunora/react";import{c as Y}from"./utils-bhneXptQ.mjs";const kt=function(t,e,r){const s=P(10);let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},s[0]=n):n=s[0];const[o,l]=L(n);let a,m;s[1]!==r||s[2]!==e||s[3]!==t?(a=()=>{if(t!==void 0)return;let c=!1;return e().then(u=>(c||l(r(u)),u)).catch(u=>{c||l({kind:"error",message:z(u)})}),()=>{c=!0}},m=[r,e,t],s[1]=r,s[2]=e,s[3]=t,s[4]=a,s[5]=m):(a=s[4],m=s[5]),ie(a,m);let d;return s[6]!==r||s[7]!==o||s[8]!==t?(d=t===void 0?o:r(t),s[6]=r,s[7]=o,s[8]=t,s[9]=d):d=s[9],d},ke=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)},F=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=>F(e)).join(" | "):t.type==="array"?`array<${F(t.items)}>`:t.type??"any",we=t=>{const e=Q(t);return e!==void 0?t.type??ke(e[0]):F(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},Ee=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 m;e[2]!==n?(m=Oe(n),e[2]=n,e[3]=m):m=e[3];const d=m,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let v;e[4]!==n?(v=Te(n),e[4]=n,e[5]=v):v=e[5];const b=v,f=s?"*":"?";let p;e[6]!==f?(p=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=p):p=e[7];let y;e[8]!==r||e[9]!==p?(y=N("span",{className:"font-mono text-foreground",children:[r,p]}),e[8]=r,e[9]=p,e[10]=y):y=e[10];let k;e[11]!==n?(k=we(n),e[11]=n,e[12]=k):k=e[12];let h;e[13]!==k?(h=i("span",{className:"font-mono text-muted-foreground",children:k}),e[13]=k,e[14]=h):h=e[14];let g;e[15]!==y||e[16]!==h?(g=N("div",{className:"flex items-baseline gap-2",children:[y,h]}),e[15]=y,e[16]=h,e[17]=g):g=e[17];let x;e[18]!==n.description?(x=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=x):x=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]!==x||e[28]!==S||e[29]!==g?(O=N("div",{className:"flex flex-col gap-1 py-2",children:[g,x,S]}),e[27]=x,e[28]=S,e[29]=g,e[30]=O):O=e[30];const w=O;if(b===void 0){let $;return e[31]!==w?($=i("div",{className:"border-b border-border/50 last:border-b-0",children:w}),e[31]=w,e[32]=$):$=e[32],$}let T;e[33]!==w?(T=i("summary",{className:"cursor-pointer marker:text-muted-foreground",children:w}),e[33]=w,e[34]=T):T=e[34];let A;e[35]!==b?(A=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(Z,{schema:b})}),e[35]=b,e[36]=A):A=e[36];let E;return e[37]!==T||e[38]!==A?(E=N("details",{className:"border-b border-border/50 last:border-b-0",children:[T,A]}),e[37]=T,e[38]=A,e[39]=E):E=e[39],E},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(m=>{const[d,c]=m;return i(Ee,{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=F(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},Ce=["curl","javascript","lunora"],Ae={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},Ie=t=>`api.${t.replaceAll(/[/:]/g,".")}`,Re=t=>{const e=D(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},je=(t,e,r)=>{const s=`${r}${e.httpPath}`,n=JSON.stringify(Re(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
 
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{c as v}from"react/compiler-runtime";import{Download01Icon as ne}from"@hugeicons/core-free-icons";import{HugeiconsIcon as se}from"@hugeicons/react";import{Handle as B,Position as G,getNodesBounds as re,getViewportForBounds as ae,useNodesState as le,useEdgesState as ie,ReactFlow as ce,Background as de,Panel as M,Controls as me,MiniMap as pe,useNodes as ue,useReactFlow as U,useNodesInitialized as fe}from"@xyflow/react";import{useState as k,useMemo as _,useRef as ge,useEffect as D}from"react";import{S as he,T as N}from"./storage-tier-C2mKwYRj.mjs";import{B as S}from"./badge-r_5B4LHP.mjs";import{B as j}from"./button-q0UYSmrn.mjs";import{d as be,D as xe,c as Ne,b as C}from"./dropdown-menu-jLZenfWH.mjs";import{I as ye}from"./input-CXhxesPC.mjs";import{useT as T}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as L}from"./internal-D4gBuklE.mjs";import{c as y}from"./utils-bhneXptQ.mjs";import{jsx as i,jsxs as f}from"react/jsx-runtime";import{LunoraError as ve}from"@lunora/errors";import{toBlob as we,toSvg as Se}from"html-to-image";function Ee(o){const e=v(10);let t,a,s;e[0]!==o?({className:t,selected:s,...a}=o,e[0]=o,e[1]=t,e[2]=a,e[3]=s):(t=e[1],a=e[2],s=e[3]);const r=s===!0?"":void 0;let n;e[4]!==t?(n=y("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]=n):n=e[5];let l;return e[6]!==a||e[7]!==r||e[8]!==n?(l=i("div",{"data-slot":"base-node","data-selected":r,className:n,...a}),e[6]=a,e[7]=r,e[8]=n,e[9]=l):l=e[9],l}function Te(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-header",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}function $e(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex flex-col",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-content",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}const F=o=>{const e=o.ref===void 0?o.type:`${o.type} → ${o.ref}`;return o.optional===!0?`${e}?`:e},_e=o=>{const e=v(22),{data:t,selected:a}=o,s=T();let r;e[0]!==t.label||e[1]!==t.loadError||e[2]!==s?(r=t.loadError===!0?i("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:s("Columns unavailable")}):i("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"—"}),e[0]=t.label,e[1]=t.loadError,e[2]=s,e[3]=r):r=e[3];const n=r,l=`sd-node-${t.label}`;let d;e[4]!==t.label?(d=i("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=i("span",{className:"ms-auto",children:i(he,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let c;e[8]!==d||e[9]!==m?(c=f(Te,{children:[d,m]}),e[8]=d,e[9]=m,e[10]=c):c=e[10];let p;e[11]!==t.columns||e[12]!==t.label||e[13]!==n?(p=t.columns.length===0?n:t.columns.map(g=>f("div",{className:y("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",g.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${g.name}`,children:[i(B,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Left,type:"target"}),i("span",{className:"truncate font-mono",title:g.name,children:g.name}),g.pk===!0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),g.ref!==void 0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),i("span",{className:"ms-auto truncate text-muted-foreground",title:F(g),children:F(g)}),i(B,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Right,type:"source"})]},g.name)),e[11]=t.columns,e[12]=t.label,e[13]=n,e[14]=p):p=e[14];let u;e[15]!==p?(u=i($e,{children:p}),e[15]=p,e[16]=u):u=e[16];let b;return e[17]!==a||e[18]!==l||e[19]!==c||e[20]!==u?(b=f(Ee,{className:"w-64 overflow-hidden","data-testid":l,selected:a,children:[c,u]}),e[17]=a,e[18]=l,e[19]=c,e[20]=u,e[21]=b):b=e[21],b},x=1920,E=1080,K=32,R=(o,e)=>{const t=globalThis.document.createElement("a");t.href=o,t.download=e,globalThis.document.body.append(t),t.click(),t.remove()},Ce=(o,e,t="schema-diagram.json")=>{const a={edges:e,exportedAt:new Date().toISOString(),nodes:o},s=JSON.stringify(a,void 0,2),r=globalThis.URL.createObjectURL(new globalThis.Blob([s],{type:"application/json"}));R(r,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(r)},0)},P=(o,e,t,a)=>{const s=re(o),{x:r,y:n,zoom:l}=ae(s,e,t,.1,2,a);return{transform:[r,n,l],zoom:l}},Me=async(o,e,t="schema-diagram.png")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await we(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});if(l===null)throw new ve("INTERNAL","html-to-image produced no blob");const d=globalThis.URL.createObjectURL(l);R(d,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(d)},0)},ke=async(o,e,t="schema-diagram.svg")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await Se(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});R(l,t)},W=256,q=112,I=36,w=24,De=480,Le=1.4,Re=o=>{const e=Math.max(1,Math.round(Math.sqrt(Le*o/(W+q))));return Math.max(De,o/e)},Ae=38,Oe=28,z=o=>Ae+Math.max(1,o)*Oe,He=(o,e)=>{const t=new Map;for(const n of o)t.set(n,[]);for(const n of e)n.to!==n.from&&t.has(n.from)&&t.has(n.to)&&t.get(n.from)?.push(n.to);const a=new Map,s=new Set,r=n=>{const l=a.get(n);if(l!==void 0)return l;if(s.has(n))return 0;s.add(n);let d=0;for(const m of t.get(n)??[])d=Math.max(d,r(m)+1);return s.delete(n),a.set(n,d),d};for(const n of o)r(n);return a},Be=(o,e,t)=>{const a=He(o,e),s=new Map;for(const m of o){const c=a.get(m)??0,p=s.get(c);p===void 0?s.set(c,[m]):p.push(m)}const r=o.reduce((m,c)=>m+z(t.get(c)??0)+I,0),n=Re(r),l=[];let d=0;for(const m of[...s.keys()].toSorted((c,p)=>c-p)){let c=0,p=w;for(const u of s.get(m)??[]){const b=z(t.get(u)??0);p>w&&p+b>n&&(c+=1,p=w),l.push({name:u,x:w+(d+c)*(W+q),y:p}),p+=b+I}d+=c+1}return l},Ge={databaseSchema:_e},J={backgroundColor:N.shard.color},V={backgroundColor:N.global.color},je={global:!0,shard:!0},Fe={},Ie=o=>{const e=o.find(t=>t.pk===!0)?.name;return e!==void 0?e:o.some(t=>t.name==="_id")?"_id":o.some(t=>t.name==="id")?"id":o[0]?.name??"_id"},Y=o=>o.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),ze=(o,e,t)=>{const a=o.map(l=>l.name),s=new Map(o.map(l=>[l.name,l.columns.length])),r=Be(a,Y(o),s),n=new Map(o.map(l=>[l.name,l]));return r.flatMap(({name:l,x:d,y:m})=>{const c=n.get(l);return c===void 0?[]:[{className:t[l],data:{columns:c.columns,label:l,loadError:e,tier:c.tier},id:l,position:{x:d,y:m},type:"databaseSchema"}]})},Ue=o=>{const e=new Map(o.map(t=>[t.name,t.columns]));return Y(o).flatMap(t=>{const a=e.get(t.to)??[],s=e.get(t.from)??[],r=Ie(a);return!a.some(n=>n.name===r)||!s.some(n=>n.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:r,target:t.from,targetHandle:t.column}]})},Ke=()=>{const o=v(15),e=T();let t;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),o[0]=t):t=o[0];let a;o[1]===Symbol.for("react.memo_cache_sentinel")?(a=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]}),o[1]=a):a=o[1];let s;o[2]===Symbol.for("react.memo_cache_sentinel")?(s=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),o[2]=s):s=o[2];let r;o[3]!==e?(r=e("Primary key"),o[3]=e,o[4]=r):r=o[4];let n;o[5]!==r?(n=f("span",{className:"flex items-center gap-1",children:[s,r]}),o[5]=r,o[6]=n):n=o[6];let l;o[7]===Symbol.for("react.memo_cache_sentinel")?(l=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),o[7]=l):l=o[7];let d;o[8]!==e?(d=e("Foreign key"),o[8]=e,o[9]=d):d=o[9];let m;o[10]!==d?(m=f("span",{className:"flex items-center gap-1",children:[l,d]}),o[10]=d,o[11]=m):m=o[11];let c;return o[12]!==n||o[13]!==m?(c=f("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,a,n,m]}),o[12]=n,o[13]=m,o[14]=c):c=o[14],c},Pe=12,We=o=>{const e=v(9),{containerRef:t,seedKey:a}=o,s=fe(),{fitView:r}=U();let n;e[0]!==t||e[1]!==r||e[2]!==s?(n=()=>{if(!s)return;const d=()=>{L(r({duration:0,maxZoom:1.6,padding:.14}))};d();const m=t.current;if(m===null)return;const c=new ResizeObserver(()=>{d()});return c.observe(m),()=>{c.disconnect()}},e[0]=t,e[1]=r,e[2]=s,e[3]=n):n=e[3];let l;return e[4]!==t||e[5]!==r||e[6]!==s||e[7]!==a?(l=[t,r,s,a],e[4]=t,e[5]=r,e[6]=s,e[7]=a,e[8]=l):l=e[8],D(n,l),null},qe=({containerRef:o,testIdPrefix:e})=>{const t=T(),a=ue(),{getEdges:s}=U(),[r,n]=k(null),l=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("png");try{await Me(u,a,`${e}-schema-diagram.png`)}finally{n(null)}}},d=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("svg");try{await ke(u,a,`${e}-schema-diagram.svg`)}finally{n(null)}}},m=()=>{n("json");try{Ce(a,s(),`${e}-schema-diagram.json`)}finally{n(null)}},c=()=>{L(l())},p=()=>{L(d())};return i(M,{position:"top-right",children:f(be,{children:[f(xe,{className:"group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-1 rounded-md border border-border bg-background px-2 text-xs font-medium whitespace-nowrap hover:bg-muted disabled:pointer-events-none disabled:opacity-50","data-testid":`${e}-export-trigger`,disabled:r!==null,children:[i(se,{className:"size-3.5",icon:ne,strokeWidth:2}),t("Export")]}),f(Ne,{align:"end",children:[i(C,{"data-testid":`${e}-export-png`,disabled:r!==null,onClick:c,children:t("PNG")}),i(C,{"data-testid":`${e}-export-svg`,disabled:r!==null,onClick:p,children:t("SVG")}),i(C,{"data-testid":`${e}-export-json`,disabled:r!==null,onClick:m,children:t("JSON")})]})]})})},dt=({columnsError:o,fill:e=!1,nodeClasses:t,tables:a,testIdPrefix:s})=>{const r=T(),[n,l]=k(je),[d,m]=k(""),c=_(()=>{const h=d.trim().toLowerCase();return a.filter(H=>n[H.tier]&&H.name.toLowerCase().includes(h))},[a,n,d]),p=_(()=>ze(c,o??!1,t??Fe),[c,o,t]),u=_(()=>Ue(c),[c]),b=c.map(h=>h.name).join(","),[g,A,Q]=le(p),[Z,O,X]=ie(u),$=ge(null);D(()=>{A(p)},[p,A]),D(()=>{O(u)},[u,O]);const ee=h=>{m(h.target.value)},te=()=>{l(h=>({...h,shard:!h.shard}))},oe=()=>{l(h=>({...h,global:!h.global}))};return a.length===0?i("section",{className:"flex flex-col gap-2","data-testid":`${s}-section`,children:i("p",{className:"text-sm text-muted-foreground","data-testid":`${s}-empty`,children:r("No tables to graph.")})}):i("section",{className:y("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${s}-section`,children:i("div",{className:y("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${s}-canvas`,ref:$,children:f(ce,{edges:Z,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:g,nodesConnectable:!1,nodeTypes:Ge,onEdgesChange:X,onNodesChange:Q,children:[i(de,{}),i(M,{position:"top-left",children:f("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[i(ye,{"aria-label":r("Find table…"),className:"h-7 w-44 text-xs","data-testid":`${s}-find`,onChange:ee,placeholder:r("Find table…"),value:d}),f("div",{"aria-label":r("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[f(j,{"aria-pressed":n.shard,className:"gap-1.5","data-testid":`${s}-tier-shard`,onClick:te,size:"xs",type:"button",variant:n.shard?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),f(j,{"aria-pressed":n.global,className:"gap-1.5","data-testid":`${s}-tier-global`,onClick:oe,size:"xs",type:"button",variant:n.global?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]})]})]})}),i(M,{position:"bottom-center",children:i(Ke,{})}),i(me,{showInteractive:!1}),c.length>Pe&&i(pe,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),i(qe,{containerRef:$,testIdPrefix:s}),i(We,{containerRef:$,seedKey:b})]})})})};export{dt as S};
2
+ import{c as v}from"react/compiler-runtime";import{Download01Icon as ne}from"@hugeicons/core-free-icons";import{HugeiconsIcon as se}from"@hugeicons/react";import{Handle as B,Position as G,getNodesBounds as re,getViewportForBounds as ae,useNodesState as le,useEdgesState as ie,ReactFlow as ce,Background as de,Panel as M,Controls as me,MiniMap as pe,useNodes as ue,useReactFlow as U,useNodesInitialized as fe}from"@xyflow/react";import{useState as k,useMemo as _,useRef as ge,useEffect as D}from"react";import{S as he,T as N}from"./storage-tier-C2mKwYRj.mjs";import{B as S}from"./badge-r_5B4LHP.mjs";import{B as j}from"./button-q0UYSmrn.mjs";import{d as be,D as xe,c as Ne,b as C}from"./dropdown-menu-jLZenfWH.mjs";import{I as ye}from"./input-CXhxesPC.mjs";import{useT as T}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as L}from"./internal-B6haJbiP.mjs";import{c as y}from"./utils-bhneXptQ.mjs";import{jsx as i,jsxs as f}from"react/jsx-runtime";import{LunoraError as ve}from"@lunora/errors";import{toBlob as we,toSvg as Se}from"html-to-image";function Ee(o){const e=v(10);let t,a,s;e[0]!==o?({className:t,selected:s,...a}=o,e[0]=o,e[1]=t,e[2]=a,e[3]=s):(t=e[1],a=e[2],s=e[3]);const r=s===!0?"":void 0;let n;e[4]!==t?(n=y("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]=n):n=e[5];let l;return e[6]!==a||e[7]!==r||e[8]!==n?(l=i("div",{"data-slot":"base-node","data-selected":r,className:n,...a}),e[6]=a,e[7]=r,e[8]=n,e[9]=l):l=e[9],l}function Te(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-header",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}function $e(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex flex-col",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-content",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}const F=o=>{const e=o.ref===void 0?o.type:`${o.type} → ${o.ref}`;return o.optional===!0?`${e}?`:e},_e=o=>{const e=v(22),{data:t,selected:a}=o,s=T();let r;e[0]!==t.label||e[1]!==t.loadError||e[2]!==s?(r=t.loadError===!0?i("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:s("Columns unavailable")}):i("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"—"}),e[0]=t.label,e[1]=t.loadError,e[2]=s,e[3]=r):r=e[3];const n=r,l=`sd-node-${t.label}`;let d;e[4]!==t.label?(d=i("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=i("span",{className:"ms-auto",children:i(he,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let c;e[8]!==d||e[9]!==m?(c=f(Te,{children:[d,m]}),e[8]=d,e[9]=m,e[10]=c):c=e[10];let p;e[11]!==t.columns||e[12]!==t.label||e[13]!==n?(p=t.columns.length===0?n:t.columns.map(g=>f("div",{className:y("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",g.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${g.name}`,children:[i(B,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Left,type:"target"}),i("span",{className:"truncate font-mono",title:g.name,children:g.name}),g.pk===!0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),g.ref!==void 0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),i("span",{className:"ms-auto truncate text-muted-foreground",title:F(g),children:F(g)}),i(B,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Right,type:"source"})]},g.name)),e[11]=t.columns,e[12]=t.label,e[13]=n,e[14]=p):p=e[14];let u;e[15]!==p?(u=i($e,{children:p}),e[15]=p,e[16]=u):u=e[16];let b;return e[17]!==a||e[18]!==l||e[19]!==c||e[20]!==u?(b=f(Ee,{className:"w-64 overflow-hidden","data-testid":l,selected:a,children:[c,u]}),e[17]=a,e[18]=l,e[19]=c,e[20]=u,e[21]=b):b=e[21],b},x=1920,E=1080,K=32,R=(o,e)=>{const t=globalThis.document.createElement("a");t.href=o,t.download=e,globalThis.document.body.append(t),t.click(),t.remove()},Ce=(o,e,t="schema-diagram.json")=>{const a={edges:e,exportedAt:new Date().toISOString(),nodes:o},s=JSON.stringify(a,void 0,2),r=globalThis.URL.createObjectURL(new globalThis.Blob([s],{type:"application/json"}));R(r,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(r)},0)},P=(o,e,t,a)=>{const s=re(o),{x:r,y:n,zoom:l}=ae(s,e,t,.1,2,a);return{transform:[r,n,l],zoom:l}},Me=async(o,e,t="schema-diagram.png")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await we(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});if(l===null)throw new ve("INTERNAL","html-to-image produced no blob");const d=globalThis.URL.createObjectURL(l);R(d,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(d)},0)},ke=async(o,e,t="schema-diagram.svg")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await Se(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});R(l,t)},W=256,q=112,I=36,w=24,De=480,Le=1.4,Re=o=>{const e=Math.max(1,Math.round(Math.sqrt(Le*o/(W+q))));return Math.max(De,o/e)},Ae=38,Oe=28,z=o=>Ae+Math.max(1,o)*Oe,He=(o,e)=>{const t=new Map;for(const n of o)t.set(n,[]);for(const n of e)n.to!==n.from&&t.has(n.from)&&t.has(n.to)&&t.get(n.from)?.push(n.to);const a=new Map,s=new Set,r=n=>{const l=a.get(n);if(l!==void 0)return l;if(s.has(n))return 0;s.add(n);let d=0;for(const m of t.get(n)??[])d=Math.max(d,r(m)+1);return s.delete(n),a.set(n,d),d};for(const n of o)r(n);return a},Be=(o,e,t)=>{const a=He(o,e),s=new Map;for(const m of o){const c=a.get(m)??0,p=s.get(c);p===void 0?s.set(c,[m]):p.push(m)}const r=o.reduce((m,c)=>m+z(t.get(c)??0)+I,0),n=Re(r),l=[];let d=0;for(const m of[...s.keys()].toSorted((c,p)=>c-p)){let c=0,p=w;for(const u of s.get(m)??[]){const b=z(t.get(u)??0);p>w&&p+b>n&&(c+=1,p=w),l.push({name:u,x:w+(d+c)*(W+q),y:p}),p+=b+I}d+=c+1}return l},Ge={databaseSchema:_e},J={backgroundColor:N.shard.color},V={backgroundColor:N.global.color},je={global:!0,shard:!0},Fe={},Ie=o=>{const e=o.find(t=>t.pk===!0)?.name;return e!==void 0?e:o.some(t=>t.name==="_id")?"_id":o.some(t=>t.name==="id")?"id":o[0]?.name??"_id"},Y=o=>o.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),ze=(o,e,t)=>{const a=o.map(l=>l.name),s=new Map(o.map(l=>[l.name,l.columns.length])),r=Be(a,Y(o),s),n=new Map(o.map(l=>[l.name,l]));return r.flatMap(({name:l,x:d,y:m})=>{const c=n.get(l);return c===void 0?[]:[{className:t[l],data:{columns:c.columns,label:l,loadError:e,tier:c.tier},id:l,position:{x:d,y:m},type:"databaseSchema"}]})},Ue=o=>{const e=new Map(o.map(t=>[t.name,t.columns]));return Y(o).flatMap(t=>{const a=e.get(t.to)??[],s=e.get(t.from)??[],r=Ie(a);return!a.some(n=>n.name===r)||!s.some(n=>n.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:r,target:t.from,targetHandle:t.column}]})},Ke=()=>{const o=v(15),e=T();let t;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),o[0]=t):t=o[0];let a;o[1]===Symbol.for("react.memo_cache_sentinel")?(a=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]}),o[1]=a):a=o[1];let s;o[2]===Symbol.for("react.memo_cache_sentinel")?(s=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),o[2]=s):s=o[2];let r;o[3]!==e?(r=e("Primary key"),o[3]=e,o[4]=r):r=o[4];let n;o[5]!==r?(n=f("span",{className:"flex items-center gap-1",children:[s,r]}),o[5]=r,o[6]=n):n=o[6];let l;o[7]===Symbol.for("react.memo_cache_sentinel")?(l=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),o[7]=l):l=o[7];let d;o[8]!==e?(d=e("Foreign key"),o[8]=e,o[9]=d):d=o[9];let m;o[10]!==d?(m=f("span",{className:"flex items-center gap-1",children:[l,d]}),o[10]=d,o[11]=m):m=o[11];let c;return o[12]!==n||o[13]!==m?(c=f("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,a,n,m]}),o[12]=n,o[13]=m,o[14]=c):c=o[14],c},Pe=12,We=o=>{const e=v(9),{containerRef:t,seedKey:a}=o,s=fe(),{fitView:r}=U();let n;e[0]!==t||e[1]!==r||e[2]!==s?(n=()=>{if(!s)return;const d=()=>{L(r({duration:0,maxZoom:1.6,padding:.14}))};d();const m=t.current;if(m===null)return;const c=new ResizeObserver(()=>{d()});return c.observe(m),()=>{c.disconnect()}},e[0]=t,e[1]=r,e[2]=s,e[3]=n):n=e[3];let l;return e[4]!==t||e[5]!==r||e[6]!==s||e[7]!==a?(l=[t,r,s,a],e[4]=t,e[5]=r,e[6]=s,e[7]=a,e[8]=l):l=e[8],D(n,l),null},qe=({containerRef:o,testIdPrefix:e})=>{const t=T(),a=ue(),{getEdges:s}=U(),[r,n]=k(null),l=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("png");try{await Me(u,a,`${e}-schema-diagram.png`)}finally{n(null)}}},d=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("svg");try{await ke(u,a,`${e}-schema-diagram.svg`)}finally{n(null)}}},m=()=>{n("json");try{Ce(a,s(),`${e}-schema-diagram.json`)}finally{n(null)}},c=()=>{L(l())},p=()=>{L(d())};return i(M,{position:"top-right",children:f(be,{children:[f(xe,{className:"group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-1 rounded-md border border-border bg-background px-2 text-xs font-medium whitespace-nowrap hover:bg-muted disabled:pointer-events-none disabled:opacity-50","data-testid":`${e}-export-trigger`,disabled:r!==null,children:[i(se,{className:"size-3.5",icon:ne,strokeWidth:2}),t("Export")]}),f(Ne,{align:"end",children:[i(C,{"data-testid":`${e}-export-png`,disabled:r!==null,onClick:c,children:t("PNG")}),i(C,{"data-testid":`${e}-export-svg`,disabled:r!==null,onClick:p,children:t("SVG")}),i(C,{"data-testid":`${e}-export-json`,disabled:r!==null,onClick:m,children:t("JSON")})]})]})})},dt=({columnsError:o,fill:e=!1,nodeClasses:t,tables:a,testIdPrefix:s})=>{const r=T(),[n,l]=k(je),[d,m]=k(""),c=_(()=>{const h=d.trim().toLowerCase();return a.filter(H=>n[H.tier]&&H.name.toLowerCase().includes(h))},[a,n,d]),p=_(()=>ze(c,o??!1,t??Fe),[c,o,t]),u=_(()=>Ue(c),[c]),b=c.map(h=>h.name).join(","),[g,A,Q]=le(p),[Z,O,X]=ie(u),$=ge(null);D(()=>{A(p)},[p,A]),D(()=>{O(u)},[u,O]);const ee=h=>{m(h.target.value)},te=()=>{l(h=>({...h,shard:!h.shard}))},oe=()=>{l(h=>({...h,global:!h.global}))};return a.length===0?i("section",{className:"flex flex-col gap-2","data-testid":`${s}-section`,children:i("p",{className:"text-sm text-muted-foreground","data-testid":`${s}-empty`,children:r("No tables to graph.")})}):i("section",{className:y("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${s}-section`,children:i("div",{className:y("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${s}-canvas`,ref:$,children:f(ce,{edges:Z,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:g,nodesConnectable:!1,nodeTypes:Ge,onEdgesChange:X,onNodesChange:Q,children:[i(de,{}),i(M,{position:"top-left",children:f("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[i(ye,{"aria-label":r("Find table…"),className:"h-7 w-44 text-xs","data-testid":`${s}-find`,onChange:ee,placeholder:r("Find table…"),value:d}),f("div",{"aria-label":r("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[f(j,{"aria-pressed":n.shard,className:"gap-1.5","data-testid":`${s}-tier-shard`,onClick:te,size:"xs",type:"button",variant:n.shard?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),f(j,{"aria-pressed":n.global,className:"gap-1.5","data-testid":`${s}-tier-global`,onClick:oe,size:"xs",type:"button",variant:n.global?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]})]})]})}),i(M,{position:"bottom-center",children:i(Ke,{})}),i(me,{showInteractive:!1}),c.length>Pe&&i(pe,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),i(qe,{containerRef:$,testIdPrefix:s}),i(We,{containerRef:$,seedKey:b})]})})})};export{dt 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-A1Yg5ORA.mjs";import{h as E}from"./internal-D4gBuklE.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-B8WGnT-5.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 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-A1Yg5ORA.mjs";import{i as E}from"./internal-B6haJbiP.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-DTBAKZlm.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};