@lunora/studio 1.0.0-alpha.141 → 1.0.0-alpha.142

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 (134) hide show
  1. package/dist/index.d.mts +2 -1
  2. package/dist/index.d.ts +2 -1
  3. package/dist/index.mjs +1 -1
  4. package/dist/mount.mjs +1 -1
  5. package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
  6. package/dist/packem_chunks/ApiTab.mjs +1 -1
  7. package/dist/packem_chunks/AuditPanel.mjs +1 -1
  8. package/dist/packem_chunks/ExportImportPanel.mjs +1 -1
  9. package/dist/packem_chunks/FileBrowser.mjs +1 -1
  10. package/dist/packem_chunks/FunctionRunner.mjs +1 -1
  11. package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
  12. package/dist/packem_chunks/HealthPanel.mjs +1 -1
  13. package/dist/packem_chunks/InsightsPanel.mjs +1 -1
  14. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  15. package/dist/packem_chunks/MailPanel.mjs +1 -1
  16. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  17. package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
  18. package/dist/packem_chunks/PitrPanel.mjs +1 -1
  19. package/dist/packem_chunks/SchemaViewer.mjs +1 -1
  20. package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
  21. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  22. package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
  23. package/dist/packem_chunks/TableEditor.mjs +1 -1
  24. package/dist/packem_chunks/agents-panel.mjs +1 -1
  25. package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
  26. package/dist/packem_chunks/auth-config-panel.mjs +1 -1
  27. package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
  28. package/dist/packem_chunks/containers-panel.mjs +1 -1
  29. package/dist/packem_chunks/dashboards-panel.mjs +1 -1
  30. package/dist/packem_chunks/evals-panel.mjs +1 -1
  31. package/dist/packem_chunks/fanout-panel.mjs +1 -1
  32. package/dist/packem_chunks/flags-panel.mjs +1 -1
  33. package/dist/packem_chunks/issues-panel.mjs +1 -1
  34. package/dist/packem_chunks/kv-browser.mjs +1 -1
  35. package/dist/packem_chunks/migrations-route.mjs +1 -1
  36. package/dist/packem_chunks/organizations-panel.mjs +1 -1
  37. package/dist/packem_chunks/payments-panel.mjs +1 -1
  38. package/dist/packem_chunks/permissions-panel.mjs +1 -1
  39. package/dist/packem_chunks/queues-panel.mjs +1 -1
  40. package/dist/packem_chunks/reactors-panel.mjs +1 -1
  41. package/dist/packem_chunks/rls-panel.mjs +1 -1
  42. package/dist/packem_chunks/schedule-panel.mjs +1 -1
  43. package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
  44. package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
  45. package/dist/packem_chunks/sync-client-panel.mjs +1 -1
  46. package/dist/packem_chunks/traces-panel.mjs +1 -1
  47. package/dist/packem_chunks/users-panel.mjs +1 -1
  48. package/dist/packem_chunks/workflows-panel.mjs +1 -1
  49. package/dist/packem_shared/{ADMIN_FUNCTIONS-B6z7VLYt.mjs → ADMIN_FUNCTIONS-B8yyk5BX.mjs} +1 -1
  50. package/dist/packem_shared/{ApiDocsPanel-BOxViKDM.mjs → ApiDocsPanel-l4DQX1Vq.mjs} +1 -1
  51. package/dist/packem_shared/DataBrowser-C2B-HNOL.mjs +4 -0
  52. package/dist/packem_shared/{GlobalDataBrowser-BKm77TNC.mjs → GlobalDataBrowser-DK4fgb7h.mjs} +1 -1
  53. package/dist/packem_shared/{HomePanel-YG8qu2Nb.mjs → HomePanel-B869m6wb.mjs} +1 -1
  54. package/dist/packem_shared/{MigrationsPanel-CYe0ygT8.mjs → MigrationsPanel-BZJ_Rv4t.mjs} +1 -1
  55. package/dist/packem_shared/{ScheduledJobs-DN0yQoo6.mjs → ScheduledJobs-oDVEymk5.mjs} +1 -1
  56. package/dist/packem_shared/{Studio-D8OZ5P-V.mjs → Studio-5eRSjGmd.mjs} +1 -1
  57. package/dist/packem_shared/{StudioApp-VZ3I91QA.mjs → StudioApp-Bkym2DjT.mjs} +1 -1
  58. package/dist/packem_shared/{advisor-view-5mZH6453.mjs → advisor-view-DoSv436g.mjs} +1 -1
  59. package/dist/packem_shared/{error-alert-CczbAfst.mjs → error-alert-CWs6gA3I.mjs} +1 -1
  60. package/dist/packem_shared/{home-panel-BID7w6j3.mjs → home-panel-ChKczU0I.mjs} +1 -1
  61. package/dist/packem_shared/{recording-client-BEZ6tVgo.mjs → recording-client-BGyq5_JP.mjs} +1 -1
  62. package/dist/packem_shared/{studio-ByaR_3g9.mjs → studio-4odoxrh9.mjs} +1 -1
  63. package/dist/packem_shared/{table-list-sidebar-BxZm3sBJ.mjs → table-list-sidebar-T7--Fv-V.mjs} +1 -1
  64. package/dist/packem_shared/use-admin-query-C7JRlFIE.mjs +1 -0
  65. package/dist/packem_shared/{use-auth-config-gxJL0E1r.mjs → use-auth-config-o-FcIXzR.mjs} +1 -1
  66. package/dist/packem_shared/{use-sql-assistant-CFRzdA9E.mjs → use-sql-assistant-Ib7Ik6cw.mjs} +1 -1
  67. package/dist/packem_shared/wire-codec-DGcjNTbZ.mjs +1 -0
  68. package/dist/standalone/chunk-2O5QDSR2.js +1 -0
  69. package/dist/standalone/{chunk-FNGY5SUZ.js → chunk-37VWQZEF.js} +1 -1
  70. package/dist/standalone/{chunk-BX3F7MXP.js → chunk-3MNTCYQ3.js} +1 -1
  71. package/dist/standalone/{chunk-O2FV34ZD.js → chunk-45T7VWRY.js} +1 -1
  72. package/dist/standalone/{chunk-M6MCQSPI.js → chunk-4TKQNBNV.js} +1 -1
  73. package/dist/standalone/{chunk-CXNZVJ3S.js → chunk-4ZEL6BYL.js} +1 -1
  74. package/dist/standalone/{chunk-3PKWDMXA.js → chunk-6H36JL4I.js} +1 -1
  75. package/dist/standalone/{chunk-USC5APTS.js → chunk-7DNDONOI.js} +1 -1
  76. package/dist/standalone/{chunk-MIVYBFY3.js → chunk-7GHBT32T.js} +1 -1
  77. package/dist/standalone/{chunk-LC3XGRNU.js → chunk-7ZWZNTKG.js} +1 -1
  78. package/dist/standalone/{chunk-TRL7AHZK.js → chunk-A4MLWW6Q.js} +1 -1
  79. package/dist/standalone/{chunk-UKL4FSKP.js → chunk-AR46S3PP.js} +1 -1
  80. package/dist/standalone/{chunk-3ZKYTFKY.js → chunk-ATO3Y6BD.js} +1 -1
  81. package/dist/standalone/{chunk-EIKBBMM4.js → chunk-AZOLR4BN.js} +1 -1
  82. package/dist/standalone/{chunk-2AFIMJPZ.js → chunk-BAIGKYAI.js} +1 -1
  83. package/dist/standalone/{chunk-V36AL47B.js → chunk-BDZFZT2N.js} +1 -1
  84. package/dist/standalone/{chunk-MRJNT4OH.js → chunk-BMAP2J7X.js} +1 -1
  85. package/dist/standalone/{chunk-YFLOZILV.js → chunk-BNGOZSCT.js} +1 -1
  86. package/dist/standalone/{chunk-TZI3JW3Q.js → chunk-BP7MDQY5.js} +1 -1
  87. package/dist/standalone/{chunk-PAUQAU23.js → chunk-BYWVVRKM.js} +1 -1
  88. package/dist/standalone/{chunk-Q3HF6P2M.js → chunk-DRFQ3BUM.js} +1 -1
  89. package/dist/standalone/{chunk-7QMV55PO.js → chunk-F2R2UX27.js} +1 -1
  90. package/dist/standalone/{chunk-C5L4BSYY.js → chunk-GCYNOU4C.js} +1 -1
  91. package/dist/standalone/{chunk-KEZZGUYY.js → chunk-HCO5STOE.js} +1 -1
  92. package/dist/standalone/{chunk-ZOWSTFP5.js → chunk-HJOKETMZ.js} +1 -1
  93. package/dist/standalone/{chunk-2DO5EQCU.js → chunk-HS7MSYK7.js} +1 -1
  94. package/dist/standalone/{chunk-EG6XHY7N.js → chunk-HWBXHONF.js} +1 -1
  95. package/dist/standalone/{chunk-NE7AR3N3.js → chunk-HZX6KSC2.js} +1 -1
  96. package/dist/standalone/{chunk-KDWJAKFX.js → chunk-I27WXF7C.js} +1 -1
  97. package/dist/standalone/{chunk-2QSOSRNW.js → chunk-IGBQ2CPW.js} +1 -1
  98. package/dist/standalone/{chunk-LJC5BM3X.js → chunk-IMUTQDOB.js} +1 -1
  99. package/dist/standalone/{chunk-5PCGB55O.js → chunk-IXLH5YBD.js} +1 -1
  100. package/dist/standalone/{chunk-UWDFH35E.js → chunk-IXMHWLSN.js} +1 -1
  101. package/dist/standalone/{chunk-Z5APSEW7.js → chunk-JXELPXLG.js} +1 -1
  102. package/dist/standalone/{chunk-ERWZGAOA.js → chunk-KBSJO66O.js} +1 -1
  103. package/dist/standalone/chunk-L6KA7M4B.js +1 -0
  104. package/dist/standalone/{chunk-HODZXHVK.js → chunk-LELCKAUP.js} +1 -1
  105. package/dist/standalone/{chunk-JYMXJUJ2.js → chunk-LPFRXMG7.js} +1 -1
  106. package/dist/standalone/{chunk-EILTQDXX.js → chunk-NPHUYLGW.js} +1 -1
  107. package/dist/standalone/{chunk-RK3WWWTT.js → chunk-NZMUY7ZG.js} +1 -1
  108. package/dist/standalone/{chunk-ZE2Q22OK.js → chunk-O32757IN.js} +1 -1
  109. package/dist/standalone/{chunk-JHEUUNXM.js → chunk-PCOD3V5E.js} +1 -1
  110. package/dist/standalone/{chunk-UBVWMMQG.js → chunk-PNFIPQJO.js} +1 -1
  111. package/dist/standalone/{chunk-56AFJWER.js → chunk-PV2LCZ6D.js} +1 -1
  112. package/dist/standalone/chunk-QEN7S6YK.js +7 -0
  113. package/dist/standalone/{chunk-DQHYNFE4.js → chunk-QM3SGSVK.js} +1 -1
  114. package/dist/standalone/{chunk-VPPKG2IW.js → chunk-S4HBMTJ3.js} +1 -1
  115. package/dist/standalone/{chunk-S63ID2FC.js → chunk-SPP7FEDA.js} +1 -1
  116. package/dist/standalone/{chunk-WR675JUF.js → chunk-V5ITAZCZ.js} +1 -1
  117. package/dist/standalone/{chunk-JAZCU2PP.js → chunk-W7E5WYFI.js} +1 -1
  118. package/dist/standalone/{chunk-OOESPRIZ.js → chunk-WHWI6KXH.js} +1 -1
  119. package/dist/standalone/{chunk-43Y54D7O.js → chunk-WIFKQ25E.js} +1 -1
  120. package/dist/standalone/{chunk-G63MGXPG.js → chunk-WZYKLEU5.js} +1 -1
  121. package/dist/standalone/chunk-XDT5DXOI.js +11 -0
  122. package/dist/standalone/{chunk-ZB74UWVA.js → chunk-XUKH3NTP.js} +1 -1
  123. package/dist/standalone/{chunk-N6KHKQJH.js → chunk-YKUEP7AA.js} +1 -1
  124. package/dist/standalone/{chunk-QSOJFV42.js → chunk-YRNEKBFM.js} +1 -1
  125. package/dist/standalone/{chunk-YFPU55K4.js → chunk-ZNPR3SGG.js} +1 -1
  126. package/dist/standalone/studio.js +1 -1
  127. package/package.json +6 -6
  128. package/dist/packem_shared/DataBrowser-rqpuEiuQ.mjs +0 -4
  129. package/dist/packem_shared/use-admin-query-Cbj2GuHu.mjs +0 -1
  130. package/dist/packem_shared/wire-codec-Dl3VeNrd.mjs +0 -1
  131. package/dist/standalone/chunk-ECQTVV2J.js +0 -1
  132. package/dist/standalone/chunk-JBIN7W2B.js +0 -11
  133. package/dist/standalone/chunk-JJA7KHJK.js +0 -1
  134. package/dist/standalone/chunk-MVKXAIW3.js +0 -7
@@ -0,0 +1,4 @@
1
+ import{c as B}from"react/compiler-runtime";import{useLunora as ct}from"@lunora/react";import{useState as D,useEffect as Be,useMemo as Tt,useRef as Je,useCallback as at}from"react";import{ShardInput as $n}from"./ShardInput-C6mjgAh4.mjs";import{u as Xe}from"./use-admin-query-C7JRlFIE.mjs";import{ADMIN_FUNCTIONS as pe}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{b as Wt}from"./browser-storage-BH1MxLZs.mjs";import{f as Ce,h as ze,j as Dn,c as Te,d as ke,i as In}from"./internal-CwaF9YNk.mjs";import{m as An,c as Ht,d as vt,G as Pn,a as Mn,u as wt,b as On,T as Fn,D as Ln}from"./table-list-sidebar-T7--Fv-V.mjs";import{u as Vn}from"./use-sql-assistant-Ib7Ik6cw.mjs";import{a as Ut,e as Qt,i as Bn,d as zn}from"./wire-codec-DGcjNTbZ.mjs";import{B as yt}from"./button-q0UYSmrn.mjs";import{I as jn}from"./input-CXhxesPC.mjs";import{L as Pt}from"./label-DKFzyHq6.mjs";import{M as dt}from"./modal-shell-CDztwLnv.mjs";import{useT as he}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{jsx as d,jsxs as E,Fragment as Ze}from"react/jsx-runtime";import{ConfirmButton as Mt}from"./ConfirmButton-DU4p72Er.mjs";import{E as qn}from"./empty-state-D7jEML_T.mjs";import{C as Et,a as De}from"./control-button-BOZ5K-FC.mjs";import{useReactTable as Gn,getSortedRowModel as Kn,getCoreRowModel as Jn,flexRender as Wn}from"@tanstack/react-table";import{useVirtualizer as Hn}from"@tanstack/react-virtual";import{C as Rt}from"./checkbox-CnS9cyCz.mjs";import{c as it}from"./utils-bhneXptQ.mjs";import{f as Un}from"./virtual-rect-D_j7aLxX.mjs";import{C as Ct,G as Qn,T as Yn}from"./data-grid-BqNXJ9PF.mjs";import{DataFilters as Xn,toFilterClauses as Ve}from"./DataFilters-3nbW0uax.mjs";import{G as Zn,C as eo}from"./grid-features-D8w5isjt.mjs";import Ot from"./useDebounced-DVeQ5-oW.mjs";import{r as to,l as no}from"./shard-history-CaO3C4KQ.mjs";const oo=s=>({tables:Object.entries(s).map(([e,n])=>({fields:n.map(o=>o.name),indexes:[],name:e,relations:n.filter(o=>o.ref!==void 0).map(o=>({field:o.name,kind:"one",name:o.name,references:o.ref,table:e}))}))}),so=s=>{const e=new Map,n=new Set;for(const o of s.tables)for(const t of o.relations){if(t.kind!=="one"||t.onDelete==="set null")continue;const i=t.references,l=`${i}\0${o.name}\0${t.field}`;if(n.has(l))continue;n.add(l);const r=e.get(i)??[];r.push({...t,table:o.name}),e.set(i,r)}return e},lo=(s,e)=>{const n=[],o=[s];for(;o.length>0;){const t=o.shift();if(t===void 0)break;e(t)&&n.push(t);for(const i of t.children)o.push(i)}return n},Ft=(s,e)=>{const n=[];for(const[o,t]of Object.entries(e))for(const i of t)i.ref===s&&n.push({column:i.name,table:o});return n.sort((o,t)=>o.table.localeCompare(t.table)||o.column.localeCompare(t.column)),n},$t=s=>`${s.table}.${s.column}`,ro=s=>{const e=B(111),{columns:n,onApply:o,onClose:t,shardKey:i,table:l,total:r,uniqueColumns:c}=s,a=he(),[f,m]=D(n[0]??""),[p,b]=D("");let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=X=>{m(X.target.value)},e[0]=u):u=e[0];const g=u;let h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=X=>{b(X.target.value)},e[1]=h):h=e[1];const w=h;let v;e[2]!==p?(v=p.trim(),e[2]=p,e[3]=v):v=e[3];const y=v==="";let x,T;if(e[4]!==y||e[5]!==a||e[6]!==p){if(!y)try{T=Ut(JSON.parse(p))}catch(X){x=a("Invalid JSON: {message}",{message:X.message})}e[4]=y,e[5]=a,e[6]=p,e[7]=x,e[8]=T}else x=e[7],T=e[8];let N;e[9]!==f||e[10]!==r||e[11]!==c?(N=c.has(f)&&r>1,e[9]=f,e[10]=r,e[11]=c,e[12]=N):N=e[12];const S=N,C=f!==""&&!y&&x===void 0&&!S;let k;e[13]!==C||e[14]!==f||e[15]!==o||e[16]!==t||e[17]!==T?(k=()=>{C&&(o({[f]:T}),t())},e[13]=C,e[14]=f,e[15]=o,e[16]=t,e[17]=T,e[18]=k):k=e[18];const M=k;let R;e[19]!==a?(R=a("Set a column on matching rows"),e[19]=a,e[20]=R):R=e[20];let _;e[21]!==a?(_=a("Set a column on matching rows"),e[21]=a,e[22]=_):_=e[22];let $;e[23]!==_?($=d("h3",{className:"text-base text-foreground","data-testid":"bulk-patch-title",children:_}),e[23]=_,e[24]=$):$=e[24];let I;e[25]!==a||e[26]!==l||e[27]!==r?(I=a("Writes {total} rows of {table} through the schema-aware writer — validators and indexes apply, exactly like a mutation.",{table:l,total:r.toString()}),e[25]=a,e[26]=l,e[27]=r,e[28]=I):I=e[28];let F;e[29]!==I?(F=d("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-desc",children:I}),e[29]=I,e[30]=F):F=e[30];let P;e[31]!==i||e[32]!==a?(P=i===""?a("Shard: root"):a("Shard: {shardKey} — rows in other shards are not touched.",{shardKey:i}),e[31]=i,e[32]=a,e[33]=P):P=e[33];let z;e[34]!==P?(z=d("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-shard",children:P}),e[34]=P,e[35]=z):z=e[35];let j;e[36]!==F||e[37]!==z||e[38]!==$?(j=E("div",{className:"flex flex-col gap-0.5",children:[$,F,z]}),e[36]=F,e[37]=z,e[38]=$,e[39]=j):j=e[39];let O;e[40]!==a?(O=a("Close"),e[40]=a,e[41]=O):O=e[41];let V;e[42]!==t||e[43]!==O?(V=d(yt,{"data-testid":"bulk-patch-close",onClick:t,size:"xs",variant:"ghost",children:O}),e[42]=t,e[43]=O,e[44]=V):V=e[44];let J;e[45]!==j||e[46]!==V?(J=E("div",{className:"flex items-start justify-between",children:[j,V]}),e[45]=j,e[46]=V,e[47]=J):J=e[47];let q;e[48]!==a?(q=a("Column"),e[48]=a,e[49]=q):q=e[49];let Y;e[50]!==q?(Y=d(Pt,{htmlFor:"bulk-patch-column",children:q}),e[50]=q,e[51]=Y):Y=e[51];let Z;e[52]!==a?(Z=a("Column"),e[52]=a,e[53]=Z):Z=e[53];let se;e[54]!==n?(se=n.map(ao),e[54]=n,e[55]=se):se=e[55];let fe;e[56]!==f||e[57]!==Z||e[58]!==se?(fe=d("select",{"aria-label":Z,className:"h-8 rounded-md border border-input bg-transparent px-2 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"bulk-patch-column",id:"bulk-patch-column",onChange:g,value:f,children:se}),e[56]=f,e[57]=Z,e[58]=se,e[59]=fe):fe=e[59];let te;e[60]!==a?(te=a("Value"),e[60]=a,e[61]=te):te=e[61];let ce;e[62]!==te?(ce=d(Pt,{htmlFor:"bulk-patch-value",children:te}),e[62]=te,e[63]=ce):ce=e[63];let de;e[64]!==p?(de=d(jn,{className:"flex-1 font-mono","data-testid":"bulk-patch-value",id:"bulk-patch-value",onChange:w,placeholder:"true",value:p}),e[64]=p,e[65]=de):de=e[65];let me;e[66]!==Y||e[67]!==fe||e[68]!==ce||e[69]!==de?(me=E("div",{className:"flex items-center gap-2",children:[Y,fe,ce,de]}),e[66]=Y,e[67]=fe,e[68]=ce,e[69]=de,e[70]=me):me=e[70];let le;e[71]!==x?(le=x!==void 0&&d("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-error",role:"alert",children:x}),e[71]=x,e[72]=le):le=e[72];let ue;e[73]!==f||e[74]!==a||e[75]!==r||e[76]!==S?(ue=S&&d("p",{className:"text-xs text-destructive","data-testid":"bulk-patch-unique",role:"alert",children:a("{column} has a unique index — the same value cannot be set on {total} rows.",{column:f,total:r.toString()})}),e[73]=f,e[74]=a,e[75]=r,e[76]=S,e[77]=ue):ue=e[77];let re;e[78]!==y||e[79]!==a||e[80]!==S?(re=y&&!S&&d("p",{className:"text-xs text-muted-foreground","data-testid":"bulk-patch-hint",children:a('Enter a JSON value — for example true, 0, null, or "done".')}),e[78]=y,e[79]=a,e[80]=S,e[81]=re):re=e[81];let Q;e[82]!==C||e[83]!==f||e[84]!==p?(Q=C&&d("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"bulk-patch-preview",children:`${f} = ${p.trim()}`}),e[82]=C,e[83]=f,e[84]=p,e[85]=Q):Q=e[85];let be;e[86]!==a?(be=a("Cancel"),e[86]=a,e[87]=be):be=e[87];let ee;e[88]!==t||e[89]!==be?(ee=d(yt,{"data-testid":"bulk-patch-cancel",onClick:t,size:"xs",variant:"outline",children:be}),e[88]=t,e[89]=be,e[90]=ee):ee=e[90];const xe=!C;let ae;e[91]!==a||e[92]!==r?(ae=a("Set on {total} rows",{total:r.toString()}),e[91]=a,e[92]=r,e[93]=ae):ae=e[93];let ie;e[94]!==M||e[95]!==xe||e[96]!==ae?(ie=d(yt,{"data-testid":"bulk-patch-apply",disabled:xe,onClick:M,size:"xs",children:ae}),e[94]=M,e[95]=xe,e[96]=ae,e[97]=ie):ie=e[97];let U;e[98]!==ee||e[99]!==ie?(U=E("div",{className:"flex justify-end gap-2",children:[ee,ie]}),e[98]=ee,e[99]=ie,e[100]=U):U=e[100];let K;return e[101]!==t||e[102]!==J||e[103]!==me||e[104]!==le||e[105]!==ue||e[106]!==re||e[107]!==Q||e[108]!==U||e[109]!==R?(K=E(dt,{label:R,onClose:t,panelTestId:"bulk-patch-panel",testId:"bulk-patch-overlay",variant:"dialog",children:[J,me,le,ue,re,Q,U]}),e[101]=t,e[102]=J,e[103]=me,e[104]=le,e[105]=ue,e[106]=re,e[107]=Q,e[108]=U,e[109]=R,e[110]=K):K=e[110],K};function ao(s){return d("option",{value:s,children:s},s)}const Lt=6,lt=100,io=s=>({paddingLeft:s*16}),co=s=>{const e=B(2),{table:n}=s,o=`cascade-restrict-${n}`;let t;return e[0]!==o?(t=d("span",{className:"rounded bg-destructive/10 px-1 text-destructive","data-testid":o,children:"restrict — will block delete"}),e[0]=o,e[1]=t):t=e[1],t},uo=s=>{const e=B(2),{table:n}=s,o=`cascade-cascade-${n}`;let t;return e[0]!==o?(t=d("span",{className:"rounded bg-warning/10 px-1 text-warning","data-testid":o,children:"cascade"}),e[0]=o,e[1]=t):t=e[1],t},fo=s=>{const e=B(2),{table:n}=s,o=`cascade-undeclared-${n}`;let t;return e[0]!==o?(t=d("span",{className:"rounded bg-muted px-1 text-muted-foreground","data-testid":o,children:"references — no delete action declared"}),e[0]=o,e[1]=t):t=e[1],t},mo=s=>s.relation===void 0||s.relation.onDelete==="cascade"?d(uo,{table:s.table}):s.isRestrict?d(co,{table:s.table}):d(fo,{table:s.table}),Yt=s=>{const e=B(35),{depth:n,node:o}=s,t=`cascade-row-${o.table}`;let i;e[0]!==n?(i=io(n),e[0]=n,e[1]=i):i=e[1];let l;e[2]!==n?(l=n>0&&d("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"└"}),e[2]=n,e[3]=l):l=e[3];let r;e[4]!==o.table?(r=d("span",{className:"font-medium text-foreground",children:o.table}),e[4]=o.table,e[5]=r):r=e[5];let c;e[6]!==o.relation||e[7]!==o.table?(c=o.relation!==void 0&&E("span",{className:"text-muted-foreground","data-testid":`cascade-col-${o.table}-${o.relation.field}`,children:["via ",o.relation.field]}),e[6]=o.relation,e[7]=o.table,e[8]=c):c=e[8];let a;e[9]!==o.rowCount?(a=o.rowCount.toString(),e[9]=o.rowCount,e[10]=a):a=e[10];let f;e[11]!==a?(f=E("span",{className:"text-muted-foreground",children:["(",a," rows)"]}),e[11]=a,e[12]=f):f=e[12];let m;e[13]!==o?(m=mo(o),e[13]=o,e[14]=m):m=e[14];let p;e[15]!==o.capNote||e[16]!==o.table?(p=o.capNote!==void 0&&E("span",{className:"italic text-muted-foreground","data-testid":`cascade-cap-${o.table}`,children:["(",o.capNote,")"]}),e[15]=o.capNote,e[16]=o.table,e[17]=p):p=e[17];let b;e[18]!==t||e[19]!==i||e[20]!==l||e[21]!==r||e[22]!==c||e[23]!==f||e[24]!==m||e[25]!==p?(b=E("li",{className:"flex flex-wrap items-center gap-1.5 py-1 font-mono text-xs","data-testid":t,style:i,children:[l,r,c,f,m,p]}),e[18]=t,e[19]=i,e[20]=l,e[21]=r,e[22]=c,e[23]=f,e[24]=m,e[25]=p,e[26]=b):b=e[26];let u;if(e[27]!==n||e[28]!==o.children){let h;e[30]!==n?(h=(w,v)=>d(Yt,{depth:n+1,node:w},`${w.table}-${w.relation?.field??"root"}-${v.toString()}`),e[30]=n,e[31]=h):h=e[31],u=o.children.map(h),e[27]=n,e[28]=o.children,e[29]=u}else u=e[29];let g;return e[32]!==b||e[33]!==u?(g=E(Ze,{children:[b,u]}),e[32]=b,e[33]=u,e[34]=g):g=e[34],g},go=s=>{const e=s._id??s.id??s.__id__??"";return typeof e=="string"?e:typeof e=="number"?e.toString():""},po=async(s,e,n,o)=>{try{const t=await o(s,e,n),i=t.rows.flatMap(c=>go(c)||[]).slice(0,lt),l=t.total??0;return{capNote:l>lt?`showing first ${lt.toString()} of ${l.toString()}`:void 0,rowCount:l,rowIds:i}}catch{return{capNote:"count unavailable",rowCount:0,rowIds:[]}}},Xt=async(s,e,n,o,t,i,l)=>{const{capNote:r,rowCount:c,rowIds:a}=n===void 0?{capNote:void 0,rowCount:1,rowIds:[e]}:await po(s,n.field,e,l),f=n?.onDelete==="restrict",m=[],p=`${s}:${e}`,b=i>=Lt;if(!t.has(p)&&!b){t.add(p);const g=o.get(s)??[];for(const h of g)for(const w of a.slice(0,10)){const v=await Xt(h.table,w,h,o,t,i+1,l);(v.rowCount>0||i===0)&&m.push(v)}t.delete(p)}let u=r;if(b){const g=`depth capped at ${Lt.toString()}`;u=r===void 0?g:`${r}; ${g}`}return{capNote:u,children:m,isRestrict:f,relation:n,rowCount:c,rowIds:a,table:s}},bo=({onClose:s,onConfirm:e,readPage:n,rowId:o,schema:t,table:i})=>{const l=he(),[r,c]=D(!0),[a,f]=D(null),[m,p]=D(null);Be(()=>{let g=!1;return Ce((async()=>{try{c(!0),p(null);const w=so(t);if(!((w.get(i)??[]).length>0)){g||(f({capNote:void 0,children:[],isRestrict:!1,relation:void 0,rowCount:1,rowIds:[o],table:i}),c(!1));return}const y=await Xt(i,o,void 0,w,new Set,0,n);g||(f(y),c(!1))}catch(w){g||(p(w.message),c(!1))}})()),()=>{g=!0}},[o,i]);const b=a!==null&&lo(a,g=>g.isRestrict).length>0,u=()=>{e(),s()};return E(dt,{label:"Cascade impact preview",onClose:s,panelTestId:"cascade-panel",testId:"cascade-overlay",variant:"dialog",children:[E("div",{className:"flex items-start justify-between",children:[E("div",{className:"flex flex-col gap-0.5",children:[d("h3",{className:"text-base text-foreground","data-testid":"cascade-title",children:l("Cascade impact")}),d("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-desc",children:l("Delete preview — rows that would cascade or be blocked")})]}),d("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"cascade-close",onClick:s,type:"button",children:l("Close")})]}),r&&d("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-loading",children:l("Loading…")}),m!==null&&d("p",{className:"text-xs text-destructive","data-testid":"cascade-error",role:"alert",children:m}),!r&&a!==null&&d("ul",{className:"flex flex-col","data-testid":"cascade-tree",children:d(Yt,{depth:0,node:a})}),!r&&a!==null&&a.children.length===0&&d("p",{className:"text-xs text-muted-foreground","data-testid":"cascade-no-impact",children:l("No related rows found.")}),b&&d("p",{className:"text-sm font-medium text-destructive","data-testid":"cascade-blocker-warning",role:"alert",children:l("Restrict relations will block this delete.")}),E("div",{className:"flex justify-end gap-2",children:[d("button",{className:"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","data-testid":"cascade-cancel",onClick:s,type:"button",children:l("Cancel")}),d("button",{className:"rounded-md bg-destructive px-3 py-1.5 text-xs font-medium text-destructive-foreground outline-none transition-colors hover:bg-destructive/90 focus-visible:bg-destructive/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"cascade-confirm",disabled:r,onClick:u,type:"button",children:l("Delete")})]})]})},ho=(s,e,n,o,t=300)=>{if(o<=0)return{ids:new Set(s.map(m=>m.id)),leadPx:0,tailPx:0};const i=n-t,l=n+o+t,r=new Set;let c=0,a=0,f=0;for(const m of s){const p=m.getSize(),b=e.has(m.id),u=c+p>i&&c<l;b||u?r.add(m.id):c<i?a+=p:f+=p,c+=p}return{ids:r,leadPx:a,tailPx:f}},xo=(s,e)=>{const n=new Map;let o=0;for(const t of s)e.has(t.id)&&(n.set(t.id,o),o+=t.getSize());return n},vo=()=>{const s=B(11);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={},s[0]=e):e=s[0];const[n,o]=D(e);let t;s[1]===Symbol.for("react.memo_cache_sentinel")?(t=(b,u,g)=>{o(h=>({...h,[b]:{...h[b],[u]:g}}))},s[1]=t):t=s[1];const i=t;let l;s[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{o({})},s[2]=l):l=s[2];const r=l;let c;s[3]!==n?(c=(b,u)=>{const g=n[b];return g!==void 0&&u in g?{value:g[u]}:void 0},s[3]=n,s[4]=c):c=s[4];const a=c;let f;s[5]!==n?(f=Object.values(n).reduce(yo,0),s[5]=n,s[6]=f):f=s[6];const m=f;let p;return s[7]!==m||s[8]!==n||s[9]!==a?(p={clear:r,count:m,stage:i,staged:n,stagedValue:a},s[7]=m,s[8]=n,s[9]=a,s[10]=p):p=s[10],p},Zt=(s,e)=>{if(typeof e=="number"){const n=Number(s);return s.trim()===""||Number.isNaN(n)?s:n}if(typeof e=="boolean"){if(s==="true")return!0;if(s==="false")return!1}return s},wo=s=>{const e=B(29),{changes:n,committing:o,onCommit:t,onDiscard:i}=s,l=he();let r;e[0]!==n.length||e[1]!==l?(r=l("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=l,e[2]=r):r=e[2];let c;e[3]!==r?(c=d("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:r}),e[3]=r,e[4]=c):c=e[4];let a;e[5]!==o||e[6]!==l?(a=l(o?"Committing…":"Commit"),e[5]=o,e[6]=l,e[7]=a):a=e[7];let f;e[8]!==o||e[9]!==t||e[10]!==a?(f=d("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:o,onClick:t,type:"button",children:a}),e[8]=o,e[9]=t,e[10]=a,e[11]=f):f=e[11];let m;e[12]!==l?(m=l("Discard"),e[12]=l,e[13]=m):m=e[13];let p;e[14]!==o||e[15]!==i||e[16]!==m?(p=d("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:o,onClick:i,type:"button",children:m}),e[14]=o,e[15]=i,e[16]=m,e[17]=p):p=e[17];let b;e[18]!==c||e[19]!==f||e[20]!==p?(b=E("div",{className:"flex flex-wrap items-center gap-2",children:[c,f,p]}),e[18]=c,e[19]=f,e[20]=p,e[21]=b):b=e[21];let u;e[22]!==n?(u=n.map(Co),e[22]=n,e[23]=u):u=e[23];let g;e[24]!==u?(g=d("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:u}),e[24]=u,e[25]=g):g=e[25];let h;return e[26]!==b||e[27]!==g?(h=E("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[b,g]}),e[26]=b,e[27]=g,e[28]=h):h=e[28],h};function yo(s,e){return s+Object.keys(e).length}function Co(s){return E("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[E("span",{className:"text-muted-foreground",children:[s.rowId,".",s.column]}),d("span",{className:"text-destructive line-through",children:ze(s.oldValue)}),d("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),d("span",{className:"text-foreground",children:ze(s.newValue)})]},`${s.rowId}:${s.column}`)}const Vt=400,No=36,So={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},ko={width:"100%"},To=/\n$/u,Eo={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},_o={display:"flex",width:"100%"},Bt={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},Ro="2.5rem",en={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},Dt=s=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${s.toString()}px`}),tn=(s,e)=>({...Dt(s),left:`calc(${Ro} + ${e.toString()}px)`,position:"sticky",zIndex:2}),Nt="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",$o=(s,e,n)=>e.enabled&&e.columns.has(n)?void 0:s,_t="__back__:",Do=s=>`${_t}${s.table}.${s.column}`,Io=s=>{const e=B(3),{counts:n,rowId:o}=s;if(n===void 0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=d("span",{className:"text-muted-foreground/50",children:"—"}),e[0]=l):l=e[0],l}const t=n[o]??0;let i;return e[1]!==t?(i=d("span",{className:"tabular-nums",children:t}),e[1]=t,e[2]=i):i=e[2],i},Ie=s=>{for(const e of["id","__id__","_id"]){const n=s[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},Ao=(s,e)=>{if(e.enumValues!==void 0&&e.enumValues.length>0)return e.enumValues.includes(s)||s===""&&e.nullable===!0?{value:s===""?null:s}:void 0;if(e.type==="boolean")return s==="true"||s==="false"?{value:s==="true"}:void 0;if(e.type==="number"){const n=Number(s);return s.trim()===""||!Number.isFinite(n)?void 0:{value:n}}return{value:s}},Po=(s,e,n)=>{if(n!==void 0&&n.type!=="any")return Ao(s,n);const o=Zt(s,e);return typeof e=="number"&&typeof o!="number"?void 0:{value:o}},Mo=({anchor:s,columnIds:e,columnMeta:n,editableColumn:o,rows:t,text:i})=>{const l=i.replaceAll(`\r
2
+ `,`
3
+ `).replace(To,"").split(`
4
+ `),r=[];let c=0;for(const[a,f]of l.entries()){const m=t[s.row+a],p=m===void 0?null:Ie(m),b=f.split(" ");if(m===void 0||p===null){c+=b.length;continue}for(const[u,g]of b.entries()){const h=e[s.col+u],w=h===void 0||!o(h)?void 0:Po(g,m[h],n?.[h]);h===void 0||w===void 0?c+=1:r.push({column:h,rowId:p,value:w.value})}}return{edits:r,skipped:c}},nn=(s,e)=>Ie(s)??`row-${e.toString()}`,Oo=8,Fo=s=>{const e=B(17),{anchor:n,mask:o,state:t}=s,i=he();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 r=l;let c;if(t==="loading"){let f;e[3]!==i?(f=i("Loading…"),e[3]=i,e[4]=f):f=e[4];let m;e[5]!==f?(m=d("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:f}),e[5]=f,e[6]=m):m=e[6],c=m}else if(t.row===null){let f;e[7]!==i?(f=i("No matching row."),e[7]=i,e[8]=f):f=e[8];let m;e[9]!==f?(m=d("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:f}),e[9]=f,e[10]=m):m=e[10],c=m}else{let f;if(e[11]!==o||e[12]!==t.row){const m=Object.entries(Ht(t.row,o)).slice(0,Oo);f=d("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 px-3 py-2",children:m.map(Uo)}),e[11]=o,e[12]=t.row,e[13]=f}else f=e[13];c=f}let a;return e[14]!==c||e[15]!==r?(a=d("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:r,children:c}),e[14]=c,e[15]=r,e[16]=a):a=e[16],a},Lo=s=>{const e=B(24),{column:n,id:o,maskViewFor:t,onNavigate:i,onPreview:l,target:r}=s,[c,a]=D(null),[f,m]=D("idle");let p;e[0]!==o||e[1]!==i||e[2]!==r?(p=()=>{i(r,o)},e[0]=o,e[1]=i,e[2]=r,e[3]=p):p=e[3];const b=p;let u;e[4]!==o||e[5]!==l||e[6]!==f||e[7]!==r?(u=S=>{const C=S.currentTarget.getBoundingClientRect();if(a({left:C.left,top:C.bottom+4}),f!=="idle")return;m("loading"),Ce((async()=>{try{m({row:await l(r,o)})}catch{m({row:null})}})())},e[4]=o,e[5]=l,e[6]=f,e[7]=r,e[8]=u):u=e[8];const g=u;let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{a(null)},e[9]=h):h=e[9];const w=h,v=`db-ref-${n}`,y=`Open ${r} ${o}`;let x;e[10]!==o||e[11]!==b||e[12]!==g||e[13]!==v||e[14]!==y?(x=E("button",{"data-testid":v,onBlur:w,onClick:b,onFocus:g,onMouseEnter:g,onMouseLeave:w,title:y,type:"button",children:[o," ↗"]}),e[10]=o,e[11]=b,e[12]=g,e[13]=v,e[14]=y,e[15]=x):x=e[15];let T;e[16]!==c||e[17]!==t||e[18]!==f||e[19]!==r?(T=c!==null&&f!=="idle"&&d(Fo,{anchor:c,mask:t(r,f==="loading"||f.row===null?[]:Object.keys(f.row)),state:f}),e[16]=c,e[17]=t,e[18]=f,e[19]=r,e[20]=T):T=e[20];let N;return e[21]!==x||e[22]!==T?(N=E(Ze,{children:[x,T]}),e[21]=x,e[22]=T,e[23]=N):N=e[23],N},Vo=s=>s==="asc"?" ▲":s==="desc"?" ▼":"",Bo="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",zt=s=>{const e=B(8),{column:n,onExpand:o,value:t}=s;let i;e[0]!==n||e[1]!==o||e[2]!==t?(i=()=>{o(n,t)},e[0]=n,e[1]=o,e[2]=t,e[3]=i):i=e[3];const l=i,r=`db-expand-${n}`;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=d("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:d("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]=c):c=e[4];let a;return e[5]!==l||e[6]!==r?(a=d("button",{"aria-label":"Expand cell",className:Bo,"data-testid":r,onClick:l,type:"button",children:c}),e[5]=l,e[6]=r,e[7]=a):a=e[7],a},zo=s=>{const e=B(15),{column:n,initial:o,onCancel:t,onCommit:i,recordId:l}=s,r=Je(null);let c,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{r.current?.select()},a=[],e[0]=c,e[1]=a):(c=e[0],a=e[1]),Be(c,a);let f;e[2]!==t||e[3]!==i?(f=w=>{w.key==="Enter"?(w.preventDefault(),i(w.currentTarget.value)):w.key==="Escape"&&(w.preventDefault(),t())},e[2]=t,e[3]=i,e[4]=f):f=e[4];const m=f;let p;e[5]!==i?(p=w=>{i(w.currentTarget.value)},e[5]=i,e[6]=p):p=e[6];const b=p,u=`db-cell-input-${l}-${n}`;let g;e[7]!==o?(g=ze(o),e[7]=o,e[8]=g):g=e[8];let h;return e[9]!==n||e[10]!==b||e[11]!==m||e[12]!==u||e[13]!==g?(h=d("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":u,defaultValue:g,onBlur:b,onKeyDown:m,ref:r}),e[9]=n,e[10]=b,e[11]=m,e[12]=u,e[13]=g,e[14]=h):h=e[14],h},jo=s=>{const e=B(70),{cell:n,edit:o,highlight:t,mask:i,refs:l}=s,r=n.column.id;let c,a,f,m;if(e[0]!==n||e[1]!==r||e[2]!==o||e[3]!==i||e[4]!==l.columns||e[5]!==l.maskViewFor||e[6]!==l.onNavigate||e[7]!==l.onPreview){m=Symbol.for("react.early_return_sentinel");e:{a=n.getValue(),c=Ie(n.row.original);const R=l.columns?.[r];if(i.enabled&&i.columns.has(r)){const _=`db-masked-${r}`,$=d(Ct,{value:An(a,r,i)});let I;e[12]!==_||e[13]!==$?(I=d("span",{className:"text-muted-foreground italic","data-testid":_,title:"Masked (preview)",children:$}),e[12]=_,e[13]=$,e[14]=I):I=e[14],m=I;break e}if(R!==void 0&&(typeof a=="string"||typeof a=="number")&&String(a)!==""){const _=String(a),$=`${R}:${String(a)}`;let I;e[15]!==r||e[16]!==l.maskViewFor||e[17]!==l.onNavigate||e[18]!==l.onPreview||e[19]!==_||e[20]!==$||e[21]!==R?(I=d(Lo,{column:r,id:_,maskViewFor:l.maskViewFor,onNavigate:l.onNavigate,onPreview:l.onPreview,target:R},$),e[15]=r,e[16]=l.maskViewFor,e[17]=l.onNavigate,e[18]=l.onPreview,e[19]=_,e[20]=$,e[21]=R,e[22]=I):I=e[22],m=I;break e}if(c===null){let _;e[23]!==a?(_=d(Ct,{value:a}),e[23]=a,e[24]=_):_=e[24];let $;e[25]!==r||e[26]!==o.onExpandCell||e[27]!==a?($=d(zt,{column:r,onExpand:o.onExpandCell,value:a}),e[25]=r,e[26]=o.onExpandCell,e[27]=a,e[28]=$):$=e[28];let I;e[29]!==_||e[30]!==$?(I=E(Ze,{children:[_,$]}),e[29]=_,e[30]=$,e[31]=I):I=e[31],m=I;break e}f=o.stagedValue(c,r)}e[0]=n,e[1]=r,e[2]=o,e[3]=i,e[4]=l.columns,e[5]=l.maskViewFor,e[6]=l.onNavigate,e[7]=l.onPreview,e[8]=c,e[9]=a,e[10]=f,e[11]=m}else c=e[8],a=e[9],f=e[10],m=e[11];if(m!==Symbol.for("react.early_return_sentinel"))return m;const p=f,b=p===void 0?a:p.value;let u;e[32]!==r||e[33]!==o?(u=o.editable&&o.editableColumn(r),e[32]=r,e[33]=o,e[34]=u):u=e[34];const g=u;if(o.editingCell!==null&&o.editingCell.rowId===c&&o.editingCell.column===r){let R;e[35]!==r||e[36]!==o||e[37]!==c||e[38]!==a?(R=$=>{o.stage(c,r,Zt($,a)),o.cancelEdit()},e[35]=r,e[36]=o,e[37]=c,e[38]=a,e[39]=R):R=e[39];let _;return e[40]!==r||e[41]!==b||e[42]!==o.cancelEdit||e[43]!==c||e[44]!==R?(_=d(zo,{column:r,initial:b,onCancel:o.cancelEdit,onCommit:R,recordId:c}),e[40]=r,e[41]=b,e[42]=o.cancelEdit,e[43]=c,e[44]=R,e[45]=_):_=e[45],_}let w;p!==void 0?w="rounded bg-warning/15 px-1":g&&(w="cursor-text");let v;e[46]!==g||e[47]!==r||e[48]!==o||e[49]!==c?(v=g?()=>{o.startEdit(c,r)}:void 0,e[46]=g,e[47]=r,e[48]=o,e[49]=c,e[50]=v):v=e[50];const y=v,x=w,T=`db-cell-${c}-${r}`;let N;e[51]!==r||e[52]!==t||e[53]!==i?(N=$o(t,i,r),e[51]=r,e[52]=t,e[53]=i,e[54]=N):N=e[54];let S;e[55]!==b||e[56]!==N?(S=d(Ct,{highlight:N,value:b}),e[55]=b,e[56]=N,e[57]=S):S=e[57];let C;e[58]!==w||e[59]!==y||e[60]!==T||e[61]!==S?(C=d("span",{className:x,"data-testid":T,onDoubleClick:y,children:S}),e[58]=w,e[59]=y,e[60]=T,e[61]=S,e[62]=C):C=e[62];let k;e[63]!==r||e[64]!==b||e[65]!==o.onExpandCell?(k=d(zt,{column:r,onExpand:o.onExpandCell,value:b}),e[63]=r,e[64]=b,e[65]=o.onExpandCell,e[66]=k):k=e[66];let M;return e[67]!==k||e[68]!==C?(M=E(Ze,{children:[C,k]}),e[67]=k,e[68]=C,e[69]=M):M=e[69],M},qo=s=>{s.preventDefault()},jt={any:"?",array:"[]",bigint:"#",boolean:"01",bytes:"0x",id:"→",number:"#",object:"{}",storage:"◫",string:"T",union:"|"},Go=({declaredType:s,draggedRef:e,header:n,masked:o=!1,onTogglePin:t,pinnedOffset:i,table:l})=>{const r=()=>{e.current=n.column.id},c=()=>{const a=e.current,f=n.column.id;if(e.current=null,a===null||a===f)return;const m=l.getState().columnOrder,b=(m.length>0?m:l.getAllLeafColumns().map(g=>g.id)).filter(g=>g!==a),u=b.indexOf(f);b.splice(u===-1?b.length:u,0,a),l.setColumnOrder(b)};return E("th",{className:it("group/head text-start text-xs font-medium text-muted-foreground",i!==void 0&&"border-e border-border bg-muted"),draggable:!0,onDragOver:qo,onDragStart:r,onDrop:c,style:i===void 0?Dt(n.getSize()):tn(n.getSize(),i),children:[E("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:[Wn(n.column.columnDef.header,n.getContext()),Vo(n.column.getIsSorted())]}),s!==void 0&&jt[s]!==void 0&&d("span",{className:"ms-1 font-mono text-[0.625rem] text-muted-foreground/70","data-testid":`db-type-${n.column.id}`,title:s,children:jt[s]}),o&&d("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"}),d("button",{"aria-label":i===void 0?`Pin ${n.column.id}`:`Unpin ${n.column.id}`,"aria-pressed":i!==void 0,className:it("ms-1 rounded-sm px-1 text-[0.625rem] outline-none transition-opacity hover:bg-accent focus-visible:bg-accent",i===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:"📌"}),d("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()})]})},Ko=s=>{const e=B(13),{table:n}=s,o=he();let t;e[0]!==n?(t=f=>{n.toggleAllRowsSelected(f)},e[0]=n,e[1]=t):t=e[1];const i=t;let l;e[2]!==o?(l=o("Select all rows"),e[2]=o,e[3]=l):l=e[3];let r;e[4]!==n?(r=n.getIsAllRowsSelected(),e[4]=n,e[5]=r):r=e[5];let c;e[6]!==n?(c=n.getIsSomeRowsSelected()&&!n.getIsAllRowsSelected(),e[6]=n,e[7]=c):c=e[7];let a;return e[8]!==i||e[9]!==l||e[10]!==r||e[11]!==c?(a=d("th",{className:"bg-muted",style:en,children:d(Rt,{"aria-label":l,checked:r,"data-testid":"db-select-all",indeterminate:c,onCheckedChange:i})}),e[8]=i,e[9]=l,e[10]=r,e[11]=c,e[12]=a):a=e[12],a},Jo=s=>{const e=B(17),{row:n}=s,o=he();let t;e[0]!==n.original?(t=Ie(n.original),e[0]=n.original,e[1]=t):t=e[1];const i=t;let l;e[2]!==n?(l=u=>{n.toggleSelected(u)},e[2]=n,e[3]=l):l=e[3];const r=l;let c;e[4]!==o?(c=o("Select row"),e[4]=o,e[5]=c):c=e[5];let a;e[6]!==n?(a=n.getIsSelected(),e[6]=n,e[7]=a):a=e[7];let f;e[8]!==n.index||e[9]!==n.original?(f=nn(n.original,n.index),e[8]=n.index,e[9]=n.original,e[10]=f):f=e[10];const m=`db-select-${f}`,p=i===null;let b;return e[11]!==r||e[12]!==c||e[13]!==a||e[14]!==m||e[15]!==p?(b=d("td",{className:"bg-background",style:en,children:d(Rt,{"aria-label":c,checked:a,"data-testid":m,disabled:p,onCheckedChange:r})}),e[11]=r,e[12]=c,e[13]=a,e[14]=m,e[15]=p,e[16]=b):b=e[16],b},Wo=s=>{const e=B(91),{columnMeta:n,edit:o,editable:t,mask:i,onDelete:l,onEdit:r,onInspect:c,highlight:a,backRelationCounts:f,onTogglePin:m,pinnedColumns:p,refs:b,tableModel:u}=s,g=he(),{attachScroll:h,scrollLeft:w,scrollToIndex:v,table:y,tableRows:x,tbodyStyle:T,viewportWidth:N,virtualRows:S}=u,C=Je(null),[k,M]=D(null);let R;e[0]===Symbol.for("react.memo_cache_sentinel")?(R={columns:"",count:0},e[0]=R):R=e[0];const[_,$]=D(R);let I;e[1]!==y?(I=y.getVisibleLeafColumns(),e[1]=y,e[2]=I):I=e[2];const F=I.length;let P;e[3]!==k||e[4]!==F||e[5]!==o||e[6]!==y||e[7]!==x?(P=X=>{if(!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"].includes(X.key))return;X.preventDefault();const W=k??{col:0,row:0};if(X.key==="Enter"){const we=x[W.row],ye=y.getVisibleLeafColumns()[W.col];if(we!==void 0&&ye!==void 0){const H=Ie(we.original);H!==null&&o.editableColumn(ye.id)&&o.startEdit(H,ye.id)}M(W);return}let{col:ve,row:ge}=W;e:switch(X.key){case"ArrowDown":{ge=Math.min(ge+1,x.length-1);break e}case"ArrowRight":{ve=Math.min(ve+1,F-1);break e}case"ArrowUp":{ge=Math.max(ge-1,0);break e}default:ve=Math.max(ve-1,0)}M({col:ve,row:ge})},e[3]=k,e[4]=F,e[5]=o,e[6]=y,e[7]=x,e[8]=P):P=e[8];const z=P;let j;e[9]!==k||e[10]!==n||e[11]!==o||e[12]!==y||e[13]!==x?(j=X=>{const W=o.editable?X.clipboardData.getData("text/plain"):"";if(W==="")return;X.preventDefault();const ve=y.getVisibleLeafColumns().map(Qo),ge=Mo({anchor:k??{col:0,row:0},columnIds:ve,columnMeta:n,editableColumn:o.editableColumn,rows:x.map(Yo),text:W});for(const we of ge.edits)o.stage(we.rowId,we.column,we.value);$({columns:ve.join("\0"),count:ge.skipped})},e[9]=k,e[10]=n,e[11]=o,e[12]=y,e[13]=x,e[14]=j):j=e[14];const O=j;let V,J;e[15]!==k||e[16]!==v?(V=()=>{k!==null&&v(k.row)},J=[k,v],e[15]=k,e[16]=v,e[17]=V,e[18]=J):(V=e[17],J=e[18]),Be(V,J);let q,Y,Z,se,fe,te,ce,de,me,le,ue,re,Q,be,ee,xe;if(e[19]!==k||e[20]!==h||e[21]!==f||e[22]!==n||e[23]!==o||e[24]!==t||e[25]!==a||e[26]!==i||e[27]!==l||e[28]!==r||e[29]!==z||e[30]!==O||e[31]!==c||e[32]!==m||e[33]!==_.columns||e[34]!==_.count||e[35]!==p||e[36]!==b||e[37]!==w||e[38]!==g||e[39]!==y||e[40]!==x||e[41]!==T||e[42]!==N||e[43]!==S){const X=y.getVisibleLeafColumns().map(Xo),W=ho(X,p,w,N),ve=xo(y.getVisibleLeafColumns().map(Zo),p),ge=H=>{const ne=x[H.index],{original:Me}=ne,Ae=Ie(Me),Pe=nn(Me,H.index),He={...Eo,height:`${H.size.toString()}px`,transform:`translateY(${H.start.toString()}px)`};return E("tr",{className:"border-b border-border text-xs transition-colors hover:bg-muted/50","data-testid":"db-row",style:He,children:[d(Jo,{row:ne}),W.leadPx>0&&d("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),ne.getVisibleCells().map((Se,je)=>{if(!W.ids.has(Se.column.id))return null;const Oe=ve.get(Se.column.id),Ue=k!==null&&k.row===H.index&&k.col===je?" ring-1 ring-ring ring-inset":"";return d("td",{className:it("group/cell truncate font-mono text-muted-foreground",Oe!==void 0&&"border-e border-border bg-background",Ue),onPointerDown:()=>{M({col:je,row:H.index})},style:Oe===void 0?Dt(Se.column.getSize()):tn(Se.column.getSize(),Oe),children:Se.column.id.startsWith(_t)?d(Io,{counts:f[Se.column.id.slice(_t.length)],rowId:Pe}):d(jo,{cell:Se,edit:o,highlight:a,mask:i,refs:b})},Se.id)}),W.tailPx>0&&d("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),E("td",{className:"flex items-center gap-1",style:Bt,children:[d("button",{className:Nt,"data-testid":`db-inspect-${Pe}`,onClick:()=>{c(Me)},type:"button",children:"Details"}),t&&E(Ze,{children:[d("button",{className:Nt,"data-testid":`db-edit-${Pe}`,disabled:Ae===null,onClick:()=>{r(Ae,Me)},type:"button",children:"Edit"}),d("button",{className:Nt,"data-testid":`db-delete-${Pe}`,disabled:Ae===null,onClick:()=>{l(Ae)},type:"button",children:"Delete"})]})]})]},ne.id)};q=Qn,re="fill",e[60]!==_.columns||e[61]!==_.count||e[62]!==g||e[63]!==y?(Q=_.count>0&&_.columns===y.getVisibleLeafColumns().map(es).join("\0")&&d("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:g("{count} pasted cells were skipped",{count:_.count})}),e[60]=_.columns,e[61]=_.count,e[62]=g,e[63]=y,e[64]=Q):Q=e[64],fe="db-scroll",te=z,ce=O,de=h,me="grid",le=So,ue=0,xe="w-full text-xs",Y="db-rows",Z=ko;let we;e[65]!==y?(we=d(Ko,{table:y}),e[65]=y,e[66]=we):we=e[66];let ye;e[67]===Symbol.for("react.memo_cache_sentinel")?(ye=d("th",{"aria-label":"Row actions",style:Bt}),e[67]=ye):ye=e[67],se=d("thead",{className:"bg-muted/50",children:E("tr",{className:"border-b border-border",style:_o,children:[we,W.leadPx>0&&d("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),y.getFlatHeaders().map(H=>W.ids.has(H.column.id)?d(Go,{declaredType:n?.[H.column.id]?.type,draggedRef:C,header:H,masked:i.columns.has(H.column.id),onTogglePin:m,pinnedOffset:ve.get(H.column.id),table:y},H.id):null),W.tailPx>0&&d("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),ye]})}),be=T,ee=S.map(H=>ge(H)),e[19]=k,e[20]=h,e[21]=f,e[22]=n,e[23]=o,e[24]=t,e[25]=a,e[26]=i,e[27]=l,e[28]=r,e[29]=z,e[30]=O,e[31]=c,e[32]=m,e[33]=_.columns,e[34]=_.count,e[35]=p,e[36]=b,e[37]=w,e[38]=g,e[39]=y,e[40]=x,e[41]=T,e[42]=N,e[43]=S,e[44]=q,e[45]=Y,e[46]=Z,e[47]=se,e[48]=fe,e[49]=te,e[50]=ce,e[51]=de,e[52]=me,e[53]=le,e[54]=ue,e[55]=re,e[56]=Q,e[57]=be,e[58]=ee,e[59]=xe}else q=e[44],Y=e[45],Z=e[46],se=e[47],fe=e[48],te=e[49],ce=e[50],de=e[51],me=e[52],le=e[53],ue=e[54],re=e[55],Q=e[56],be=e[57],ee=e[58],xe=e[59];let ae;e[68]!==be||e[69]!==ee?(ae=d("tbody",{style:be,children:ee}),e[68]=be,e[69]=ee,e[70]=ae):ae=e[70];let ie;e[71]!==Y||e[72]!==Z||e[73]!==se||e[74]!==ae||e[75]!==xe?(ie=E("table",{className:xe,"data-testid":Y,style:Z,children:[se,ae]}),e[71]=Y,e[72]=Z,e[73]=se,e[74]=ae,e[75]=xe,e[76]=ie):ie=e[76];let U;e[77]!==fe||e[78]!==te||e[79]!==ce||e[80]!==de||e[81]!==me||e[82]!==le||e[83]!==ue||e[84]!==ie?(U=d("div",{"data-testid":fe,onKeyDown:te,onPaste:ce,ref:de,role:me,style:le,tabIndex:ue,children:ie}),e[77]=fe,e[78]=te,e[79]=ce,e[80]=de,e[81]=me,e[82]=le,e[83]=ue,e[84]=ie,e[85]=U):U=e[85];let K;return e[86]!==q||e[87]!==re||e[88]!==Q||e[89]!==U?(K=E(q,{layout:re,children:[Q,U]}),e[86]=q,e[87]=re,e[88]=Q,e[89]=U,e[90]=K):K=e[90],K},Ho=(s,e,n,o=[])=>{const t=s?.columns,i=s?.rows,l=s?.refs,r=Tt(()=>{if(t===void 0)return[];const C=t.map(k=>({accessorFn:M=>M[k],header:l?.[k]===void 0?k:`${k} →`,id:k}));for(const k of o)C.push({accessorFn:()=>{},enableSorting:!1,header:`← ${k.table}`,id:Do(k)});return C},[o,t,l]),c=Tt(()=>i??[],[i]),[a,f]=D({}),[m,p]=D({}),b=Gn({columnResizeMode:"onChange",columns:r,data:c,defaultColumn:{minSize:80,size:200},enableColumnResizing:!0,enableRowSelection:C=>Ie(C.original)!==null,getCoreRowModel:Jn(),getRowId:(C,k)=>Ie(C)??`row-${k.toString()}`,getSortedRowModel:Kn(),manualSorting:!0,onColumnVisibilityChange:p,onRowSelectionChange:f,onSortingChange:n,state:{columnVisibility:m,rowSelection:a,sorting:e}}),u=b.getRowModel().rows,g=Je(null),h=Hn({count:u.length,estimateSize:()=>No,getScrollElement:()=>g.current,initialRect:{height:Vt,width:0},observeElementRect:(C,k)=>Un(C,k,Vt),overscan:8}),w=at(C=>{h.scrollToIndex(C)},[h]),[v,y]=D({left:0,width:0}),x=at(C=>{if(g.current=C,C===null)return;const k=()=>{y(R=>R.left===C.scrollLeft&&R.width===C.clientWidth?R:{left:C.scrollLeft,width:C.clientWidth})};C.addEventListener("scroll",k,{passive:!0});const M=new ResizeObserver(k);return M.observe(C),()=>{C.removeEventListener("scroll",k),M.disconnect(),g.current=null}},[]),T=h.getVirtualItems(),S={display:"block",height:`${h.getTotalSize().toString()}px`,position:"relative"};return{attachScroll:x,scrollLeft:v.left,scrollToIndex:w,table:b,tableRows:u,tbodyStyle:S,viewportWidth:v.width,virtualRows:T}};function Uo(s){const[e,n]=s;return E("div",{className:"contents",children:[d("dt",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e}),d("dd",{className:"truncate font-mono text-[11px] text-foreground",title:ze(n),children:ze(n)})]},e)}function Qo(s){return s.id}function Yo(s){return s.original}function Xo(s){return{getSize:()=>s.getSize(),id:s.id}}function Zo(s){return{getSize:()=>s.getSize(),id:s.id}}function es(s){return s.id}const ts=s=>{const e=B(22),{onCommit:n}=s,o=he(),[t,i]=D(""),l=Je(null);let r,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{l.current?.focus()},c=[],e[0]=r,e[1]=c):(r=e[0],c=e[1]),Be(r,c);let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=y=>{i(y.target.value)},e[2]=a):a=e[2];const f=a;let m;e[3]!==t||e[4]!==n?(m=()=>{const y=t.trim();y!==""&&n(y)},e[3]=t,e[4]=n,e[5]=m):m=e[5];const p=m;let b;e[6]!==o?(b=o("Query name"),e[6]=o,e[7]=b):b=e[7];let u;e[8]!==o?(u=o("Query name"),e[8]=o,e[9]=u):u=e[9];let g;e[10]!==t||e[11]!==b||e[12]!==u?(g=d("input",{"aria-label":b,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:f,placeholder:u,ref:l,value:t}),e[10]=t,e[11]=b,e[12]=u,e[13]=g):g=e[13];let h;e[14]!==o?(h=o("Save"),e[14]=o,e[15]=h):h=e[15];let w;e[16]!==p||e[17]!==h?(w=d("button",{className:Et,"data-testid":"db-save-query-confirm",onClick:p,type:"button",children:h}),e[16]=p,e[17]=h,e[18]=w):w=e[18];let v;return e[19]!==g||e[20]!==w?(v=E("span",{className:"inline-flex items-center gap-1",children:[g,w]}),e[19]=g,e[20]=w,e[21]=v):v=e[21],v},ns=s=>{const e=B(27),{onApply:n,onCopyLink:o,onDelete:t,onSave:i,saved:l}=s,r=he(),[c,a]=D(!1);let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{a(!0)},e[0]=f):f=e[0];const m=f;let p;e[1]!==i?(p=S=>{i(S),a(!1)},e[1]=i,e[2]=p):p=e[2];const b=p;let u;e[3]!==n||e[4]!==l?(u=S=>{const C=l[Number(S.currentTarget.dataset.index)];C!==void 0&&n(C)},e[3]=n,e[4]=l,e[5]=u):u=e[5];const g=u;let h;e[6]!==t||e[7]!==l?(h=S=>{const C=l[Number(S.currentTarget.dataset.index)];C!==void 0&&t(C.name)},e[6]=t,e[7]=l,e[8]=h):h=e[8];const w=h;let v;e[9]!==r?(v=r("Copy link"),e[9]=r,e[10]=v):v=e[10];let y;e[11]!==o||e[12]!==v?(y=d("button",{className:Et,"data-testid":"db-copy-link",onClick:o,type:"button",children:v}),e[11]=o,e[12]=v,e[13]=y):y=e[13];let x;e[14]!==b||e[15]!==c||e[16]!==r?(x=c?d(ts,{onCommit:b}):d("button",{className:Et,"data-testid":"db-save-query",onClick:m,type:"button",children:r("Save query")}),e[14]=b,e[15]=c,e[16]=r,e[17]=x):x=e[17];let T;e[18]!==g||e[19]!==w||e[20]!==l||e[21]!==r?(T=l.length>0&&E("div",{className:"flex flex-wrap items-center gap-1","data-testid":"db-saved-queries",children:[d("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:r("Saved")}),l.map((S,C)=>E("span",{className:"inline-flex items-center overflow-hidden rounded-md border border-border",children:[d("button",{className:"px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-accent","data-index":C,"data-testid":`db-saved-query-${S.name}`,onClick:g,type:"button",children:S.name}),d("button",{"aria-label":r("Delete saved query {name}",{name:S.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":C,"data-testid":`db-saved-query-delete-${S.name}`,onClick:w,type:"button",children:"✕"})]},S.name))]}),e[18]=g,e[19]=w,e[20]=l,e[21]=r,e[22]=T):T=e[22];let N;return e[23]!==y||e[24]!==x||e[25]!==T?(N=E("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-query-bar",children:[y,x,T]}),e[23]=y,e[24]=x,e[25]=T,e[26]=N):N=e[26],N},We="w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus-visible:border-ring",on=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,qt=(s,e)=>typeof e=="boolean"?"boolean":typeof e=="number"?on.test(s)?"date":"number":e!==null&&typeof e=="object"?"json":"text",os=(s,e,n)=>n===void 0?qt(s,e):n.enumValues!==void 0&&n.enumValues.length>0?"enum":n.type==="boolean"?"boolean":n.type==="number"?on.test(s)?"date":"number":qt(s,e),ss=s=>{try{const e=JSON.parse(s);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}},ls=s=>{const e=new Date(s),n=o=>String(o).padStart(2,"0");return`${e.getFullYear().toString()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`},Ke="\0clear",rs=s=>{const e=B(23),{column:n,nullable:o,onChange:t,value:i}=s,l=he();let r;e[0]!==n||e[1]!==t?(r=v=>{t(n,v)},e[0]=n,e[1]=t,e[2]=r):r=e[2];const c=r;let a;e[3]!==n||e[4]!==t?(a=v=>{t(n,v.target.value===Ke?null:v.target.value==="true")},e[3]=n,e[4]=t,e[5]=a):a=e[5];const f=a;if(!o&&i!==null){const v=i===!0,y=`db-field-${n}`;let x;return e[6]!==n||e[7]!==c||e[8]!==v||e[9]!==y?(x=d(Rt,{"aria-label":n,checked:v,"data-testid":y,onCheckedChange:c}),e[6]=n,e[7]=c,e[8]=v,e[9]=y,e[10]=x):x=e[10],x}const m=`db-field-${n}`,p=i===!0||i===!1?String(i):Ke;let b;e[11]!==l?(b=l("(none)"),e[11]=l,e[12]=b):b=e[12];let u;e[13]!==b?(u=d("option",{value:Ke,children:b}),e[13]=b,e[14]=u):u=e[14];let g,h;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=d("option",{value:"true",children:"true"}),h=d("option",{value:"false",children:"false"}),e[15]=g,e[16]=h):(g=e[15],h=e[16]);let w;return e[17]!==n||e[18]!==f||e[19]!==m||e[20]!==p||e[21]!==u?(w=E("select",{"aria-label":n,className:We,"data-testid":m,onChange:f,value:p,children:[u,g,h]}),e[17]=n,e[18]=f,e[19]=m,e[20]=p,e[21]=u,e[22]=w):w=e[22],w},as=s=>{const e=B(23),{column:n,nullable:o,onChange:t,options:i,value:l}=s,r=he(),c=typeof l=="string"?l:null;let a;e[0]!==i||e[1]!==c?(a=c!==null&&!i.includes(c),e[0]=i,e[1]=c,e[2]=a):a=e[2];const f=a;let m;e[3]!==n||e[4]!==t?(m=y=>{t(n,y.target.value===Ke?null:y.target.value)},e[3]=n,e[4]=t,e[5]=m):m=e[5];const p=m,b=`db-field-${n}`,u=c??Ke;let g;e[6]!==o||e[7]!==c||e[8]!==r?(g=(o||c===null)&&d("option",{value:Ke,children:r("(none)")}),e[6]=o,e[7]=c,e[8]=r,e[9]=g):g=e[9];let h;e[10]!==c||e[11]!==f?(h=f&&d("option",{value:c,children:c}),e[10]=c,e[11]=f,e[12]=h):h=e[12];let w;e[13]!==i?(w=i.map(gs),e[13]=i,e[14]=w):w=e[14];let v;return e[15]!==n||e[16]!==p||e[17]!==b||e[18]!==u||e[19]!==g||e[20]!==h||e[21]!==w?(v=E("select",{"aria-label":n,className:We,"data-testid":b,onChange:p,value:u,children:[g,h,w]}),e[15]=n,e[16]=p,e[17]=b,e[18]=u,e[19]=g,e[20]=h,e[21]=w,e[22]=v):v=e[22],v},is=s=>{const e=B(8),{column:n,onChange:o,value:t}=s;let i;e[0]!==n||e[1]!==o?(i=f=>{const m=Number(f.target.value);f.target.value!==""&&!Number.isNaN(m)&&o(n,m)},e[0]=n,e[1]=o,e[2]=i):i=e[2];const l=i,r=`db-field-${n}`,c=typeof t=="number"?t:"";let a;return e[3]!==n||e[4]!==l||e[5]!==r||e[6]!==c?(a=d("input",{"aria-label":n,className:We,"data-testid":r,onChange:l,type:"number",value:c}),e[3]=n,e[4]=l,e[5]=r,e[6]=c,e[7]=a):a=e[7],a},cs=s=>{const e=B(10),{column:n,onChange:o,value:t}=s;let i;e[0]!==n||e[1]!==o?(i=f=>{const m=new Date(f.target.value).getTime();Number.isNaN(m)||o(n,m)},e[0]=n,e[1]=o,e[2]=i):i=e[2];const l=i,r=`db-field-${n}`;let c;e[3]!==t?(c=typeof t=="number"?ls(t):"",e[3]=t,e[4]=c):c=e[4];let a;return e[5]!==n||e[6]!==l||e[7]!==r||e[8]!==c?(a=d("input",{"aria-label":n,className:We,"data-testid":r,onChange:l,type:"datetime-local",value:c}),e[5]=n,e[6]=l,e[7]=r,e[8]=c,e[9]=a):a=e[9],a},ds=s=>{const e=B(8),{column:n,onChange:o,value:t}=s;let i;e[0]!==n||e[1]!==o?(i=f=>{o(n,f.target.value)},e[0]=n,e[1]=o,e[2]=i):i=e[2];const l=i,r=`db-field-${n}`,c=typeof t=="string"?t:"";let a;return e[3]!==n||e[4]!==l||e[5]!==r||e[6]!==c?(a=d("input",{"aria-label":n,className:We,"data-testid":r,onChange:l,type:"text",value:c}),e[3]=n,e[4]=l,e[5]=r,e[6]=c,e[7]=a):a=e[7],a},us=s=>{const e=B(20),{column:n,onChange:o,value:t}=s,i=he();let l;e[0]!==t?(l=()=>JSON.stringify(t,null,2),e[0]=t,e[1]=l):l=e[1];const[r,c]=D(l),[a,f]=D(!1);let m;e[2]!==n||e[3]!==o?(m=y=>{const x=y.target.value;c(x);try{o(n,JSON.parse(x)),f(!1)}catch{f(!0)}},e[2]=n,e[3]=o,e[4]=m):m=e[4];const p=m,b=a&&"border-destructive";let u;e[5]!==b?(u=it(We,"min-h-16",b),e[5]=b,e[6]=u):u=e[6];const g=`db-field-${n}`;let h;e[7]!==n||e[8]!==p||e[9]!==u||e[10]!==g||e[11]!==r?(h=d("textarea",{"aria-label":n,className:u,"data-testid":g,onChange:p,value:r}),e[7]=n,e[8]=p,e[9]=u,e[10]=g,e[11]=r,e[12]=h):h=e[12];let w;e[13]!==n||e[14]!==a||e[15]!==i?(w=a&&d("span",{className:"text-xs text-destructive","data-testid":`db-field-error-${n}`,children:i("Invalid JSON")}),e[13]=n,e[14]=a,e[15]=i,e[16]=w):w=e[16];let v;return e[17]!==h||e[18]!==w?(v=E("div",{className:"flex flex-col gap-1",children:[h,w]}),e[17]=h,e[18]=w,e[19]=v):v=e[19],v},fs=s=>{const e=B(56),{column:n,meta:o,onChange:t,target:i,value:l}=s;let r;e[0]!==n||e[1]!==o||e[2]!==l?(r=os(n,l,o),e[0]=n,e[1]=o,e[2]=l,e[3]=r):r=e[3];const c=r,a=`db-field-${n}`;let f;e[4]!==n?(f=d("span",{className:"font-mono",children:n}),e[4]=n,e[5]=f):f=e[5];let m;e[6]!==n||e[7]!==o?(m=o!==void 0&&d("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide","data-testid":`db-field-type-${n}`,children:o.type}),e[6]=n,e[7]=o,e[8]=m):m=e[8];let p;e[9]!==i?(p=i!==void 0&&E("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:["→ ",i]}),e[9]=i,e[10]=p):p=e[10];let b;e[11]!==f||e[12]!==m||e[13]!==p?(b=E("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground",children:[f,m,p]}),e[11]=f,e[12]=m,e[13]=p,e[14]=b):b=e[14];let u;e[15]!==n||e[16]!==c||e[17]!==o?.nullable||e[18]!==t||e[19]!==l?(u=c==="boolean"&&d(rs,{column:n,nullable:o?.nullable===!0,onChange:t,value:l}),e[15]=n,e[16]=c,e[17]=o?.nullable,e[18]=t,e[19]=l,e[20]=u):u=e[20];let g;e[21]!==n||e[22]!==c||e[23]!==o||e[24]!==t||e[25]!==l?(g=c==="enum"&&o?.enumValues!==void 0&&d(as,{column:n,nullable:o.nullable===!0,onChange:t,options:o.enumValues,value:l}),e[21]=n,e[22]=c,e[23]=o,e[24]=t,e[25]=l,e[26]=g):g=e[26];let h;e[27]!==n||e[28]!==c||e[29]!==t||e[30]!==l?(h=c==="number"&&d(is,{column:n,onChange:t,value:l}),e[27]=n,e[28]=c,e[29]=t,e[30]=l,e[31]=h):h=e[31];let w;e[32]!==n||e[33]!==c||e[34]!==t||e[35]!==l?(w=c==="date"&&d(cs,{column:n,onChange:t,value:l}),e[32]=n,e[33]=c,e[34]=t,e[35]=l,e[36]=w):w=e[36];let v;e[37]!==n||e[38]!==c||e[39]!==t||e[40]!==l?(v=c==="json"&&d(us,{column:n,onChange:t,value:l}),e[37]=n,e[38]=c,e[39]=t,e[40]=l,e[41]=v):v=e[41];let y;e[42]!==n||e[43]!==c||e[44]!==t||e[45]!==l?(y=c==="text"&&d(ds,{column:n,onChange:t,value:l}),e[42]=n,e[43]=c,e[44]=t,e[45]=l,e[46]=y):y=e[46];let x;return e[47]!==w||e[48]!==v||e[49]!==y||e[50]!==a||e[51]!==b||e[52]!==u||e[53]!==g||e[54]!==h?(x=E("label",{className:"flex flex-col gap-1 text-xs",htmlFor:a,children:[b,u,g,h,w,v,y]}),e[47]=w,e[48]=v,e[49]=y,e[50]=a,e[51]=b,e[52]=u,e[53]=g,e[54]=h,e[55]=x):x=e[55],x},ms=s=>{const e=B(49),{columnMeta:n,documentText:o,onCancel:t,onDocumentTextChange:i,onSave:l,refs:r}=s,c=he();let a;e[0]!==o?(a=ss(o),e[0]=o,e[1]=a):a=e[1];const f=a,[m,p]=D(!1),b=!m&&f!==null;let u;e[2]!==f||e[3]!==i?(u=(V,J)=>{i(JSON.stringify({...f,[V]:J},null,2))},e[2]=f,e[3]=i,e[4]=u):u=e[4];const g=u;let h;e[5]!==i?(h=V=>{i(V.target.value)},e[5]=i,e[6]=h):h=e[6];const w=h;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{p(!1)},e[7]=v):v=e[7];const y=v;let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{p(!0)},e[8]=x):x=e[8];const T=x,N=f===null;let S;e[9]!==c?(S=c("Form"),e[9]=c,e[10]=S):S=e[10];let C;e[11]!==b||e[12]!==N||e[13]!==S?(C=d("button",{"aria-pressed":b,className:De,"data-testid":"db-editor-form",disabled:N,onClick:y,type:"button",children:S}),e[11]=b,e[12]=N,e[13]=S,e[14]=C):C=e[14];const k=!b;let M;e[15]!==c?(M=c("JSON"),e[15]=c,e[16]=M):M=e[16];let R;e[17]!==M||e[18]!==k?(R=d("button",{"aria-pressed":k,className:De,"data-testid":"db-editor-json",onClick:T,type:"button",children:M}),e[17]=M,e[18]=k,e[19]=R):R=e[19];let _;e[20]!==R||e[21]!==C?(_=E("div",{className:"flex items-center gap-1.5",children:[C,R]}),e[20]=R,e[21]=C,e[22]=_):_=e[22];let $;e[23]!==n||e[24]!==o||e[25]!==f||e[26]!==g||e[27]!==w||e[28]!==r||e[29]!==b||e[30]!==c?($=b?d("div",{className:"flex flex-col gap-3","data-testid":"db-editor-fields",children:Object.entries(f).map(V=>{const[J,q]=V;return d(fs,{column:J,meta:n?.[J],onChange:g,target:r?.[J],value:q},J)})}):d("textarea",{"aria-label":c("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:w,value:o}),e[23]=n,e[24]=o,e[25]=f,e[26]=g,e[27]=w,e[28]=r,e[29]=b,e[30]=c,e[31]=$):$=e[31];let I;e[32]!==c?(I=c("Save"),e[32]=c,e[33]=I):I=e[33];let F;e[34]!==l||e[35]!==I?(F=d("button",{className:De,"data-testid":"db-editor-save",onClick:l,type:"button",children:I}),e[34]=l,e[35]=I,e[36]=F):F=e[36];let P;e[37]!==c?(P=c("Cancel"),e[37]=c,e[38]=P):P=e[38];let z;e[39]!==t||e[40]!==P?(z=d("button",{className:De,"data-testid":"db-editor-cancel",onClick:t,type:"button",children:P}),e[39]=t,e[40]=P,e[41]=z):z=e[41];let j;e[42]!==F||e[43]!==z?(j=E("div",{className:"flex items-center gap-1.5",children:[F,z]}),e[42]=F,e[43]=z,e[44]=j):j=e[44];let O;return e[45]!==_||e[46]!==$||e[47]!==j?(O=E("div",{className:"flex flex-col gap-2 border border-border bg-card p-3","data-testid":"db-editor",children:[_,$,j]}),e[45]=_,e[46]=$,e[47]=j,e[48]=O):O=e[48],O};function gs(s){return d("option",{value:s,children:s},s)}const ps=s=>{const e=B(69),{columns:n,editable:o,filter:t,filters:i,hasMaskedColumns:l,liveError:r,maskOn:c,onAddRow:a,onBulkDelete:f,onBulkPatch:m,onAskAiFilter:p,onClearTable:b,onFilterChange:u,onFiltersChange:g,onGenerateRows:h,onShowJson:w,onShowTable:v,onToggleMask:y,total:x,viewMode:T}=s,N=he(),S=T==="table";let C;e[0]!==v||e[1]!==S?(C=d("button",{"aria-pressed":S,className:De,"data-testid":"db-view-table",onClick:v,type:"button",children:"Table"}),e[0]=v,e[1]=S,e[2]=C):C=e[2];const k=T==="json";let M;e[3]!==w||e[4]!==k?(M=d("button",{"aria-pressed":k,className:De,"data-testid":"db-view-json",onClick:w,type:"button",children:"JSON"}),e[3]=w,e[4]=k,e[5]=M):M=e[5];let R;e[6]!==r||e[7]!==N?(R=r===void 0?N("Live — changes stream in automatically"):N("Live unavailable: {liveError}",{liveError:r}),e[6]=r,e[7]=N,e[8]=R):R=e[8];const _=`size-1.5 rounded-full ${r===void 0?"bg-success":"bg-muted-foreground/50"}`;let $;e[9]!==_?($=d("span",{"aria-hidden":"true",className:_}),e[9]=_,e[10]=$):$=e[10];let I;e[11]!==r||e[12]!==N?(I=N(r===void 0?"Live":"Live unavailable"),e[11]=r,e[12]=N,e[13]=I):I=e[13];let F;e[14]!==R||e[15]!==$||e[16]!==I?(F=E("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:R,children:[$,I]}),e[14]=R,e[15]=$,e[16]=I,e[17]=F):F=e[17];let P;e[18]!==l||e[19]!==c||e[20]!==y||e[21]!==N?(P=l&&d("button",{"aria-pressed":c,className:De,"data-testid":"db-mask-toggle",onClick:y,type:"button",children:N("Mask sensitive columns")}),e[18]=l,e[19]=c,e[20]=y,e[21]=N,e[22]=P):P=e[22];let z;e[23]!==o||e[24]!==a?(z=o&&d("button",{className:De,"data-testid":"db-add-row",onClick:a,type:"button",children:"Add row"}),e[23]=o,e[24]=a,e[25]=z):z=e[25];let j;e[26]!==o||e[27]!==h||e[28]!==N?(j=o&&d("button",{className:De,"data-testid":"db-generate-rows",onClick:h,type:"button",children:N("Generate rows")}),e[26]=o,e[27]=h,e[28]=N,e[29]=j):j=e[29];let O;e[30]!==o||e[31]!==t||e[32]!==i||e[33]!==f||e[34]!==x?(O=o&&x>0&&(t!==""||i.length>0)&&d(Mt,{confirmLabel:`Delete ${x.toString()} matching?`,onConfirm:f,testId:"db-bulk-delete",children:`Delete ${x.toString()} matching`}),e[30]=o,e[31]=t,e[32]=i,e[33]=f,e[34]=x,e[35]=O):O=e[35];let V;e[36]!==o||e[37]!==t||e[38]!==i||e[39]!==m||e[40]!==N||e[41]!==x?(V=o&&x>0&&(t!==""||i.length>0)&&d("button",{className:De,"data-testid":"db-bulk-patch",onClick:m,type:"button",children:N("Set column on {total} matching",{total:x.toString()})}),e[36]=o,e[37]=t,e[38]=i,e[39]=m,e[40]=N,e[41]=x,e[42]=V):V=e[42];let J;e[43]!==o||e[44]!==t||e[45]!==i||e[46]!==b||e[47]!==x?(J=o&&x>0&&t===""&&i.length===0&&d(Mt,{confirmLabel:`Clear all ${x.toString()} rows?`,onConfirm:b,testId:"db-clear-table",children:`Clear table (${x.toString()})`}),e[43]=o,e[44]=t,e[45]=i,e[46]=b,e[47]=x,e[48]=J):J=e[48];let q;e[49]!==P||e[50]!==z||e[51]!==j||e[52]!==O||e[53]!==V||e[54]!==J||e[55]!==C||e[56]!==M||e[57]!==F?(q=E("div",{className:"flex flex-wrap items-center gap-1.5",children:[C,M,F,P,z,j,O,V,J]}),e[49]=P,e[50]=z,e[51]=j,e[52]=O,e[53]=V,e[54]=J,e[55]=C,e[56]=M,e[57]=F,e[58]=q):q=e[58];let Y;e[59]!==n||e[60]!==t||e[61]!==i||e[62]!==p||e[63]!==u||e[64]!==g?(Y=d(Xn,{columns:n,filters:i,onAskAi:p,onFiltersChange:g,onSearchChange:u,search:t}),e[59]=n,e[60]=t,e[61]=i,e[62]=p,e[63]=u,e[64]=g,e[65]=Y):Y=e[65];let Z;return e[66]!==q||e[67]!==Y?(Z=E("div",{className:"flex flex-col gap-2","data-testid":"db-view-toggle",children:[q,Y]}),e[66]=q,e[67]=Y,e[68]=Z):Z=e[68],Z},bs=s=>{const e=B(108),{assistant:n,backRelations:o,browser:t,columnMeta:i,edit:l,editable:r,onAskAiFilter:c,onInspect:a,onOpenBulkPatch:f,onOpenGenerateRows:m,onRowDelete:p,onSaveQuery:b,page:u,preferences:g,queryBar:h,references:w}=s,v=g.maskColumns.size>0,y=n.unavailable?void 0:c;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]!==r||e[14]!==f||e[15]!==m||e[16]!==g.maskOn||e[17]!==g.onToggleMask||e[18]!==v||e[19]!==y?(x=d(ps,{columns:t.columns,editable:r,filter:t.filter,filters:t.filters,hasMaskedColumns:v,liveError:t.liveError,maskOn:g.maskOn,onAddRow:t.addRow,onAskAiFilter:y,onBulkDelete:t.bulkDelete,onBulkPatch:f,onClearTable:t.clearTable,onFilterChange:t.onFilterChange,onFiltersChange:t.onFiltersChange,onGenerateRows:m,onShowJson:t.showJson,onShowTable:t.showTable,onToggleMask:g.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]=r,e[14]=f,e[15]=m,e[16]=g.maskOn,e[17]=g.onToggleMask,e[18]=v,e[19]=y,e[20]=x):x=e[20];let T;e[21]!==b||e[22]!==h?(T=h!==void 0&&d(ns,{onApply:h.onApplyQuery,onCopyLink:h.onCopyLink,onDelete:h.onDeleteQuery,onSave:b,saved:h.saved}),e[21]=b,e[22]=h,e[23]=T):T=e[23];let N;e[24]!==o||e[25]!==t.onBulkDeleteSelected||e[26]!==t.selectedTable||e[27]!==t.table||e[28]!==t.viewMode||e[29]!==r||e[30]!==u||e[31]!==g.maskView||e[32]!==g.onToggleTranspose||e[33]!==g.transposed?(N=t.viewMode==="table"&&u.rows.length>0&&d(Zn,{backRelations:o.available,columns:u.columns,editable:r,enabledBackRelations:o.enabled,name:t.selectedTable??"export",onBulkDelete:t.onBulkDeleteSelected,onToggleBackRelation:o.onToggle,onToggleTranspose:g.onToggleTranspose,rows:vt(u.rows,g.maskView),table:t.table.table,transposed:g.transposed}),e[24]=o,e[25]=t.onBulkDeleteSelected,e[26]=t.selectedTable,e[27]=t.table,e[28]=t.viewMode,e[29]=r,e[30]=u,e[31]=g.maskView,e[32]=g.onToggleTranspose,e[33]=g.transposed,e[34]=N):N=e[34];let S;e[35]!==t.cancelEdit||e[36]!==t.editing||e[37]!==t.saveEdit||e[38]!==t.setEditorDocumentText||e[39]!==i||e[40]!==r||e[41]!==u?(S=r&&t.editing!==null&&d(ms,{columnMeta:i,documentText:t.editing.docText,onCancel:t.cancelEdit,onDocumentTextChange:t.setEditorDocumentText,onSave:t.saveEdit,refs:u.refs}),e[35]=t.cancelEdit,e[36]=t.editing,e[37]=t.saveEdit,e[38]=t.setEditorDocumentText,e[39]=i,e[40]=r,e[41]=u,e[42]=S):S=e[42];let C;e[43]!==t.committing||e[44]!==t.discardStaged||e[45]!==t.onCommitStaged||e[46]!==t.stagedChanges||e[47]!==r?(C=r&&t.stagedChanges.length>0&&d(wo,{changes:t.stagedChanges,committing:t.committing,onCommit:t.onCommitStaged,onDiscard:t.discardStaged}),e[43]=t.committing,e[44]=t.discardStaged,e[45]=t.onCommitStaged,e[46]=t.stagedChanges,e[47]=r,e[48]=C):C=e[48];let k;e[49]!==t.writeError?(k=t.writeError!==null&&d("p",{className:"text-sm text-destructive","data-testid":"db-write-error",role:"alert",children:t.writeError}),e[49]=t.writeError,e[50]=k):k=e[50];let M;e[51]!==t.writeNotice?(M=t.writeNotice!==null&&d("p",{className:"text-sm text-muted-foreground","data-testid":"db-write-notice",role:"status",children:t.writeNotice}),e[51]=t.writeNotice,e[52]=M):M=e[52];let R;e[53]!==x||e[54]!==T||e[55]!==N||e[56]!==S||e[57]!==C||e[58]!==k||e[59]!==M?(R=E("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3",children:[x,T,N,S,C,k,M]}),e[53]=x,e[54]=T,e[55]=N,e[56]=S,e[57]=C,e[58]=k,e[59]=M,e[60]=R):R=e[60];let _;e[61]!==t.viewMode||e[62]!==u?(_=t.viewMode==="table"&&u.rows.length===0&&d("div",{className:"flex flex-1 items-center justify-center p-6",children:d(qn,{description:"Rows you insert into this table will show up here.",icon:d("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:d("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"})}),testId:"db-empty-rows",title:"This table is empty."})}),e[61]=t.viewMode,e[62]=u,e[63]=_):_=e[63];let $;e[64]!==t.viewMode||e[65]!==u||e[66]!==g.maskView||e[67]!==g.transposed?($=t.viewMode==="table"&&u.rows.length>0&&g.transposed&&d(Yn,{columns:u.columns,rows:vt(u.rows,g.maskView)}),e[64]=t.viewMode,e[65]=u,e[66]=g.maskView,e[67]=g.transposed,e[68]=$):$=e[68];let I;e[69]!==o||e[70]!==t.filter||e[71]!==t.onRowEdit||e[72]!==t.table||e[73]!==t.viewMode||e[74]!==i||e[75]!==l||e[76]!==r||e[77]!==a||e[78]!==p||e[79]!==u||e[80]!==g.maskView||e[81]!==g.onTogglePin||e[82]!==g.pinnedColumns||e[83]!==g.transposed||e[84]!==w?(I=t.viewMode==="table"&&u.rows.length>0&&!g.transposed&&d(Wo,{backRelationCounts:o.counts,columnMeta:i,edit:l,editable:r,highlight:t.filter,mask:g.maskView,onDelete:p,onEdit:t.onRowEdit,onInspect:a,onTogglePin:g.onTogglePin,pinnedColumns:g.pinnedColumns,refs:w,tableModel:t.table}),e[69]=o,e[70]=t.filter,e[71]=t.onRowEdit,e[72]=t.table,e[73]=t.viewMode,e[74]=i,e[75]=l,e[76]=r,e[77]=a,e[78]=p,e[79]=u,e[80]=g.maskView,e[81]=g.onTogglePin,e[82]=g.pinnedColumns,e[83]=g.transposed,e[84]=w,e[85]=I):I=e[85];let F;e[86]!==t.viewMode||e[87]!==u||e[88]!==g.maskView?(F=t.viewMode==="json"&&d("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(vt(u.rows,g.maskView),Dn,2)}),e[86]=t.viewMode,e[87]=u,e[88]=g.maskView,e[89]=F):F=e[89];let P;e[90]!==t.changePageSize||e[91]!==t.goNext||e[92]!==t.goPrevious||e[93]!==t.hasNext||e[94]!==t.hasPrevious||e[95]!==t.jumpToPage||e[96]!==t.pageSize||e[97]!==t.rangeEnd||e[98]!==t.rangeStart||e[99]!==t.total?(P=d("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:d(Pn,{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[90]=t.changePageSize,e[91]=t.goNext,e[92]=t.goPrevious,e[93]=t.hasNext,e[94]=t.hasPrevious,e[95]=t.jumpToPage,e[96]=t.pageSize,e[97]=t.rangeEnd,e[98]=t.rangeStart,e[99]=t.total,e[100]=P):P=e[100];let z;return e[101]!==R||e[102]!==_||e[103]!==$||e[104]!==I||e[105]!==F||e[106]!==P?(z=E("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"db-page",children:[R,_,$,I,F,P]}),e[101]=R,e[102]=_,e[103]=$,e[104]=I,e[105]=F,e[106]=P,e[107]=z):z=e[107],z},hs="/__lunora/seed",St=200,xs=50,vs=(s,e)=>{const n=[];for(const o of s)o.pk!==!0&&o.ref!==void 0&&o.type==="id"&&(e[o.ref]??[]).length===0&&n.push(o.name);return n},ws=async s=>{const e=await fetch(hs,{body:JSON.stringify(s),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)})`}},ys="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",Cs="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",Ns=({columns:s,fkPools:e,onClose:n,onInsertRows:o,table:t})=>{const i=he(),[l,r]=D(10),[c,a]=D(!1),[f,m]=D(void 0),[p,b]=D(void 0),[u,g]=D(0),h=x=>{const T=Number(x.target.value);!Number.isNaN(T)&&T>=1&&r(Math.min(T,St))},w=async()=>{m(void 0),b(void 0),g(0),a(!0);try{const x=await ws({count:l,existingIds:e,seed:Date.now(),table:t});if(x.kind==="error"){m(x.message);return}const{rows:T}=x;if(T.length===0){m(i("No rows generated — all columns were skipped."));return}const N=await o(T);if(N.error!==void 0){m(N.error);return}b(N.inserted),g(N.conflicts);const S=vs(s,e);S.length>0&&m(i("Inserted {count} rows. Skipped FK columns: {cols}",{cols:S.join(", "),count:N.inserted.toString()}))}finally{a(!1)}},v=()=>{Ce(w())},y=s.filter(x=>x.pk!==!0);return E(dt,{label:i("Generate dummy rows"),onClose:n,panelTestId:"gen-rows-panel",testId:"gen-rows-overlay",variant:"dialog",children:[E("div",{className:"flex items-start justify-between",children:[E("div",{className:"flex flex-col gap-0.5",children:[d("h3",{className:"text-base text-foreground","data-testid":"gen-rows-title",children:i("Generate dummy rows")}),d("p",{className:"text-xs text-muted-foreground","data-testid":"gen-rows-desc",children:i("Seed {table} with Faker-generated rows. Existing rows are not affected.",{table:t})})]}),d("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"gen-rows-close",onClick:n,type:"button",children:i("Close")})]}),E("div",{className:"flex items-center gap-2",children:[d("label",{className:"text-xs font-medium text-foreground",htmlFor:"gen-rows-count",children:i("Row count")}),d("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:St,min:1,onChange:h,type:"number",value:l}),d("span",{className:"text-xs text-muted-foreground",children:i("(max {max})",{max:St.toString()})})]}),y.length>0&&E("div",{className:"flex flex-col gap-1",children:[d("p",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:i("Columns to seed")}),d("ul",{className:"flex flex-col gap-0.5","data-testid":"gen-rows-columns",children:y.map(x=>{const T=x.ref!==void 0&&x.type==="id",N=T&&(e[x.ref??""]??[]).length===0,S=N?"rounded bg-destructive/10 px-1 text-destructive":"rounded bg-muted px-1 text-muted-foreground",C=N?`gen-rows-fk-empty-${x.name}`:`gen-rows-fk-ok-${x.name}`,k=N?i("FK: no rows in {ref} — will skip",{ref:x.ref??""}):i("→ {ref}",{ref:x.ref??""});return E("li",{className:"flex items-center gap-1.5 font-mono text-xs",children:[d("span",{className:"text-foreground",children:x.name}),E("span",{className:"text-muted-foreground",children:["(",x.type,")"]}),x.optional&&d("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:"optional"}),T&&d("span",{className:S,"data-testid":C,children:k})]},x.name)})})]}),f!==void 0&&d("p",{className:"text-xs text-destructive","data-testid":"gen-rows-error",role:"alert",children:f}),p!==void 0&&f===void 0&&d("p",{className:"text-xs text-success","data-testid":"gen-rows-success",children:u>0?i("Inserted {inserted} of {total} rows — {conflicts} skipped as id conflicts.",{conflicts:u.toString(),inserted:p.toString(),total:(p+u).toString()}):i("Inserted {count} rows successfully.",{count:p.toString()})}),E("div",{className:"flex justify-end gap-2",children:[d("button",{className:ys,"data-testid":"gen-rows-cancel",onClick:n,type:"button",children:i("Cancel")}),d("button",{className:Cs,"data-testid":"gen-rows-generate",disabled:c,onClick:v,type:"button",children:i(c?"Inserting…":"Generate & insert")})]})]})},Ss=Te(pe.backRelationCounts),ks=(s,e,n,o)=>{const t=B(16),i=ct();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={},t[0]=l):l=t[0];const[r,c]=D(l);let a;if(t[1]!==s||t[2]!==e){let w;t[4]!==s?(w=v=>s.has($t(v)),t[4]=s,t[5]=w):w=t[5],a=e.filter(w),t[1]=s,t[2]=e,t[3]=a}else a=t[3];const f=a;let m;t[6]!==n||t[7]!==f?(m=JSON.stringify([f,n]),t[6]=n,t[7]=f,t[8]=m):m=t[8];const p=m;let b;t[9]!==i||t[10]!==o||t[11]!==p?(b=async w=>{const[v,y]=JSON.parse(p);if(v.length===0||y.length===0){w.cancelled||c({});return}try{const x=await i.query(Ss,{ids:y,relations:v},ke(o));w.cancelled||c(Object.fromEntries(x.relations.map(Ts)))}catch{}},t[9]=i,t[10]=o,t[11]=p,t[12]=b):b=t[12];const u=b;let g,h;return t[13]!==u?(g=()=>{const w={cancelled:!1};return Ce(u(w)),()=>{w.cancelled=!0}},h=[u],t[13]=u,t[14]=g,t[15]=h):(g=t[14],h=t[15]),Be(g,h),r};function Ts(s){return[$t(s),s.counts]}const Es=async s=>{const{args:e,maxBatches:n,openCursor:o,query:t}=s;let i=o,l=0,r="cap-hit";for(let c=0;c<n;c+=1){const a=await t({...e,after:i});if(l+=a.count,i=a.cursor,!a.hasMore){r="completed";break}}return{cursor:r==="cap-hit"?i:void 0,outcome:r,written:l}},rt=s=>{const e=s[0];return e===void 0?void 0:{column:e.id,direction:e.desc?"desc":"asc"}},sn=s=>s==null?"":typeof s=="object"?JSON.stringify(s):String(s),Gt=s=>s.map(e=>({column:e.column,operator:e.operator,value:e.value===void 0?"":sn(e.value)})),Kt=s=>s===void 0?[]:[{desc:s.direction==="desc",id:s.column}],_s=s=>[s.column,s.operator,s.value],st=(s,e,n,o)=>JSON.stringify([s??"",e??"",(n??[]).map(t=>_s(t)),o===void 0?null:[o.column,o.direction]]),It=200,Rs=20,$s=Te(pe.readTablePage),Ds=Te(pe.facetColumn),kt=Te(pe.writeRow),Is=Te(pe.deleteRows),As=Te(pe.clearTable),Ps=Te(pe.patchRows),Ms={},At=new Set(["__doc__","__id__","_creationTime","_id","id"]),Os=s=>{const e=s.__doc__;if(typeof e=="string"){const o=zn(e);if(o!==void 0)return o}const n={};for(const[o,t]of Object.entries(s))At.has(o)||(n[o]=t);return n},Fs=(s,e,n)=>JSON.stringify([s.__lunoraRef,n,Qt(e)]),Ls=({filters:s,offset:e,pageSize:n,search:o,sorting:t,table:i})=>({filters:Ve(s),limit:n,offset:e,orderBy:rt(t),search:o,skipCount:!0,table:i}),Vs=({filters:s,search:e,table:n})=>({filters:Ve(s),limit:1,search:e,table:n}),Bs=(s,e)=>{const n=new Map;for(const t of s?.rows??[]){const i=Ie(t);i!==null&&n.set(i,t)}const o=[];for(const[t,i]of Object.entries(e))for(const[l,r]of Object.entries(i))o.push({column:l,newValue:r,oldValue:n.get(t)?.[l],rowId:t});return o},zs=s=>!At.has(s),js=`Stopped after ${It.toString()} batches — rows still match. Run it again to remove the rest.`,qs=`Stopped after ${It.toString()} batches — rows still match. Run it again to set the rest.`,Jt={resumable:!1,truncated:js,verb:"deleted"},Gs={resumable:!0,truncated:qs,verb:"written"},Ks=({initialFilters:s,initialOrderBy:e,initialSearch:n,initialShardKey:o,onSelectTable:t,onViewChange:i,pageSize:l,resolveBackRelations:r,tableParam:c})=>{const a=ct(),[f,m]=D(l),[p,b]=D(o??""),u=c===void 0||c===""?null:c,[g,h]=D(0),[w,v]=D("table"),[y,x]=D(()=>Kt(e)),[T,N]=D(n??""),[S,C]=D(()=>Gt(s??[])),{clearFacets:k,facets:M,refetchFacets:R,toggleFacet:_}=Mn(),[$,I]=D(null),[F,P]=D(null),[z,j]=D(null),O=Je(null),V=vo(),[J,q]=D(null),[Y,Z]=D(!1),[se,fe]=D(c),[te,ce]=D(()=>st(o,n,s,e)),[de,me]=D(0),[le,ue]=D(()=>st(o,n,s,e)),re=c!==se,Q=st(o,n,s,e),ee=re||!re&&Q!==te&&Q!==le;if(ee){fe(c),ce(Q),me(G=>G+1),x(Kt(e)),N(n??"");const A=Gt(s??[]);C(A),b(o??""),k(),V.clear(),q(null),h(0),P(null),j(null),O.current=null}else Q!==te&&ce(Q);const xe=ee?n??"":T,ae=ee?o??"":p,ie=`${c??""}:${de.toString()}`,U=Ot(xe.trim(),300,ie),K=Ot(ae.trim(),400,ie),X=st(K,U,Ve(S),rt(y));X!==le&&ue(X);const W=Xe(pe.listTables,Ms,{live:!0,shardKey:K}),ve=W.data??null,ge=W.error,we=Ls({filters:S,offset:g,pageSize:f,search:U,sorting:y,table:u??""}),ye=Vs({filters:S,search:U,table:u??""}),H=Xe(pe.readTablePage,we,{enabled:u!==null,keepPreviousData:!1,live:!0,shardKey:K}),ne=H.data??null,Me=H.error,{liveError:Ae}=H,Pe=Xe(pe.readTablePage,ye,{enabled:u!==null,live:!0,shardKey:K});Be(()=>{W.data!==void 0&&to(K)},[W.data,K]);const He=A=>{t?.(A)},Se=(A,G)=>{t?.(A,{search:G})},je=async(A,G)=>{try{return(await a.query($s,{filters:[],limit:Rs,offset:0,search:G,table:A},ke(K))).rows.find(_e=>Ie(_e)===G)??null}catch{return null}},Oe=(A,G,Ne,_e)=>$e=>a.query(Ds,{column:$e,filters:Ve(Ne),search:_e,table:G},ke(A)),Ue=A=>{_(A,u===null?null:Oe(K,u,S,U))},ut=(A,G)=>{const Ne=sn(G);C(_e=>[..._e.filter($e=>$e.column!==A),{column:A,operator:"eq",value:Ne}]),h(0)},ft=wt(Oe),et=wt(R),tt=wt(i);Be(()=>{u!==null&&et.current(ft.current(K,u,S,U))},[K,u,S,U]),Be(()=>{u===null||tt.current===void 0||se!==c||te!==Q||tt.current({filters:Ve(S),orderBy:rt(y),search:U,shard:K})},[u,c,se,te,Q,S,y,U,K]);const Qe=A=>{u!==null&&h(Math.max(0,A))},nt=(A,G)=>{q({column:G,rowId:A})},mt=()=>{q(null)},gt=async()=>{if(u!==null){P(null),Z(!0);try{for(const[A,G]of Object.entries(V.staged))await a.query(kt,{doc:G,id:A,op:"patch",table:u},ke(K));V.clear(),q(null),H.refetch()}catch(A){P(A.message)}Z(!1)}},pt=()=>{V.clear(),q(null)},bt=Bs(ne,V.staged),ot=async(A,G,Ne)=>{if(u===null)return;P(null);let _e;if(A!=="delete"){let $e;try{$e=Ne===void 0||Ne.trim()===""?{}:JSON.parse(Ne)}catch(Le){P(`Invalid JSON: ${Le.message}`);return}try{const Le=Ut($e);if(!Bn(Le)){P("The document must be a JSON object.");return}_e=Le}catch(Le){P(`Invalid document: ${Le.message}`);return}}try{await a.query(kt,{doc:_e,id:G??void 0,op:A,table:u},ke(K)),I(null),H.refetch()}catch($e){P($e.message)}},Ye=async(A,G,Ne)=>{if(u===null)return 0;P(null),j(null);const _e=Fs(A,G,K),$e=O.current?.key===_e?O.current.after:void 0,Le=Ne.resumable?$e??"":void 0;let qe=0;try{const Ge=await Es({args:G,maxBatches:It,openCursor:Le,query:async Rn=>await a.query(A,Rn,ke(K))});return qe=Ge.written,O.current=Ge.cursor===void 0?null:{after:Ge.cursor,key:_e},Ge.outcome==="cap-hit"&&P(Ne.truncated),j(`${qe.toString()} ${qe===1?"row":"rows"} ${Ne.verb}.`),qe}catch(Ge){return P(`${Ge.message} (at least ${qe.toString()} rows were already ${Ne.verb})`),O.current=null,qe}finally{h(0),H.refetch()}},ht=A=>{x(A),h(0)},L=Tt(()=>u===null?[]:r?.(u)??[],[r,u]),oe=Ho(ne,y,ht,L),Ee={filters:Ve(S),orderBy:rt(y),search:U,shard:p,table:u??void 0},Re=Pe.data?.total??(ne===null?0:g+ne.rows.length),Fe=g>0,xt=ne!==null&&g+ne.rows.length<Re,ln=ne===null||ne.rows.length===0?0:g+1,rn=ne===null?0:g+ne.rows.length,an=()=>{W.refetch()},cn=()=>{v("table")},dn=()=>{v("json")},un=()=>{Ce(Ye(Is,{filters:Ve(S),search:U,table:u},Jt))},fn=()=>{Ce(Ye(As,{table:u},Jt))},mn=A=>{Ce(Ye(Ps,{doc:A,filters:Ve(S),search:U,table:u},Gs))},gn=A=>{N(A.target.value),h(0)},pn=A=>{C(A),h(0)},bn=()=>{P(null);const A={};for(const G of ne?.columns??[])At.has(G)||(A[G]="");I({docText:JSON.stringify(A,null,2),id:""})},hn=A=>{I(G=>G===null?G:{docText:A,id:G.id})},xn=()=>{$!==null&&Ce(ot($.id===""?"insert":"patch",$.id===""?null:$.id,$.docText))},vn=()=>{I(null),P(null)},wn=()=>{Qe(g-f)},yn=()=>{Qe(g+f)},Cn=A=>{Qe(Math.max(0,(A-1)*f))},Nn=A=>{m(A),h(0)},Sn=(A,G)=>{P(null),I({docText:JSON.stringify(Qt(Os(G)),null,2),id:A})},kn=A=>{Ce(ot("delete",A))},Tn=async A=>{if(!(u===null||A.length===0)){P(null);try{for(const G of A)await a.query(kt,{id:G,op:"delete",table:u},ke(K));H.refetch()}catch(G){P(G.message)}}},En=A=>{Ce(Tn(A))},_n=()=>{Ce(gt())};return{addRow:bn,bulkDelete:un,bulkPatch:mn,cancelCellEdit:mt,cancelEdit:vn,changePageSize:Nn,clearTable:fn,columns:ne?.columns??[],committing:Y,currentView:Ee,discardStaged:pt,editableColumn:zs,editing:$,editingCell:J,facetFilter:ut,facets:M,filter:T,filters:S,goNext:yn,goPrevious:wn,hasNext:xt,hasPrevious:Fe,jumpToPage:Cn,liveError:Ae,loadTables:an,navigateToRef:Se,onBulkDeleteSelected:En,onCommitStaged:_n,onFilterChange:gn,onFiltersChange:pn,onRowDelete:kn,onRowEdit:Sn,page:ne,previewRef:je,pageError:Me,pageSize:f,rangeEnd:rn,rangeStart:ln,queryShardKey:K,saveEdit:xn,selectedTable:u,selectTable:He,setEditorDocumentText:hn,setShardKey:b,shardKey:p,showJson:dn,showTable:cn,stage:V.stage,stagedChanges:bt,stagedValue:V.stagedValue,startCellEdit:nt,table:oe,tables:ve,tablesError:ge,toggleFacet:Ue,total:Re,viewMode:w,writeError:F,writeNotice:z}},Js="lunora-studio-pinned-columns",Ws=s=>{const e=B(21),{columns:n,initialPins:o,selectedTable:t}=s;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];const[l,r]=Wt(Js,i),c=t??"",a=l[c];let f;e[1]!==o||e[2]!==a?(f=a===void 0?new Set((o??"").split(",").filter(Hs)):new Set(a),e[1]=o,e[2]=a,e[3]=f):f=e[3];const m=f;let p;e[4]!==c||e[5]!==m||e[6]!==r?(p=k=>{r(M=>{const R=M[c]??[...m],_=R.includes(k)?R.filter($=>$!==k):[...R,k];return{...M,[c]:_}})},e[4]=c,e[5]=m,e[6]=r,e[7]=p):p=e[7];const b=p,[u,g]=D(!1);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{g(Us)},e[8]=h):h=e[8];const w=h;let v;e[9]!==n||e[10]!==t?(v={columns:n,selectedTable:t},e[9]=n,e[10]=t,e[11]=v):v=e[11];const{maskColumns:y,maskOn:x,maskView:T,maskViewFor:N,onToggleMask:S}=On(v);let C;return e[12]!==y||e[13]!==x||e[14]!==T||e[15]!==N||e[16]!==S||e[17]!==b||e[18]!==m||e[19]!==u?(C={maskColumns:y,maskOn:x,maskView:T,maskViewFor:N,onToggleMask:S,onTogglePin:b,onToggleTranspose:w,pinnedColumns:m,transposed:u},e[12]=y,e[13]=x,e[14]=T,e[15]=N,e[16]=S,e[17]=b,e[18]=m,e[19]=u,e[20]=C):C=e[20],C};function Hs(s){return s!==""}function Us(s){return!s}const Qs=Te(pe.describeTable),Ys=Te(pe.readTablePage),Xs=Te(pe.importShard),Zs=s=>{const e=s._id??s.id??s.__id__??"";return typeof e=="string"?e:typeof e=="number"?String(e):""},el=s=>{const e=Object.values(s.inserted).reduce((c,a)=>c+a,0),[n]=s.errors;if(n===void 0)return{conflicts:s.conflicts,error:void 0,inserted:e};const o=s.errors.length-1,t=e+s.conflicts+s.errors.length,i=o===1?"error":"errors",l=o>0?` (+${o.toString()} more ${i})`:"",r=`Inserted ${e.toString()} of ${t.toString()} rows — row ${n.line.toString()} (${n.table}): ${n.message}${l}`;return{conflicts:s.conflicts,error:r,inserted:e}},tl=s=>{const e=ct(),[n,o]=D(!1),[t,i]=D(void 0),[l,r]=D(void 0),[c,a]=D(void 0),[f,m]=D({}),[p,b]=D(!1),[u,g]=D(void 0),h=async(x,T)=>{o(!0),i(x),r(T),a(void 0),m({}),g(void 0),b(!0);try{const N=await e.query(Qs,{table:x},ke(T)),{columns:S}=N;a(S);const C={},k=S.filter(M=>M.ref!==void 0&&M.type==="id"&&M.pk!==!0);for(const M of k){if(M.ref===void 0)continue;const{ref:R}=M;if(C[R]===void 0)try{const _=await e.query(Ys,{filters:[],limit:xs,offset:0,search:"",table:R},ke(T));C[R]=_.rows.flatMap($=>Zs($)||[])}catch{C[R]=[]}}m(C)}catch(N){g(N.message)}b(!1)};return{closeDialog:()=>{o(!1),i(void 0),r(void 0),a(void 0),m({}),g(void 0)},columnMeta:c,error:u,fkPools:f,insertBatch:async(x,T)=>{if(t===void 0||l===void 0)return{conflicts:0,error:"No table selected.",inserted:0};try{const N=await e.query(Xs,{rows:x.map(C=>({doc:C,table:t}))},ke(l)),S=el(N);return S.error!==void 0||(T(),s()),S}catch(N){return{conflicts:0,error:N.message,inserted:0}}},loading:p,open:n,openDialog:(x,T)=>{Ce(h(x,T))},shardKey:l,table:t}},nl=()=>{const s=B(6),[e,n]=D(null);let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{n(null)},s[0]=o):o=s[0];const t=o,[i,l]=D(null);let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r=(p,b)=>{l({column:p,value:b})},s[1]=r):r=s[1];const c=r;let a;s[2]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{l(null)},s[2]=a):a=s[2];const f=a;let m;return s[3]!==i||s[4]!==e?(m={closeExpandedCell:f,closeInspect:t,expandedCell:i,inspecting:e,onExpandCell:c,onInspect:n},s[3]=i,s[4]=e,s[5]=m):m=s[5],m},ol=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,sl=(s,e)=>typeof e=="number"&&ol.test(s),ll=s=>{const e=B(31),{column:n,masked:o,onNavigate:t,target:i,value:l}=s;let r;e[0]!==t||e[1]!==i||e[2]!==l?(r=()=>{i!==void 0&&t(i,String(l))},e[0]=t,e[1]=i,e[2]=l,e[3]=r):r=e[3];const c=r;if(l==null){let m;return e[4]===Symbol.for("react.memo_cache_sentinel")?(m=d("span",{className:"italic text-muted-foreground",children:"null"}),e[4]=m):m=e[4],m}if(o){const m=`rd-masked-${n}`;let p;e[5]!==l?(p=ze(l),e[5]=l,e[6]=p):p=e[6];let b;return e[7]!==m||e[8]!==p?(b=d("span",{className:"italic text-muted-foreground","data-testid":m,title:"Masked (preview)",children:p}),e[7]=m,e[8]=p,e[9]=b):b=e[9],b}if(i!==void 0&&(typeof l=="string"||typeof l=="number")&&String(l)!==""){const m=`rd-ref-${n}`,p=`Open ${i} ${String(l)}`,b=String(l);let u;return e[10]!==c||e[11]!==m||e[12]!==p||e[13]!==b?(u=E("button",{"data-testid":m,onClick:c,title:p,type:"button",children:[b," ↗"]}),e[10]=c,e[11]=m,e[12]=p,e[13]=b,e[14]=u):u=e[14],u}if(sl(n,l)){const m=`rd-ts-${n}`;let p;e[15]!==l?(p=l.toString(),e[15]=l,e[16]=p):p=e[16];let b;e[17]!==l?(b=In(l),e[17]=l,e[18]=b):b=e[18];let u;return e[19]!==m||e[20]!==p||e[21]!==b?(u=d("span",{"data-testid":m,title:p,children:b}),e[19]=m,e[20]=p,e[21]=b,e[22]=u):u=e[22],u}if(typeof l=="object"){let m;e[23]!==l?(m=JSON.stringify(l,null,2),e[23]=l,e[24]=m):m=e[24];let p;return e[25]!==m?(p=d("pre",{className:"m-0 overflow-auto rounded-md bg-muted/50 p-2 text-xs",children:m}),e[25]=m,e[26]=p):p=e[26],p}let a;e[27]!==l?(a=ze(l),e[27]=l,e[28]=a):a=e[28];let f;return e[29]!==a?(f=d("span",{children:a}),e[29]=a,e[30]=f):f=e[30],f},rl=s=>{const e=B(23),{columns:n,mask:o,onClose:t,onNavigate:i,refs:l,row:r}=s;let c;e[0]!==t||e[1]!==i?(c=(g,h)=>{i(g,h),t()},e[0]=t,e[1]=i,e[2]=c):c=e[2];const a=c;let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=d("h3",{className:"m-0 text-base text-foreground",children:"Row detail"}),e[3]=f):f=e[3];let m;e[4]!==t?(m=E("div",{className:"mb-3 flex items-center justify-between",children:[f,d("button",{"data-testid":"rd-close",onClick:t,type:"button",children:"Close"})]}),e[4]=t,e[5]=m):m=e[5];let p;if(e[6]!==n||e[7]!==o||e[8]!==a||e[9]!==l||e[10]!==r){let g;e[12]!==o||e[13]!==a||e[14]!==l||e[15]!==r?(g=h=>E("div",{className:"border-t border-border py-2 first:border-t-0","data-testid":`rd-field-${h}`,children:[d("dt",{className:"mb-0.5 text-xs font-semibold text-muted-foreground",children:h}),d("dd",{className:"m-0",children:d(ll,{column:h,masked:o.enabled&&o.columns.has(h),onNavigate:a,target:l?.[h],value:r[h]})})]},h),e[12]=o,e[13]=a,e[14]=l,e[15]=r,e[16]=g):g=e[16],p=n.map(g),e[6]=n,e[7]=o,e[8]=a,e[9]=l,e[10]=r,e[11]=p}else p=e[11];let b;e[17]!==p?(b=d("dl",{"data-testid":"rd-fields",children:p}),e[17]=p,e[18]=b):b=e[18];let u;return e[19]!==t||e[20]!==m||e[21]!==b?(u=E(dt,{label:"Row detail",onClose:t,panelTestId:"rd-panel",testId:"rd-overlay",variant:"drawer",children:[m,b]}),e[19]=t,e[20]=m,e[21]=b,e[22]=u):u=e[22],u},al=50,il=s=>{const e=B(8),{active:n,onPick:o,shard:t}=s;let i;e[0]!==o||e[1]!==t?(i=()=>{o(t)},e[0]=o,e[1]=t,e[2]=i):i=e[2];const l=i,r=`w-full rounded px-2 py-0.5 text-left text-xs transition-colors hover:bg-accent ${n?"bg-accent font-medium":""}`,c=`shard-explorer-item-${t}`;let a;return e[3]!==l||e[4]!==t||e[5]!==r||e[6]!==c?(a=d("button",{className:r,"data-testid":c,onClick:l,type:"button",children:t}),e[3]=l,e[4]=t,e[5]=r,e[6]=c,e[7]=a):a=e[7],a},cl=({onFetchTables:s,onSelect:e})=>{const n=he(),[o]=D(()=>no()),[t,i]=D(!1),[l,r]=D(void 0),[c,a]=D(void 0),[f,m]=D(!1),[p,b]=D(void 0),u=Je(0),g=()=>{i(v=>!v)},h=async v=>{e(v),r(v),a(void 0),b(void 0),m(!0),u.current+=1;const y=u.current;try{const x=await s(v);u.current===y&&a(x?.slice(0,al))}catch(x){u.current===y&&b(x.message)}u.current===y&&m(!1)},w=v=>{Ce(h(v))};return o.length===0?null:E("div",{"data-testid":"shard-explorer",children:[E("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:g,type:"button",children:[n("Shards seen"),d("span",{"aria-hidden":"true",className:`ml-0.5 transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),t&&E("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:[d("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-hint",children:n("Recently visited shards — click to switch")}),d("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-list",children:o.map(v=>d("li",{children:d(il,{active:l===v,onPick:w,shard:v})},v))}),l!==void 0&&E("div",{className:"mt-1 border-t border-border pt-1","data-testid":"shard-explorer-summary",children:[d("p",{className:"mb-1 text-xs font-medium text-foreground","data-testid":"shard-explorer-summary-title",children:n("{shard} tables",{shard:l})}),f&&d("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-loading",children:n("Loading…")}),p!==void 0&&d("p",{className:"text-xs text-destructive","data-testid":"shard-explorer-error",role:"alert",children:p}),!f&&p===void 0&&c?.length===0&&d("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-empty",children:n("No tables in this shard.")}),!f&&p===void 0&&c!==void 0&&c.length>0&&d("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-tables",children:c.map(v=>E("li",{className:"flex items-center justify-between text-xs",children:[d("span",{"data-testid":`shard-explorer-table-${v.name}`,children:v.name}),d("span",{className:"text-muted-foreground","data-testid":`shard-explorer-rowcount-${v.name}`,children:v.rowCount})]},v.name))})]})]})]})},dl="lunora-studio-back-relations",ul=s=>new Set((s??[]).filter(e=>e.unique===!0&&e.fields.length===1).map(e=>e.fields[0]??"")),fl={},ml=50,gl=[],pl=Te(pe.listTables),bl=Te(pe.readTablePage),hl=s=>{const e=B(10),{onFetchShardTables:n,onShardChange:o,schemaSwitch:t,shardKey:i}=s;let l;e[0]!==o||e[1]!==i?(l=d($n,{onChange:o,testId:"db-shard-input",value:i}),e[0]=o,e[1]=i,e[2]=l):l=e[2];let r;e[3]!==n||e[4]!==o?(r=d(cl,{onFetchTables:n,onSelect:o}),e[3]=n,e[4]=o,e[5]=r):r=e[5];let c;return e[6]!==t||e[7]!==l||e[8]!==r?(c=E("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[t,l,r]}),e[6]=t,e[7]=l,e[8]=r,e[9]=c):c=e[9],c},Hl=({editable:s=!1,globalTableNames:e,initialFilters:n,initialOrderBy:o,initialPins:t,initialSearch:i,initialShardKey:l,onNavigateToGlobal:r,onSelectTable:c,onViewChange:a,pageSize:f=ml,queryBar:m,schemaSwitch:p,tableParam:b})=>{const u=Xe(pe.describeTables,{},{shardKey:l??""}),g=Xe(pe.listTablesIndexes,{},{shardKey:l??""}),h=u.data?.columnsByTable??fl,[w,v]=Wt(dl,{}),y=at(L=>{const oe=new Set(w[L]);return Ft(L,h).filter(Ee=>oe.has($t(Ee)))},[w,h]),x=Ks({initialFilters:n,initialOrderBy:o,initialSearch:i,initialShardKey:l,onSelectTable:c,onViewChange:a,pageSize:f,resolveBackRelations:y,tableParam:b}),{cancelCellEdit:T,columns:N,currentView:S,editableColumn:C,editingCell:k,facetFilter:M,facets:R,loadTables:_,navigateToRef:$,onFiltersChange:I,page:F,pageError:P,previewRef:z,queryShardKey:j,selectedTable:O,selectTable:V,setShardKey:J,shardKey:q,stage:Y,stagedValue:Z,startCellEdit:se,tables:fe,tablesError:te,toggleFacet:ce}=x,de=Vn(q),me=L=>{Ce((async()=>{const Ee=await de.suggestFilter(L,O??"");Ee!==void 0&&I(Ee.map(Re=>{const Fe=Re.value,xt=typeof Fe=="string"||typeof Fe=="number"||typeof Fe=="boolean"?String(Fe):"";return{column:Re.column,operator:Re.operator,value:xt}}))})())},le=O===null?[]:Ft(O,h),ue=new Set(w[O??""]),re=[];for(const L of F?.rows??[]){const oe=L._id??L.id;typeof oe=="string"&&oe!==""&&re.push(oe)}const Q=ks(ue,le,re,j),be=L=>{v(oe=>{const Ee=O??"",Re=oe[Ee]??[];return{...oe,[Ee]:Re.includes(L)?Re.filter(Fe=>Fe!==L):[...Re,L]}})},ee=Ws({columns:N,initialPins:t,selectedTable:O}),xe=nl(),[ae,ie]=D(null),{closeExpandedCell:U,closeInspect:K,expandedCell:X,inspecting:W,onExpandCell:ve}=xe,ge=ct(),we=Object.fromEntries((h[O??""]??[]).map(L=>[L.name,L])),ye=new Map;for(const L of h[O??""]??[])L.isStorage===!0&&ye.set(L.name,L.bucket);const H=at(async(L,oe)=>ge.signedStorageUrl(L,oe===void 0?{}:{bucket:oe}),[ge]),ne=async L=>await ge.query(pl,{},ke(L)),Me=()=>{O!==null&&V(O)},{closeDialog:Ae,columnMeta:Pe,fkPools:He,insertBatch:Se,open:je,openDialog:Oe}=tl(Me),Ue=()=>{O!==null&&Oe(O,q)},ut=L=>Se(L,Ae),[ft,et]=D(!1),tt=()=>{et(!0)},Qe=()=>{et(!1)},nt=(L,oe)=>{if(r!==void 0&&e?.has(L)===!0){r(L,oe);return}$(L,oe)},mt=m?.onSaveQuery,gt=L=>{mt?.(L,S)},pt={cancelEdit:T,editable:s,editableColumn:C,editingCell:k,onExpandCell:ve,stage:Y,stagedValue:Z,startEdit:se},bt=L=>{L!==null&&ie(L)},ot=()=>{x.onRowDelete(ae)},Ye=async(L,oe,Ee)=>await ge.query(bl,{filters:[{column:oe,operator:"eq",value:Ee}],limit:lt,offset:0,orderBy:[],table:L},ke(j)),ht={columns:F?.refs,maskViewFor:ee.maskViewFor,onNavigate:nt,onPreview:z};return E("div",{className:"flex h-full min-w-0","data-testid":"lunora-data-browser",children:[d(Fn,{header:d(hl,{onFetchShardTables:ne,onShardChange:J,schemaSwitch:p,shardKey:q}),onReload:_,onSelect:V,prefix:"db",selected:O,tables:fe??gl}),E("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[te!==null&&d("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-tables-error",role:"alert",children:te}),F===null&&P===null&&d("div",{className:"flex flex-1 items-center justify-center p-6",children:d("p",{className:"text-sm text-muted-foreground",children:"Select a table to browse its rows."})}),P!==null&&d("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-page-error",role:"alert",children:P}),F!==null&&d(bs,{assistant:de,backRelations:{available:le,counts:Q,enabled:ue,onToggle:be},browser:x,columnMeta:we,edit:pt,editable:s,onAskAiFilter:me,onInspect:xe.onInspect,onOpenBulkPatch:tt,onOpenGenerateRows:Ue,onRowDelete:bt,onSaveQuery:gt,page:F,preferences:ee,queryBar:m,references:ht})]}),F!==null&&d(Ln,{columns:N,facets:R,mask:ee.maskView,onFacetFilter:M,onToggleFacet:ce}),W!==null&&F!==null&&d(rl,{columns:F.columns,mask:ee.maskView,onClose:K,onNavigate:nt,refs:F.refs,row:Ht(W,ee.maskView)}),ae!==null&&O!==null&&d(bo,{onClose:()=>{ie(null)},onConfirm:ot,readPage:Ye,rowId:ae,schema:oo(h),table:O}),X!==null&&d(eo,{bucket:ye.get(X.column),column:X.column,onClose:U,resolveUrl:ye.has(X.column)?H:void 0,value:X.value}),ft&&O!==null&&d(ro,{columns:x.columns.filter(L=>x.editableColumn(L)),onApply:x.bulkPatch,onClose:Qe,shardKey:x.queryShardKey,table:O,total:x.total,uniqueColumns:ul(g.data?.indexesByTable[O])}),je&&O!==null&&Pe!==void 0&&d(Ns,{columns:Pe,fkPools:He,onClose:Ae,onInsertRows:ut,table:O})]})};export{Hl as DataBrowser};
@@ -1 +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-Cbj2GuHu.mjs";import{useAutoRefresh as me}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";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-BxZm3sBJ.mjs";import{useT as V}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{b as xe}from"./cf-links-CBJ5SywP.mjs";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-D0SBiDu-.mjs";import{a as Te}from"./control-button-BOZ5K-FC.mjs";import{C as q,G as Se}from"./data-grid-BqNXJ9PF.mjs";import{jsx as r,jsxs as F}from"react/jsx-runtime";import{E as Ce}from"./empty-state-D7jEML_T.mjs";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
+ 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-C7JRlFIE.mjs";import{useAutoRefresh as me}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";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-T7--Fv-V.mjs";import{useT as V}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{b as xe}from"./cf-links-CBJ5SywP.mjs";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-D0SBiDu-.mjs";import{a as Te}from"./control-button-BOZ5K-FC.mjs";import{C as q,G as Se}from"./data-grid-BqNXJ9PF.mjs";import{jsx as r,jsxs as F}from"react/jsx-runtime";import{E as Ce}from"./empty-state-D7jEML_T.mjs";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-r_5B4LHP.mjs";import"./card--2hKx4L2.mjs";import"./empty-state-D7jEML_T.mjs";import"./use-admin-query-Cbj2GuHu.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./ADMIN_FUNCTIONS-B6z7VLYt.mjs";import"./internal-CwaF9YNk.mjs";import"./utils-bhneXptQ.mjs";import"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{H,c as f}from"./home-panel-BID7w6j3.mjs";export{H as HomePanel,f as cacheFooterText};
1
+ import"./badge-r_5B4LHP.mjs";import"./card--2hKx4L2.mjs";import"./empty-state-D7jEML_T.mjs";import"./use-admin-query-C7JRlFIE.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import"./internal-CwaF9YNk.mjs";import"./utils-bhneXptQ.mjs";import"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{H,c as f}from"./home-panel-ChKczU0I.mjs";export{H as HomePanel,f as cacheFooterText};
@@ -1 +1 @@
1
- import{c as Ce}from"react/compiler-runtime";import{useLunora as Se}from"@lunora/react";import{useState as Q,useEffect as Ie}from"react";import{ConfirmButton as Ee}from"./ConfirmButton-DU4p72Er.mjs";import{E as Me}from"./error-alert-CczbAfst.mjs";import{L as Te}from"./live-status-BuJdUZFU.mjs";import{ShardInput as _e}from"./ShardInput-C6mjgAh4.mjs";import{B as ke}from"./badge-r_5B4LHP.mjs";import{B as Le}from"./button-q0UYSmrn.mjs";import{C as we,a as De}from"./card--2hKx4L2.mjs";import{E as Be}from"./empty-state-D7jEML_T.mjs";import{I as Ae}from"./input-CXhxesPC.mjs";import{L as ue}from"./label-DKFzyHq6.mjs";import{T as Ke,a as je,b as fe,c as u,d as Fe,e as f}from"./table-D0SBiDu-.mjs";import{u as Oe}from"./use-admin-query-Cbj2GuHu.mjs";import{u as qe}from"./use-shard-key-BsP3o5wT.mjs";import{useT as He}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as he}from"./ADMIN_FUNCTIONS-B6z7VLYt.mjs";import{i as Qe,c as Ue,f as $e,d as ze,b as Ge}from"./internal-CwaF9YNk.mjs";import{r as Pe}from"./shard-history-CaO3C4KQ.mjs";import{jsx as r,jsxs as s}from"react/jsx-runtime";const We=Ue(he.runMigration),yt=i=>{const e=Ce(98),{initialShardKey:pe}=i,re=Se(),t=He(),{queryShardKey:d,setShardKey:ie,shardKey:a}=qe(pe),[h,ge]=Q(""),[p,ye]=Q("up"),[l,be]=Q(!0),[g,ce]=Q(!1),[c,ne]=Q(null),[U,se]=Q(null);let $;e[0]!==a?($=a.trim(),e[0]=a,e[1]=$):$=e[1];const z=$===d;let G;e[2]===Symbol.for("react.memo_cache_sentinel")?(G={},e[2]=G):G=e[2];let P;e[3]!==d?(P={live:!0,shardKey:d},e[3]=d,e[4]=P):P=e[4];const n=Oe(he.migrationStatus,G,P),o=n.data?.migrations??null,ae=n.error,{errorSource:le,liveError:oe}=n;let W,J;e[5]!==d||e[6]!==n.data?(W=()=>{n.data!==void 0&&Pe(d)},J=[n.data,d],e[5]=d,e[6]=n.data,e[7]=W,e[8]=J):(W=e[7],J=e[8]),Ie(W,J);let V;if(e[9]!==re||e[10]!==p||e[11]!==l||e[12]!==h||e[13]!==a||e[14]!==n||e[15]!==t){const m=async()=>{const me=h.trim();if(me===""){se(t("Enter a migration id")),ne(null);return}ce(!0),se(null);try{const de=await re.query(We,{direction:p,dryRun:l,id:me},ze(a));ne(de),n.refetch()}catch(de){const Ne=de;ne(null),se(Ge(Ne))}ce(!1)};V=()=>{$e(m())},e[9]=re,e[10]=p,e[11]=l,e[12]=h,e[13]=a,e[14]=n,e[15]=t,e[16]=V}else V=e[16];const X=V;let Y;e[17]===Symbol.for("react.memo_cache_sentinel")?(Y=m=>{ge(m.target.value)},e[17]=Y):Y=e[17];const ve=Y;let Z;e[18]===Symbol.for("react.memo_cache_sentinel")?(Z=m=>{ye(m.target.value==="down"?"down":"up")},e[18]=Z):Z=e[18];const xe=Z;let ee;e[19]===Symbol.for("react.memo_cache_sentinel")?(ee=m=>{be(m.target.checked)},e[19]=ee):ee=e[19];const Re=ee;let y;e[20]!==ie||e[21]!==a?(y=r(_e,{onChange:ie,testId:"mg-shard-input",value:a}),e[20]=ie,e[21]=a,e[22]=y):y=e[22];let b;e[23]!==oe?(b=r(Te,{message:oe,prefix:"mg"}),e[23]=oe,e[24]=b):b=e[24];let v;e[25]!==y||e[26]!==b?(v=s("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]}),e[25]=y,e[26]=b,e[27]=v):v=e[27];let x;e[28]!==ae||e[29]!==le?(x=ae!==null&&r(Me,{error:le,testId:"mg-status-error"}),e[28]=ae,e[29]=le,e[30]=x):x=e[30];let R;e[31]!==o||e[32]!==t?(R=o!==null&&o.length===0&&r(Be,{description:t("Data migrations you run against this shard will be tracked here."),icon:r("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:t("No migrations have run on this shard.")}),e[31]=o,e[32]=t,e[33]=R):R=e[33];let N;e[34]!==o||e[35]!==t?(N=o!==null&&o.length>0&&r(we,{className:"overflow-hidden py-0",children:r(De,{className:"px-0",children:s(Ke,{"data-testid":"mg-table",children:[r(je,{children:s(fe,{children:[r(u,{children:t("id")}),r(u,{children:t("direction")}),r(u,{children:t("status")}),r(u,{children:t("processed")}),r(u,{children:t("changed")}),r(u,{children:t("updated")}),r(u,{children:t("error")})]})}),r(Fe,{children:o.map(Je)})]})})}),e[34]=o,e[35]=t,e[36]=N):N=e[36];let C;e[37]!==t?(C=t("Run migration"),e[37]=t,e[38]=C):C=e[38];let S;e[39]!==C?(S=r(ue,{children:C}),e[39]=C,e[40]=S):S=e[40];let I;e[41]!==t?(I=t("Migration id"),e[41]=t,e[42]=I):I=e[42];let E;e[43]!==t?(E=t("migration id"),e[43]=t,e[44]=E):E=e[44];let M;e[45]!==h||e[46]!==I||e[47]!==E?(M=r(Ae,{"aria-label":I,className:"w-auto","data-testid":"mg-id-input",onChange:ve,placeholder:E,value:h}),e[45]=h,e[46]=I,e[47]=E,e[48]=M):M=e[48];let T;e[49]!==t?(T=t("Direction"),e[49]=t,e[50]=T):T=e[50];let _;e[51]!==t?(_=t("up"),e[51]=t,e[52]=_):_=e[52];let k;e[53]!==_?(k=r("option",{value:"up",children:_}),e[53]=_,e[54]=k):k=e[54];let L;e[55]!==t?(L=t("down"),e[55]=t,e[56]=L):L=e[56];let w;e[57]!==L?(w=r("option",{value:"down",children:L}),e[57]=L,e[58]=w):w=e[58];let D;e[59]!==p||e[60]!==T||e[61]!==k||e[62]!==w?(D=s("select",{"aria-label":T,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:xe,value:p,children:[k,w]}),e[59]=p,e[60]=T,e[61]=k,e[62]=w,e[63]=D):D=e[63];let B;e[64]!==l?(B=r("input",{checked:l,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:Re,type:"checkbox"}),e[64]=l,e[65]=B):B=e[65];let A;e[66]!==t?(A=t("Dry run"),e[66]=t,e[67]=A):A=e[67];let K;e[68]!==B||e[69]!==A?(K=s(ue,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[B,A]}),e[68]=B,e[69]=A,e[70]=K):K=e[70];let j;e[71]!==l||e[72]!==X||e[73]!==g||e[74]!==z||e[75]!==t?(j=l?r(Le,{"data-testid":"mg-run",disabled:g||!z,onClick:X,type:"button",children:t(g?"Running…":"Run")}):r(Ee,{confirmLabel:t(g?"Running…":"Run migration?"),disabled:g||!z,onConfirm:X,testId:"mg-run",children:t("Run")}),e[71]=l,e[72]=X,e[73]=g,e[74]=z,e[75]=t,e[76]=j):j=e[76];let F;e[77]!==M||e[78]!==D||e[79]!==K||e[80]!==j?(F=s("div",{className:"flex flex-wrap items-center gap-2",children:[M,D,K,j]}),e[77]=M,e[78]=D,e[79]=K,e[80]=j,e[81]=F):F=e[81];let O;e[82]!==S||e[83]!==F?(O=s("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[S,F]}),e[82]=S,e[83]=F,e[84]=O):O=e[84];let q;e[85]!==U?(q=U!==null&&r("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:U}),e[85]=U,e[86]=q):q=e[86];let H;e[87]!==c||e[88]!==t?(H=c!==null&&s("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[c.dryRun?t("Dry run: "):"",t("{status} — processed",{status:c.status}),c.processed,t(", changed"),c.changed]}),e[87]=c,e[88]=t,e[89]=H):H=e[89];let te;return e[90]!==v||e[91]!==x||e[92]!==R||e[93]!==N||e[94]!==O||e[95]!==q||e[96]!==H?(te=s("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[v,x,R,N,O,q,H]}),e[90]=v,e[91]=x,e[92]=R,e[93]=N,e[94]=O,e[95]=q,e[96]=H,e[97]=te):te=e[97],te};function Je(i){return s(fe,{"data-testid":`mg-row-${i.id}`,children:[r(f,{children:i.id}),r(f,{children:i.direction}),r(f,{children:r(ke,{variant:"secondary",children:i.status})}),r(f,{children:i.processed}),r(f,{children:i.changed}),r(f,{children:Qe(i.updatedAt)}),r(f,{children:i.error??""})]},i.id)}export{yt as MigrationsPanel};
1
+ import{c as Ce}from"react/compiler-runtime";import{useLunora as Se}from"@lunora/react";import{useState as Q,useEffect as Ie}from"react";import{ConfirmButton as Ee}from"./ConfirmButton-DU4p72Er.mjs";import{E as Me}from"./error-alert-CWs6gA3I.mjs";import{L as Te}from"./live-status-BuJdUZFU.mjs";import{ShardInput as _e}from"./ShardInput-C6mjgAh4.mjs";import{B as ke}from"./badge-r_5B4LHP.mjs";import{B as Le}from"./button-q0UYSmrn.mjs";import{C as we,a as De}from"./card--2hKx4L2.mjs";import{E as Be}from"./empty-state-D7jEML_T.mjs";import{I as Ae}from"./input-CXhxesPC.mjs";import{L as ue}from"./label-DKFzyHq6.mjs";import{T as Ke,a as je,b as fe,c as u,d as Fe,e as f}from"./table-D0SBiDu-.mjs";import{u as Oe}from"./use-admin-query-C7JRlFIE.mjs";import{u as qe}from"./use-shard-key-BsP3o5wT.mjs";import{useT as He}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as he}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{i as Qe,c as Ue,f as $e,d as ze,b as Ge}from"./internal-CwaF9YNk.mjs";import{r as Pe}from"./shard-history-CaO3C4KQ.mjs";import{jsx as r,jsxs as s}from"react/jsx-runtime";const We=Ue(he.runMigration),yt=i=>{const e=Ce(98),{initialShardKey:pe}=i,re=Se(),t=He(),{queryShardKey:d,setShardKey:ie,shardKey:a}=qe(pe),[h,ge]=Q(""),[p,ye]=Q("up"),[l,be]=Q(!0),[g,ce]=Q(!1),[c,ne]=Q(null),[U,se]=Q(null);let $;e[0]!==a?($=a.trim(),e[0]=a,e[1]=$):$=e[1];const z=$===d;let G;e[2]===Symbol.for("react.memo_cache_sentinel")?(G={},e[2]=G):G=e[2];let P;e[3]!==d?(P={live:!0,shardKey:d},e[3]=d,e[4]=P):P=e[4];const n=Oe(he.migrationStatus,G,P),o=n.data?.migrations??null,ae=n.error,{errorSource:le,liveError:oe}=n;let W,J;e[5]!==d||e[6]!==n.data?(W=()=>{n.data!==void 0&&Pe(d)},J=[n.data,d],e[5]=d,e[6]=n.data,e[7]=W,e[8]=J):(W=e[7],J=e[8]),Ie(W,J);let V;if(e[9]!==re||e[10]!==p||e[11]!==l||e[12]!==h||e[13]!==a||e[14]!==n||e[15]!==t){const m=async()=>{const me=h.trim();if(me===""){se(t("Enter a migration id")),ne(null);return}ce(!0),se(null);try{const de=await re.query(We,{direction:p,dryRun:l,id:me},ze(a));ne(de),n.refetch()}catch(de){const Ne=de;ne(null),se(Ge(Ne))}ce(!1)};V=()=>{$e(m())},e[9]=re,e[10]=p,e[11]=l,e[12]=h,e[13]=a,e[14]=n,e[15]=t,e[16]=V}else V=e[16];const X=V;let Y;e[17]===Symbol.for("react.memo_cache_sentinel")?(Y=m=>{ge(m.target.value)},e[17]=Y):Y=e[17];const ve=Y;let Z;e[18]===Symbol.for("react.memo_cache_sentinel")?(Z=m=>{ye(m.target.value==="down"?"down":"up")},e[18]=Z):Z=e[18];const xe=Z;let ee;e[19]===Symbol.for("react.memo_cache_sentinel")?(ee=m=>{be(m.target.checked)},e[19]=ee):ee=e[19];const Re=ee;let y;e[20]!==ie||e[21]!==a?(y=r(_e,{onChange:ie,testId:"mg-shard-input",value:a}),e[20]=ie,e[21]=a,e[22]=y):y=e[22];let b;e[23]!==oe?(b=r(Te,{message:oe,prefix:"mg"}),e[23]=oe,e[24]=b):b=e[24];let v;e[25]!==y||e[26]!==b?(v=s("div",{className:"flex flex-wrap items-center gap-2",children:[y,b]}),e[25]=y,e[26]=b,e[27]=v):v=e[27];let x;e[28]!==ae||e[29]!==le?(x=ae!==null&&r(Me,{error:le,testId:"mg-status-error"}),e[28]=ae,e[29]=le,e[30]=x):x=e[30];let R;e[31]!==o||e[32]!==t?(R=o!==null&&o.length===0&&r(Be,{description:t("Data migrations you run against this shard will be tracked here."),icon:r("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:t("No migrations have run on this shard.")}),e[31]=o,e[32]=t,e[33]=R):R=e[33];let N;e[34]!==o||e[35]!==t?(N=o!==null&&o.length>0&&r(we,{className:"overflow-hidden py-0",children:r(De,{className:"px-0",children:s(Ke,{"data-testid":"mg-table",children:[r(je,{children:s(fe,{children:[r(u,{children:t("id")}),r(u,{children:t("direction")}),r(u,{children:t("status")}),r(u,{children:t("processed")}),r(u,{children:t("changed")}),r(u,{children:t("updated")}),r(u,{children:t("error")})]})}),r(Fe,{children:o.map(Je)})]})})}),e[34]=o,e[35]=t,e[36]=N):N=e[36];let C;e[37]!==t?(C=t("Run migration"),e[37]=t,e[38]=C):C=e[38];let S;e[39]!==C?(S=r(ue,{children:C}),e[39]=C,e[40]=S):S=e[40];let I;e[41]!==t?(I=t("Migration id"),e[41]=t,e[42]=I):I=e[42];let E;e[43]!==t?(E=t("migration id"),e[43]=t,e[44]=E):E=e[44];let M;e[45]!==h||e[46]!==I||e[47]!==E?(M=r(Ae,{"aria-label":I,className:"w-auto","data-testid":"mg-id-input",onChange:ve,placeholder:E,value:h}),e[45]=h,e[46]=I,e[47]=E,e[48]=M):M=e[48];let T;e[49]!==t?(T=t("Direction"),e[49]=t,e[50]=T):T=e[50];let _;e[51]!==t?(_=t("up"),e[51]=t,e[52]=_):_=e[52];let k;e[53]!==_?(k=r("option",{value:"up",children:_}),e[53]=_,e[54]=k):k=e[54];let L;e[55]!==t?(L=t("down"),e[55]=t,e[56]=L):L=e[56];let w;e[57]!==L?(w=r("option",{value:"down",children:L}),e[57]=L,e[58]=w):w=e[58];let D;e[59]!==p||e[60]!==T||e[61]!==k||e[62]!==w?(D=s("select",{"aria-label":T,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:xe,value:p,children:[k,w]}),e[59]=p,e[60]=T,e[61]=k,e[62]=w,e[63]=D):D=e[63];let B;e[64]!==l?(B=r("input",{checked:l,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:Re,type:"checkbox"}),e[64]=l,e[65]=B):B=e[65];let A;e[66]!==t?(A=t("Dry run"),e[66]=t,e[67]=A):A=e[67];let K;e[68]!==B||e[69]!==A?(K=s(ue,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[B,A]}),e[68]=B,e[69]=A,e[70]=K):K=e[70];let j;e[71]!==l||e[72]!==X||e[73]!==g||e[74]!==z||e[75]!==t?(j=l?r(Le,{"data-testid":"mg-run",disabled:g||!z,onClick:X,type:"button",children:t(g?"Running…":"Run")}):r(Ee,{confirmLabel:t(g?"Running…":"Run migration?"),disabled:g||!z,onConfirm:X,testId:"mg-run",children:t("Run")}),e[71]=l,e[72]=X,e[73]=g,e[74]=z,e[75]=t,e[76]=j):j=e[76];let F;e[77]!==M||e[78]!==D||e[79]!==K||e[80]!==j?(F=s("div",{className:"flex flex-wrap items-center gap-2",children:[M,D,K,j]}),e[77]=M,e[78]=D,e[79]=K,e[80]=j,e[81]=F):F=e[81];let O;e[82]!==S||e[83]!==F?(O=s("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[S,F]}),e[82]=S,e[83]=F,e[84]=O):O=e[84];let q;e[85]!==U?(q=U!==null&&r("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:U}),e[85]=U,e[86]=q):q=e[86];let H;e[87]!==c||e[88]!==t?(H=c!==null&&s("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[c.dryRun?t("Dry run: "):"",t("{status} — processed",{status:c.status}),c.processed,t(", changed"),c.changed]}),e[87]=c,e[88]=t,e[89]=H):H=e[89];let te;return e[90]!==v||e[91]!==x||e[92]!==R||e[93]!==N||e[94]!==O||e[95]!==q||e[96]!==H?(te=s("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[v,x,R,N,O,q,H]}),e[90]=v,e[91]=x,e[92]=R,e[93]=N,e[94]=O,e[95]=q,e[96]=H,e[97]=te):te=e[97],te};function Je(i){return s(fe,{"data-testid":`mg-row-${i.id}`,children:[r(f,{children:i.id}),r(f,{children:i.direction}),r(f,{children:r(ke,{variant:"secondary",children:i.status})}),r(f,{children:i.processed}),r(f,{children:i.changed}),r(f,{children:Qe(i.updatedAt)}),r(f,{children:i.error??""})]},i.id)}export{yt as MigrationsPanel};
@@ -1 +1 @@
1
- import{c as 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-DU4p72Er.mjs";import{C as P,a as Q}from"./card--2hKx4L2.mjs";import{E as R}from"./empty-state-D7jEML_T.mjs";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-D0SBiDu-.mjs";import{b as V}from"./use-admin-query-Cbj2GuHu.mjs";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as G,i as O,b as U}from"./internal-CwaF9YNk.mjs";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-DU4p72Er.mjs";import{C as P,a as Q}from"./card--2hKx4L2.mjs";import{E as R}from"./empty-state-D7jEML_T.mjs";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-D0SBiDu-.mjs";import{b as V}from"./use-admin-query-C7JRlFIE.mjs";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as G,i as O,b as U}from"./internal-CwaF9YNk.mjs";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 +1 @@
1
- import{S as b}from"./studio-ByaR_3g9.mjs";import"./ErrorBoundary-BWNF98VF.mjs";import"./operation-console-provider-DoloEvon.mjs";import"./badge-r_5B4LHP.mjs";import"./input-CXhxesPC.mjs";import"./skeleton-DX1gfixl.mjs";import"./home-panel-BID7w6j3.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./StudioI18nProvider-fVsCSs5L.mjs";import"./data-view-params-qoSTqjAj.mjs";import"./internal-CwaF9YNk.mjs";import"./utils-bhneXptQ.mjs";import"./CommandPalette-C4UrhLxv.mjs";export{b as Studio};
1
+ import{S as b}from"./studio-4odoxrh9.mjs";import"./ErrorBoundary-BWNF98VF.mjs";import"./operation-console-provider-DoloEvon.mjs";import"./badge-r_5B4LHP.mjs";import"./input-CXhxesPC.mjs";import"./skeleton-DX1gfixl.mjs";import"./home-panel-ChKczU0I.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./StudioI18nProvider-fVsCSs5L.mjs";import"./data-view-params-qoSTqjAj.mjs";import"./internal-CwaF9YNk.mjs";import"./utils-bhneXptQ.mjs";import"./CommandPalette-C4UrhLxv.mjs";export{b as Studio};
@@ -1 +1 @@
1
- import{c as O}from"react/compiler-runtime";import{LunoraClient as G}from"@lunora/client";import{LunoraProvider as H}from"@lunora/react";import{useState as B,useEffect as R}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.mjs";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-ByaR_3g9.mjs";import Q from"./useDebounced-DVeQ5-oW.mjs";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{StudioI18nProvider as D}from"./StudioI18nProvider-fVsCSs5L.mjs";import{r as Z}from"./internal-CwaF9YNk.mjs";import{w as $}from"./recording-client-BEZ6tVgo.mjs";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.mjs";import{a as K}from"./browser-storage-BH1MxLZs.mjs";import{c as W}from"./utils-bhneXptQ.mjs";import{B as ee}from"./button-q0UYSmrn.mjs";import{I as te}from"./input-CXhxesPC.mjs";import{jsx as 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.mjs";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-4odoxrh9.mjs";import Q from"./useDebounced-DVeQ5-oW.mjs";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{StudioI18nProvider as D}from"./StudioI18nProvider-fVsCSs5L.mjs";import{r as Z}from"./internal-CwaF9YNk.mjs";import{w as $}from"./recording-client-BGyq5_JP.mjs";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.mjs";import{a as K}from"./browser-storage-BH1MxLZs.mjs";import{c as W}from"./utils-bhneXptQ.mjs";import{B as ee}from"./button-q0UYSmrn.mjs";import{I as te}from"./input-CXhxesPC.mjs";import{jsx as 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-CczbAfst.mjs";import{C as N,a as y}from"./card--2hKx4L2.mjs";import{T as v,a as T,b as d,c as m,d as w,e as l}from"./table-D0SBiDu-.mjs";import{useT as E}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{c as L}from"./utils-bhneXptQ.mjs";import{jsxs as o,jsx as t}from"react/jsx-runtime";const C={ERROR:"error",INFO:"info",WARN:"warning"},z=e=>{const a=typeof e.metadata.table=="string"?e.metadata.table:void 0;return{description:`${e.detail} ${e.remediation}`,entity:a,issueType:e.title,key:e.cacheKey,level:C[e.level]}},R=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},$=(e,a)=>({error:e("Errors"),info:e("Info"),warning:e("Warnings")})[a],k=(e,a,n)=>({error:e("{count} errors",{count:n}),info:e("{count} suggestions",{count:n}),warning:e("{count} warnings",{count:n})})[a],V=(e,a)=>({error:e("No errors detected"),info:e("No suggestions"),warning:e("No warnings detected")})[a],O=e=>{const a={error:0,info:0,warning:0};for(const n of e??[])a[n.level]+=1;return a},F=({error:e=null,errorSource:a,rows:n,testId:i,toolbar:p})=>{const s=E(),[c,f]=g("error"),b=O(n),u=(n??[]).filter(r=>r.level===c),h=r=>{f(r.currentTarget.dataset.level)};return o("div",{className:"flex flex-col gap-3","data-testid":i,children:[t("div",{className:"flex border-b border-border",role:"tablist",children:R.map(r=>o("button",{"aria-selected":c===r,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":r,"data-testid":`${i}-tab-${r}`,onClick:h,role:"tab",type:"button",children:[o("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t("span",{"aria-hidden":"true",className:L("size-2 rounded-sm",A[r])}),$(s,r)]}),t("span",{className:"ps-4 text-xs text-muted-foreground",children:k(s,r,b[r])})]},r))}),p!==void 0&&t("div",{className:"flex flex-wrap items-center gap-2",children:p}),e!==null&&t(x,{error:a??e,testId:`${i}-error`}),t(N,{className:"overflow-hidden py-0",children:t(y,{className:"px-0",children:o(v,{children:[t(T,{children:o(d,{children:[t(m,{children:s("Issue type")}),t(m,{children:s("Entity/item")}),t(m,{children:s("Description")})]})}),t(w,{children:u.length===0?t(d,{children:o(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${i}-empty`,children:[t("span",{className:"block text-sm font-medium text-foreground",children:V(s,c)}),t("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(r=>o(d,{children:[t(l,{className:"font-medium text-foreground",children:r.issueType}),t(l,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"—"}),o(l,{className:"text-muted-foreground",children:[t("span",{children:r.description}),r.action!==void 0&&t("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:r.action})]})]},r.key))})]})})})]})};export{F as A,z as a};
1
+ import{useState as g}from"react";import{E as x}from"./error-alert-CWs6gA3I.mjs";import{C as N,a as y}from"./card--2hKx4L2.mjs";import{T as v,a as T,b as d,c as m,d as w,e as l}from"./table-D0SBiDu-.mjs";import{useT as E}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{c as L}from"./utils-bhneXptQ.mjs";import{jsxs as o,jsx as t}from"react/jsx-runtime";const C={ERROR:"error",INFO:"info",WARN:"warning"},z=e=>{const a=typeof e.metadata.table=="string"?e.metadata.table:void 0;return{description:`${e.detail} ${e.remediation}`,entity:a,issueType:e.title,key:e.cacheKey,level:C[e.level]}},R=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},$=(e,a)=>({error:e("Errors"),info:e("Info"),warning:e("Warnings")})[a],k=(e,a,n)=>({error:e("{count} errors",{count:n}),info:e("{count} suggestions",{count:n}),warning:e("{count} warnings",{count:n})})[a],V=(e,a)=>({error:e("No errors detected"),info:e("No suggestions"),warning:e("No warnings detected")})[a],O=e=>{const a={error:0,info:0,warning:0};for(const n of e??[])a[n.level]+=1;return a},F=({error:e=null,errorSource:a,rows:n,testId:i,toolbar:p})=>{const s=E(),[c,f]=g("error"),b=O(n),u=(n??[]).filter(r=>r.level===c),h=r=>{f(r.currentTarget.dataset.level)};return o("div",{className:"flex flex-col gap-3","data-testid":i,children:[t("div",{className:"flex border-b border-border",role:"tablist",children:R.map(r=>o("button",{"aria-selected":c===r,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":r,"data-testid":`${i}-tab-${r}`,onClick:h,role:"tab",type:"button",children:[o("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t("span",{"aria-hidden":"true",className:L("size-2 rounded-sm",A[r])}),$(s,r)]}),t("span",{className:"ps-4 text-xs text-muted-foreground",children:k(s,r,b[r])})]},r))}),p!==void 0&&t("div",{className:"flex flex-wrap items-center gap-2",children:p}),e!==null&&t(x,{error:a??e,testId:`${i}-error`}),t(N,{className:"overflow-hidden py-0",children:t(y,{className:"px-0",children:o(v,{children:[t(T,{children:o(d,{children:[t(m,{children:s("Issue type")}),t(m,{children:s("Entity/item")}),t(m,{children:s("Description")})]})}),t(w,{children:u.length===0?t(d,{children:o(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${i}-empty`,children:[t("span",{className:"block text-sm font-medium text-foreground",children:V(s,c)}),t("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(r=>o(d,{children:[t(l,{className:"font-medium text-foreground",children:r.issueType}),t(l,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"—"}),o(l,{className:"text-muted-foreground",children:[t("span",{children:r.description}),r.action!==void 0&&t("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:r.action})]})]},r.key))})]})})})]})};export{F as A,z as a};
@@ -1 +1 @@
1
- import{c as A}from"react/compiler-runtime";import{flattenHint as I}from"@lunora/errors";import{useT as O}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{e as j,a as q,b as E}from"./internal-CwaF9YNk.mjs";import{o as H}from"./recording-client-BEZ6tVgo.mjs";import{u as S}from"./operation-console-provider-DoloEvon.mjs";import{A as T}from"./alert-PB5W11MM.mjs";import{jsx as v,jsxs as U}from"react/jsx-runtime";const G=y=>{const e=A(38),{className:w,error:t,testId:N}=y,g=O(),o=S();let s,l,i,n,a,c,r,m;if(e[0]!==w||e[1]!==t||e[2]!==o||e[3]!==N){const k=j(t);let h;e[12]!==t?(h=q(t),e[12]=t,e[13]=h):h=e[13],l=h;let b;e[14]!==t?(b=H(t),e[14]=t,e[15]=b):b=e[15];const C=b;let x;e[16]!==o||e[17]!==C?(x=()=>{o?.openConsole({errorsOnly:!0,seq:C})},e[16]=o,e[17]=C,e[18]=x):x=e[18],i=x,s=T,n=w,a=N,c="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(r=v("p",{className:"font-medium",children:u}),e[21]=u,e[22]=r):r=e[22],m=k===void 0?null:v("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(k)}),e[0]=w,e[1]=t,e[2]=o,e[3]=N,e[4]=s,e[5]=l,e[6]=i,e[7]=n,e[8]=a,e[9]=c,e[10]=r,e[11]=m}else s=e[4],l=e[5],i=e[6],n=e[7],a=e[8],c=e[9],r=e[10],m=e[11];let f;e[23]!==l?(f=l===void 0?null:v("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:l,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=l,e[24]=f):f=e[24];let p;e[25]!==o||e[26]!==i||e[27]!==g?(p=o===void 0?null:v("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:i,type:"button",children:g("Show in console")}),e[25]=o,e[26]=i,e[27]=g,e[28]=p):p=e[28];let d;return e[29]!==s||e[30]!==n||e[31]!==a||e[32]!==c||e[33]!==r||e[34]!==m||e[35]!==f||e[36]!==p?(d=U(s,{className:n,testId:a,variant:c,children:[r,m,f,p]}),e[29]=s,e[30]=n,e[31]=a,e[32]=c,e[33]=r,e[34]=m,e[35]=f,e[36]=p,e[37]=d):d=e[37],d};export{G as E};
1
+ import{c as A}from"react/compiler-runtime";import{flattenHint as I}from"@lunora/errors";import{useT as O}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{e as j,a as q,b as E}from"./internal-CwaF9YNk.mjs";import{o as H}from"./recording-client-BGyq5_JP.mjs";import{u as S}from"./operation-console-provider-DoloEvon.mjs";import{A as T}from"./alert-PB5W11MM.mjs";import{jsx as v,jsxs as U}from"react/jsx-runtime";const G=y=>{const e=A(38),{className:w,error:t,testId:N}=y,g=O(),o=S();let s,l,i,n,a,c,r,m;if(e[0]!==w||e[1]!==t||e[2]!==o||e[3]!==N){const k=j(t);let h;e[12]!==t?(h=q(t),e[12]=t,e[13]=h):h=e[13],l=h;let b;e[14]!==t?(b=H(t),e[14]=t,e[15]=b):b=e[15];const C=b;let x;e[16]!==o||e[17]!==C?(x=()=>{o?.openConsole({errorsOnly:!0,seq:C})},e[16]=o,e[17]=C,e[18]=x):x=e[18],i=x,s=T,n=w,a=N,c="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(r=v("p",{className:"font-medium",children:u}),e[21]=u,e[22]=r):r=e[22],m=k===void 0?null:v("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(k)}),e[0]=w,e[1]=t,e[2]=o,e[3]=N,e[4]=s,e[5]=l,e[6]=i,e[7]=n,e[8]=a,e[9]=c,e[10]=r,e[11]=m}else s=e[4],l=e[5],i=e[6],n=e[7],a=e[8],c=e[9],r=e[10],m=e[11];let f;e[23]!==l?(f=l===void 0?null:v("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:l,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=l,e[24]=f):f=e[24];let p;e[25]!==o||e[26]!==i||e[27]!==g?(p=o===void 0?null:v("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:i,type:"button",children:g("Show in console")}),e[25]=o,e[26]=i,e[27]=g,e[28]=p):p=e[28];let d;return e[29]!==s||e[30]!==n||e[31]!==a||e[32]!==c||e[33]!==r||e[34]!==m||e[35]!==f||e[36]!==p?(d=U(s,{className:n,testId:a,variant:c,children:[r,m,f,p]}),e[29]=s,e[30]=n,e[31]=a,e[32]=c,e[33]=r,e[34]=m,e[35]=f,e[36]=p,e[37]=d):d=e[37],d};export{G as E};
@@ -1,3 +1,3 @@
1
- import{c as $}from"react/compiler-runtime";import{useNavigate as He}from"@tanstack/react-router";import{useState as Pe,useEffect as qe,Suspense as et,lazy as tt}from"react";import{B as Ge}from"./badge-r_5B4LHP.mjs";import{C as F,a as Je}from"./card--2hKx4L2.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-Cbj2GuHu.mjs";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ye}from"./ADMIN_FUNCTIONS-B6z7VLYt.mjs";import{c as nt,f as Ne,d as lt,r as at,g as ot,l as rt}from"./internal-CwaF9YNk.mjs";import{c as Ye}from"./utils-bhneXptQ.mjs";import{deriveInsights as it}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useLunora as Ze}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ke}from"./button-q0UYSmrn.mjs";const ct=nt(ye.studioFeatures),Xe={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},dt=t=>{if(t===null||typeof t!="object")return Xe;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ut=()=>{const t=$(3),e=Ze(),[n,s]=Pe(Xe);let a,o;return t[0]!==e?(a=()=>{Ne((async()=>{try{s(dt(await e.query(ct,{},lt(""))))}catch{}})())},o=[e],t[0]=e,t[1]=a,t[2]=o):(a=t[1],o=t[2]),qe(a,o),n},mt=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},ft=t=>{const e=$(24),{group:n}=t,s=I(),a=He();let o;e[0]!==n.tab||e[1]!==a?(o=()=>{Ne(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=o):o=e[2];const r=o,i=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(mt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(gt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Je,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==r||e[22]!==g?(x=l(F,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:r,children:g}),e[20]=n.testId,e[21]=r,e[22]=g,e[23]=x):x=e[23],x},ze=["kv","files","vectors"],pt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>ze.indexOf(n.tab)-ze.indexOf(s.tab)),ht=()=>{const t=$(19),e=Ze(),n=ut(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[o,r]=Pe(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(xt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(bt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Ne((async()=>{try{const v=await b.load();if(!g.cancelled){const _={bindings:v,label:b.label,tab:b.tab,testId:b.testId};r(A=>pt(A,_))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=i,t[7]=c):(i=t[6],c=t[7]),qe(i,c),o.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==o?(f=o.map(yt),t[12]=o,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function gt(t){return l(Ge,{variant:"secondary",children:t},t)}function xt(t){return t.binding}function bt(t){return t.name}function yt(t){return l(ft,{group:t},t.tab)}const vt=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],Nt=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),_t=t=>{const e=vt.map(n=>`- ${n.name} — ${n.summary}`).join(`
1
+ import{c as $}from"react/compiler-runtime";import{useNavigate as He}from"@tanstack/react-router";import{useState as Pe,useEffect as qe,Suspense as et,lazy as tt}from"react";import{B as Ge}from"./badge-r_5B4LHP.mjs";import{C as F,a as Je}from"./card--2hKx4L2.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-C7JRlFIE.mjs";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ye}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as nt,f as Ne,d as lt,r as at,g as ot,l as rt}from"./internal-CwaF9YNk.mjs";import{c as Ye}from"./utils-bhneXptQ.mjs";import{deriveInsights as it}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useLunora as Ze}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ke}from"./button-q0UYSmrn.mjs";const ct=nt(ye.studioFeatures),Xe={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},dt=t=>{if(t===null||typeof t!="object")return Xe;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ut=()=>{const t=$(3),e=Ze(),[n,s]=Pe(Xe);let a,o;return t[0]!==e?(a=()=>{Ne((async()=>{try{s(dt(await e.query(ct,{},lt(""))))}catch{}})())},o=[e],t[0]=e,t[1]=a,t[2]=o):(a=t[1],o=t[2]),qe(a,o),n},mt=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},ft=t=>{const e=$(24),{group:n}=t,s=I(),a=He();let o;e[0]!==n.tab||e[1]!==a?(o=()=>{Ne(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=o):o=e[2];const r=o,i=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(mt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(gt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Je,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==r||e[22]!==g?(x=l(F,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:r,children:g}),e[20]=n.testId,e[21]=r,e[22]=g,e[23]=x):x=e[23],x},ze=["kv","files","vectors"],pt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>ze.indexOf(n.tab)-ze.indexOf(s.tab)),ht=()=>{const t=$(19),e=Ze(),n=ut(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[o,r]=Pe(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(xt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(bt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Ne((async()=>{try{const v=await b.load();if(!g.cancelled){const _={bindings:v,label:b.label,tab:b.tab,testId:b.testId};r(A=>pt(A,_))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=i,t[7]=c):(i=t[6],c=t[7]),qe(i,c),o.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==o?(f=o.map(yt),t[12]=o,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function gt(t){return l(Ge,{variant:"secondary",children:t},t)}function xt(t){return t.binding}function bt(t){return t.name}function yt(t){return l(ft,{group:t},t.tab)}const vt=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],Nt=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),_t=t=>{const e=vt.map(n=>`- ${n.name} — ${n.summary}`).join(`
2
2
  `);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
3
3
  `)},St=1500,kt=()=>{const t=$(35),e=I();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=at(),t[0]=n):n=t[0];const s=n,[a,o]=Pe(null);let r,i;t[1]!==a?(r=()=>{if(a===null)return;const L=globalThis.setTimeout(()=>{o(null)},St);return()=>{globalThis.clearTimeout(L)}},i=[a],t[1]=a,t[2]=r,t[3]=i):(r=t[2],i=t[3]),qe(r,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=(L,M)=>{ot(M)&&o(L)},t[4]=c):c=t[4];const m=c;let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{m("config",Nt(s))},t[5]=d):d=t[5];const f=d;let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{m("prompt",_t(s))},t[6]=u):u=t[6];const p=u;let g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=l("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let v;t[13]!==b?(v=l("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=v):v=t[14];let _;t[15]!==x||t[16]!==v?(_=h("div",{className:"flex flex-col gap-1.5 p-4",children:[x,v]}),t[15]=x,t[16]=v,t[17]=_):_=t[17];let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A=l("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=A):A=t[18];let S;t[19]!==a||t[20]!==e?(S=e(a==="config"?"Copied":"Copy MCP config"),t[19]=a,t[20]=e,t[21]=S):S=t[21];let y;t[22]!==S?(y=l(Ke,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:S}),t[22]=S,t[23]=y):y=t[23];let k;t[24]!==a||t[25]!==e?(k=e(a==="prompt"?"Copied":"Copy agent prompt"),t[24]=a,t[25]=e,t[26]=k):k=t[26];let C;t[27]!==k?(C=l(Ke,{"data-testid":"home-connect-agent-copy-prompt",onClick:p,size:"xs",variant:"outline",children:k}),t[27]=k,t[28]=C):C=t[28];let w;t[29]!==y||t[30]!==C?(w=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,h("div",{className:"flex flex-wrap gap-2",children:[y,C]})]}),t[29]=y,t[30]=C,t[31]=w):w=t[31];let N;return t[32]!==_||t[33]!==w?(N=h(F,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[_,w]}),t[32]=_,t[33]=w,t[34]=N):N=t[34],N},Ct=tt(()=>import("../packem_chunks/sparkline.mjs")),wt=(t,e)=>{if(e==null)return t("cache not enabled");const n=e.hits+e.misses;return n===0?t("no cache traffic yet"):`${Math.round(e.hits/n*100).toString()}% ${t("cache hit")}`},De=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},$t=(t,e)=>{const n=Math.max(0,Math.round((e-t)/1e3));if(n<60)return`${String(n)}s ago`;const s=Math.round(n/60);if(s<60)return`${String(s)}m ago`;const a=Math.round(s/60);return a<24?`${String(a)}h ago`:`${String(Math.round(a/24))}d ago`},Ve=(t,e)=>{if(t===void 0||t.length===0)return[];const n=new Map;for(const s of t)n.set(s.bucketMs,(n.get(s.bucketMs)??0)+s[e]);return[...n.entries()].toSorted(([s],[a])=>s-a).map(([,s])=>s)},We=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((r,i)=>r+i,0),a=t.slice(n).reduce((r,i)=>r+i,0);if(s===0)return null;const o=(a-s)/s*100;return{positive:e?o>=0:o<=0,text:`${o>=0?"+":""}${o.toFixed(1)}%`}},Te=t=>{const e=$(24),{delta:n,footer:s,label:a,trend:o,unit:r,value:i}=t,c=I();let m;e[0]!==a?(m=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=m):m=e[1];let d;e[2]!==i?(d=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==r?(f=r!==void 0&&l("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=h("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let p;e[9]!==o?(p=o!==void 0&&l(et,{fallback:l("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:l(Ct,{data:o})}),e[9]=o,e[10]=p):p=e[10];let g;e[11]!==u||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[u,p]}),e[11]=u,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==m||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[m,g]}),e[14]=m,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n||e[18]!==s||e[19]!==c?(b=n==null?s!=null&&l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s}):h("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[l("span",{className:Ye("font-semibold",n.positive?"text-success":"text-destructive"),children:n.text})," ",l("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=n,e[18]=s,e[19]=c,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=h(F,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},At=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},Be=t=>{const e=$(7),{command:n,label:s}=t;let a;e[0]!==s?(a=l("div",{className:"p-4",children:l("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=a):a=e[1];let o;e[2]!==n?(o=l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:l("code",{className:"font-mono text-xs text-muted-foreground",children:n})}),e[2]=n,e[3]=o):o=e[3];let r;return e[4]!==a||e[5]!==o?(r=h(F,{className:"justify-between gap-0 py-0",children:[a,o]}),e[4]=a,e[5]=o,e[6]=r):r=e[6],r},Qe=t=>{const e=$(18),{count:n,onView:s,testId:a,title:o}=t,r=I();let i;e[0]!==o?(i=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o}),e[0]=o,e[1]=i):i=e[1];let c;e[2]!==n||e[3]!==r?(c=n===null?l("span",{className:"text-xs text-muted-foreground",children:r("No data yet")}):l(Ge,{variant:n>0?"destructive":"success",children:n>0?n:r("All clear")}),e[2]=n,e[3]=r,e[4]=c):c=e[4];let m;e[5]!==i||e[6]!==c?(m=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=m):m=e[7];let d;e[8]!==r?(d=r("View"),e[8]=r,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=l(At,{}),e[10]=f):f=e[10];let u;e[11]!==s||e[12]!==d?(u=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:s,type:"button",children:[d,f]}),e[11]=s,e[12]=d,e[13]=u):u=e[13];let p;return e[14]!==m||e[15]!==u||e[16]!==a?(p=h(F,{className:"justify-between gap-0 py-0","data-testid":a,children:[m,u]}),e[14]=m,e[15]=u,e[16]=a,e[17]=p):p=e[17],p},Lt=t=>{const e=$(7),{functions:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const o=[...n].toSorted(Ot).slice(0,5);let r;e[3]!==s?(r=s("Top functions"),e[3]=s,e[4]=r):r=e[4];let i;e[5]!==r?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r})}),e[5]=r,e[6]=i):i=e[6],a=h(F,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,o.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No functions called yet.")}):h("div",{className:"divide-y divide-border",children:[h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[l("span",{children:s("Function")}),l("span",{className:"text-end",children:s("Calls")}),l("span",{className:"w-12 text-end",children:s("Avg")}),l("span",{className:"w-8 text-end",children:s("Err")})]}),o.map(Rt)]})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Mt=t=>{const e=$(26),{subs:n}=t,s=I();let a;e[0]!==s?(a=s("Live connections"),e[0]=s,e[1]=a):a=e[1];let o;e[2]!==a?(o=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[2]=a,e[3]=o):o=e[3];const r=n?.totalConnections??0;let i;e[4]!==r?(i=r.toLocaleString(),e[4]=r,e[5]=i):i=e[5];let c;e[6]!==i?(c=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==s?(m=s("sockets"),e[8]=s,e[9]=m):m=e[9];let d;e[10]!==m?(d=l("span",{className:"text-xs text-muted-foreground",children:m}),e[10]=m,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];const u=n?.totalSubscriptions??0;let p;e[15]!==u?(p=u.toLocaleString(),e[15]=u,e[16]=p):p=e[16];let g;e[17]!==s?(g=s("active subscriptions"),e[17]=s,e[18]=g):g=e[18];let x;e[19]!==p||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[p," ",g]}),e[19]=p,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==o||e[24]!==f?(b=l(F,{"data-testid":"home-live-connections",children:h(Je,{className:"flex flex-col gap-2.5 py-4",children:[o,f,x]})}),e[22]=x,e[23]=o,e[24]=f,e[25]=b):b=e[25],b},It=t=>{const e=$(7),{entries:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const o=Date.now();let r;e[3]!==s?(r=s("Recent activity"),e[3]=s,e[4]=r):r=e[4];let i;e[5]!==r?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r})}),e[5]=r,e[6]=i):i=e[6],a=h(F,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,n.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No recent activity.")}):l("ul",{className:"divide-y divide-border",children:n.slice(0,5).map(c=>h("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[h("span",{className:"flex min-w-0 items-center gap-2",children:[l("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),h("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&h("span",{className:"text-muted-foreground",children:[" · ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),l("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:$t(c.ts,o)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Tt=t=>{const e=t.reduce((n,s)=>n+s.calls,0);return e===0?null:t.reduce((n,s)=>n+s.totalDurationMs,0)/e},Yt=t=>{const e=$(149),{initialShardKey:n}=t,s=I(),a=He(),o=n??"";let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];let i;e[1]!==o?(i={shardKey:o},e[1]=o,e[2]=i):i=e[2];const c=ve(ye.getMetrics,r,i);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m={},e[3]=m):m=e[3];let d;e[4]!==o?(d={shardKey:o},e[4]=o,e[5]=d):d=e[5];const f=ve(ye.getFunctionStats,m,d);let u,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},p={shardKey:""},e[6]=u,e[7]=p):(u=e[6],p=e[7]);const g=ve(ye.getSecurityAudit,u,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==o?(b={shardKey:o},e[9]=o,e[10]=b):b=e[10];const v=ve(ye.listSubscriptions,x,b);let _;e[11]===Symbol.for("react.memo_cache_sentinel")?(_={},e[11]=_):_=e[11];let A;e[12]!==o?(A={shardKey:o},e[12]=o,e[13]=A):A=e[13];const S=ve(ye.getAuditLog,_,A),y=c.data??null;let k,C,w,N,L,M,j,T,O,B,D,P,R,E,q,U,K,z;if(e[14]!==S.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==a||e[19]!==f.data||e[20]!==v.data||e[21]!==s){N=Array.isArray(f.data?.functions)?f.data.functions:[],j=v.data??null;let Ce;e[40]!==S.data?(Ce=Array.isArray(S.data?.entries)?S.data.entries:[],e[40]=S.data,e[41]=Ce):Ce=e[41],C=Ce,L=c.data===void 0||f.data===void 0?null:it(y,N).length,M=Array.isArray(g.data?.findings)?g.data.findings.length:null;let we;e[42]!==a?(we=()=>{Ne(a({to:"/security"}))},e[42]=a,e[43]=we):we=e[43],z=we;let $e;e[44]!==a?($e=()=>{Ne(a({to:"/insights"}))},e[44]=a,e[45]=$e):$e=e[45],K=$e;const Ae=Ve(y?.history,"calls"),Le=Ve(y?.history,"errors"),Ue=Tt(N),Me=Math.max(0,...N.map(Et));let Ie;e[46]!==y||e[47]!==s?(Ie=y===null?void 0:wt(s,y.cache),e[46]=y,e[47]=s,e[48]=Ie):Ie=e[48],w=Ie,q="flex flex-col gap-6",U="lunora-home",D="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",P="home-health";const Re=We(Ae);let he;e[49]!==s?(he=s("Requests"),e[49]=s,e[50]=he):he=e[50];const Ee=y?.requests??0;let ge;e[51]!==Ee?(ge=Ee.toLocaleString(),e[51]=Ee,e[52]=ge):ge=e[52],e[53]!==Ae||e[54]!==Re||e[55]!==he||e[56]!==ge?(R=l(Te,{delta:Re,label:he,trend:Ae,value:ge}),e[53]=Ae,e[54]=Re,e[55]=he,e[56]=ge,e[57]=R):R=e[57];const Fe=We(Le,!1);let xe;e[58]!==s?(xe=s("Errors"),e[58]=s,e[59]=xe):xe=e[59];const je=y?.errors??0;let be;e[60]!==je?(be=je.toLocaleString(),e[60]=je,e[61]=be):be=e[61],e[62]!==Le||e[63]!==Fe||e[64]!==xe||e[65]!==be?(E=l(Te,{delta:Fe,label:xe,trend:Le,value:be}),e[62]=Le,e[63]=Fe,e[64]=xe,e[65]=be,e[66]=E):E=e[66],k=Te,e[67]!==Me||e[68]!==s?(T=Me>0?`${s("max")} ${De(Me)}`:void 0,e[67]=Me,e[68]=s,e[69]=T):T=e[69],e[70]!==s?(O=s("Avg latency"),e[70]=s,e[71]=O):O=e[71],B=Ue===null?"—":De(Ue),e[14]=S.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=a,e[19]=f.data,e[20]=v.data,e[21]=s,e[22]=k,e[23]=C,e[24]=w,e[25]=N,e[26]=L,e[27]=M,e[28]=j,e[29]=T,e[30]=O,e[31]=B,e[32]=D,e[33]=P,e[34]=R,e[35]=E,e[36]=q,e[37]=U,e[38]=K,e[39]=z}else k=e[22],C=e[23],w=e[24],N=e[25],L=e[26],M=e[27],j=e[28],T=e[29],O=e[30],B=e[31],D=e[32],P=e[33],R=e[34],E=e[35],q=e[36],U=e[37],K=e[38],z=e[39];let V;e[72]!==k||e[73]!==T||e[74]!==O||e[75]!==B?(V=l(k,{footer:T,label:O,value:B}),e[72]=k,e[73]=T,e[74]=O,e[75]=B,e[76]=V):V=e[76];let W;e[77]!==s?(W=s("Database size"),e[77]=s,e[78]=W):W=e[78];const Oe=y?.databaseSize??null;let Q;e[79]!==Oe?(Q=rt(Oe),e[79]=Oe,e[80]=Q):Q=e[80];let H;e[81]!==w||e[82]!==W||e[83]!==Q?(H=l(Te,{footer:w,label:W,value:Q}),e[81]=w,e[82]=W,e[83]=Q,e[84]=H):H=e[84];let G;e[85]!==D||e[86]!==P||e[87]!==R||e[88]!==E||e[89]!==V||e[90]!==H?(G=h("div",{className:D,"data-testid":P,children:[R,E,V,H]}),e[85]=D,e[86]=P,e[87]=R,e[88]=E,e[89]=V,e[90]=H,e[91]=G):G=e[91];let _e;e[92]===Symbol.for("react.memo_cache_sentinel")?(_e=l(ht,{}),e[92]=_e):_e=e[92];let J;e[93]!==N?(J=l("div",{className:"lg:col-span-2",children:l(Lt,{functions:N})}),e[93]=N,e[94]=J):J=e[94];let Y;e[95]!==j?(Y=l(Mt,{subs:j}),e[95]=j,e[96]=Y):Y=e[96];let Z;e[97]!==C?(Z=l(It,{entries:C}),e[97]=C,e[98]=Z):Z=e[98];let X;e[99]!==Y||e[100]!==Z?(X=h("div",{className:"flex flex-col gap-3",children:[Y,Z]}),e[99]=Y,e[100]=Z,e[101]=X):X=e[101];let ee;e[102]!==J||e[103]!==X?(ee=h("div",{className:"grid gap-3 lg:grid-cols-3",children:[J,X]}),e[102]=J,e[103]=X,e[104]=ee):ee=e[104];let te;e[105]!==s?(te=s("Advisors"),e[105]=s,e[106]=te):te=e[106];let se;e[107]!==te?(se=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:te}),e[107]=te,e[108]=se):se=e[108];let ne;e[109]!==L||e[110]!==M||e[111]!==s||e[112]!==K||e[113]!==z?(ne=M===0&&L===0?l(st,{description:s("No security or performance issues detected."),icon:h("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[l("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),l("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:s("No issues found")}):h("div",{className:"grid gap-3 sm:grid-cols-2",children:[l(Qe,{count:M,onView:z,testId:"home-security",title:s("Security findings")}),l(Qe,{count:L,onView:K,testId:"home-performance",title:s("Performance issues")})]}),e[109]=L,e[110]=M,e[111]=s,e[112]=K,e[113]=z,e[114]=ne):ne=e[114];let le;e[115]!==se||e[116]!==ne?(le=h("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[se,ne]}),e[115]=se,e[116]=ne,e[117]=le):le=e[117];let ae;e[118]!==s?(ae=s("Get connected"),e[118]=s,e[119]=ae):ae=e[119];let oe;e[120]!==ae?(oe=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[120]=ae,e[121]=oe):oe=e[121];let re;e[122]!==s?(re=s("Client SDK"),e[122]=s,e[123]=re):re=e[123];let ie;e[124]!==re?(ie=l(Be,{command:"npm i @lunora/client",label:re}),e[124]=re,e[125]=ie):ie=e[125];let ce;e[126]!==s?(ce=s("React"),e[126]=s,e[127]=ce):ce=e[127];let de;e[128]!==ce?(de=l(Be,{command:"npm i @lunora/react",label:ce}),e[128]=ce,e[129]=de):de=e[129];let ue;e[130]!==s?(ue=s("CLI"),e[130]=s,e[131]=ue):ue=e[131];let me;e[132]!==ue?(me=l(Be,{command:"lunora dev",label:ue}),e[132]=ue,e[133]=me):me=e[133];let fe;e[134]!==ie||e[135]!==de||e[136]!==me?(fe=h("div",{className:"grid gap-3 sm:grid-cols-3",children:[ie,de,me]}),e[134]=ie,e[135]=de,e[136]=me,e[137]=fe):fe=e[137];let Se;e[138]===Symbol.for("react.memo_cache_sentinel")?(Se=l(kt,{}),e[138]=Se):Se=e[138];let pe;e[139]!==oe||e[140]!==fe?(pe=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[oe,fe,Se]}),e[139]=oe,e[140]=fe,e[141]=pe):pe=e[141];let ke;return e[142]!==q||e[143]!==U||e[144]!==G||e[145]!==ee||e[146]!==le||e[147]!==pe?(ke=h("div",{className:q,"data-testid":U,children:[G,_e,ee,le,pe]}),e[142]=q,e[143]=U,e[144]=G,e[145]=ee,e[146]=le,e[147]=pe,e[148]=ke):ke=e[148],ke};function Ot(t,e){return e.calls-t.calls}function Rt(t){return h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[l("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),l("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),l("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:De(t.calls>0?t.totalDurationMs/t.calls:0)}),l("span",{className:Ye("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function Et(t){return t.maxDurationMs}export{Yt as H,wt as c,ut as u};
@@ -1 +1 @@
1
- import{o as u}from"./use-admin-query-Cbj2GuHu.mjs";const b="__lunora_admin__:",d=new Set(["action","mutation","query"]),r=Symbol("lunora.operationSeq"),g=t=>{if(typeof t!="object"||t===null)return;const n=t[r];return typeof n=="number"?n:void 0},h=(t,n)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,r,{configurable:!0,enumerable:!1,value:n,writable:!0})}catch{}},p=t=>{if(typeof t!="object"||t===null)return;const n=t.__lunoraRef;return typeof n=="string"&&n.startsWith(b)?n:void 0},O=t=>{if(typeof t!="object"||t===null)return"";const{shardKey:n}=t;return typeof n=="string"?n:""},E=t=>new Proxy(t,{get(n,c,a){const i=Reflect.get(n,c,a);if(typeof i!="function"||typeof c!="string"||!d.has(c))return typeof i=="function"?i.bind(n):i;const f=i;return async(...e)=>{const l=p(e[0]);if(l===void 0)return f.apply(n,e);const y=typeof e[1]=="object"&&e[1]!==null?e[1]:{},s=u.start(l,y,O(e[2]));try{const o=await f.apply(n,e);return u.settle(s,{result:o}),o}catch(o){throw u.settle(s,{error:o instanceof Error?o.message:String(o)}),h(o,s),o}}}});export{g as o,E as w};
1
+ import{o as u}from"./use-admin-query-C7JRlFIE.mjs";const b="__lunora_admin__:",d=new Set(["action","mutation","query"]),r=Symbol("lunora.operationSeq"),g=t=>{if(typeof t!="object"||t===null)return;const n=t[r];return typeof n=="number"?n:void 0},h=(t,n)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,r,{configurable:!0,enumerable:!1,value:n,writable:!0})}catch{}},p=t=>{if(typeof t!="object"||t===null)return;const n=t.__lunoraRef;return typeof n=="string"&&n.startsWith(b)?n:void 0},O=t=>{if(typeof t!="object"||t===null)return"";const{shardKey:n}=t;return typeof n=="string"?n:""},E=t=>new Proxy(t,{get(n,c,a){const i=Reflect.get(n,c,a);if(typeof i!="function"||typeof c!="string"||!d.has(c))return typeof i=="function"?i.bind(n):i;const f=i;return async(...e)=>{const l=p(e[0]);if(l===void 0)return f.apply(n,e);const y=typeof e[1]=="object"&&e[1]!==null?e[1]:{},s=u.start(l,y,O(e[2]));try{const o=await f.apply(n,e);return u.settle(s,{result:o}),o}catch(o){throw u.settle(s,{error:o instanceof Error?o.message:String(o)}),h(o,s),o}}}});export{g as o,E as w};