@lunora/studio 1.0.0-alpha.122 → 1.0.0-alpha.124

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 (168) hide show
  1. package/dist/index.d.ts +46 -1
  2. package/dist/index.js +1 -1
  3. package/dist/mount.js +1 -1
  4. package/dist/packem_chunks/AdvisorHealthPanel.js +1 -1
  5. package/dist/packem_chunks/ApiTab.js +1 -1
  6. package/dist/packem_chunks/AuditPanel.js +1 -1
  7. package/dist/packem_chunks/DeploymentHealthPanel.js +1 -1
  8. package/dist/packem_chunks/ExportImportPanel.js +1 -1
  9. package/dist/packem_chunks/FileBrowser.js +1 -1
  10. package/dist/packem_chunks/FunctionRunner.js +1 -1
  11. package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
  12. package/dist/packem_chunks/HealthPanel.js +1 -1
  13. package/dist/packem_chunks/InsightsPanel.js +1 -1
  14. package/dist/packem_chunks/LogsPanel.js +1 -1
  15. package/dist/packem_chunks/MailPanel.js +1 -1
  16. package/dist/packem_chunks/MetricsPanel.js +1 -1
  17. package/dist/packem_chunks/NotificationsPanel.js +1 -1
  18. package/dist/packem_chunks/PitrPanel.js +1 -1
  19. package/dist/packem_chunks/SchemaViewer.js +1 -1
  20. package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
  21. package/dist/packem_chunks/SettingsPanel.js +1 -1
  22. package/dist/packem_chunks/SqlEditorPanel.js +1 -1
  23. package/dist/packem_chunks/TableEditor.js +1 -1
  24. package/dist/packem_chunks/agents-panel.js +1 -1
  25. package/dist/packem_chunks/analytics-panel.js +1 -1
  26. package/dist/packem_chunks/auth-audit-panel.js +1 -1
  27. package/dist/packem_chunks/auth-config-panel.js +1 -1
  28. package/dist/packem_chunks/auth-sessions-panel.js +1 -1
  29. package/dist/packem_chunks/containers-panel.js +1 -1
  30. package/dist/packem_chunks/dashboards-panel.js +1 -1
  31. package/dist/packem_chunks/evals-panel.js +1 -1
  32. package/dist/packem_chunks/fanout-panel.js +1 -1
  33. package/dist/packem_chunks/flags-panel.js +1 -1
  34. package/dist/packem_chunks/issues-panel.js +1 -1
  35. package/dist/packem_chunks/kv-browser.js +1 -1
  36. package/dist/packem_chunks/log-drains-panel.js +1 -1
  37. package/dist/packem_chunks/migrations-route.js +1 -1
  38. package/dist/packem_chunks/organizations-panel.js +1 -1
  39. package/dist/packem_chunks/payments-panel.js +1 -1
  40. package/dist/packem_chunks/permissions-panel.js +1 -1
  41. package/dist/packem_chunks/queues-panel.js +1 -1
  42. package/dist/packem_chunks/reactors-panel.js +1 -1
  43. package/dist/packem_chunks/rls-panel.js +1 -1
  44. package/dist/packem_chunks/schedule-panel.js +1 -1
  45. package/dist/packem_chunks/storage-rules-panel.js +1 -1
  46. package/dist/packem_chunks/subscriptions-panel.js +1 -1
  47. package/dist/packem_chunks/sync-client-panel.js +1 -1
  48. package/dist/packem_chunks/traces-panel.js +1 -1
  49. package/dist/packem_chunks/users-panel.js +1 -1
  50. package/dist/packem_chunks/vector-browser.js +1 -1
  51. package/dist/packem_chunks/workflows-panel.js +1 -1
  52. package/dist/packem_shared/{ApiDocsPanel-BMzLPgvv.js → ApiDocsPanel-Du1L7Ysj.js} +1 -1
  53. package/dist/packem_shared/{ApiReferencePanel-CZDVN7zg.js → ApiReferencePanel-uGgGOBYj.js} +1 -1
  54. package/dist/packem_shared/{CommandPalette-kQLn0xlS.js → CommandPalette-HqiXrWIm.js} +1 -1
  55. package/dist/packem_shared/DataBrowser-W5TxvLB8.js +4 -0
  56. package/dist/packem_shared/GlobalDataBrowser-LFznuyGe.js +1 -0
  57. package/dist/packem_shared/{HomePanel-B-tcMcTZ.js → HomePanel-DmB0EKjl.js} +1 -1
  58. package/dist/packem_shared/{MigrationsPanel-CLRWwPyL.js → MigrationsPanel-BDNt136v.js} +1 -1
  59. package/dist/packem_shared/{OpenRpcReferencePanel-XoYdKuMg.js → OpenRpcReferencePanel-DgrpASYD.js} +1 -1
  60. package/dist/packem_shared/{ScheduledJobs-DRmOKtDa.js → ScheduledJobs-CiO3eXgI.js} +1 -1
  61. package/dist/packem_shared/Studio-CkNE_tEy.js +1 -0
  62. package/dist/packem_shared/{StudioApp-Bxmtp-Fi.js → StudioApp-BZP_0E2n.js} +1 -1
  63. package/dist/packem_shared/{advisor-view-CqCG22DB.js → advisor-view-C1KFTXSH.js} +1 -1
  64. package/dist/packem_shared/control-button-BOZ5K-FC.js +1 -0
  65. package/dist/packem_shared/{data-grid-pjv4t5Yi.js → data-grid-BFTQnkXq.js} +1 -1
  66. package/dist/packem_shared/{error-alert-CKqB2CiN.js → error-alert-TYdKetJd.js} +1 -1
  67. package/dist/packem_shared/grid-features-jBzZGauv.js +6 -0
  68. package/dist/packem_shared/{home-panel-ecz6-nHV.js → home-panel-DHOa3sxt.js} +1 -1
  69. package/dist/packem_shared/{internal-7bgd8inO.js → internal-CwaF9YNk.js} +1 -1
  70. package/dist/packem_shared/{log-line-D0XBZaDn.js → log-line-UnE93Ovi.js} +1 -1
  71. package/dist/packem_shared/quote-identifier-CGiYFBvY.js +1 -0
  72. package/dist/packem_shared/{recording-client-BPY8sYUl.js → recording-client-CKn4-vUx.js} +1 -1
  73. package/dist/packem_shared/{reference-view-DY3CaRxH.js → reference-view-BU2dNK9Z.js} +1 -1
  74. package/dist/packem_shared/{schema-diagram-DLhppqVE.js → schema-diagram-DOaIh1y6.js} +1 -1
  75. package/dist/packem_shared/{sql-result-table-blxdNVJ0.js → sql-result-table-CqlZo2QN.js} +1 -1
  76. package/dist/packem_shared/{studio-Cvdwfzxm.js → studio-CXai1O2K.js} +1 -1
  77. package/dist/packem_shared/table-list-sidebar-BWq_-gtu.js +1 -0
  78. package/dist/packem_shared/{use-admin-query-DV9xmFl8.js → use-admin-query-P0RJrjsD.js} +1 -1
  79. package/dist/packem_shared/{use-async-submit-C9xXjXWX.js → use-async-submit-DdLd0MdK.js} +1 -1
  80. package/dist/packem_shared/{use-auth-config-DIAyVsa3.js → use-auth-config-z3KRWAqD.js} +1 -1
  81. package/dist/packem_shared/{use-open-trace-ClAdPkGD.js → use-open-trace-4mqqFWrn.js} +1 -1
  82. package/dist/packem_shared/{use-sql-assistant-CXgVX_PP.js → use-sql-assistant-D1K2LqpO.js} +1 -1
  83. package/dist/standalone/{chunk-5XMZP64Z.js → chunk-26VREVWU.js} +1 -1
  84. package/dist/standalone/{chunk-K3SXMDKL.js → chunk-2XWSDIDE.js} +1 -1
  85. package/dist/standalone/{chunk-R7EV3YND.js → chunk-3XH6Y5XR.js} +1 -1
  86. package/dist/standalone/chunk-443UDYWL.js +6 -0
  87. package/dist/standalone/{chunk-EIWXXEVA.js → chunk-4NIGWKLB.js} +1 -1
  88. package/dist/standalone/{chunk-TCAX32PK.js → chunk-52EGR2D7.js} +1 -1
  89. package/dist/standalone/{chunk-2HW5M4MK.js → chunk-52XAAEXT.js} +1 -1
  90. package/dist/standalone/{chunk-7MO56FXL.js → chunk-5AZRLELE.js} +1 -1
  91. package/dist/standalone/{chunk-DXXXNZ3P.js → chunk-5RC2J7EQ.js} +1 -1
  92. package/dist/standalone/{chunk-7EOXUWAI.js → chunk-6OP4OPZL.js} +1 -1
  93. package/dist/standalone/{chunk-BKM6PMSO.js → chunk-6ZPTNC34.js} +1 -1
  94. package/dist/standalone/{chunk-T7DJP5HM.js → chunk-76YLMHR3.js} +1 -1
  95. package/dist/standalone/{chunk-UBT2FIU5.js → chunk-BFCUKERU.js} +1 -1
  96. package/dist/standalone/{chunk-33TNFS73.js → chunk-C4KVCFWK.js} +1 -1
  97. package/dist/standalone/{chunk-5DEXJ766.js → chunk-CDSCHFAO.js} +1 -1
  98. package/dist/standalone/{chunk-GISVVEPU.js → chunk-CORGKNPG.js} +1 -1
  99. package/dist/standalone/{chunk-KNI5YDPT.js → chunk-CXCSFWBE.js} +1 -1
  100. package/dist/standalone/{chunk-SQSMHFA7.js → chunk-CXYGKZKS.js} +1 -1
  101. package/dist/standalone/{chunk-GDC3W3DZ.js → chunk-DPNKDUJC.js} +1 -1
  102. package/dist/standalone/{chunk-POD66K2Y.js → chunk-EKZA2SNK.js} +1 -1
  103. package/dist/standalone/{chunk-VYW2PAWC.js → chunk-FDLSPDIC.js} +4 -4
  104. package/dist/standalone/{chunk-XYWLXNTV.js → chunk-FJ57FLS4.js} +1 -1
  105. package/dist/standalone/{chunk-2EWSVBWG.js → chunk-FM2JJJO7.js} +1 -1
  106. package/dist/standalone/{chunk-UDCFI5NF.js → chunk-FW2XISZX.js} +1 -1
  107. package/dist/standalone/{chunk-THTL2KBP.js → chunk-FZQVGJMN.js} +1 -1
  108. package/dist/standalone/{chunk-FKXX3Y2J.js → chunk-GHYRLOMN.js} +1 -1
  109. package/dist/standalone/{chunk-6AJONHNM.js → chunk-GIQDEWC4.js} +1 -1
  110. package/dist/standalone/{chunk-TI5RJJRX.js → chunk-HBOCJUOG.js} +1 -1
  111. package/dist/standalone/chunk-HHVCAFE5.js +7 -0
  112. package/dist/standalone/{chunk-E4RVRJHD.js → chunk-HKEMILZM.js} +1 -1
  113. package/dist/standalone/{chunk-GNN5HJ56.js → chunk-ICIYR6A6.js} +1 -1
  114. package/dist/standalone/{chunk-JCSDJBBZ.js → chunk-JCSKFOWL.js} +1 -1
  115. package/dist/standalone/{chunk-UFUOW6UJ.js → chunk-JSRBQSJF.js} +1 -1
  116. package/dist/standalone/{chunk-E6P2ERQV.js → chunk-JURAVSE7.js} +1 -1
  117. package/dist/standalone/chunk-KIU56OEQ.js +11 -0
  118. package/dist/standalone/{chunk-B6YM5NAF.js → chunk-KN3HN3RR.js} +1 -1
  119. package/dist/standalone/chunk-LCQ5HHRP.js +1 -0
  120. package/dist/standalone/{chunk-MTGEDJQH.js → chunk-LY2DCTSE.js} +1 -1
  121. package/dist/standalone/{chunk-VJQAOU2U.js → chunk-MR7UZGEN.js} +1 -1
  122. package/dist/standalone/{chunk-4HWTEDVV.js → chunk-MV7VAZWZ.js} +1 -1
  123. package/dist/standalone/{chunk-AVBUV42G.js → chunk-N3BGHNUY.js} +1 -1
  124. package/dist/standalone/{chunk-MHB2TOAK.js → chunk-NF2SQSOU.js} +1 -1
  125. package/dist/standalone/{chunk-XL2OT5WB.js → chunk-NNLNQKT7.js} +1 -1
  126. package/dist/standalone/chunk-O5MAFDY2.js +1 -0
  127. package/dist/standalone/{chunk-2FFV3NB7.js → chunk-O7SUXUZM.js} +1 -1
  128. package/dist/standalone/{chunk-MLYZZD5C.js → chunk-OE4KGVJW.js} +1 -1
  129. package/dist/standalone/{chunk-2EJQ7SPV.js → chunk-OG57FC7W.js} +1 -1
  130. package/dist/standalone/{chunk-O4RQGUJ7.js → chunk-PC77ZYDR.js} +1 -1
  131. package/dist/standalone/{chunk-PAJQOSEU.js → chunk-QEF6JA57.js} +1 -1
  132. package/dist/standalone/chunk-QHQTOESO.js +1 -0
  133. package/dist/standalone/{chunk-PGTCEMBA.js → chunk-QQHMGTOT.js} +1 -1
  134. package/dist/standalone/{chunk-KTEVBZIV.js → chunk-QWARY4R4.js} +1 -1
  135. package/dist/standalone/{chunk-QBONDY5I.js → chunk-RBD64CEG.js} +1 -1
  136. package/dist/standalone/chunk-RCCQVHVD.js +1 -0
  137. package/dist/standalone/{chunk-VTFMI4DC.js → chunk-RO6ZQZVK.js} +1 -1
  138. package/dist/standalone/{chunk-KJNDUIZG.js → chunk-S7CPEVEC.js} +1 -1
  139. package/dist/standalone/{chunk-XOA5TTRA.js → chunk-SQMJUXBA.js} +1 -1
  140. package/dist/standalone/{chunk-YMVKAXBC.js → chunk-SRQP7SLQ.js} +1 -1
  141. package/dist/standalone/{chunk-TKKRBSUB.js → chunk-SXDZK4EN.js} +1 -1
  142. package/dist/standalone/{chunk-6UN4V2HB.js → chunk-TB5N24CM.js} +1 -1
  143. package/dist/standalone/{chunk-TDH7K7E7.js → chunk-USM7ZIHK.js} +1 -1
  144. package/dist/standalone/{chunk-MG7VPUFA.js → chunk-V6QPVFDL.js} +1 -1
  145. package/dist/standalone/{chunk-U2FRMJAN.js → chunk-VKJS3O3E.js} +1 -1
  146. package/dist/standalone/{chunk-OCZ2IP5A.js → chunk-VLIRSGFL.js} +1 -1
  147. package/dist/standalone/{chunk-3K4F3B56.js → chunk-W5WKMQFK.js} +1 -1
  148. package/dist/standalone/{chunk-U32MMDFO.js → chunk-WED7GO6G.js} +2 -2
  149. package/dist/standalone/{chunk-KR6SZXOI.js → chunk-WJOMJPWF.js} +1 -1
  150. package/dist/standalone/{chunk-RAFPVMXJ.js → chunk-X2CXZPPL.js} +1 -1
  151. package/dist/standalone/{chunk-N7PPYEHW.js → chunk-XT5DGCBY.js} +1 -1
  152. package/dist/standalone/{chunk-ZWATJNSU.js → chunk-YGGQHUKC.js} +1 -1
  153. package/dist/standalone/{chunk-2AJMY73I.js → chunk-YNIOJEFL.js} +1 -1
  154. package/dist/standalone/{chunk-3WFIPW6W.js → chunk-Z5HOZ3HK.js} +1 -1
  155. package/dist/standalone/{chunk-4O7MEQMU.js → chunk-ZQMNQ2EZ.js} +1 -1
  156. package/dist/standalone/studio.js +1 -1
  157. package/package.json +6 -6
  158. package/dist/packem_shared/DataBrowser-C68K5QHO.js +0 -4
  159. package/dist/packem_shared/GlobalDataBrowser-BHFgEqMl.js +0 -1
  160. package/dist/packem_shared/Studio-BYdUxnM5.js +0 -1
  161. package/dist/packem_shared/grid-features-AzpmpR3Q.js +0 -6
  162. package/dist/packem_shared/table-list-sidebar-BCxqrZ0s.js +0 -1
  163. package/dist/standalone/chunk-5QAT5NQ4.js +0 -1
  164. package/dist/standalone/chunk-5VKIJNHE.js +0 -1
  165. package/dist/standalone/chunk-7CVIN6KU.js +0 -6
  166. package/dist/standalone/chunk-FS7FGJOU.js +0 -1
  167. package/dist/standalone/chunk-ICQTVV6U.js +0 -7
  168. package/dist/standalone/chunk-NIUA7EHL.js +0 -11
@@ -0,0 +1,4 @@
1
+ import{c as L}from"react/compiler-runtime";import{useLunora as ot}from"@lunora/react";import{useState as M,useMemo as dt,useRef as He,useCallback as et,useEffect as Le}from"react";import{ShardInput as gn}from"./ShardInput-CdawpUiS.js";import{u as Xe}from"./use-admin-query-P0RJrjsD.js";import{ADMIN_FUNCTIONS as le}from"./ADMIN_FUNCTIONS-B6z7VLYt.js";import{b as $t}from"./browser-storage-BH1MxLZs.js";import{h as Be,f as be,j as pn,c as Te,d as we,i as bn}from"./internal-CwaF9YNk.js";import{m as hn,c as Dt,d as lt,G as xn,a as vn,u as rt,b as wn,T as yn,D as Sn}from"./table-list-sidebar-BWq_-gtu.js";import{u as Cn}from"./use-sql-assistant-D1K2LqpO.js";import{ConfirmButton as ut}from"./ConfirmButton-Cj2SOapE.js";import{E as Nn}from"./empty-state-B939z6K2.js";import{useT as re}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{C as ft,a as Ie}from"./control-button-BOZ5K-FC.js";import{useReactTable as kn,getSortedRowModel as Tn,getCoreRowModel as En,flexRender as _n}from"@tanstack/react-table";import{useVirtualizer as Rn}from"@tanstack/react-virtual";import{C as gt}from"./checkbox-C5w53W-E.js";import{c as tt}from"./utils-bhneXptQ.js";import{f as $n}from"./virtual-rect-D_j7aLxX.js";import{C as it,G as Dn,T as In}from"./data-grid-BFTQnkXq.js";import{jsxs as _,jsx as f,Fragment as nt}from"react/jsx-runtime";import{DataFilters as Mn,toFilterClauses as Ve}from"./DataFilters-3nbW0uax.js";import{G as An,C as On}from"./grid-features-jBzZGauv.js";import{M as It}from"./modal-shell-wGW4CKEW.js";import{e as Fn,a as Pn,i as Vn,d as Ln}from"./wire-codec-Dl3VeNrd.js";import vt from"./useDebounced-DVeQ5-oW.js";import{r as Bn,l as zn}from"./shard-history-DU5b3QDI.js";const wt=(o,e)=>{const n=[];for(const[s,t]of Object.entries(e))for(const a of t)a.ref===o&&n.push({column:a.name,table:s});return n.sort((s,t)=>s.table.localeCompare(t.table)||s.column.localeCompare(t.column)),n},pt=o=>`${o.table}.${o.column}`,jn=(o,e,n,s,t=300)=>{if(s<=0)return{ids:new Set(o.map(u=>u.id)),leadPx:0,tailPx:0};const a=n-t,l=n+s+t,i=new Set;let r=0,c=0,g=0;for(const u of o){const m=u.getSize(),d=e.has(u.id),p=r+m>a&&r<l;d||p?i.add(u.id):r<a?c+=m:g+=m,r+=m}return{ids:i,leadPx:c,tailPx:g}},Gn=(o,e)=>{const n=new Map;let s=0;for(const t of o)e.has(t.id)&&(n.set(t.id,s),s+=t.getSize());return n},Jn=()=>{const o=L(11);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={},o[0]=e):e=o[0];const[n,s]=M(e);let t;o[1]===Symbol.for("react.memo_cache_sentinel")?(t=(d,p,b)=>{s(h=>({...h,[d]:{...h[d],[p]:b}}))},o[1]=t):t=o[1];const a=t;let l;o[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{s({})},o[2]=l):l=o[2];const i=l;let r;o[3]!==n?(r=(d,p)=>{const b=n[d];return b!==void 0&&p in b?{value:b[p]}:void 0},o[3]=n,o[4]=r):r=o[4];const c=r;let g;o[5]!==n?(g=Object.values(n).reduce(Kn,0),o[5]=n,o[6]=g):g=o[6];const u=g;let m;return o[7]!==u||o[8]!==n||o[9]!==c?(m={clear:i,count:u,stage:a,staged:n,stagedValue:c},o[7]=u,o[8]=n,o[9]=c,o[10]=m):m=o[10],m},Mt=(o,e)=>{if(typeof e=="number"){const n=Number(o);return o.trim()===""||Number.isNaN(n)?o:n}if(typeof e=="boolean"){if(o==="true")return!0;if(o==="false")return!1}return o},qn=o=>{const e=L(29),{changes:n,committing:s,onCommit:t,onDiscard:a}=o,l=re();let i;e[0]!==n.length||e[1]!==l?(i=l("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=l,e[2]=i):i=e[2];let r;e[3]!==i?(r=f("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:i}),e[3]=i,e[4]=r):r=e[4];let c;e[5]!==s||e[6]!==l?(c=l(s?"Committing…":"Commit"),e[5]=s,e[6]=l,e[7]=c):c=e[7];let g;e[8]!==s||e[9]!==t||e[10]!==c?(g=f("button",{className:"ms-auto rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-commit",disabled:s,onClick:t,type:"button",children:c}),e[8]=s,e[9]=t,e[10]=c,e[11]=g):g=e[11];let u;e[12]!==l?(u=l("Discard"),e[12]=l,e[13]=u):u=e[13];let m;e[14]!==s||e[15]!==a||e[16]!==u?(m=f("button",{className:"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","data-testid":"db-staged-discard",disabled:s,onClick:a,type:"button",children:u}),e[14]=s,e[15]=a,e[16]=u,e[17]=m):m=e[17];let d;e[18]!==r||e[19]!==g||e[20]!==m?(d=_("div",{className:"flex flex-wrap items-center gap-2",children:[r,g,m]}),e[18]=r,e[19]=g,e[20]=m,e[21]=d):d=e[21];let p;e[22]!==n?(p=n.map(Wn),e[22]=n,e[23]=p):p=e[23];let b;e[24]!==p?(b=f("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:p}),e[24]=p,e[25]=b):b=e[25];let h;return e[26]!==d||e[27]!==b?(h=_("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[d,b]}),e[26]=d,e[27]=b,e[28]=h):h=e[28],h};function Kn(o,e){return o+Object.keys(e).length}function Wn(o){return _("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[_("span",{className:"text-muted-foreground",children:[o.rowId,".",o.column]}),f("span",{className:"text-destructive line-through",children:Be(o.oldValue)}),f("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),f("span",{className:"text-foreground",children:Be(o.newValue)})]},`${o.rowId}:${o.column}`)}const yt=400,Hn=36,Qn={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},Un={width:"100%"},Yn=/\n$/u,Xn={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Zn={display:"flex",width:"100%"},St={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},eo="2.5rem",At={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},bt=o=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${o.toString()}px`}),Ot=(o,e)=>({...bt(o),left:`calc(${eo} + ${e.toString()}px)`,position:"sticky",zIndex:2}),Ct="rounded-md px-2 py-0.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",to=(o,e,n)=>e.enabled&&e.columns.has(n)?void 0:o,mt="__back__:",no=o=>`${mt}${o.table}.${o.column}`,oo=o=>{const e=L(3),{counts:n,rowId:s}=o;if(n===void 0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=f("span",{className:"text-muted-foreground/50",children:"—"}),e[0]=l):l=e[0],l}const t=n[s]??0;let a;return e[1]!==t?(a=f("span",{className:"tabular-nums",children:t}),e[1]=t,e[2]=a):a=e[2],a},ke=o=>{for(const e of["id","__id__","_id"]){const n=o[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},so=(o,e)=>{if(e.enumValues!==void 0&&e.enumValues.length>0)return e.enumValues.includes(o)||o===""&&e.nullable===!0?{value:o===""?null:o}:void 0;if(e.type==="boolean")return o==="true"||o==="false"?{value:o==="true"}:void 0;if(e.type==="number"){const n=Number(o);return o.trim()===""||!Number.isFinite(n)?void 0:{value:n}}return{value:o}},lo=(o,e,n)=>{if(n!==void 0&&n.type!=="any")return so(o,n);const s=Mt(o,e);return typeof e=="number"&&typeof s!="number"?void 0:{value:s}},ro=({anchor:o,columnIds:e,columnMeta:n,editableColumn:s,rows:t,text:a})=>{const l=a.replaceAll(`\r
2
+ `,`
3
+ `).replace(Yn,"").split(`
4
+ `),i=[];let r=0;for(const[c,g]of l.entries()){const u=t[o.row+c],m=u===void 0?null:ke(u),d=g.split(" ");if(u===void 0||m===null){r+=d.length;continue}for(const[p,b]of d.entries()){const h=e[o.col+p],y=h===void 0||!s(h)?void 0:lo(b,u[h],n?.[h]);h===void 0||y===void 0?r+=1:i.push({column:h,rowId:m,value:y.value})}}return{edits:i,skipped:r}},Ft=(o,e)=>ke(o)??`row-${e.toString()}`,io=8,ao=o=>{const e=L(17),{anchor:n,mask:s,state:t}=o,a=re();let l;e[0]!==n.left||e[1]!==n.top?(l={left:n.left,position:"fixed",top:n.top,zIndex:50},e[0]=n.left,e[1]=n.top,e[2]=l):l=e[2];const i=l;let r;if(t==="loading"){let g;e[3]!==a?(g=a("Loading…"),e[3]=a,e[4]=g):g=e[4];let u;e[5]!==g?(u=f("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:g}),e[5]=g,e[6]=u):u=e[6],r=u}else if(t.row===null){let g;e[7]!==a?(g=a("No matching row."),e[7]=a,e[8]=g):g=e[8];let u;e[9]!==g?(u=f("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:g}),e[9]=g,e[10]=u):u=e[10],r=u}else{let g;if(e[11]!==s||e[12]!==t.row){const u=Object.entries(Dt(t.row,s)).slice(0,io);g=f("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 px-3 py-2",children:u.map(yo)}),e[11]=s,e[12]=t.row,e[13]=g}else g=e[13];r=g}let c;return e[14]!==r||e[15]!==i?(c=f("div",{className:"pointer-events-none w-72 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground","data-testid":"db-ref-preview",role:"tooltip",style:i,children:r}),e[14]=r,e[15]=i,e[16]=c):c=e[16],c},co=o=>{const e=L(24),{column:n,id:s,maskViewFor:t,onNavigate:a,onPreview:l,target:i}=o,[r,c]=M(null),[g,u]=M("idle");let m;e[0]!==s||e[1]!==a||e[2]!==i?(m=()=>{a(i,s)},e[0]=s,e[1]=a,e[2]=i,e[3]=m):m=e[3];const d=m;let p;e[4]!==s||e[5]!==l||e[6]!==g||e[7]!==i?(p=C=>{const S=C.currentTarget.getBoundingClientRect();if(c({left:S.left,top:S.bottom+4}),g!=="idle")return;u("loading"),be((async()=>{try{u({row:await l(i,s)})}catch{u({row:null})}})())},e[4]=s,e[5]=l,e[6]=g,e[7]=i,e[8]=p):p=e[8];const b=p;let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{c(null)},e[9]=h):h=e[9];const y=h,x=`db-ref-${n}`,v=`Open ${i} ${s}`;let w;e[10]!==s||e[11]!==d||e[12]!==b||e[13]!==x||e[14]!==v?(w=_("button",{"data-testid":x,onBlur:y,onClick:d,onFocus:b,onMouseEnter:b,onMouseLeave:y,title:v,type:"button",children:[s," ↗"]}),e[10]=s,e[11]=d,e[12]=b,e[13]=x,e[14]=v,e[15]=w):w=e[15];let N;e[16]!==r||e[17]!==t||e[18]!==g||e[19]!==i?(N=r!==null&&g!=="idle"&&f(ao,{anchor:r,mask:t(i,g==="loading"||g.row===null?[]:Object.keys(g.row)),state:g}),e[16]=r,e[17]=t,e[18]=g,e[19]=i,e[20]=N):N=e[20];let T;return e[21]!==w||e[22]!==N?(T=_(nt,{children:[w,N]}),e[21]=w,e[22]=N,e[23]=T):T=e[23],T},uo=o=>o==="asc"?" ▲":o==="desc"?" ▼":"",fo="absolute end-1 top-1/2 hidden -translate-y-1/2 items-center justify-center rounded text-muted-foreground outline-none group-hover/cell:flex hover:text-foreground focus-visible:flex",Nt=o=>{const e=L(8),{column:n,onExpand:s,value:t}=o;let a;e[0]!==n||e[1]!==s||e[2]!==t?(a=()=>{s(n,t)},e[0]=n,e[1]=s,e[2]=t,e[3]=a):a=e[3];const l=a,i=`db-expand-${n}`;let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=f("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:f("path",{d:"M9 21H5a2 2 0 0 1-2-2v-4m18 0v4a2 2 0 0 1-2 2h-4M3 9V5a2 2 0 0 1 2-2h4m6 0h4a2 2 0 0 1 2 2v4"})}),e[4]=r):r=e[4];let c;return e[5]!==l||e[6]!==i?(c=f("button",{"aria-label":"Expand cell",className:fo,"data-testid":i,onClick:l,type:"button",children:r}),e[5]=l,e[6]=i,e[7]=c):c=e[7],c},mo=o=>{const e=L(15),{column:n,initial:s,onCancel:t,onCommit:a,recordId:l}=o,i=He(null);let r,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{i.current?.select()},c=[],e[0]=r,e[1]=c):(r=e[0],c=e[1]),Le(r,c);let g;e[2]!==t||e[3]!==a?(g=y=>{y.key==="Enter"?(y.preventDefault(),a(y.currentTarget.value)):y.key==="Escape"&&(y.preventDefault(),t())},e[2]=t,e[3]=a,e[4]=g):g=e[4];const u=g;let m;e[5]!==a?(m=y=>{a(y.currentTarget.value)},e[5]=a,e[6]=m):m=e[6];const d=m,p=`db-cell-input-${l}-${n}`;let b;e[7]!==s?(b=Be(s),e[7]=s,e[8]=b):b=e[8];let h;return e[9]!==n||e[10]!==d||e[11]!==u||e[12]!==p||e[13]!==b?(h=f("input",{"aria-label":n,className:"w-full rounded border border-ring bg-background px-1 py-0.5 font-mono text-xs outline-none","data-testid":p,defaultValue:b,onBlur:d,onKeyDown:u,ref:i}),e[9]=n,e[10]=d,e[11]=u,e[12]=p,e[13]=b,e[14]=h):h=e[14],h},go=o=>{const e=L(70),{cell:n,edit:s,highlight:t,mask:a,refs:l}=o,i=n.column.id;let r,c,g,u;if(e[0]!==n||e[1]!==i||e[2]!==s||e[3]!==a||e[4]!==l.columns||e[5]!==l.maskViewFor||e[6]!==l.onNavigate||e[7]!==l.onPreview){u=Symbol.for("react.early_return_sentinel");e:{c=n.getValue(),r=ke(n.row.original);const $=l.columns?.[i];if(a.enabled&&a.columns.has(i)){const E=`db-masked-${i}`,D=f(it,{value:hn(c,i,a)});let R;e[12]!==E||e[13]!==D?(R=f("span",{className:"text-muted-foreground italic","data-testid":E,title:"Masked (preview)",children:D}),e[12]=E,e[13]=D,e[14]=R):R=e[14],u=R;break e}if($!==void 0&&(typeof c=="string"||typeof c=="number")&&String(c)!==""){const E=String(c),D=`${$}:${String(c)}`;let R;e[15]!==i||e[16]!==l.maskViewFor||e[17]!==l.onNavigate||e[18]!==l.onPreview||e[19]!==E||e[20]!==D||e[21]!==$?(R=f(co,{column:i,id:E,maskViewFor:l.maskViewFor,onNavigate:l.onNavigate,onPreview:l.onPreview,target:$},D),e[15]=i,e[16]=l.maskViewFor,e[17]=l.onNavigate,e[18]=l.onPreview,e[19]=E,e[20]=D,e[21]=$,e[22]=R):R=e[22],u=R;break e}if(r===null){let E;e[23]!==c?(E=f(it,{value:c}),e[23]=c,e[24]=E):E=e[24];let D;e[25]!==i||e[26]!==s.onExpandCell||e[27]!==c?(D=f(Nt,{column:i,onExpand:s.onExpandCell,value:c}),e[25]=i,e[26]=s.onExpandCell,e[27]=c,e[28]=D):D=e[28];let R;e[29]!==E||e[30]!==D?(R=_(nt,{children:[E,D]}),e[29]=E,e[30]=D,e[31]=R):R=e[31],u=R;break e}g=s.stagedValue(r,i)}e[0]=n,e[1]=i,e[2]=s,e[3]=a,e[4]=l.columns,e[5]=l.maskViewFor,e[6]=l.onNavigate,e[7]=l.onPreview,e[8]=r,e[9]=c,e[10]=g,e[11]=u}else r=e[8],c=e[9],g=e[10],u=e[11];if(u!==Symbol.for("react.early_return_sentinel"))return u;const m=g,d=m===void 0?c:m.value;let p;e[32]!==i||e[33]!==s?(p=s.editable&&s.editableColumn(i),e[32]=i,e[33]=s,e[34]=p):p=e[34];const b=p;if(s.editingCell!==null&&s.editingCell.rowId===r&&s.editingCell.column===i){let $;e[35]!==i||e[36]!==s||e[37]!==r||e[38]!==c?($=D=>{s.stage(r,i,Mt(D,c)),s.cancelEdit()},e[35]=i,e[36]=s,e[37]=r,e[38]=c,e[39]=$):$=e[39];let E;return e[40]!==i||e[41]!==d||e[42]!==s.cancelEdit||e[43]!==r||e[44]!==$?(E=f(mo,{column:i,initial:d,onCancel:s.cancelEdit,onCommit:$,recordId:r}),e[40]=i,e[41]=d,e[42]=s.cancelEdit,e[43]=r,e[44]=$,e[45]=E):E=e[45],E}let y;m!==void 0?y="rounded bg-warning/15 px-1":b&&(y="cursor-text");let x;e[46]!==b||e[47]!==i||e[48]!==s||e[49]!==r?(x=b?()=>{s.startEdit(r,i)}:void 0,e[46]=b,e[47]=i,e[48]=s,e[49]=r,e[50]=x):x=e[50];const v=x,w=y,N=`db-cell-${r}-${i}`;let T;e[51]!==i||e[52]!==t||e[53]!==a?(T=to(t,a,i),e[51]=i,e[52]=t,e[53]=a,e[54]=T):T=e[54];let C;e[55]!==d||e[56]!==T?(C=f(it,{highlight:T,value:d}),e[55]=d,e[56]=T,e[57]=C):C=e[57];let S;e[58]!==y||e[59]!==v||e[60]!==N||e[61]!==C?(S=f("span",{className:w,"data-testid":N,onDoubleClick:v,children:C}),e[58]=y,e[59]=v,e[60]=N,e[61]=C,e[62]=S):S=e[62];let k;e[63]!==i||e[64]!==d||e[65]!==s.onExpandCell?(k=f(Nt,{column:i,onExpand:s.onExpandCell,value:d}),e[63]=i,e[64]=d,e[65]=s.onExpandCell,e[66]=k):k=e[66];let A;return e[67]!==k||e[68]!==S?(A=_(nt,{children:[S,k]}),e[67]=k,e[68]=S,e[69]=A):A=e[69],A},po=o=>{o.preventDefault()},kt={any:"?",array:"[]",bigint:"#",boolean:"01",bytes:"0x",id:"→",number:"#",object:"{}",storage:"◫",string:"T",union:"|"},bo=({declaredType:o,draggedRef:e,header:n,masked:s=!1,onTogglePin:t,pinnedOffset:a,table:l})=>{const i=()=>{e.current=n.column.id},r=()=>{const c=e.current,g=n.column.id;if(e.current=null,c===null||c===g)return;const u=l.getState().columnOrder,d=(u.length>0?u:l.getAllLeafColumns().map(b=>b.id)).filter(b=>b!==c),p=d.indexOf(g);d.splice(p===-1?d.length:p,0,c),l.setColumnOrder(d)};return _("th",{className:tt("group/head text-start text-xs font-medium text-muted-foreground",a!==void 0&&"border-e border-border bg-muted"),draggable:!0,onDragOver:po,onDragStart:i,onDrop:r,style:a===void 0?bt(n.getSize()):Ot(n.getSize(),a),children:[_("button",{className:"inline-flex max-w-full cursor-grab items-center gap-1 truncate outline-none hover:text-foreground","data-testid":`db-sort-${n.column.id}`,onClick:n.column.getToggleSortingHandler(),type:"button",children:[_n(n.column.columnDef.header,n.getContext()),uo(n.column.getIsSorted())]}),o!==void 0&&kt[o]!==void 0&&f("span",{className:"ms-1 font-mono text-[0.625rem] text-muted-foreground/70","data-testid":`db-type-${n.column.id}`,title:o,children:kt[o]}),s&&f("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":`db-mask-chip-${n.column.id}`,title:"This column is masked by a mask() policy",children:"masked"}),f("button",{"aria-label":a===void 0?`Pin ${n.column.id}`:`Unpin ${n.column.id}`,"aria-pressed":a!==void 0,className:tt("ms-1 rounded-sm px-1 text-[0.625rem] outline-none transition-opacity hover:bg-accent focus-visible:bg-accent",a===void 0?"opacity-0 group-hover/head:opacity-100 focus-visible:opacity-100":"opacity-100 text-foreground"),"data-testid":`db-pin-${n.column.id}`,onClick:()=>{t(n.column.id)},type:"button",children:"📌"}),f("span",{"aria-hidden":"true",className:"absolute inset-y-0 end-0 w-1 cursor-col-resize touch-none select-none hover:bg-ring/60 data-[resizing=true]:bg-ring","data-resizing":n.column.getIsResizing(),"data-testid":`db-resize-${n.column.id}`,onMouseDown:n.getResizeHandler(),onTouchStart:n.getResizeHandler()})]})},ho=o=>{const e=L(13),{table:n}=o,s=re();let t;e[0]!==n?(t=g=>{n.toggleAllRowsSelected(g)},e[0]=n,e[1]=t):t=e[1];const a=t;let l;e[2]!==s?(l=s("Select all rows"),e[2]=s,e[3]=l):l=e[3];let i;e[4]!==n?(i=n.getIsAllRowsSelected(),e[4]=n,e[5]=i):i=e[5];let r;e[6]!==n?(r=n.getIsSomeRowsSelected()&&!n.getIsAllRowsSelected(),e[6]=n,e[7]=r):r=e[7];let c;return e[8]!==a||e[9]!==l||e[10]!==i||e[11]!==r?(c=f("th",{className:"bg-muted",style:At,children:f(gt,{"aria-label":l,checked:i,"data-testid":"db-select-all",indeterminate:r,onCheckedChange:a})}),e[8]=a,e[9]=l,e[10]=i,e[11]=r,e[12]=c):c=e[12],c},xo=o=>{const e=L(17),{row:n}=o,s=re();let t;e[0]!==n.original?(t=ke(n.original),e[0]=n.original,e[1]=t):t=e[1];const a=t;let l;e[2]!==n?(l=p=>{n.toggleSelected(p)},e[2]=n,e[3]=l):l=e[3];const i=l;let r;e[4]!==s?(r=s("Select row"),e[4]=s,e[5]=r):r=e[5];let c;e[6]!==n?(c=n.getIsSelected(),e[6]=n,e[7]=c):c=e[7];let g;e[8]!==n.index||e[9]!==n.original?(g=Ft(n.original,n.index),e[8]=n.index,e[9]=n.original,e[10]=g):g=e[10];const u=`db-select-${g}`,m=a===null;let d;return e[11]!==i||e[12]!==r||e[13]!==c||e[14]!==u||e[15]!==m?(d=f("td",{className:"bg-background",style:At,children:f(gt,{"aria-label":r,checked:c,"data-testid":u,disabled:m,onCheckedChange:i})}),e[11]=i,e[12]=r,e[13]=c,e[14]=u,e[15]=m,e[16]=d):d=e[16],d},vo=o=>{const e=L(91),{columnMeta:n,edit:s,editable:t,mask:a,onDelete:l,onEdit:i,onInspect:r,highlight:c,backRelationCounts:g,onTogglePin:u,pinnedColumns:m,refs:d,tableModel:p}=o,b=re(),{attachScroll:h,scrollLeft:y,scrollToIndex:x,table:v,tableRows:w,tbodyStyle:N,viewportWidth:T,virtualRows:C}=p,S=He(null),[k,A]=M(null);let $;e[0]===Symbol.for("react.memo_cache_sentinel")?($={columns:"",count:0},e[0]=$):$=e[0];const[E,D]=M($);let R;e[1]!==v?(R=v.getVisibleLeafColumns(),e[1]=v,e[2]=R):R=e[2];const q=R.length;let O;e[3]!==k||e[4]!==q||e[5]!==s||e[6]!==v||e[7]!==w?(O=oe=>{if(!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"].includes(oe.key))return;oe.preventDefault();const W=k??{col:0,row:0};if(oe.key==="Enter"){const z=w[W.row],ge=v.getVisibleLeafColumns()[W.col];if(z!==void 0&&ge!==void 0){const K=ke(z.original);K!==null&&s.editableColumn(ge.id)&&s.startEdit(K,ge.id)}A(W);return}let{col:ee,row:Q}=W;e:switch(oe.key){case"ArrowDown":{Q=Math.min(Q+1,w.length-1);break e}case"ArrowRight":{ee=Math.min(ee+1,q-1);break e}case"ArrowUp":{Q=Math.max(Q-1,0);break e}default:ee=Math.max(ee-1,0)}A({col:ee,row:Q})},e[3]=k,e[4]=q,e[5]=s,e[6]=v,e[7]=w,e[8]=O):O=e[8];const B=O;let F;e[9]!==k||e[10]!==n||e[11]!==s||e[12]!==v||e[13]!==w?(F=oe=>{const W=s.editable?oe.clipboardData.getData("text/plain"):"";if(W==="")return;oe.preventDefault();const ee=v.getVisibleLeafColumns().map(So),Q=ro({anchor:k??{col:0,row:0},columnIds:ee,columnMeta:n,editableColumn:s.editableColumn,rows:w.map(Co),text:W});for(const z of Q.edits)s.stage(z.rowId,z.column,z.value);D({columns:ee.join("\0"),count:Q.skipped})},e[9]=k,e[10]=n,e[11]=s,e[12]=v,e[13]=w,e[14]=F):F=e[14];const J=F;let H,G;e[15]!==k||e[16]!==x?(H=()=>{k!==null&&x(k.row)},G=[k,x],e[15]=k,e[16]=x,e[17]=H,e[18]=G):(H=e[17],G=e[18]),Le(H,G);let U,ye,ie,he,xe,Se,ce,Ce,de,Z,Ne,ue,fe,se,me,Y;if(e[19]!==k||e[20]!==h||e[21]!==g||e[22]!==n||e[23]!==s||e[24]!==t||e[25]!==c||e[26]!==a||e[27]!==l||e[28]!==i||e[29]!==B||e[30]!==J||e[31]!==r||e[32]!==u||e[33]!==E.columns||e[34]!==E.count||e[35]!==m||e[36]!==d||e[37]!==y||e[38]!==b||e[39]!==v||e[40]!==w||e[41]!==N||e[42]!==T||e[43]!==C){const oe=v.getVisibleLeafColumns().map(No),W=jn(oe,m,y,T),ee=Gn(v.getVisibleLeafColumns().map(ko),m),Q=K=>{const Ee=w[K.index],{original:Ae}=Ee,Oe=ke(Ae),Fe=Ft(Ae,K.index),ze={...Xn,height:`${K.size.toString()}px`,transform:`translateY(${K.start.toString()}px)`};return _("tr",{className:"border-b border-border text-xs transition-colors hover:bg-muted/50","data-testid":"db-row",style:ze,children:[f(xo,{row:Ee}),W.leadPx>0&&f("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),Ee.getVisibleCells().map((pe,je)=>{if(!W.ids.has(pe.column.id))return null;const Pe=ee.get(pe.column.id),Ke=k!==null&&k.row===K.index&&k.col===je?" ring-1 ring-ring ring-inset":"";return f("td",{className:tt("group/cell truncate font-mono text-muted-foreground",Pe!==void 0&&"border-e border-border bg-background",Ke),onPointerDown:()=>{A({col:je,row:K.index})},style:Pe===void 0?bt(pe.column.getSize()):Ot(pe.column.getSize(),Pe),children:pe.column.id.startsWith(mt)?f(oo,{counts:g[pe.column.id.slice(mt.length)],rowId:Fe}):f(go,{cell:pe,edit:s,highlight:c,mask:a,refs:d})},pe.id)}),W.tailPx>0&&f("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),_("td",{className:"flex items-center gap-1",style:St,children:[f("button",{className:Ct,"data-testid":`db-inspect-${Fe}`,onClick:()=>{r(Ae)},type:"button",children:"Details"}),t&&_(nt,{children:[f("button",{className:Ct,"data-testid":`db-edit-${Fe}`,disabled:Oe===null,onClick:()=>{i(Oe,Ae)},type:"button",children:"Edit"}),f(ut,{confirmLabel:"Delete?",disabled:Oe===null,onConfirm:()=>{l(Oe)},testId:`db-delete-${Fe}`,children:"Delete"})]})]})]},Ee.id)};U=Dn,ue="fill",e[60]!==E.columns||e[61]!==E.count||e[62]!==b||e[63]!==v?(fe=E.count>0&&E.columns===v.getVisibleLeafColumns().map(To).join("\0")&&f("p",{className:"border-b border-warning/40 bg-warning/5 px-3 py-1.5 text-xs text-warning","data-testid":"db-paste-skipped",children:b("{count} pasted cells were skipped",{count:E.count})}),e[60]=E.columns,e[61]=E.count,e[62]=b,e[63]=v,e[64]=fe):fe=e[64],xe="db-scroll",Se=B,ce=J,Ce=h,de="grid",Z=Qn,Ne=0,Y="w-full text-xs",ye="db-rows",ie=Un;let z;e[65]!==v?(z=f(ho,{table:v}),e[65]=v,e[66]=z):z=e[66];let ge;e[67]===Symbol.for("react.memo_cache_sentinel")?(ge=f("th",{"aria-label":"Row actions",style:St}),e[67]=ge):ge=e[67],he=f("thead",{className:"bg-muted/50",children:_("tr",{className:"border-b border-border",style:Zn,children:[z,W.leadPx>0&&f("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),v.getFlatHeaders().map(K=>W.ids.has(K.column.id)?f(bo,{declaredType:n?.[K.column.id]?.type,draggedRef:S,header:K,masked:a.columns.has(K.column.id),onTogglePin:u,pinnedOffset:ee.get(K.column.id),table:v},K.id):null),W.tailPx>0&&f("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),ge]})}),se=N,me=C.map(K=>Q(K)),e[19]=k,e[20]=h,e[21]=g,e[22]=n,e[23]=s,e[24]=t,e[25]=c,e[26]=a,e[27]=l,e[28]=i,e[29]=B,e[30]=J,e[31]=r,e[32]=u,e[33]=E.columns,e[34]=E.count,e[35]=m,e[36]=d,e[37]=y,e[38]=b,e[39]=v,e[40]=w,e[41]=N,e[42]=T,e[43]=C,e[44]=U,e[45]=ye,e[46]=ie,e[47]=he,e[48]=xe,e[49]=Se,e[50]=ce,e[51]=Ce,e[52]=de,e[53]=Z,e[54]=Ne,e[55]=ue,e[56]=fe,e[57]=se,e[58]=me,e[59]=Y}else U=e[44],ye=e[45],ie=e[46],he=e[47],xe=e[48],Se=e[49],ce=e[50],Ce=e[51],de=e[52],Z=e[53],Ne=e[54],ue=e[55],fe=e[56],se=e[57],me=e[58],Y=e[59];let j;e[68]!==se||e[69]!==me?(j=f("tbody",{style:se,children:me}),e[68]=se,e[69]=me,e[70]=j):j=e[70];let te;e[71]!==ye||e[72]!==ie||e[73]!==he||e[74]!==j||e[75]!==Y?(te=_("table",{className:Y,"data-testid":ye,style:ie,children:[he,j]}),e[71]=ye,e[72]=ie,e[73]=he,e[74]=j,e[75]=Y,e[76]=te):te=e[76];let ne;e[77]!==xe||e[78]!==Se||e[79]!==ce||e[80]!==Ce||e[81]!==de||e[82]!==Z||e[83]!==Ne||e[84]!==te?(ne=f("div",{"data-testid":xe,onKeyDown:Se,onPaste:ce,ref:Ce,role:de,style:Z,tabIndex:Ne,children:te}),e[77]=xe,e[78]=Se,e[79]=ce,e[80]=Ce,e[81]=de,e[82]=Z,e[83]=Ne,e[84]=te,e[85]=ne):ne=e[85];let Me;return e[86]!==U||e[87]!==ue||e[88]!==fe||e[89]!==ne?(Me=_(U,{layout:ue,children:[fe,ne]}),e[86]=U,e[87]=ue,e[88]=fe,e[89]=ne,e[90]=Me):Me=e[90],Me},wo=(o,e,n,s=[])=>{const t=o?.columns,a=o?.rows,l=o?.refs,i=dt(()=>{if(t===void 0)return[];const S=t.map(k=>({accessorFn:A=>A[k],header:l?.[k]===void 0?k:`${k} →`,id:k}));for(const k of s)S.push({accessorFn:()=>{},enableSorting:!1,header:`← ${k.table}`,id:no(k)});return S},[s,t,l]),r=dt(()=>a??[],[a]),[c,g]=M({}),[u,m]=M({}),d=kn({columnResizeMode:"onChange",columns:i,data:r,defaultColumn:{minSize:80,size:200},enableColumnResizing:!0,enableRowSelection:S=>ke(S.original)!==null,getCoreRowModel:En(),getRowId:(S,k)=>ke(S)??`row-${k.toString()}`,getSortedRowModel:Tn(),manualSorting:!0,onColumnVisibilityChange:m,onRowSelectionChange:g,onSortingChange:n,state:{columnVisibility:u,rowSelection:c,sorting:e}}),p=d.getRowModel().rows,b=He(null),h=Rn({count:p.length,estimateSize:()=>Hn,getScrollElement:()=>b.current,initialRect:{height:yt,width:0},observeElementRect:(S,k)=>$n(S,k,yt),overscan:8}),y=et(S=>{h.scrollToIndex(S)},[h]),[x,v]=M({left:0,width:0}),w=et(S=>{if(b.current=S,S===null)return;const k=()=>{v($=>$.left===S.scrollLeft&&$.width===S.clientWidth?$:{left:S.scrollLeft,width:S.clientWidth})};S.addEventListener("scroll",k,{passive:!0});const A=new ResizeObserver(k);return A.observe(S),()=>{S.removeEventListener("scroll",k),A.disconnect(),b.current=null}},[]),N=h.getVirtualItems(),C={display:"block",height:`${h.getTotalSize().toString()}px`,position:"relative"};return{attachScroll:w,scrollLeft:x.left,scrollToIndex:y,table:d,tableRows:p,tbodyStyle:C,viewportWidth:x.width,virtualRows:N}};function yo(o){const[e,n]=o;return _("div",{className:"contents",children:[f("dt",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e}),f("dd",{className:"truncate font-mono text-[11px] text-foreground",title:Be(n),children:Be(n)})]},e)}function So(o){return o.id}function Co(o){return o.original}function No(o){return{getSize:()=>o.getSize(),id:o.id}}function ko(o){return{getSize:()=>o.getSize(),id:o.id}}function To(o){return o.id}const Eo=o=>{const e=L(22),{onCommit:n}=o,s=re(),[t,a]=M(""),l=He(null);let i,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{l.current?.focus()},r=[],e[0]=i,e[1]=r):(i=e[0],r=e[1]),Le(i,r);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=v=>{a(v.target.value)},e[2]=c):c=e[2];const g=c;let u;e[3]!==t||e[4]!==n?(u=()=>{const v=t.trim();v!==""&&n(v)},e[3]=t,e[4]=n,e[5]=u):u=e[5];const m=u;let d;e[6]!==s?(d=s("Query name"),e[6]=s,e[7]=d):d=e[7];let p;e[8]!==s?(p=s("Query name"),e[8]=s,e[9]=p):p=e[9];let b;e[10]!==t||e[11]!==d||e[12]!==p?(b=f("input",{"aria-label":d,className:"h-7 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"db-save-query-name",onChange:g,placeholder:p,ref:l,value:t}),e[10]=t,e[11]=d,e[12]=p,e[13]=b):b=e[13];let h;e[14]!==s?(h=s("Save"),e[14]=s,e[15]=h):h=e[15];let y;e[16]!==m||e[17]!==h?(y=f("button",{className:ft,"data-testid":"db-save-query-confirm",onClick:m,type:"button",children:h}),e[16]=m,e[17]=h,e[18]=y):y=e[18];let x;return e[19]!==b||e[20]!==y?(x=_("span",{className:"inline-flex items-center gap-1",children:[b,y]}),e[19]=b,e[20]=y,e[21]=x):x=e[21],x},_o=o=>{const e=L(27),{onApply:n,onCopyLink:s,onDelete:t,onSave:a,saved:l}=o,i=re(),[r,c]=M(!1);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{c(!0)},e[0]=g):g=e[0];const u=g;let m;e[1]!==a?(m=C=>{a(C),c(!1)},e[1]=a,e[2]=m):m=e[2];const d=m;let p;e[3]!==n||e[4]!==l?(p=C=>{const S=l[Number(C.currentTarget.dataset.index)];S!==void 0&&n(S)},e[3]=n,e[4]=l,e[5]=p):p=e[5];const b=p;let h;e[6]!==t||e[7]!==l?(h=C=>{const S=l[Number(C.currentTarget.dataset.index)];S!==void 0&&t(S.name)},e[6]=t,e[7]=l,e[8]=h):h=e[8];const y=h;let x;e[9]!==i?(x=i("Copy link"),e[9]=i,e[10]=x):x=e[10];let v;e[11]!==s||e[12]!==x?(v=f("button",{className:ft,"data-testid":"db-copy-link",onClick:s,type:"button",children:x}),e[11]=s,e[12]=x,e[13]=v):v=e[13];let w;e[14]!==d||e[15]!==r||e[16]!==i?(w=r?f(Eo,{onCommit:d}):f("button",{className:ft,"data-testid":"db-save-query",onClick:u,type:"button",children:i("Save query")}),e[14]=d,e[15]=r,e[16]=i,e[17]=w):w=e[17];let N;e[18]!==b||e[19]!==y||e[20]!==l||e[21]!==i?(N=l.length>0&&_("div",{className:"flex flex-wrap items-center gap-1","data-testid":"db-saved-queries",children:[f("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:i("Saved")}),l.map((C,S)=>_("span",{className:"inline-flex items-center overflow-hidden rounded-md border border-border",children:[f("button",{className:"px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-accent","data-index":S,"data-testid":`db-saved-query-${C.name}`,onClick:b,type:"button",children:C.name}),f("button",{"aria-label":i("Delete saved query {name}",{name:C.name}),className:"border-l border-border px-1 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive","data-index":S,"data-testid":`db-saved-query-delete-${C.name}`,onClick:y,type:"button",children:"✕"})]},C.name))]}),e[18]=b,e[19]=y,e[20]=l,e[21]=i,e[22]=N):N=e[22];let T;return e[23]!==v||e[24]!==w||e[25]!==N?(T=_("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-query-bar",children:[v,w,N]}),e[23]=v,e[24]=w,e[25]=N,e[26]=T):T=e[26],T},qe="w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus-visible:border-ring",Pt=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Tt=(o,e)=>typeof e=="boolean"?"boolean":typeof e=="number"?Pt.test(o)?"date":"number":e!==null&&typeof e=="object"?"json":"text",Ro=(o,e,n)=>n===void 0?Tt(o,e):n.enumValues!==void 0&&n.enumValues.length>0?"enum":n.type==="boolean"?"boolean":n.type==="number"?Pt.test(o)?"date":"number":Tt(o,e),$o=o=>{try{const e=JSON.parse(o);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}},Do=o=>{const e=new Date(o),n=s=>String(s).padStart(2,"0");return`${e.getFullYear().toString()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`},Je="\0clear",Io=o=>{const e=L(23),{column:n,nullable:s,onChange:t,value:a}=o,l=re();let i;e[0]!==n||e[1]!==t?(i=x=>{t(n,x)},e[0]=n,e[1]=t,e[2]=i):i=e[2];const r=i;let c;e[3]!==n||e[4]!==t?(c=x=>{t(n,x.target.value===Je?null:x.target.value==="true")},e[3]=n,e[4]=t,e[5]=c):c=e[5];const g=c;if(!s&&a!==null){const x=a===!0,v=`db-field-${n}`;let w;return e[6]!==n||e[7]!==r||e[8]!==x||e[9]!==v?(w=f(gt,{"aria-label":n,checked:x,"data-testid":v,onCheckedChange:r}),e[6]=n,e[7]=r,e[8]=x,e[9]=v,e[10]=w):w=e[10],w}const u=`db-field-${n}`,m=a===!0||a===!1?String(a):Je;let d;e[11]!==l?(d=l("(none)"),e[11]=l,e[12]=d):d=e[12];let p;e[13]!==d?(p=f("option",{value:Je,children:d}),e[13]=d,e[14]=p):p=e[14];let b,h;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=f("option",{value:"true",children:"true"}),h=f("option",{value:"false",children:"false"}),e[15]=b,e[16]=h):(b=e[15],h=e[16]);let y;return e[17]!==n||e[18]!==g||e[19]!==u||e[20]!==m||e[21]!==p?(y=_("select",{"aria-label":n,className:qe,"data-testid":u,onChange:g,value:m,children:[p,b,h]}),e[17]=n,e[18]=g,e[19]=u,e[20]=m,e[21]=p,e[22]=y):y=e[22],y},Mo=o=>{const e=L(23),{column:n,nullable:s,onChange:t,options:a,value:l}=o,i=re(),r=typeof l=="string"?l:null;let c;e[0]!==a||e[1]!==r?(c=r!==null&&!a.includes(r),e[0]=a,e[1]=r,e[2]=c):c=e[2];const g=c;let u;e[3]!==n||e[4]!==t?(u=v=>{t(n,v.target.value===Je?null:v.target.value)},e[3]=n,e[4]=t,e[5]=u):u=e[5];const m=u,d=`db-field-${n}`,p=r??Je;let b;e[6]!==s||e[7]!==r||e[8]!==i?(b=(s||r===null)&&f("option",{value:Je,children:i("(none)")}),e[6]=s,e[7]=r,e[8]=i,e[9]=b):b=e[9];let h;e[10]!==r||e[11]!==g?(h=g&&f("option",{value:r,children:r}),e[10]=r,e[11]=g,e[12]=h):h=e[12];let y;e[13]!==a?(y=a.map(Bo),e[13]=a,e[14]=y):y=e[14];let x;return e[15]!==n||e[16]!==m||e[17]!==d||e[18]!==p||e[19]!==b||e[20]!==h||e[21]!==y?(x=_("select",{"aria-label":n,className:qe,"data-testid":d,onChange:m,value:p,children:[b,h,y]}),e[15]=n,e[16]=m,e[17]=d,e[18]=p,e[19]=b,e[20]=h,e[21]=y,e[22]=x):x=e[22],x},Ao=o=>{const e=L(8),{column:n,onChange:s,value:t}=o;let a;e[0]!==n||e[1]!==s?(a=g=>{const u=Number(g.target.value);g.target.value!==""&&!Number.isNaN(u)&&s(n,u)},e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a,i=`db-field-${n}`,r=typeof t=="number"?t:"";let c;return e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==r?(c=f("input",{"aria-label":n,className:qe,"data-testid":i,onChange:l,type:"number",value:r}),e[3]=n,e[4]=l,e[5]=i,e[6]=r,e[7]=c):c=e[7],c},Oo=o=>{const e=L(10),{column:n,onChange:s,value:t}=o;let a;e[0]!==n||e[1]!==s?(a=g=>{const u=new Date(g.target.value).getTime();Number.isNaN(u)||s(n,u)},e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a,i=`db-field-${n}`;let r;e[3]!==t?(r=typeof t=="number"?Do(t):"",e[3]=t,e[4]=r):r=e[4];let c;return e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==r?(c=f("input",{"aria-label":n,className:qe,"data-testid":i,onChange:l,type:"datetime-local",value:r}),e[5]=n,e[6]=l,e[7]=i,e[8]=r,e[9]=c):c=e[9],c},Fo=o=>{const e=L(8),{column:n,onChange:s,value:t}=o;let a;e[0]!==n||e[1]!==s?(a=g=>{s(n,g.target.value)},e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a,i=`db-field-${n}`,r=typeof t=="string"?t:"";let c;return e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==r?(c=f("input",{"aria-label":n,className:qe,"data-testid":i,onChange:l,type:"text",value:r}),e[3]=n,e[4]=l,e[5]=i,e[6]=r,e[7]=c):c=e[7],c},Po=o=>{const e=L(20),{column:n,onChange:s,value:t}=o,a=re();let l;e[0]!==t?(l=()=>JSON.stringify(t,null,2),e[0]=t,e[1]=l):l=e[1];const[i,r]=M(l),[c,g]=M(!1);let u;e[2]!==n||e[3]!==s?(u=v=>{const w=v.target.value;r(w);try{s(n,JSON.parse(w)),g(!1)}catch{g(!0)}},e[2]=n,e[3]=s,e[4]=u):u=e[4];const m=u,d=c&&"border-destructive";let p;e[5]!==d?(p=tt(qe,"min-h-16",d),e[5]=d,e[6]=p):p=e[6];const b=`db-field-${n}`;let h;e[7]!==n||e[8]!==m||e[9]!==p||e[10]!==b||e[11]!==i?(h=f("textarea",{"aria-label":n,className:p,"data-testid":b,onChange:m,value:i}),e[7]=n,e[8]=m,e[9]=p,e[10]=b,e[11]=i,e[12]=h):h=e[12];let y;e[13]!==n||e[14]!==c||e[15]!==a?(y=c&&f("span",{className:"text-xs text-destructive","data-testid":`db-field-error-${n}`,children:a("Invalid JSON")}),e[13]=n,e[14]=c,e[15]=a,e[16]=y):y=e[16];let x;return e[17]!==h||e[18]!==y?(x=_("div",{className:"flex flex-col gap-1",children:[h,y]}),e[17]=h,e[18]=y,e[19]=x):x=e[19],x},Vo=o=>{const e=L(56),{column:n,meta:s,onChange:t,target:a,value:l}=o;let i;e[0]!==n||e[1]!==s||e[2]!==l?(i=Ro(n,l,s),e[0]=n,e[1]=s,e[2]=l,e[3]=i):i=e[3];const r=i,c=`db-field-${n}`;let g;e[4]!==n?(g=f("span",{className:"font-mono",children:n}),e[4]=n,e[5]=g):g=e[5];let u;e[6]!==n||e[7]!==s?(u=s!==void 0&&f("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide","data-testid":`db-field-type-${n}`,children:s.type}),e[6]=n,e[7]=s,e[8]=u):u=e[8];let m;e[9]!==a?(m=a!==void 0&&_("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:["→ ",a]}),e[9]=a,e[10]=m):m=e[10];let d;e[11]!==g||e[12]!==u||e[13]!==m?(d=_("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground",children:[g,u,m]}),e[11]=g,e[12]=u,e[13]=m,e[14]=d):d=e[14];let p;e[15]!==n||e[16]!==r||e[17]!==s?.nullable||e[18]!==t||e[19]!==l?(p=r==="boolean"&&f(Io,{column:n,nullable:s?.nullable===!0,onChange:t,value:l}),e[15]=n,e[16]=r,e[17]=s?.nullable,e[18]=t,e[19]=l,e[20]=p):p=e[20];let b;e[21]!==n||e[22]!==r||e[23]!==s||e[24]!==t||e[25]!==l?(b=r==="enum"&&s?.enumValues!==void 0&&f(Mo,{column:n,nullable:s.nullable===!0,onChange:t,options:s.enumValues,value:l}),e[21]=n,e[22]=r,e[23]=s,e[24]=t,e[25]=l,e[26]=b):b=e[26];let h;e[27]!==n||e[28]!==r||e[29]!==t||e[30]!==l?(h=r==="number"&&f(Ao,{column:n,onChange:t,value:l}),e[27]=n,e[28]=r,e[29]=t,e[30]=l,e[31]=h):h=e[31];let y;e[32]!==n||e[33]!==r||e[34]!==t||e[35]!==l?(y=r==="date"&&f(Oo,{column:n,onChange:t,value:l}),e[32]=n,e[33]=r,e[34]=t,e[35]=l,e[36]=y):y=e[36];let x;e[37]!==n||e[38]!==r||e[39]!==t||e[40]!==l?(x=r==="json"&&f(Po,{column:n,onChange:t,value:l}),e[37]=n,e[38]=r,e[39]=t,e[40]=l,e[41]=x):x=e[41];let v;e[42]!==n||e[43]!==r||e[44]!==t||e[45]!==l?(v=r==="text"&&f(Fo,{column:n,onChange:t,value:l}),e[42]=n,e[43]=r,e[44]=t,e[45]=l,e[46]=v):v=e[46];let w;return e[47]!==y||e[48]!==x||e[49]!==v||e[50]!==c||e[51]!==d||e[52]!==p||e[53]!==b||e[54]!==h?(w=_("label",{className:"flex flex-col gap-1 text-xs",htmlFor:c,children:[d,p,b,h,y,x,v]}),e[47]=y,e[48]=x,e[49]=v,e[50]=c,e[51]=d,e[52]=p,e[53]=b,e[54]=h,e[55]=w):w=e[55],w},Lo=o=>{const e=L(49),{columnMeta:n,documentText:s,onCancel:t,onDocumentTextChange:a,onSave:l,refs:i}=o,r=re();let c;e[0]!==s?(c=$o(s),e[0]=s,e[1]=c):c=e[1];const g=c,[u,m]=M(!1),d=!u&&g!==null;let p;e[2]!==g||e[3]!==a?(p=(H,G)=>{a(JSON.stringify({...g,[H]:G},null,2))},e[2]=g,e[3]=a,e[4]=p):p=e[4];const b=p;let h;e[5]!==a?(h=H=>{a(H.target.value)},e[5]=a,e[6]=h):h=e[6];const y=h;let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{m(!1)},e[7]=x):x=e[7];const v=x;let w;e[8]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{m(!0)},e[8]=w):w=e[8];const N=w,T=g===null;let C;e[9]!==r?(C=r("Form"),e[9]=r,e[10]=C):C=e[10];let S;e[11]!==d||e[12]!==T||e[13]!==C?(S=f("button",{"aria-pressed":d,className:Ie,"data-testid":"db-editor-form",disabled:T,onClick:v,type:"button",children:C}),e[11]=d,e[12]=T,e[13]=C,e[14]=S):S=e[14];const k=!d;let A;e[15]!==r?(A=r("JSON"),e[15]=r,e[16]=A):A=e[16];let $;e[17]!==A||e[18]!==k?($=f("button",{"aria-pressed":k,className:Ie,"data-testid":"db-editor-json",onClick:N,type:"button",children:A}),e[17]=A,e[18]=k,e[19]=$):$=e[19];let E;e[20]!==$||e[21]!==S?(E=_("div",{className:"flex items-center gap-1.5",children:[S,$]}),e[20]=$,e[21]=S,e[22]=E):E=e[22];let D;e[23]!==n||e[24]!==s||e[25]!==g||e[26]!==b||e[27]!==y||e[28]!==i||e[29]!==d||e[30]!==r?(D=d?f("div",{className:"flex flex-col gap-3","data-testid":"db-editor-fields",children:Object.entries(g).map(H=>{const[G,U]=H;return f(Vo,{column:G,meta:n?.[G],onChange:b,target:i?.[G],value:U},G)})}):f("textarea",{"aria-label":r("Row document JSON"),className:"min-h-28 w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"db-editor-doc",onChange:y,value:s}),e[23]=n,e[24]=s,e[25]=g,e[26]=b,e[27]=y,e[28]=i,e[29]=d,e[30]=r,e[31]=D):D=e[31];let R;e[32]!==r?(R=r("Save"),e[32]=r,e[33]=R):R=e[33];let q;e[34]!==l||e[35]!==R?(q=f("button",{className:Ie,"data-testid":"db-editor-save",onClick:l,type:"button",children:R}),e[34]=l,e[35]=R,e[36]=q):q=e[36];let O;e[37]!==r?(O=r("Cancel"),e[37]=r,e[38]=O):O=e[38];let B;e[39]!==t||e[40]!==O?(B=f("button",{className:Ie,"data-testid":"db-editor-cancel",onClick:t,type:"button",children:O}),e[39]=t,e[40]=O,e[41]=B):B=e[41];let F;e[42]!==q||e[43]!==B?(F=_("div",{className:"flex items-center gap-1.5",children:[q,B]}),e[42]=q,e[43]=B,e[44]=F):F=e[44];let J;return e[45]!==E||e[46]!==D||e[47]!==F?(J=_("div",{className:"flex flex-col gap-2 border border-border bg-card p-3","data-testid":"db-editor",children:[E,D,F]}),e[45]=E,e[46]=D,e[47]=F,e[48]=J):J=e[48],J};function Bo(o){return f("option",{value:o,children:o},o)}const zo=o=>{const e=L(61),{columns:n,editable:s,filter:t,filters:a,hasMaskedColumns:l,liveError:i,maskOn:r,onAddRow:c,onBulkDelete:g,onAskAiFilter:u,onClearTable:m,onFilterChange:d,onFiltersChange:p,onGenerateRows:b,onShowJson:h,onShowTable:y,onToggleMask:x,total:v,viewMode:w}=o,N=re(),T=w==="table";let C;e[0]!==y||e[1]!==T?(C=f("button",{"aria-pressed":T,className:Ie,"data-testid":"db-view-table",onClick:y,type:"button",children:"Table"}),e[0]=y,e[1]=T,e[2]=C):C=e[2];const S=w==="json";let k;e[3]!==h||e[4]!==S?(k=f("button",{"aria-pressed":S,className:Ie,"data-testid":"db-view-json",onClick:h,type:"button",children:"JSON"}),e[3]=h,e[4]=S,e[5]=k):k=e[5];let A;e[6]!==i||e[7]!==N?(A=i===void 0?N("Live — changes stream in automatically"):N("Live unavailable: {liveError}",{liveError:i}),e[6]=i,e[7]=N,e[8]=A):A=e[8];const $=`size-1.5 rounded-full ${i===void 0?"bg-success":"bg-muted-foreground/50"}`;let E;e[9]!==$?(E=f("span",{"aria-hidden":"true",className:$}),e[9]=$,e[10]=E):E=e[10];let D;e[11]!==i||e[12]!==N?(D=N(i===void 0?"Live":"Live unavailable"),e[11]=i,e[12]=N,e[13]=D):D=e[13];let R;e[14]!==A||e[15]!==E||e[16]!==D?(R=_("span",{className:"inline-flex items-center gap-1.5 px-1 text-xs font-medium text-muted-foreground","data-testid":"db-live-indicator",role:"status",title:A,children:[E,D]}),e[14]=A,e[15]=E,e[16]=D,e[17]=R):R=e[17];let q;e[18]!==l||e[19]!==r||e[20]!==x||e[21]!==N?(q=l&&f("button",{"aria-pressed":r,className:Ie,"data-testid":"db-mask-toggle",onClick:x,type:"button",children:N("Mask sensitive columns")}),e[18]=l,e[19]=r,e[20]=x,e[21]=N,e[22]=q):q=e[22];let O;e[23]!==s||e[24]!==c?(O=s&&f("button",{className:Ie,"data-testid":"db-add-row",onClick:c,type:"button",children:"Add row"}),e[23]=s,e[24]=c,e[25]=O):O=e[25];let B;e[26]!==s||e[27]!==b||e[28]!==N?(B=s&&f("button",{className:Ie,"data-testid":"db-generate-rows",onClick:b,type:"button",children:N("Generate rows")}),e[26]=s,e[27]=b,e[28]=N,e[29]=B):B=e[29];let F;e[30]!==s||e[31]!==t||e[32]!==a||e[33]!==g||e[34]!==v?(F=s&&v>0&&(t!==""||a.length>0)&&f(ut,{confirmLabel:`Delete ${v.toString()} matching?`,onConfirm:g,testId:"db-bulk-delete",children:`Delete ${v.toString()} matching`}),e[30]=s,e[31]=t,e[32]=a,e[33]=g,e[34]=v,e[35]=F):F=e[35];let J;e[36]!==s||e[37]!==t||e[38]!==a||e[39]!==m||e[40]!==v?(J=s&&v>0&&t===""&&a.length===0&&f(ut,{confirmLabel:`Clear all ${v.toString()} rows?`,onConfirm:m,testId:"db-clear-table",children:`Clear table (${v.toString()})`}),e[36]=s,e[37]=t,e[38]=a,e[39]=m,e[40]=v,e[41]=J):J=e[41];let H;e[42]!==q||e[43]!==O||e[44]!==B||e[45]!==F||e[46]!==J||e[47]!==C||e[48]!==k||e[49]!==R?(H=_("div",{className:"flex flex-wrap items-center gap-1.5",children:[C,k,R,q,O,B,F,J]}),e[42]=q,e[43]=O,e[44]=B,e[45]=F,e[46]=J,e[47]=C,e[48]=k,e[49]=R,e[50]=H):H=e[50];let G;e[51]!==n||e[52]!==t||e[53]!==a||e[54]!==u||e[55]!==d||e[56]!==p?(G=f(Mn,{columns:n,filters:a,onAskAi:u,onFiltersChange:p,onSearchChange:d,search:t}),e[51]=n,e[52]=t,e[53]=a,e[54]=u,e[55]=d,e[56]=p,e[57]=G):G=e[57];let U;return e[58]!==H||e[59]!==G?(U=_("div",{className:"flex flex-col gap-2","data-testid":"db-view-toggle",children:[H,G]}),e[58]=H,e[59]=G,e[60]=U):U=e[60],U},jo=o=>{const e=L(104),{assistant:n,backRelations:s,browser:t,columnMeta:a,edit:l,editable:i,onAskAiFilter:r,onInspect:c,onOpenGenerateRows:g,onSaveQuery:u,page:m,preferences:d,queryBar:p,references:b}=o,h=d.maskColumns.size>0,y=n.unavailable?void 0:r;let x;e[0]!==t.addRow||e[1]!==t.bulkDelete||e[2]!==t.clearTable||e[3]!==t.columns||e[4]!==t.filter||e[5]!==t.filters||e[6]!==t.liveError||e[7]!==t.onFilterChange||e[8]!==t.onFiltersChange||e[9]!==t.showJson||e[10]!==t.showTable||e[11]!==t.total||e[12]!==t.viewMode||e[13]!==i||e[14]!==g||e[15]!==d.maskOn||e[16]!==d.onToggleMask||e[17]!==h||e[18]!==y?(x=f(zo,{columns:t.columns,editable:i,filter:t.filter,filters:t.filters,hasMaskedColumns:h,liveError:t.liveError,maskOn:d.maskOn,onAddRow:t.addRow,onAskAiFilter:y,onBulkDelete:t.bulkDelete,onClearTable:t.clearTable,onFilterChange:t.onFilterChange,onFiltersChange:t.onFiltersChange,onGenerateRows:g,onShowJson:t.showJson,onShowTable:t.showTable,onToggleMask:d.onToggleMask,total:t.total,viewMode:t.viewMode}),e[0]=t.addRow,e[1]=t.bulkDelete,e[2]=t.clearTable,e[3]=t.columns,e[4]=t.filter,e[5]=t.filters,e[6]=t.liveError,e[7]=t.onFilterChange,e[8]=t.onFiltersChange,e[9]=t.showJson,e[10]=t.showTable,e[11]=t.total,e[12]=t.viewMode,e[13]=i,e[14]=g,e[15]=d.maskOn,e[16]=d.onToggleMask,e[17]=h,e[18]=y,e[19]=x):x=e[19];let v;e[20]!==u||e[21]!==p?(v=p!==void 0&&f(_o,{onApply:p.onApplyQuery,onCopyLink:p.onCopyLink,onDelete:p.onDeleteQuery,onSave:u,saved:p.saved}),e[20]=u,e[21]=p,e[22]=v):v=e[22];let w;e[23]!==s||e[24]!==t.onBulkDeleteSelected||e[25]!==t.selectedTable||e[26]!==t.table||e[27]!==t.viewMode||e[28]!==i||e[29]!==m||e[30]!==d.maskView||e[31]!==d.onToggleTranspose||e[32]!==d.transposed?(w=t.viewMode==="table"&&m.rows.length>0&&f(An,{backRelations:s.available,columns:m.columns,editable:i,enabledBackRelations:s.enabled,name:t.selectedTable??"export",onBulkDelete:t.onBulkDeleteSelected,onToggleBackRelation:s.onToggle,onToggleTranspose:d.onToggleTranspose,rows:lt(m.rows,d.maskView),table:t.table.table,transposed:d.transposed}),e[23]=s,e[24]=t.onBulkDeleteSelected,e[25]=t.selectedTable,e[26]=t.table,e[27]=t.viewMode,e[28]=i,e[29]=m,e[30]=d.maskView,e[31]=d.onToggleTranspose,e[32]=d.transposed,e[33]=w):w=e[33];let N;e[34]!==t.cancelEdit||e[35]!==t.editing||e[36]!==t.saveEdit||e[37]!==t.setEditorDocumentText||e[38]!==a||e[39]!==i||e[40]!==m?(N=i&&t.editing!==null&&f(Lo,{columnMeta:a,documentText:t.editing.docText,onCancel:t.cancelEdit,onDocumentTextChange:t.setEditorDocumentText,onSave:t.saveEdit,refs:m.refs}),e[34]=t.cancelEdit,e[35]=t.editing,e[36]=t.saveEdit,e[37]=t.setEditorDocumentText,e[38]=a,e[39]=i,e[40]=m,e[41]=N):N=e[41];let T;e[42]!==t.committing||e[43]!==t.discardStaged||e[44]!==t.onCommitStaged||e[45]!==t.stagedChanges||e[46]!==i?(T=i&&t.stagedChanges.length>0&&f(qn,{changes:t.stagedChanges,committing:t.committing,onCommit:t.onCommitStaged,onDiscard:t.discardStaged}),e[42]=t.committing,e[43]=t.discardStaged,e[44]=t.onCommitStaged,e[45]=t.stagedChanges,e[46]=i,e[47]=T):T=e[47];let C;e[48]!==t.writeError?(C=t.writeError!==null&&f("p",{className:"text-sm text-destructive","data-testid":"db-write-error",role:"alert",children:t.writeError}),e[48]=t.writeError,e[49]=C):C=e[49];let S;e[50]!==x||e[51]!==v||e[52]!==w||e[53]!==N||e[54]!==T||e[55]!==C?(S=_("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3",children:[x,v,w,N,T,C]}),e[50]=x,e[51]=v,e[52]=w,e[53]=N,e[54]=T,e[55]=C,e[56]=S):S=e[56];let k;e[57]!==t.viewMode||e[58]!==m?(k=t.viewMode==="table"&&m.rows.length===0&&f("div",{className:"flex flex-1 items-center justify-center p-6",children:f(Nn,{description:"Rows you insert into this table will show up here.",icon:f("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:f("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"})}),testId:"db-empty-rows",title:"This table is empty."})}),e[57]=t.viewMode,e[58]=m,e[59]=k):k=e[59];let A;e[60]!==t.viewMode||e[61]!==m||e[62]!==d.maskView||e[63]!==d.transposed?(A=t.viewMode==="table"&&m.rows.length>0&&d.transposed&&f(In,{columns:m.columns,rows:lt(m.rows,d.maskView)}),e[60]=t.viewMode,e[61]=m,e[62]=d.maskView,e[63]=d.transposed,e[64]=A):A=e[64];let $;e[65]!==s||e[66]!==t.filter||e[67]!==t.onRowDelete||e[68]!==t.onRowEdit||e[69]!==t.table||e[70]!==t.viewMode||e[71]!==a||e[72]!==l||e[73]!==i||e[74]!==c||e[75]!==m||e[76]!==d.maskView||e[77]!==d.onTogglePin||e[78]!==d.pinnedColumns||e[79]!==d.transposed||e[80]!==b?($=t.viewMode==="table"&&m.rows.length>0&&!d.transposed&&f(vo,{backRelationCounts:s.counts,columnMeta:a,edit:l,editable:i,highlight:t.filter,mask:d.maskView,onDelete:t.onRowDelete,onEdit:t.onRowEdit,onInspect:c,onTogglePin:d.onTogglePin,pinnedColumns:d.pinnedColumns,refs:b,tableModel:t.table}),e[65]=s,e[66]=t.filter,e[67]=t.onRowDelete,e[68]=t.onRowEdit,e[69]=t.table,e[70]=t.viewMode,e[71]=a,e[72]=l,e[73]=i,e[74]=c,e[75]=m,e[76]=d.maskView,e[77]=d.onTogglePin,e[78]=d.pinnedColumns,e[79]=d.transposed,e[80]=b,e[81]=$):$=e[81];let E;e[82]!==t.viewMode||e[83]!==m||e[84]!==d.maskView?(E=t.viewMode==="json"&&f("pre",{className:"min-h-0 flex-1 overflow-auto border-t border-border bg-muted/30 p-3 text-xs","data-testid":"db-json",children:JSON.stringify(lt(m.rows,d.maskView),pn,2)}),e[82]=t.viewMode,e[83]=m,e[84]=d.maskView,e[85]=E):E=e[85];let D;e[86]!==t.changePageSize||e[87]!==t.goNext||e[88]!==t.goPrevious||e[89]!==t.hasNext||e[90]!==t.hasPrevious||e[91]!==t.jumpToPage||e[92]!==t.pageSize||e[93]!==t.rangeEnd||e[94]!==t.rangeStart||e[95]!==t.total?(D=f("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:f(xn,{hasNext:t.hasNext,hasPrevious:t.hasPrevious,onJumpToPage:t.jumpToPage,onNext:t.goNext,onPageSizeChange:t.changePageSize,onPrevious:t.goPrevious,pageSize:t.pageSize,prefix:"db",rangeEnd:t.rangeEnd,rangeStart:t.rangeStart,total:t.total})}),e[86]=t.changePageSize,e[87]=t.goNext,e[88]=t.goPrevious,e[89]=t.hasNext,e[90]=t.hasPrevious,e[91]=t.jumpToPage,e[92]=t.pageSize,e[93]=t.rangeEnd,e[94]=t.rangeStart,e[95]=t.total,e[96]=D):D=e[96];let R;return e[97]!==k||e[98]!==A||e[99]!==$||e[100]!==E||e[101]!==D||e[102]!==S?(R=_("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"db-page",children:[S,k,A,$,E,D]}),e[97]=k,e[98]=A,e[99]=$,e[100]=E,e[101]=D,e[102]=S,e[103]=R):R=e[103],R},Go="/__lunora/seed",at=200,Jo=50,qo=(o,e)=>{const n=[];for(const s of o)s.pk!==!0&&s.ref!==void 0&&s.type==="id"&&(e[s.ref]??[]).length===0&&n.push(s.name);return n},Ko=async o=>{const e=await fetch(Go,{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST"}),n=await e.json();return e.ok&&n.rows!==void 0?{kind:"ok",rows:n.rows}:{kind:"error",message:n.error??`seed request failed (${String(e.status)})`}},Wo="rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",Ho="rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",Qo=({columns:o,fkPools:e,onClose:n,onInsertRows:s,table:t})=>{const a=re(),[l,i]=M(10),[r,c]=M(!1),[g,u]=M(void 0),[m,d]=M(void 0),[p,b]=M(0),h=w=>{const N=Number(w.target.value);!Number.isNaN(N)&&N>=1&&i(Math.min(N,at))},y=async()=>{u(void 0),d(void 0),b(0),c(!0);try{const w=await Ko({count:l,existingIds:e,seed:Date.now(),table:t});if(w.kind==="error"){u(w.message);return}const{rows:N}=w;if(N.length===0){u(a("No rows generated — all columns were skipped."));return}const T=await s(N);if(T.error!==void 0){u(T.error);return}d(T.inserted),b(T.conflicts);const C=qo(o,e);C.length>0&&u(a("Inserted {count} rows. Skipped FK columns: {cols}",{cols:C.join(", "),count:T.inserted.toString()}))}finally{c(!1)}},x=()=>{be(y())},v=o.filter(w=>w.pk!==!0);return _(It,{label:a("Generate dummy rows"),onClose:n,panelTestId:"gen-rows-panel",testId:"gen-rows-overlay",variant:"dialog",children:[_("div",{className:"flex items-start justify-between",children:[_("div",{className:"flex flex-col gap-0.5",children:[f("h3",{className:"text-base text-foreground","data-testid":"gen-rows-title",children:a("Generate dummy rows")}),f("p",{className:"text-xs text-muted-foreground","data-testid":"gen-rows-desc",children:a("Seed {table} with Faker-generated rows. Existing rows are not affected.",{table:t})})]}),f("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"gen-rows-close",onClick:n,type:"button",children:a("Close")})]}),_("div",{className:"flex items-center gap-2",children:[f("label",{className:"text-xs font-medium text-foreground",htmlFor:"gen-rows-count",children:a("Row count")}),f("input",{className:"w-20 rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus-visible:border-ring","data-testid":"gen-rows-count",id:"gen-rows-count",max:at,min:1,onChange:h,type:"number",value:l}),f("span",{className:"text-xs text-muted-foreground",children:a("(max {max})",{max:at.toString()})})]}),v.length>0&&_("div",{className:"flex flex-col gap-1",children:[f("p",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:a("Columns to seed")}),f("ul",{className:"flex flex-col gap-0.5","data-testid":"gen-rows-columns",children:v.map(w=>{const N=w.ref!==void 0&&w.type==="id",T=N&&(e[w.ref??""]??[]).length===0,C=T?"rounded bg-destructive/10 px-1 text-destructive":"rounded bg-muted px-1 text-muted-foreground",S=T?`gen-rows-fk-empty-${w.name}`:`gen-rows-fk-ok-${w.name}`,k=T?a("FK: no rows in {ref} — will skip",{ref:w.ref??""}):a("→ {ref}",{ref:w.ref??""});return _("li",{className:"flex items-center gap-1.5 font-mono text-xs",children:[f("span",{className:"text-foreground",children:w.name}),_("span",{className:"text-muted-foreground",children:["(",w.type,")"]}),w.optional&&f("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:"optional"}),N&&f("span",{className:C,"data-testid":S,children:k})]},w.name)})})]}),g!==void 0&&f("p",{className:"text-xs text-destructive","data-testid":"gen-rows-error",role:"alert",children:g}),m!==void 0&&g===void 0&&f("p",{className:"text-xs text-success","data-testid":"gen-rows-success",children:p>0?a("Inserted {inserted} of {total} rows — {conflicts} skipped as id conflicts.",{conflicts:p.toString(),inserted:m.toString(),total:(m+p).toString()}):a("Inserted {count} rows successfully.",{count:m.toString()})}),_("div",{className:"flex justify-end gap-2",children:[f("button",{className:Wo,"data-testid":"gen-rows-cancel",onClick:n,type:"button",children:a("Cancel")}),f("button",{className:Ho,"data-testid":"gen-rows-generate",disabled:r,onClick:x,type:"button",children:a(r?"Inserting…":"Generate & insert")})]})]})},Uo=Te(le.backRelationCounts),Yo=(o,e,n,s)=>{const t=L(16),a=ot();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={},t[0]=l):l=t[0];const[i,r]=M(l);let c;if(t[1]!==o||t[2]!==e){let y;t[4]!==o?(y=x=>o.has(pt(x)),t[4]=o,t[5]=y):y=t[5],c=e.filter(y),t[1]=o,t[2]=e,t[3]=c}else c=t[3];const g=c;let u;t[6]!==n||t[7]!==g?(u=JSON.stringify([g,n]),t[6]=n,t[7]=g,t[8]=u):u=t[8];const m=u;let d;t[9]!==a||t[10]!==s||t[11]!==m?(d=async y=>{const[x,v]=JSON.parse(m);if(x.length===0||v.length===0){y.cancelled||r({});return}try{const w=await a.query(Uo,{ids:v,relations:x},we(s));y.cancelled||r(Object.fromEntries(w.relations.map(Xo)))}catch{}},t[9]=a,t[10]=s,t[11]=m,t[12]=d):d=t[12];const p=d;let b,h;return t[13]!==p?(b=()=>{const y={cancelled:!1};return be(p(y)),()=>{y.cancelled=!0}},h=[p],t[13]=p,t[14]=b,t[15]=h):(b=t[14],h=t[15]),Le(b,h),i};function Xo(o){return[pt(o),o.counts]}const Ze=o=>{const e=o[0];return e===void 0?void 0:{column:e.id,direction:e.desc?"desc":"asc"}},Vt=o=>o==null?"":typeof o=="object"?JSON.stringify(o):String(o),Et=o=>o.map(e=>({column:e.column,operator:e.operator,value:e.value===void 0?"":Vt(e.value)})),_t=o=>o===void 0?[]:[{desc:o.direction==="desc",id:o.column}],Zo=o=>[o.column,o.operator,o.value],Ye=(o,e,n,s)=>JSON.stringify([o??"",e??"",(n??[]).map(t=>Zo(t)),s===void 0?null:[s.column,s.direction]]),Rt=200,es=20,ts=Te(le.readTablePage),ns=Te(le.facetColumn),ct=Te(le.writeRow),os=Te(le.deleteRows),ss=Te(le.clearTable),ls={},ht=new Set(["__doc__","__id__","_creationTime","_id","id"]),rs=o=>{const e=o.__doc__;if(typeof e=="string"){const s=Ln(e);if(s!==void 0)return s}const n={};for(const[s,t]of Object.entries(o))ht.has(s)||(n[s]=t);return n},is=({filters:o,offset:e,pageSize:n,search:s,sorting:t,table:a})=>({filters:Ve(o),limit:n,offset:e,orderBy:Ze(t),search:s,skipCount:!0,table:a}),as=({filters:o,search:e,table:n})=>({filters:Ve(o),limit:1,search:e,table:n}),cs=(o,e)=>{const n=new Map;for(const t of o?.rows??[]){const a=ke(t);a!==null&&n.set(a,t)}const s=[];for(const[t,a]of Object.entries(e))for(const[l,i]of Object.entries(a))s.push({column:l,newValue:i,oldValue:n.get(t)?.[l],rowId:t});return s},ds=o=>!ht.has(o),us=({initialFilters:o,initialOrderBy:e,initialSearch:n,initialShardKey:s,onSelectTable:t,onViewChange:a,pageSize:l,resolveBackRelations:i,tableParam:r})=>{const c=ot(),[g,u]=M(l),[m,d]=M(s??""),p=r===void 0||r===""?null:r,[b,h]=M(0),[y,x]=M("table"),[v,w]=M(()=>_t(e)),[N,T]=M(n??""),[C,S]=M(()=>Et(o??[])),{clearFacets:k,facets:A,refetchFacets:$,toggleFacet:E}=vn(),[D,R]=M(null),[q,O]=M(null),B=Jn(),[F,J]=M(null),[H,G]=M(!1),[U,ye]=M(r),[ie,he]=M(()=>Ye(s,n,o,e)),[xe,Se]=M(0),[ce,Ce]=M(()=>Ye(s,n,o,e)),de=r!==U,Z=Ye(s,n,o,e),ue=de||!de&&Z!==ie&&Z!==ce;if(ue){ye(r),he(Z),Se(V=>V+1),w(_t(e)),T(n??"");const I=Et(o??[]);S(I),d(s??""),k(),B.clear(),J(null),h(0)}else Z!==ie&&he(Z);const fe=ue?n??"":N,se=ue?s??"":m,me=`${r??""}:${xe.toString()}`,Y=vt(fe.trim(),300,me),j=vt(se.trim(),400,me),te=Ye(j,Y,Ve(C),Ze(v));te!==ce&&Ce(te);const ne=Xe(le.listTables,ls,{live:!0,shardKey:j}),Me=ne.data??null,oe=ne.error,W=is({filters:C,offset:b,pageSize:g,search:Y,sorting:v,table:p??""}),ee=as({filters:C,search:Y,table:p??""}),Q=Xe(le.readTablePage,W,{enabled:p!==null,keepPreviousData:!1,live:!0,shardKey:j}),z=Q.data??null,ge=Q.error,{liveError:K}=Q,Ee=Xe(le.readTablePage,ee,{enabled:p!==null,live:!0,shardKey:j});Le(()=>{ne.data!==void 0&&Bn(j)},[ne.data,j]);const Ae=I=>{t?.(I)},Oe=(I,V)=>{t?.(I,{search:V})},Fe=async(I,V)=>{try{return(await c.query(ts,{filters:[],limit:es,offset:0,search:V,table:I},we(j))).rows.find(ve=>ke(ve)===V)??null}catch{return null}},ze=(I,V,ae,ve)=>De=>c.query(ns,{column:De,filters:Ve(ae),search:ve,table:V},we(I)),pe=I=>{E(I,p===null?null:ze(j,p,C,Y))},je=(I,V)=>{const ae=Vt(V);S(ve=>[...ve.filter(De=>De.column!==I),{column:I,operator:"eq",value:ae}]),h(0)},Pe=rt(ze),Ke=rt($),Qe=rt(a);Le(()=>{p!==null&&Ke.current(Pe.current(j,p,C,Y))},[j,p,C,Y]),Le(()=>{p===null||Qe.current===void 0||U!==r||ie!==Z||Qe.current({filters:Ve(C),orderBy:Ze(v),search:Y,shard:j})},[p,r,U,ie,Z,C,v,Y,j]);const We=I=>{p!==null&&h(Math.max(0,I))},st=(I,V)=>{J({column:V,rowId:I})},P=()=>{J(null)},X=async()=>{if(p!==null){O(null),G(!0);try{for(const[I,V]of Object.entries(B.staged))await c.query(ct,{doc:V,id:I,op:"patch",table:p},we(j));B.clear(),J(null),Q.refetch()}catch(I){O(I.message)}G(!1)}},_e=()=>{B.clear(),J(null)},Re=cs(z,B.staged),$e=async(I,V,ae)=>{if(p===null)return;O(null);let ve;if(I!=="delete"){let De;try{De=ae===void 0||ae.trim()===""?{}:JSON.parse(ae)}catch(Ge){O(`Invalid JSON: ${Ge.message}`);return}try{const Ge=Pn(De);if(!Vn(Ge)){O("The document must be a JSON object.");return}ve=Ge}catch(Ge){O(`Invalid document: ${Ge.message}`);return}}try{await c.query(ct,{doc:ve,id:V??void 0,op:I,table:p},we(j)),R(null),Q.refetch()}catch(De){O(De.message)}},Ue=async(I,V)=>{if(p!==null){O(null);try{let ae="cap-hit";for(let ve=0;ve<Rt;ve+=1)if(!(await c.query(I,V,we(j))).hasMore){ae="completed";break}h(0),Q.refetch(),ae==="cap-hit"&&O(`Stopped after ${Rt.toString()} batches — rows still match this delete. Run it again to remove the rest.`)}catch(ae){O(ae.message)}}},Lt=I=>{w(I),h(0)},Bt=dt(()=>p===null?[]:i?.(p)??[],[i,p]),zt=wo(z,v,Lt,Bt),jt={filters:Ve(C),orderBy:Ze(v),search:Y,shard:m,table:p??void 0},xt=Ee.data?.total??(z===null?0:b+z.rows.length),Gt=b>0,Jt=z!==null&&b+z.rows.length<xt,qt=z===null||z.rows.length===0?0:b+1,Kt=z===null?0:b+z.rows.length,Wt=()=>{ne.refetch()},Ht=()=>{x("table")},Qt=()=>{x("json")},Ut=()=>{be(Ue(os,{filters:Ve(C),search:Y,table:p}))},Yt=()=>{be(Ue(ss,{table:p}))},Xt=I=>{T(I.target.value),h(0)},Zt=I=>{S(I),h(0)},en=()=>{O(null);const I={};for(const V of z?.columns??[])ht.has(V)||(I[V]="");R({docText:JSON.stringify(I,null,2),id:""})},tn=I=>{R(V=>V===null?V:{docText:I,id:V.id})},nn=()=>{D!==null&&be($e(D.id===""?"insert":"patch",D.id===""?null:D.id,D.docText))},on=()=>{R(null),O(null)},sn=()=>{We(b-g)},ln=()=>{We(b+g)},rn=I=>{We(Math.max(0,(I-1)*g))},an=I=>{u(I),h(0)},cn=(I,V)=>{O(null),R({docText:JSON.stringify(Fn(rs(V)),null,2),id:I})},dn=I=>{be($e("delete",I))},un=async I=>{if(!(p===null||I.length===0)){O(null);try{for(const V of I)await c.query(ct,{id:V,op:"delete",table:p},we(j));Q.refetch()}catch(V){O(V.message)}}},fn=I=>{be(un(I))},mn=()=>{be(X())};return{addRow:en,bulkDelete:Ut,cancelCellEdit:P,cancelEdit:on,changePageSize:an,clearTable:Yt,columns:z?.columns??[],committing:H,currentView:jt,discardStaged:_e,editableColumn:ds,editing:D,editingCell:F,facetFilter:je,facets:A,filter:N,filters:C,goNext:ln,goPrevious:sn,hasNext:Jt,hasPrevious:Gt,jumpToPage:rn,liveError:K,loadTables:Wt,navigateToRef:Oe,onBulkDeleteSelected:fn,onCommitStaged:mn,onFilterChange:Xt,onFiltersChange:Zt,onRowDelete:dn,onRowEdit:cn,page:z,previewRef:Fe,pageError:ge,pageSize:g,rangeEnd:Kt,rangeStart:qt,queryShardKey:j,saveEdit:nn,selectedTable:p,selectTable:Ae,setEditorDocumentText:tn,setShardKey:d,shardKey:m,showJson:Qt,showTable:Ht,stage:B.stage,stagedChanges:Re,stagedValue:B.stagedValue,startCellEdit:st,table:zt,tables:Me,tablesError:oe,toggleFacet:pe,total:xt,viewMode:y,writeError:q}},fs="lunora-studio-pinned-columns",ms=o=>{const e=L(21),{columns:n,initialPins:s,selectedTable:t}=o;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];const[l,i]=$t(fs,a),r=t??"",c=l[r];let g;e[1]!==s||e[2]!==c?(g=c===void 0?new Set((s??"").split(",").filter(gs)):new Set(c),e[1]=s,e[2]=c,e[3]=g):g=e[3];const u=g;let m;e[4]!==r||e[5]!==u||e[6]!==i?(m=k=>{i(A=>{const $=A[r]??[...u],E=$.includes(k)?$.filter(D=>D!==k):[...$,k];return{...A,[r]:E}})},e[4]=r,e[5]=u,e[6]=i,e[7]=m):m=e[7];const d=m,[p,b]=M(!1);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{b(ps)},e[8]=h):h=e[8];const y=h;let x;e[9]!==n||e[10]!==t?(x={columns:n,selectedTable:t},e[9]=n,e[10]=t,e[11]=x):x=e[11];const{maskColumns:v,maskOn:w,maskView:N,maskViewFor:T,onToggleMask:C}=wn(x);let S;return e[12]!==v||e[13]!==w||e[14]!==N||e[15]!==T||e[16]!==C||e[17]!==d||e[18]!==u||e[19]!==p?(S={maskColumns:v,maskOn:w,maskView:N,maskViewFor:T,onToggleMask:C,onTogglePin:d,onToggleTranspose:y,pinnedColumns:u,transposed:p},e[12]=v,e[13]=w,e[14]=N,e[15]=T,e[16]=C,e[17]=d,e[18]=u,e[19]=p,e[20]=S):S=e[20],S};function gs(o){return o!==""}function ps(o){return!o}const bs=Te(le.describeTable),hs=Te(le.readTablePage),xs=Te(le.importShard),vs=o=>{const e=o._id??o.id??o.__id__??"";return typeof e=="string"?e:typeof e=="number"?String(e):""},ws=o=>{const e=Object.values(o.inserted).reduce((r,c)=>r+c,0),[n]=o.errors;if(n===void 0)return{conflicts:o.conflicts,error:void 0,inserted:e};const s=o.errors.length-1,t=e+o.conflicts+o.errors.length,a=s===1?"error":"errors",l=s>0?` (+${s.toString()} more ${a})`:"",i=`Inserted ${e.toString()} of ${t.toString()} rows — row ${n.line.toString()} (${n.table}): ${n.message}${l}`;return{conflicts:o.conflicts,error:i,inserted:e}},ys=o=>{const e=ot(),[n,s]=M(!1),[t,a]=M(void 0),[l,i]=M(void 0),[r,c]=M(void 0),[g,u]=M({}),[m,d]=M(!1),[p,b]=M(void 0),h=async(w,N)=>{s(!0),a(w),i(N),c(void 0),u({}),b(void 0),d(!0);try{const T=await e.query(bs,{table:w},we(N)),{columns:C}=T;c(C);const S={},k=C.filter(A=>A.ref!==void 0&&A.type==="id"&&A.pk!==!0);for(const A of k){if(A.ref===void 0)continue;const{ref:$}=A;if(S[$]===void 0)try{const E=await e.query(hs,{filters:[],limit:Jo,offset:0,search:"",table:$},we(N));S[$]=E.rows.flatMap(D=>vs(D)||[])}catch{S[$]=[]}}u(S)}catch(T){b(T.message)}d(!1)};return{closeDialog:()=>{s(!1),a(void 0),i(void 0),c(void 0),u({}),b(void 0)},columnMeta:r,error:p,fkPools:g,insertBatch:async(w,N)=>{if(t===void 0||l===void 0)return{conflicts:0,error:"No table selected.",inserted:0};try{const T=await e.query(xs,{rows:w.map(S=>({doc:S,table:t}))},we(l)),C=ws(T);return C.error!==void 0||(N(),o()),C}catch(T){return{conflicts:0,error:T.message,inserted:0}}},loading:m,open:n,openDialog:(w,N)=>{be(h(w,N))},shardKey:l,table:t}},Ss=()=>{const o=L(6),[e,n]=M(null);let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{n(null)},o[0]=s):s=o[0];const t=s,[a,l]=M(null);let i;o[1]===Symbol.for("react.memo_cache_sentinel")?(i=(m,d)=>{l({column:m,value:d})},o[1]=i):i=o[1];const r=i;let c;o[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{l(null)},o[2]=c):c=o[2];const g=c;let u;return o[3]!==a||o[4]!==e?(u={closeExpandedCell:g,closeInspect:t,expandedCell:a,inspecting:e,onExpandCell:r,onInspect:n},o[3]=a,o[4]=e,o[5]=u):u=o[5],u},Cs=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Ns=(o,e)=>typeof e=="number"&&Cs.test(o),ks=o=>{const e=L(31),{column:n,masked:s,onNavigate:t,target:a,value:l}=o;let i;e[0]!==t||e[1]!==a||e[2]!==l?(i=()=>{a!==void 0&&t(a,String(l))},e[0]=t,e[1]=a,e[2]=l,e[3]=i):i=e[3];const r=i;if(l==null){let u;return e[4]===Symbol.for("react.memo_cache_sentinel")?(u=f("span",{className:"italic text-muted-foreground",children:"null"}),e[4]=u):u=e[4],u}if(s){const u=`rd-masked-${n}`;let m;e[5]!==l?(m=Be(l),e[5]=l,e[6]=m):m=e[6];let d;return e[7]!==u||e[8]!==m?(d=f("span",{className:"italic text-muted-foreground","data-testid":u,title:"Masked (preview)",children:m}),e[7]=u,e[8]=m,e[9]=d):d=e[9],d}if(a!==void 0&&(typeof l=="string"||typeof l=="number")&&String(l)!==""){const u=`rd-ref-${n}`,m=`Open ${a} ${String(l)}`,d=String(l);let p;return e[10]!==r||e[11]!==u||e[12]!==m||e[13]!==d?(p=_("button",{"data-testid":u,onClick:r,title:m,type:"button",children:[d," ↗"]}),e[10]=r,e[11]=u,e[12]=m,e[13]=d,e[14]=p):p=e[14],p}if(Ns(n,l)){const u=`rd-ts-${n}`;let m;e[15]!==l?(m=l.toString(),e[15]=l,e[16]=m):m=e[16];let d;e[17]!==l?(d=bn(l),e[17]=l,e[18]=d):d=e[18];let p;return e[19]!==u||e[20]!==m||e[21]!==d?(p=f("span",{"data-testid":u,title:m,children:d}),e[19]=u,e[20]=m,e[21]=d,e[22]=p):p=e[22],p}if(typeof l=="object"){let u;e[23]!==l?(u=JSON.stringify(l,null,2),e[23]=l,e[24]=u):u=e[24];let m;return e[25]!==u?(m=f("pre",{className:"m-0 overflow-auto rounded-md bg-muted/50 p-2 text-xs",children:u}),e[25]=u,e[26]=m):m=e[26],m}let c;e[27]!==l?(c=Be(l),e[27]=l,e[28]=c):c=e[28];let g;return e[29]!==c?(g=f("span",{children:c}),e[29]=c,e[30]=g):g=e[30],g},Ts=o=>{const e=L(23),{columns:n,mask:s,onClose:t,onNavigate:a,refs:l,row:i}=o;let r;e[0]!==t||e[1]!==a?(r=(b,h)=>{a(b,h),t()},e[0]=t,e[1]=a,e[2]=r):r=e[2];const c=r;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=f("h3",{className:"m-0 text-base text-foreground",children:"Row detail"}),e[3]=g):g=e[3];let u;e[4]!==t?(u=_("div",{className:"mb-3 flex items-center justify-between",children:[g,f("button",{"data-testid":"rd-close",onClick:t,type:"button",children:"Close"})]}),e[4]=t,e[5]=u):u=e[5];let m;if(e[6]!==n||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==i){let b;e[12]!==s||e[13]!==c||e[14]!==l||e[15]!==i?(b=h=>_("div",{className:"border-t border-border py-2 first:border-t-0","data-testid":`rd-field-${h}`,children:[f("dt",{className:"mb-0.5 text-xs font-semibold text-muted-foreground",children:h}),f("dd",{className:"m-0",children:f(ks,{column:h,masked:s.enabled&&s.columns.has(h),onNavigate:c,target:l?.[h],value:i[h]})})]},h),e[12]=s,e[13]=c,e[14]=l,e[15]=i,e[16]=b):b=e[16],m=n.map(b),e[6]=n,e[7]=s,e[8]=c,e[9]=l,e[10]=i,e[11]=m}else m=e[11];let d;e[17]!==m?(d=f("dl",{"data-testid":"rd-fields",children:m}),e[17]=m,e[18]=d):d=e[18];let p;return e[19]!==t||e[20]!==u||e[21]!==d?(p=_(It,{label:"Row detail",onClose:t,panelTestId:"rd-panel",testId:"rd-overlay",variant:"drawer",children:[u,d]}),e[19]=t,e[20]=u,e[21]=d,e[22]=p):p=e[22],p},Es=50,_s=o=>{const e=L(8),{active:n,onPick:s,shard:t}=o;let a;e[0]!==s||e[1]!==t?(a=()=>{s(t)},e[0]=s,e[1]=t,e[2]=a):a=e[2];const l=a,i=`w-full rounded px-2 py-0.5 text-left text-xs transition-colors hover:bg-accent ${n?"bg-accent font-medium":""}`,r=`shard-explorer-item-${t}`;let c;return e[3]!==l||e[4]!==t||e[5]!==i||e[6]!==r?(c=f("button",{className:i,"data-testid":r,onClick:l,type:"button",children:t}),e[3]=l,e[4]=t,e[5]=i,e[6]=r,e[7]=c):c=e[7],c},Rs=({onFetchTables:o,onSelect:e})=>{const n=re(),[s]=M(()=>zn()),[t,a]=M(!1),[l,i]=M(void 0),[r,c]=M(void 0),[g,u]=M(!1),[m,d]=M(void 0),p=He(0),b=()=>{a(x=>!x)},h=async x=>{e(x),i(x),c(void 0),d(void 0),u(!0),p.current+=1;const v=p.current;try{const w=await o(x);p.current===v&&c(w?.slice(0,Es))}catch(w){p.current===v&&d(w.message)}p.current===v&&u(!1)},y=x=>{be(h(x))};return s.length===0?null:_("div",{"data-testid":"shard-explorer",children:[_("button",{"aria-controls":"shard-explorer-panel","aria-expanded":t,className:"inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"shard-explorer-toggle",onClick:b,type:"button",children:[n("Shards seen"),f("span",{"aria-hidden":"true",className:`ml-0.5 transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),t&&_("div",{className:"mt-1 flex flex-col gap-1 rounded-md border border-border bg-popover p-2","data-testid":"shard-explorer-panel",id:"shard-explorer-panel",children:[f("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-hint",children:n("Recently visited shards — click to switch")}),f("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-list",children:s.map(x=>f("li",{children:f(_s,{active:l===x,onPick:y,shard:x})},x))}),l!==void 0&&_("div",{className:"mt-1 border-t border-border pt-1","data-testid":"shard-explorer-summary",children:[f("p",{className:"mb-1 text-xs font-medium text-foreground","data-testid":"shard-explorer-summary-title",children:n("{shard} tables",{shard:l})}),g&&f("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-loading",children:n("Loading…")}),m!==void 0&&f("p",{className:"text-xs text-destructive","data-testid":"shard-explorer-error",role:"alert",children:m}),!g&&m===void 0&&r?.length===0&&f("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-empty",children:n("No tables in this shard.")}),!g&&m===void 0&&r!==void 0&&r.length>0&&f("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-tables",children:r.map(x=>_("li",{className:"flex items-center justify-between text-xs",children:[f("span",{"data-testid":`shard-explorer-table-${x.name}`,children:x.name}),f("span",{className:"text-muted-foreground","data-testid":`shard-explorer-rowcount-${x.name}`,children:x.rowCount})]},x.name))})]})]})]})},$s="lunora-studio-back-relations",Ds={},Is=50,Ms=[],As=Te(le.listTables),Os=o=>{const e=L(10),{onFetchShardTables:n,onShardChange:s,schemaSwitch:t,shardKey:a}=o;let l;e[0]!==s||e[1]!==a?(l=f(gn,{onChange:s,testId:"db-shard-input",value:a}),e[0]=s,e[1]=a,e[2]=l):l=e[2];let i;e[3]!==n||e[4]!==s?(i=f(Rs,{onFetchTables:n,onSelect:s}),e[3]=n,e[4]=s,e[5]=i):i=e[5];let r;return e[6]!==t||e[7]!==l||e[8]!==i?(r=_("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[t,l,i]}),e[6]=t,e[7]=l,e[8]=i,e[9]=r):r=e[9],r},cl=({editable:o=!1,globalTableNames:e,initialFilters:n,initialOrderBy:s,initialPins:t,initialSearch:a,initialShardKey:l,onNavigateToGlobal:i,onSelectTable:r,onViewChange:c,pageSize:g=Is,queryBar:u,schemaSwitch:m,tableParam:d})=>{const b=Xe(le.describeTables,{},{shardKey:l??""}).data?.columnsByTable??Ds,[h,y]=$t($s,{}),x=et(P=>{const X=new Set(h[P]);return wt(P,b).filter(_e=>X.has(pt(_e)))},[h,b]),v=us({initialFilters:n,initialOrderBy:s,initialSearch:a,initialShardKey:l,onSelectTable:r,onViewChange:c,pageSize:g,resolveBackRelations:x,tableParam:d}),{cancelCellEdit:w,columns:N,currentView:T,editableColumn:C,editingCell:S,facetFilter:k,facets:A,loadTables:$,navigateToRef:E,onFiltersChange:D,page:R,pageError:q,previewRef:O,queryShardKey:B,selectedTable:F,selectTable:J,setShardKey:H,shardKey:G,stage:U,stagedValue:ye,startCellEdit:ie,tables:he,tablesError:xe,toggleFacet:Se}=v,ce=Cn(G),Ce=P=>{be((async()=>{const _e=await ce.suggestFilter(P,F??"");_e!==void 0&&D(_e.map(Re=>{const $e=Re.value,Ue=typeof $e=="string"||typeof $e=="number"||typeof $e=="boolean"?String($e):"";return{column:Re.column,operator:Re.operator,value:Ue}}))})())},de=F===null?[]:wt(F,b),Z=new Set(h[F??""]),Ne=[];for(const P of R?.rows??[]){const X=P._id??P.id;typeof X=="string"&&X!==""&&Ne.push(X)}const ue=Yo(Z,de,Ne,B),fe=P=>{y(X=>{const _e=F??"",Re=X[_e]??[];return{...X,[_e]:Re.includes(P)?Re.filter($e=>$e!==P):[...Re,P]}})},se=ms({columns:N,initialPins:t,selectedTable:F}),me=Ss(),{closeExpandedCell:Y,closeInspect:j,expandedCell:te,inspecting:ne,onExpandCell:Me}=me,oe=ot(),W=Object.fromEntries((b[F??""]??[]).map(P=>[P.name,P])),ee=new Map;for(const P of b[F??""]??[])P.isStorage===!0&&ee.set(P.name,P.bucket);const Q=et(async(P,X)=>oe.signedStorageUrl(P,X===void 0?{}:{bucket:X}),[oe]),z=async P=>await oe.query(As,{},we(P)),ge=()=>{F!==null&&J(F)},{closeDialog:K,columnMeta:Ee,fkPools:Ae,insertBatch:Oe,open:Fe,openDialog:ze}=ys(ge),pe=()=>{F!==null&&ze(F,G)},je=P=>Oe(P,K),Pe=(P,X)=>{if(i!==void 0&&e?.has(P)===!0){i(P,X);return}E(P,X)},Ke=u?.onSaveQuery,Qe=P=>{Ke?.(P,T)},We={cancelEdit:w,editable:o,editableColumn:C,editingCell:S,onExpandCell:Me,stage:U,stagedValue:ye,startEdit:ie},st={columns:R?.refs,maskViewFor:se.maskViewFor,onNavigate:Pe,onPreview:O};return _("div",{className:"flex h-full min-w-0","data-testid":"lunora-data-browser",children:[f(yn,{header:f(Os,{onFetchShardTables:z,onShardChange:H,schemaSwitch:m,shardKey:G}),onReload:$,onSelect:J,prefix:"db",selected:F,tables:he??Ms}),_("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[xe!==null&&f("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-tables-error",role:"alert",children:xe}),R===null&&q===null&&f("div",{className:"flex flex-1 items-center justify-center p-6",children:f("p",{className:"text-sm text-muted-foreground",children:"Select a table to browse its rows."})}),q!==null&&f("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-page-error",role:"alert",children:q}),R!==null&&f(jo,{assistant:ce,backRelations:{available:de,counts:ue,enabled:Z,onToggle:fe},browser:v,columnMeta:W,edit:We,editable:o,onAskAiFilter:Ce,onInspect:me.onInspect,onOpenGenerateRows:pe,onSaveQuery:Qe,page:R,preferences:se,queryBar:u,references:st})]}),R!==null&&f(Sn,{columns:N,facets:A,mask:se.maskView,onFacetFilter:k,onToggleFacet:Se}),ne!==null&&R!==null&&f(Ts,{columns:R.columns,mask:se.maskView,onClose:j,onNavigate:Pe,refs:R.refs,row:Dt(ne,se.maskView)}),te!==null&&f(On,{bucket:ee.get(te.column),column:te.column,onClose:Y,resolveUrl:ee.has(te.column)?Q:void 0,value:te.value}),Fe&&F!==null&&Ee!==void 0&&f(Qo,{columns:Ee,fkPools:Ae,onClose:K,onInsertRows:je,table:F})]})};export{cl as DataBrowser};
@@ -0,0 +1 @@
1
+ import{useLunora as de}from"@lunora/react";import{useState as A,useRef as U,useEffect as H}from"react";import{b as I}from"./use-admin-query-P0RJrjsD.js";import{useAutoRefresh as me}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{m as Q,G as ue,u as fe,a as ge,b as pe,T as be,D as he}from"./table-list-sidebar-BWq_-gtu.js";import{useT as V}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{b as xe}from"./cf-links-CBJ5SywP.js";import{c as W}from"react/compiler-runtime";import{c as ke,a as Ne,b as Z,e as ve,d as ye,T as we}from"./table-BMsuYFhk.js";import{a as Te}from"./control-button-BOZ5K-FC.js";import{C as q,G as Se}from"./data-grid-BFTQnkXq.js";import{jsx as r,jsxs as F}from"react/jsx-runtime";import{E as Ce}from"./empty-state-B939z6K2.js";const Pe=(t,e)=>{const o=t._id;return typeof o=="string"||typeof o=="number"?String(o):`row-${e.toString()}`},Fe=t=>t==null?"∅":t===""?"(empty)":typeof t=="object"?JSON.stringify(t):String(t),Ee=t=>{const e=W(45),{filters:o,hasMaskedColumns:f,mask:s,maskOn:u,onChangePageSize:i,onJumpToPage:R,onNext:d,onPrevious:T,onRemoveFilter:g,onToggleMask:L,page:c,pageSize:E,pagination:S}=t,C=V(),{hasNext:z,hasPrevious:D,rangeEnd:j,rangeStart:P,total:k}=S;let N;e[0]!==f||e[1]!==u||e[2]!==L||e[3]!==C?(N=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:Te,"data-testid":"gdb-mask-toggle",onClick:L,type:"button",children:C("Mask sensitive columns")})}),e[0]=f,e[1]=u,e[2]=L,e[3]=C,e[4]=N):N=e[4];let p;e[5]!==o||e[6]!==s||e[7]!==g||e[8]!==C?(p=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=Fe(Q(n.value,n.column,s));return F("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:()=>{g(m)},type:"button",children:"✕"})]},`${n.column}:${G}`)})}),e[5]=o,e[6]=s,e[7]=g,e[8]=C,e[9]=p):p=e[9];let a;if(e[10]!==s||e[11]!==c.columns){let n;e[13]!==s?(n=m=>F(ke,{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 v;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(ve,{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))},Pe(m,G)),e[21]=s,e[22]=c.columns,e[23]=n):n=e[23],v=c.rows.map(n),e[17]=s,e[18]=c.columns,e[19]=c.rows,e[20]=v}else v=e[20];let y;e[24]!==v?(y=r(ye,{children:v}),e[24]=v,e[25]=y):y=e[25];let h;e[26]!==b||e[27]!==y?(h=r(Se,{layout:"fill",children:r("div",{className:"min-h-0 flex-1 overflow-auto",children:F(we,{"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]!==R||e[33]!==d||e[34]!==T||e[35]!==E||e[36]!==j||e[37]!==P||e[38]!==k?(x=r("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:r(ue,{hasNext:z,hasPrevious:D,onJumpToPage:R,onNext:d,onPageSizeChange:i,onPrevious:T,pageSize:E,prefix:"gdb",rangeEnd:j,rangeStart:P,total:k})}),e[29]=z,e[30]=D,e[31]=i,e[32]=R,e[33]=d,e[34]=T,e[35]=E,e[36]=j,e[37]=P,e[38]=k,e[39]=x):x=e[39];let M;return e[40]!==N||e[41]!==p||e[42]!==h||e[43]!==x?(M=F("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"gdb-page",children:[N,p,h,x]}),e[40]=N,e[41]=p,e[42]=h,e[43]=x,e[44]=M):M=e[44],M},Me=()=>{const t=W(8),e=V();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=F("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(Ce,{description:o,icon:f,testId:"gdb-empty",title:s})}),t[5]=o,t[6]=s,t[7]=u):u=t[7],u},Ge=50,Oe=[],K=[],Ie=({initialTable:t,onSelectTable:e,pageSize:o=Ge,schemaSwitch:f}={})=>{const s=de(),u=V(),[i,R]=A(t??null),[d,T]=A(0),[g,L]=A(o),[c,E]=A([]),S=fe(c),{clearFacets:C,facets:z,refetchFacets:D,toggleFacet:j}=ge(),P=I(["lunora-global-tables"],()=>s.listGlobalTables()),k=P.data??null,N=P.error,p=I(["lunora-global-page",i??"",d,g,JSON.stringify(c)],()=>s.readGlobalTablePage({filters:c,limit:g,offset:d,table:i??""}),{enabled:i!==null,keepPreviousData:!1}),a=p.data??null,b=p.error,v=(l,O)=>$=>s.facetGlobalColumn({column:$,filters:O,table:l}),y=(l,O)=>{D(v(l,O))};me(()=>{P.refetch(),i!==null&&(p.refetch(),y(i,S.current))},!0);const h=U(void 0),x=l=>{R(l),h.current=l,E([]),S.current=[],C(),T(0),e?.(l)},M=l=>{j(l,i===null?null:v(i,S.current))},n=l=>{E(l),S.current=l,T(0),i!==null&&y(i,l)},m=(l,O)=>{n([...S.current.filter($=>$.column!==l),{column:l,value:O}])},G=l=>{n(S.current.filter((O,$)=>$!==l))},w=U(x);H(()=>{w.current=x}),H(()=>{if(t===void 0||t===""||h.current===t)return;h.current=t;const l=t;queueMicrotask(()=>{w.current(l)})},[t]);const B=l=>{i!==null&&T(Math.max(0,l))},{maskColumns:X,maskOn:Y,maskView:_,onToggleMask:ee}=pe({columns:a?.columns??K,selectedTable:i}),J=a?.total??0,te=d>0,re=a!==null&&d+a.rows.length<J,se=a===null||a.rows.length===0?0:d+1,le=a===null?0:d+a.rows.length,ae=()=>{P.refetch()},oe=()=>{B(d-g)},ne=()=>{B(d+g)},ie=l=>{B(Math.max(0,(l-1)*g))},ce=l=>{L(l),T(0)};return F("div",{className:"flex h-full min-w-0","data-testid":"lunora-global-data-browser",children:[r(be,{header:F("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:xe,rel:"noreferrer",target:"_blank",children:u("Open in Cloudflare")})]}),onReload:ae,onSelect:x,prefix:"gdb",selected:i,tables:k??Oe}),F("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[N!==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:N}),k!==null&&k.length===0&&r(Me,{}),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(Ee,{filters:c,hasMaskedColumns:X.size>0,mask:_,maskOn:Y,onChangePageSize:ce,onJumpToPage:ie,onNext:ne,onPrevious:oe,onRemoveFilter:G,onToggleMask:ee,page:a,pageSize:g,pagination:{hasNext:re,hasPrevious:te,rangeEnd:le,rangeStart:se,total:J}})]}),r(he,{columns:a?.columns??K,facets:z,mask:_,onFacetFilter:m,onToggleFacet:M})]})};export{Ie as GlobalDataBrowser};
@@ -1 +1 @@
1
- import"./badge-cAk9Di1Q.js";import"./card-BGlQzQY-.js";import"./empty-state-B939z6K2.js";import"./use-admin-query-DV9xmFl8.js";import"./DEFAULT_LOCALE-A1Yg5ORA.js";import"./ADMIN_FUNCTIONS-B6z7VLYt.js";import"./internal-7bgd8inO.js";import"./utils-bhneXptQ.js";import"./DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js";import{H as n}from"./home-panel-ecz6-nHV.js";export{n as HomePanel};
1
+ import"./badge-cAk9Di1Q.js";import"./card-BGlQzQY-.js";import"./empty-state-B939z6K2.js";import"./use-admin-query-P0RJrjsD.js";import"./DEFAULT_LOCALE-A1Yg5ORA.js";import"./ADMIN_FUNCTIONS-B6z7VLYt.js";import"./internal-CwaF9YNk.js";import"./utils-bhneXptQ.js";import"./DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js";import{H as n}from"./home-panel-DHOa3sxt.js";export{n as HomePanel};
@@ -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-Cj2SOapE.js";import{E as Me}from"./error-alert-CKqB2CiN.js";import{L as Te}from"./live-status-Bf7rR8o8.js";import{ShardInput as _e}from"./ShardInput-CdawpUiS.js";import{B as ke}from"./badge-cAk9Di1Q.js";import{B as Le}from"./button-BOPLD1un.js";import{C as we,a as De}from"./card-BGlQzQY-.js";import{E as Be}from"./empty-state-B939z6K2.js";import{I as Ae}from"./input-CY5W3wzv.js";import{L as ue}from"./label-BOUo-DP0.js";import{T as Ke,a as je,b as fe,c as u,d as Fe,e as f}from"./table-BMsuYFhk.js";import{u as Oe}from"./use-admin-query-DV9xmFl8.js";import{u as qe}from"./use-shard-key-BsP3o5wT.js";import{useT as He}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as he}from"./ADMIN_FUNCTIONS-B6z7VLYt.js";import{i as Qe,c as Ue,f as $e,d as ze,b as Ge}from"./internal-7bgd8inO.js";import{r as Pe}from"./shard-history-DU5b3QDI.js";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-Cj2SOapE.js";import{E as Me}from"./error-alert-TYdKetJd.js";import{L as Te}from"./live-status-Bf7rR8o8.js";import{ShardInput as _e}from"./ShardInput-CdawpUiS.js";import{B as ke}from"./badge-cAk9Di1Q.js";import{B as Le}from"./button-BOPLD1un.js";import{C as we,a as De}from"./card-BGlQzQY-.js";import{E as Be}from"./empty-state-B939z6K2.js";import{I as Ae}from"./input-CY5W3wzv.js";import{L as ue}from"./label-BOUo-DP0.js";import{T as Ke,a as je,b as fe,c as u,d as Fe,e as f}from"./table-BMsuYFhk.js";import{u as Oe}from"./use-admin-query-P0RJrjsD.js";import{u as qe}from"./use-shard-key-BsP3o5wT.js";import{useT as He}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as he}from"./ADMIN_FUNCTIONS-B6z7VLYt.js";import{i as Qe,c as Ue,f as $e,d as ze,b as Ge}from"./internal-CwaF9YNk.js";import{r as Pe}from"./shard-history-DU5b3QDI.js";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-B939z6K2.js";import{S as y}from"./skeleton-DFBBaJU6.js";import{u as R,R as S}from"./reference-view-DY3CaRxH.js";import{useT as P}from"./DEFAULT_LOCALE-A1Yg5ORA.js";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-B939z6K2.js";import{S as y}from"./skeleton-DFBBaJU6.js";import{u as R,R as S}from"./reference-view-BU2dNK9Z.js";import{useT as P}from"./DEFAULT_LOCALE-A1Yg5ORA.js";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 w,useEffect as H}from"react";import{ConfirmButton as M}from"./ConfirmButton-Cj2SOapE.js";import{C as P,a as Q}from"./card-BGlQzQY-.js";import{E as R}from"./empty-state-B939z6K2.js";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-BMsuYFhk.js";import{b as V}from"./use-admin-query-DV9xmFl8.js";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{f as G,i as O,b as U}from"./internal-7bgd8inO.js";import{jsx as t,jsxs as p}from"react/jsx-runtime";const X=s=>Number.isFinite(s)?O(s,"—"):"—",j=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 j(r)}),[F,L]=w(void 0),[A,S]=w(void 0);let v,x;e[1]!==n||e[2]!==c?(v=()=>{if(c)return n.subscribeScheduledJobs(r=>{S(void 0),L(j(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=F??d.data,N=A??d.error,E=async r=>{if(C!==void 0){S(void 0);try{await C(r),c||d.refetch()}catch(_){S(U(_))}}},k="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 T=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.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(E(r.id))},testId:`sj-cancel-${r.id}`,children:o("Cancel")})})]},r.id))})]})})});let g;return e[12]!==T||e[13]!==m||e[14]!==h?(g=p("div",{className:k,"data-testid":B,children:[m,h,T]}),e[12]=T,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 w,useEffect as H}from"react";import{ConfirmButton as M}from"./ConfirmButton-Cj2SOapE.js";import{C as P,a as Q}from"./card-BGlQzQY-.js";import{E as R}from"./empty-state-B939z6K2.js";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-BMsuYFhk.js";import{b as V}from"./use-admin-query-P0RJrjsD.js";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{f as G,i as O,b as U}from"./internal-CwaF9YNk.js";import{jsx as t,jsxs as p}from"react/jsx-runtime";const X=s=>Number.isFinite(s)?O(s,"—"):"—",j=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 j(r)}),[F,L]=w(void 0),[A,S]=w(void 0);let v,x;e[1]!==n||e[2]!==c?(v=()=>{if(c)return n.subscribeScheduledJobs(r=>{S(void 0),L(j(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=F??d.data,N=A??d.error,E=async r=>{if(C!==void 0){S(void 0);try{await C(r),c||d.refetch()}catch(_){S(U(_))}}},k="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 T=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.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(E(r.id))},testId:`sj-cancel-${r.id}`,children:o("Cancel")})})]},r.id))})]})})});let g;return e[12]!==T||e[13]!==m||e[14]!==h?(g=p("div",{className:k,"data-testid":B,children:[m,h,T]}),e[12]=T,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-CXai1O2K.js";import"./ErrorBoundary-BWNF98VF.js";import"./operation-console-provider-DoloEvon.js";import"./badge-cAk9Di1Q.js";import"./input-CY5W3wzv.js";import"./skeleton-DFBBaJU6.js";import"./home-panel-DHOa3sxt.js";import"./DEFAULT_LOCALE-A1Yg5ORA.js";import"./StudioI18nProvider-Bl547evf.js";import"./data-view-params-qoSTqjAj.js";import"./internal-CwaF9YNk.js";import"./utils-bhneXptQ.js";import"./CommandPalette-HqiXrWIm.js";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 R}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.js";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-Cvdwfzxm.js";import Q from"./useDebounced-DVeQ5-oW.js";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{StudioI18nProvider as D}from"./StudioI18nProvider-Bl547evf.js";import{r as Z}from"./internal-7bgd8inO.js";import{w as $}from"./recording-client-BPY8sYUl.js";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.js";import{a as K}from"./browser-storage-BH1MxLZs.js";import{c as W}from"./utils-bhneXptQ.js";import{B as ee}from"./button-BOPLD1un.js";import{I as te}from"./input-CY5W3wzv.js";import{jsx as g,jsxs as L}from"react/jsx-runtime";const P="lunora-studio-admin-token",oe=()=>{try{return K("session")?.getItem(P)??""}catch{return""}},ne=b=>{const e=K("session");if(e!==void 0)try{b===""?e.removeItem(P):e.setItem(P,b)}catch{}},se="/_lunora/admin/ws-token",ie=1e4,le=b=>{const e=b;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},re=b=>{const{adminToken:e,baseUrl:d}=b,o=b.fetchImpl??fetch;let n=d;for(;n.endsWith("/");)n=n.slice(0,-1);const r=`${n}${se}`;let t,s=!1,i;const f=async()=>{const u=await o(r,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(u.status===404||u.status===405)return s=!0,e;if(!u.ok)throw new Error(`ws-token mint failed: ${String(u.status)}`);const l=await u.json().catch(()=>{});if(!le(l))throw new Error("ws-token mint failed: malformed response body");return t=l,l.token};return{getToken:async()=>s?e:t!==void 0&&t.expiresAtMs-ie>Date.now()?t.token:(i??=f().finally(()=>{i=void 0}),i),invalidate:()=>{t=void 0}}},ae=b=>{const e=O(42),{onSubmit:d}=b,o=j(),[n,r]=B("");let t;e[0]!==n?(t=n.trim(),e[0]=n,e[1]=t):t=e[1];const s=t;let i;e[2]!==d||e[3]!==s?(i=_=>{_.preventDefault(),s!==""&&d(s)},e[2]=d,e[3]=s,e[4]=i):i=e[4];const f=i;let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=g("div",{className:"h-10 w-10 text-foreground",children:g(V,{})}),e[5]=u):u=e[5];let l;e[6]!==o?(l=o("Connect to Lunora Studio"),e[6]=o,e[7]=l):l=e[7];let v;e[8]!==l?(v=g("h1",{className:"text-base font-semibold text-foreground",children:l}),e[8]=l,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 m;e[12]!==k?(m=g("p",{className:"text-[13px] text-muted-foreground",children:k}),e[12]=k,e[13]=m):m=e[13];let c;e[14]!==v||e[15]!==m?(c=L("div",{className:"flex flex-col items-center gap-3 text-center",children:[u,L("div",{className:"flex flex-col gap-1",children:[v,m]})]}),e[14]=v,e[15]=m,e[16]=c):c=e[16];let h;e[17]!==o?(h=o("admin token"),e[17]=o,e[18]=h):h=e[18];let a;e[19]!==h?(a=g("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:h}),e[19]=h,e[20]=a):a=e[20];let p;e[21]===Symbol.for("react.memo_cache_sentinel")?(p=_=>{r(_.target.value)},e[21]=p):p=e[21];let S;e[22]!==n?(S=g(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:p,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:n}),e[22]=n,e[23]=S):S=e[23];let x;e[24]!==o?(x=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]=x):x=e[25];let A;e[26]!==x?(A=g("p",{className:"text-[11px] text-muted-foreground",children:x}),e[26]=x,e[27]=A):A=e[27];let T;e[28]!==a||e[29]!==S||e[30]!==A?(T=L("div",{className:"flex flex-col gap-1.5",children:[a,S,A]}),e[28]=a,e[29]=S,e[30]=A,e[31]=T):T=e[31];const E=s==="";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=g(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]!==f||e[38]!==T||e[39]!==w||e[40]!==c?(N=L("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:f,children:[c,T,w]}),e[37]=f,e[38]=T,e[39]=w,e[40]=c,e[41]=N):N=e[41],N},ce=b=>{const e=O(10),{i18n:d,onSubmit:o}=b,{resolvedTheme:n}=U(),r=n==="dark"&&"dark";let t;e[0]!==r?(t=W(F,r,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==o?(s=g(ae,{onSubmit:o}),e[2]=o,e[3]=s):s=e[3];let i;e[4]!==d||e[5]!==s?(i=g(D,{i18n:d,children:s}),e[4]=d,e[5]=s,e[6]=i):i=e[6];let f;return e[7]!==t||e[8]!==i?(f=g("div",{className:t,"data-testid":"lunora-studio-login-root",children:i}),e[7]=t,e[8]=i,e[9]=f):f=e[9],f},de=b=>{const e=O(23),{basePath:d,chrome:o,studio:n}=b,r=j();let t;e[0]!==r?(t=r("Studio failed"),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==r?(s=r("Studio"),e[2]=r,e[3]=s):s=e[3];let i;e[4]!==r?(i=r("Try again"),e[4]=r,e[5]=i):i=e[5];const f=n?.dataEditable,u=n?.functions,l=n?.initialShardKey,v=n?.openApiSpec,k=n?.openRpcSpec,m=n?.runAsIdentity,c=n?.scheduledCancel,h=n?.scheduledLoad,a=n?.schemaEditable;let p;e[6]!==d||e[7]!==o||e[8]!==c||e[9]!==h||e[10]!==a||e[11]!==f||e[12]!==u||e[13]!==l||e[14]!==v||e[15]!==k||e[16]!==m?(p=g(J,{basePath:d,chrome:o,dataEditable:f,functions:u,initialShardKey:l,openApiSpec:v,openRpcSpec:k,runAsIdentity:m,scheduledCancel:c,scheduledLoad:h,schemaEditable:a}),e[6]=d,e[7]=o,e[8]=c,e[9]=h,e[10]=a,e[11]=f,e[12]=u,e[13]=l,e[14]=v,e[15]=k,e[16]=m,e[17]=p):p=e[17];let S;return e[18]!==t||e[19]!==p||e[20]!==s||e[21]!==i?(S=g(z,{fallbackTitle:t,label:s,retryLabel:i,children:p}),e[18]=t,e[19]=p,e[20]=s,e[21]=i,e[22]=S):S=e[22],S},fe=b=>{const e=O(20),{basePath:d,clearToken:o,client:n,i18n:r,onTokenChange:t,rulesInstalled:s,studio:i,token:f}=b,{resolvedTheme:u}=U();let l;e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==f?(l={clearToken:o,onTokenChange:t,rulesInstalled:s,token:f},e[0]=o,e[1]=t,e[2]=s,e[3]=f,e[4]=l):l=e[4];const v=l,k=u==="dark"&&"dark";let m;e[5]!==k?(m=W(F,k,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=k,e[6]=m):m=e[6];let c;e[7]!==d||e[8]!==v||e[9]!==i?(c=g(q,{children:g(de,{basePath:d,chrome:v,studio:i})}),e[7]=d,e[8]=v,e[9]=i,e[10]=c):c=e[10];let h;e[11]!==r||e[12]!==c?(h=g(D,{i18n:r,children:c}),e[11]=r,e[12]=c,e[13]=h):h=e[13];let a;e[14]!==n||e[15]!==h?(a=g(H,{client:n,children:h}),e[14]=n,e[15]=h,e[16]=a):a=e[16];let p;return e[17]!==m||e[18]!==a?(p=g("div",{className:m,"data-testid":"lunora-studio-app",children:a}),e[17]=m,e[18]=a,e[19]=p):p=e[19],p},Ee=b=>{const e=O(27);let d;e[0]!==b?(d=b===void 0?{}:b,e[0]=b,e[1]=d):d=e[1];const{adminToken:o,basePath:n,baseUrl:r,client:t,rulesInstalled:s,studio:i,locale:f}=d;let u;e[2]!==o?(u=()=>o??oe(),e[2]=o,e[3]=u):u=e[3];const[l,v]=B(u);let k,m;e[4]!==l?(k=()=>{ne(l)},m=[l],e[4]=l,e[5]=k,e[6]=m):(k=e[5],m=e[6]),R(k,m);const c=Q(l,300);let h;e:{if(t!==void 0){let I;e[7]!==t?(I=$(t),e[7]=t,e[8]=I):I=e[8],h=I;break e}let _;if(e[9]!==r||e[10]!==c){const I=Z(r),C=c===""?void 0:re({adminToken:c,baseUrl:I}),M=new G({url:I,...C===void 0?{}:{wsToken:C.getToken}});C!==void 0&&(M.setAuthToken(c),M.onTokenExpired(C.invalidate)),_=$(M),e[9]=r,e[10]=c,e[11]=_}else _=e[11];h=_}const a=h;let p,S;e[12]!==a||e[13]!==t?(p=()=>()=>{t===void 0&&a.close()},S=[a,t],e[12]=a,e[13]=t,e[14]=p,e[15]=S):(p=e[14],S=e[15]),R(p,S);let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=_=>{v(_.target.value)},e[16]=x):x=e[16];const A=x;let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{v("")},e[17]=T):T=e[17];const E=T;let y;e[18]!==f?(y=X(f),e[18]=f,e[19]=y):y=e[19];const w=y;let N;return e[20]!==n||e[21]!==a||e[22]!==w||e[23]!==s||e[24]!==i||e[25]!==l?(N=g(Y,{children:l===""?g(ce,{i18n:w,onSubmit:v}):g(fe,{basePath:n,clearToken:E,client:a,i18n:w,onTokenChange:A,rulesInstalled:s,studio:i,token:l})}),e[20]=n,e[21]=a,e[22]=w,e[23]=s,e[24]=i,e[25]=l,e[26]=N):N=e[26],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 R}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.js";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-CXai1O2K.js";import Q from"./useDebounced-DVeQ5-oW.js";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{StudioI18nProvider as D}from"./StudioI18nProvider-Bl547evf.js";import{r as Z}from"./internal-CwaF9YNk.js";import{w as $}from"./recording-client-CKn4-vUx.js";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.js";import{a as K}from"./browser-storage-BH1MxLZs.js";import{c as W}from"./utils-bhneXptQ.js";import{B as ee}from"./button-BOPLD1un.js";import{I as te}from"./input-CY5W3wzv.js";import{jsx as g,jsxs as L}from"react/jsx-runtime";const P="lunora-studio-admin-token",oe=()=>{try{return K("session")?.getItem(P)??""}catch{return""}},ne=b=>{const e=K("session");if(e!==void 0)try{b===""?e.removeItem(P):e.setItem(P,b)}catch{}},se="/_lunora/admin/ws-token",ie=1e4,le=b=>{const e=b;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},re=b=>{const{adminToken:e,baseUrl:d}=b,o=b.fetchImpl??fetch;let n=d;for(;n.endsWith("/");)n=n.slice(0,-1);const r=`${n}${se}`;let t,s=!1,i;const f=async()=>{const u=await o(r,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(u.status===404||u.status===405)return s=!0,e;if(!u.ok)throw new Error(`ws-token mint failed: ${String(u.status)}`);const l=await u.json().catch(()=>{});if(!le(l))throw new Error("ws-token mint failed: malformed response body");return t=l,l.token};return{getToken:async()=>s?e:t!==void 0&&t.expiresAtMs-ie>Date.now()?t.token:(i??=f().finally(()=>{i=void 0}),i),invalidate:()=>{t=void 0}}},ae=b=>{const e=O(42),{onSubmit:d}=b,o=j(),[n,r]=B("");let t;e[0]!==n?(t=n.trim(),e[0]=n,e[1]=t):t=e[1];const s=t;let i;e[2]!==d||e[3]!==s?(i=_=>{_.preventDefault(),s!==""&&d(s)},e[2]=d,e[3]=s,e[4]=i):i=e[4];const f=i;let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=g("div",{className:"h-10 w-10 text-foreground",children:g(V,{})}),e[5]=u):u=e[5];let l;e[6]!==o?(l=o("Connect to Lunora Studio"),e[6]=o,e[7]=l):l=e[7];let v;e[8]!==l?(v=g("h1",{className:"text-base font-semibold text-foreground",children:l}),e[8]=l,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 m;e[12]!==k?(m=g("p",{className:"text-[13px] text-muted-foreground",children:k}),e[12]=k,e[13]=m):m=e[13];let c;e[14]!==v||e[15]!==m?(c=L("div",{className:"flex flex-col items-center gap-3 text-center",children:[u,L("div",{className:"flex flex-col gap-1",children:[v,m]})]}),e[14]=v,e[15]=m,e[16]=c):c=e[16];let h;e[17]!==o?(h=o("admin token"),e[17]=o,e[18]=h):h=e[18];let a;e[19]!==h?(a=g("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:h}),e[19]=h,e[20]=a):a=e[20];let p;e[21]===Symbol.for("react.memo_cache_sentinel")?(p=_=>{r(_.target.value)},e[21]=p):p=e[21];let S;e[22]!==n?(S=g(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:p,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:n}),e[22]=n,e[23]=S):S=e[23];let x;e[24]!==o?(x=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]=x):x=e[25];let A;e[26]!==x?(A=g("p",{className:"text-[11px] text-muted-foreground",children:x}),e[26]=x,e[27]=A):A=e[27];let T;e[28]!==a||e[29]!==S||e[30]!==A?(T=L("div",{className:"flex flex-col gap-1.5",children:[a,S,A]}),e[28]=a,e[29]=S,e[30]=A,e[31]=T):T=e[31];const E=s==="";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=g(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]!==f||e[38]!==T||e[39]!==w||e[40]!==c?(N=L("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:f,children:[c,T,w]}),e[37]=f,e[38]=T,e[39]=w,e[40]=c,e[41]=N):N=e[41],N},ce=b=>{const e=O(10),{i18n:d,onSubmit:o}=b,{resolvedTheme:n}=U(),r=n==="dark"&&"dark";let t;e[0]!==r?(t=W(F,r,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==o?(s=g(ae,{onSubmit:o}),e[2]=o,e[3]=s):s=e[3];let i;e[4]!==d||e[5]!==s?(i=g(D,{i18n:d,children:s}),e[4]=d,e[5]=s,e[6]=i):i=e[6];let f;return e[7]!==t||e[8]!==i?(f=g("div",{className:t,"data-testid":"lunora-studio-login-root",children:i}),e[7]=t,e[8]=i,e[9]=f):f=e[9],f},de=b=>{const e=O(23),{basePath:d,chrome:o,studio:n}=b,r=j();let t;e[0]!==r?(t=r("Studio failed"),e[0]=r,e[1]=t):t=e[1];let s;e[2]!==r?(s=r("Studio"),e[2]=r,e[3]=s):s=e[3];let i;e[4]!==r?(i=r("Try again"),e[4]=r,e[5]=i):i=e[5];const f=n?.dataEditable,u=n?.functions,l=n?.initialShardKey,v=n?.openApiSpec,k=n?.openRpcSpec,m=n?.runAsIdentity,c=n?.scheduledCancel,h=n?.scheduledLoad,a=n?.schemaEditable;let p;e[6]!==d||e[7]!==o||e[8]!==c||e[9]!==h||e[10]!==a||e[11]!==f||e[12]!==u||e[13]!==l||e[14]!==v||e[15]!==k||e[16]!==m?(p=g(J,{basePath:d,chrome:o,dataEditable:f,functions:u,initialShardKey:l,openApiSpec:v,openRpcSpec:k,runAsIdentity:m,scheduledCancel:c,scheduledLoad:h,schemaEditable:a}),e[6]=d,e[7]=o,e[8]=c,e[9]=h,e[10]=a,e[11]=f,e[12]=u,e[13]=l,e[14]=v,e[15]=k,e[16]=m,e[17]=p):p=e[17];let S;return e[18]!==t||e[19]!==p||e[20]!==s||e[21]!==i?(S=g(z,{fallbackTitle:t,label:s,retryLabel:i,children:p}),e[18]=t,e[19]=p,e[20]=s,e[21]=i,e[22]=S):S=e[22],S},fe=b=>{const e=O(20),{basePath:d,clearToken:o,client:n,i18n:r,onTokenChange:t,rulesInstalled:s,studio:i,token:f}=b,{resolvedTheme:u}=U();let l;e[0]!==o||e[1]!==t||e[2]!==s||e[3]!==f?(l={clearToken:o,onTokenChange:t,rulesInstalled:s,token:f},e[0]=o,e[1]=t,e[2]=s,e[3]=f,e[4]=l):l=e[4];const v=l,k=u==="dark"&&"dark";let m;e[5]!==k?(m=W(F,k,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=k,e[6]=m):m=e[6];let c;e[7]!==d||e[8]!==v||e[9]!==i?(c=g(q,{children:g(de,{basePath:d,chrome:v,studio:i})}),e[7]=d,e[8]=v,e[9]=i,e[10]=c):c=e[10];let h;e[11]!==r||e[12]!==c?(h=g(D,{i18n:r,children:c}),e[11]=r,e[12]=c,e[13]=h):h=e[13];let a;e[14]!==n||e[15]!==h?(a=g(H,{client:n,children:h}),e[14]=n,e[15]=h,e[16]=a):a=e[16];let p;return e[17]!==m||e[18]!==a?(p=g("div",{className:m,"data-testid":"lunora-studio-app",children:a}),e[17]=m,e[18]=a,e[19]=p):p=e[19],p},Ee=b=>{const e=O(27);let d;e[0]!==b?(d=b===void 0?{}:b,e[0]=b,e[1]=d):d=e[1];const{adminToken:o,basePath:n,baseUrl:r,client:t,rulesInstalled:s,studio:i,locale:f}=d;let u;e[2]!==o?(u=()=>o??oe(),e[2]=o,e[3]=u):u=e[3];const[l,v]=B(u);let k,m;e[4]!==l?(k=()=>{ne(l)},m=[l],e[4]=l,e[5]=k,e[6]=m):(k=e[5],m=e[6]),R(k,m);const c=Q(l,300);let h;e:{if(t!==void 0){let I;e[7]!==t?(I=$(t),e[7]=t,e[8]=I):I=e[8],h=I;break e}let _;if(e[9]!==r||e[10]!==c){const I=Z(r),C=c===""?void 0:re({adminToken:c,baseUrl:I}),M=new G({url:I,...C===void 0?{}:{wsToken:C.getToken}});C!==void 0&&(M.setAuthToken(c),M.onTokenExpired(C.invalidate)),_=$(M),e[9]=r,e[10]=c,e[11]=_}else _=e[11];h=_}const a=h;let p,S;e[12]!==a||e[13]!==t?(p=()=>()=>{t===void 0&&a.close()},S=[a,t],e[12]=a,e[13]=t,e[14]=p,e[15]=S):(p=e[14],S=e[15]),R(p,S);let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=_=>{v(_.target.value)},e[16]=x):x=e[16];const A=x;let T;e[17]===Symbol.for("react.memo_cache_sentinel")?(T=()=>{v("")},e[17]=T):T=e[17];const E=T;let y;e[18]!==f?(y=X(f),e[18]=f,e[19]=y):y=e[19];const w=y;let N;return e[20]!==n||e[21]!==a||e[22]!==w||e[23]!==s||e[24]!==i||e[25]!==l?(N=g(Y,{children:l===""?g(ce,{i18n:w,onSubmit:v}):g(fe,{basePath:n,clearToken:E,client:a,i18n:w,onTokenChange:A,rulesInstalled:s,studio:i,token:l})}),e[20]=n,e[21]=a,e[22]=w,e[23]=s,e[24]=i,e[25]=l,e[26]=N):N=e[26],N};export{Ee as StudioApp};
@@ -1 +1 @@
1
- import{useState as g}from"react";import{E as x}from"./error-alert-CKqB2CiN.js";import{C as N,a as y}from"./card-BGlQzQY-.js";import{T as v,a as T,b as d,c as m,d as w,e as l}from"./table-BMsuYFhk.js";import{useT as E}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{c as L}from"./utils-bhneXptQ.js";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-TYdKetJd.js";import{C as N,a as y}from"./card-BGlQzQY-.js";import{T as v,a as T,b as d,c as m,d as w,e as l}from"./table-BMsuYFhk.js";import{useT as E}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{c as L}from"./utils-bhneXptQ.js";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 e="inline-flex items-center gap-1 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",n=`${e} aria-pressed:bg-accent aria-pressed:text-accent-foreground`;export{e as C,n as a};
@@ -1 +1 @@
1
- import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{h as y}from"./internal-7bgd8inO.js";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.js";import{h as y}from"./internal-CwaF9YNk.js";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 +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.js";import{e as j,a as q,b as E}from"./internal-7bgd8inO.js";import{o as H}from"./recording-client-BPY8sYUl.js";import{u as S}from"./operation-console-provider-DoloEvon.js";import{A as T}from"./alert-C2SEhYS9.js";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.js";import{e as j,a as q,b as E}from"./internal-CwaF9YNk.js";import{o as H}from"./recording-client-CKn4-vUx.js";import{u as S}from"./operation-console-provider-DoloEvon.js";import{A as T}from"./alert-C2SEhYS9.js";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};
@@ -0,0 +1,6 @@
1
+ import{c as R}from"react/compiler-runtime";import{useState as M,useEffect as K}from"react";import{ConfirmButton as Q}from"./ConfirmButton-Cj2SOapE.js";import{D as J,a as A,b as D,c as F,d as G,e as I,f as v,g as U}from"./dropdown-menu-U7Tjg1Nb.js";import{M as H}from"./modal-shell-wGW4CKEW.js";import{useT as _}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{h as P,g as W,j as Y,f as z}from"./internal-CwaF9YNk.js";import{C as L}from"./control-button-BOZ5K-FC.js";import{jsx as d,jsxs as $}from"react/jsx-runtime";import{q as B}from"./quote-identifier-CGiYFBvY.js";const X=/["\n,]/u,Z=/^[=+\-@\t\r]/u,V=l=>{if(l==null)return"";let e;return typeof l=="string"?e=Z.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=JSON.stringify(l),X.test(e)?`"${e.replaceAll('"','""')}"`:e},ee=(l,e)=>{const o=l.map(t=>V(t)).join(","),s=e.map(t=>l.map(n=>V(t[n])).join(","));return[o,...s].join(`
2
+ `)},te=l=>JSON.stringify(l,Y,2),q=500,le=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:JSON.stringify(l)).replaceAll("'","''")}'`,oe=(l,e,o)=>{if(e.length===0||o.length===0)return"";const s=e.map(n=>B(n)).join(", "),t=[];for(let n=0;n<o.length;n+=q){const r=o.slice(n,n+q).map(i=>` (${e.map(a=>le(i[a])).join(", ")})`).join(`,
3
+ `);t.push(`INSERT INTO ${B(l)} (${s}) VALUES
4
+ ${r};`)}return t.join(`
5
+
6
+ `)},O=(l,e,o)=>{if(!("document"in globalThis))return;const s=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:o})),t=globalThis.document.createElement("a");t.href=s,t.download=l,globalThis.document.body.append(t),t.click(),t.remove(),globalThis.URL.revokeObjectURL(s)},ne=l=>{const e=R(36),{columns:o,name:s,rows:t}=l,n=_();let r;e[0]!==o||e[1]!==s||e[2]!==t?(r=()=>{O(`${s}.csv`,ee(o,t),"text/csv;charset=utf-8")},e[0]=o,e[1]=s,e[2]=t,e[3]=r):r=e[3];const i=r;let a;e[4]!==s||e[5]!==t?(a=()=>{O(`${s}.json`,te(t),"application/json")},e[4]=s,e[5]=t,e[6]=a):a=e[6];const u=a;let f;e[7]!==o||e[8]!==s||e[9]!==t?(f=()=>{O(`${s}.sql`,oe(s,o,t),"application/sql;charset=utf-8")},e[7]=o,e[8]=s,e[9]=t,e[10]=f):f=e[10];const c=f,C=t.length===0;let p;e[11]!==C?(p=d(J,{className:L,"data-testid":"grid-export",disabled:C,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[11]=C,e[12]=p):p=e[12];let g;e[13]===Symbol.for("react.memo_cache_sentinel")?(g=d(A,{children:"Export loaded rows"}),e[13]=g):g=e[13];let m;e[14]!==n?(m=n("CSV"),e[14]=n,e[15]=m):m=e[15];let y;e[16]!==i||e[17]!==m?(y=d(D,{"data-testid":"grid-export-csv",onClick:i,children:m}),e[16]=i,e[17]=m,e[18]=y):y=e[18];let N;e[19]!==n?(N=n("JSON"),e[19]=n,e[20]=N):N=e[20];let w;e[21]!==u||e[22]!==N?(w=d(D,{"data-testid":"grid-export-json",onClick:u,children:N}),e[21]=u,e[22]=N,e[23]=w):w=e[23];let S;e[24]!==n?(S=n("SQL"),e[24]=n,e[25]=S):S=e[25];let h;e[26]!==c||e[27]!==S?(h=d(D,{"data-testid":"grid-export-sql",onClick:c,children:S}),e[26]=c,e[27]=S,e[28]=h):h=e[28];let b;e[29]!==w||e[30]!==h||e[31]!==y?(b=$(F,{align:"end",children:[g,y,w,h]}),e[29]=w,e[30]=h,e[31]=y,e[32]=b):b=e[32];let x;return e[33]!==b||e[34]!==p?(x=$(G,{children:[p,b]}),e[33]=b,e[34]=p,e[35]=x):x=e[35],x},se=l=>{const e=R(9),{column:o}=l;let s;e[0]!==o?(s=()=>{o.toggleVisibility()},e[0]=o,e[1]=s):s=e[1];const t=s;let n;e[2]!==o?(n=o.getIsVisible(),e[2]=o,e[3]=n):n=e[3];const r=`grid-column-${o.id}`;let i;return e[4]!==o.id||e[5]!==t||e[6]!==n||e[7]!==r?(i=d(v,{checked:n,closeOnClick:!1,"data-testid":r,onCheckedChange:t,children:o.id}),e[4]=o.id,e[5]=t,e[6]=n,e[7]=r,e[8]=i):i=e[8],i},ie=[],re=({backRelations:l=ie,enabledBackRelations:e,onToggleBackRelation:o,table:s})=>{const t=_(),n=s.getIsAllColumnsVisible(),r=()=>{s.toggleAllColumnsVisible(!n)};return $(G,{children:[d(J,{className:L,"data-testid":"grid-columns",children:t("Columns")}),$(F,{align:"end",className:"max-h-80 overflow-y-auto",children:[$(I,{children:[d(A,{children:t("Columns")}),d(v,{checked:n,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:r,children:t(n?"Hide all":"Show all")}),d(U,{}),s.getAllLeafColumns().filter(i=>!i.id.startsWith("__back__:")).map(i=>d(se,{column:i},i.id))]}),l.length>0&&o!==void 0&&$(I,{children:[d(U,{}),d(A,{children:t("Related")}),l.map(i=>{const a=`${i.table}.${i.column}`;return d(v,{checked:e?.has(a)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${a}`,onCheckedChange:()=>{o(a)},children:`← ${i.table}.${i.column}`},a)})]})]})]})},ce=l=>{const e=R(19),{count:o,editable:s,onClear:t,onDelete:n}=l,r=_();let i;e[0]!==o||e[1]!==r?(i=r("{count} selected",{count:o}),e[0]=o,e[1]=r,e[2]=i):i=e[2];let a;e[3]!==i?(a=d("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:i}),e[3]=i,e[4]=a):a=e[4];let u;e[5]!==r?(u=r("Clear"),e[5]=r,e[6]=u):u=e[6];let f;e[7]!==t||e[8]!==u?(f=d("button",{className:L,"data-testid":"grid-selection-clear",onClick:t,type:"button",children:u}),e[7]=t,e[8]=u,e[9]=f):f=e[9];let c;e[10]!==o||e[11]!==s||e[12]!==n||e[13]!==r?(c=s&&d(Q,{confirmLabel:r("Delete {count} rows?",{count:o}),onConfirm:n,testId:"grid-selection-delete",children:r("Delete {count}",{count:o})}),e[10]=o,e[11]=s,e[12]=n,e[13]=r,e[14]=c):c=e[14];let C;return e[15]!==a||e[16]!==f||e[17]!==c?(C=$("div",{className:"flex items-center gap-2 rounded-md border border-border bg-accent/40 px-3 py-1.5 text-xs","data-testid":"grid-selection-bar",children:[a,f,c]}),e[15]=a,e[16]=f,e[17]=c,e[18]=C):C=e[18],C},ae=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,de=l=>{const e=R(9),{bucket:o,objectKey:s,resolveUrl:t}=l,[n,r]=M(null),[i,a]=M(!1);let u,f;e[0]!==o||e[1]!==s||e[2]!==t?(u=()=>{const g={cancelled:!1};return z((async()=>{try{const m=await t(s,o);g.cancelled||r(m)}catch{g.cancelled||a(!0)}})()),()=>{g.cancelled=!0}},f=[o,s,t],e[0]=o,e[1]=s,e[2]=t,e[3]=u,e[4]=f):(u=e[3],f=e[4]),K(u,f);let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{a(!0)},e[5]=c):c=e[5];const C=c;if(n===null||i)return null;let p;return e[6]!==s||e[7]!==n?(p=d("div",{className:"flex max-h-64 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:d("img",{alt:s,className:"max-h-64 object-contain","data-testid":"grid-cell-image",onError:C,src:n})}),e[6]=s,e[7]=n,e[8]=p):p=e[8],p},Ne=l=>{const e=R(37),{bucket:o,column:s,onClose:t,resolveUrl:n,value:r}=l,i=_(),[a,u]=M(!1);let f;e[0]!==r?(f=P(r),e[0]=r,e[1]=f):f=e[1];const c=f;let C;e[2]!==c?(C=()=>{W(c)&&u(!0)},e[2]=c,e[3]=C):C=e[3];const p=C;let g;e[4]!==i?(g=i("Cell value"),e[4]=i,e[5]=g):g=e[5];let m;e[6]!==s?(m=d("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:s}),e[6]=s,e[7]=m):m=e[7];let y;e[8]!==a||e[9]!==i?(y=i(a?"Copied":"Copy"),e[8]=a,e[9]=i,e[10]=y):y=e[10];let N;e[11]!==p||e[12]!==y?(N=d("button",{className:L,"data-testid":"grid-cell-copy",onClick:p,type:"button",children:y}),e[11]=p,e[12]=y,e[13]=N):N=e[13];let w;e[14]!==i?(w=i("Close"),e[14]=i,e[15]=w):w=e[15];let S;e[16]!==t||e[17]!==w?(S=d("button",{className:L,"data-testid":"grid-cell-close",onClick:t,type:"button",children:w}),e[16]=t,e[17]=w,e[18]=S):S=e[18];let h;e[19]!==N||e[20]!==S?(h=$("div",{className:"flex items-center gap-1.5",children:[N,S]}),e[19]=N,e[20]=S,e[21]=h):h=e[21];let b;e[22]!==m||e[23]!==h?(b=$("div",{className:"flex items-center justify-between",children:[m,h]}),e[22]=m,e[23]=h,e[24]=b):b=e[24];let x;e[25]!==o||e[26]!==n||e[27]!==r?(x=n!==void 0&&typeof r=="string"&&ae.test(r)&&d(de,{bucket:o,objectKey:r,resolveUrl:n}),e[25]=o,e[26]=n,e[27]=r,e[28]=x):x=e[28];let k;e[29]!==c?(k=d("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs whitespace-pre-wrap","data-testid":"grid-cell-value",children:c}),e[29]=c,e[30]=k):k=e[30];let T;return e[31]!==t||e[32]!==b||e[33]!==x||e[34]!==k||e[35]!==g?(T=$(H,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:g,onClose:t,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[b,x,k]}),e[31]=t,e[32]=b,e[33]=x,e[34]=k,e[35]=g,e[36]=T):T=e[36],T},Se=l=>{const e=R(36),{backRelations:o,enabledBackRelations:s,onToggleBackRelation:t,columns:n,editable:r,name:i,onBulkDelete:a,onToggleTranspose:u,rows:f,table:c,transposed:C}=l,p=_();let g;e[0]!==c?(g=c.getSelectedRowModel(),e[0]=c,e[1]=g):g=e[1];const m=g.rows;let y;e[2]!==c?(y=()=>{c.resetRowSelection()},e[2]=c,e[3]=y):y=e[3];const N=y;let w;e[4]!==a||e[5]!==m||e[6]!==c?(w=()=>{a(m.map(fe)),c.resetRowSelection()},e[4]=a,e[5]=m,e[6]=c,e[7]=w):w=e[7];const S=w;let h;e[8]!==n||e[9]!==i||e[10]!==f?(h=d(ne,{columns:n,name:i,rows:f}),e[8]=n,e[9]=i,e[10]=f,e[11]=h):h=e[11];let b;e[12]!==o||e[13]!==s||e[14]!==t||e[15]!==c?(b=d(re,{backRelations:o,enabledBackRelations:s,onToggleBackRelation:t,table:c}),e[12]=o,e[13]=s,e[14]=t,e[15]=c,e[16]=b):b=e[16];let x;e[17]!==p?(x=p("Swap rows and columns"),e[17]=p,e[18]=x):x=e[18];let k;e[19]!==p?(k=p("Transpose"),e[19]=p,e[20]=k):k=e[20];let T;e[21]!==u||e[22]!==x||e[23]!==k||e[24]!==C?(T=d("button",{"aria-pressed":C,className:L,"data-testid":"grid-transpose",onClick:u,title:x,type:"button",children:k}),e[21]=u,e[22]=x,e[23]=k,e[24]=C,e[25]=T):T=e[25];let j;e[26]!==r||e[27]!==N||e[28]!==S||e[29]!==m.length?(j=m.length>0&&d(ce,{count:m.length,editable:r,onClear:N,onDelete:S}),e[26]=r,e[27]=N,e[28]=S,e[29]=m.length,e[30]=j):j=e[30];let E;return e[31]!==h||e[32]!==b||e[33]!==T||e[34]!==j?(E=$("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[h,b,T,j]}),e[31]=h,e[32]=b,e[33]=T,e[34]=j,e[35]=E):E=e[35],E};function fe(l){return l.id}export{Ne as C,ne as E,Se as G,ce as S};
@@ -1,3 +1,3 @@
1
- import{c as $}from"react/compiler-runtime";import{useNavigate as Je}from"@tanstack/react-router";import{useState as Ue,useEffect as Ke,Suspense as st,lazy as nt}from"react";import{B as Ye}from"./badge-cAk9Di1Q.js";import{C as B,a as Ze}from"./card-BGlQzQY-.js";import{E as lt}from"./empty-state-B939z6K2.js";import{u as _e}from"./use-admin-query-DV9xmFl8.js";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as Ne}from"./ADMIN_FUNCTIONS-B6z7VLYt.js";import{c as at,f as Se,d as rt,r as ot,g as it,l as ct}from"./internal-7bgd8inO.js";import{c as Xe}from"./utils-bhneXptQ.js";import{deriveInsights as dt}from"./DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js";import{useLunora as et}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ve}from"./button-BOPLD1un.js";const ut=at(Ne.studioFeatures),tt={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},mt=t=>{if(t===null||typeof t!="object")return tt;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")}},ft=()=>{const t=$(3),e=et(),[n,s]=Ue(tt);let a,r;return t[0]!==e?(a=()=>{Se((async()=>{try{s(mt(await e.query(ut,{},rt(""))))}catch{}})())},r=[e],t[0]=e,t[1]=a,t[2]=r):(a=t[1],r=t[2]),Ke(a,r),n},pt=()=>{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},ht=t=>{const e=$(24),{group:n}=t,s=I(),a=Je();let r;e[0]!==n.tab||e[1]!==a?(r=()=>{Se(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=r):r=e[2];const o=r,i=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(pt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(bt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Ze,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==o||e[22]!==g?(x=l(B,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:o,children:g}),e[20]=n.testId,e[21]=o,e[22]=g,e[23]=x):x=e[23],x},We=["kv","files","vectors"],gt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>We.indexOf(n.tab)-We.indexOf(s.tab)),xt=()=>{const t=$(19),e=et(),n=ft(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[r,o]=Ue(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(yt),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(vt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Se((async()=>{try{const y=await b.load();if(!g.cancelled){const S={bindings:y,label:b.label,tab:b.tab,testId:b.testId};o(A=>gt(A,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]=i,t[7]=c):(i=t[6],c=t[7]),Ke(i,c),r.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==r?(f=r.map(Nt),t[12]=r,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function bt(t){return l(Ye,{variant:"secondary",children:t},t)}function yt(t){return t.binding}function vt(t){return t.name}function Nt(t){return l(ht,{group:t},t.tab)}const _t=[{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"}],St=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=_t.map(n=>`- ${n.name} — ${n.summary}`).join(`
1
+ import{c as $}from"react/compiler-runtime";import{useNavigate as Je}from"@tanstack/react-router";import{useState as Ue,useEffect as Ke,Suspense as st,lazy as nt}from"react";import{B as Ye}from"./badge-cAk9Di1Q.js";import{C as B,a as Ze}from"./card-BGlQzQY-.js";import{E as lt}from"./empty-state-B939z6K2.js";import{u as _e}from"./use-admin-query-P0RJrjsD.js";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as Ne}from"./ADMIN_FUNCTIONS-B6z7VLYt.js";import{c as at,f as Se,d as rt,r as ot,g as it,l as ct}from"./internal-CwaF9YNk.js";import{c as Xe}from"./utils-bhneXptQ.js";import{deriveInsights as dt}from"./DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js";import{useLunora as et}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ve}from"./button-BOPLD1un.js";const ut=at(Ne.studioFeatures),tt={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},mt=t=>{if(t===null||typeof t!="object")return tt;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")}},ft=()=>{const t=$(3),e=et(),[n,s]=Ue(tt);let a,r;return t[0]!==e?(a=()=>{Se((async()=>{try{s(mt(await e.query(ut,{},rt(""))))}catch{}})())},r=[e],t[0]=e,t[1]=a,t[2]=r):(a=t[1],r=t[2]),Ke(a,r),n},pt=()=>{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},ht=t=>{const e=$(24),{group:n}=t,s=I(),a=Je();let r;e[0]!==n.tab||e[1]!==a?(r=()=>{Se(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=r):r=e[2];const o=r,i=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(pt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(bt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Ze,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==o||e[22]!==g?(x=l(B,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:o,children:g}),e[20]=n.testId,e[21]=o,e[22]=g,e[23]=x):x=e[23],x},We=["kv","files","vectors"],gt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>We.indexOf(n.tab)-We.indexOf(s.tab)),xt=()=>{const t=$(19),e=et(),n=ft(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[r,o]=Ue(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(yt),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(vt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Se((async()=>{try{const y=await b.load();if(!g.cancelled){const S={bindings:y,label:b.label,tab:b.tab,testId:b.testId};o(A=>gt(A,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]=i,t[7]=c):(i=t[6],c=t[7]),Ke(i,c),r.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==r?(f=r.map(Nt),t[12]=r,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function bt(t){return l(Ye,{variant:"secondary",children:t},t)}function yt(t){return t.binding}function vt(t){return t.name}function Nt(t){return l(ht,{group:t},t.tab)}const _t=[{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"}],St=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=_t.map(n=>`- ${n.name} — ${n.summary}`).join(`
2
2
  `);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
3
3
  `)},Ct=1500,wt=()=>{const t=$(35),e=I();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=ot(),t[0]=n):n=t[0];const s=n,[a,r]=Ue(null);let o,i;t[1]!==a?(o=()=>{if(a===null)return;const L=globalThis.setTimeout(()=>{r(null)},Ct);return()=>{globalThis.clearTimeout(L)}},i=[a],t[1]=a,t[2]=o,t[3]=i):(o=t[2],i=t[3]),Ke(o,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=(L,M)=>{it(M)&&r(L)},t[4]=c):c=t[4];const m=c;let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{m("config",St(s))},t[5]=d):d=t[5];const f=d;let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{m("prompt",kt(s))},t[6]=u):u=t[6];const p=u;let g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=l("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let y;t[13]!==b?(y=l("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=y):y=t[14];let S;t[15]!==x||t[16]!==y?(S=h("div",{className:"flex flex-col gap-1.5 p-4",children:[x,y]}),t[15]=x,t[16]=y,t[17]=S):S=t[17];let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A=l("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=A):A=t[18];let k;t[19]!==a||t[20]!==e?(k=e(a==="config"?"Copied":"Copy MCP config"),t[19]=a,t[20]=e,t[21]=k):k=t[21];let v;t[22]!==k?(v=l(Ve,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:k}),t[22]=k,t[23]=v):v=t[23];let C;t[24]!==a||t[25]!==e?(C=e(a==="prompt"?"Copied":"Copy agent prompt"),t[24]=a,t[25]=e,t[26]=C):C=t[26];let w;t[27]!==C?(w=l(Ve,{"data-testid":"home-connect-agent-copy-prompt",onClick:p,size:"xs",variant:"outline",children:C}),t[27]=C,t[28]=w):w=t[28];let N;t[29]!==v||t[30]!==w?(N=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,h("div",{className:"flex flex-wrap gap-2",children:[v,w]})]}),t[29]=v,t[30]=w,t[31]=N):N=t[31];let _;return t[32]!==S||t[33]!==N?(_=h(B,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[S,N]}),t[32]=S,t[33]=N,t[34]=_):_=t[34],_},$t=nt(()=>import("../packem_chunks/sparkline.js")),qe=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},At=(t,e)=>{const n=Math.max(0,Math.round((e-t)/1e3));if(n<60)return`${String(n)}s ago`;const s=Math.round(n/60);if(s<60)return`${String(s)}m ago`;const a=Math.round(s/60);return a<24?`${String(a)}h ago`:`${String(Math.round(a/24))}d ago`},Qe=(t,e)=>{if(t===void 0||t.length===0)return[];const n=new Map;for(const s of t)n.set(s.bucketMs,(n.get(s.bucketMs)??0)+s[e]);return[...n.entries()].toSorted(([s],[a])=>s-a).map(([,s])=>s)},He=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((o,i)=>o+i,0),a=t.slice(n).reduce((o,i)=>o+i,0);if(s===0)return null;const r=(a-s)/s*100;return{positive:e?r>=0:r<=0,text:`${r>=0?"+":""}${r.toFixed(1)}%`}},Re=t=>{const e=$(24),{delta:n,footer:s,label:a,trend:r,unit:o,value:i}=t,c=I();let m;e[0]!==a?(m=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=m):m=e[1];let d;e[2]!==i?(d=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==o?(f=o!==void 0&&l("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=h("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let p;e[9]!==r?(p=r!==void 0&&l(st,{fallback:l("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:l($t,{data:r})}),e[9]=r,e[10]=p):p=e[10];let g;e[11]!==u||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[u,p]}),e[11]=u,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==m||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[m,g]}),e[14]=m,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n||e[18]!==s||e[19]!==c?(b=n==null?s!=null&&l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s}):h("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[l("span",{className:Xe("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 y;return e[21]!==x||e[22]!==b?(y=h(B,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23],y},Lt=()=>{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},Fe=t=>{const e=$(7),{command:n,label:s}=t;let a;e[0]!==s?(a=l("div",{className:"p-4",children:l("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=a):a=e[1];let r;e[2]!==n?(r=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]=r):r=e[3];let o;return e[4]!==a||e[5]!==r?(o=h(B,{className:"justify-between gap-0 py-0",children:[a,r]}),e[4]=a,e[5]=r,e[6]=o):o=e[6],o},Ge=t=>{const e=$(18),{count:n,onView:s,testId:a,title:r}=t,o=I();let i;e[0]!==r?(i=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=i):i=e[1];let c;e[2]!==n||e[3]!==o?(c=n===null?l("span",{className:"text-xs text-muted-foreground",children:o("No data yet")}):l(Ye,{variant:n>0?"destructive":"success",children:n>0?n:o("All clear")}),e[2]=n,e[3]=o,e[4]=c):c=e[4];let m;e[5]!==i||e[6]!==c?(m=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=m):m=e[7];let d;e[8]!==o?(d=o("View"),e[8]=o,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=l(Lt,{}),e[10]=f):f=e[10];let u;e[11]!==s||e[12]!==d?(u=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:s,type:"button",children:[d,f]}),e[11]=s,e[12]=d,e[13]=u):u=e[13];let p;return e[14]!==m||e[15]!==u||e[16]!==a?(p=h(B,{className:"justify-between gap-0 py-0","data-testid":a,children:[m,u]}),e[14]=m,e[15]=u,e[16]=a,e[17]=p):p=e[17],p},Mt=t=>{const e=$(7),{functions:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const r=[...n].toSorted(Rt).slice(0,5);let o;e[3]!==s?(o=s("Top functions"),e[3]=s,e[4]=o):o=e[4];let i;e[5]!==o?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],a=h(B,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,r.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")})]}),r.map(Et)]})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},It=t=>{const e=$(26),{subs:n}=t,s=I();let a;e[0]!==s?(a=s("Live connections"),e[0]=s,e[1]=a):a=e[1];let r;e[2]!==a?(r=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[2]=a,e[3]=r):r=e[3];const o=n?.totalConnections??0;let i;e[4]!==o?(i=o.toLocaleString(),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==i?(c=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==s?(m=s("sockets"),e[8]=s,e[9]=m):m=e[9];let d;e[10]!==m?(d=l("span",{className:"text-xs text-muted-foreground",children:m}),e[10]=m,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];const u=n?.totalSubscriptions??0;let p;e[15]!==u?(p=u.toLocaleString(),e[15]=u,e[16]=p):p=e[16];let g;e[17]!==s?(g=s("active subscriptions"),e[17]=s,e[18]=g):g=e[18];let x;e[19]!==p||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[p," ",g]}),e[19]=p,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==r||e[24]!==f?(b=l(B,{"data-testid":"home-live-connections",children:h(Ze,{className:"flex flex-col gap-2.5 py-4",children:[r,f,x]})}),e[22]=x,e[23]=r,e[24]=f,e[25]=b):b=e[25],b},Tt=t=>{const e=$(7),{entries:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const r=Date.now();let o;e[3]!==s?(o=s("Recent activity"),e[3]=s,e[4]=o):o=e[4];let i;e[5]!==o?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],a=h(B,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,n.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No recent activity.")}):l("ul",{className:"divide-y divide-border",children:n.slice(0,5).map(c=>h("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[h("span",{className:"flex min-w-0 items-center gap-2",children:[l("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),h("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&h("span",{className:"text-muted-foreground",children:[" · ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),l("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:At(c.ts,r)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Ot=t=>{const e=t.reduce((n,s)=>n+s.calls,0);return e===0?null:t.reduce((n,s)=>n+s.totalDurationMs,0)/e},Zt=t=>{const e=$(151),{initialShardKey:n}=t,s=I(),a=Je(),r=n??"";let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let i;e[1]!==r?(i={shardKey:r},e[1]=r,e[2]=i):i=e[2];const c=_e(Ne.getMetrics,o,i);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m={},e[3]=m):m=e[3];let d;e[4]!==r?(d={shardKey:r},e[4]=r,e[5]=d):d=e[5];const f=_e(Ne.getFunctionStats,m,d);let u,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},p={shardKey:""},e[6]=u,e[7]=p):(u=e[6],p=e[7]);const g=_e(Ne.getSecurityAudit,u,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==r?(b={shardKey:r},e[9]=r,e[10]=b):b=e[10];const y=_e(Ne.listSubscriptions,x,b);let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S={},e[11]=S):S=e[11];let A;e[12]!==r?(A={shardKey:r},e[12]=r,e[13]=A):A=e[13];const k=_e(Ne.getAuditLog,S,A),v=c.data??null;let C,w,N,_,L,M,D,T,O,P,F,q,R,E,U,K,z,V;if(e[14]!==k.data||e[15]!==g.data||e[16]!==v||e[17]!==c.data||e[18]!==a||e[19]!==f.data||e[20]!==y.data||e[21]!==s){_=Array.isArray(f.data?.functions)?f.data.functions:[],D=y.data??null;let $e;e[40]!==k.data?($e=Array.isArray(k.data?.entries)?k.data.entries:[],e[40]=k.data,e[41]=$e):$e=e[41],w=$e,L=c.data===void 0||f.data===void 0?null:dt(v,_).length,M=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ae;e[42]!==a?(Ae=()=>{Se(a({to:"/security"}))},e[42]=a,e[43]=Ae):Ae=e[43],V=Ae;let Le;e[44]!==a?(Le=()=>{Se(a({to:"/insights"}))},e[44]=a,e[45]=Le):Le=e[45],z=Le;const Me=Qe(v?.history,"calls"),Ie=Qe(v?.history,"errors"),ze=Ot(_),Te=Math.max(0,..._.map(jt)),j=v?.cache;let Oe;e[46]!==j?(Oe=j!=null&&j.hits+j.misses>0?Math.round(j.hits/(j.hits+j.misses)*100):null,e[46]=j,e[47]=Oe):Oe=e[47],N=Oe,U="flex flex-col gap-6",K="lunora-home",F="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",q="home-health";const je=He(Me);let xe;e[48]!==s?(xe=s("Requests"),e[48]=s,e[49]=xe):xe=e[49];const Be=v?.requests??0;let be;e[50]!==Be?(be=Be.toLocaleString(),e[50]=Be,e[51]=be):be=e[51],e[52]!==Me||e[53]!==je||e[54]!==xe||e[55]!==be?(R=l(Re,{delta:je,label:xe,trend:Me,value:be}),e[52]=Me,e[53]=je,e[54]=xe,e[55]=be,e[56]=R):R=e[56];const De=He(Ie,!1);let ye;e[57]!==s?(ye=s("Errors"),e[57]=s,e[58]=ye):ye=e[58];const Pe=v?.errors??0;let ve;e[59]!==Pe?(ve=Pe.toLocaleString(),e[59]=Pe,e[60]=ve):ve=e[60],e[61]!==Ie||e[62]!==De||e[63]!==ye||e[64]!==ve?(E=l(Re,{delta:De,label:ye,trend:Ie,value:ve}),e[61]=Ie,e[62]=De,e[63]=ye,e[64]=ve,e[65]=E):E=e[65],C=Re,e[66]!==Te||e[67]!==s?(T=Te>0?`${s("max")} ${qe(Te)}`:void 0,e[66]=Te,e[67]=s,e[68]=T):T=e[68],e[69]!==s?(O=s("Avg latency"),e[69]=s,e[70]=O):O=e[70],P=ze===null?"—":qe(ze),e[14]=k.data,e[15]=g.data,e[16]=v,e[17]=c.data,e[18]=a,e[19]=f.data,e[20]=y.data,e[21]=s,e[22]=C,e[23]=w,e[24]=N,e[25]=_,e[26]=L,e[27]=M,e[28]=D,e[29]=T,e[30]=O,e[31]=P,e[32]=F,e[33]=q,e[34]=R,e[35]=E,e[36]=U,e[37]=K,e[38]=z,e[39]=V}else C=e[22],w=e[23],N=e[24],_=e[25],L=e[26],M=e[27],D=e[28],T=e[29],O=e[30],P=e[31],F=e[32],q=e[33],R=e[34],E=e[35],U=e[36],K=e[37],z=e[38],V=e[39];let W;e[71]!==C||e[72]!==T||e[73]!==O||e[74]!==P?(W=l(C,{footer:T,label:O,value:P}),e[71]=C,e[72]=T,e[73]=O,e[74]=P,e[75]=W):W=e[75];let Q;e[76]!==N||e[77]!==s?(Q=N===null?void 0:`${String(N)}% ${s("cache hit")}`,e[76]=N,e[77]=s,e[78]=Q):Q=e[78];let H;e[79]!==s?(H=s("Database size"),e[79]=s,e[80]=H):H=e[80];const Ee=v?.databaseSize??null;let G;e[81]!==Ee?(G=ct(Ee),e[81]=Ee,e[82]=G):G=e[82];let J;e[83]!==Q||e[84]!==H||e[85]!==G?(J=l(Re,{footer:Q,label:H,value:G}),e[83]=Q,e[84]=H,e[85]=G,e[86]=J):J=e[86];let Y;e[87]!==F||e[88]!==q||e[89]!==R||e[90]!==E||e[91]!==W||e[92]!==J?(Y=h("div",{className:F,"data-testid":q,children:[R,E,W,J]}),e[87]=F,e[88]=q,e[89]=R,e[90]=E,e[91]=W,e[92]=J,e[93]=Y):Y=e[93];let ke;e[94]===Symbol.for("react.memo_cache_sentinel")?(ke=l(xt,{}),e[94]=ke):ke=e[94];let Z;e[95]!==_?(Z=l("div",{className:"lg:col-span-2",children:l(Mt,{functions:_})}),e[95]=_,e[96]=Z):Z=e[96];let X;e[97]!==D?(X=l(It,{subs:D}),e[97]=D,e[98]=X):X=e[98];let ee;e[99]!==w?(ee=l(Tt,{entries:w}),e[99]=w,e[100]=ee):ee=e[100];let te;e[101]!==X||e[102]!==ee?(te=h("div",{className:"flex flex-col gap-3",children:[X,ee]}),e[101]=X,e[102]=ee,e[103]=te):te=e[103];let se;e[104]!==Z||e[105]!==te?(se=h("div",{className:"grid gap-3 lg:grid-cols-3",children:[Z,te]}),e[104]=Z,e[105]=te,e[106]=se):se=e[106];let ne;e[107]!==s?(ne=s("Advisors"),e[107]=s,e[108]=ne):ne=e[108];let le;e[109]!==ne?(le=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ne}),e[109]=ne,e[110]=le):le=e[110];let ae;e[111]!==L||e[112]!==M||e[113]!==s||e[114]!==z||e[115]!==V?(ae=M===0&&L===0?l(lt,{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(Ge,{count:M,onView:V,testId:"home-security",title:s("Security findings")}),l(Ge,{count:L,onView:z,testId:"home-performance",title:s("Performance issues")})]}),e[111]=L,e[112]=M,e[113]=s,e[114]=z,e[115]=V,e[116]=ae):ae=e[116];let re;e[117]!==le||e[118]!==ae?(re=h("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[le,ae]}),e[117]=le,e[118]=ae,e[119]=re):re=e[119];let oe;e[120]!==s?(oe=s("Get connected"),e[120]=s,e[121]=oe):oe=e[121];let ie;e[122]!==oe?(ie=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:oe}),e[122]=oe,e[123]=ie):ie=e[123];let ce;e[124]!==s?(ce=s("Client SDK"),e[124]=s,e[125]=ce):ce=e[125];let de;e[126]!==ce?(de=l(Fe,{command:"npm i @lunora/client",label:ce}),e[126]=ce,e[127]=de):de=e[127];let ue;e[128]!==s?(ue=s("React"),e[128]=s,e[129]=ue):ue=e[129];let me;e[130]!==ue?(me=l(Fe,{command:"npm i @lunora/react",label:ue}),e[130]=ue,e[131]=me):me=e[131];let fe;e[132]!==s?(fe=s("CLI"),e[132]=s,e[133]=fe):fe=e[133];let pe;e[134]!==fe?(pe=l(Fe,{command:"lunora dev",label:fe}),e[134]=fe,e[135]=pe):pe=e[135];let he;e[136]!==de||e[137]!==me||e[138]!==pe?(he=h("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,me,pe]}),e[136]=de,e[137]=me,e[138]=pe,e[139]=he):he=e[139];let Ce;e[140]===Symbol.for("react.memo_cache_sentinel")?(Ce=l(wt,{}),e[140]=Ce):Ce=e[140];let ge;e[141]!==ie||e[142]!==he?(ge=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,Ce]}),e[141]=ie,e[142]=he,e[143]=ge):ge=e[143];let we;return e[144]!==U||e[145]!==K||e[146]!==Y||e[147]!==se||e[148]!==re||e[149]!==ge?(we=h("div",{className:U,"data-testid":K,children:[Y,ke,se,re,ge]}),e[144]=U,e[145]=K,e[146]=Y,e[147]=se,e[148]=re,e[149]=ge,e[150]=we):we=e[150],we};function Rt(t,e){return e.calls-t.calls}function Et(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:qe(t.calls>0?t.totalDurationMs/t.calls:0)}),l("span",{className:Xe("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function jt(t){return t.maxDurationMs}export{Zt as H,ft as u};
@@ -1,2 +1,2 @@
1
1
  const a=(t,n,r,o,i)=>{switch(n){case"action":return t.action(r,o,i);case"mutation":return t.mutation(r,o,i);default:return t.query(r,o,i)}},f=t=>({__lunoraRef:t}),u=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},d=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},g=t=>{if(t===null||typeof t!="object"||!("hint"in t))return;const{hint:n}=t;return typeof n=="string"?n:Array.isArray(n)?n.filter(r=>typeof r=="string").join(`
2
- `):void 0},y=t=>{if(t===null||typeof t!="object"||!("docsUrl"in t))return;const n=t.docsUrl;if(typeof n=="string")try{const{protocol:r}=new URL(n);return r==="http:"||r==="https:"?n:void 0}catch{return}},s=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,o=0;for(;r>=1024&&o<n.length-1;)r/=1024,o+=1;return`${r.toFixed(1)} ${n[o]??"TB"}`},e=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: ${s(t.byteLength)}>`:JSON.stringify(t)}},h=(t,n)=>typeof n=="bigint"||n instanceof ArrayBuffer||ArrayBuffer.isView(n)?e(n):n,c=(t,n)=>{t.catch(r=>{})},p=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=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},b=t=>`"${t.replaceAll('"','""')}"`,B=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{y as a,d as b,f as c,u as d,g as e,c as f,m as g,e as h,B as i,h as j,a as k,s as l,l as m,p as r,b as s};
2
+ `):void 0},y=t=>{if(t===null||typeof t!="object"||!("docsUrl"in t))return;const n=t.docsUrl;if(typeof n=="string")try{const{protocol:r}=new URL(n);return r==="http:"||r==="https:"?n:void 0}catch{return}},s=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,o=0;for(;r>=1024&&o<n.length-1;)r/=1024,o+=1;return`${r.toFixed(1)} ${n[o]??"TB"}`},e=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: ${s(t.byteLength)}>`:JSON.stringify(t)}},h=(t,n)=>typeof n=="bigint"||n instanceof ArrayBuffer||ArrayBuffer.isView(n)?e(n):n,c=(t,n)=>{t.catch(r=>{})},m=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},p=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},b=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{y as a,d as b,f as c,u as d,g as e,c as f,p as g,e as h,b as i,h as j,a as k,s as l,l as m,m as r};
@@ -1 +1 @@
1
- import{c as h}from"react/compiler-runtime";import{f as v}from"./log-fields-SBxKyBug.js";import{B as x}from"./badge-cAk9Di1Q.js";import{i as L}from"./internal-7bgd8inO.js";import{jsx as o,jsxs as g,Fragment as N}from"react/jsx-runtime";const w={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},B=p=>{const e=h(21),{entry:t}=p;let m;e[0]!==t.fields?(m=v(t.fields),e[0]=t.fields,e[1]=m):m=e[1];const c=m;let l;e[2]!==t.timestamp?(l=L(t.timestamp),e[2]=t.timestamp,e[3]=l):l=e[3];let s;e[4]!==l?(s=o("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:l}),e[4]=l,e[5]=s):s=e[5];const f=w[t.level];let r;e[6]!==t.level||e[7]!==f?(r=o("span",{className:"w-20 shrink-0",role:"gridcell",children:o(x,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=r):r=e[8];const u=t.functionPath??"—";let i;e[9]!==u?(i=o("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[9]=u,e[10]=i):i=e[10];let a;e[11]!==c?(a=c===""?null:o("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c}),e[11]=c,e[12]=a):a=e[12];let n;e[13]!==t.message||e[14]!==a?(n=g("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,a]}),e[13]=t.message,e[14]=a,e[15]=n):n=e[15];let d;return e[16]!==s||e[17]!==r||e[18]!==i||e[19]!==n?(d=g(N,{children:[s,r,i,n]}),e[16]=s,e[17]=r,e[18]=i,e[19]=n,e[20]=d):d=e[20],d};export{B as L,w as a};
1
+ import{c as h}from"react/compiler-runtime";import{f as v}from"./log-fields-SBxKyBug.js";import{B as x}from"./badge-cAk9Di1Q.js";import{i as L}from"./internal-CwaF9YNk.js";import{jsx as o,jsxs as g,Fragment as N}from"react/jsx-runtime";const w={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},B=p=>{const e=h(21),{entry:t}=p;let m;e[0]!==t.fields?(m=v(t.fields),e[0]=t.fields,e[1]=m):m=e[1];const c=m;let l;e[2]!==t.timestamp?(l=L(t.timestamp),e[2]=t.timestamp,e[3]=l):l=e[3];let s;e[4]!==l?(s=o("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:l}),e[4]=l,e[5]=s):s=e[5];const f=w[t.level];let r;e[6]!==t.level||e[7]!==f?(r=o("span",{className:"w-20 shrink-0",role:"gridcell",children:o(x,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=r):r=e[8];const u=t.functionPath??"—";let i;e[9]!==u?(i=o("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[9]=u,e[10]=i):i=e[10];let a;e[11]!==c?(a=c===""?null:o("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c}),e[11]=c,e[12]=a):a=e[12];let n;e[13]!==t.message||e[14]!==a?(n=g("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,a]}),e[13]=t.message,e[14]=a,e[15]=n):n=e[15];let d;return e[16]!==s||e[17]!==r||e[18]!==i||e[19]!==n?(d=g(N,{children:[s,r,i,n]}),e[16]=s,e[17]=r,e[18]=i,e[19]=n,e[20]=d):d=e[20],d};export{B as L,w as a};
@@ -0,0 +1 @@
1
+ const t=e=>`"${e.replaceAll('"','""')}"`;export{t as q};
@@ -1 +1 @@
1
- import{o as u}from"./use-admin-query-DV9xmFl8.js";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-P0RJrjsD.js";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};