@lunora/studio 1.0.0-alpha.217 → 1.0.0-alpha.219

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 (193) hide show
  1. package/dist/index.d.mts +2 -2
  2. package/dist/index.d.ts +2 -2
  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 +1 -1
  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 +2 -2
  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 +1 -1
  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-BImfQhyJ.mjs → ApiDocsPanel-DzvVLAev.mjs} +1 -1
  54. package/dist/packem_shared/{ApiReferencePanel-CigvHhCa.mjs → ApiReferencePanel--1Y4o_-l.mjs} +1 -1
  55. package/dist/packem_shared/{CommandPalette-CSdz9zax.mjs → CommandPalette-D7GxhPrH.mjs} +1 -1
  56. package/dist/packem_shared/DataBrowser-CKbaOtDh.mjs +4 -0
  57. package/dist/packem_shared/GlobalDataBrowser-DSexMt80.mjs +1 -0
  58. package/dist/packem_shared/{HomePanel-_BwLI4TQ.mjs → HomePanel-BkCmY0Hl.mjs} +1 -1
  59. package/dist/packem_shared/{MigrationsPanel-BPWzFdxC.mjs → MigrationsPanel-DLQRarWw.mjs} +1 -1
  60. package/dist/packem_shared/{OpenRpcReferencePanel-C6CM791D.mjs → OpenRpcReferencePanel-a_mbqw67.mjs} +1 -1
  61. package/dist/packem_shared/{ScheduledJobs-B4DPADwk.mjs → ScheduledJobs-DSqsMB51.mjs} +1 -1
  62. package/dist/packem_shared/Studio-BE_SzY44.mjs +1 -0
  63. package/dist/packem_shared/{StudioApp-fYFz6zZQ.mjs → StudioApp-kVjMop0V.mjs} +1 -1
  64. package/dist/packem_shared/{advisor-view-CPgOok_h.mjs → advisor-view-DtkbHW2O.mjs} +1 -1
  65. package/dist/packem_shared/aggregateMetrics-5zEJC6Ju.mjs +1 -0
  66. package/dist/packem_shared/auth-pager-DiDnXsfe.mjs +1 -0
  67. package/dist/packem_shared/{data-grid-DTBAKZlm.mjs → data-grid-BPu1a997.mjs} +1 -1
  68. package/dist/packem_shared/data-view-params-DhYmAkcj.mjs +1 -0
  69. package/dist/packem_shared/{error-alert-tf5zvSLV.mjs → error-alert-dQk3g8WI.mjs} +1 -1
  70. package/dist/packem_shared/{grid-features-Dm80ngyR.mjs → grid-features-ByxOklon.mjs} +1 -1
  71. package/dist/packem_shared/grid-pagination-DgzyzfBh.mjs +1 -0
  72. package/dist/packem_shared/home-panel-B_HN6YMA.mjs +3 -0
  73. package/dist/packem_shared/internal-CyDwqA67.mjs +2 -0
  74. package/dist/packem_shared/{log-line-BoObzuue.mjs → log-line-BHZD2Aj4.mjs} +1 -1
  75. package/dist/packem_shared/{recording-client-BXUIyBL4.mjs → recording-client-CjRFjhya.mjs} +1 -1
  76. package/dist/packem_shared/reference-view-vNXUVPlA.mjs +13 -0
  77. package/dist/packem_shared/{schema-diagram-CDj_69jF.mjs → schema-diagram-DADlbs2X.mjs} +1 -1
  78. package/dist/packem_shared/{sql-result-table-C5y0jwaK.mjs → sql-result-table-DS4o0GoC.mjs} +1 -1
  79. package/dist/packem_shared/{studio-OqNyRY1N.mjs → studio-BVQq3QLR.mjs} +1 -1
  80. package/dist/packem_shared/table-list-sidebar-D30qERKx.mjs +1 -0
  81. package/dist/packem_shared/{use-admin-query-BKXiqLci.mjs → use-admin-query-CR9mHt0P.mjs} +1 -1
  82. package/dist/packem_shared/{use-async-submit-BTr3w2-K.mjs → use-async-submit-LWIKsZ8r.mjs} +1 -1
  83. package/dist/packem_shared/{use-auth-config-CuM3eJZz.mjs → use-auth-config-HmTOvrWd.mjs} +1 -1
  84. package/dist/packem_shared/{use-open-trace-BCW0c9qq.mjs → use-open-trace-DdGxsEB9.mjs} +1 -1
  85. package/dist/packem_shared/{use-sql-assistant-BhIMDQHV.mjs → use-sql-assistant-D4XQ0v0R.mjs} +1 -1
  86. package/dist/standalone/{chunk-VPL4UEUQ.js → chunk-2ABVDLD3.js} +1 -1
  87. package/dist/standalone/{chunk-GNT6XGND.js → chunk-2HAWCLCS.js} +1 -1
  88. package/dist/standalone/chunk-2HF37UQN.js +1 -0
  89. package/dist/standalone/chunk-2JLOP2EL.js +1 -0
  90. package/dist/standalone/{chunk-DUKQRASV.js → chunk-2R6ZRXPJ.js} +1 -1
  91. package/dist/standalone/{chunk-NKPDRRNQ.js → chunk-2RMFAASK.js} +1 -1
  92. package/dist/standalone/{chunk-ZBCR4Y7H.js → chunk-3C25RFTP.js} +1 -1
  93. package/dist/standalone/chunk-3GFF4BA4.js +3 -0
  94. package/dist/standalone/{chunk-PA2VU4KN.js → chunk-3TE3V2QL.js} +1 -1
  95. package/dist/standalone/{chunk-SO2DWPC4.js → chunk-3ZMF2GJ5.js} +1 -1
  96. package/dist/standalone/chunk-4AZDQAT2.js +1 -0
  97. package/dist/standalone/chunk-4P2KFEUN.js +1 -0
  98. package/dist/standalone/chunk-5ICUJ4IA.js +15 -0
  99. package/dist/standalone/{chunk-FODLDLE2.js → chunk-6B7FVPW3.js} +5 -5
  100. package/dist/standalone/{chunk-QHRQX4KT.js → chunk-6CGJCPHC.js} +1 -1
  101. package/dist/standalone/chunk-6DAD3RFX.js +1 -0
  102. package/dist/standalone/chunk-6HDT763N.js +1 -0
  103. package/dist/standalone/{chunk-EDGO46IR.js → chunk-6P7CYZPR.js} +1 -1
  104. package/dist/standalone/{chunk-3S77QF26.js → chunk-6RNWWWLS.js} +1 -1
  105. package/dist/standalone/chunk-6WPU62WQ.js +2 -0
  106. package/dist/standalone/{chunk-JYKNN7XE.js → chunk-A2XTI2C3.js} +1 -1
  107. package/dist/standalone/{chunk-WMCC4HKS.js → chunk-AM7VTTNL.js} +1 -1
  108. package/dist/standalone/chunk-BJEJVHCO.js +9 -0
  109. package/dist/standalone/{chunk-TIUMFAN2.js → chunk-DKLSANZA.js} +1 -1
  110. package/dist/standalone/{chunk-NX2EQSOE.js → chunk-DX6246CW.js} +1 -1
  111. package/dist/standalone/{chunk-DX6FAHR2.js → chunk-DXT2DY4I.js} +1 -1
  112. package/dist/standalone/{chunk-RLVFEWIN.js → chunk-EDEQELIO.js} +1 -1
  113. package/dist/standalone/chunk-EQVY6WGK.js +1 -0
  114. package/dist/standalone/{chunk-YIK4XEVX.js → chunk-FCEQTBLC.js} +1 -1
  115. package/dist/standalone/{chunk-WD3PESCG.js → chunk-FCPY75TQ.js} +1 -1
  116. package/dist/standalone/{chunk-E7TOMONS.js → chunk-FS4GMDIW.js} +1 -1
  117. package/dist/standalone/{chunk-YDIJI7T6.js → chunk-GGAUC5ZI.js} +1 -1
  118. package/dist/standalone/{chunk-N3R2NFDS.js → chunk-GL7PC32W.js} +1 -1
  119. package/dist/standalone/{chunk-R3J3OY24.js → chunk-GYKK64E7.js} +1 -1
  120. package/dist/standalone/{chunk-JYQA5LES.js → chunk-H4OORJHB.js} +1 -1
  121. package/dist/standalone/chunk-HR7W3Z5I.js +1 -0
  122. package/dist/standalone/chunk-I3TUOZM3.js +1 -0
  123. package/dist/standalone/{chunk-OK2Q64WC.js → chunk-I4VOJYXE.js} +1 -1
  124. package/dist/standalone/{chunk-BOTGXX4H.js → chunk-IJPXZZZ5.js} +1 -1
  125. package/dist/standalone/{chunk-Y5D7BKI4.js → chunk-J345HOFQ.js} +1 -1
  126. package/dist/standalone/chunk-JNDBJAO6.js +1 -0
  127. package/dist/standalone/{chunk-LAOVV6GJ.js → chunk-JQ63BDVF.js} +1 -1
  128. package/dist/standalone/{chunk-IDVSCQJU.js → chunk-K4HVLN3Z.js} +1 -1
  129. package/dist/standalone/chunk-KFEWMJQS.js +1 -0
  130. package/dist/standalone/chunk-KGCUFNFC.js +5 -0
  131. package/dist/standalone/{chunk-4Q6ZHR7P.js → chunk-LJVH6HRQ.js} +1 -1
  132. package/dist/standalone/{chunk-GGPSI4ZR.js → chunk-MDUTVBJZ.js} +1 -1
  133. package/dist/standalone/{chunk-U745VG7H.js → chunk-MMMRSTCL.js} +1 -1
  134. package/dist/standalone/{chunk-3F35BVE4.js → chunk-PAE3ULFR.js} +1 -1
  135. package/dist/standalone/{chunk-2J44JAMR.js → chunk-PIKO7SSB.js} +1 -1
  136. package/dist/standalone/chunk-PSBP27ZK.js +1 -0
  137. package/dist/standalone/chunk-PSPSEIFN.js +1 -0
  138. package/dist/standalone/{chunk-SYJQ3QYJ.js → chunk-PUBYZCHW.js} +1 -1
  139. package/dist/standalone/{chunk-7PKIWAFQ.js → chunk-PVNT7VXC.js} +1 -1
  140. package/dist/standalone/{chunk-BDO4YYBB.js → chunk-PY5P53RV.js} +3 -3
  141. package/dist/standalone/{chunk-LBMSRD6N.js → chunk-Q2F2DRGB.js} +1 -1
  142. package/dist/standalone/chunk-QKZ2JCH3.js +1 -0
  143. package/dist/standalone/{chunk-F2FPKLFM.js → chunk-RBJMRBC3.js} +1 -1
  144. package/dist/standalone/{chunk-SGBJAOTU.js → chunk-RE4RWXYW.js} +1 -1
  145. package/dist/standalone/{chunk-XUNTO4S2.js → chunk-RVBRSHYE.js} +1 -1
  146. package/dist/standalone/{chunk-3OI7B7W6.js → chunk-SEBIGECV.js} +1 -1
  147. package/dist/standalone/{chunk-6EJUU2ZR.js → chunk-TZHEXHD4.js} +1 -1
  148. package/dist/standalone/{chunk-4FNAK556.js → chunk-UTPXXTQ6.js} +1 -1
  149. package/dist/standalone/chunk-UYKO4I36.js +1 -0
  150. package/dist/standalone/chunk-V2JKX5UU.js +14 -0
  151. package/dist/standalone/{chunk-EHTUWA7S.js → chunk-V2LIXSFE.js} +1 -1
  152. package/dist/standalone/{chunk-YHCB77HW.js → chunk-VQM2MKYO.js} +1 -1
  153. package/dist/standalone/chunk-VQTSESFP.js +1 -0
  154. package/dist/standalone/{chunk-HRHJB4QO.js → chunk-WINPNKYC.js} +1 -1
  155. package/dist/standalone/{chunk-BMDPZOBN.js → chunk-Y5PCZUGU.js} +1 -1
  156. package/dist/standalone/{chunk-A2TVIAEC.js → chunk-YBCFAAQJ.js} +1 -1
  157. package/dist/standalone/chunk-YV6JXZJO.js +1 -0
  158. package/dist/standalone/{chunk-2DX5MROH.js → chunk-ZHM5ZHPC.js} +1 -1
  159. package/dist/standalone/{chunk-PD6WIDY6.js → chunk-ZJZNCJHY.js} +1 -1
  160. package/dist/standalone/{chunk-OVBIGTEL.js → chunk-ZUGCPRKB.js} +1 -1
  161. package/dist/standalone/studio.js +1 -1
  162. package/dist/styles.css +1 -1
  163. package/package.json +6 -6
  164. package/dist/packem_shared/DataBrowser-DLRa1EYq.mjs +0 -4
  165. package/dist/packem_shared/GlobalDataBrowser-BTbqR6Wc.mjs +0 -1
  166. package/dist/packem_shared/Studio-CcWQdYrV.mjs +0 -1
  167. package/dist/packem_shared/aggregateMetrics-CY05xrYU.mjs +0 -1
  168. package/dist/packem_shared/data-view-params-qoSTqjAj.mjs +0 -1
  169. package/dist/packem_shared/home-panel-DCUKd8Uk.mjs +0 -3
  170. package/dist/packem_shared/internal-B6haJbiP.mjs +0 -2
  171. package/dist/packem_shared/reference-view-DiikOols.mjs +0 -13
  172. package/dist/packem_shared/table-list-sidebar-DHG1UJC4.mjs +0 -1
  173. package/dist/standalone/chunk-4BSUMM2O.js +0 -1
  174. package/dist/standalone/chunk-4IE4RCU2.js +0 -14
  175. package/dist/standalone/chunk-6IGGJN74.js +0 -1
  176. package/dist/standalone/chunk-75TJGBCF.js +0 -1
  177. package/dist/standalone/chunk-AFUPTCKG.js +0 -1
  178. package/dist/standalone/chunk-C3RVT4ZV.js +0 -1
  179. package/dist/standalone/chunk-EC4MB5HF.js +0 -5
  180. package/dist/standalone/chunk-ETRF5USL.js +0 -1
  181. package/dist/standalone/chunk-FR7VMBTI.js +0 -1
  182. package/dist/standalone/chunk-J54ZPBT7.js +0 -1
  183. package/dist/standalone/chunk-ORJ7WS3N.js +0 -1
  184. package/dist/standalone/chunk-RLLKECZT.js +0 -1
  185. package/dist/standalone/chunk-SI6H2NVN.js +0 -1
  186. package/dist/standalone/chunk-SUDJTC4S.js +0 -1
  187. package/dist/standalone/chunk-SYDJEFWA.js +0 -1
  188. package/dist/standalone/chunk-TFDBSYX4.js +0 -15
  189. package/dist/standalone/chunk-UEVR3CED.js +0 -2
  190. package/dist/standalone/chunk-UEZQP5EU.js +0 -9
  191. package/dist/standalone/chunk-XGJNOLY6.js +0 -1
  192. package/dist/standalone/chunk-XNHCCZZZ.js +0 -3
  193. package/dist/standalone/chunk-ZGMLIJ7Y.js +0 -1
@@ -0,0 +1 @@
1
+ import{useLunora as de}from"@lunora/react";import{useState as V,useRef as H,useEffect as I}from"react";import{b as J}from"./use-admin-query-CR9mHt0P.mjs";import{useAutoRefresh as me}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{m as Q,u as ue,a as fe,b as pe,T as ge,D as be}from"./table-list-sidebar-D30qERKx.mjs";import{useT as B}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{b as he}from"./cf-links-CBJ5SywP.mjs";import{i as xe,m as ke}from"./internal-CyDwqA67.mjs";import{c as W}from"react/compiler-runtime";import{c as ve,a as Ne,b as Z,e as ye,d as we,T as Te}from"./table-D0SBiDu-.mjs";import{a as Se}from"./control-button-BOZ5K-FC.mjs";import{C as q,G as Ce}from"./data-grid-BPu1a997.mjs";import{G as Fe}from"./grid-pagination-DgzyzfBh.mjs";import{jsx as r,jsxs as P}from"react/jsx-runtime";import{E as Pe}from"./empty-state-D7jEML_T.mjs";const Ee=(t,e)=>{const o=t._id;return typeof o=="string"||typeof o=="number"?String(o):`row-${e.toString()}`},Me=t=>t==null?"∅":t===""?"(empty)":xe(t),Ge=t=>{const e=W(45),{filters:o,hasMaskedColumns:f,mask:s,maskOn:u,onChangePageSize:i,onJumpToPage:L,onNext:d,onPrevious:T,onRemoveFilter:p,onToggleMask:O,page:c,pageSize:E,pagination:S}=t,C=B(),{hasNext:z,hasPrevious:D,rangeEnd:$,rangeStart:F,total:k}=S;let v;e[0]!==f||e[1]!==u||e[2]!==O||e[3]!==C?(v=f&&r("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-4 py-2",children:r("button",{"aria-pressed":u,className:Se,"data-testid":"gdb-mask-toggle",onClick:O,type:"button",children:C("Mask sensitive columns")})}),e[0]=f,e[1]=u,e[2]=O,e[3]=C,e[4]=v):v=e[4];let g;e[5]!==o||e[6]!==s||e[7]!==p||e[8]!==C?(g=o.length>0&&r("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border px-4 py-2 text-xs","data-testid":"gdb-filters",children:o.map((n,m)=>{const G=Me(Q(n.value,n.column,s));return P("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-muted px-1.5 py-0.5","data-testid":"gdb-filter-chip",children:[r("span",{className:"font-medium text-foreground",children:n.column}),r("span",{className:"text-muted-foreground",children:"="}),r("span",{className:"font-mono text-foreground",children:G}),r("button",{"aria-label":C("Remove filter"),className:"ml-0.5 text-muted-foreground hover:text-foreground","data-testid":"gdb-filter-remove",onClick:()=>{p(m)},type:"button",children:"✕"})]},`${n.column}:${G}`)})}),e[5]=o,e[6]=s,e[7]=p,e[8]=C,e[9]=g):g=e[9];let a;if(e[10]!==s||e[11]!==c.columns){let n;e[13]!==s?(n=m=>P(ve,{children:[m,s.columns.has(m)&&r("span",{className:"ms-1 inline-flex items-center rounded-sm bg-warning/15 px-1 text-[0.625rem] font-medium uppercase text-warning","data-testid":`gdb-mask-chip-${m}`,title:"This column is masked by a mask() policy",children:"masked"})]},m),e[13]=s,e[14]=n):n=e[14],a=c.columns.map(n),e[10]=s,e[11]=c.columns,e[12]=a}else a=e[12];let b;e[15]!==a?(b=r(Ne,{children:r(Z,{children:a})}),e[15]=a,e[16]=b):b=e[16];let N;if(e[17]!==s||e[18]!==c.columns||e[19]!==c.rows){let n;e[21]!==s||e[22]!==c.columns?(n=(m,G)=>r(Z,{"data-testid":"gdb-row",children:c.columns.map(w=>r(ye,{className:"max-w-xs truncate font-mono text-xs",children:s.enabled&&s.columns.has(w)?r("span",{className:"text-muted-foreground italic","data-testid":`gdb-masked-${w}`,title:"Masked (preview)",children:r(q,{value:Q(m[w],w,s)})}):r(q,{value:m[w]})},w))},Ee(m,G)),e[21]=s,e[22]=c.columns,e[23]=n):n=e[23],N=c.rows.map(n),e[17]=s,e[18]=c.columns,e[19]=c.rows,e[20]=N}else N=e[20];let y;e[24]!==N?(y=r(we,{children:N}),e[24]=N,e[25]=y):y=e[25];let h;e[26]!==b||e[27]!==y?(h=r(Ce,{layout:"fill",children:r("div",{className:"min-h-0 flex-1 overflow-auto",children:P(Te,{"data-testid":"gdb-rows",children:[b,y]})})}),e[26]=b,e[27]=y,e[28]=h):h=e[28];let x;e[29]!==z||e[30]!==D||e[31]!==i||e[32]!==L||e[33]!==d||e[34]!==T||e[35]!==E||e[36]!==$||e[37]!==F||e[38]!==k?(x=r("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:r(Fe,{hasNext:z,hasPrevious:D,onJumpToPage:L,onNext:d,onPageSizeChange:i,onPrevious:T,pageSize:E,prefix:"gdb",rangeEnd:$,rangeStart:F,total:k})}),e[29]=z,e[30]=D,e[31]=i,e[32]=L,e[33]=d,e[34]=T,e[35]=E,e[36]=$,e[37]=F,e[38]=k,e[39]=x):x=e[39];let M;return e[40]!==v||e[41]!==g||e[42]!==h||e[43]!==x?(M=P("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"gdb-page",children:[v,g,h,x]}),e[40]=v,e[41]=g,e[42]=h,e[43]=x,e[44]=M):M=e[44],M},Re=()=>{const t=W(8),e=B();let o;t[0]!==e?(o=e("Tables marked .global() (D1-backed, region-replicated) will appear here."),t[0]=e,t[1]=o):o=t[1];let f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f=P("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M3 12h18M12 3a14 14 0 0 1 0 18 14 14 0 0 1 0-18Z"})]}),t[2]=f):f=t[2];let s;t[3]!==e?(s=e("No global tables."),t[3]=e,t[4]=s):s=t[4];let u;return t[5]!==o||t[6]!==s?(u=r("div",{className:"flex flex-1 items-center justify-center p-6",children:r(Pe,{description:o,icon:f,testId:"gdb-empty",title:s})}),t[5]=o,t[6]=s,t[7]=u):u=t[7],u},Le=50,Oe=[],K=[],Ke=({initialTable:t,onSelectTable:e,pageSize:o=Le,schemaSwitch:f}={})=>{const s=de(),u=B(),[i,L]=V(t??null),[d,T]=V(0),[p,O]=V(o),[c,E]=V([]),S=ue(c),{clearFacets:C,facets:z,refetchFacets:D,toggleFacet:$}=fe(),F=J(["lunora-global-tables"],()=>s.listGlobalTables()),k=F.data??null,v=F.error,g=J(["lunora-global-page",i??"",d,p,JSON.stringify(c)],()=>s.readGlobalTablePage({filters:c,limit:p,offset:d,table:i??""}),{enabled:i!==null,keepPreviousData:!1}),a=g.data??null,b=g.error,N=(l,R)=>j=>s.facetGlobalColumn({column:j,filters:R,table:l}),y=(l,R)=>{D(N(l,R))};me(()=>{F.refetch(),i!==null&&(g.refetch(),y(i,S.current))},!0);const h=H(void 0),x=l=>{L(l),h.current=l,E([]),S.current=[],C(),T(0),e?.(l)},M=l=>{$(l,i===null?null:N(i,S.current))},n=l=>{E(l),S.current=l,T(0),i!==null&&y(i,l)},m=(l,R)=>{n([...S.current.filter(j=>j.column!==l),{column:l,value:ke(R)}])},G=l=>{n(S.current.filter((R,j)=>j!==l))},w=H(x);I(()=>{w.current=x}),I(()=>{if(t===void 0||t===""||h.current===t)return;h.current=t;const l=t;queueMicrotask(()=>{w.current(l)})},[t]);const A=l=>{i!==null&&T(Math.max(0,l))},{maskColumns:X,maskOn:Y,maskView:_,onToggleMask:ee}=pe({columns:a?.columns??K,selectedTable:i}),U=a?.total??0,te=d>0,re=a!==null&&d+a.rows.length<U,se=a===null||a.rows.length===0?0:d+1,le=a===null?0:d+a.rows.length,ae=()=>{F.refetch()},oe=()=>{A(d-p)},ne=()=>{A(d+p)},ie=l=>{A(Math.max(0,(l-1)*p))},ce=l=>{O(l),T(0)};return P("div",{className:"flex h-full min-w-0","data-testid":"lunora-global-data-browser",children:[r(ge,{header:P("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[f,r("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"gdb-cf-link",href:he,rel:"noreferrer",target:"_blank",children:u("Open in Cloudflare")})]}),onReload:ae,onSelect:x,prefix:"gdb",selected:i,tables:k??Oe}),P("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[v!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-tables-error",role:"alert",children:v}),k!==null&&k.length===0&&r(Re,{}),b!==null&&r("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"gdb-page-error",role:"alert",children:b}),k!==null&&k.length>0&&a===null&&b===null&&r("div",{className:"flex flex-1 items-center justify-center p-6",children:r("p",{className:"text-sm text-muted-foreground",children:u("Select a table to browse its rows.")})}),a!==null&&r(Ge,{filters:c,hasMaskedColumns:X.size>0,mask:_,maskOn:Y,onChangePageSize:ce,onJumpToPage:ie,onNext:ne,onPrevious:oe,onRemoveFilter:G,onToggleMask:ee,page:a,pageSize:p,pagination:{hasNext:re,hasPrevious:te,rangeEnd:le,rangeStart:se,total:U}})]}),r(be,{columns:a?.columns??K,facets:z,mask:_,onFacetFilter:m,onToggleFacet:M})]})};export{Ke as GlobalDataBrowser};
@@ -1 +1 @@
1
- import"./badge-r_5B4LHP.mjs";import"./card--2hKx4L2.mjs";import"./empty-state-D7jEML_T.mjs";import"./use-admin-query-BKXiqLci.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import"./internal-B6haJbiP.mjs";import"./utils-bhneXptQ.mjs";import"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{H,c as f}from"./home-panel-DCUKd8Uk.mjs";export{H as HomePanel,f as cacheFooterText};
1
+ import"./badge-r_5B4LHP.mjs";import"./card--2hKx4L2.mjs";import"./empty-state-D7jEML_T.mjs";import"./use-admin-query-CR9mHt0P.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import"./internal-CyDwqA67.mjs";import"./utils-bhneXptQ.mjs";import"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{H,c as f}from"./home-panel-B_HN6YMA.mjs";export{H as HomePanel,f as cacheFooterText};
@@ -1 +1 @@
1
- import{c as Ce}from"react/compiler-runtime";import{useLunora as Se}from"@lunora/react";import{useState as Q,useEffect as Ie}from"react";import{ConfirmButton as Ee}from"./ConfirmButton-DU4p72Er.mjs";import{E as Me}from"./error-alert-tf5zvSLV.mjs";import{L as Te}from"./live-status-BuJdUZFU.mjs";import{ShardInput as _e}from"./ShardInput-C6mjgAh4.mjs";import{B as ke}from"./badge-r_5B4LHP.mjs";import{B as Le}from"./button-q0UYSmrn.mjs";import{C as we,a as De}from"./card--2hKx4L2.mjs";import{E as Be}from"./empty-state-D7jEML_T.mjs";import{I as Ae}from"./input-CXhxesPC.mjs";import{L as ue}from"./label-DKFzyHq6.mjs";import{T as Ke,a as je,b as fe,c as u,d as Fe,e as f}from"./table-D0SBiDu-.mjs";import{u as Oe}from"./use-admin-query-BKXiqLci.mjs";import{u as qe}from"./use-shard-key-BsP3o5wT.mjs";import{useT as He}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as he}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{h as Qe,c as Ue,f as $e,d as ze,b as Ge}from"./internal-B6haJbiP.mjs";import{r as Pe}from"./shard-history-CaO3C4KQ.mjs";import{jsx as r,jsxs as s}from"react/jsx-runtime";const We=Ue(he.runMigration),yt=i=>{const e=Ce(98),{initialShardKey:pe}=i,re=Se(),t=He(),{queryShardKey:d,setShardKey:ie,shardKey:a}=qe(pe),[h,ge]=Q(""),[p,ye]=Q("up"),[l,be]=Q(!0),[g,ce]=Q(!1),[c,ne]=Q(null),[U,se]=Q(null);let $;e[0]!==a?($=a.trim(),e[0]=a,e[1]=$):$=e[1];const z=$===d;let G;e[2]===Symbol.for("react.memo_cache_sentinel")?(G={},e[2]=G):G=e[2];let P;e[3]!==d?(P={live:!0,shardKey:d},e[3]=d,e[4]=P):P=e[4];const n=Oe(he.migrationStatus,G,P),o=n.data?.migrations??null,ae=n.error,{errorSource:le,liveError:oe}=n;let W,J;e[5]!==d||e[6]!==n.data?(W=()=>{n.data!==void 0&&Pe(d)},J=[n.data,d],e[5]=d,e[6]=n.data,e[7]=W,e[8]=J):(W=e[7],J=e[8]),Ie(W,J);let V;if(e[9]!==re||e[10]!==p||e[11]!==l||e[12]!==h||e[13]!==a||e[14]!==n||e[15]!==t){const m=async()=>{const me=h.trim();if(me===""){se(t("Enter a migration id")),ne(null);return}ce(!0),se(null);try{const de=await re.query(We,{direction:p,dryRun:l,id:me},ze(a));ne(de),n.refetch()}catch(de){const Ne=de;ne(null),se(Ge(Ne))}ce(!1)};V=()=>{$e(m())},e[9]=re,e[10]=p,e[11]=l,e[12]=h,e[13]=a,e[14]=n,e[15]=t,e[16]=V}else V=e[16];const X=V;let Y;e[17]===Symbol.for("react.memo_cache_sentinel")?(Y=m=>{ge(m.target.value)},e[17]=Y):Y=e[17];const ve=Y;let Z;e[18]===Symbol.for("react.memo_cache_sentinel")?(Z=m=>{ye(m.target.value==="down"?"down":"up")},e[18]=Z):Z=e[18];const xe=Z;let ee;e[19]===Symbol.for("react.memo_cache_sentinel")?(ee=m=>{be(m.target.checked)},e[19]=ee):ee=e[19];const Re=ee;let y;e[20]!==ie||e[21]!==a?(y=r(_e,{onChange:ie,testId:"mg-shard-input",value:a}),e[20]=ie,e[21]=a,e[22]=y):y=e[22];let b;e[23]!==oe?(b=r(Te,{message:oe,prefix:"mg"}),e[23]=oe,e[24]=b):b=e[24];let v;e[25]!==y||e[26]!==b?(v=s("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]}),e[25]=y,e[26]=b,e[27]=v):v=e[27];let x;e[28]!==ae||e[29]!==le?(x=ae!==null&&r(Me,{error:le,testId:"mg-status-error"}),e[28]=ae,e[29]=le,e[30]=x):x=e[30];let R;e[31]!==o||e[32]!==t?(R=o!==null&&o.length===0&&r(Be,{description:t("Data migrations you run against this shard will be tracked here."),icon:r("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:t("No migrations have run on this shard.")}),e[31]=o,e[32]=t,e[33]=R):R=e[33];let N;e[34]!==o||e[35]!==t?(N=o!==null&&o.length>0&&r(we,{className:"overflow-hidden py-0",children:r(De,{className:"px-0",children:s(Ke,{"data-testid":"mg-table",children:[r(je,{children:s(fe,{children:[r(u,{children:t("id")}),r(u,{children:t("direction")}),r(u,{children:t("status")}),r(u,{children:t("processed")}),r(u,{children:t("changed")}),r(u,{children:t("updated")}),r(u,{children:t("error")})]})}),r(Fe,{children:o.map(Je)})]})})}),e[34]=o,e[35]=t,e[36]=N):N=e[36];let C;e[37]!==t?(C=t("Run migration"),e[37]=t,e[38]=C):C=e[38];let S;e[39]!==C?(S=r(ue,{children:C}),e[39]=C,e[40]=S):S=e[40];let I;e[41]!==t?(I=t("Migration id"),e[41]=t,e[42]=I):I=e[42];let E;e[43]!==t?(E=t("migration id"),e[43]=t,e[44]=E):E=e[44];let M;e[45]!==h||e[46]!==I||e[47]!==E?(M=r(Ae,{"aria-label":I,className:"w-auto","data-testid":"mg-id-input",onChange:ve,placeholder:E,value:h}),e[45]=h,e[46]=I,e[47]=E,e[48]=M):M=e[48];let T;e[49]!==t?(T=t("Direction"),e[49]=t,e[50]=T):T=e[50];let _;e[51]!==t?(_=t("up"),e[51]=t,e[52]=_):_=e[52];let k;e[53]!==_?(k=r("option",{value:"up",children:_}),e[53]=_,e[54]=k):k=e[54];let L;e[55]!==t?(L=t("down"),e[55]=t,e[56]=L):L=e[56];let w;e[57]!==L?(w=r("option",{value:"down",children:L}),e[57]=L,e[58]=w):w=e[58];let D;e[59]!==p||e[60]!==T||e[61]!==k||e[62]!==w?(D=s("select",{"aria-label":T,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:xe,value:p,children:[k,w]}),e[59]=p,e[60]=T,e[61]=k,e[62]=w,e[63]=D):D=e[63];let B;e[64]!==l?(B=r("input",{checked:l,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:Re,type:"checkbox"}),e[64]=l,e[65]=B):B=e[65];let A;e[66]!==t?(A=t("Dry run"),e[66]=t,e[67]=A):A=e[67];let K;e[68]!==B||e[69]!==A?(K=s(ue,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[B,A]}),e[68]=B,e[69]=A,e[70]=K):K=e[70];let j;e[71]!==l||e[72]!==X||e[73]!==g||e[74]!==z||e[75]!==t?(j=l?r(Le,{"data-testid":"mg-run",disabled:g||!z,onClick:X,type:"button",children:t(g?"Running…":"Run")}):r(Ee,{confirmLabel:t(g?"Running…":"Run migration?"),disabled:g||!z,onConfirm:X,testId:"mg-run",children:t("Run")}),e[71]=l,e[72]=X,e[73]=g,e[74]=z,e[75]=t,e[76]=j):j=e[76];let F;e[77]!==M||e[78]!==D||e[79]!==K||e[80]!==j?(F=s("div",{className:"flex flex-wrap items-center gap-2",children:[M,D,K,j]}),e[77]=M,e[78]=D,e[79]=K,e[80]=j,e[81]=F):F=e[81];let O;e[82]!==S||e[83]!==F?(O=s("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[S,F]}),e[82]=S,e[83]=F,e[84]=O):O=e[84];let q;e[85]!==U?(q=U!==null&&r("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:U}),e[85]=U,e[86]=q):q=e[86];let H;e[87]!==c||e[88]!==t?(H=c!==null&&s("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[c.dryRun?t("Dry run: "):"",t("{status} — processed",{status:c.status}),c.processed,t(", changed"),c.changed]}),e[87]=c,e[88]=t,e[89]=H):H=e[89];let te;return e[90]!==v||e[91]!==x||e[92]!==R||e[93]!==N||e[94]!==O||e[95]!==q||e[96]!==H?(te=s("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[v,x,R,N,O,q,H]}),e[90]=v,e[91]=x,e[92]=R,e[93]=N,e[94]=O,e[95]=q,e[96]=H,e[97]=te):te=e[97],te};function Je(i){return s(fe,{"data-testid":`mg-row-${i.id}`,children:[r(f,{children:i.id}),r(f,{children:i.direction}),r(f,{children:r(ke,{variant:"secondary",children:i.status})}),r(f,{children:i.processed}),r(f,{children:i.changed}),r(f,{children:Qe(i.updatedAt)}),r(f,{children:i.error??""})]},i.id)}export{yt as MigrationsPanel};
1
+ import{c as Ce}from"react/compiler-runtime";import{useLunora as Se}from"@lunora/react";import{useState as Q,useEffect as Ie}from"react";import{ConfirmButton as Ee}from"./ConfirmButton-DU4p72Er.mjs";import{E as Me}from"./error-alert-dQk3g8WI.mjs";import{L as Te}from"./live-status-BuJdUZFU.mjs";import{ShardInput as _e}from"./ShardInput-C6mjgAh4.mjs";import{B as ke}from"./badge-r_5B4LHP.mjs";import{B as Le}from"./button-q0UYSmrn.mjs";import{C as we,a as De}from"./card--2hKx4L2.mjs";import{E as Be}from"./empty-state-D7jEML_T.mjs";import{I as Ae}from"./input-CXhxesPC.mjs";import{L as ue}from"./label-DKFzyHq6.mjs";import{T as Ke,a as je,b as fe,c as u,d as Fe,e as f}from"./table-D0SBiDu-.mjs";import{u as Oe}from"./use-admin-query-CR9mHt0P.mjs";import{u as qe}from"./use-shard-key-BsP3o5wT.mjs";import{useT as He}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as he}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{h as Qe,c as Ue,f as $e,d as ze,b as Ge}from"./internal-CyDwqA67.mjs";import{r as Pe}from"./shard-history-CaO3C4KQ.mjs";import{jsx as r,jsxs as s}from"react/jsx-runtime";const We=Ue(he.runMigration),yt=i=>{const e=Ce(98),{initialShardKey:pe}=i,re=Se(),t=He(),{queryShardKey:d,setShardKey:ie,shardKey:a}=qe(pe),[h,ge]=Q(""),[p,ye]=Q("up"),[l,be]=Q(!0),[g,ce]=Q(!1),[c,ne]=Q(null),[U,se]=Q(null);let $;e[0]!==a?($=a.trim(),e[0]=a,e[1]=$):$=e[1];const z=$===d;let G;e[2]===Symbol.for("react.memo_cache_sentinel")?(G={},e[2]=G):G=e[2];let P;e[3]!==d?(P={live:!0,shardKey:d},e[3]=d,e[4]=P):P=e[4];const n=Oe(he.migrationStatus,G,P),o=n.data?.migrations??null,ae=n.error,{errorSource:le,liveError:oe}=n;let W,J;e[5]!==d||e[6]!==n.data?(W=()=>{n.data!==void 0&&Pe(d)},J=[n.data,d],e[5]=d,e[6]=n.data,e[7]=W,e[8]=J):(W=e[7],J=e[8]),Ie(W,J);let V;if(e[9]!==re||e[10]!==p||e[11]!==l||e[12]!==h||e[13]!==a||e[14]!==n||e[15]!==t){const m=async()=>{const me=h.trim();if(me===""){se(t("Enter a migration id")),ne(null);return}ce(!0),se(null);try{const de=await re.query(We,{direction:p,dryRun:l,id:me},ze(a));ne(de),n.refetch()}catch(de){const Ne=de;ne(null),se(Ge(Ne))}ce(!1)};V=()=>{$e(m())},e[9]=re,e[10]=p,e[11]=l,e[12]=h,e[13]=a,e[14]=n,e[15]=t,e[16]=V}else V=e[16];const X=V;let Y;e[17]===Symbol.for("react.memo_cache_sentinel")?(Y=m=>{ge(m.target.value)},e[17]=Y):Y=e[17];const ve=Y;let Z;e[18]===Symbol.for("react.memo_cache_sentinel")?(Z=m=>{ye(m.target.value==="down"?"down":"up")},e[18]=Z):Z=e[18];const xe=Z;let ee;e[19]===Symbol.for("react.memo_cache_sentinel")?(ee=m=>{be(m.target.checked)},e[19]=ee):ee=e[19];const Re=ee;let y;e[20]!==ie||e[21]!==a?(y=r(_e,{onChange:ie,testId:"mg-shard-input",value:a}),e[20]=ie,e[21]=a,e[22]=y):y=e[22];let b;e[23]!==oe?(b=r(Te,{message:oe,prefix:"mg"}),e[23]=oe,e[24]=b):b=e[24];let v;e[25]!==y||e[26]!==b?(v=s("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]}),e[25]=y,e[26]=b,e[27]=v):v=e[27];let x;e[28]!==ae||e[29]!==le?(x=ae!==null&&r(Me,{error:le,testId:"mg-status-error"}),e[28]=ae,e[29]=le,e[30]=x):x=e[30];let R;e[31]!==o||e[32]!==t?(R=o!==null&&o.length===0&&r(Be,{description:t("Data migrations you run against this shard will be tracked here."),icon:r("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:t("No migrations have run on this shard.")}),e[31]=o,e[32]=t,e[33]=R):R=e[33];let N;e[34]!==o||e[35]!==t?(N=o!==null&&o.length>0&&r(we,{className:"overflow-hidden py-0",children:r(De,{className:"px-0",children:s(Ke,{"data-testid":"mg-table",children:[r(je,{children:s(fe,{children:[r(u,{children:t("id")}),r(u,{children:t("direction")}),r(u,{children:t("status")}),r(u,{children:t("processed")}),r(u,{children:t("changed")}),r(u,{children:t("updated")}),r(u,{children:t("error")})]})}),r(Fe,{children:o.map(Je)})]})})}),e[34]=o,e[35]=t,e[36]=N):N=e[36];let C;e[37]!==t?(C=t("Run migration"),e[37]=t,e[38]=C):C=e[38];let S;e[39]!==C?(S=r(ue,{children:C}),e[39]=C,e[40]=S):S=e[40];let I;e[41]!==t?(I=t("Migration id"),e[41]=t,e[42]=I):I=e[42];let E;e[43]!==t?(E=t("migration id"),e[43]=t,e[44]=E):E=e[44];let M;e[45]!==h||e[46]!==I||e[47]!==E?(M=r(Ae,{"aria-label":I,className:"w-auto","data-testid":"mg-id-input",onChange:ve,placeholder:E,value:h}),e[45]=h,e[46]=I,e[47]=E,e[48]=M):M=e[48];let T;e[49]!==t?(T=t("Direction"),e[49]=t,e[50]=T):T=e[50];let _;e[51]!==t?(_=t("up"),e[51]=t,e[52]=_):_=e[52];let k;e[53]!==_?(k=r("option",{value:"up",children:_}),e[53]=_,e[54]=k):k=e[54];let L;e[55]!==t?(L=t("down"),e[55]=t,e[56]=L):L=e[56];let w;e[57]!==L?(w=r("option",{value:"down",children:L}),e[57]=L,e[58]=w):w=e[58];let D;e[59]!==p||e[60]!==T||e[61]!==k||e[62]!==w?(D=s("select",{"aria-label":T,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:xe,value:p,children:[k,w]}),e[59]=p,e[60]=T,e[61]=k,e[62]=w,e[63]=D):D=e[63];let B;e[64]!==l?(B=r("input",{checked:l,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:Re,type:"checkbox"}),e[64]=l,e[65]=B):B=e[65];let A;e[66]!==t?(A=t("Dry run"),e[66]=t,e[67]=A):A=e[67];let K;e[68]!==B||e[69]!==A?(K=s(ue,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[B,A]}),e[68]=B,e[69]=A,e[70]=K):K=e[70];let j;e[71]!==l||e[72]!==X||e[73]!==g||e[74]!==z||e[75]!==t?(j=l?r(Le,{"data-testid":"mg-run",disabled:g||!z,onClick:X,type:"button",children:t(g?"Running…":"Run")}):r(Ee,{confirmLabel:t(g?"Running…":"Run migration?"),disabled:g||!z,onConfirm:X,testId:"mg-run",children:t("Run")}),e[71]=l,e[72]=X,e[73]=g,e[74]=z,e[75]=t,e[76]=j):j=e[76];let F;e[77]!==M||e[78]!==D||e[79]!==K||e[80]!==j?(F=s("div",{className:"flex flex-wrap items-center gap-2",children:[M,D,K,j]}),e[77]=M,e[78]=D,e[79]=K,e[80]=j,e[81]=F):F=e[81];let O;e[82]!==S||e[83]!==F?(O=s("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[S,F]}),e[82]=S,e[83]=F,e[84]=O):O=e[84];let q;e[85]!==U?(q=U!==null&&r("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:U}),e[85]=U,e[86]=q):q=e[86];let H;e[87]!==c||e[88]!==t?(H=c!==null&&s("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[c.dryRun?t("Dry run: "):"",t("{status} — processed",{status:c.status}),c.processed,t(", changed"),c.changed]}),e[87]=c,e[88]=t,e[89]=H):H=e[89];let te;return e[90]!==v||e[91]!==x||e[92]!==R||e[93]!==N||e[94]!==O||e[95]!==q||e[96]!==H?(te=s("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[v,x,R,N,O,q,H]}),e[90]=v,e[91]=x,e[92]=R,e[93]=N,e[94]=O,e[95]=q,e[96]=H,e[97]=te):te=e[97],te};function Je(i){return s(fe,{"data-testid":`mg-row-${i.id}`,children:[r(f,{children:i.id}),r(f,{children:i.direction}),r(f,{children:r(ke,{variant:"secondary",children:i.status})}),r(f,{children:i.processed}),r(f,{children:i.changed}),r(f,{children:Qe(i.updatedAt)}),r(f,{children:i.error??""})]},i.id)}export{yt as MigrationsPanel};
@@ -1 +1 @@
1
- import{c as k}from"react/compiler-runtime";import{useLunora as O}from"@lunora/react";import{E as g}from"./empty-state-D7jEML_T.mjs";import{S as y}from"./skeleton-DX1gfixl.mjs";import{u as R,R as S}from"./reference-view-DiikOols.mjs";import{useT as P}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsxs as h,jsx as l}from"react/jsx-runtime";const x=n=>(n.params??[]).find(e=>e.name==="args")??(n.params??[])[0],v=n=>n["x-tags"]?.[0]?.name??(n.name.includes(":")?n.name.slice(0,n.name.indexOf(":")):""),w=n=>{const e=x(n)?.schema;return{argsSchema:e,description:n.description,functionPath:n.name,httpPath:"/_lunora/rpc",key:n.name,kind:n["x-lunora-function-kind"],method:"POST",operationId:n.name,requestSchema:e,responses:[{description:n.result?.name,schema:n.result?.schema,status:"200"}],summary:n.summary??n.name,tags:[v(n)],title:n.summary??n.name}},I=n=>{const e=n??{},m=(e.methods??[]).map(a=>w(a)),r=new Map;for(const a of m){const i=a.tags[0]??"",s=r.get(i)??[];s.push(a),r.set(i,s)}return{groups:[...r.entries()].map(([a,i])=>({name:a,operations:i.toSorted((s,p)=>s.operationId.localeCompare(p.operationId))})).toSorted((a,i)=>a.name.localeCompare(i.name)),operationByKey:new Map(m.map(a=>[a.key,a])),title:e.info?.title??"API reference",version:e.info?.version}},C=n=>n.methods===void 0||n.methods.length===0,N=n=>{const e=n;return C(e)?{kind:"empty"}:{kind:"ready",spec:e}},T=n=>{const e=k(23),{spec:m}=n,r=P(),f=O();let a;e[0]!==f?(a=()=>f.fetchOpenRpc(),e[0]=f,e[1]=a):a=e[1];const s=R(m,a,N);let p;e[2]!==s.kind||e[3]!==s.spec?(p=s.kind==="ready"?I(s.spec):void 0,e[2]=s.kind,e[3]=s.spec,e[4]=p):p=e[4];const u=p;if(s.kind==="loading"){let t;return e[5]===Symbol.for("react.memo_cache_sentinel")?(t=h("div",{className:"flex flex-col gap-4","data-testid":"openrpc-reference-loading",children:[l(y,{className:"h-8 w-48"}),l(y,{className:"h-64 w-full"})]}),e[5]=t):t=e[5],t}if(s.kind==="error"){let t;e[6]!==s.message||e[7]!==r?(t=r("Couldn't load the OpenRPC spec: {message}",{message:s.message}),e[6]=s.message,e[7]=r,e[8]=t):t=e[8];let o;e[9]!==r?(o=r("API reference unavailable"),e[9]=r,e[10]=o):o=e[10];let c;return e[11]!==t||e[12]!==o?(c=l(g,{description:t,testId:"openrpc-reference-error",title:o}),e[11]=t,e[12]=o,e[13]=c):c=e[13],c}if(s.kind==="empty"||u===void 0){let t;e[14]!==r?(t=r("Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here."),e[14]=r,e[15]=t):t=e[15];let o;e[16]!==r?(o=r("No OpenRPC spec configured"),e[16]=r,e[17]=o):o=e[17];let c;return e[18]!==t||e[19]!==o?(c=l(g,{description:t,testId:"openrpc-reference-empty",title:o}),e[18]=t,e[19]=o,e[20]=c):c=e[20],c}let d;return e[21]!==u?(d=l(S,{model:u}),e[21]=u,e[22]=d):d=e[22],d};export{T as default};
1
+ import{c as k}from"react/compiler-runtime";import{useLunora as O}from"@lunora/react";import{E as g}from"./empty-state-D7jEML_T.mjs";import{S as y}from"./skeleton-DX1gfixl.mjs";import{u as R,R as S}from"./reference-view-vNXUVPlA.mjs";import{useT as P}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsxs as h,jsx as l}from"react/jsx-runtime";const x=n=>(n.params??[]).find(e=>e.name==="args")??(n.params??[])[0],v=n=>n["x-tags"]?.[0]?.name??(n.name.includes(":")?n.name.slice(0,n.name.indexOf(":")):""),w=n=>{const e=x(n)?.schema;return{argsSchema:e,description:n.description,functionPath:n.name,httpPath:"/_lunora/rpc",key:n.name,kind:n["x-lunora-function-kind"],method:"POST",operationId:n.name,requestSchema:e,responses:[{description:n.result?.name,schema:n.result?.schema,status:"200"}],summary:n.summary??n.name,tags:[v(n)],title:n.summary??n.name}},I=n=>{const e=n??{},m=(e.methods??[]).map(a=>w(a)),r=new Map;for(const a of m){const i=a.tags[0]??"",s=r.get(i)??[];s.push(a),r.set(i,s)}return{groups:[...r.entries()].map(([a,i])=>({name:a,operations:i.toSorted((s,p)=>s.operationId.localeCompare(p.operationId))})).toSorted((a,i)=>a.name.localeCompare(i.name)),operationByKey:new Map(m.map(a=>[a.key,a])),title:e.info?.title??"API reference",version:e.info?.version}},C=n=>n.methods===void 0||n.methods.length===0,N=n=>{const e=n;return C(e)?{kind:"empty"}:{kind:"ready",spec:e}},T=n=>{const e=k(23),{spec:m}=n,r=P(),f=O();let a;e[0]!==f?(a=()=>f.fetchOpenRpc(),e[0]=f,e[1]=a):a=e[1];const s=R(m,a,N);let p;e[2]!==s.kind||e[3]!==s.spec?(p=s.kind==="ready"?I(s.spec):void 0,e[2]=s.kind,e[3]=s.spec,e[4]=p):p=e[4];const u=p;if(s.kind==="loading"){let t;return e[5]===Symbol.for("react.memo_cache_sentinel")?(t=h("div",{className:"flex flex-col gap-4","data-testid":"openrpc-reference-loading",children:[l(y,{className:"h-8 w-48"}),l(y,{className:"h-64 w-full"})]}),e[5]=t):t=e[5],t}if(s.kind==="error"){let t;e[6]!==s.message||e[7]!==r?(t=r("Couldn't load the OpenRPC spec: {message}",{message:s.message}),e[6]=s.message,e[7]=r,e[8]=t):t=e[8];let o;e[9]!==r?(o=r("API reference unavailable"),e[9]=r,e[10]=o):o=e[10];let c;return e[11]!==t||e[12]!==o?(c=l(g,{description:t,testId:"openrpc-reference-error",title:o}),e[11]=t,e[12]=o,e[13]=c):c=e[13],c}if(s.kind==="empty"||u===void 0){let t;e[14]!==r?(t=r("Run `lunora codegen --api-spec openrpc` and wire `_generated/openrpc.json` to the worker to render the OpenRPC reference here."),e[14]=r,e[15]=t):t=e[15];let o;e[16]!==r?(o=r("No OpenRPC spec configured"),e[16]=r,e[17]=o):o=e[17];let c;return e[18]!==t||e[19]!==o?(c=l(g,{description:t,testId:"openrpc-reference-empty",title:o}),e[18]=t,e[19]=o,e[20]=c):c=e[20],c}let d;return e[21]!==u?(d=l(S,{model:u}),e[21]=u,e[22]=d):d=e[22],d};export{T as default};
@@ -1 +1 @@
1
- import{c as I}from"react/compiler-runtime";import{useLunora as $}from"@lunora/react";import{useState as T,useEffect as H}from"react";import{ConfirmButton as M}from"./ConfirmButton-DU4p72Er.mjs";import{C as P,a as Q}from"./card--2hKx4L2.mjs";import{E as R}from"./empty-state-D7jEML_T.mjs";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-D0SBiDu-.mjs";import{b as V}from"./use-admin-query-BKXiqLci.mjs";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as G,h as O,b as U}from"./internal-B6haJbiP.mjs";import{jsx as t,jsxs as p}from"react/jsx-runtime";const X=s=>Number.isFinite(s)?O(s,"—"):"—",F=s=>s.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),Y=(s,e,u)=>e!==void 0?e:u===void 0?f=>s.cancelScheduledJob(f):void 0,he=s=>{const e=I(16),{cancelJob:u,loadJobs:f}=s===void 0?{}:s,n=$(),o=z(),c=f===void 0;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=["lunora-scheduled-jobs"],e[0]=b):b=e[0];const d=V(b,async()=>{const r=await(f??(()=>n.listScheduledJobs()))();return F(r)}),[L,j]=T(void 0),[k,w]=T(void 0);let v,x;e[1]!==n||e[2]!==c?(v=()=>{if(c)return n.subscribeScheduledJobs(r=>{w(void 0),j(F(r))})},x=[c,n],e[1]=n,e[2]=c,e[3]=v,e[4]=x):(v=e[3],x=e[4]),H(v,x);let y;e[5]!==d?(y=()=>{d.refetch()},e[5]=d,e[6]=y):y=e[6],W(y,!c);const C=Y(n,u,f),a=L??d.data,N=k??d.error,A=async r=>{if(C!==void 0){w(void 0);try{await C(r),c||d.refetch()}catch(_){w(U(_))}}},E="flex flex-col gap-3",B="lunora-scheduled-jobs";let m;e[7]!==N?(m=N!==null&&t("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:N}),e[7]=N,e[8]=m):m=e[8];let h;e[9]!==a?.length||e[10]!==o?(h=a?.length===0&&t(R,{description:o("Jobs queued with runAfter / runAt will appear here."),icon:p("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:o("No scheduled jobs.")}),e[9]=a?.length,e[10]=o,e[11]=h):h=e[11];const S=a!==void 0&&a.length>0&&t(P,{className:"overflow-hidden py-0",children:t(Q,{className:"px-0",children:p(q,{"data-testid":"sj-table",children:[t(D,{children:p(J,{children:[t(l,{children:o("function")}),t(l,{children:o("scheduled for")}),t(l,{children:o("pool")}),t(l,{children:o("attempts")}),t(l,{children:o("shard")}),t(l,{children:o("id")}),C!==void 0&&t(l,{"aria-label":o("Actions")})]})}),t(K,{children:a.map(r=>p(J,{"data-testid":`sj-row-${r.id}`,children:[t(i,{className:"font-mono text-xs",children:r.workflow??r.functionPath}),t(i,{className:"text-muted-foreground tabular-nums",children:X(r.scheduledFor)}),t(i,{className:"font-mono text-xs",children:r.pool??""}),t(i,{className:"tabular-nums",children:r.attempts??0}),t(i,{children:r.shardKey??""}),t(i,{className:"font-mono text-xs",children:r.id}),C!==void 0&&t(i,{className:"text-right",children:t(M,{confirmLabel:o("Cancel job?"),onConfirm:()=>{G(A(r.id))},testId:`sj-cancel-${r.id}`,children:o("Cancel")})})]},r.id))})]})})});let g;return e[12]!==S||e[13]!==m||e[14]!==h?(g=p("div",{className:E,"data-testid":B,children:[m,h,S]}),e[12]=S,e[13]=m,e[14]=h,e[15]=g):g=e[15],g};export{he as ScheduledJobs};
1
+ import{c as I}from"react/compiler-runtime";import{useLunora as $}from"@lunora/react";import{useState as T,useEffect as H}from"react";import{ConfirmButton as M}from"./ConfirmButton-DU4p72Er.mjs";import{C as P,a as Q}from"./card--2hKx4L2.mjs";import{E as R}from"./empty-state-D7jEML_T.mjs";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-D0SBiDu-.mjs";import{b as V}from"./use-admin-query-CR9mHt0P.mjs";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as G,h as O,b as U}from"./internal-CyDwqA67.mjs";import{jsx as t,jsxs as p}from"react/jsx-runtime";const X=s=>Number.isFinite(s)?O(s,"—"):"—",F=s=>s.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),Y=(s,e,u)=>e!==void 0?e:u===void 0?f=>s.cancelScheduledJob(f):void 0,he=s=>{const e=I(16),{cancelJob:u,loadJobs:f}=s===void 0?{}:s,n=$(),o=z(),c=f===void 0;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=["lunora-scheduled-jobs"],e[0]=b):b=e[0];const d=V(b,async()=>{const r=await(f??(()=>n.listScheduledJobs()))();return F(r)}),[L,j]=T(void 0),[k,w]=T(void 0);let v,x;e[1]!==n||e[2]!==c?(v=()=>{if(c)return n.subscribeScheduledJobs(r=>{w(void 0),j(F(r))})},x=[c,n],e[1]=n,e[2]=c,e[3]=v,e[4]=x):(v=e[3],x=e[4]),H(v,x);let y;e[5]!==d?(y=()=>{d.refetch()},e[5]=d,e[6]=y):y=e[6],W(y,!c);const C=Y(n,u,f),a=L??d.data,N=k??d.error,A=async r=>{if(C!==void 0){w(void 0);try{await C(r),c||d.refetch()}catch(_){w(U(_))}}},E="flex flex-col gap-3",B="lunora-scheduled-jobs";let m;e[7]!==N?(m=N!==null&&t("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:N}),e[7]=N,e[8]=m):m=e[8];let h;e[9]!==a?.length||e[10]!==o?(h=a?.length===0&&t(R,{description:o("Jobs queued with runAfter / runAt will appear here."),icon:p("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:o("No scheduled jobs.")}),e[9]=a?.length,e[10]=o,e[11]=h):h=e[11];const S=a!==void 0&&a.length>0&&t(P,{className:"overflow-hidden py-0",children:t(Q,{className:"px-0",children:p(q,{"data-testid":"sj-table",children:[t(D,{children:p(J,{children:[t(l,{children:o("function")}),t(l,{children:o("scheduled for")}),t(l,{children:o("pool")}),t(l,{children:o("attempts")}),t(l,{children:o("shard")}),t(l,{children:o("id")}),C!==void 0&&t(l,{"aria-label":o("Actions")})]})}),t(K,{children:a.map(r=>p(J,{"data-testid":`sj-row-${r.id}`,children:[t(i,{className:"font-mono text-xs",children:r.workflow??r.functionPath}),t(i,{className:"text-muted-foreground tabular-nums",children:X(r.scheduledFor)}),t(i,{className:"font-mono text-xs",children:r.pool??""}),t(i,{className:"tabular-nums",children:r.attempts??0}),t(i,{children:r.shardKey??""}),t(i,{className:"font-mono text-xs",children:r.id}),C!==void 0&&t(i,{className:"text-right",children:t(M,{confirmLabel:o("Cancel job?"),onConfirm:()=>{G(A(r.id))},testId:`sj-cancel-${r.id}`,children:o("Cancel")})})]},r.id))})]})})});let g;return e[12]!==S||e[13]!==m||e[14]!==h?(g=p("div",{className:E,"data-testid":B,children:[m,h,S]}),e[12]=S,e[13]=m,e[14]=h,e[15]=g):g=e[15],g};export{he as ScheduledJobs};
@@ -0,0 +1 @@
1
+ import{S as b}from"./studio-BVQq3QLR.mjs";import"./ErrorBoundary-BWNF98VF.mjs";import"./operation-console-provider-DoloEvon.mjs";import"./badge-r_5B4LHP.mjs";import"./input-CXhxesPC.mjs";import"./skeleton-DX1gfixl.mjs";import"./home-panel-B_HN6YMA.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./StudioI18nProvider-fVsCSs5L.mjs";import"./data-view-params-DhYmAkcj.mjs";import"./internal-CyDwqA67.mjs";import"./utils-bhneXptQ.mjs";import"./CommandPalette-D7GxhPrH.mjs";export{b as Studio};
@@ -1 +1 @@
1
- import{c as O}from"react/compiler-runtime";import{LunoraClient as G}from"@lunora/client";import{LunoraProvider as H}from"@lunora/react";import{useState as B,useEffect as $}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.mjs";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-OqNyRY1N.mjs";import Q from"./useDebounced-DVeQ5-oW.mjs";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{StudioI18nProvider as D}from"./StudioI18nProvider-fVsCSs5L.mjs";import{r as Z}from"./internal-B6haJbiP.mjs";import{w as R}from"./recording-client-BXUIyBL4.mjs";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.mjs";import{a as K}from"./browser-storage-BH1MxLZs.mjs";import{c as W}from"./utils-bhneXptQ.mjs";import{B as ee}from"./button-q0UYSmrn.mjs";import{I as te}from"./input-CXhxesPC.mjs";import{jsx as m,jsxs as P}from"react/jsx-runtime";const L="lunora-studio-admin-token",oe=()=>{try{return K("session")?.getItem(L)??""}catch{return""}},ne=u=>{const e=K("session");if(e!==void 0)try{u===""?e.removeItem(L):e.setItem(L,u)}catch{}},se="/_lunora/admin/ws-token",ie=1e4,re=u=>{const e=u;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},le=u=>{const{adminToken:e,baseUrl:d}=u,o=u.fetchImpl??fetch;let r=d;for(;r.endsWith("/");)r=r.slice(0,-1);const l=`${r}${se}`;let t,n=!1,s;const a=async()=>{const c=await o(l,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(c.status===404||c.status===405)return n=!0,e;if(!c.ok)throw new Error(`ws-token mint failed: ${String(c.status)}`);const i=await c.json().catch(()=>{});if(!re(i))throw new Error("ws-token mint failed: malformed response body");return t=i,i.token};return{getToken:async()=>n?e:t!==void 0&&t.expiresAtMs-ie>Date.now()?t.token:(s??=a().finally(()=>{s=void 0}),s),invalidate:()=>{t=void 0,n=!1}}},ae=u=>{const e=O(42),{onSubmit:d}=u,o=j(),[r,l]=B("");let t;e[0]!==r?(t=r.trim(),e[0]=r,e[1]=t):t=e[1];const n=t;let s;e[2]!==d||e[3]!==n?(s=_=>{_.preventDefault(),n!==""&&d(n)},e[2]=d,e[3]=n,e[4]=s):s=e[4];const a=s;let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=m("div",{className:"h-10 w-10 text-foreground",children:m(V,{})}),e[5]=c):c=e[5];let i;e[6]!==o?(i=o("Connect to Lunora Studio"),e[6]=o,e[7]=i):i=e[7];let v;e[8]!==i?(v=m("h1",{className:"text-base font-semibold text-foreground",children:i}),e[8]=i,e[9]=v):v=e[9];let k;e[10]!==o?(k=o("Enter your admin token to access the studio."),e[10]=o,e[11]=k):k=e[11];let p;e[12]!==k?(p=m("p",{className:"text-[13px] text-muted-foreground",children:k}),e[12]=k,e[13]=p):p=e[13];let h;e[14]!==v||e[15]!==p?(h=P("div",{className:"flex flex-col items-center gap-3 text-center",children:[c,P("div",{className:"flex flex-col gap-1",children:[v,p]})]}),e[14]=v,e[15]=p,e[16]=h):h=e[16];let g;e[17]!==o?(g=o("admin token"),e[17]=o,e[18]=g):g=e[18];let f;e[19]!==g?(f=m("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:g}),e[19]=g,e[20]=f):f=e[20];let b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=_=>{l(_.target.value)},e[21]=b):b=e[21];let x;e[22]!==r?(x=m(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:b,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:r}),e[22]=r,e[23]=x):x=e[23];let T;e[24]!==o?(T=o("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production."),e[24]=o,e[25]=T):T=e[25];let I;e[26]!==T?(I=m("p",{className:"text-[11px] text-muted-foreground",children:T}),e[26]=T,e[27]=I):I=e[27];let S;e[28]!==f||e[29]!==x||e[30]!==I?(S=P("div",{className:"flex flex-col gap-1.5",children:[f,x,I]}),e[28]=f,e[29]=x,e[30]=I,e[31]=S):S=e[31];const E=n==="";let y;e[32]!==o?(y=o("Connect"),e[32]=o,e[33]=y):y=e[33];let w;e[34]!==E||e[35]!==y?(w=m(ee,{"data-testid":"lunora-studio-login-submit",disabled:E,type:"submit",children:y}),e[34]=E,e[35]=y,e[36]=w):w=e[36];let N;return e[37]!==a||e[38]!==S||e[39]!==w||e[40]!==h?(N=P("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:a,children:[h,S,w]}),e[37]=a,e[38]=S,e[39]=w,e[40]=h,e[41]=N):N=e[41],N},de=u=>{const e=O(10),{i18n:d,onSubmit:o}=u,{resolvedTheme:r}=U(),l=r==="dark"&&"dark";let t;e[0]!==l?(t=W(F,l,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=l,e[1]=t):t=e[1];let n;e[2]!==o?(n=m(ae,{onSubmit:o}),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==d||e[5]!==n?(s=m(D,{i18n:d,children:n}),e[4]=d,e[5]=n,e[6]=s):s=e[6];let a;return e[7]!==t||e[8]!==s?(a=m("div",{className:t,"data-testid":"lunora-studio-login-root",children:s}),e[7]=t,e[8]=s,e[9]=a):a=e[9],a},ce=u=>{const e=O(15),{basePath:d,chrome:o,studio:r}=u,l=j();let t;e[0]!==l?(t=l("Studio failed"),e[0]=l,e[1]=t):t=e[1];let n;e[2]!==l?(n=l("Studio"),e[2]=l,e[3]=n):n=e[3];let s;e[4]!==l?(s=l("Try again"),e[4]=l,e[5]=s):s=e[5];let a;e[6]!==d||e[7]!==o||e[8]!==r?(a=m(J,{...r,basePath:d,chrome:o}),e[6]=d,e[7]=o,e[8]=r,e[9]=a):a=e[9];let c;return e[10]!==t||e[11]!==n||e[12]!==s||e[13]!==a?(c=m(z,{fallbackTitle:t,label:n,retryLabel:s,children:a}),e[10]=t,e[11]=n,e[12]=s,e[13]=a,e[14]=c):c=e[14],c},fe=u=>{const e=O(20),{basePath:d,clearToken:o,client:r,i18n:l,onTokenChange:t,rulesInstalled:n,studio:s,token:a}=u,{resolvedTheme:c}=U();let i;e[0]!==o||e[1]!==t||e[2]!==n||e[3]!==a?(i={clearToken:o,onTokenChange:t,rulesInstalled:n,token:a},e[0]=o,e[1]=t,e[2]=n,e[3]=a,e[4]=i):i=e[4];const v=i,k=c==="dark"&&"dark";let p;e[5]!==k?(p=W(F,k,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=k,e[6]=p):p=e[6];let h;e[7]!==d||e[8]!==v||e[9]!==s?(h=m(q,{children:m(ce,{basePath:d,chrome:v,studio:s})}),e[7]=d,e[8]=v,e[9]=s,e[10]=h):h=e[10];let g;e[11]!==l||e[12]!==h?(g=m(D,{i18n:l,children:h}),e[11]=l,e[12]=h,e[13]=g):g=e[13];let f;e[14]!==r||e[15]!==g?(f=m(H,{client:r,children:g}),e[14]=r,e[15]=g,e[16]=f):f=e[16];let b;return e[17]!==p||e[18]!==f?(b=m("div",{className:p,"data-testid":"lunora-studio-app",children:f}),e[17]=p,e[18]=f,e[19]=b):b=e[19],b},Ee=u=>{const e=O(28);let d;e[0]!==u?(d=u===void 0?{}:u,e[0]=u,e[1]=d):d=e[1];const{adminToken:o,basePath:r,baseUrl:l,client:t,rulesInstalled:n,studio:s,locale:a}=d;let c;e[2]!==o?(c=()=>o??oe(),e[2]=o,e[3]=c):c=e[3];const[i,v]=B(c);let k,p;e[4]!==i?(k=()=>{ne(i)},p=[i],e[4]=i,e[5]=k,e[6]=p):(k=e[5],p=e[6]),$(k,p);const h=Q(i,300,i==="");let g;e:{if(t!==void 0){let A;e[7]!==t?(A=R(t),e[7]=t,e[8]=A):A=e[8],g=A;break e}let _;if(e[9]!==l||e[10]!==h){const A=Z(l),M=h===""?void 0:le({adminToken:h,baseUrl:A}),C=new G({url:A,...M===void 0?{}:{wsToken:M.getToken}});M!==void 0&&(C.setAuthToken(h),C.onTokenExpired(M.invalidate)),_=R(C),e[9]=l,e[10]=h,e[11]=_}else _=e[11];g=_}const f=g;let b,x;e[12]!==f||e[13]!==t?(b=()=>()=>{t===void 0&&f.close()},x=[f,t],e[12]=f,e[13]=t,e[14]=b,e[15]=x):(b=e[14],x=e[15]),$(b,x);let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=_=>{v(_.target.value)},e[16]=T):T=e[16];const I=T;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{v("")},e[17]=S):S=e[17];const E=S;let y;e[18]!==a?(y=X(a),e[18]=a,e[19]=y):y=e[19];const w=y;let N;return e[20]!==r||e[21]!==f||e[22]!==w||e[23]!==t||e[24]!==n||e[25]!==s||e[26]!==i?(N=m(Y,{children:i===""&&t===void 0?m(de,{i18n:w,onSubmit:v}):m(fe,{basePath:r,clearToken:E,client:f,i18n:w,onTokenChange:I,rulesInstalled:n,studio:s,token:i})}),e[20]=r,e[21]=f,e[22]=w,e[23]=t,e[24]=n,e[25]=s,e[26]=i,e[27]=N):N=e[27],N};export{Ee as StudioApp};
1
+ import{c as O}from"react/compiler-runtime";import{LunoraClient as G}from"@lunora/client";import{LunoraProvider as H}from"@lunora/react";import{useState as B,useEffect as $}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.mjs";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-BVQq3QLR.mjs";import Q from"./useDebounced-DVeQ5-oW.mjs";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{StudioI18nProvider as D}from"./StudioI18nProvider-fVsCSs5L.mjs";import{r as Z}from"./internal-CyDwqA67.mjs";import{w as R}from"./recording-client-CjRFjhya.mjs";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.mjs";import{a as K}from"./browser-storage-BH1MxLZs.mjs";import{c as W}from"./utils-bhneXptQ.mjs";import{B as ee}from"./button-q0UYSmrn.mjs";import{I as te}from"./input-CXhxesPC.mjs";import{jsx as m,jsxs as P}from"react/jsx-runtime";const L="lunora-studio-admin-token",oe=()=>{try{return K("session")?.getItem(L)??""}catch{return""}},ne=u=>{const e=K("session");if(e!==void 0)try{u===""?e.removeItem(L):e.setItem(L,u)}catch{}},se="/_lunora/admin/ws-token",ie=1e4,re=u=>{const e=u;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},le=u=>{const{adminToken:e,baseUrl:d}=u,o=u.fetchImpl??fetch;let r=d;for(;r.endsWith("/");)r=r.slice(0,-1);const l=`${r}${se}`;let t,n=!1,s;const a=async()=>{const c=await o(l,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(c.status===404||c.status===405)return n=!0,e;if(!c.ok)throw new Error(`ws-token mint failed: ${String(c.status)}`);const i=await c.json().catch(()=>{});if(!re(i))throw new Error("ws-token mint failed: malformed response body");return t=i,i.token};return{getToken:async()=>n?e:t!==void 0&&t.expiresAtMs-ie>Date.now()?t.token:(s??=a().finally(()=>{s=void 0}),s),invalidate:()=>{t=void 0,n=!1}}},ae=u=>{const e=O(42),{onSubmit:d}=u,o=j(),[r,l]=B("");let t;e[0]!==r?(t=r.trim(),e[0]=r,e[1]=t):t=e[1];const n=t;let s;e[2]!==d||e[3]!==n?(s=_=>{_.preventDefault(),n!==""&&d(n)},e[2]=d,e[3]=n,e[4]=s):s=e[4];const a=s;let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=m("div",{className:"h-10 w-10 text-foreground",children:m(V,{})}),e[5]=c):c=e[5];let i;e[6]!==o?(i=o("Connect to Lunora Studio"),e[6]=o,e[7]=i):i=e[7];let v;e[8]!==i?(v=m("h1",{className:"text-base font-semibold text-foreground",children:i}),e[8]=i,e[9]=v):v=e[9];let k;e[10]!==o?(k=o("Enter your admin token to access the studio."),e[10]=o,e[11]=k):k=e[11];let p;e[12]!==k?(p=m("p",{className:"text-[13px] text-muted-foreground",children:k}),e[12]=k,e[13]=p):p=e[13];let h;e[14]!==v||e[15]!==p?(h=P("div",{className:"flex flex-col items-center gap-3 text-center",children:[c,P("div",{className:"flex flex-col gap-1",children:[v,p]})]}),e[14]=v,e[15]=p,e[16]=h):h=e[16];let g;e[17]!==o?(g=o("admin token"),e[17]=o,e[18]=g):g=e[18];let f;e[19]!==g?(f=m("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:g}),e[19]=g,e[20]=f):f=e[20];let b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=_=>{l(_.target.value)},e[21]=b):b=e[21];let x;e[22]!==r?(x=m(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:b,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:r}),e[22]=r,e[23]=x):x=e[23];let T;e[24]!==o?(T=o("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production."),e[24]=o,e[25]=T):T=e[25];let I;e[26]!==T?(I=m("p",{className:"text-[11px] text-muted-foreground",children:T}),e[26]=T,e[27]=I):I=e[27];let S;e[28]!==f||e[29]!==x||e[30]!==I?(S=P("div",{className:"flex flex-col gap-1.5",children:[f,x,I]}),e[28]=f,e[29]=x,e[30]=I,e[31]=S):S=e[31];const E=n==="";let y;e[32]!==o?(y=o("Connect"),e[32]=o,e[33]=y):y=e[33];let w;e[34]!==E||e[35]!==y?(w=m(ee,{"data-testid":"lunora-studio-login-submit",disabled:E,type:"submit",children:y}),e[34]=E,e[35]=y,e[36]=w):w=e[36];let N;return e[37]!==a||e[38]!==S||e[39]!==w||e[40]!==h?(N=P("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:a,children:[h,S,w]}),e[37]=a,e[38]=S,e[39]=w,e[40]=h,e[41]=N):N=e[41],N},de=u=>{const e=O(10),{i18n:d,onSubmit:o}=u,{resolvedTheme:r}=U(),l=r==="dark"&&"dark";let t;e[0]!==l?(t=W(F,l,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=l,e[1]=t):t=e[1];let n;e[2]!==o?(n=m(ae,{onSubmit:o}),e[2]=o,e[3]=n):n=e[3];let s;e[4]!==d||e[5]!==n?(s=m(D,{i18n:d,children:n}),e[4]=d,e[5]=n,e[6]=s):s=e[6];let a;return e[7]!==t||e[8]!==s?(a=m("div",{className:t,"data-testid":"lunora-studio-login-root",children:s}),e[7]=t,e[8]=s,e[9]=a):a=e[9],a},ce=u=>{const e=O(15),{basePath:d,chrome:o,studio:r}=u,l=j();let t;e[0]!==l?(t=l("Studio failed"),e[0]=l,e[1]=t):t=e[1];let n;e[2]!==l?(n=l("Studio"),e[2]=l,e[3]=n):n=e[3];let s;e[4]!==l?(s=l("Try again"),e[4]=l,e[5]=s):s=e[5];let a;e[6]!==d||e[7]!==o||e[8]!==r?(a=m(J,{...r,basePath:d,chrome:o}),e[6]=d,e[7]=o,e[8]=r,e[9]=a):a=e[9];let c;return e[10]!==t||e[11]!==n||e[12]!==s||e[13]!==a?(c=m(z,{fallbackTitle:t,label:n,retryLabel:s,children:a}),e[10]=t,e[11]=n,e[12]=s,e[13]=a,e[14]=c):c=e[14],c},fe=u=>{const e=O(20),{basePath:d,clearToken:o,client:r,i18n:l,onTokenChange:t,rulesInstalled:n,studio:s,token:a}=u,{resolvedTheme:c}=U();let i;e[0]!==o||e[1]!==t||e[2]!==n||e[3]!==a?(i={clearToken:o,onTokenChange:t,rulesInstalled:n,token:a},e[0]=o,e[1]=t,e[2]=n,e[3]=a,e[4]=i):i=e[4];const v=i,k=c==="dark"&&"dark";let p;e[5]!==k?(p=W(F,k,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=k,e[6]=p):p=e[6];let h;e[7]!==d||e[8]!==v||e[9]!==s?(h=m(q,{children:m(ce,{basePath:d,chrome:v,studio:s})}),e[7]=d,e[8]=v,e[9]=s,e[10]=h):h=e[10];let g;e[11]!==l||e[12]!==h?(g=m(D,{i18n:l,children:h}),e[11]=l,e[12]=h,e[13]=g):g=e[13];let f;e[14]!==r||e[15]!==g?(f=m(H,{client:r,children:g}),e[14]=r,e[15]=g,e[16]=f):f=e[16];let b;return e[17]!==p||e[18]!==f?(b=m("div",{className:p,"data-testid":"lunora-studio-app",children:f}),e[17]=p,e[18]=f,e[19]=b):b=e[19],b},Ee=u=>{const e=O(28);let d;e[0]!==u?(d=u===void 0?{}:u,e[0]=u,e[1]=d):d=e[1];const{adminToken:o,basePath:r,baseUrl:l,client:t,rulesInstalled:n,studio:s,locale:a}=d;let c;e[2]!==o?(c=()=>o??oe(),e[2]=o,e[3]=c):c=e[3];const[i,v]=B(c);let k,p;e[4]!==i?(k=()=>{ne(i)},p=[i],e[4]=i,e[5]=k,e[6]=p):(k=e[5],p=e[6]),$(k,p);const h=Q(i,300,i==="");let g;e:{if(t!==void 0){let A;e[7]!==t?(A=R(t),e[7]=t,e[8]=A):A=e[8],g=A;break e}let _;if(e[9]!==l||e[10]!==h){const A=Z(l),M=h===""?void 0:le({adminToken:h,baseUrl:A}),C=new G({url:A,...M===void 0?{}:{wsToken:M.getToken}});M!==void 0&&(C.setAuthToken(h),C.onTokenExpired(M.invalidate)),_=R(C),e[9]=l,e[10]=h,e[11]=_}else _=e[11];g=_}const f=g;let b,x;e[12]!==f||e[13]!==t?(b=()=>()=>{t===void 0&&f.close()},x=[f,t],e[12]=f,e[13]=t,e[14]=b,e[15]=x):(b=e[14],x=e[15]),$(b,x);let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=_=>{v(_.target.value)},e[16]=T):T=e[16];const I=T;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{v("")},e[17]=S):S=e[17];const E=S;let y;e[18]!==a?(y=X(a),e[18]=a,e[19]=y):y=e[19];const w=y;let N;return e[20]!==r||e[21]!==f||e[22]!==w||e[23]!==t||e[24]!==n||e[25]!==s||e[26]!==i?(N=m(Y,{children:i===""&&t===void 0?m(de,{i18n:w,onSubmit:v}):m(fe,{basePath:r,clearToken:E,client:f,i18n:w,onTokenChange:I,rulesInstalled:n,studio:s,token:i})}),e[20]=r,e[21]=f,e[22]=w,e[23]=t,e[24]=n,e[25]=s,e[26]=i,e[27]=N):N=e[27],N};export{Ee as StudioApp};
@@ -1 +1 @@
1
- import{useState as g}from"react";import{E as x}from"./error-alert-tf5zvSLV.mjs";import{C as N,a as y}from"./card--2hKx4L2.mjs";import{T as v,a as T,b as d,c as m,d as w,e as l}from"./table-D0SBiDu-.mjs";import{useT as E}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{c as L}from"./utils-bhneXptQ.mjs";import{jsxs as o,jsx as t}from"react/jsx-runtime";const C={ERROR:"error",INFO:"info",WARN:"warning"},z=e=>{const a=typeof e.metadata.table=="string"?e.metadata.table:void 0;return{description:`${e.detail} ${e.remediation}`,entity:a,issueType:e.title,key:e.cacheKey,level:C[e.level]}},R=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},$=(e,a)=>({error:e("Errors"),info:e("Info"),warning:e("Warnings")})[a],k=(e,a,n)=>({error:e("{count} errors",{count:n}),info:e("{count} suggestions",{count:n}),warning:e("{count} warnings",{count:n})})[a],V=(e,a)=>({error:e("No errors detected"),info:e("No suggestions"),warning:e("No warnings detected")})[a],O=e=>{const a={error:0,info:0,warning:0};for(const n of e??[])a[n.level]+=1;return a},F=({error:e=null,errorSource:a,rows:n,testId:i,toolbar:p})=>{const s=E(),[c,f]=g("error"),b=O(n),u=(n??[]).filter(r=>r.level===c),h=r=>{f(r.currentTarget.dataset.level)};return o("div",{className:"flex flex-col gap-3","data-testid":i,children:[t("div",{className:"flex border-b border-border",role:"tablist",children:R.map(r=>o("button",{"aria-selected":c===r,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":r,"data-testid":`${i}-tab-${r}`,onClick:h,role:"tab",type:"button",children:[o("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t("span",{"aria-hidden":"true",className:L("size-2 rounded-sm",A[r])}),$(s,r)]}),t("span",{className:"ps-4 text-xs text-muted-foreground",children:k(s,r,b[r])})]},r))}),p!==void 0&&t("div",{className:"flex flex-wrap items-center gap-2",children:p}),e!==null&&t(x,{error:a??e,testId:`${i}-error`}),t(N,{className:"overflow-hidden py-0",children:t(y,{className:"px-0",children:o(v,{children:[t(T,{children:o(d,{children:[t(m,{children:s("Issue type")}),t(m,{children:s("Entity/item")}),t(m,{children:s("Description")})]})}),t(w,{children:u.length===0?t(d,{children:o(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${i}-empty`,children:[t("span",{className:"block text-sm font-medium text-foreground",children:V(s,c)}),t("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(r=>o(d,{children:[t(l,{className:"font-medium text-foreground",children:r.issueType}),t(l,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"—"}),o(l,{className:"text-muted-foreground",children:[t("span",{children:r.description}),r.action!==void 0&&t("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:r.action})]})]},r.key))})]})})})]})};export{F as A,z as a};
1
+ import{useState as g}from"react";import{E as x}from"./error-alert-dQk3g8WI.mjs";import{C as N,a as y}from"./card--2hKx4L2.mjs";import{T as v,a as T,b as d,c as m,d as w,e as l}from"./table-D0SBiDu-.mjs";import{useT as E}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{c as L}from"./utils-bhneXptQ.mjs";import{jsxs as o,jsx as t}from"react/jsx-runtime";const C={ERROR:"error",INFO:"info",WARN:"warning"},z=e=>{const a=typeof e.metadata.table=="string"?e.metadata.table:void 0;return{description:`${e.detail} ${e.remediation}`,entity:a,issueType:e.title,key:e.cacheKey,level:C[e.level]}},R=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},$=(e,a)=>({error:e("Errors"),info:e("Info"),warning:e("Warnings")})[a],k=(e,a,n)=>({error:e("{count} errors",{count:n}),info:e("{count} suggestions",{count:n}),warning:e("{count} warnings",{count:n})})[a],V=(e,a)=>({error:e("No errors detected"),info:e("No suggestions"),warning:e("No warnings detected")})[a],O=e=>{const a={error:0,info:0,warning:0};for(const n of e??[])a[n.level]+=1;return a},F=({error:e=null,errorSource:a,rows:n,testId:i,toolbar:p})=>{const s=E(),[c,f]=g("error"),b=O(n),u=(n??[]).filter(r=>r.level===c),h=r=>{f(r.currentTarget.dataset.level)};return o("div",{className:"flex flex-col gap-3","data-testid":i,children:[t("div",{className:"flex border-b border-border",role:"tablist",children:R.map(r=>o("button",{"aria-selected":c===r,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":r,"data-testid":`${i}-tab-${r}`,onClick:h,role:"tab",type:"button",children:[o("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t("span",{"aria-hidden":"true",className:L("size-2 rounded-sm",A[r])}),$(s,r)]}),t("span",{className:"ps-4 text-xs text-muted-foreground",children:k(s,r,b[r])})]},r))}),p!==void 0&&t("div",{className:"flex flex-wrap items-center gap-2",children:p}),e!==null&&t(x,{error:a??e,testId:`${i}-error`}),t(N,{className:"overflow-hidden py-0",children:t(y,{className:"px-0",children:o(v,{children:[t(T,{children:o(d,{children:[t(m,{children:s("Issue type")}),t(m,{children:s("Entity/item")}),t(m,{children:s("Description")})]})}),t(w,{children:u.length===0?t(d,{children:o(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${i}-empty`,children:[t("span",{className:"block text-sm font-medium text-foreground",children:V(s,c)}),t("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(r=>o(d,{children:[t(l,{className:"font-medium text-foreground",children:r.issueType}),t(l,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"—"}),o(l,{className:"text-muted-foreground",children:[t("span",{children:r.description}),r.action!==void 0&&t("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:r.action})]})]},r.key))})]})})})]})};export{F as A,z as a};
@@ -0,0 +1 @@
1
+ const u=s=>{let t=0,e=0,c=0,o=0,a=0,n=0,r=0;for(const{metrics:l}of s){if(l===null){a+=1;continue}o+=1,t+=l.requests,e+=l.errors,c+=l.databaseSize??0,l.cache&&(n+=l.cache.hits,r+=l.cache.hits+l.cache.misses)}return{failed:a,hitRate:r===0?null:n/r,reachable:o,totalDatabaseSize:c,totalErrors:e,totalRequests:t}},i=(s,t)=>{const e=new Set,c=[];for(const o of["",s.trim(),...t])e.has(o)||(e.add(o),c.push(o));return c},h=s=>{const t=s,e=[];let c=0;for(const a of t.functions??[])a.calls>0&&(e.push({avg:a.totalDurationMs/a.calls,calls:a.calls}),c+=a.calls);e.sort((a,n)=>a.avg-n.avg);const o=a=>{const n=Math.ceil(a/100*c);let r=0;for(const l of e)if(r+=l.calls,r>=n)return l.avg;return e.at(-1)?.avg??0};return{p90:o(90),p95:o(95)}},f=(s,t,e="neutral")=>{const c=t-s,o=s===0?null:c/s*100;return{delta:c,direction:e,pct:o}},g=s=>s.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0}));export{u as aggregateMetrics,f as computeDelta,h as computeLatencyPercentiles,g as enrichQueryStats,i as shardsToAggregate};
@@ -0,0 +1 @@
1
+ import{c as x}from"react/compiler-runtime";import{useState as P}from"react";import{G as d}from"./grid-pagination-DgzyzfBh.mjs";import{jsx as M}from"react/jsx-runtime";const G=o=>{const t=x(18),{count:n,offset:e,onOffsetChange:i,pageSize:s,prefix:a,total:f}=o;if(f===void 0)return null;const c=Math.max(0,Math.floor((f-1)/s)*s),u=e+n<f,g=e>0;let r;t[0]!==e||t[1]!==i||t[2]!==s?(r=()=>{i(e+s)},t[0]=e,t[1]=i,t[2]=s,t[3]=r):r=t[3];let l;t[4]!==c||t[5]!==e||t[6]!==i||t[7]!==s?(l=()=>{i(Math.max(0,Math.min(e-s,c)))},t[4]=c,t[5]=e,t[6]=i,t[7]=s,t[8]=l):l=t[8];const h=n===0?0:e+n,p=n===0?0:e+1;let m;return t[9]!==a||t[10]!==u||t[11]!==g||t[12]!==r||t[13]!==l||t[14]!==h||t[15]!==p||t[16]!==f?(m=M(d,{hasNext:u,hasPrevious:g,onNext:r,onPrevious:l,prefix:a,rangeEnd:h,rangeStart:p,total:f}),t[9]=a,t[10]=u,t[11]=g,t[12]=r,t[13]=l,t[14]=h,t[15]=p,t[16]=f,t[17]=m):m=t[17],m},N=o=>{const t=x(7);let n;t[0]!==o?(n={offset:0,owner:o},t[0]=o,t[1]=n):n=t[1];const[e,i]=P(n);e.owner!==o&&i({offset:0,owner:o});const s=e.owner===o?e.offset:0;let a;t[2]!==o?(a=c=>{i({offset:c,owner:o})},t[2]=o,t[3]=a):a=t[3];let f;return t[4]!==s||t[5]!==a?(f=[s,a],t[4]=s,t[5]=a,t[6]=f):f=t[6],f};export{G as A,N as u};
@@ -1 +1 @@
1
- import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{i as y}from"./internal-B6haJbiP.mjs";import{jsx as i,jsxs as u}from"react/jsx-runtime";const N=(l,e)=>{if(e==="")return[{match:!1,offset:0,text:l}];const a=[],s=l.toLowerCase(),o=e.toLowerCase();let t=0;for(let r=s.indexOf(o);r!==-1;r=s.indexOf(o,t))r>t&&a.push({match:!1,offset:t,text:l.slice(t,r)}),a.push({match:!0,offset:r,text:l.slice(r,r+e.length)}),t=r+e.length;return t<l.length&&a.push({match:!1,offset:t,text:l.slice(t)}),a},v=l=>{const e=x(9),{highlight:a,value:s}=l;if(s==null){let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=n):n=e[0],n}let o,t,r;if(e[1]!==a||e[2]!==s){r=Symbol.for("react.early_return_sentinel");e:{const n=y(s);if(a===void 0||a===""){r=i("span",{title:n,children:n});break e}o=n,t=N(n,a).map(_)}e[1]=a,e[2]=s,e[3]=o,e[4]=t,e[5]=r}else o=e[3],t=e[4],r=e[5];if(r!==Symbol.for("react.early_return_sentinel"))return r;let d;return e[6]!==o||e[7]!==t?(d=i("span",{title:o,children:t}),e[6]=o,e[7]=t,e[8]=d):d=e[8],d},T=l=>{const e=x(22),{columns:a,rows:s}=l,o=w();let t;e[0]!==o?(t=o("Field"),e[0]=o,e[1]=t):t=e[1];let r;e[2]!==t?(r=i("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let d;if(e[4]!==s||e[5]!==o){let c;e[7]!==o?(c=(b,p)=>i("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:o("Row {n}",{n:p+1})},p),e[7]=o,e[8]=c):c=e[8],d=s.map(c),e[4]=s,e[5]=o,e[6]=d}else d=e[6];let n;e[9]!==r||e[10]!==d?(n=i("thead",{className:"sticky top-0 z-10 bg-muted",children:u("tr",{children:[r,d]})}),e[9]=r,e[10]=d,e[11]=n):n=e[11];let f;if(e[12]!==a||e[13]!==s){let c;e[15]!==s?(c=b=>u("tr",{className:"hover:bg-muted/40",children:[i("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:b}),s.map((p,g)=>i("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:i(v,{value:p[b]})},g))]},b),e[15]=s,e[16]=c):c=e[16],f=a.map(c),e[12]=a,e[13]=s,e[14]=f}else f=e[14];let m;e[17]!==f?(m=i("tbody",{children:f}),e[17]=f,e[18]=m):m=e[18];let h;return e[19]!==n||e[20]!==m?(h=i("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:u("table",{className:"border-collapse text-xs",children:[n,m]})}),e[19]=n,e[20]=m,e[21]=h):h=e[21],h},j=({children:l,layout:e="card",testId:a})=>i("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":a,children:l});function _(l){return i("mark",{className:l.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:l.text},l.offset)}export{v as C,j as G,T};
1
+ import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{i as y}from"./internal-CyDwqA67.mjs";import{jsx as i,jsxs as u}from"react/jsx-runtime";const N=(l,e)=>{if(e==="")return[{match:!1,offset:0,text:l}];const a=[],s=l.toLowerCase(),o=e.toLowerCase();let t=0;for(let r=s.indexOf(o);r!==-1;r=s.indexOf(o,t))r>t&&a.push({match:!1,offset:t,text:l.slice(t,r)}),a.push({match:!0,offset:r,text:l.slice(r,r+e.length)}),t=r+e.length;return t<l.length&&a.push({match:!1,offset:t,text:l.slice(t)}),a},v=l=>{const e=x(9),{highlight:a,value:s}=l;if(s==null){let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=n):n=e[0],n}let o,t,r;if(e[1]!==a||e[2]!==s){r=Symbol.for("react.early_return_sentinel");e:{const n=y(s);if(a===void 0||a===""){r=i("span",{title:n,children:n});break e}o=n,t=N(n,a).map(_)}e[1]=a,e[2]=s,e[3]=o,e[4]=t,e[5]=r}else o=e[3],t=e[4],r=e[5];if(r!==Symbol.for("react.early_return_sentinel"))return r;let d;return e[6]!==o||e[7]!==t?(d=i("span",{title:o,children:t}),e[6]=o,e[7]=t,e[8]=d):d=e[8],d},T=l=>{const e=x(22),{columns:a,rows:s}=l,o=w();let t;e[0]!==o?(t=o("Field"),e[0]=o,e[1]=t):t=e[1];let r;e[2]!==t?(r=i("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let d;if(e[4]!==s||e[5]!==o){let c;e[7]!==o?(c=(b,p)=>i("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:o("Row {n}",{n:p+1})},p),e[7]=o,e[8]=c):c=e[8],d=s.map(c),e[4]=s,e[5]=o,e[6]=d}else d=e[6];let n;e[9]!==r||e[10]!==d?(n=i("thead",{className:"sticky top-0 z-10 bg-muted",children:u("tr",{children:[r,d]})}),e[9]=r,e[10]=d,e[11]=n):n=e[11];let f;if(e[12]!==a||e[13]!==s){let c;e[15]!==s?(c=b=>u("tr",{className:"hover:bg-muted/40",children:[i("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:b}),s.map((p,g)=>i("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:i(v,{value:p[b]})},g))]},b),e[15]=s,e[16]=c):c=e[16],f=a.map(c),e[12]=a,e[13]=s,e[14]=f}else f=e[14];let m;e[17]!==f?(m=i("tbody",{children:f}),e[17]=f,e[18]=m):m=e[18];let h;return e[19]!==n||e[20]!==m?(h=i("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:u("table",{className:"border-collapse text-xs",children:[n,m]})}),e[19]=n,e[20]=m,e[21]=h):h=e[21],h},j=({children:l,layout:e="card",testId:a})=>i("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":a,children:l});function _(l){return i("mark",{className:l.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:l.text},l.offset)}export{v as C,j as G,T};
@@ -0,0 +1 @@
1
+ const g=new Set(["contains","eq","gt","gte","lt","lte","ne"]),i=t=>typeof t=="number"&&Number.isSafeInteger(t)?String(t):t,e=t=>{if(typeof t!="string")return;const r=t.trim();return r===""?void 0:r},p=t=>{if(t===null||typeof t!="object")return!1;const r=t;return typeof r.column=="string"&&typeof r.operator=="string"&&g.has(r.operator)},f=t=>{if(typeof t!="string"||t==="")return[];try{const r=JSON.parse(t);return Array.isArray(r)?r.filter(p):[]}catch{return[]}},u=t=>{if(typeof t!="string"||t==="")return;const r=t.lastIndexOf(":");if(r<=0)return;const o=t.slice(0,r),s=t.slice(r+1);if(!(s!=="asc"&&s!=="desc"))return{column:o,direction:s}},h=/^[\da-f]{16}$/u,b=t=>{const r={};if(typeof t.pins=="string"&&t.pins!==""){const d=t.pins.split(",").filter(c=>c!==""&&c.length<=64).slice(0,12);d.length>0&&(r.pins=d.join(","))}t.schema==="global"&&(r.schema="global");const o=e(t.table);o!==void 0&&(r.table=o);const s=e(i(t.shard));s!==void 0&&(r.shard=s);const l=e(i(t.search));l!==void 0&&(r.search=l);const n=e(t.order);n!==void 0&&u(n)!==void 0&&(r.order=n);const a=e(t.filters);return a!==void 0&&f(a).length>0&&(r.filters=a),r},v=t=>{const r=f(t.filters),o=u(t.order);return{filters:r.length>0?r:void 0,orderBy:o,search:e(i(t.search)),shard:e(i(t.shard)),table:e(t.table),tier:t.schema==="global"?"global":"shard"}},y=t=>{const r=t.filters??[];return{filters:r.length>0?JSON.stringify(r):void 0,order:t.orderBy===void 0?void 0:`${t.orderBy.column}:${t.orderBy.direction}`,schema:t.tier==="global"?"global":void 0,search:t.search!==void 0&&t.search!==""?t.search:void 0,shard:t.shard!==void 0&&t.shard!==""?t.shard:void 0,table:t.table!==void 0&&t.table!==""?t.table:void 0}},S=t=>{const{version:r}=t;return typeof r=="string"&&h.test(r)?{version:r}:{}};export{b as a,y as d,v as s,S as v};
@@ -1 +1 @@
1
- import{c as A}from"react/compiler-runtime";import{flattenHint as I}from"@lunora/errors";import{useT as O}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{e as j,a as q,b as E}from"./internal-B6haJbiP.mjs";import{o as H}from"./recording-client-BXUIyBL4.mjs";import{u as S}from"./operation-console-provider-DoloEvon.mjs";import{A as T}from"./alert-PB5W11MM.mjs";import{jsx as v,jsxs as U}from"react/jsx-runtime";const G=y=>{const e=A(38),{className:w,error:t,testId:N}=y,g=O(),o=S();let s,l,i,n,a,c,r,m;if(e[0]!==w||e[1]!==t||e[2]!==o||e[3]!==N){const k=j(t);let h;e[12]!==t?(h=q(t),e[12]=t,e[13]=h):h=e[13],l=h;let b;e[14]!==t?(b=H(t),e[14]=t,e[15]=b):b=e[15];const C=b;let x;e[16]!==o||e[17]!==C?(x=()=>{o?.openConsole({errorsOnly:!0,seq:C})},e[16]=o,e[17]=C,e[18]=x):x=e[18],i=x,s=T,n=w,a=N,c="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(r=v("p",{className:"font-medium",children:u}),e[21]=u,e[22]=r):r=e[22],m=k===void 0?null:v("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(k)}),e[0]=w,e[1]=t,e[2]=o,e[3]=N,e[4]=s,e[5]=l,e[6]=i,e[7]=n,e[8]=a,e[9]=c,e[10]=r,e[11]=m}else s=e[4],l=e[5],i=e[6],n=e[7],a=e[8],c=e[9],r=e[10],m=e[11];let f;e[23]!==l?(f=l===void 0?null:v("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:l,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=l,e[24]=f):f=e[24];let p;e[25]!==o||e[26]!==i||e[27]!==g?(p=o===void 0?null:v("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:i,type:"button",children:g("Show in console")}),e[25]=o,e[26]=i,e[27]=g,e[28]=p):p=e[28];let d;return e[29]!==s||e[30]!==n||e[31]!==a||e[32]!==c||e[33]!==r||e[34]!==m||e[35]!==f||e[36]!==p?(d=U(s,{className:n,testId:a,variant:c,children:[r,m,f,p]}),e[29]=s,e[30]=n,e[31]=a,e[32]=c,e[33]=r,e[34]=m,e[35]=f,e[36]=p,e[37]=d):d=e[37],d};export{G as E};
1
+ import{c as A}from"react/compiler-runtime";import{flattenHint as I}from"@lunora/errors";import{useT as O}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{e as j,a as q,b as E}from"./internal-CyDwqA67.mjs";import{o as H}from"./recording-client-CjRFjhya.mjs";import{u as S}from"./operation-console-provider-DoloEvon.mjs";import{A as T}from"./alert-PB5W11MM.mjs";import{jsx as v,jsxs as U}from"react/jsx-runtime";const G=y=>{const e=A(38),{className:w,error:t,testId:N}=y,g=O(),o=S();let s,l,i,n,a,c,r,m;if(e[0]!==w||e[1]!==t||e[2]!==o||e[3]!==N){const k=j(t);let h;e[12]!==t?(h=q(t),e[12]=t,e[13]=h):h=e[13],l=h;let b;e[14]!==t?(b=H(t),e[14]=t,e[15]=b):b=e[15];const C=b;let x;e[16]!==o||e[17]!==C?(x=()=>{o?.openConsole({errorsOnly:!0,seq:C})},e[16]=o,e[17]=C,e[18]=x):x=e[18],i=x,s=T,n=w,a=N,c="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(r=v("p",{className:"font-medium",children:u}),e[21]=u,e[22]=r):r=e[22],m=k===void 0?null:v("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(k)}),e[0]=w,e[1]=t,e[2]=o,e[3]=N,e[4]=s,e[5]=l,e[6]=i,e[7]=n,e[8]=a,e[9]=c,e[10]=r,e[11]=m}else s=e[4],l=e[5],i=e[6],n=e[7],a=e[8],c=e[9],r=e[10],m=e[11];let f;e[23]!==l?(f=l===void 0?null:v("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:l,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=l,e[24]=f):f=e[24];let p;e[25]!==o||e[26]!==i||e[27]!==g?(p=o===void 0?null:v("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:i,type:"button",children:g("Show in console")}),e[25]=o,e[26]=i,e[27]=g,e[28]=p):p=e[28];let d;return e[29]!==s||e[30]!==n||e[31]!==a||e[32]!==c||e[33]!==r||e[34]!==m||e[35]!==f||e[36]!==p?(d=U(s,{className:n,testId:a,variant:c,children:[r,m,f,p]}),e[29]=s,e[30]=n,e[31]=a,e[32]=c,e[33]=r,e[34]=m,e[35]=f,e[36]=p,e[37]=d):d=e[37],d};export{G as E};
@@ -1,4 +1,4 @@
1
- import{c as E}from"react/compiler-runtime";import{useState as A,useEffect as Y}from"react";import{ConfirmButton as z}from"./ConfirmButton-DU4p72Er.mjs";import{D as Q,a as I,b as v,c as H,d as P,e as V,f as U,g as q}from"./dropdown-menu-jLZenfWH.mjs";import{M as X}from"./modal-shell-CDztwLnv.mjs";import{useT as R}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{i as B,g as Z,j as W,f as ee}from"./internal-B6haJbiP.mjs";import{C as L}from"./control-button-BOZ5K-FC.mjs";import{jsx as u,jsxs as $}from"react/jsx-runtime";const F=l=>`"${l.replaceAll('"','""')}"`,te=/["\n,]/u,le=/^[=+\-@\t\r]/u,J=l=>{if(l==null)return"";let e;return typeof l=="string"?e=le.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=B(l),te.test(e)?`"${e.replaceAll('"','""')}"`:e},ne=(l,e)=>{const n=l.map(t=>J(t)).join(","),o=e.map(t=>l.map(r=>J(t[r])).join(","));return[n,...o].join(`
1
+ import{c as E}from"react/compiler-runtime";import{useState as A,useEffect as Y}from"react";import{ConfirmButton as z}from"./ConfirmButton-DU4p72Er.mjs";import{D as Q,a as I,b as v,c as H,d as P,e as V,f as U,g as q}from"./dropdown-menu-jLZenfWH.mjs";import{M as X}from"./modal-shell-CDztwLnv.mjs";import{useT as R}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{i as B,g as Z,j as W,f as ee}from"./internal-CyDwqA67.mjs";import{C as L}from"./control-button-BOZ5K-FC.mjs";import{jsx as u,jsxs as $}from"react/jsx-runtime";const F=l=>`"${l.replaceAll('"','""')}"`,te=/["\n\r,]/u,le=/^[=+\-@\t\r]/u,J=l=>{if(l==null)return"";let e;return typeof l=="string"?e=le.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=B(l),te.test(e)?`"${e.replaceAll('"','""')}"`:e},ne=(l,e)=>{const n=l.map(t=>J(t)).join(","),o=e.map(t=>l.map(r=>J(t[r])).join(","));return[n,...o].join(`
2
2
  `)},oe=l=>JSON.stringify(l,W,2),G=500,K=l=>l==null?"NULL":typeof l=="number"?Number.isFinite(l)?String(l):"NULL":typeof l=="bigint"?String(l):typeof l=="boolean"?l?"1":"0":`'${(typeof l=="string"?l:B(l)).replaceAll("'","''")}'`,D="__doc__",se=(l,e,n,o)=>{if(e.length===0||n.length===0)return"";const t=o?.includes(D)===!0&&!e.includes(D)?e.filter(c=>!o.includes(c)):void 0,r=t===void 0?e:o,i=(c,m)=>K(t===void 0||m!==D?c[m]:JSON.stringify(Object.fromEntries(t.map(a=>[a,c[a]])),W)),s=r.map(c=>F(c)).join(", "),f=[];for(let c=0;c<n.length;c+=G){const m=n.slice(c,c+G).map(a=>` (${r.map(d=>i(a,d)).join(", ")})`).join(`,
3
3
  `);f.push(`INSERT INTO ${F(l)} (${s}) VALUES
4
4
  ${m};`)}return f.join(`
@@ -0,0 +1 @@
1
+ import{c as k}from"react/compiler-runtime";import{useT as M}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsxs as $,jsx as p}from"react/jsx-runtime";const w=[25,50,100,250],C=f=>{const e=k(18),{onChange:u,options:m,prefix:a,value:x}=f,t=M();let c;e[0]!==u?(c=h=>{u(Number.parseInt(h.target.value,10))},e[0]=u,e[1]=c):c=e[1];const n=c,b=`${a}-page-size`;let r;e[2]!==t?(r=t("Rows per page"),e[2]=t,e[3]=r):r=e[3];let o;e[4]!==r?(o=p("span",{children:r}),e[4]=r,e[5]=o):o=e[5];const d=`${a}-page-size`,l=`${a}-page-size`;let s;e[6]!==m?(s=m.map(E),e[6]=m,e[7]=s):s=e[7];let i;e[8]!==n||e[9]!==d||e[10]!==l||e[11]!==s||e[12]!==x?(i=p("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":d,id:l,onChange:n,value:x,children:s}),e[8]=n,e[9]=d,e[10]=l,e[11]=s,e[12]=x,e[13]=i):i=e[13];let g;return e[14]!==b||e[15]!==o||e[16]!==i?(g=$("label",{className:"flex items-center gap-1.5",htmlFor:b,children:[o,i]}),e[14]=b,e[15]=o,e[16]=i,e[17]=g):g=e[17],g},j=f=>{const e=k(25),{onJump:u,page:m,pages:a,prefix:x}=f,t=M();let c;e[0]!==u||e[1]!==a?(c=N=>{const P=Number.parseInt(N,10);Number.isNaN(P)||u(Math.min(Math.max(1,P),Math.max(1,a)))},e[0]=u,e[1]=a,e[2]=c):c=e[2];const n=c;let b;e[3]!==n?(b=N=>{N.key==="Enter"&&n(N.currentTarget.value)},e[3]=n,e[4]=b):b=e[4];const r=b;let o;e[5]!==n?(o=N=>{n(N.currentTarget.value)},e[5]=n,e[6]=o):o=e[6];const d=o;let l;e[7]!==t?(l=t("Page"),e[7]=t,e[8]=l):l=e[8];let s;e[9]!==t?(s=t("Page"),e[9]=t,e[10]=s):s=e[10];const i=`${x}-page-jump`,g=Math.max(1,a);let h;e[11]!==d||e[12]!==r||e[13]!==m||e[14]!==s||e[15]!==i||e[16]!==g?(h=p("input",{"aria-label":s,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":i,defaultValue:m,max:g,min:1,onBlur:d,onKeyDown:r,type:"number"},m),e[11]=d,e[12]=r,e[13]=m,e[14]=s,e[15]=i,e[16]=g,e[17]=h):h=e[17];let v;e[18]!==a||e[19]!==t?(v=t("of {pages}",{pages:a}),e[18]=a,e[19]=t,e[20]=v):v=e[20];let y;return e[21]!==l||e[22]!==h||e[23]!==v?(y=$("span",{className:"flex items-center gap-1.5 tabular-nums",children:[l,h,v]}),e[21]=l,e[22]=h,e[23]=v,e[24]=y):y=e[24],y},_=({hasNext:f,hasPrevious:e,onJumpToPage:u,onNext:m,onPageSizeChange:a,onPrevious:x,pageSize:t,pageSizeOptions:c=w,prefix:n,rangeEnd:b,rangeStart:r,total:o})=>{const d=M(),l="rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",s=t!==void 0&&t>0?Math.max(1,Math.ceil(o/t)):1,i=t!==void 0&&t>0?Math.floor(Math.max(0,r-1)/t)+1:1;return $("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[$("div",{className:"flex items-center gap-3",children:[t!==void 0&&a!==void 0&&p(C,{onChange:a,options:c,prefix:n,value:t}),p("span",{className:"tabular-nums","data-testid":`${n}-page-info`,children:d("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:b,rangeStart:r,total:o})})]}),$("div",{className:"flex items-center gap-3",children:[p("button",{className:l,"data-testid":`${n}-prev`,disabled:!e,onClick:x,type:"button",children:d("Previous")}),t!==void 0&&u!==void 0&&p(j,{onJump:u,page:i,pages:s,prefix:n}),p("button",{className:l,"data-testid":`${n}-next`,disabled:!f,onClick:m,type:"button",children:d("Next")})]})]})};function E(f){return p("option",{value:f,children:f},f)}export{_ as G};
@@ -0,0 +1,3 @@
1
+ import{c as $}from"react/compiler-runtime";import{useNavigate as Ge}from"@tanstack/react-router";import{useState as Pe,useEffect as qe,Suspense as et,lazy as tt}from"react";import{B as Je}from"./badge-r_5B4LHP.mjs";import{C as F,a as Ye}from"./card--2hKx4L2.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-CR9mHt0P.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,w as at,g as rt,l as ot}from"./internal-CyDwqA67.mjs";import{c as Ze}from"./utils-bhneXptQ.mjs";import{deriveInsights as it}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useLunora as Ue}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as ze}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=Ue(),[n,s]=Pe(Xe);let r,a;return t[0]!==e?(r=()=>{Ne((async()=>{try{s(dt(await e.query(ct,{},lt(""))))}catch{}})())},a=[e],t[0]=e,t[1]=r,t[2]=a):(r=t[1],a=t[2]),qe(r,a),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(),r=Ge();let a;e[0]!==n.tab||e[1]!==r?(a=()=>{Ne(r({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=r,e[2]=a):a=e[2];const i=a,o=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 u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=l(mt,{}),e[5]=u):u=e[5];let m;e[6]!==c?(m=h("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=m):m=e[7];let d;e[8]!==o||e[9]!==s?(d=o===1?s("1 binding"):s("{count} bindings",{count:o}),e[8]=o,e[9]=s,e[10]=d):d=e[10];let f;e[11]!==d?(f=l("span",{className:"text-xs text-muted-foreground",children:d}),e[11]=d,e[12]=f):f=e[12];let p;e[13]!==o||e[14]!==n.bindings?(p=o>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(gt)}),e[13]=o,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==m||e[17]!==f||e[18]!==p?(g=h(Ye,{className:"flex flex-col gap-2 py-4",children:[m,f,p]}),e[16]=m,e[17]=f,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==i||e[22]!==g?(x=l(F,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:i,children:g}),e[20]=n.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},Ve=["kv","files","vectors"],pt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>Ve.indexOf(n.tab)-Ve.indexOf(s.tab)),ht=()=>{const t=$(19),e=Ue(),n=ut(),s=I();let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];const[a,i]=Pe(r);let o,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(o=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(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};i(S=>pt(S,_))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=o,t[7]=c):(o=t[6],c=t[7]),qe(o,c),a.length===0)return null;let u;t[8]!==s?(u=s("Bindings"),t[8]=s,t[9]=u):u=t[9];let m;t[10]!==u?(m=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=m):m=t[11];let d;t[12]!==a?(d=a.map(yt),t[12]=a,t[13]=d):d=t[13];let f;t[14]!==d?(f=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:d}),t[14]=d,t[15]=f):f=t[15];let p;return t[16]!==m||t[17]!==f?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[m,f]}),t[16]=m,t[17]=f,t[18]=p):p=t[18],p};function gt(t){return l(Je,{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
+ `);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
+ `)},St=1500,kt=()=>{const t=$(40),e=I(),{url:n}=Ue();let s;t[0]!==n?(s=at(n),t[0]=n,t[1]=s):s=t[1];const r=s,[a,i]=Pe(null);let o,c;t[2]!==a?(o=()=>{if(a===null)return;const M=globalThis.setTimeout(()=>{i(null)},St);return()=>{globalThis.clearTimeout(M)}},c=[a],t[2]=a,t[3]=o,t[4]=c):(o=t[3],c=t[4]),qe(o,c);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(M,T)=>{rt(T)&&i(M)},t[5]=u):u=t[5];const m=u;let d;t[6]!==r?(d=()=>{m("config",Nt(r))},t[6]=r,t[7]=d):d=t[7];const f=d;let p;t[8]!==r?(p=()=>{m("prompt",_t(r))},t[8]=r,t[9]=p):p=t[9];const g=p;let x;t[10]!==e?(x=e("Connect an AI agent"),t[10]=e,t[11]=x):x=t[11];let b;t[12]!==x?(b=l("span",{className:"text-sm font-medium text-foreground",children:x}),t[12]=x,t[13]=b):b=t[13];let v;t[14]!==e?(v=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[14]=e,t[15]=v):v=t[15];let _;t[16]!==v?(_=l("span",{className:"text-xs text-muted-foreground",children:v}),t[16]=v,t[17]=_):_=t[17];let S;t[18]!==b||t[19]!==_?(S=h("div",{className:"flex flex-col gap-1.5 p-4",children:[b,_]}),t[18]=b,t[19]=_,t[20]=S):S=t[20];let L;t[21]===Symbol.for("react.memo_cache_sentinel")?(L=l("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[21]=L):L=t[21];let y;t[22]!==a||t[23]!==e?(y=e(a==="config"?"Copied":"Copy MCP config"),t[22]=a,t[23]=e,t[24]=y):y=t[24];let k;t[25]!==f||t[26]!==y?(k=l(ze,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:y}),t[25]=f,t[26]=y,t[27]=k):k=t[27];let w;t[28]!==a||t[29]!==e?(w=e(a==="prompt"?"Copied":"Copy agent prompt"),t[28]=a,t[29]=e,t[30]=w):w=t[30];let C;t[31]!==g||t[32]!==w?(C=l(ze,{"data-testid":"home-connect-agent-copy-prompt",onClick:g,size:"xs",variant:"outline",children:w}),t[31]=g,t[32]=w,t[33]=C):C=t[33];let N;t[34]!==k||t[35]!==C?(N=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[L,h("div",{className:"flex flex-wrap gap-2",children:[k,C]})]}),t[34]=k,t[35]=C,t[36]=N):N=t[36];let A;return t[37]!==S||t[38]!==N?(A=h(F,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[S,N]}),t[37]=S,t[38]=N,t[39]=A):A=t[39],A},wt=tt(()=>import("../packem_chunks/sparkline.mjs")),Ct=(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 r=Math.round(s/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},We=(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],[r])=>s-r).map(([,s])=>s)},Qe=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((i,o)=>i+o,0),r=t.slice(n).reduce((i,o)=>i+o,0);if(s===0)return null;const a=(r-s)/s*100;return{positive:e?a>=0:a<=0,text:`${a>=0?"+":""}${a.toFixed(1)}%`}},Te=t=>{const e=$(24),{delta:n,footer:s,label:r,trend:a,unit:i,value:o}=t,c=I();let u;e[0]!==r?(u=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=u):u=e[1];let m;e[2]!==o?(m=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[2]=o,e[3]=m):m=e[3];let d;e[4]!==i?(d=i!==void 0&&l("span",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=d):d=e[5];let f;e[6]!==m||e[7]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[m,d]}),e[6]=m,e[7]=d,e[8]=f):f=e[8];let p;e[9]!==a?(p=a!==void 0&&l(et,{fallback:l("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:l(wt,{data:a})}),e[9]=a,e[10]=p):p=e[10];let g;e[11]!==f||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[f,p]}),e[11]=f,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n||e[18]!==s||e[19]!==c?(b=n==null?s!=null&&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:Ze("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},je=t=>{const e=$(7),{command:n,label:s}=t;let r;e[0]!==s?(r=l("div",{className:"p-4",children:l("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=r):r=e[1];let a;e[2]!==n?(a=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]=a):a=e[3];let i;return e[4]!==r||e[5]!==a?(i=h(F,{className:"justify-between gap-0 py-0",children:[r,a]}),e[4]=r,e[5]=a,e[6]=i):i=e[6],i},He=t=>{const e=$(18),{count:n,onView:s,testId:r,title:a}=t,i=I();let o;e[0]!==a?(o=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=o):o=e[1];let c;e[2]!==n||e[3]!==i?(c=n===null?l("span",{className:"text-xs text-muted-foreground",children:i("No data yet")}):l(Je,{variant:n>0?"destructive":"success",children:n>0?n:i("All clear")}),e[2]=n,e[3]=i,e[4]=c):c=e[4];let u;e[5]!==o||e[6]!==c?(u=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[o,c]}),e[5]=o,e[6]=c,e[7]=u):u=e[7];let m;e[8]!==i?(m=i("View"),e[8]=i,e[9]=m):m=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=l(At,{}),e[10]=d):d=e[10];let f;e[11]!==s||e[12]!==m?(f=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:s,type:"button",children:[m,d]}),e[11]=s,e[12]=m,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f||e[16]!==r?(p=h(F,{className:"justify-between gap-0 py-0","data-testid":r,children:[u,f]}),e[14]=u,e[15]=f,e[16]=r,e[17]=p):p=e[17],p},Lt=t=>{const e=$(7),{functions:n}=t,s=I();let r;if(e[0]!==n||e[1]!==s){const a=[...n].toSorted(Ot).slice(0,5);let i;e[3]!==s?(i=s("Top functions"),e[3]=s,e[4]=i):i=e[4];let o;e[5]!==i?(o=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:i})}),e[5]=i,e[6]=o):o=e[6],r=h(F,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[o,a.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")})]}),a.map(Rt)]})]}),e[0]=n,e[1]=s,e[2]=r}else r=e[2];return r},Mt=t=>{const e=$(26),{subs:n}=t,s=I();let r;e[0]!==s?(r=s("Live connections"),e[0]=s,e[1]=r):r=e[1];let a;e[2]!==r?(a=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=a):a=e[3];const i=n?.totalConnections??0;let o;e[4]!==i?(o=i.toLocaleString(),e[4]=i,e[5]=o):o=e[5];let c;e[6]!==o?(c=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[6]=o,e[7]=c):c=e[7];let u;e[8]!==s?(u=s("sockets"),e[8]=s,e[9]=u):u=e[9];let m;e[10]!==u?(m=l("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=m):m=e[11];let d;e[12]!==c||e[13]!==m?(d=h("span",{className:"flex items-baseline gap-1.5",children:[c,m]}),e[12]=c,e[13]=m,e[14]=d):d=e[14];const f=n?.totalSubscriptions??0;let p;e[15]!==f?(p=f.toLocaleString(),e[15]=f,e[16]=p):p=e[16];let g;e[17]!==s?(g=s("active subscriptions"),e[17]=s,e[18]=g):g=e[18];let x;e[19]!==p||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[p," ",g]}),e[19]=p,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==a||e[24]!==d?(b=l(F,{"data-testid":"home-live-connections",children:h(Ye,{className:"flex flex-col gap-2.5 py-4",children:[a,d,x]})}),e[22]=x,e[23]=a,e[24]=d,e[25]=b):b=e[25],b},It=t=>{const e=$(7),{entries:n}=t,s=I();let r;if(e[0]!==n||e[1]!==s){const a=Date.now();let i;e[3]!==s?(i=s("Recent activity"),e[3]=s,e[4]=i):i=e[4];let o;e[5]!==i?(o=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:i})}),e[5]=i,e[6]=o):o=e[6],r=h(F,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[o,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,a)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=r}else r=e[2];return r},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(),r=Ge(),a=n??"";let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let o;e[1]!==a?(o={shardKey:a},e[1]=a,e[2]=o):o=e[2];const c=ve(ye.getMetrics,i,o);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let m;e[4]!==a?(m={shardKey:a},e[4]=a,e[5]=m):m=e[5];const d=ve(ye.getFunctionStats,u,m);let f,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},p={shardKey:""},e[6]=f,e[7]=p):(f=e[6],p=e[7]);const g=ve(ye.getSecurityAudit,f,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==a?(b={shardKey:a},e[9]=a,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 S;e[12]!==a?(S={shardKey:a},e[12]=a,e[13]=S):S=e[13];const L=ve(ye.getAuditLog,_,S),y=c.data??null;let k,w,C,N,A,M,T,O,R,j,D,P,E,B,q,U,K,z;if(e[14]!==L.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==r||e[19]!==d.data||e[20]!==v.data||e[21]!==s){N=Array.isArray(d.data?.functions)?d.data.functions:[],T=v.data??null;let we;e[40]!==L.data?(we=Array.isArray(L.data?.entries)?L.data.entries:[],e[40]=L.data,e[41]=we):we=e[41],w=we,A=c.data===void 0||d.data===void 0?null:it(y,N).length,M=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ce;e[42]!==r?(Ce=()=>{Ne(r({to:"/security"}))},e[42]=r,e[43]=Ce):Ce=e[43],z=Ce;let $e;e[44]!==r?($e=()=>{Ne(r({to:"/insights"}))},e[44]=r,e[45]=$e):$e=e[45],K=$e;const Ae=We(y?.history,"calls"),Le=We(y?.history,"errors"),Ke=Tt(N),Me=Math.max(0,...N.map(Et));let Ie;e[46]!==y||e[47]!==s?(Ie=y===null?void 0:Ct(s,y.cache),e[46]=y,e[47]=s,e[48]=Ie):Ie=e[48],C=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=Qe(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?(E=l(Te,{delta:Re,label:he,trend:Ae,value:ge}),e[53]=Ae,e[54]=Re,e[55]=he,e[56]=ge,e[57]=E):E=e[57];const Be=Qe(Le,!1);let xe;e[58]!==s?(xe=s("Errors"),e[58]=s,e[59]=xe):xe=e[59];const Fe=y?.errors??0;let be;e[60]!==Fe?(be=Fe.toLocaleString(),e[60]=Fe,e[61]=be):be=e[61],e[62]!==Le||e[63]!==Be||e[64]!==xe||e[65]!==be?(B=l(Te,{delta:Be,label:xe,trend:Le,value:be}),e[62]=Le,e[63]=Be,e[64]=xe,e[65]=be,e[66]=B):B=e[66],k=Te,e[67]!==Me||e[68]!==s?(O=Me>0?`${s("max")} ${De(Me)}`:void 0,e[67]=Me,e[68]=s,e[69]=O):O=e[69],e[70]!==s?(R=s("Avg latency"),e[70]=s,e[71]=R):R=e[71],j=Ke===null?"—":De(Ke),e[14]=L.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=r,e[19]=d.data,e[20]=v.data,e[21]=s,e[22]=k,e[23]=w,e[24]=C,e[25]=N,e[26]=A,e[27]=M,e[28]=T,e[29]=O,e[30]=R,e[31]=j,e[32]=D,e[33]=P,e[34]=E,e[35]=B,e[36]=q,e[37]=U,e[38]=K,e[39]=z}else k=e[22],w=e[23],C=e[24],N=e[25],A=e[26],M=e[27],T=e[28],O=e[29],R=e[30],j=e[31],D=e[32],P=e[33],E=e[34],B=e[35],q=e[36],U=e[37],K=e[38],z=e[39];let V;e[72]!==k||e[73]!==O||e[74]!==R||e[75]!==j?(V=l(k,{footer:O,label:R,value:j}),e[72]=k,e[73]=O,e[74]=R,e[75]=j,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=ot(Oe),e[79]=Oe,e[80]=Q):Q=e[80];let H;e[81]!==C||e[82]!==W||e[83]!==Q?(H=l(Te,{footer:C,label:W,value:Q}),e[81]=C,e[82]=W,e[83]=Q,e[84]=H):H=e[84];let G;e[85]!==D||e[86]!==P||e[87]!==E||e[88]!==B||e[89]!==V||e[90]!==H?(G=h("div",{className:D,"data-testid":P,children:[E,B,V,H]}),e[85]=D,e[86]=P,e[87]=E,e[88]=B,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]!==T?(Y=l(Mt,{subs:T}),e[95]=T,e[96]=Y):Y=e[96];let Z;e[97]!==w?(Z=l(It,{entries:w}),e[97]=w,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]!==A||e[110]!==M||e[111]!==s||e[112]!==K||e[113]!==z?(ne=M===0&&A===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(He,{count:M,onView:z,testId:"home-security",title:s("Security findings")}),l(He,{count:A,onView:K,testId:"home-performance",title:s("Performance issues")})]}),e[109]=A,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 re;e[120]!==ae?(re=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[120]=ae,e[121]=re):re=e[121];let oe;e[122]!==s?(oe=s("Client SDK"),e[122]=s,e[123]=oe):oe=e[123];let ie;e[124]!==oe?(ie=l(je,{command:"npm i @lunora/client",label:oe}),e[124]=oe,e[125]=ie):ie=e[125];let ce;e[126]!==s?(ce=s("React"),e[126]=s,e[127]=ce):ce=e[127];let de;e[128]!==ce?(de=l(je,{command:"npm i @lunora/react",label:ce}),e[128]=ce,e[129]=de):de=e[129];let ue;e[130]!==s?(ue=s("CLI"),e[130]=s,e[131]=ue):ue=e[131];let me;e[132]!==ue?(me=l(je,{command:"lunora dev",label:ue}),e[132]=ue,e[133]=me):me=e[133];let fe;e[134]!==ie||e[135]!==de||e[136]!==me?(fe=h("div",{className:"grid gap-3 sm:grid-cols-3",children:[ie,de,me]}),e[134]=ie,e[135]=de,e[136]=me,e[137]=fe):fe=e[137];let Se;e[138]===Symbol.for("react.memo_cache_sentinel")?(Se=l(kt,{}),e[138]=Se):Se=e[138];let pe;e[139]!==re||e[140]!==fe?(pe=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[re,fe,Se]}),e[139]=re,e[140]=fe,e[141]=pe):pe=e[141];let 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:Ze("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,Ct as c,ut as u};
@@ -0,0 +1,2 @@
1
+ const f=(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)}},u=t=>({__lunoraRef:t}),d=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},g=t=>t instanceof Error?t.message:String(t),l=t=>{if(t===null||typeof t!="object"||!("code"in t))return;const{code:n}=t;return typeof n=="string"?n:void 0},y=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},h=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,p=t=>typeof t=="bigint"?t.toString():t,b=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)})},a=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},m=t=>{let n=a(t);for(;n.endsWith("/");)n=n.slice(0,-1);return n},B=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},w=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{h as a,g as b,u as c,d,y as e,c as f,B as g,w as h,b as i,s as j,f as k,e as l,p as m,l as n,a as r,m as w};
@@ -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{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
+ 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-CyDwqA67.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-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
+ import{o as u}from"./use-admin-query-CR9mHt0P.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};
@@ -0,0 +1,13 @@
1
+ import{c as P}from"react/compiler-runtime";import{useState as L,useEffectEvent as U,useEffect as ae,createContext as le,use as de}from"react";import{b as z,g as Y,f as ce,k as ue,c as fe,d as me,j as pe}from"./internal-CyDwqA67.mjs";import{SentIcon as he,Copy01Icon as ge,Search01Icon as xe}from"@hugeicons/core-free-icons";import{HugeiconsIcon as W}from"@hugeicons/react";import{I as be}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 ye}from"react/jsx-runtime";import{B as ve}from"./badge-r_5B4LHP.mjs";import{ShardInput as Ne}from"./ShardInput-C6mjgAh4.mjs";import{L as V}from"./label-DKFzyHq6.mjs";import{T as Se}from"./textarea--40GKAyz.mjs";import{LunoraError as ke}from"@lunora/errors";import{useLunora as we}from"@lunora/react";import{c as Q}from"./utils-bhneXptQ.mjs";const Ot=function(t,e,s){const r=P(15);let n;r[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},r[0]=n):n=r[0];const[o,l]=L(n);let a;r[1]!==e?(a=async()=>e(),r[1]=e,r[2]=a):a=r[2];const g=U(a);let d;r[3]!==s?(d=f=>s(f),r[3]=s,r[4]=d):d=r[4];const c=U(d);let u;r[5]!==c||r[6]!==g||r[7]!==t?(u=()=>{if(t!==void 0)return;let f=!1;return g().then(m=>(f||l(c(m)),m)).catch(m=>{f||l({kind:"error",message:z(m)})}),()=>{f=!0}},r[5]=c,r[6]=g,r[7]=t,r[8]=u):u=r[8];let h;r[9]!==t?(h=[t],r[9]=t,r[10]=h):h=r[10],ae(u,h);let p;return r[11]!==s||r[12]!==o||r[13]!==t?(p=t===void 0?o:s(t),r[11]=s,r[12]=o,r[13]=t,r[14]=p):p=r[14],p},Oe=t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string",Z=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",$e=t=>{const e=Z(t);return e!==void 0?t.type??Oe(e[0]):F(t)},Te=t=>{const e=Z(t);return e===void 0?void 0:e.map(s=>JSON.stringify(s)).join(" | ")},Ee=t=>{const e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} ≤`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);const s=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 r=e.length>(s?2:1);return s||r?e.join(" "):void 0},Ce=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[s,r]of Object.entries(t.properties??{}))e[s]=D(r);return e}case"string":return"";default:return null}},K=t=>{const e=P(7),{label:s,value:r}=t;let n;e[0]!==s?(n=i("span",{className:"text-muted-foreground",children:s}),e[0]=s,e[1]=n):n=e[1];let o;e[2]!==r?(o=i("span",{className:"text-foreground",children:r}),e[2]=r,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},Ae=t=>{const e=P(40),{name:s,required:r,schema:n}=t,o=J();let l;e[0]!==n?(l=Ee(n),e[0]=n,e[1]=l):l=e[1];const a=l;let g;e[2]!==n?(g=Te(n),e[2]=n,e[3]=g):g=e[3];const d=g,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let h;e[4]!==n?(h=Ce(n),e[4]=n,e[5]=h):h=e[5];const p=h,f=r?"*":"?";let m;e[6]!==f?(m=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=m):m=e[7];let v;e[8]!==s||e[9]!==m?(v=N("span",{className:"font-mono text-foreground",children:[s,m]}),e[8]=s,e[9]=m,e[10]=v):v=e[10];let k;e[11]!==n?(k=$e(n),e[11]=n,e[12]=k):k=e[12];let x;e[13]!==k?(x=i("span",{className:"font-mono text-muted-foreground",children:k}),e[13]=k,e[14]=x):x=e[14];let b;e[15]!==v||e[16]!==x?(b=N("div",{className:"flex items-baseline gap-2",children:[v,x]}),e[15]=v,e[16]=x,e[17]=b):b=e[17];let y;e[18]!==n.description?(y=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=y):y=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]!==y||e[28]!==S||e[29]!==b?(O=N("div",{className:"flex flex-col gap-1 py-2",children:[b,y,S]}),e[27]=y,e[28]=S,e[29]=b,e[30]=O):O=e[30];const w=O;if(p===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]!==p?(A=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(ee,{schema:p})}),e[35]=p,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},ee=t=>{const e=P(7),{schema:s}=t;let r;e[0]!==s.required?(r=new Set(s.required),e[0]=s.required,e[1]=r):r=e[1];const n=r;let o;e[2]!==s.properties?(o=Object.entries(s.properties??{}),e[2]=s.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(g=>{const[d,c]=g;return i(Ae,{name:d,required:n.has(d),schema:c},d)})}),e[4]=n,e[5]=l,e[6]=a):a=e[6],a},G=t=>{const e=P(10),{schema:s,testId:r}=t;if(s?.type!=="object"||Object.keys(s.properties??{}).length===0){let l;e[0]!==s?(l=F(s),e[0]=s,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==r?(a=i("p",{className:"font-mono text-xs text-muted-foreground","data-testid":r,children:l}),e[2]=l,e[3]=r,e[4]=a):a=e[4],a}let n;e[5]!==s?(n=i(ee,{schema:s}),e[5]=s,e[6]=n):n=e[6];let o;return e[7]!==n||e[8]!==r?(o=i("div",{className:"text-xs","data-testid":r,children:n}),e[7]=n,e[8]=r,e[9]=o):o=e[9],o},Re=["curl","javascript","lunora"],je={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},Ie=t=>`api.${t.replaceAll(/[/:]/g,".")}`,Pe=t=>{const e=D(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},Le=(t,e,s)=>{const r=`${s}${e.httpPath}`,n=JSON.stringify(Pe(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(r)}`];return l&&a.push(' -H "Content-Type: application/json"',` -d '${n}'`),a.join(` \\
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
+ import { api } from "./_generated/api";
4
+
5
+ const client = useLunora();
6
+ await client.${e.kind??"query"}(${Ie(e.functionPath)}, ${o});`;default:{const a=e.method!=="GET"&&e.method!=="HEAD"?`{
7
+ method: ${JSON.stringify(e.method)},
8
+ headers: { "Content-Type": "application/json" },
9
+ body: JSON.stringify(${n}),
10
+ }`:`{ method: ${JSON.stringify(e.method)} }`;return`const response = await fetch(${JSON.stringify(r)}, ${a});
11
+ const data = await response.json();`}}},_e=t=>{const e=P(24),{operation:s,server:r}=t,n=J(),[o,l]=L("curl");let a;e[0]!==s||e[1]!==o||e[2]!==r?(a=Le(o,s,r),e[0]=s,e[1]=o,e[2]=r,e[3]=a):a=e[3];const g=a;let d;e[4]!==g?(d=()=>{Y(g)},e[4]=g,e[5]=d):d=e[5];const c=d;let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=y=>{l(y.currentTarget.dataset.sample)},e[6]=u):u=e[6];const h=u;let p;e[7]!==o?(p=Re.map(y=>i("button",{"aria-selected":o===y,className:"rounded px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium aria-selected:text-foreground","data-sample":y,"data-testid":`api-sample-${y}`,onClick:h,role:"tab",type:"button",children:je[y]},y)),e[7]=o,e[8]=p):p=e[8];let f;e[9]!==p?(f=i("div",{className:"flex gap-1",role:"tablist",children:p}),e[9]=p,e[10]=f):f=e[10];let m;e[11]!==n?(m=n("Copy"),e[11]=n,e[12]=m):m=e[12];let v;e[13]!==c||e[14]!==m?(v=i(q,{"data-testid":"api-sample-copy",onClick:c,size:"xs",type:"button",variant:"ghost",children:m}),e[13]=c,e[14]=m,e[15]=v):v=e[15];let k;e[16]!==f||e[17]!==v?(k=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[f,v]}),e[16]=f,e[17]=v,e[18]=k):k=e[18];let x;e[19]!==g?(x=i("pre",{className:"overflow-auto px-3 pb-3 font-mono text-xs","data-testid":"api-sample-source",children:g}),e[19]=g,e[20]=x):x=e[20];let b;return e[21]!==k||e[22]!==x?(b=N("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card","data-testid":"api-code-samples",children:[k,x]}),e[21]=k,e[22]=x,e[23]=b):b=e[23],b},Be={blue:"text-info",emerald:"text-success",neutral:"text-muted-foreground",orange:"text-warning",red:"text-destructive",violet:"text-royal-amethyst"},Me=t=>{switch(t.toUpperCase()){case"DELETE":return"red";case"GET":return"emerald";case"PATCH":return"orange";case"POST":return"blue";case"PUT":return"orange";default:return"neutral"}},Je=t=>{switch(t){case"action":return"violet";case"mutation":return"orange";case"query":return"emerald";default:return"neutral"}},H=t=>{const e=P(7),{kind:s,method:r,testId:n}=t;let o;e[0]!==s||e[1]!==r?(o=s??r.toUpperCase(),e[0]=s,e[1]=r,e[2]=o):o=e[2];const l=o,a=s===void 0?Me(r):Je(s),g=`${Be[a]} font-mono text-[10px] tracking-wide uppercase`;let d;return e[3]!==l||e[4]!==g||e[5]!==n?(d=i(ve,{className:g,"data-testid":n,variant:"ghost",children:l}),e[3]=l,e[4]=g,e[5]=n,e[6]=d):d=e[6],d},te=t=>t.startsWith("2")?"text-emerald-600 dark:text-emerald-400":t==="default"||t.startsWith("4")||t.startsWith("5")?"text-red-600 dark:text-red-400":"text-muted-foreground",re=t=>t.startsWith("2")?"bg-emerald-500":t==="default"||t.startsWith("4")||t.startsWith("5")?"bg-red-500":"bg-muted-foreground",De=new Set([" ",`
12
+ `,"\r"]),X=" ",Ke=t=>{let e="";for(const n of t)De.has(n)||(e+=n);let s=0,r=e.length;for(;s<r&&(e[s]??"")<=X;)s+=1;for(;r>s&&(e[r-1]??"")<=X;)r-=1;return e.slice(s,r)},Fe=/^(?:[a-z][\d+.a-z-]*:)?\/\//i,ze=(t,e)=>{const s=globalThis.location?.origin??"",r=e===""?s:e,n=Ke(t);if(r===""){if(Fe.test(n))throw new Error(`restDispatch: refusing to send the admin token off-origin (${n} names its own host and there is no origin to check it against)`);return n}const o=new URL(n,r);if(o.origin!==new URL(r).origin)throw new Error(`restDispatch: refusing to send the admin token off-origin (${o.origin} is not ${r})`);return o.toString()},We=async(t,e,s,r)=>{const n=t.method!=="GET"&&t.method!=="HEAD",o=ze(t.httpPath,s),a=await(await fetch(o,{body:n?JSON.stringify(e):void 0,headers:{...n?{"content-type":"application/json"}:{},...r===null||r===""?{}:{authorization:`Bearer ${r}`}},method:t.method})).text();try{return JSON.parse(a)}catch{return a}},qe=t=>JSON.stringify(D(t.argsSchema)??{},void 0,2),se=le(null),ne=()=>{const t=de(se);if(t===null)throw new ke("INTERNAL","useOperationRun must be used within an OperationRunProvider");return t},He=({children:t,operation:e})=>{const s=J(),r=we(),[n,o]=L(()=>qe(e)),[l,a]=L(""),[g,d]=L("idle"),[c,u]=L(void 0),[h,p]=L(null),[f,m]=L(null),v=async()=>{let b;try{b=n.trim()===""?{}:JSON.parse(n)}catch(S){d("error"),u(void 0),m(null),p(s("Invalid JSON args: {message}",{message:z(S)}));return}d("running"),p(null);const y=performance.now();try{const S=await(e.functionPath===void 0?We(e,b,r.url,r.getAuthToken()):ue(r,e.kind,fe(e.functionPath),b,me(l)));u(S),m(Math.round(performance.now()-y)),d("success")}catch(S){u(void 0),m(Math.round(performance.now()-y)),p(z(S)),d("error")}};return i(se,{value:{argsText:n,durationMs:f,error:h,operation:e,response:c,send:()=>{ce(v())},setArgsText:o,setShardKey:a,shardKey:l,status:g},children:t})},Ue=()=>{const t=P(48),e=J(),{argsText:s,operation:r,send:n,setArgsText:o,setShardKey:l,shardKey:a,status:g}=ne();let d;t[0]!==o?(d=C=>{o(C.target.value)},t[0]=o,t[1]=d):d=t[1];const c=d;let u;t[2]!==n?(u=C=>{C.key==="Enter"&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),n())},t[2]=n,t[3]=u):u=t[3];const h=u,p=g==="running";let f;t[4]!==r.kind||t[5]!==r.method?(f=i(H,{kind:r.kind,method:r.method,testId:"api-try-method"}),t[4]=r.kind,t[5]=r.method,t[6]=f):f=t[6];const m=r.functionPath??r.httpPath;let v;t[7]!==m?(v=i("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:m}),t[7]=m,t[8]=v):v=t[8];const k=p?"animate-pulse":void 0;let x;t[9]!==k?(x=i(W,{className:k,icon:he,strokeWidth:2}),t[9]=k,t[10]=x):x=t[10];let b;t[11]!==p||t[12]!==e?(b=e(p?"Sending…":"Send"),t[11]=p,t[12]=e,t[13]=b):b=t[13];let y;t[14]!==p||t[15]!==n||t[16]!==x||t[17]!==b?(y=N(q,{"data-testid":"api-try-send",disabled:p,onClick:n,size:"sm",type:"button",children:[x,b]}),t[14]=p,t[15]=n,t[16]=x,t[17]=b,t[18]=y):y=t[18];let S;t[19]!==f||t[20]!==v||t[21]!==y?(S=N("div",{className:"flex items-center gap-2 border-b border-border bg-muted px-3 py-2",children:[f,v,y]}),t[19]=f,t[20]=v,t[21]=y,t[22]=S):S=t[22];let O;t[23]!==e?(O=e("Arguments (JSON)"),t[23]=e,t[24]=O):O=t[24];let w;t[25]!==O?(w=i(V,{htmlFor:"api-try-args",children:O}),t[25]=O,t[26]=w):w=t[26];let T;t[27]!==s?(T=s.split(`
13
+ `),t[27]=s,t[28]=T):T=t[28];const A=Math.min(12,Math.max(3,T.length));let E;t[29]!==s||t[30]!==c||t[31]!==h||t[32]!==A?(E=i(Se,{className:"font-mono text-xs","data-testid":"api-try-args",id:"api-try-args",onChange:c,onKeyDown:h,rows:A,spellCheck:!1,value:s}),t[29]=s,t[30]=c,t[31]=h,t[32]=A,t[33]=E):E=t[33];let $;t[34]!==w||t[35]!==E?($=N("div",{className:"flex flex-col gap-1.5",children:[w,E]}),t[34]=w,t[35]=E,t[36]=$):$=t[36];let R;t[37]!==r.functionPath||t[38]!==l||t[39]!==a||t[40]!==e?(R=r.functionPath!==void 0&&N("div",{className:"flex flex-col gap-1.5",children:[i(V,{htmlFor:"shard-input",children:e("Shard key (optional)")}),i(Ne,{id:"shard-input",onChange:l,testId:"shard-input",value:a})]}),t[37]=r.functionPath,t[38]=l,t[39]=a,t[40]=e,t[41]=R):R=t[41];let j;t[42]!==$||t[43]!==R?(j=N("div",{className:"flex flex-col gap-3 p-3",children:[$,R]}),t[42]=$,t[43]=R,t[44]=j):j=t[44];let I;return t[45]!==j||t[46]!==S?(I=N("div",{className:"overflow-hidden rounded-xl border border-border bg-card","data-testid":"api-try-it",children:[S,j]}),t[45]=j,t[46]=S,t[47]=I):I=t[47],I},Ve=t=>{const e=P(51),{operation:s}=t,r=J(),n=`api-operation-${s.operationId}`,o=s.key;let l;e[0]!==s.kind||e[1]!==s.method?(l=i(H,{kind:s.kind,method:s.method,testId:"api-operation-method"}),e[0]=s.kind,e[1]=s.method,e[2]=l):l=e[2];const a=s.functionPath??s.httpPath;let g;e[3]!==a?(g=i("code",{className:"truncate font-mono text-xs text-muted-foreground",children:a}),e[3]=a,e[4]=g):g=e[4];let d;e[5]!==l||e[6]!==g?(d=N("div",{className:"flex items-center gap-2",children:[l,g]}),e[5]=l,e[6]=g,e[7]=d):d=e[7];let c;e[8]!==s.title?(c=i("h1",{className:"text-lg font-semibold text-foreground","data-testid":"api-operation-title",children:s.title}),e[8]=s.title,e[9]=c):c=e[9];let u;e[10]!==s.description?(u=s.description!==void 0&&i("p",{className:"text-sm text-muted-foreground",children:s.description}),e[10]=s.description,e[11]=u):u=e[11];let h;e[12]!==d||e[13]!==c||e[14]!==u?(h=N("header",{className:"sticky top-0 z-10 -mx-6 -mt-6 flex flex-col gap-2 border-b border-border bg-background px-6 pt-6 pb-3",children:[d,c,u]}),e[12]=d,e[13]=c,e[14]=u,e[15]=h):h=e[15];let p;e[16]!==r?(p=r("Try it"),e[16]=r,e[17]=p):p=e[17];let f;e[18]!==p?(f=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:p}),e[18]=p,e[19]=f):f=e[19];let m;e[20]===Symbol.for("react.memo_cache_sentinel")?(m=i(Ue,{}),e[20]=m):m=e[20];let v;e[21]!==f?(v=N("section",{className:"flex flex-col gap-2",children:[f,m]}),e[21]=f,e[22]=v):v=e[22];let k;e[23]!==r?(k=r("Request arguments"),e[23]=r,e[24]=k):k=e[24];let x;e[25]!==k?(x=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:k}),e[25]=k,e[26]=x):x=e[26];let b;e[27]!==s.argsSchema?(b=i(G,{schema:s.argsSchema,testId:"api-operation-args"}),e[27]=s.argsSchema,e[28]=b):b=e[28];let y;e[29]!==x||e[30]!==b?(y=N("section",{className:"flex flex-col gap-2",children:[x,b]}),e[29]=x,e[30]=b,e[31]=y):y=e[31];let S;e[32]!==r?(S=r("Response body"),e[32]=r,e[33]=S):S=e[33];let O;e[34]!==S?(O=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),e[34]=S,e[35]=O):O=e[35];let w;if(e[36]!==s.responses||e[37]!==r){let E;e[39]!==r?(E=$=>N("div",{className:"flex flex-col gap-1.5 rounded-xl border border-border bg-card p-3",children:[N("div",{className:"flex items-center justify-between gap-2",children:[N("span",{className:`inline-flex items-center gap-1.5 font-mono text-xs font-semibold ${te($.status)}`,children:[i("span",{className:`size-1.5 rounded-full ${re($.status)}`}),$.status]}),$.schema!==void 0&&i("span",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:r("application/json")})]}),$.description!==void 0&&i("p",{className:"text-xs text-muted-foreground",children:$.description}),$.schema!==void 0&&i(G,{schema:$.schema,testId:`api-response-${$.status}`})]},$.status),e[39]=r,e[40]=E):E=e[40],w=s.responses.map(E),e[36]=s.responses,e[37]=r,e[38]=w}else w=e[38];let T;e[41]!==O||e[42]!==w?(T=N("section",{className:"flex flex-col gap-3",children:[O,w]}),e[41]=O,e[42]=w,e[43]=T):T=e[43];let A;return e[44]!==s.key||e[45]!==n||e[46]!==v||e[47]!==y||e[48]!==T||e[49]!==h?(A=N("div",{className:"flex flex-col gap-6 duration-200 animate-in fade-in-0 slide-in-from-bottom-1","data-testid":n,children:[h,v,y,T]},o),e[44]=s.key,e[45]=n,e[46]=v,e[47]=y,e[48]=T,e[49]=h,e[50]=A):A=e[50],A},Ge={boolean:"text-royal-amethyst",key:"text-sky-sapphire",number:"text-warning",plain:"",string:"text-success"},Xe=/"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?/g,Ye=/^\s*:/,Qe=(t,e,s)=>s.startsWith('"')?Ye.test(t.slice(e))?"key":"string":s==="true"||s==="false"||s==="null"?"boolean":"number",Ze=t=>{const e=[];let s=0;for(const r of t.matchAll(Xe)){const{index:n}=r,o=r[0],l=n+o.length;n>s&&e.push({kind:"plain",start:s,text:t.slice(s,n)}),e.push({kind:Qe(t,l,o),start:n,text:o}),s=l}return s<t.length&&e.push({kind:"plain",start:s,text:t.slice(s)}),e},et=t=>{const e=P(4),{code:s}=t;let r;e[0]!==s?(r=Ze(s).map(tt),e[0]=s,e[1]=r):r=e[1];let n;return e[2]!==r?(n=i(ye,{children:r}),e[2]=r,e[3]=n):n=e[3],n};function tt(t){return i("span",{className:Ge[t.kind],children:t.text},t.start)}const oe="__live__",rt=t=>t.schema===void 0?"":JSON.stringify(D(t.schema),void 0,2),st=(t,e,s)=>s?t??"":e===void 0?"":JSON.stringify(e,pe,2),nt=t=>{const e=P(18),{active:s,running:r,showError:n}=t,o=J();if(r){let u;e[0]!==o?(u=o("Sending…"),e[0]=o,e[1]=u):u=e[1];let h;return e[2]!==u?(h=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-running",children:u}),e[2]=u,e[3]=h):h=e[3],h}if(s===void 0||s.body===""){let u;e[4]!==s?.live||e[5]!==o?(u=s?.live===!0?o("Send a request to see the response."):o("No example for this response."),e[4]=s?.live,e[5]=o,e[6]=u):u=e[6];let h;return e[7]!==u?(h=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-idle",children:u}),e[7]=u,e[8]=h):h=e[8],h}const l=n&&"text-destructive";let a;e[9]!==l?(a=Q("max-h-[28rem] overflow-auto px-3 py-3 font-mono text-xs",l),e[9]=l,e[10]=a):a=e[10];const g=n?"api-response-error":"api-response-body";let d;e[11]!==s.body||e[12]!==n?(d=n?s.body:i(et,{code:s.body}),e[11]=s.body,e[12]=n,e[13]=d):d=e[13];let c;return e[14]!==a||e[15]!==g||e[16]!==d?(c=i("pre",{className:a,"data-testid":g,children:d}),e[14]=a,e[15]=g,e[16]=d,e[17]=c):c=e[17],c},ot=({durationMs:t,error:e,failed:s,operation:r,ran:n,response:o,t:l})=>{const a=r.responses.map(d=>({body:rt(d),durationMs:null,id:d.status,label:d.status,live:!1,status:d.status}));return n?[{body:st(e,o,s),durationMs:t,id:oe,label:l("Live"),live:!0,status:s?"error":"200"},...a]:a},it=()=>{const t=P(19),e=J(),{durationMs:s,error:r,operation:n,response:o,status:l}=ne(),a=l==="running",g=l==="error",d=l==="success"||g,c=ot({durationMs:s,error:r,failed:g,operation:n,ran:d,response:o,t:e}),u=d?oe:c.find(at)?.id??c[0]?.id??"",[h,p]=L(null),f=c.find(C=>C.id===(h??u))??c[0];let m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=C=>{const{id:_}=C.currentTarget.dataset;_!==void 0&&p(_)},t[0]=m):m=t[0];const v=m,k=()=>{f!==void 0&&Y(f.body)},x=f?.live===!0?f.durationMs:null,b=f?.live===!0&&f.status==="error",y="flex min-h-0 flex-col rounded-xl border border-border bg-card",S="api-response-panel";let O;t[1]!==e?(O=e("Response"),t[1]=e,t[2]=O):O=t[2];let w;t[3]!==O?(w=i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:O}),t[3]=O,t[4]=w):w=t[4];const T=x!==null&&i("span",{className:"font-mono text-[10px] text-muted-foreground",children:e("{ms} ms",{ms:x})}),A=f!==void 0&&f.body!==""&&i(q,{"aria-label":e("Copy"),"data-testid":"api-response-copy",onClick:k,size:"icon-xs",type:"button",variant:"ghost",children:i(W,{icon:ge,strokeWidth:2})});let E;t[5]!==T||t[6]!==A?(E=N("div",{className:"flex items-center gap-2",children:[T,A]}),t[5]=T,t[6]=A,t[7]=E):E=t[7];let $;t[8]!==w||t[9]!==E?($=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[w,E]}),t[8]=w,t[9]=E,t[10]=$):$=t[10];const R=c.length>0&&i("div",{className:"flex gap-1 overflow-x-auto border-b border-border px-2 py-1.5",role:"tablist",children:c.map(C=>{const _=C.id===f?.id;return N("button",{"aria-selected":_,className:Q("inline-flex items-center gap-1.5 rounded px-2 py-0.5 font-mono text-xs transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium",_?te(C.status):"text-muted-foreground"),"data-id":C.id,"data-testid":C.live?"api-response-tab-live":`api-response-tab-${C.status}`,onClick:v,role:"tab",type:"button",children:[i("span",{className:`size-1.5 rounded-full ${re(C.status)}`}),C.label]},C.id)})});let j;t[11]!==f||t[12]!==a||t[13]!==b?(j=i(nt,{active:f,running:a,showError:b}),t[11]=f,t[12]=a,t[13]=b,t[14]=j):j=t[14];let I;return t[15]!==j||t[16]!==$||t[17]!==R?(I=N("div",{className:y,"data-testid":S,children:[$,R,j]}),t[15]=j,t[16]=$,t[17]=R,t[18]=I):I=t[18],I};function at(t){return t.status.startsWith("2")}const lt=(t,e)=>{const s=e.trim().toLowerCase();return s===""?t:t.map(r=>({...r,operations:r.operations.filter(n=>`${n.summary} ${n.operationId}`.toLowerCase().includes(s))})).filter(r=>r.operations.length>0)},$t=t=>{const e=P(53),{model:s}=t,r=J(),n=s.groups[0]?.operations[0]?.key??"",[o,l]=L(n),[a,g]=L("");let d;e[0]!==n||e[1]!==s.operationByKey||e[2]!==o?(d=s.operationByKey.get(o)??s.operationByKey.get(n),e[0]=n,e[1]=s.operationByKey,e[2]=o,e[3]=d):d=e[3];const c=d;let u,h,p,f,m,v,k,x,b,y;if(e[4]!==a||e[5]!==s.groups||e[6]!==s.server||e[7]!==c?.key||e[8]!==r){u=lt(s.groups,a);let E;e[19]===Symbol.for("react.memo_cache_sentinel")?(E=M=>{const{key:B}=M.currentTarget.dataset;B!==void 0&&l(B)},e[19]=E):E=e[19];const $=E;let R;e[20]===Symbol.for("react.memo_cache_sentinel")?(R=M=>{g(M.target.value)},e[20]=R):R=e[20];const j=R;h=s.server??"",b="grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[16rem_minmax(0,1fr)_22rem]",y="api-reference",e[21]!==r?(m=r("API operations"),e[21]=r,e[22]=m):m=e[22],v="flex min-h-0 flex-col overflow-y-auto border-r border-border",k="api-reference-nav";let I;e[23]===Symbol.for("react.memo_cache_sentinel")?(I=i(W,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground",icon:xe,strokeWidth:2}),e[23]=I):I=e[23];let C;e[24]!==r?(C=r("Filter operations"),e[24]=r,e[25]=C):C=e[25],e[26]!==a||e[27]!==C?(x=i("div",{className:"sticky top-0 z-10 border-b border-border bg-sidebar p-2",children:N("div",{className:"relative",children:[I,i(be,{className:"h-7 pl-7","data-testid":"api-filter",onChange:j,placeholder:C,value:a})]})}),e[26]=a,e[27]=C,e[28]=x):x=e[28],p="flex flex-col gap-4 p-2";let _;e[29]!==c?.key||e[30]!==r?(_=M=>N("div",{className:"flex flex-col gap-1",children:[N("div",{className:"flex items-center justify-between px-2",children:[i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M.name||r("(root)")}),i("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:M.operations.length})]}),M.operations.map(B=>{const ie=B.key===c?.key;return N("button",{"aria-current":ie?"page":void 0,className:"flex items-center justify-between gap-2 rounded-md border-l-2 border-transparent px-2 py-1 text-start text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:border-primary aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-key":B.key,"data-testid":`api-nav-${B.operationId}`,onClick:$,type:"button",children:[i("span",{className:"truncate",children:B.summary}),i(H,{kind:B.kind,method:B.method})]},B.key)})]},M.name),e[29]=c?.key,e[30]=r,e[31]=_):_=e[31],f=u.map(_),e[4]=a,e[5]=s.groups,e[6]=s.server,e[7]=c?.key,e[8]=r,e[9]=u,e[10]=h,e[11]=p,e[12]=f,e[13]=m,e[14]=v,e[15]=k,e[16]=x,e[17]=b,e[18]=y}else u=e[9],h=e[10],p=e[11],f=e[12],m=e[13],v=e[14],k=e[15],x=e[16],b=e[17],y=e[18];let S;e[32]!==u.length||e[33]!==r?(S=u.length===0&&i("p",{className:"px-2 py-1 text-xs text-muted-foreground","data-testid":"api-nav-empty",children:r("No operations match your filter.")}),e[32]=u.length,e[33]=r,e[34]=S):S=e[34];let O;e[35]!==S||e[36]!==p||e[37]!==f?(O=N("div",{className:p,children:[f,S]}),e[35]=S,e[36]=p,e[37]=f,e[38]=O):O=e[38];let w;e[39]!==O||e[40]!==m||e[41]!==v||e[42]!==k||e[43]!==x?(w=N("nav",{"aria-label":m,className:v,"data-testid":k,children:[x,O]}),e[39]=O,e[40]=m,e[41]=v,e[42]=k,e[43]=x,e[44]=w):w=e[44];let T;e[45]!==c||e[46]!==h?(T=c===void 0?i("div",{className:"lg:col-span-2"}):N(He,{operation:c,children:[i("div",{className:"min-w-0 overflow-y-auto p-6","data-testid":"api-reference-main",children:i(Ve,{operation:c})}),N("aside",{className:"flex min-w-0 flex-col gap-4 overflow-y-auto border-border p-4 lg:border-l","data-testid":"api-reference-aside",children:[i(_e,{operation:c,server:h}),i(it,{})]})]},c.key),e[45]=c,e[46]=h,e[47]=T):T=e[47];let A;return e[48]!==w||e[49]!==T||e[50]!==b||e[51]!==y?(A=N("div",{className:b,"data-testid":y,children:[w,T]}),e[48]=w,e[49]=T,e[50]=b,e[51]=y,e[52]=A):A=e[52],A};export{$t as R,Ot as u};
@@ -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-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};
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-CyDwqA67.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{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};
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-CyDwqA67.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-BPu1a997.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};