@lunora/studio 1.0.0-alpha.140 → 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 (137) hide show
  1. package/dist/index.d.mts +66 -65
  2. package/dist/index.d.ts +66 -65
  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-B869m6wb.mjs +1 -0
  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-CHCAslfi.mjs → Studio-5eRSjGmd.mjs} +1 -1
  57. package/dist/packem_shared/{StudioApp-DVl_E-VZ.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-ChKczU0I.mjs +3 -0
  61. package/dist/packem_shared/{recording-client-BEZ6tVgo.mjs → recording-client-BGyq5_JP.mjs} +1 -1
  62. package/dist/packem_shared/{studio-DRHuKwbt.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-37VWQZEF.js +3 -0
  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-U4IH7O6B.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-KTTYWH6A.js → chunk-WZYKLEU5.js} +1 -1
  121. package/dist/standalone/chunk-XDT5DXOI.js +11 -0
  122. package/dist/standalone/{chunk-Q5DQABG6.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-CDzwqq4b.mjs +0 -4
  129. package/dist/packem_shared/HomePanel-T_fBZTEM.mjs +0 -1
  130. package/dist/packem_shared/home-panel-CSENDmoB.mjs +0 -3
  131. package/dist/packem_shared/use-admin-query-Cbj2GuHu.mjs +0 -1
  132. package/dist/packem_shared/wire-codec-Dl3VeNrd.mjs +0 -1
  133. package/dist/standalone/chunk-ECQTVV2J.js +0 -1
  134. package/dist/standalone/chunk-JBIN7W2B.js +0 -11
  135. package/dist/standalone/chunk-JJA7KHJK.js +0 -1
  136. package/dist/standalone/chunk-LWYAZ2H7.js +0 -7
  137. package/dist/standalone/chunk-WLGZOFKE.js +0 -3
@@ -1 +1 @@
1
- import{a as Ke}from"./chunk-VVOVVU53.js";import{a as Qe,b as Me}from"./chunk-UWDFH35E.js";import{a as Ye}from"./chunk-NBC6NJFJ.js";import{a as Ve}from"./chunk-XZMOZFE6.js";import{a as D}from"./chunk-IMOHEGMV.js";import{a as Je}from"./chunk-66UGPQVC.js";import{a as Ge}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import{P as L}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as z}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as P}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ze}from"./chunk-ECQTVV2J.js";import{f as O}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{a as We}from"./chunk-FKVZRPV5.js";import{a as Ue,b as $e,c as _e,d as q,e as U,f as $}from"./chunk-HEAQVSNS.js";import{a as we,e as Ce}from"./chunk-WUWBZPUK.js";import{d as H,h as je,m as Ae,o as ze,r as Ie}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as r,d as qe,e as et,f as tt,g as at}from"./chunk-YKXDMIHQ.js";var k=qe(et(),1);var W=qe(tt(),1);var t=qe(at(),1);Qe.capabilities;var st=r(()=>{let u=(0,W.c)(3),{config:e,ready:l}=Me(),s;return u[0]!==e.capabilities||u[1]!==l?(s={capabilities:e.capabilities,ready:l},u[0]=e.capabilities,u[1]=l,u[2]=s):s=u[2],s},"tt"),lt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},rt=r((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"lt"),it=r((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let l=typeof e=="string"?e.trim():"";if(l!==""){if(u.type==="number"){let s=Number(l);return Number.isNaN(s)?void 0:{value:s}}return{value:l}}},"at"),nt=r(u=>{let e=(0,W.c)(105),{onClose:l,onCreated:s}=u,c=O(),a=H(),{config:o}=Me(),{busy:i,error:n,run:m}=Ye(),[w,S]=(0,k.useState)(""),[x,C]=(0,k.useState)(""),[y,I]=(0,k.useState)(""),[h,g]=(0,k.useState)(""),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];let[f,d]=(0,k.useState)(b),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=r(p=>{S(p.target.value)},"C"),e[1]=A):A=e[1];let v=A,F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r(p=>{C(p.target.value)},"I"),e[2]=F):F=e[2];let T=F,R;e[3]===Symbol.for("react.memo_cache_sentinel")?(R=r(p=>{I(p.target.value)},"T"),e[3]=R):R=e[3];let Le=R,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=r(p=>{g(p.target.value)},"q"),e[4]=Z):Z=e[4];let Pe=Z,J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=r((p,_)=>{d(V=>({...V,[p]:_}))},"Y"),e[5]=J):J=e[5];let Re=J,Q;e[6]!==f?(Q=r(p=>f[p.name]??(p.type==="boolean"?!1:""),"G"),e[6]=f,e[7]=Q):Q=e[7];let B=Q,Y;if(e[8]!==o.userFields||e[9]!==B){let p;e[11]!==B?(p=r(_=>!_.required||rt(_,B(_)),"f"),e[11]=B,e[12]=p):p=e[12],Y=o.userFields.every(p),e[8]=o.userFields,e[9]=B,e[10]=Y}else Y=e[10];let Fe=Y,G;e[13]!==i||e[14]!==w||e[15]!==x||e[16]!==Fe?(G=!i&&w.trim()!==""&&x.trim()!==""&&Fe,e[13]=i,e[14]=w,e[15]=x,e[16]=Fe,e[17]=G):G=e[17];let De=G,K;e[18]!==o.userFields||e[19]!==B?(K=r(()=>{let p={};for(let _ of o.userFields){let V=it(_,B(_));V!==void 0&&(p[_.name]=V.value)}return Object.keys(p).length===0?void 0:p},"W"),e[18]=o.userFields,e[19]=B,e[20]=K):K=e[20];let Se=K,X;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==x||e[25]!==l||e[26]!==s||e[27]!==y||e[28]!==h||e[29]!==m?(X=r(()=>{m(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:x.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),s(),l()})},"J"),e[21]=Se,e[22]=c,e[23]=w,e[24]=x,e[25]=l,e[26]=s,e[27]=y,e[28]=h,e[29]=m,e[30]=X):X=e[30];let N=X,j;e[31]!==a?(j=a("Create user"),e[31]=a,e[32]=j):j=e[32];let E;e[33]!==a?(E=a("Create user"),e[33]=a,e[34]=E):E=e[34];let M;e[35]!==E?(M=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:E}),e[35]=E,e[36]=M):M=e[36];let ee;e[37]!==a?(ee=a("email"),e[37]=a,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsx)(D,{htmlFor:"uc-email",children:ee}),e[39]=ee,e[40]=te):te=e[40];let ae;e[41]!==w?(ae=(0,t.jsx)(L,{"data-testid":"uc-email",id:"uc-email",onChange:v,type:"email",value:w}),e[41]=w,e[42]=ae):ae=e[42];let se;e[43]!==te||e[44]!==ae?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[te,ae]}),e[43]=te,e[44]=ae,e[45]=se):se=e[45];let le;e[46]!==a?(le=a("name"),e[46]=a,e[47]=le):le=e[47];let re;e[48]!==le?(re=(0,t.jsx)(D,{htmlFor:"uc-name",children:le}),e[48]=le,e[49]=re):re=e[49];let ie;e[50]!==x?(ie=(0,t.jsx)(L,{"data-testid":"uc-name",id:"uc-name",onChange:T,value:x}),e[50]=x,e[51]=ie):ie=e[51];let ne;e[52]!==re||e[53]!==ie?(ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,ie]}),e[52]=re,e[53]=ie,e[54]=ne):ne=e[54];let de;e[55]!==a?(de=a("Password (optional)"),e[55]=a,e[56]=de):de=e[56];let oe;e[57]!==de?(oe=(0,t.jsx)(D,{htmlFor:"uc-password",children:de}),e[57]=de,e[58]=oe):oe=e[58];let ce;e[59]!==y?(ce=(0,t.jsx)(L,{"data-testid":"uc-password",id:"uc-password",onChange:Le,type:"password",value:y}),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==oe||e[62]!==ce?(ue=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[oe,ce]}),e[61]=oe,e[62]=ce,e[63]=ue):ue=e[63];let me;e[64]!==a?(me=a("Role (optional)"),e[64]=a,e[65]=me):me=e[65];let he;e[66]!==me?(he=(0,t.jsx)(D,{htmlFor:"uc-role",children:me}),e[66]=me,e[67]=he):he=e[67];let pe;e[68]!==h?(pe=(0,t.jsx)(L,{"data-testid":"uc-role",id:"uc-role",onChange:Pe,value:h}),e[68]=h,e[69]=pe):pe=e[69];let fe;e[70]!==he||e[71]!==pe?(fe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[he,pe]}),e[70]=he,e[71]=pe,e[72]=fe):fe=e[72];let be;e[73]!==o.userFields||e[74]!==B||e[75]!==a?(be=o.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),o.userFields.map(p=>{let _=`uc-field-${p.name}`,V=p.required?"":` (${a("optional")})`;if(p.type==="boolean"){let Ee=B(p)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:_,children:[(0,t.jsx)(Ke,{checked:Ee,"data-testid":_,id:_,onCheckedChange:r(Xe=>{Re(p.name,Xe)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[p.name,V]})]},p.name)}let He=B(p);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(D,{htmlFor:_,children:[p.name,V]}),(0,t.jsx)(L,{"data-testid":_,id:_,onChange:r(Ee=>{Re(p.name,Ee.target.value)},"onChange"),type:lt[p.type],value:typeof He=="string"?He:""})]},p.name)})]}),e[73]=o.userFields,e[74]=B,e[75]=a,e[76]=be):be=e[76];let ve;e[77]!==n?(ve=n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n}),e[77]=n,e[78]=ve):ve=e[78];let xe;e[79]!==a?(xe=a("Cancel"),e[79]=a,e[80]=xe):xe=e[80];let ye;e[81]!==l||e[82]!==xe?(ye=(0,t.jsx)(z,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:xe}),e[81]=l,e[82]=xe,e[83]=ye):ye=e[83];let Te=!De,ge;e[84]!==i||e[85]!==a?(ge=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Te||e[89]!==ge?(Ne=(0,t.jsx)(z,{"data-testid":"uc-submit",disabled:Te,onClick:N,size:"sm",type:"button",children:ge}),e[87]=N,e[88]=Te,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]}),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Be;return e[94]!==l||e[95]!==j||e[96]!==M||e[97]!==se||e[98]!==ne||e[99]!==ue||e[100]!==fe||e[101]!==be||e[102]!==ve||e[103]!==ke?(Be=(0,t.jsxs)(Ve,{label:j,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[M,se,ne,ue,fe,be,ve,ke]}),e[94]=l,e[95]=j,e[96]=M,e[97]=se,e[98]=ne,e[99]=ue,e[100]=fe,e[101]=be,e[102]=ve,e[103]=ke,e[104]=Be):Be=e[104],Be},"nt"),Oe=r(u=>{let e=(0,W.c)(2),{children:l}=u,s;return e[0]!==l?(s=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=s):s=e[1],s},"Oe"),dt=r(u=>{let e=(0,W.c)(29),{busy:l,runAction:s,userId:c,version:a}=u,o=O(),i=H(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==o||e[1]!==c?(x=r(()=>{ze((async()=>{S(null);try{let v=await o.listAuthSessions({limit:50,userId:c});m(v.rows)}catch(v){let F=v;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==o||e[8]!==s?(y=r(v=>{s(()=>o.revokeAuthSession({sessionId:v}))},"y"),e[7]=o,e[8]=s,e[9]=y):y=e[9];let I=y,h;e[10]!==i?(h=i("Sessions"),e[10]=i,e[11]=h):h=e[11];let g;e[12]!==h?(g=(0,t.jsx)(Oe,{children:h}),e[12]=h,e[13]=g):g=e[13];let b;e[14]!==w?(b=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w}),e[14]=w,e[15]=b):b=e[15];let f;e[16]!==n||e[17]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=n,e[17]=i,e[18]=f):f=e[18];let d;e[19]!==l||e[20]!==I||e[21]!==n||e[22]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("expires")}),(0,t.jsx)(U,{children:i("ip")}),(0,t.jsx)(U,{children:i("user agent")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(_e,{children:n.map(v=>(0,t.jsxs)(q,{"data-testid":`ud-session-${v.id}`,children:[(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(v.expiresAt)}),(0,t.jsx)($,{children:v.ipAddress??""}),(0,t.jsx)($,{className:"max-w-40 truncate",children:v.userAgent??""}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-revoke-${v.id}`,disabled:l,onClick:r(()=>{I(v.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},v.id))})]})})}),e[19]=l,e[20]=I,e[21]=n,e[22]=i,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==b||e[26]!==f||e[27]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,b,f,d]}),e[24]=g,e[25]=b,e[26]=f,e[27]=d,e[28]=A):A=e[28],A},"rt"),ot=r(u=>{let e=(0,W.c)(30),{busy:l,runAction:s,userId:c,version:a}=u,o=O(),i=H(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==o||e[1]!==c?(x=r(()=>{ze((async()=>{S(null);try{m(await o.listAuthAccounts({userId:c}))}catch(v){let F=v;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==o||e[8]!==s||e[9]!==c?(y=r(v=>{s(()=>o.unlinkAuthAccount({accountId:v,userId:c}))},"y"),e[7]=o,e[8]=s,e[9]=c,e[10]=y):y=e[10];let I=y,h;e[11]!==i?(h=i("Linked accounts"),e[11]=i,e[12]=h):h=e[12];let g;e[13]!==h?(g=(0,t.jsx)(Oe,{children:h}),e[13]=h,e[14]=g):g=e[14];let b;e[15]!==w?(b=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:w}),e[15]=w,e[16]=b):b=e[16];let f;e[17]!==n||e[18]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=n,e[18]=i,e[19]=f):f=e[19];let d;e[20]!==n||e[21]!==l||e[22]!==I||e[23]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("provider")}),(0,t.jsx)(U,{children:i("created")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(_e,{children:n.map(v=>{let F=Ae(v.id);return(0,t.jsxs)(q,{"data-testid":`ud-account-${F}`,children:[(0,t.jsx)($,{children:Ae(v.providerId)}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(v.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-unlink-${F}`,disabled:l,onClick:r(()=>{I(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},F)})})]})})}),e[20]=n,e[21]=l,e[22]=I,e[23]=i,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==b||e[27]!==f||e[28]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,b,f,d]}),e[25]=g,e[26]=b,e[27]=f,e[28]=d,e[29]=A):A=e[29],A},"it"),ct=r(u=>{let e=(0,W.c)(40),{busy:l,capabilities:s,runAction:c,userId:a,version:o}=u,i=O(),n=H(),[m,w]=(0,k.useState)(null),S;e[0]!==s.passkey||e[1]!==i||e[2]!==a?(S=r(()=>{s.passkey&&ze((async()=>{try{w(await i.listAuthPasskeys({userId:a}))}catch{w(null)}})())},"S"),e[0]=s.passkey,e[1]=i,e[2]=a,e[3]=S):S=e[3];let x;e[4]!==s.passkey||e[5]!==i||e[6]!==a||e[7]!==o?(x=[s.passkey,i,a,o],e[4]=s.passkey,e[5]=i,e[6]=a,e[7]=o,e[8]=x):x=e[8],(0,k.useEffect)(S,x);let C;e[9]!==i||e[10]!==c||e[11]!==a?(C=r(()=>{c(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=c,e[11]=a,e[12]=C):C=e[12];let y=C,I;e[13]!==i||e[14]!==c?(I=r(F=>{c(()=>i.deleteAuthPasskey({passkeyId:F}))},"A"),e[13]=i,e[14]=c,e[15]=I):I=e[15];let h=I,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let b;e[18]!==g?(b=(0,t.jsx)(Oe,{children:g}),e[18]=g,e[19]=b):b=e[19];let f;e[20]!==l||e[21]!==s.twoFactor||e[22]!==y||e[23]!==n?(f=s.twoFactor&&(0,t.jsx)(z,{"data-testid":"ud-disable-2fa",disabled:l,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")}),e[20]=l,e[21]=s.twoFactor,e[22]=y,e[23]=n,e[24]=f):f=e[24];let d;e[25]!==s.passkey||e[26]!==m||e[27]!==n?(d=s.passkey&&m!==null&&m.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")}),e[25]=s.passkey,e[26]=m,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==l||e[30]!==s.passkey||e[31]!==h||e[32]!==m||e[33]!==n?(A=s.passkey&&m!==null&&m.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)(_e,{children:m.map(F=>{let T=Ae(F.id);return(0,t.jsxs)(q,{"data-testid":`ud-passkey-${T}`,children:[(0,t.jsx)($,{children:Ae(F.name)||T}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(F.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-delete-passkey-${T}`,disabled:l,onClick:r(()=>{h(T)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})})]},T)})})]})})}),e[29]=l,e[30]=s.passkey,e[31]=h,e[32]=m,e[33]=n,e[34]=A):A=e[34];let v;return e[35]!==b||e[36]!==f||e[37]!==d||e[38]!==A?(v=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,f,d,A]}),e[35]=b,e[36]=f,e[37]=d,e[38]=A,e[39]=v):v=e[39],v},"ot"),ut=/(?:at|expires)$/iu,mt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ht=r((u,e)=>typeof e=="number"&&ut.test(u)?Ie(e):Ae(e),"ut"),pt=r(({capabilities:u,onChanged:e,onClose:l,user:s})=>{let c=O(),a=H(),o=s.banned===!0,[i,n]=(0,k.useState)(null),[m,w]=(0,k.useState)(!1),[S,x]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof s.role=="string"?s.role:""),[I,h]=(0,k.useState)(""),[g,b]=(0,k.useState)(""),[f,d]=(0,k.useState)(""),[A,v]=(0,k.useState)(null),[F,T]=(0,k.useState)(!1),R=r((N,j)=>{ze((async()=>{w(!0),n(null);try{let E=await N();j?.refresh!==!1&&(x(M=>M+1),e()),j?.onResult?.(E)}catch(E){n(je(E))}w(!1)})())},"T"),Le=r(N=>{y(N.target.value)},"ze"),Z=r(N=>{h(N.target.value)},"q"),Pe=r(N=>{b(N.target.value)},"Be"),J=r(N=>{d(N.target.value)},"Y"),Re=r(()=>{let N=C.trim();N!==""&&R(async()=>{await c.setAuthUserRole({role:N,userId:s.id})})},"Ue"),Q=r(()=>{let N=Number.parseInt(g,10),j=Number.isFinite(N)&&N>0?N*86400:void 0;R(async()=>{await c.banAuthUser({expiresInSeconds:j,reason:I.trim()===""?void 0:I.trim(),userId:s.id})})},"G"),B=r(()=>{R(async()=>{await c.unbanAuthUser({userId:s.id})})},"E"),Y=r(()=>{R(async()=>{await c.setAuthUserPassword({newPassword:f,userId:s.id}),d("")})},"Q"),Fe=r(()=>{R(()=>c.impersonateAuthUser({userId:s.id}),{onResult:r(N=>{v(N.token)},"onResult"),refresh:!1})},"we"),G=r(()=>{R(async()=>{await c.revokeAuthUserSessions({userId:s.id})})},"Z"),De=r(()=>{R(async()=>{await c.removeAuthUser({userId:s.id}),l()})},"$e"),K=r(()=>{T(!0)},"W"),Se=r(()=>{T(!1)},"Ce"),X=Object.entries(s).filter(([N])=>!mt.has(N));return(0,t.jsxs)(Ve,{label:a("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s.name??s.email??s.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:s.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof s.role=="string"&&s.role!==""&&(0,t.jsx)(P,{variant:"secondary",children:s.role}),o?(0,t.jsx)(P,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(P,{variant:"outline",children:a("Active")}),s.emailVerified===!0?(0,t.jsx)(P,{variant:"secondary",children:a("verified")}):(0,t.jsx)(P,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(z,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),i!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:i}),u.admin&&(0,t.jsxs)(we,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Actions")})}),(0,t.jsxs)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(L,{"data-testid":"ud-role-input",id:"ud-role",onChange:Le,value:C})]}),(0,t.jsx)(z,{"data-testid":"ud-set-role",disabled:m||C.trim()==="",onClick:Re,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),o?(0,t.jsx)(z,{"data-testid":"ud-unban",disabled:m,onClick:B,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-reason",children:a("Ban reason (optional)")}),(0,t.jsx)(L,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:I})]}),(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-days",children:a("Days")}),(0,t.jsx)(L,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:Pe,type:"number",value:g})]}),(0,t.jsx)(z,{"data-testid":"ud-ban",disabled:m,onClick:Q,size:"sm",type:"button",variant:"destructive",children:a("Ban user")})]}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(L,{"data-testid":"ud-password",id:"ud-password",onChange:J,type:"password",value:f})]}),(0,t.jsx)(z,{"data-testid":"ud-set-password",disabled:m||f==="",onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(z,{"data-testid":"ud-impersonate",disabled:m,onClick:Fe,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(z,{"data-testid":"ud-revoke-all",disabled:m,onClick:G,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),F?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z,{"data-testid":"ud-delete-confirm",disabled:m,onClick:De,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(z,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(z,{"data-testid":"ud-delete",disabled:m,onClick:K,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),A!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(D,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(L,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A})]})]})]}),(0,t.jsx)(dt,{busy:m,runAction:R,userId:s.id,version:S}),u.accounts&&(0,t.jsx)(ot,{busy:m,runAction:R,userId:s.id,version:S}),(u.twoFactor||u.passkey)&&(0,t.jsx)(ct,{busy:m,capabilities:u,runAction:R,userId:s.id,version:S}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:X.map(([N,j])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:ht(N,j)})]},N))})]})]})},"mt"),ft=50,Rt=r(({pageSize:u=ft}={})=>{let e=O(),l=H(),[s,c]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),i=Ge(s),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:x}=st(),C=i.trim(),y=a.trim(),I=Ze(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),h=I.data?.rows??null,g=I.error,b=r(()=>{I.refetch()},"b");Je(()=>{I.refetch()},!0);let f=n===null?null:h?.find(d=>d.id===n)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(L,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:r(d=>{c(d.target.value)},"onChange"),placeholder:l("Search by email or name\u2026"),value:s}),(0,t.jsx)(L,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:r(d=>{o(d.target.value)},"onChange"),placeholder:l("Filter by role"),value:a}),(0,t.jsx)(z,{"data-testid":"us-new",onClick:r(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:l("New user")})]}),g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&(0,t.jsx)(We,{description:l("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:l("No users.")}),h!==null&&h.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"us-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:l("id")}),(0,t.jsx)(U,{children:l("email")}),(0,t.jsx)(U,{children:l("name")}),(0,t.jsx)(U,{children:l("role")}),(0,t.jsx)(U,{children:l("status")}),(0,t.jsx)(U,{children:l("verified")}),(0,t.jsx)(U,{children:l("created")}),(0,t.jsx)(U,{"aria-label":l("Actions")})]})}),(0,t.jsx)(_e,{children:h.map(d=>(0,t.jsxs)(q,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsx)($,{className:"font-mono text-xs",children:d.id}),(0,t.jsx)($,{children:d.email??""}),(0,t.jsx)($,{children:d.name??""}),(0,t.jsx)($,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsx)(P,{variant:"secondary",children:d.role}):""}),(0,t.jsx)($,{children:d.banned===!0?(0,t.jsx)(P,{variant:"destructive",children:l("Banned")}):(0,t.jsx)(P,{variant:"success",children:l("Active")})}),(0,t.jsx)($,{children:d.emailVerified===!0?(0,t.jsx)(P,{variant:"success",children:l("yes")}):(0,t.jsx)(P,{variant:"outline",children:l("no")})}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(d.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`us-manage-${d.id}`,onClick:r(()=>{m(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},d.id))})]})})}),f!==null&&(0,t.jsx)(pt,{capabilities:x,onChanged:b,onClose:r(()=>{m(null)},"onClose"),user:f}),w&&(0,t.jsx)(nt,{onClose:r(()=>{S(!1)},"onClose"),onCreated:b})]})},"Et");export{Rt as UsersPanel};
1
+ import{a as Ke}from"./chunk-VVOVVU53.js";import{a as Qe,b as Me}from"./chunk-IXMHWLSN.js";import{a as Ye}from"./chunk-NBC6NJFJ.js";import{a as Ve}from"./chunk-XZMOZFE6.js";import{a as D}from"./chunk-IMOHEGMV.js";import{a as Je}from"./chunk-66UGPQVC.js";import{a as Ge}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import{P as L}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as z}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as P}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ze}from"./chunk-L6KA7M4B.js";import{f as O}from"./chunk-XDT5DXOI.js";import"./chunk-FSRSK4LY.js";import{a as We}from"./chunk-FKVZRPV5.js";import{a as Ue,b as $e,c as _e,d as q,e as U,f as $}from"./chunk-HEAQVSNS.js";import{a as we,e as Ce}from"./chunk-WUWBZPUK.js";import{d as H,h as je,m as Ae,o as ze,r as Ie}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as r,d as qe,e as et,f as tt,g as at}from"./chunk-YKXDMIHQ.js";var k=qe(et(),1);var W=qe(tt(),1);var t=qe(at(),1);Qe.capabilities;var st=r(()=>{let u=(0,W.c)(3),{config:e,ready:l}=Me(),s;return u[0]!==e.capabilities||u[1]!==l?(s={capabilities:e.capabilities,ready:l},u[0]=e.capabilities,u[1]=l,u[2]=s):s=u[2],s},"tt"),lt={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},rt=r((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"lt"),it=r((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let l=typeof e=="string"?e.trim():"";if(l!==""){if(u.type==="number"){let s=Number(l);return Number.isNaN(s)?void 0:{value:s}}return{value:l}}},"at"),nt=r(u=>{let e=(0,W.c)(105),{onClose:l,onCreated:s}=u,c=O(),a=H(),{config:o}=Me(),{busy:i,error:n,run:m}=Ye(),[w,S]=(0,k.useState)(""),[x,C]=(0,k.useState)(""),[y,I]=(0,k.useState)(""),[h,g]=(0,k.useState)(""),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];let[f,d]=(0,k.useState)(b),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=r(p=>{S(p.target.value)},"C"),e[1]=A):A=e[1];let v=A,F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r(p=>{C(p.target.value)},"I"),e[2]=F):F=e[2];let T=F,R;e[3]===Symbol.for("react.memo_cache_sentinel")?(R=r(p=>{I(p.target.value)},"T"),e[3]=R):R=e[3];let Le=R,Z;e[4]===Symbol.for("react.memo_cache_sentinel")?(Z=r(p=>{g(p.target.value)},"q"),e[4]=Z):Z=e[4];let Pe=Z,J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=r((p,_)=>{d(V=>({...V,[p]:_}))},"Y"),e[5]=J):J=e[5];let Re=J,Q;e[6]!==f?(Q=r(p=>f[p.name]??(p.type==="boolean"?!1:""),"G"),e[6]=f,e[7]=Q):Q=e[7];let B=Q,Y;if(e[8]!==o.userFields||e[9]!==B){let p;e[11]!==B?(p=r(_=>!_.required||rt(_,B(_)),"f"),e[11]=B,e[12]=p):p=e[12],Y=o.userFields.every(p),e[8]=o.userFields,e[9]=B,e[10]=Y}else Y=e[10];let Fe=Y,G;e[13]!==i||e[14]!==w||e[15]!==x||e[16]!==Fe?(G=!i&&w.trim()!==""&&x.trim()!==""&&Fe,e[13]=i,e[14]=w,e[15]=x,e[16]=Fe,e[17]=G):G=e[17];let De=G,K;e[18]!==o.userFields||e[19]!==B?(K=r(()=>{let p={};for(let _ of o.userFields){let V=it(_,B(_));V!==void 0&&(p[_.name]=V.value)}return Object.keys(p).length===0?void 0:p},"W"),e[18]=o.userFields,e[19]=B,e[20]=K):K=e[20];let Se=K,X;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==x||e[25]!==l||e[26]!==s||e[27]!==y||e[28]!==h||e[29]!==m?(X=r(()=>{m(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:x.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),s(),l()})},"J"),e[21]=Se,e[22]=c,e[23]=w,e[24]=x,e[25]=l,e[26]=s,e[27]=y,e[28]=h,e[29]=m,e[30]=X):X=e[30];let N=X,j;e[31]!==a?(j=a("Create user"),e[31]=a,e[32]=j):j=e[32];let E;e[33]!==a?(E=a("Create user"),e[33]=a,e[34]=E):E=e[34];let M;e[35]!==E?(M=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:E}),e[35]=E,e[36]=M):M=e[36];let ee;e[37]!==a?(ee=a("email"),e[37]=a,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsx)(D,{htmlFor:"uc-email",children:ee}),e[39]=ee,e[40]=te):te=e[40];let ae;e[41]!==w?(ae=(0,t.jsx)(L,{"data-testid":"uc-email",id:"uc-email",onChange:v,type:"email",value:w}),e[41]=w,e[42]=ae):ae=e[42];let se;e[43]!==te||e[44]!==ae?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[te,ae]}),e[43]=te,e[44]=ae,e[45]=se):se=e[45];let le;e[46]!==a?(le=a("name"),e[46]=a,e[47]=le):le=e[47];let re;e[48]!==le?(re=(0,t.jsx)(D,{htmlFor:"uc-name",children:le}),e[48]=le,e[49]=re):re=e[49];let ie;e[50]!==x?(ie=(0,t.jsx)(L,{"data-testid":"uc-name",id:"uc-name",onChange:T,value:x}),e[50]=x,e[51]=ie):ie=e[51];let ne;e[52]!==re||e[53]!==ie?(ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,ie]}),e[52]=re,e[53]=ie,e[54]=ne):ne=e[54];let de;e[55]!==a?(de=a("Password (optional)"),e[55]=a,e[56]=de):de=e[56];let oe;e[57]!==de?(oe=(0,t.jsx)(D,{htmlFor:"uc-password",children:de}),e[57]=de,e[58]=oe):oe=e[58];let ce;e[59]!==y?(ce=(0,t.jsx)(L,{"data-testid":"uc-password",id:"uc-password",onChange:Le,type:"password",value:y}),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==oe||e[62]!==ce?(ue=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[oe,ce]}),e[61]=oe,e[62]=ce,e[63]=ue):ue=e[63];let me;e[64]!==a?(me=a("Role (optional)"),e[64]=a,e[65]=me):me=e[65];let he;e[66]!==me?(he=(0,t.jsx)(D,{htmlFor:"uc-role",children:me}),e[66]=me,e[67]=he):he=e[67];let pe;e[68]!==h?(pe=(0,t.jsx)(L,{"data-testid":"uc-role",id:"uc-role",onChange:Pe,value:h}),e[68]=h,e[69]=pe):pe=e[69];let fe;e[70]!==he||e[71]!==pe?(fe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[he,pe]}),e[70]=he,e[71]=pe,e[72]=fe):fe=e[72];let be;e[73]!==o.userFields||e[74]!==B||e[75]!==a?(be=o.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),o.userFields.map(p=>{let _=`uc-field-${p.name}`,V=p.required?"":` (${a("optional")})`;if(p.type==="boolean"){let Ee=B(p)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:_,children:[(0,t.jsx)(Ke,{checked:Ee,"data-testid":_,id:_,onCheckedChange:r(Xe=>{Re(p.name,Xe)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[p.name,V]})]},p.name)}let He=B(p);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(D,{htmlFor:_,children:[p.name,V]}),(0,t.jsx)(L,{"data-testid":_,id:_,onChange:r(Ee=>{Re(p.name,Ee.target.value)},"onChange"),type:lt[p.type],value:typeof He=="string"?He:""})]},p.name)})]}),e[73]=o.userFields,e[74]=B,e[75]=a,e[76]=be):be=e[76];let ve;e[77]!==n?(ve=n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n}),e[77]=n,e[78]=ve):ve=e[78];let xe;e[79]!==a?(xe=a("Cancel"),e[79]=a,e[80]=xe):xe=e[80];let ye;e[81]!==l||e[82]!==xe?(ye=(0,t.jsx)(z,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:xe}),e[81]=l,e[82]=xe,e[83]=ye):ye=e[83];let Te=!De,ge;e[84]!==i||e[85]!==a?(ge=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Te||e[89]!==ge?(Ne=(0,t.jsx)(z,{"data-testid":"uc-submit",disabled:Te,onClick:N,size:"sm",type:"button",children:ge}),e[87]=N,e[88]=Te,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]}),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Be;return e[94]!==l||e[95]!==j||e[96]!==M||e[97]!==se||e[98]!==ne||e[99]!==ue||e[100]!==fe||e[101]!==be||e[102]!==ve||e[103]!==ke?(Be=(0,t.jsxs)(Ve,{label:j,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[M,se,ne,ue,fe,be,ve,ke]}),e[94]=l,e[95]=j,e[96]=M,e[97]=se,e[98]=ne,e[99]=ue,e[100]=fe,e[101]=be,e[102]=ve,e[103]=ke,e[104]=Be):Be=e[104],Be},"nt"),Oe=r(u=>{let e=(0,W.c)(2),{children:l}=u,s;return e[0]!==l?(s=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=s):s=e[1],s},"Oe"),dt=r(u=>{let e=(0,W.c)(29),{busy:l,runAction:s,userId:c,version:a}=u,o=O(),i=H(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==o||e[1]!==c?(x=r(()=>{ze((async()=>{S(null);try{let v=await o.listAuthSessions({limit:50,userId:c});m(v.rows)}catch(v){let F=v;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==o||e[8]!==s?(y=r(v=>{s(()=>o.revokeAuthSession({sessionId:v}))},"y"),e[7]=o,e[8]=s,e[9]=y):y=e[9];let I=y,h;e[10]!==i?(h=i("Sessions"),e[10]=i,e[11]=h):h=e[11];let g;e[12]!==h?(g=(0,t.jsx)(Oe,{children:h}),e[12]=h,e[13]=g):g=e[13];let b;e[14]!==w?(b=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w}),e[14]=w,e[15]=b):b=e[15];let f;e[16]!==n||e[17]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=n,e[17]=i,e[18]=f):f=e[18];let d;e[19]!==l||e[20]!==I||e[21]!==n||e[22]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("expires")}),(0,t.jsx)(U,{children:i("ip")}),(0,t.jsx)(U,{children:i("user agent")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(_e,{children:n.map(v=>(0,t.jsxs)(q,{"data-testid":`ud-session-${v.id}`,children:[(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(v.expiresAt)}),(0,t.jsx)($,{children:v.ipAddress??""}),(0,t.jsx)($,{className:"max-w-40 truncate",children:v.userAgent??""}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-revoke-${v.id}`,disabled:l,onClick:r(()=>{I(v.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},v.id))})]})})}),e[19]=l,e[20]=I,e[21]=n,e[22]=i,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==b||e[26]!==f||e[27]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,b,f,d]}),e[24]=g,e[25]=b,e[26]=f,e[27]=d,e[28]=A):A=e[28],A},"rt"),ot=r(u=>{let e=(0,W.c)(30),{busy:l,runAction:s,userId:c,version:a}=u,o=O(),i=H(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),x;e[0]!==o||e[1]!==c?(x=r(()=>{ze((async()=>{S(null);try{m(await o.listAuthAccounts({userId:c}))}catch(v){let F=v;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=x):x=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(x,C);let y;e[7]!==o||e[8]!==s||e[9]!==c?(y=r(v=>{s(()=>o.unlinkAuthAccount({accountId:v,userId:c}))},"y"),e[7]=o,e[8]=s,e[9]=c,e[10]=y):y=e[10];let I=y,h;e[11]!==i?(h=i("Linked accounts"),e[11]=i,e[12]=h):h=e[12];let g;e[13]!==h?(g=(0,t.jsx)(Oe,{children:h}),e[13]=h,e[14]=g):g=e[14];let b;e[15]!==w?(b=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:w}),e[15]=w,e[16]=b):b=e[16];let f;e[17]!==n||e[18]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=n,e[18]=i,e[19]=f):f=e[19];let d;e[20]!==n||e[21]!==l||e[22]!==I||e[23]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:i("provider")}),(0,t.jsx)(U,{children:i("created")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)(_e,{children:n.map(v=>{let F=Ae(v.id);return(0,t.jsxs)(q,{"data-testid":`ud-account-${F}`,children:[(0,t.jsx)($,{children:Ae(v.providerId)}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(v.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-unlink-${F}`,disabled:l,onClick:r(()=>{I(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},F)})})]})})}),e[20]=n,e[21]=l,e[22]=I,e[23]=i,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==b||e[27]!==f||e[28]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,b,f,d]}),e[25]=g,e[26]=b,e[27]=f,e[28]=d,e[29]=A):A=e[29],A},"it"),ct=r(u=>{let e=(0,W.c)(40),{busy:l,capabilities:s,runAction:c,userId:a,version:o}=u,i=O(),n=H(),[m,w]=(0,k.useState)(null),S;e[0]!==s.passkey||e[1]!==i||e[2]!==a?(S=r(()=>{s.passkey&&ze((async()=>{try{w(await i.listAuthPasskeys({userId:a}))}catch{w(null)}})())},"S"),e[0]=s.passkey,e[1]=i,e[2]=a,e[3]=S):S=e[3];let x;e[4]!==s.passkey||e[5]!==i||e[6]!==a||e[7]!==o?(x=[s.passkey,i,a,o],e[4]=s.passkey,e[5]=i,e[6]=a,e[7]=o,e[8]=x):x=e[8],(0,k.useEffect)(S,x);let C;e[9]!==i||e[10]!==c||e[11]!==a?(C=r(()=>{c(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=c,e[11]=a,e[12]=C):C=e[12];let y=C,I;e[13]!==i||e[14]!==c?(I=r(F=>{c(()=>i.deleteAuthPasskey({passkeyId:F}))},"A"),e[13]=i,e[14]=c,e[15]=I):I=e[15];let h=I,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let b;e[18]!==g?(b=(0,t.jsx)(Oe,{children:g}),e[18]=g,e[19]=b):b=e[19];let f;e[20]!==l||e[21]!==s.twoFactor||e[22]!==y||e[23]!==n?(f=s.twoFactor&&(0,t.jsx)(z,{"data-testid":"ud-disable-2fa",disabled:l,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")}),e[20]=l,e[21]=s.twoFactor,e[22]=y,e[23]=n,e[24]=f):f=e[24];let d;e[25]!==s.passkey||e[26]!==m||e[27]!==n?(d=s.passkey&&m!==null&&m.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")}),e[25]=s.passkey,e[26]=m,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==l||e[30]!==s.passkey||e[31]!==h||e[32]!==m||e[33]!==n?(A=s.passkey&&m!==null&&m.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)(_e,{children:m.map(F=>{let T=Ae(F.id);return(0,t.jsxs)(q,{"data-testid":`ud-passkey-${T}`,children:[(0,t.jsx)($,{children:Ae(F.name)||T}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(F.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`ud-delete-passkey-${T}`,disabled:l,onClick:r(()=>{h(T)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})})]},T)})})]})})}),e[29]=l,e[30]=s.passkey,e[31]=h,e[32]=m,e[33]=n,e[34]=A):A=e[34];let v;return e[35]!==b||e[36]!==f||e[37]!==d||e[38]!==A?(v=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,f,d,A]}),e[35]=b,e[36]=f,e[37]=d,e[38]=A,e[39]=v):v=e[39],v},"ot"),ut=/(?:at|expires)$/iu,mt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),ht=r((u,e)=>typeof e=="number"&&ut.test(u)?Ie(e):Ae(e),"ut"),pt=r(({capabilities:u,onChanged:e,onClose:l,user:s})=>{let c=O(),a=H(),o=s.banned===!0,[i,n]=(0,k.useState)(null),[m,w]=(0,k.useState)(!1),[S,x]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof s.role=="string"?s.role:""),[I,h]=(0,k.useState)(""),[g,b]=(0,k.useState)(""),[f,d]=(0,k.useState)(""),[A,v]=(0,k.useState)(null),[F,T]=(0,k.useState)(!1),R=r((N,j)=>{ze((async()=>{w(!0),n(null);try{let E=await N();j?.refresh!==!1&&(x(M=>M+1),e()),j?.onResult?.(E)}catch(E){n(je(E))}w(!1)})())},"T"),Le=r(N=>{y(N.target.value)},"ze"),Z=r(N=>{h(N.target.value)},"q"),Pe=r(N=>{b(N.target.value)},"Be"),J=r(N=>{d(N.target.value)},"Y"),Re=r(()=>{let N=C.trim();N!==""&&R(async()=>{await c.setAuthUserRole({role:N,userId:s.id})})},"Ue"),Q=r(()=>{let N=Number.parseInt(g,10),j=Number.isFinite(N)&&N>0?N*86400:void 0;R(async()=>{await c.banAuthUser({expiresInSeconds:j,reason:I.trim()===""?void 0:I.trim(),userId:s.id})})},"G"),B=r(()=>{R(async()=>{await c.unbanAuthUser({userId:s.id})})},"E"),Y=r(()=>{R(async()=>{await c.setAuthUserPassword({newPassword:f,userId:s.id}),d("")})},"Q"),Fe=r(()=>{R(()=>c.impersonateAuthUser({userId:s.id}),{onResult:r(N=>{v(N.token)},"onResult"),refresh:!1})},"we"),G=r(()=>{R(async()=>{await c.revokeAuthUserSessions({userId:s.id})})},"Z"),De=r(()=>{R(async()=>{await c.removeAuthUser({userId:s.id}),l()})},"$e"),K=r(()=>{T(!0)},"W"),Se=r(()=>{T(!1)},"Ce"),X=Object.entries(s).filter(([N])=>!mt.has(N));return(0,t.jsxs)(Ve,{label:a("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s.name??s.email??s.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:s.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof s.role=="string"&&s.role!==""&&(0,t.jsx)(P,{variant:"secondary",children:s.role}),o?(0,t.jsx)(P,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(P,{variant:"outline",children:a("Active")}),s.emailVerified===!0?(0,t.jsx)(P,{variant:"secondary",children:a("verified")}):(0,t.jsx)(P,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(z,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),i!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:i}),u.admin&&(0,t.jsxs)(we,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Actions")})}),(0,t.jsxs)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(L,{"data-testid":"ud-role-input",id:"ud-role",onChange:Le,value:C})]}),(0,t.jsx)(z,{"data-testid":"ud-set-role",disabled:m||C.trim()==="",onClick:Re,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),o?(0,t.jsx)(z,{"data-testid":"ud-unban",disabled:m,onClick:B,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-reason",children:a("Ban reason (optional)")}),(0,t.jsx)(L,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:Z,value:I})]}),(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-days",children:a("Days")}),(0,t.jsx)(L,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:Pe,type:"number",value:g})]}),(0,t.jsx)(z,{"data-testid":"ud-ban",disabled:m,onClick:Q,size:"sm",type:"button",variant:"destructive",children:a("Ban user")})]}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(L,{"data-testid":"ud-password",id:"ud-password",onChange:J,type:"password",value:f})]}),(0,t.jsx)(z,{"data-testid":"ud-set-password",disabled:m||f==="",onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(z,{"data-testid":"ud-impersonate",disabled:m,onClick:Fe,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(z,{"data-testid":"ud-revoke-all",disabled:m,onClick:G,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),F?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z,{"data-testid":"ud-delete-confirm",disabled:m,onClick:De,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(z,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(z,{"data-testid":"ud-delete",disabled:m,onClick:K,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),A!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(D,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(L,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A})]})]})]}),(0,t.jsx)(dt,{busy:m,runAction:R,userId:s.id,version:S}),u.accounts&&(0,t.jsx)(ot,{busy:m,runAction:R,userId:s.id,version:S}),(u.twoFactor||u.passkey)&&(0,t.jsx)(ct,{busy:m,capabilities:u,runAction:R,userId:s.id,version:S}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:X.map(([N,j])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:ht(N,j)})]},N))})]})]})},"mt"),ft=50,Rt=r(({pageSize:u=ft}={})=>{let e=O(),l=H(),[s,c]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),i=Ge(s),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:x}=st(),C=i.trim(),y=a.trim(),I=Ze(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),h=I.data?.rows??null,g=I.error,b=r(()=>{I.refetch()},"b");Je(()=>{I.refetch()},!0);let f=n===null?null:h?.find(d=>d.id===n)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(L,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:r(d=>{c(d.target.value)},"onChange"),placeholder:l("Search by email or name\u2026"),value:s}),(0,t.jsx)(L,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:r(d=>{o(d.target.value)},"onChange"),placeholder:l("Filter by role"),value:a}),(0,t.jsx)(z,{"data-testid":"us-new",onClick:r(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:l("New user")})]}),g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&(0,t.jsx)(We,{description:l("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:l("No users.")}),h!==null&&h.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"us-table",children:[(0,t.jsx)($e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:l("id")}),(0,t.jsx)(U,{children:l("email")}),(0,t.jsx)(U,{children:l("name")}),(0,t.jsx)(U,{children:l("role")}),(0,t.jsx)(U,{children:l("status")}),(0,t.jsx)(U,{children:l("verified")}),(0,t.jsx)(U,{children:l("created")}),(0,t.jsx)(U,{"aria-label":l("Actions")})]})}),(0,t.jsx)(_e,{children:h.map(d=>(0,t.jsxs)(q,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsx)($,{className:"font-mono text-xs",children:d.id}),(0,t.jsx)($,{children:d.email??""}),(0,t.jsx)($,{children:d.name??""}),(0,t.jsx)($,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsx)(P,{variant:"secondary",children:d.role}):""}),(0,t.jsx)($,{children:d.banned===!0?(0,t.jsx)(P,{variant:"destructive",children:l("Banned")}):(0,t.jsx)(P,{variant:"success",children:l("Active")})}),(0,t.jsx)($,{children:d.emailVerified===!0?(0,t.jsx)(P,{variant:"success",children:l("yes")}):(0,t.jsx)(P,{variant:"outline",children:l("no")})}),(0,t.jsx)($,{className:"text-muted-foreground tabular-nums",children:Ie(d.createdAt)}),(0,t.jsx)($,{children:(0,t.jsx)(z,{"data-testid":`us-manage-${d.id}`,onClick:r(()=>{m(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},d.id))})]})})}),f!==null&&(0,t.jsx)(pt,{capabilities:x,onChanged:b,onClose:r(()=>{m(null)},"onClose"),user:f}),w&&(0,t.jsx)(nt,{onClose:r(()=>{S(!1)},"onClose"),onCreated:b})]})},"Et");export{Rt as UsersPanel};
@@ -1 +1 @@
1
- import{a as G}from"./chunk-EA2JKR5D.js";import{a as x}from"./chunk-IMOHEGMV.js";import{a as U}from"./chunk-IFLTA2OD.js";import{b as M}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{P as O}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as h}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as w}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as E}from"./chunk-CXNZVJ3S.js";import{f as D}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{d as K,e as _,f as z,h as B,o as P,r as q}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-YKXDMIHQ.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");p("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),p("success"),L("success")}catch(l){y(void 0),N(l.message),p("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
1
+ import{a as G}from"./chunk-EA2JKR5D.js";import{a as x}from"./chunk-IMOHEGMV.js";import{a as U}from"./chunk-IFLTA2OD.js";import{b as M}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{P as O}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as h}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as w}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{f as D}from"./chunk-XDT5DXOI.js";import"./chunk-FSRSK4LY.js";import{d as K,e as _,f as z,h as B,o as P,r as q}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-YKXDMIHQ.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");p("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),p("success"),L("success")}catch(l){y(void 0),N(l.message),p("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
@@ -1 +1 @@
1
- import{a as q}from"./chunk-PKCC4J5W.js";import{a as k}from"./chunk-DEJLINCJ.js";import"./chunk-4GTO7FL5.js";import"./chunk-XSLMHPP2.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import{a as A}from"./chunk-S3CRZLGS.js";import{a as $}from"./chunk-IFLTA2OD.js";import"./chunk-OGUKYRFM.js";import"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-5GFSKIB2.js";import{b as K}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as F}from"./chunk-JAZCU2PP.js";import"./chunk-ULIQFBZU.js";import"./chunk-OOESPRIZ.js";import"./chunk-35DM4JJG.js";import{a as T}from"./chunk-CXNZVJ3S.js";import{c as S}from"./chunk-ECQTVV2J.js";import"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{a as O}from"./chunk-FKVZRPV5.js";import{a as j,e as w}from"./chunk-WUWBZPUK.js";import{d as I,r as E}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as p,d as C,f as D,g as H}from"./chunk-YKXDMIHQ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
1
+ import{a as q}from"./chunk-PKCC4J5W.js";import{a as k}from"./chunk-DEJLINCJ.js";import"./chunk-4GTO7FL5.js";import"./chunk-XSLMHPP2.js";import"./chunk-5JDWLCSH.js";import"./chunk-PYT4RZJH.js";import{a as A}from"./chunk-S3CRZLGS.js";import{a as $}from"./chunk-IFLTA2OD.js";import"./chunk-OGUKYRFM.js";import"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-5GFSKIB2.js";import{b as K}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as F}from"./chunk-W7E5WYFI.js";import"./chunk-ULIQFBZU.js";import"./chunk-WHWI6KXH.js";import"./chunk-35DM4JJG.js";import{a as T}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-L6KA7M4B.js";import"./chunk-XDT5DXOI.js";import"./chunk-FSRSK4LY.js";import{a as O}from"./chunk-FKVZRPV5.js";import{a as j,e as w}from"./chunk-WUWBZPUK.js";import{d as I,r as E}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as p,d as C,f as D,g as H}from"./chunk-YKXDMIHQ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
@@ -1,4 +1,4 @@
1
- import{a as Yi,b as Ve,c as Ri,d as Je,e as Zi,f as xi,k as ji}from"./chunk-U4IH7O6B.js";import"./chunk-Q4CAKBWN.js";import"./chunk-WLGZOFKE.js";import"./chunk-RLLKECZT.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import{a as Ci}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-5WJXVZMZ.js";import"./chunk-PYT4RZJH.js";import"./chunk-K7AJEMKE.js";import"./chunk-JVUZEYKQ.js";import{a as Le}from"./chunk-OKG3HWSJ.js";import{P as Xi}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import{a as zd}from"./chunk-4L4WTGN5.js";import{a as Gi}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ke}from"./chunk-OOESPRIZ.js";import"./chunk-35DM4JJG.js";import"./chunk-CXNZVJ3S.js";import"./chunk-ECQTVV2J.js";import{a as Hi,e as qi}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import"./chunk-FKVZRPV5.js";import"./chunk-WUWBZPUK.js";import{a as Qi,d as je,p as pi}from"./chunk-Y4Q25F6X.js";import{c as _i}from"./chunk-T2IE5GKA.js";import{a as c,b as vn,d as fu,e as Ni,f as Ad,g as Bi,i as xe}from"./chunk-YKXDMIHQ.js";var ri=vn(w=>{"use strict";function $e(l,t){var a=l.length;l.push(t);l:for(;0<a;){var u=a-1>>>1,n=l[u];if(0<dn(n,t))l[u]=t,l[a]=n,a=u;else break l}}c($e,"push");function wl(l){return l.length===0?null:l[0]}c(wl,"peek");function hn(l){if(l.length===0)return null;var t=l[0],a=l.pop();if(a!==t){l[0]=a;l:for(var u=0,n=l.length,e=n>>>1;u<e;){var f=2*(u+1)-1,i=l[f],m=f+1,y=l[m];if(0>dn(i,a))m<n&&0>dn(y,i)?(l[u]=y,l[m]=a,u=m):(l[u]=i,l[f]=a,u=f);else if(m<n&&0>dn(y,a))l[u]=y,l[m]=a,u=m;else break l}}return t}c(hn,"pop");function dn(l,t){var a=l.sortIndex-t.sortIndex;return a!==0?a:l.id-t.id}c(dn,"compare");w.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Vi=performance,w.unstable_now=function(){return Vi.now()}):(We=Date,Li=We.now(),w.unstable_now=function(){return We.now()-Li});var Vi,We,Li,tt=[],Et=[],Td=1,Ql=null,Sl=3,ke=!1,iu=!1,mu=!1,re=!1,Wi=typeof setTimeout=="function"?setTimeout:null,wi=typeof clearTimeout=="function"?clearTimeout:null,Ki=typeof setImmediate<"u"?setImmediate:null;function yn(l){for(var t=wl(Et);t!==null;){if(t.callback===null)hn(Et);else if(t.startTime<=l)hn(Et),t.sortIndex=t.expirationTime,$e(tt,t);else break;t=wl(Et)}}c(yn,"advanceTimers");function Ie(l){if(mu=!1,yn(l),!iu)if(wl(tt)!==null)iu=!0,ga||(ga=!0,oa());else{var t=wl(Et);t!==null&&Pe(Ie,t.startTime-l)}}c(Ie,"handleTimeout");var ga=!1,vu=-1,Fi=5,$i=-1;function ki(){return re?!0:!(w.unstable_now()-$i<Fi)}c(ki,"shouldYieldToHost");function we(){if(re=!1,ga){var l=w.unstable_now();$i=l;var t=!0;try{l:{iu=!1,mu&&(mu=!1,wi(vu),vu=-1),ke=!0;var a=Sl;try{t:{for(yn(l),Ql=wl(tt);Ql!==null&&!(Ql.expirationTime>l&&ki());){var u=Ql.callback;if(typeof u=="function"){Ql.callback=null,Sl=Ql.priorityLevel;var n=u(Ql.expirationTime<=l);if(l=w.unstable_now(),typeof n=="function"){Ql.callback=n,yn(l),t=!0;break t}Ql===wl(tt)&&hn(tt),yn(l)}else hn(tt);Ql=wl(tt)}if(Ql!==null)t=!0;else{var e=wl(Et);e!==null&&Pe(Ie,e.startTime-l),t=!1}}break l}finally{Ql=null,Sl=a,ke=!1}t=void 0}}finally{t?oa():ga=!1}}}c(we,"performWorkUntilDeadline");var oa;typeof Ki=="function"?oa=c(function(){Ki(we)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(Fe=new MessageChannel,Ji=Fe.port2,Fe.port1.onmessage=we,oa=c(function(){Ji.postMessage(null)},"schedulePerformWorkUntilDeadline")):oa=c(function(){Wi(we,0)},"schedulePerformWorkUntilDeadline");var Fe,Ji;function Pe(l,t){vu=Wi(function(){l(w.unstable_now())},t)}c(Pe,"requestHostTimeout");w.unstable_IdlePriority=5;w.unstable_ImmediatePriority=1;w.unstable_LowPriority=4;w.unstable_NormalPriority=3;w.unstable_Profiling=null;w.unstable_UserBlockingPriority=2;w.unstable_cancelCallback=function(l){l.callback=null};w.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Fi=0<l?Math.floor(1e3/l):5};w.unstable_getCurrentPriorityLevel=function(){return Sl};w.unstable_next=function(l){switch(Sl){case 1:case 2:case 3:var t=3;break;default:t=Sl}var a=Sl;Sl=t;try{return l()}finally{Sl=a}};w.unstable_requestPaint=function(){re=!0};w.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var a=Sl;Sl=l;try{return t()}finally{Sl=a}};w.unstable_scheduleCallback=function(l,t,a){var u=w.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?u+a:u):a=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,l={id:Td++,callback:t,priorityLevel:l,startTime:a,expirationTime:n,sortIndex:-1},a>u?(l.sortIndex=a,$e(Et,l),wl(tt)===null&&l===wl(Et)&&(mu?(wi(vu),vu=-1):mu=!0,Pe(Ie,a-u))):(l.sortIndex=n,$e(tt,l),iu||ke||(iu=!0,ga||(ga=!0,oa()))),l};w.unstable_shouldYield=ki;w.unstable_wrapCallback=function(l){var t=Sl;return function(){var a=Sl;Sl=t;try{return l.apply(this,arguments)}finally{Sl=a}}}});var Pi=vn((e2,Ii)=>{"use strict";Ii.exports=ri()});var dd=vn(Re=>{"use strict";var el=Pi(),U1=Ni(),Ed=zd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}c(z,"formatProdErrorMessage");function D1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}c(D1,"isValidContainer");function ku(l){var t=l,a=l;if(l.alternate)for(;t.return;)t=t.return;else{l=t;do t=l,(t.flags&4098)!==0&&(a=t.return),l=t.return;while(l)}return t.tag===3?a:null}c(ku,"getNearestMountedFiber");function _1(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(_1,"getSuspenseInstanceFromFiber");function N1(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(N1,"getActivityInstanceFromFiber");function l0(l){if(ku(l)!==l)throw Error(z(188))}c(l0,"assertIsMounted");function Md(l){var t=l.alternate;if(!t){if(t=ku(l),t===null)throw Error(z(188));return t!==l?null:l}for(var a=l,u=t;;){var n=a.return;if(n===null)break;var e=n.alternate;if(e===null){if(u=n.return,u!==null){a=u;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===a)return l0(n),l;if(e===u)return l0(n),t;e=e.sibling}throw Error(z(188))}if(a.return!==u.return)a=n,u=e;else{for(var f=!1,i=n.child;i;){if(i===a){f=!0,a=n,u=e;break}if(i===u){f=!0,u=n,a=e;break}i=i.sibling}if(!f){for(i=e.child;i;){if(i===a){f=!0,a=e,u=n;break}if(i===u){f=!0,u=e,a=n;break}i=i.sibling}if(!f)throw Error(z(189))}}if(a.alternate!==u)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?l:t}c(Md,"findCurrentFiberUsingSlowPath");function H1(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=H1(l),t!==null)return t;l=l.sibling}return null}c(H1,"findCurrentHostFiberImpl");var W=Object.assign,Od=Symbol.for("react.element"),Sn=Symbol.for("react.transitional.element"),su=Symbol.for("react.portal"),Ea=Symbol.for("react.fragment"),B1=Symbol.for("react.strict_mode"),Qc=Symbol.for("react.profiler"),q1=Symbol.for("react.consumer"),mt=Symbol.for("react.context"),Hf=Symbol.for("react.forward_ref"),Xc=Symbol.for("react.suspense"),Gc=Symbol.for("react.suspense_list"),Bf=Symbol.for("react.memo"),Mt=Symbol.for("react.lazy"),pc=Symbol.for("react.activity"),Ud=Symbol.for("react.memo_cache_sentinel"),t0=Symbol.iterator;function du(l){return l===null||typeof l!="object"?null:(l=t0&&l[t0]||l["@@iterator"],typeof l=="function"?l:null)}c(du,"getIteratorFn");var Dd=Symbol.for("react.client.reference");function Cc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Dd?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Ea:return"Fragment";case Qc:return"Profiler";case B1:return"StrictMode";case Xc:return"Suspense";case Gc:return"SuspenseList";case pc:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case su:return"Portal";case mt:return l.displayName||"Context";case q1:return(l._context.displayName||"Context")+".Consumer";case Hf:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Bf:return t=l.displayName||null,t!==null?t:Cc(l.type)||"Memo";case Mt:t=l._payload,l=l._init;try{return Cc(l(t))}catch{}}return null}c(Cc,"getComponentNameFromType");var zu=Array.isArray,_=U1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,p=Ed.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,la={pending:!1,data:null,method:null,action:null},Rc=[],Ma=-1;function Il(l){return{current:l}}c(Il,"createCursor");function il(l){0>Ma||(l.current=Rc[Ma],Rc[Ma]=null,Ma--)}c(il,"pop");function L(l,t){Ma++,Rc[Ma]=l.current,l.current=t}c(L,"push");var rl=Il(null),pu=Il(null),Xt=Il(null),wn=Il(null);function Fn(l,t){switch(L(Xt,t),L(pu,l),L(rl,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?i1(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=i1(t),l=rv(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}il(rl),L(rl,l)}c(Fn,"pushHostContainer");function ja(){il(rl),il(pu),il(Xt)}c(ja,"popHostContainer");function Zc(l){l.memoizedState!==null&&L(wn,l);var t=rl.current,a=rv(t,l.type);t!==a&&(L(pu,l),L(rl,a))}c(Zc,"pushHostContext");function $n(l){pu.current===l&&(il(rl),il(pu)),wn.current===l&&(il(wn),wu._currentValue=la)}c($n,"popHostContext");var lc,a0;function kt(l){if(lc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);lc=t&&t[1]||"",a0=-1<a.stack.indexOf(`
1
+ import{a as Yi,b as Ve,c as Ri,d as Je,e as Zi,f as xi,k as ji}from"./chunk-BDZFZT2N.js";import"./chunk-Q4CAKBWN.js";import"./chunk-37VWQZEF.js";import"./chunk-RLLKECZT.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import{a as Ci}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-5WJXVZMZ.js";import"./chunk-PYT4RZJH.js";import"./chunk-K7AJEMKE.js";import"./chunk-JVUZEYKQ.js";import{a as Le}from"./chunk-OKG3HWSJ.js";import{P as Xi}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import{a as zd}from"./chunk-4L4WTGN5.js";import{a as Gi}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ke}from"./chunk-WHWI6KXH.js";import"./chunk-35DM4JJG.js";import"./chunk-4ZEL6BYL.js";import"./chunk-L6KA7M4B.js";import{a as Hi,e as qi}from"./chunk-XDT5DXOI.js";import"./chunk-FSRSK4LY.js";import"./chunk-FKVZRPV5.js";import"./chunk-WUWBZPUK.js";import{a as Qi,d as je,p as pi}from"./chunk-Y4Q25F6X.js";import{c as _i}from"./chunk-T2IE5GKA.js";import{a as c,b as vn,d as fu,e as Ni,f as Ad,g as Bi,i as xe}from"./chunk-YKXDMIHQ.js";var ri=vn(w=>{"use strict";function $e(l,t){var a=l.length;l.push(t);l:for(;0<a;){var u=a-1>>>1,n=l[u];if(0<dn(n,t))l[u]=t,l[a]=n,a=u;else break l}}c($e,"push");function wl(l){return l.length===0?null:l[0]}c(wl,"peek");function hn(l){if(l.length===0)return null;var t=l[0],a=l.pop();if(a!==t){l[0]=a;l:for(var u=0,n=l.length,e=n>>>1;u<e;){var f=2*(u+1)-1,i=l[f],m=f+1,y=l[m];if(0>dn(i,a))m<n&&0>dn(y,i)?(l[u]=y,l[m]=a,u=m):(l[u]=i,l[f]=a,u=f);else if(m<n&&0>dn(y,a))l[u]=y,l[m]=a,u=m;else break l}}return t}c(hn,"pop");function dn(l,t){var a=l.sortIndex-t.sortIndex;return a!==0?a:l.id-t.id}c(dn,"compare");w.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Vi=performance,w.unstable_now=function(){return Vi.now()}):(We=Date,Li=We.now(),w.unstable_now=function(){return We.now()-Li});var Vi,We,Li,tt=[],Et=[],Td=1,Ql=null,Sl=3,ke=!1,iu=!1,mu=!1,re=!1,Wi=typeof setTimeout=="function"?setTimeout:null,wi=typeof clearTimeout=="function"?clearTimeout:null,Ki=typeof setImmediate<"u"?setImmediate:null;function yn(l){for(var t=wl(Et);t!==null;){if(t.callback===null)hn(Et);else if(t.startTime<=l)hn(Et),t.sortIndex=t.expirationTime,$e(tt,t);else break;t=wl(Et)}}c(yn,"advanceTimers");function Ie(l){if(mu=!1,yn(l),!iu)if(wl(tt)!==null)iu=!0,ga||(ga=!0,oa());else{var t=wl(Et);t!==null&&Pe(Ie,t.startTime-l)}}c(Ie,"handleTimeout");var ga=!1,vu=-1,Fi=5,$i=-1;function ki(){return re?!0:!(w.unstable_now()-$i<Fi)}c(ki,"shouldYieldToHost");function we(){if(re=!1,ga){var l=w.unstable_now();$i=l;var t=!0;try{l:{iu=!1,mu&&(mu=!1,wi(vu),vu=-1),ke=!0;var a=Sl;try{t:{for(yn(l),Ql=wl(tt);Ql!==null&&!(Ql.expirationTime>l&&ki());){var u=Ql.callback;if(typeof u=="function"){Ql.callback=null,Sl=Ql.priorityLevel;var n=u(Ql.expirationTime<=l);if(l=w.unstable_now(),typeof n=="function"){Ql.callback=n,yn(l),t=!0;break t}Ql===wl(tt)&&hn(tt),yn(l)}else hn(tt);Ql=wl(tt)}if(Ql!==null)t=!0;else{var e=wl(Et);e!==null&&Pe(Ie,e.startTime-l),t=!1}}break l}finally{Ql=null,Sl=a,ke=!1}t=void 0}}finally{t?oa():ga=!1}}}c(we,"performWorkUntilDeadline");var oa;typeof Ki=="function"?oa=c(function(){Ki(we)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(Fe=new MessageChannel,Ji=Fe.port2,Fe.port1.onmessage=we,oa=c(function(){Ji.postMessage(null)},"schedulePerformWorkUntilDeadline")):oa=c(function(){Wi(we,0)},"schedulePerformWorkUntilDeadline");var Fe,Ji;function Pe(l,t){vu=Wi(function(){l(w.unstable_now())},t)}c(Pe,"requestHostTimeout");w.unstable_IdlePriority=5;w.unstable_ImmediatePriority=1;w.unstable_LowPriority=4;w.unstable_NormalPriority=3;w.unstable_Profiling=null;w.unstable_UserBlockingPriority=2;w.unstable_cancelCallback=function(l){l.callback=null};w.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Fi=0<l?Math.floor(1e3/l):5};w.unstable_getCurrentPriorityLevel=function(){return Sl};w.unstable_next=function(l){switch(Sl){case 1:case 2:case 3:var t=3;break;default:t=Sl}var a=Sl;Sl=t;try{return l()}finally{Sl=a}};w.unstable_requestPaint=function(){re=!0};w.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var a=Sl;Sl=l;try{return t()}finally{Sl=a}};w.unstable_scheduleCallback=function(l,t,a){var u=w.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?u+a:u):a=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,l={id:Td++,callback:t,priorityLevel:l,startTime:a,expirationTime:n,sortIndex:-1},a>u?(l.sortIndex=a,$e(Et,l),wl(tt)===null&&l===wl(Et)&&(mu?(wi(vu),vu=-1):mu=!0,Pe(Ie,a-u))):(l.sortIndex=n,$e(tt,l),iu||ke||(iu=!0,ga||(ga=!0,oa()))),l};w.unstable_shouldYield=ki;w.unstable_wrapCallback=function(l){var t=Sl;return function(){var a=Sl;Sl=t;try{return l.apply(this,arguments)}finally{Sl=a}}}});var Pi=vn((e2,Ii)=>{"use strict";Ii.exports=ri()});var dd=vn(Re=>{"use strict";var el=Pi(),U1=Ni(),Ed=zd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}c(z,"formatProdErrorMessage");function D1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}c(D1,"isValidContainer");function ku(l){var t=l,a=l;if(l.alternate)for(;t.return;)t=t.return;else{l=t;do t=l,(t.flags&4098)!==0&&(a=t.return),l=t.return;while(l)}return t.tag===3?a:null}c(ku,"getNearestMountedFiber");function _1(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(_1,"getSuspenseInstanceFromFiber");function N1(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(N1,"getActivityInstanceFromFiber");function l0(l){if(ku(l)!==l)throw Error(z(188))}c(l0,"assertIsMounted");function Md(l){var t=l.alternate;if(!t){if(t=ku(l),t===null)throw Error(z(188));return t!==l?null:l}for(var a=l,u=t;;){var n=a.return;if(n===null)break;var e=n.alternate;if(e===null){if(u=n.return,u!==null){a=u;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===a)return l0(n),l;if(e===u)return l0(n),t;e=e.sibling}throw Error(z(188))}if(a.return!==u.return)a=n,u=e;else{for(var f=!1,i=n.child;i;){if(i===a){f=!0,a=n,u=e;break}if(i===u){f=!0,u=n,a=e;break}i=i.sibling}if(!f){for(i=e.child;i;){if(i===a){f=!0,a=e,u=n;break}if(i===u){f=!0,u=e,a=n;break}i=i.sibling}if(!f)throw Error(z(189))}}if(a.alternate!==u)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?l:t}c(Md,"findCurrentFiberUsingSlowPath");function H1(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=H1(l),t!==null)return t;l=l.sibling}return null}c(H1,"findCurrentHostFiberImpl");var W=Object.assign,Od=Symbol.for("react.element"),Sn=Symbol.for("react.transitional.element"),su=Symbol.for("react.portal"),Ea=Symbol.for("react.fragment"),B1=Symbol.for("react.strict_mode"),Qc=Symbol.for("react.profiler"),q1=Symbol.for("react.consumer"),mt=Symbol.for("react.context"),Hf=Symbol.for("react.forward_ref"),Xc=Symbol.for("react.suspense"),Gc=Symbol.for("react.suspense_list"),Bf=Symbol.for("react.memo"),Mt=Symbol.for("react.lazy"),pc=Symbol.for("react.activity"),Ud=Symbol.for("react.memo_cache_sentinel"),t0=Symbol.iterator;function du(l){return l===null||typeof l!="object"?null:(l=t0&&l[t0]||l["@@iterator"],typeof l=="function"?l:null)}c(du,"getIteratorFn");var Dd=Symbol.for("react.client.reference");function Cc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Dd?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Ea:return"Fragment";case Qc:return"Profiler";case B1:return"StrictMode";case Xc:return"Suspense";case Gc:return"SuspenseList";case pc:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case su:return"Portal";case mt:return l.displayName||"Context";case q1:return(l._context.displayName||"Context")+".Consumer";case Hf:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Bf:return t=l.displayName||null,t!==null?t:Cc(l.type)||"Memo";case Mt:t=l._payload,l=l._init;try{return Cc(l(t))}catch{}}return null}c(Cc,"getComponentNameFromType");var zu=Array.isArray,_=U1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,p=Ed.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,la={pending:!1,data:null,method:null,action:null},Rc=[],Ma=-1;function Il(l){return{current:l}}c(Il,"createCursor");function il(l){0>Ma||(l.current=Rc[Ma],Rc[Ma]=null,Ma--)}c(il,"pop");function L(l,t){Ma++,Rc[Ma]=l.current,l.current=t}c(L,"push");var rl=Il(null),pu=Il(null),Xt=Il(null),wn=Il(null);function Fn(l,t){switch(L(Xt,t),L(pu,l),L(rl,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?i1(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=i1(t),l=rv(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}il(rl),L(rl,l)}c(Fn,"pushHostContainer");function ja(){il(rl),il(pu),il(Xt)}c(ja,"popHostContainer");function Zc(l){l.memoizedState!==null&&L(wn,l);var t=rl.current,a=rv(t,l.type);t!==a&&(L(pu,l),L(rl,a))}c(Zc,"pushHostContext");function $n(l){pu.current===l&&(il(rl),il(pu)),wn.current===l&&(il(wn),wu._currentValue=la)}c($n,"popHostContext");var lc,a0;function kt(l){if(lc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);lc=t&&t[1]||"",a0=-1<a.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
3
  `+lc+l+a0}c(kt,"describeBuiltInComponentFrame");var tc=!1;function ac(l,t){if(!l||tc)return"";tc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:c(function(){try{if(t){var b=c(function(){throw Error()},"Fake");if(Object.defineProperty(b.prototype,"props",{set:c(function(){throw Error()},"set")}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(b,[])}catch(o){var S=o}Reflect.construct(l,[],b)}else{try{b.call()}catch(o){S=o}l.call(b.prototype)}}else{try{throw Error()}catch(o){S=o}(b=l())&&typeof b.catch=="function"&&b.catch(function(){})}}catch(o){if(o&&S&&typeof o.stack=="string")return[o.stack,S.stack]}return[null,null]},"DetermineComponentFrameRoot")};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var e=u.DetermineComponentFrameRoot(),f=e[0],i=e[1];if(f&&i){var m=f.split(`
4
4
  `),y=i.split(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/studio",
3
- "version": "1.0.0-alpha.140",
3
+ "version": "1.0.0-alpha.142",
4
4
  "description": "The Lunora Studio: a local admin UI for your schema, data, logs, and advisors",
5
5
  "keywords": [
6
6
  "admin-ui",
@@ -58,11 +58,11 @@
58
58
  "@hugeicons/react": "^1.1.9",
59
59
  "@lingui/core": "^6.6.0",
60
60
  "@lingui/message-utils": "^6.6.0",
61
- "@lunora/advisor": "1.0.0-alpha.100",
62
- "@lunora/bindings": "1.0.0-alpha.42",
63
- "@lunora/client": "1.0.0-alpha.66",
64
- "@lunora/errors": "1.0.0-alpha.26",
65
- "@lunora/react": "1.0.0-alpha.71",
61
+ "@lunora/advisor": "1.0.0-alpha.102",
62
+ "@lunora/bindings": "1.0.0-alpha.44",
63
+ "@lunora/client": "1.0.0-alpha.68",
64
+ "@lunora/errors": "1.0.0-alpha.27",
65
+ "@lunora/react": "1.0.0-alpha.73",
66
66
  "@tanstack/react-query": "^5.101.4",
67
67
  "@tanstack/react-router": "^1.170.25",
68
68
  "@tanstack/react-table": "^8.21.3",
@@ -1,4 +0,0 @@
1
- import{c as L}from"react/compiler-runtime";import{useLunora as ot}from"@lunora/react";import{useState as M,useMemo as dt,useRef as He,useCallback as et,useEffect as Le}from"react";import{ShardInput as gn}from"./ShardInput-C6mjgAh4.mjs";import{u as Xe}from"./use-admin-query-Cbj2GuHu.mjs";import{ADMIN_FUNCTIONS as le}from"./ADMIN_FUNCTIONS-B6z7VLYt.mjs";import{b as $t}from"./browser-storage-BH1MxLZs.mjs";import{h as Be,f as be,j as pn,c as Te,d as we,i as bn}from"./internal-CwaF9YNk.mjs";import{m as hn,c as Dt,d as lt,G as xn,a as vn,u as rt,b as wn,T as yn,D as Sn}from"./table-list-sidebar-BxZm3sBJ.mjs";import{u as Cn}from"./use-sql-assistant-CFRzdA9E.mjs";import{ConfirmButton as ut}from"./ConfirmButton-DU4p72Er.mjs";import{E as Nn}from"./empty-state-D7jEML_T.mjs";import{useT as re}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{C as ft,a as Ie}from"./control-button-BOZ5K-FC.mjs";import{useReactTable as kn,getSortedRowModel as Tn,getCoreRowModel as En,flexRender as _n}from"@tanstack/react-table";import{useVirtualizer as Rn}from"@tanstack/react-virtual";import{C as gt}from"./checkbox-CnS9cyCz.mjs";import{c as tt}from"./utils-bhneXptQ.mjs";import{f as $n}from"./virtual-rect-D_j7aLxX.mjs";import{C as it,G as Dn,T as In}from"./data-grid-BqNXJ9PF.mjs";import{jsxs as _,jsx as f,Fragment as nt}from"react/jsx-runtime";import{DataFilters as Mn,toFilterClauses as Ve}from"./DataFilters-3nbW0uax.mjs";import{G as An,C as On}from"./grid-features-D8w5isjt.mjs";import{M as It}from"./modal-shell-CDztwLnv.mjs";import{e as Fn,a as Pn,i as Vn,d as Ln}from"./wire-codec-Dl3VeNrd.mjs";import vt from"./useDebounced-DVeQ5-oW.mjs";import{r as Bn,l as zn}from"./shard-history-CaO3C4KQ.mjs";const wt=(o,e)=>{const n=[];for(const[s,t]of Object.entries(e))for(const a of t)a.ref===o&&n.push({column:a.name,table:s});return n.sort((s,t)=>s.table.localeCompare(t.table)||s.column.localeCompare(t.column)),n},pt=o=>`${o.table}.${o.column}`,jn=(o,e,n,s,t=300)=>{if(s<=0)return{ids:new Set(o.map(u=>u.id)),leadPx:0,tailPx:0};const a=n-t,l=n+s+t,i=new Set;let r=0,c=0,g=0;for(const u of o){const m=u.getSize(),d=e.has(u.id),p=r+m>a&&r<l;d||p?i.add(u.id):r<a?c+=m:g+=m,r+=m}return{ids:i,leadPx:c,tailPx:g}},Gn=(o,e)=>{const n=new Map;let s=0;for(const t of o)e.has(t.id)&&(n.set(t.id,s),s+=t.getSize());return n},Jn=()=>{const o=L(11);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={},o[0]=e):e=o[0];const[n,s]=M(e);let t;o[1]===Symbol.for("react.memo_cache_sentinel")?(t=(d,p,b)=>{s(h=>({...h,[d]:{...h[d],[p]:b}}))},o[1]=t):t=o[1];const a=t;let l;o[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{s({})},o[2]=l):l=o[2];const i=l;let r;o[3]!==n?(r=(d,p)=>{const b=n[d];return b!==void 0&&p in b?{value:b[p]}:void 0},o[3]=n,o[4]=r):r=o[4];const c=r;let g;o[5]!==n?(g=Object.values(n).reduce(Kn,0),o[5]=n,o[6]=g):g=o[6];const u=g;let m;return o[7]!==u||o[8]!==n||o[9]!==c?(m={clear:i,count:u,stage:a,staged:n,stagedValue:c},o[7]=u,o[8]=n,o[9]=c,o[10]=m):m=o[10],m},Mt=(o,e)=>{if(typeof e=="number"){const n=Number(o);return o.trim()===""||Number.isNaN(n)?o:n}if(typeof e=="boolean"){if(o==="true")return!0;if(o==="false")return!1}return o},qn=o=>{const e=L(29),{changes:n,committing:s,onCommit:t,onDiscard:a}=o,l=re();let i;e[0]!==n.length||e[1]!==l?(i=l("{count} pending changes",{count:n.length}),e[0]=n.length,e[1]=l,e[2]=i):i=e[2];let r;e[3]!==i?(r=f("span",{className:"font-mono text-[11px] tracking-wide uppercase text-warning","data-testid":"db-staged-count",children:i}),e[3]=i,e[4]=r):r=e[4];let c;e[5]!==s||e[6]!==l?(c=l(s?"Committing…":"Commit"),e[5]=s,e[6]=l,e[7]=c):c=e[7];let g;e[8]!==s||e[9]!==t||e[10]!==c?(g=f("button",{className:"ms-auto rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-commit",disabled:s,onClick:t,type:"button",children:c}),e[8]=s,e[9]=t,e[10]=c,e[11]=g):g=e[11];let u;e[12]!==l?(u=l("Discard"),e[12]=l,e[13]=u):u=e[13];let m;e[14]!==s||e[15]!==a||e[16]!==u?(m=f("button",{className:"rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50","data-testid":"db-staged-discard",disabled:s,onClick:a,type:"button",children:u}),e[14]=s,e[15]=a,e[16]=u,e[17]=m):m=e[17];let d;e[18]!==r||e[19]!==g||e[20]!==m?(d=_("div",{className:"flex flex-wrap items-center gap-2",children:[r,g,m]}),e[18]=r,e[19]=g,e[20]=m,e[21]=d):d=e[21];let p;e[22]!==n?(p=n.map(Wn),e[22]=n,e[23]=p):p=e[23];let b;e[24]!==p?(b=f("ul",{className:"flex flex-col gap-1","data-testid":"db-staged-list",children:p}),e[24]=p,e[25]=b):b=e[25];let h;return e[26]!==d||e[27]!==b?(h=_("div",{className:"flex flex-col gap-2 border border-warning/40 bg-warning/5 p-3","data-testid":"db-staged",children:[d,b]}),e[26]=d,e[27]=b,e[28]=h):h=e[28],h};function Kn(o,e){return o+Object.keys(e).length}function Wn(o){return _("li",{className:"flex flex-wrap items-center gap-2 font-mono text-xs",children:[_("span",{className:"text-muted-foreground",children:[o.rowId,".",o.column]}),f("span",{className:"text-destructive line-through",children:Be(o.oldValue)}),f("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),f("span",{className:"text-foreground",children:Be(o.newValue)})]},`${o.rowId}:${o.column}`)}const yt=400,Hn=36,Qn={flex:"1 1 0%",minHeight:0,overflow:"auto",position:"relative"},Un={width:"100%"},Yn=/\n$/u,Xn={alignItems:"center",display:"flex",left:0,position:"absolute",top:0,width:"100%"},Zn={display:"flex",width:"100%"},St={flex:"0 0 8.5rem",padding:"0.375rem 0.75rem"},eo="2.5rem",At={alignItems:"center",display:"flex",flex:"0 0 2.5rem",justifyContent:"center",left:0,padding:"0.375rem 0",position:"sticky",zIndex:2},bt=o=>({flex:"0 0 auto",overflow:"hidden",padding:"0.375rem 0.75rem",position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",width:`${o.toString()}px`}),Ot=(o,e)=>({...bt(o),left:`calc(${eo} + ${e.toString()}px)`,position:"sticky",zIndex:2}),Ct="rounded-md px-2 py-0.5 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",to=(o,e,n)=>e.enabled&&e.columns.has(n)?void 0:o,mt="__back__:",no=o=>`${mt}${o.table}.${o.column}`,oo=o=>{const e=L(3),{counts:n,rowId:s}=o;if(n===void 0){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=f("span",{className:"text-muted-foreground/50",children:"—"}),e[0]=l):l=e[0],l}const t=n[s]??0;let a;return e[1]!==t?(a=f("span",{className:"tabular-nums",children:t}),e[1]=t,e[2]=a):a=e[2],a},ke=o=>{for(const e of["id","__id__","_id"]){const n=o[e];if(typeof n=="string"||typeof n=="number")return String(n)}return null},so=(o,e)=>{if(e.enumValues!==void 0&&e.enumValues.length>0)return e.enumValues.includes(o)||o===""&&e.nullable===!0?{value:o===""?null:o}:void 0;if(e.type==="boolean")return o==="true"||o==="false"?{value:o==="true"}:void 0;if(e.type==="number"){const n=Number(o);return o.trim()===""||!Number.isFinite(n)?void 0:{value:n}}return{value:o}},lo=(o,e,n)=>{if(n!==void 0&&n.type!=="any")return so(o,n);const s=Mt(o,e);return typeof e=="number"&&typeof s!="number"?void 0:{value:s}},ro=({anchor:o,columnIds:e,columnMeta:n,editableColumn:s,rows:t,text:a})=>{const l=a.replaceAll(`\r
2
- `,`
3
- `).replace(Yn,"").split(`
4
- `),i=[];let r=0;for(const[c,g]of l.entries()){const u=t[o.row+c],m=u===void 0?null:ke(u),d=g.split(" ");if(u===void 0||m===null){r+=d.length;continue}for(const[p,b]of d.entries()){const h=e[o.col+p],y=h===void 0||!s(h)?void 0:lo(b,u[h],n?.[h]);h===void 0||y===void 0?r+=1:i.push({column:h,rowId:m,value:y.value})}}return{edits:i,skipped:r}},Ft=(o,e)=>ke(o)??`row-${e.toString()}`,io=8,ao=o=>{const e=L(17),{anchor:n,mask:s,state:t}=o,a=re();let l;e[0]!==n.left||e[1]!==n.top?(l={left:n.left,position:"fixed",top:n.top,zIndex:50},e[0]=n.left,e[1]=n.top,e[2]=l):l=e[2];const i=l;let r;if(t==="loading"){let g;e[3]!==a?(g=a("Loading…"),e[3]=a,e[4]=g):g=e[4];let u;e[5]!==g?(u=f("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:g}),e[5]=g,e[6]=u):u=e[6],r=u}else if(t.row===null){let g;e[7]!==a?(g=a("No matching row."),e[7]=a,e[8]=g):g=e[8];let u;e[9]!==g?(u=f("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:g}),e[9]=g,e[10]=u):u=e[10],r=u}else{let g;if(e[11]!==s||e[12]!==t.row){const u=Object.entries(Dt(t.row,s)).slice(0,io);g=f("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 px-3 py-2",children:u.map(yo)}),e[11]=s,e[12]=t.row,e[13]=g}else g=e[13];r=g}let c;return e[14]!==r||e[15]!==i?(c=f("div",{className:"pointer-events-none w-72 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground","data-testid":"db-ref-preview",role:"tooltip",style:i,children:r}),e[14]=r,e[15]=i,e[16]=c):c=e[16],c},co=o=>{const e=L(24),{column:n,id:s,maskViewFor:t,onNavigate:a,onPreview:l,target:i}=o,[r,c]=M(null),[g,u]=M("idle");let m;e[0]!==s||e[1]!==a||e[2]!==i?(m=()=>{a(i,s)},e[0]=s,e[1]=a,e[2]=i,e[3]=m):m=e[3];const d=m;let p;e[4]!==s||e[5]!==l||e[6]!==g||e[7]!==i?(p=C=>{const S=C.currentTarget.getBoundingClientRect();if(c({left:S.left,top:S.bottom+4}),g!=="idle")return;u("loading"),be((async()=>{try{u({row:await l(i,s)})}catch{u({row:null})}})())},e[4]=s,e[5]=l,e[6]=g,e[7]=i,e[8]=p):p=e[8];const b=p;let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{c(null)},e[9]=h):h=e[9];const y=h,x=`db-ref-${n}`,v=`Open ${i} ${s}`;let w;e[10]!==s||e[11]!==d||e[12]!==b||e[13]!==x||e[14]!==v?(w=_("button",{"data-testid":x,onBlur:y,onClick:d,onFocus:b,onMouseEnter:b,onMouseLeave:y,title:v,type:"button",children:[s," ↗"]}),e[10]=s,e[11]=d,e[12]=b,e[13]=x,e[14]=v,e[15]=w):w=e[15];let N;e[16]!==r||e[17]!==t||e[18]!==g||e[19]!==i?(N=r!==null&&g!=="idle"&&f(ao,{anchor:r,mask:t(i,g==="loading"||g.row===null?[]:Object.keys(g.row)),state:g}),e[16]=r,e[17]=t,e[18]=g,e[19]=i,e[20]=N):N=e[20];let T;return e[21]!==w||e[22]!==N?(T=_(nt,{children:[w,N]}),e[21]=w,e[22]=N,e[23]=T):T=e[23],T},uo=o=>o==="asc"?" ▲":o==="desc"?" ▼":"",fo="absolute end-1 top-1/2 hidden -translate-y-1/2 items-center justify-center rounded text-muted-foreground outline-none group-hover/cell:flex hover:text-foreground focus-visible:flex",Nt=o=>{const e=L(8),{column:n,onExpand:s,value:t}=o;let a;e[0]!==n||e[1]!==s||e[2]!==t?(a=()=>{s(n,t)},e[0]=n,e[1]=s,e[2]=t,e[3]=a):a=e[3];const l=a,i=`db-expand-${n}`;let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=f("svg",{"aria-hidden":"true",className:"size-3",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:f("path",{d:"M9 21H5a2 2 0 0 1-2-2v-4m18 0v4a2 2 0 0 1-2 2h-4M3 9V5a2 2 0 0 1 2-2h4m6 0h4a2 2 0 0 1 2 2v4"})}),e[4]=r):r=e[4];let c;return e[5]!==l||e[6]!==i?(c=f("button",{"aria-label":"Expand cell",className:fo,"data-testid":i,onClick:l,type:"button",children:r}),e[5]=l,e[6]=i,e[7]=c):c=e[7],c},mo=o=>{const e=L(15),{column:n,initial:s,onCancel:t,onCommit:a,recordId:l}=o,i=He(null);let r,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{i.current?.select()},c=[],e[0]=r,e[1]=c):(r=e[0],c=e[1]),Le(r,c);let g;e[2]!==t||e[3]!==a?(g=y=>{y.key==="Enter"?(y.preventDefault(),a(y.currentTarget.value)):y.key==="Escape"&&(y.preventDefault(),t())},e[2]=t,e[3]=a,e[4]=g):g=e[4];const u=g;let m;e[5]!==a?(m=y=>{a(y.currentTarget.value)},e[5]=a,e[6]=m):m=e[6];const d=m,p=`db-cell-input-${l}-${n}`;let b;e[7]!==s?(b=Be(s),e[7]=s,e[8]=b):b=e[8];let h;return e[9]!==n||e[10]!==d||e[11]!==u||e[12]!==p||e[13]!==b?(h=f("input",{"aria-label":n,className:"w-full rounded border border-ring bg-background px-1 py-0.5 font-mono text-xs outline-none","data-testid":p,defaultValue:b,onBlur:d,onKeyDown:u,ref:i}),e[9]=n,e[10]=d,e[11]=u,e[12]=p,e[13]=b,e[14]=h):h=e[14],h},go=o=>{const e=L(70),{cell:n,edit:s,highlight:t,mask:a,refs:l}=o,i=n.column.id;let r,c,g,u;if(e[0]!==n||e[1]!==i||e[2]!==s||e[3]!==a||e[4]!==l.columns||e[5]!==l.maskViewFor||e[6]!==l.onNavigate||e[7]!==l.onPreview){u=Symbol.for("react.early_return_sentinel");e:{c=n.getValue(),r=ke(n.row.original);const $=l.columns?.[i];if(a.enabled&&a.columns.has(i)){const E=`db-masked-${i}`,D=f(it,{value:hn(c,i,a)});let R;e[12]!==E||e[13]!==D?(R=f("span",{className:"text-muted-foreground italic","data-testid":E,title:"Masked (preview)",children:D}),e[12]=E,e[13]=D,e[14]=R):R=e[14],u=R;break e}if($!==void 0&&(typeof c=="string"||typeof c=="number")&&String(c)!==""){const E=String(c),D=`${$}:${String(c)}`;let R;e[15]!==i||e[16]!==l.maskViewFor||e[17]!==l.onNavigate||e[18]!==l.onPreview||e[19]!==E||e[20]!==D||e[21]!==$?(R=f(co,{column:i,id:E,maskViewFor:l.maskViewFor,onNavigate:l.onNavigate,onPreview:l.onPreview,target:$},D),e[15]=i,e[16]=l.maskViewFor,e[17]=l.onNavigate,e[18]=l.onPreview,e[19]=E,e[20]=D,e[21]=$,e[22]=R):R=e[22],u=R;break e}if(r===null){let E;e[23]!==c?(E=f(it,{value:c}),e[23]=c,e[24]=E):E=e[24];let D;e[25]!==i||e[26]!==s.onExpandCell||e[27]!==c?(D=f(Nt,{column:i,onExpand:s.onExpandCell,value:c}),e[25]=i,e[26]=s.onExpandCell,e[27]=c,e[28]=D):D=e[28];let R;e[29]!==E||e[30]!==D?(R=_(nt,{children:[E,D]}),e[29]=E,e[30]=D,e[31]=R):R=e[31],u=R;break e}g=s.stagedValue(r,i)}e[0]=n,e[1]=i,e[2]=s,e[3]=a,e[4]=l.columns,e[5]=l.maskViewFor,e[6]=l.onNavigate,e[7]=l.onPreview,e[8]=r,e[9]=c,e[10]=g,e[11]=u}else r=e[8],c=e[9],g=e[10],u=e[11];if(u!==Symbol.for("react.early_return_sentinel"))return u;const m=g,d=m===void 0?c:m.value;let p;e[32]!==i||e[33]!==s?(p=s.editable&&s.editableColumn(i),e[32]=i,e[33]=s,e[34]=p):p=e[34];const b=p;if(s.editingCell!==null&&s.editingCell.rowId===r&&s.editingCell.column===i){let $;e[35]!==i||e[36]!==s||e[37]!==r||e[38]!==c?($=D=>{s.stage(r,i,Mt(D,c)),s.cancelEdit()},e[35]=i,e[36]=s,e[37]=r,e[38]=c,e[39]=$):$=e[39];let E;return e[40]!==i||e[41]!==d||e[42]!==s.cancelEdit||e[43]!==r||e[44]!==$?(E=f(mo,{column:i,initial:d,onCancel:s.cancelEdit,onCommit:$,recordId:r}),e[40]=i,e[41]=d,e[42]=s.cancelEdit,e[43]=r,e[44]=$,e[45]=E):E=e[45],E}let y;m!==void 0?y="rounded bg-warning/15 px-1":b&&(y="cursor-text");let x;e[46]!==b||e[47]!==i||e[48]!==s||e[49]!==r?(x=b?()=>{s.startEdit(r,i)}:void 0,e[46]=b,e[47]=i,e[48]=s,e[49]=r,e[50]=x):x=e[50];const v=x,w=y,N=`db-cell-${r}-${i}`;let T;e[51]!==i||e[52]!==t||e[53]!==a?(T=to(t,a,i),e[51]=i,e[52]=t,e[53]=a,e[54]=T):T=e[54];let C;e[55]!==d||e[56]!==T?(C=f(it,{highlight:T,value:d}),e[55]=d,e[56]=T,e[57]=C):C=e[57];let S;e[58]!==y||e[59]!==v||e[60]!==N||e[61]!==C?(S=f("span",{className:w,"data-testid":N,onDoubleClick:v,children:C}),e[58]=y,e[59]=v,e[60]=N,e[61]=C,e[62]=S):S=e[62];let k;e[63]!==i||e[64]!==d||e[65]!==s.onExpandCell?(k=f(Nt,{column:i,onExpand:s.onExpandCell,value:d}),e[63]=i,e[64]=d,e[65]=s.onExpandCell,e[66]=k):k=e[66];let A;return e[67]!==k||e[68]!==S?(A=_(nt,{children:[S,k]}),e[67]=k,e[68]=S,e[69]=A):A=e[69],A},po=o=>{o.preventDefault()},kt={any:"?",array:"[]",bigint:"#",boolean:"01",bytes:"0x",id:"→",number:"#",object:"{}",storage:"◫",string:"T",union:"|"},bo=({declaredType:o,draggedRef:e,header:n,masked:s=!1,onTogglePin:t,pinnedOffset:a,table:l})=>{const i=()=>{e.current=n.column.id},r=()=>{const c=e.current,g=n.column.id;if(e.current=null,c===null||c===g)return;const u=l.getState().columnOrder,d=(u.length>0?u:l.getAllLeafColumns().map(b=>b.id)).filter(b=>b!==c),p=d.indexOf(g);d.splice(p===-1?d.length:p,0,c),l.setColumnOrder(d)};return _("th",{className:tt("group/head text-start text-xs font-medium text-muted-foreground",a!==void 0&&"border-e border-border bg-muted"),draggable:!0,onDragOver:po,onDragStart:i,onDrop:r,style:a===void 0?bt(n.getSize()):Ot(n.getSize(),a),children:[_("button",{className:"inline-flex max-w-full cursor-grab items-center gap-1 truncate outline-none hover:text-foreground","data-testid":`db-sort-${n.column.id}`,onClick:n.column.getToggleSortingHandler(),type:"button",children:[_n(n.column.columnDef.header,n.getContext()),uo(n.column.getIsSorted())]}),o!==void 0&&kt[o]!==void 0&&f("span",{className:"ms-1 font-mono text-[0.625rem] text-muted-foreground/70","data-testid":`db-type-${n.column.id}`,title:o,children:kt[o]}),s&&f("span",{className:"ms-1 inline-flex items-center rounded-sm bg-warning/15 px-1 text-[0.625rem] font-medium uppercase text-warning","data-testid":`db-mask-chip-${n.column.id}`,title:"This column is masked by a mask() policy",children:"masked"}),f("button",{"aria-label":a===void 0?`Pin ${n.column.id}`:`Unpin ${n.column.id}`,"aria-pressed":a!==void 0,className:tt("ms-1 rounded-sm px-1 text-[0.625rem] outline-none transition-opacity hover:bg-accent focus-visible:bg-accent",a===void 0?"opacity-0 group-hover/head:opacity-100 focus-visible:opacity-100":"opacity-100 text-foreground"),"data-testid":`db-pin-${n.column.id}`,onClick:()=>{t(n.column.id)},type:"button",children:"📌"}),f("span",{"aria-hidden":"true",className:"absolute inset-y-0 end-0 w-1 cursor-col-resize touch-none select-none hover:bg-ring/60 data-[resizing=true]:bg-ring","data-resizing":n.column.getIsResizing(),"data-testid":`db-resize-${n.column.id}`,onMouseDown:n.getResizeHandler(),onTouchStart:n.getResizeHandler()})]})},ho=o=>{const e=L(13),{table:n}=o,s=re();let t;e[0]!==n?(t=g=>{n.toggleAllRowsSelected(g)},e[0]=n,e[1]=t):t=e[1];const a=t;let l;e[2]!==s?(l=s("Select all rows"),e[2]=s,e[3]=l):l=e[3];let i;e[4]!==n?(i=n.getIsAllRowsSelected(),e[4]=n,e[5]=i):i=e[5];let r;e[6]!==n?(r=n.getIsSomeRowsSelected()&&!n.getIsAllRowsSelected(),e[6]=n,e[7]=r):r=e[7];let c;return e[8]!==a||e[9]!==l||e[10]!==i||e[11]!==r?(c=f("th",{className:"bg-muted",style:At,children:f(gt,{"aria-label":l,checked:i,"data-testid":"db-select-all",indeterminate:r,onCheckedChange:a})}),e[8]=a,e[9]=l,e[10]=i,e[11]=r,e[12]=c):c=e[12],c},xo=o=>{const e=L(17),{row:n}=o,s=re();let t;e[0]!==n.original?(t=ke(n.original),e[0]=n.original,e[1]=t):t=e[1];const a=t;let l;e[2]!==n?(l=p=>{n.toggleSelected(p)},e[2]=n,e[3]=l):l=e[3];const i=l;let r;e[4]!==s?(r=s("Select row"),e[4]=s,e[5]=r):r=e[5];let c;e[6]!==n?(c=n.getIsSelected(),e[6]=n,e[7]=c):c=e[7];let g;e[8]!==n.index||e[9]!==n.original?(g=Ft(n.original,n.index),e[8]=n.index,e[9]=n.original,e[10]=g):g=e[10];const u=`db-select-${g}`,m=a===null;let d;return e[11]!==i||e[12]!==r||e[13]!==c||e[14]!==u||e[15]!==m?(d=f("td",{className:"bg-background",style:At,children:f(gt,{"aria-label":r,checked:c,"data-testid":u,disabled:m,onCheckedChange:i})}),e[11]=i,e[12]=r,e[13]=c,e[14]=u,e[15]=m,e[16]=d):d=e[16],d},vo=o=>{const e=L(91),{columnMeta:n,edit:s,editable:t,mask:a,onDelete:l,onEdit:i,onInspect:r,highlight:c,backRelationCounts:g,onTogglePin:u,pinnedColumns:m,refs:d,tableModel:p}=o,b=re(),{attachScroll:h,scrollLeft:y,scrollToIndex:x,table:v,tableRows:w,tbodyStyle:N,viewportWidth:T,virtualRows:C}=p,S=He(null),[k,A]=M(null);let $;e[0]===Symbol.for("react.memo_cache_sentinel")?($={columns:"",count:0},e[0]=$):$=e[0];const[E,D]=M($);let R;e[1]!==v?(R=v.getVisibleLeafColumns(),e[1]=v,e[2]=R):R=e[2];const q=R.length;let O;e[3]!==k||e[4]!==q||e[5]!==s||e[6]!==v||e[7]!==w?(O=oe=>{if(!["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter"].includes(oe.key))return;oe.preventDefault();const W=k??{col:0,row:0};if(oe.key==="Enter"){const z=w[W.row],ge=v.getVisibleLeafColumns()[W.col];if(z!==void 0&&ge!==void 0){const K=ke(z.original);K!==null&&s.editableColumn(ge.id)&&s.startEdit(K,ge.id)}A(W);return}let{col:ee,row:Q}=W;e:switch(oe.key){case"ArrowDown":{Q=Math.min(Q+1,w.length-1);break e}case"ArrowRight":{ee=Math.min(ee+1,q-1);break e}case"ArrowUp":{Q=Math.max(Q-1,0);break e}default:ee=Math.max(ee-1,0)}A({col:ee,row:Q})},e[3]=k,e[4]=q,e[5]=s,e[6]=v,e[7]=w,e[8]=O):O=e[8];const B=O;let F;e[9]!==k||e[10]!==n||e[11]!==s||e[12]!==v||e[13]!==w?(F=oe=>{const W=s.editable?oe.clipboardData.getData("text/plain"):"";if(W==="")return;oe.preventDefault();const ee=v.getVisibleLeafColumns().map(So),Q=ro({anchor:k??{col:0,row:0},columnIds:ee,columnMeta:n,editableColumn:s.editableColumn,rows:w.map(Co),text:W});for(const z of Q.edits)s.stage(z.rowId,z.column,z.value);D({columns:ee.join("\0"),count:Q.skipped})},e[9]=k,e[10]=n,e[11]=s,e[12]=v,e[13]=w,e[14]=F):F=e[14];const J=F;let H,G;e[15]!==k||e[16]!==x?(H=()=>{k!==null&&x(k.row)},G=[k,x],e[15]=k,e[16]=x,e[17]=H,e[18]=G):(H=e[17],G=e[18]),Le(H,G);let U,ye,ie,he,xe,Se,ce,Ce,de,Z,Ne,ue,fe,se,me,Y;if(e[19]!==k||e[20]!==h||e[21]!==g||e[22]!==n||e[23]!==s||e[24]!==t||e[25]!==c||e[26]!==a||e[27]!==l||e[28]!==i||e[29]!==B||e[30]!==J||e[31]!==r||e[32]!==u||e[33]!==E.columns||e[34]!==E.count||e[35]!==m||e[36]!==d||e[37]!==y||e[38]!==b||e[39]!==v||e[40]!==w||e[41]!==N||e[42]!==T||e[43]!==C){const oe=v.getVisibleLeafColumns().map(No),W=jn(oe,m,y,T),ee=Gn(v.getVisibleLeafColumns().map(ko),m),Q=K=>{const Ee=w[K.index],{original:Ae}=Ee,Oe=ke(Ae),Fe=Ft(Ae,K.index),ze={...Xn,height:`${K.size.toString()}px`,transform:`translateY(${K.start.toString()}px)`};return _("tr",{className:"border-b border-border text-xs transition-colors hover:bg-muted/50","data-testid":"db-row",style:ze,children:[f(xo,{row:Ee}),W.leadPx>0&&f("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),Ee.getVisibleCells().map((pe,je)=>{if(!W.ids.has(pe.column.id))return null;const Pe=ee.get(pe.column.id),Ke=k!==null&&k.row===K.index&&k.col===je?" ring-1 ring-ring ring-inset":"";return f("td",{className:tt("group/cell truncate font-mono text-muted-foreground",Pe!==void 0&&"border-e border-border bg-background",Ke),onPointerDown:()=>{A({col:je,row:K.index})},style:Pe===void 0?bt(pe.column.getSize()):Ot(pe.column.getSize(),Pe),children:pe.column.id.startsWith(mt)?f(oo,{counts:g[pe.column.id.slice(mt.length)],rowId:Fe}):f(go,{cell:pe,edit:s,highlight:c,mask:a,refs:d})},pe.id)}),W.tailPx>0&&f("td",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),_("td",{className:"flex items-center gap-1",style:St,children:[f("button",{className:Ct,"data-testid":`db-inspect-${Fe}`,onClick:()=>{r(Ae)},type:"button",children:"Details"}),t&&_(nt,{children:[f("button",{className:Ct,"data-testid":`db-edit-${Fe}`,disabled:Oe===null,onClick:()=>{i(Oe,Ae)},type:"button",children:"Edit"}),f(ut,{confirmLabel:"Delete?",disabled:Oe===null,onConfirm:()=>{l(Oe)},testId:`db-delete-${Fe}`,children:"Delete"})]})]})]},Ee.id)};U=Dn,ue="fill",e[60]!==E.columns||e[61]!==E.count||e[62]!==b||e[63]!==v?(fe=E.count>0&&E.columns===v.getVisibleLeafColumns().map(To).join("\0")&&f("p",{className:"border-b border-warning/40 bg-warning/5 px-3 py-1.5 text-xs text-warning","data-testid":"db-paste-skipped",children:b("{count} pasted cells were skipped",{count:E.count})}),e[60]=E.columns,e[61]=E.count,e[62]=b,e[63]=v,e[64]=fe):fe=e[64],xe="db-scroll",Se=B,ce=J,Ce=h,de="grid",Z=Qn,Ne=0,Y="w-full text-xs",ye="db-rows",ie=Un;let z;e[65]!==v?(z=f(ho,{table:v}),e[65]=v,e[66]=z):z=e[66];let ge;e[67]===Symbol.for("react.memo_cache_sentinel")?(ge=f("th",{"aria-label":"Row actions",style:St}),e[67]=ge):ge=e[67],he=f("thead",{className:"bg-muted/50",children:_("tr",{className:"border-b border-border",style:Zn,children:[z,W.leadPx>0&&f("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.leadPx.toString()}px`}}),v.getFlatHeaders().map(K=>W.ids.has(K.column.id)?f(bo,{declaredType:n?.[K.column.id]?.type,draggedRef:S,header:K,masked:a.columns.has(K.column.id),onTogglePin:u,pinnedOffset:ee.get(K.column.id),table:v},K.id):null),W.tailPx>0&&f("th",{"aria-hidden":"true",style:{flex:`0 0 ${W.tailPx.toString()}px`}}),ge]})}),se=N,me=C.map(K=>Q(K)),e[19]=k,e[20]=h,e[21]=g,e[22]=n,e[23]=s,e[24]=t,e[25]=c,e[26]=a,e[27]=l,e[28]=i,e[29]=B,e[30]=J,e[31]=r,e[32]=u,e[33]=E.columns,e[34]=E.count,e[35]=m,e[36]=d,e[37]=y,e[38]=b,e[39]=v,e[40]=w,e[41]=N,e[42]=T,e[43]=C,e[44]=U,e[45]=ye,e[46]=ie,e[47]=he,e[48]=xe,e[49]=Se,e[50]=ce,e[51]=Ce,e[52]=de,e[53]=Z,e[54]=Ne,e[55]=ue,e[56]=fe,e[57]=se,e[58]=me,e[59]=Y}else U=e[44],ye=e[45],ie=e[46],he=e[47],xe=e[48],Se=e[49],ce=e[50],Ce=e[51],de=e[52],Z=e[53],Ne=e[54],ue=e[55],fe=e[56],se=e[57],me=e[58],Y=e[59];let j;e[68]!==se||e[69]!==me?(j=f("tbody",{style:se,children:me}),e[68]=se,e[69]=me,e[70]=j):j=e[70];let te;e[71]!==ye||e[72]!==ie||e[73]!==he||e[74]!==j||e[75]!==Y?(te=_("table",{className:Y,"data-testid":ye,style:ie,children:[he,j]}),e[71]=ye,e[72]=ie,e[73]=he,e[74]=j,e[75]=Y,e[76]=te):te=e[76];let ne;e[77]!==xe||e[78]!==Se||e[79]!==ce||e[80]!==Ce||e[81]!==de||e[82]!==Z||e[83]!==Ne||e[84]!==te?(ne=f("div",{"data-testid":xe,onKeyDown:Se,onPaste:ce,ref:Ce,role:de,style:Z,tabIndex:Ne,children:te}),e[77]=xe,e[78]=Se,e[79]=ce,e[80]=Ce,e[81]=de,e[82]=Z,e[83]=Ne,e[84]=te,e[85]=ne):ne=e[85];let Me;return e[86]!==U||e[87]!==ue||e[88]!==fe||e[89]!==ne?(Me=_(U,{layout:ue,children:[fe,ne]}),e[86]=U,e[87]=ue,e[88]=fe,e[89]=ne,e[90]=Me):Me=e[90],Me},wo=(o,e,n,s=[])=>{const t=o?.columns,a=o?.rows,l=o?.refs,i=dt(()=>{if(t===void 0)return[];const S=t.map(k=>({accessorFn:A=>A[k],header:l?.[k]===void 0?k:`${k} →`,id:k}));for(const k of s)S.push({accessorFn:()=>{},enableSorting:!1,header:`← ${k.table}`,id:no(k)});return S},[s,t,l]),r=dt(()=>a??[],[a]),[c,g]=M({}),[u,m]=M({}),d=kn({columnResizeMode:"onChange",columns:i,data:r,defaultColumn:{minSize:80,size:200},enableColumnResizing:!0,enableRowSelection:S=>ke(S.original)!==null,getCoreRowModel:En(),getRowId:(S,k)=>ke(S)??`row-${k.toString()}`,getSortedRowModel:Tn(),manualSorting:!0,onColumnVisibilityChange:m,onRowSelectionChange:g,onSortingChange:n,state:{columnVisibility:u,rowSelection:c,sorting:e}}),p=d.getRowModel().rows,b=He(null),h=Rn({count:p.length,estimateSize:()=>Hn,getScrollElement:()=>b.current,initialRect:{height:yt,width:0},observeElementRect:(S,k)=>$n(S,k,yt),overscan:8}),y=et(S=>{h.scrollToIndex(S)},[h]),[x,v]=M({left:0,width:0}),w=et(S=>{if(b.current=S,S===null)return;const k=()=>{v($=>$.left===S.scrollLeft&&$.width===S.clientWidth?$:{left:S.scrollLeft,width:S.clientWidth})};S.addEventListener("scroll",k,{passive:!0});const A=new ResizeObserver(k);return A.observe(S),()=>{S.removeEventListener("scroll",k),A.disconnect(),b.current=null}},[]),N=h.getVirtualItems(),C={display:"block",height:`${h.getTotalSize().toString()}px`,position:"relative"};return{attachScroll:w,scrollLeft:x.left,scrollToIndex:y,table:d,tableRows:p,tbodyStyle:C,viewportWidth:x.width,virtualRows:N}};function yo(o){const[e,n]=o;return _("div",{className:"contents",children:[f("dt",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e}),f("dd",{className:"truncate font-mono text-[11px] text-foreground",title:Be(n),children:Be(n)})]},e)}function So(o){return o.id}function Co(o){return o.original}function No(o){return{getSize:()=>o.getSize(),id:o.id}}function ko(o){return{getSize:()=>o.getSize(),id:o.id}}function To(o){return o.id}const Eo=o=>{const e=L(22),{onCommit:n}=o,s=re(),[t,a]=M(""),l=He(null);let i,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{l.current?.focus()},r=[],e[0]=i,e[1]=r):(i=e[0],r=e[1]),Le(i,r);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=v=>{a(v.target.value)},e[2]=c):c=e[2];const g=c;let u;e[3]!==t||e[4]!==n?(u=()=>{const v=t.trim();v!==""&&n(v)},e[3]=t,e[4]=n,e[5]=u):u=e[5];const m=u;let d;e[6]!==s?(d=s("Query name"),e[6]=s,e[7]=d):d=e[7];let p;e[8]!==s?(p=s("Query name"),e[8]=s,e[9]=p):p=e[9];let b;e[10]!==t||e[11]!==d||e[12]!==p?(b=f("input",{"aria-label":d,className:"h-7 rounded-md border border-border bg-background px-2 text-xs outline-none focus-visible:border-ring","data-testid":"db-save-query-name",onChange:g,placeholder:p,ref:l,value:t}),e[10]=t,e[11]=d,e[12]=p,e[13]=b):b=e[13];let h;e[14]!==s?(h=s("Save"),e[14]=s,e[15]=h):h=e[15];let y;e[16]!==m||e[17]!==h?(y=f("button",{className:ft,"data-testid":"db-save-query-confirm",onClick:m,type:"button",children:h}),e[16]=m,e[17]=h,e[18]=y):y=e[18];let x;return e[19]!==b||e[20]!==y?(x=_("span",{className:"inline-flex items-center gap-1",children:[b,y]}),e[19]=b,e[20]=y,e[21]=x):x=e[21],x},_o=o=>{const e=L(27),{onApply:n,onCopyLink:s,onDelete:t,onSave:a,saved:l}=o,i=re(),[r,c]=M(!1);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{c(!0)},e[0]=g):g=e[0];const u=g;let m;e[1]!==a?(m=C=>{a(C),c(!1)},e[1]=a,e[2]=m):m=e[2];const d=m;let p;e[3]!==n||e[4]!==l?(p=C=>{const S=l[Number(C.currentTarget.dataset.index)];S!==void 0&&n(S)},e[3]=n,e[4]=l,e[5]=p):p=e[5];const b=p;let h;e[6]!==t||e[7]!==l?(h=C=>{const S=l[Number(C.currentTarget.dataset.index)];S!==void 0&&t(S.name)},e[6]=t,e[7]=l,e[8]=h):h=e[8];const y=h;let x;e[9]!==i?(x=i("Copy link"),e[9]=i,e[10]=x):x=e[10];let v;e[11]!==s||e[12]!==x?(v=f("button",{className:ft,"data-testid":"db-copy-link",onClick:s,type:"button",children:x}),e[11]=s,e[12]=x,e[13]=v):v=e[13];let w;e[14]!==d||e[15]!==r||e[16]!==i?(w=r?f(Eo,{onCommit:d}):f("button",{className:ft,"data-testid":"db-save-query",onClick:u,type:"button",children:i("Save query")}),e[14]=d,e[15]=r,e[16]=i,e[17]=w):w=e[17];let N;e[18]!==b||e[19]!==y||e[20]!==l||e[21]!==i?(N=l.length>0&&_("div",{className:"flex flex-wrap items-center gap-1","data-testid":"db-saved-queries",children:[f("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:i("Saved")}),l.map((C,S)=>_("span",{className:"inline-flex items-center overflow-hidden rounded-md border border-border",children:[f("button",{className:"px-2 py-0.5 text-xs text-foreground transition-colors hover:bg-accent","data-index":S,"data-testid":`db-saved-query-${C.name}`,onClick:b,type:"button",children:C.name}),f("button",{"aria-label":i("Delete saved query {name}",{name:C.name}),className:"border-l border-border px-1 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive","data-index":S,"data-testid":`db-saved-query-delete-${C.name}`,onClick:y,type:"button",children:"✕"})]},C.name))]}),e[18]=b,e[19]=y,e[20]=l,e[21]=i,e[22]=N):N=e[22];let T;return e[23]!==v||e[24]!==w||e[25]!==N?(T=_("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"db-query-bar",children:[v,w,N]}),e[23]=v,e[24]=w,e[25]=N,e[26]=T):T=e[26],T},qe="w-full rounded-md border border-border bg-background px-2 py-1 font-mono text-xs outline-none focus-visible:border-ring",Pt=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Tt=(o,e)=>typeof e=="boolean"?"boolean":typeof e=="number"?Pt.test(o)?"date":"number":e!==null&&typeof e=="object"?"json":"text",Ro=(o,e,n)=>n===void 0?Tt(o,e):n.enumValues!==void 0&&n.enumValues.length>0?"enum":n.type==="boolean"?"boolean":n.type==="number"?Pt.test(o)?"date":"number":Tt(o,e),$o=o=>{try{const e=JSON.parse(o);return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}},Do=o=>{const e=new Date(o),n=s=>String(s).padStart(2,"0");return`${e.getFullYear().toString()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`},Je="\0clear",Io=o=>{const e=L(23),{column:n,nullable:s,onChange:t,value:a}=o,l=re();let i;e[0]!==n||e[1]!==t?(i=x=>{t(n,x)},e[0]=n,e[1]=t,e[2]=i):i=e[2];const r=i;let c;e[3]!==n||e[4]!==t?(c=x=>{t(n,x.target.value===Je?null:x.target.value==="true")},e[3]=n,e[4]=t,e[5]=c):c=e[5];const g=c;if(!s&&a!==null){const x=a===!0,v=`db-field-${n}`;let w;return e[6]!==n||e[7]!==r||e[8]!==x||e[9]!==v?(w=f(gt,{"aria-label":n,checked:x,"data-testid":v,onCheckedChange:r}),e[6]=n,e[7]=r,e[8]=x,e[9]=v,e[10]=w):w=e[10],w}const u=`db-field-${n}`,m=a===!0||a===!1?String(a):Je;let d;e[11]!==l?(d=l("(none)"),e[11]=l,e[12]=d):d=e[12];let p;e[13]!==d?(p=f("option",{value:Je,children:d}),e[13]=d,e[14]=p):p=e[14];let b,h;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=f("option",{value:"true",children:"true"}),h=f("option",{value:"false",children:"false"}),e[15]=b,e[16]=h):(b=e[15],h=e[16]);let y;return e[17]!==n||e[18]!==g||e[19]!==u||e[20]!==m||e[21]!==p?(y=_("select",{"aria-label":n,className:qe,"data-testid":u,onChange:g,value:m,children:[p,b,h]}),e[17]=n,e[18]=g,e[19]=u,e[20]=m,e[21]=p,e[22]=y):y=e[22],y},Mo=o=>{const e=L(23),{column:n,nullable:s,onChange:t,options:a,value:l}=o,i=re(),r=typeof l=="string"?l:null;let c;e[0]!==a||e[1]!==r?(c=r!==null&&!a.includes(r),e[0]=a,e[1]=r,e[2]=c):c=e[2];const g=c;let u;e[3]!==n||e[4]!==t?(u=v=>{t(n,v.target.value===Je?null:v.target.value)},e[3]=n,e[4]=t,e[5]=u):u=e[5];const m=u,d=`db-field-${n}`,p=r??Je;let b;e[6]!==s||e[7]!==r||e[8]!==i?(b=(s||r===null)&&f("option",{value:Je,children:i("(none)")}),e[6]=s,e[7]=r,e[8]=i,e[9]=b):b=e[9];let h;e[10]!==r||e[11]!==g?(h=g&&f("option",{value:r,children:r}),e[10]=r,e[11]=g,e[12]=h):h=e[12];let y;e[13]!==a?(y=a.map(Bo),e[13]=a,e[14]=y):y=e[14];let x;return e[15]!==n||e[16]!==m||e[17]!==d||e[18]!==p||e[19]!==b||e[20]!==h||e[21]!==y?(x=_("select",{"aria-label":n,className:qe,"data-testid":d,onChange:m,value:p,children:[b,h,y]}),e[15]=n,e[16]=m,e[17]=d,e[18]=p,e[19]=b,e[20]=h,e[21]=y,e[22]=x):x=e[22],x},Ao=o=>{const e=L(8),{column:n,onChange:s,value:t}=o;let a;e[0]!==n||e[1]!==s?(a=g=>{const u=Number(g.target.value);g.target.value!==""&&!Number.isNaN(u)&&s(n,u)},e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a,i=`db-field-${n}`,r=typeof t=="number"?t:"";let c;return e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==r?(c=f("input",{"aria-label":n,className:qe,"data-testid":i,onChange:l,type:"number",value:r}),e[3]=n,e[4]=l,e[5]=i,e[6]=r,e[7]=c):c=e[7],c},Oo=o=>{const e=L(10),{column:n,onChange:s,value:t}=o;let a;e[0]!==n||e[1]!==s?(a=g=>{const u=new Date(g.target.value).getTime();Number.isNaN(u)||s(n,u)},e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a,i=`db-field-${n}`;let r;e[3]!==t?(r=typeof t=="number"?Do(t):"",e[3]=t,e[4]=r):r=e[4];let c;return e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==r?(c=f("input",{"aria-label":n,className:qe,"data-testid":i,onChange:l,type:"datetime-local",value:r}),e[5]=n,e[6]=l,e[7]=i,e[8]=r,e[9]=c):c=e[9],c},Fo=o=>{const e=L(8),{column:n,onChange:s,value:t}=o;let a;e[0]!==n||e[1]!==s?(a=g=>{s(n,g.target.value)},e[0]=n,e[1]=s,e[2]=a):a=e[2];const l=a,i=`db-field-${n}`,r=typeof t=="string"?t:"";let c;return e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==r?(c=f("input",{"aria-label":n,className:qe,"data-testid":i,onChange:l,type:"text",value:r}),e[3]=n,e[4]=l,e[5]=i,e[6]=r,e[7]=c):c=e[7],c},Po=o=>{const e=L(20),{column:n,onChange:s,value:t}=o,a=re();let l;e[0]!==t?(l=()=>JSON.stringify(t,null,2),e[0]=t,e[1]=l):l=e[1];const[i,r]=M(l),[c,g]=M(!1);let u;e[2]!==n||e[3]!==s?(u=v=>{const w=v.target.value;r(w);try{s(n,JSON.parse(w)),g(!1)}catch{g(!0)}},e[2]=n,e[3]=s,e[4]=u):u=e[4];const m=u,d=c&&"border-destructive";let p;e[5]!==d?(p=tt(qe,"min-h-16",d),e[5]=d,e[6]=p):p=e[6];const b=`db-field-${n}`;let h;e[7]!==n||e[8]!==m||e[9]!==p||e[10]!==b||e[11]!==i?(h=f("textarea",{"aria-label":n,className:p,"data-testid":b,onChange:m,value:i}),e[7]=n,e[8]=m,e[9]=p,e[10]=b,e[11]=i,e[12]=h):h=e[12];let y;e[13]!==n||e[14]!==c||e[15]!==a?(y=c&&f("span",{className:"text-xs text-destructive","data-testid":`db-field-error-${n}`,children:a("Invalid JSON")}),e[13]=n,e[14]=c,e[15]=a,e[16]=y):y=e[16];let x;return e[17]!==h||e[18]!==y?(x=_("div",{className:"flex flex-col gap-1",children:[h,y]}),e[17]=h,e[18]=y,e[19]=x):x=e[19],x},Vo=o=>{const e=L(56),{column:n,meta:s,onChange:t,target:a,value:l}=o;let i;e[0]!==n||e[1]!==s||e[2]!==l?(i=Ro(n,l,s),e[0]=n,e[1]=s,e[2]=l,e[3]=i):i=e[3];const r=i,c=`db-field-${n}`;let g;e[4]!==n?(g=f("span",{className:"font-mono",children:n}),e[4]=n,e[5]=g):g=e[5];let u;e[6]!==n||e[7]!==s?(u=s!==void 0&&f("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide","data-testid":`db-field-type-${n}`,children:s.type}),e[6]=n,e[7]=s,e[8]=u):u=e[8];let m;e[9]!==a?(m=a!==void 0&&_("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:["→ ",a]}),e[9]=a,e[10]=m):m=e[10];let d;e[11]!==g||e[12]!==u||e[13]!==m?(d=_("span",{className:"flex items-center gap-1.5 font-medium text-muted-foreground",children:[g,u,m]}),e[11]=g,e[12]=u,e[13]=m,e[14]=d):d=e[14];let p;e[15]!==n||e[16]!==r||e[17]!==s?.nullable||e[18]!==t||e[19]!==l?(p=r==="boolean"&&f(Io,{column:n,nullable:s?.nullable===!0,onChange:t,value:l}),e[15]=n,e[16]=r,e[17]=s?.nullable,e[18]=t,e[19]=l,e[20]=p):p=e[20];let b;e[21]!==n||e[22]!==r||e[23]!==s||e[24]!==t||e[25]!==l?(b=r==="enum"&&s?.enumValues!==void 0&&f(Mo,{column:n,nullable:s.nullable===!0,onChange:t,options:s.enumValues,value:l}),e[21]=n,e[22]=r,e[23]=s,e[24]=t,e[25]=l,e[26]=b):b=e[26];let h;e[27]!==n||e[28]!==r||e[29]!==t||e[30]!==l?(h=r==="number"&&f(Ao,{column:n,onChange:t,value:l}),e[27]=n,e[28]=r,e[29]=t,e[30]=l,e[31]=h):h=e[31];let y;e[32]!==n||e[33]!==r||e[34]!==t||e[35]!==l?(y=r==="date"&&f(Oo,{column:n,onChange:t,value:l}),e[32]=n,e[33]=r,e[34]=t,e[35]=l,e[36]=y):y=e[36];let x;e[37]!==n||e[38]!==r||e[39]!==t||e[40]!==l?(x=r==="json"&&f(Po,{column:n,onChange:t,value:l}),e[37]=n,e[38]=r,e[39]=t,e[40]=l,e[41]=x):x=e[41];let v;e[42]!==n||e[43]!==r||e[44]!==t||e[45]!==l?(v=r==="text"&&f(Fo,{column:n,onChange:t,value:l}),e[42]=n,e[43]=r,e[44]=t,e[45]=l,e[46]=v):v=e[46];let w;return e[47]!==y||e[48]!==x||e[49]!==v||e[50]!==c||e[51]!==d||e[52]!==p||e[53]!==b||e[54]!==h?(w=_("label",{className:"flex flex-col gap-1 text-xs",htmlFor:c,children:[d,p,b,h,y,x,v]}),e[47]=y,e[48]=x,e[49]=v,e[50]=c,e[51]=d,e[52]=p,e[53]=b,e[54]=h,e[55]=w):w=e[55],w},Lo=o=>{const e=L(49),{columnMeta:n,documentText:s,onCancel:t,onDocumentTextChange:a,onSave:l,refs:i}=o,r=re();let c;e[0]!==s?(c=$o(s),e[0]=s,e[1]=c):c=e[1];const g=c,[u,m]=M(!1),d=!u&&g!==null;let p;e[2]!==g||e[3]!==a?(p=(H,G)=>{a(JSON.stringify({...g,[H]:G},null,2))},e[2]=g,e[3]=a,e[4]=p):p=e[4];const b=p;let h;e[5]!==a?(h=H=>{a(H.target.value)},e[5]=a,e[6]=h):h=e[6];const y=h;let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{m(!1)},e[7]=x):x=e[7];const v=x;let w;e[8]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{m(!0)},e[8]=w):w=e[8];const N=w,T=g===null;let C;e[9]!==r?(C=r("Form"),e[9]=r,e[10]=C):C=e[10];let S;e[11]!==d||e[12]!==T||e[13]!==C?(S=f("button",{"aria-pressed":d,className:Ie,"data-testid":"db-editor-form",disabled:T,onClick:v,type:"button",children:C}),e[11]=d,e[12]=T,e[13]=C,e[14]=S):S=e[14];const k=!d;let A;e[15]!==r?(A=r("JSON"),e[15]=r,e[16]=A):A=e[16];let $;e[17]!==A||e[18]!==k?($=f("button",{"aria-pressed":k,className:Ie,"data-testid":"db-editor-json",onClick:N,type:"button",children:A}),e[17]=A,e[18]=k,e[19]=$):$=e[19];let E;e[20]!==$||e[21]!==S?(E=_("div",{className:"flex items-center gap-1.5",children:[S,$]}),e[20]=$,e[21]=S,e[22]=E):E=e[22];let D;e[23]!==n||e[24]!==s||e[25]!==g||e[26]!==b||e[27]!==y||e[28]!==i||e[29]!==d||e[30]!==r?(D=d?f("div",{className:"flex flex-col gap-3","data-testid":"db-editor-fields",children:Object.entries(g).map(H=>{const[G,U]=H;return f(Vo,{column:G,meta:n?.[G],onChange:b,target:i?.[G],value:U},G)})}):f("textarea",{"aria-label":r("Row document JSON"),className:"min-h-28 w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none focus-visible:border-ring","data-testid":"db-editor-doc",onChange:y,value:s}),e[23]=n,e[24]=s,e[25]=g,e[26]=b,e[27]=y,e[28]=i,e[29]=d,e[30]=r,e[31]=D):D=e[31];let R;e[32]!==r?(R=r("Save"),e[32]=r,e[33]=R):R=e[33];let q;e[34]!==l||e[35]!==R?(q=f("button",{className:Ie,"data-testid":"db-editor-save",onClick:l,type:"button",children:R}),e[34]=l,e[35]=R,e[36]=q):q=e[36];let O;e[37]!==r?(O=r("Cancel"),e[37]=r,e[38]=O):O=e[38];let B;e[39]!==t||e[40]!==O?(B=f("button",{className:Ie,"data-testid":"db-editor-cancel",onClick:t,type:"button",children:O}),e[39]=t,e[40]=O,e[41]=B):B=e[41];let F;e[42]!==q||e[43]!==B?(F=_("div",{className:"flex items-center gap-1.5",children:[q,B]}),e[42]=q,e[43]=B,e[44]=F):F=e[44];let J;return e[45]!==E||e[46]!==D||e[47]!==F?(J=_("div",{className:"flex flex-col gap-2 border border-border bg-card p-3","data-testid":"db-editor",children:[E,D,F]}),e[45]=E,e[46]=D,e[47]=F,e[48]=J):J=e[48],J};function Bo(o){return f("option",{value:o,children:o},o)}const zo=o=>{const e=L(61),{columns:n,editable:s,filter:t,filters:a,hasMaskedColumns:l,liveError:i,maskOn:r,onAddRow:c,onBulkDelete:g,onAskAiFilter:u,onClearTable:m,onFilterChange:d,onFiltersChange:p,onGenerateRows:b,onShowJson:h,onShowTable:y,onToggleMask:x,total:v,viewMode:w}=o,N=re(),T=w==="table";let C;e[0]!==y||e[1]!==T?(C=f("button",{"aria-pressed":T,className:Ie,"data-testid":"db-view-table",onClick:y,type:"button",children:"Table"}),e[0]=y,e[1]=T,e[2]=C):C=e[2];const S=w==="json";let k;e[3]!==h||e[4]!==S?(k=f("button",{"aria-pressed":S,className:Ie,"data-testid":"db-view-json",onClick:h,type:"button",children:"JSON"}),e[3]=h,e[4]=S,e[5]=k):k=e[5];let A;e[6]!==i||e[7]!==N?(A=i===void 0?N("Live — changes stream in automatically"):N("Live unavailable: {liveError}",{liveError:i}),e[6]=i,e[7]=N,e[8]=A):A=e[8];const $=`size-1.5 rounded-full ${i===void 0?"bg-success":"bg-muted-foreground/50"}`;let E;e[9]!==$?(E=f("span",{"aria-hidden":"true",className:$}),e[9]=$,e[10]=E):E=e[10];let D;e[11]!==i||e[12]!==N?(D=N(i===void 0?"Live":"Live unavailable"),e[11]=i,e[12]=N,e[13]=D):D=e[13];let R;e[14]!==A||e[15]!==E||e[16]!==D?(R=_("span",{className:"inline-flex items-center gap-1.5 px-1 text-xs font-medium text-muted-foreground","data-testid":"db-live-indicator",role:"status",title:A,children:[E,D]}),e[14]=A,e[15]=E,e[16]=D,e[17]=R):R=e[17];let q;e[18]!==l||e[19]!==r||e[20]!==x||e[21]!==N?(q=l&&f("button",{"aria-pressed":r,className:Ie,"data-testid":"db-mask-toggle",onClick:x,type:"button",children:N("Mask sensitive columns")}),e[18]=l,e[19]=r,e[20]=x,e[21]=N,e[22]=q):q=e[22];let O;e[23]!==s||e[24]!==c?(O=s&&f("button",{className:Ie,"data-testid":"db-add-row",onClick:c,type:"button",children:"Add row"}),e[23]=s,e[24]=c,e[25]=O):O=e[25];let B;e[26]!==s||e[27]!==b||e[28]!==N?(B=s&&f("button",{className:Ie,"data-testid":"db-generate-rows",onClick:b,type:"button",children:N("Generate rows")}),e[26]=s,e[27]=b,e[28]=N,e[29]=B):B=e[29];let F;e[30]!==s||e[31]!==t||e[32]!==a||e[33]!==g||e[34]!==v?(F=s&&v>0&&(t!==""||a.length>0)&&f(ut,{confirmLabel:`Delete ${v.toString()} matching?`,onConfirm:g,testId:"db-bulk-delete",children:`Delete ${v.toString()} matching`}),e[30]=s,e[31]=t,e[32]=a,e[33]=g,e[34]=v,e[35]=F):F=e[35];let J;e[36]!==s||e[37]!==t||e[38]!==a||e[39]!==m||e[40]!==v?(J=s&&v>0&&t===""&&a.length===0&&f(ut,{confirmLabel:`Clear all ${v.toString()} rows?`,onConfirm:m,testId:"db-clear-table",children:`Clear table (${v.toString()})`}),e[36]=s,e[37]=t,e[38]=a,e[39]=m,e[40]=v,e[41]=J):J=e[41];let H;e[42]!==q||e[43]!==O||e[44]!==B||e[45]!==F||e[46]!==J||e[47]!==C||e[48]!==k||e[49]!==R?(H=_("div",{className:"flex flex-wrap items-center gap-1.5",children:[C,k,R,q,O,B,F,J]}),e[42]=q,e[43]=O,e[44]=B,e[45]=F,e[46]=J,e[47]=C,e[48]=k,e[49]=R,e[50]=H):H=e[50];let G;e[51]!==n||e[52]!==t||e[53]!==a||e[54]!==u||e[55]!==d||e[56]!==p?(G=f(Mn,{columns:n,filters:a,onAskAi:u,onFiltersChange:p,onSearchChange:d,search:t}),e[51]=n,e[52]=t,e[53]=a,e[54]=u,e[55]=d,e[56]=p,e[57]=G):G=e[57];let U;return e[58]!==H||e[59]!==G?(U=_("div",{className:"flex flex-col gap-2","data-testid":"db-view-toggle",children:[H,G]}),e[58]=H,e[59]=G,e[60]=U):U=e[60],U},jo=o=>{const e=L(104),{assistant:n,backRelations:s,browser:t,columnMeta:a,edit:l,editable:i,onAskAiFilter:r,onInspect:c,onOpenGenerateRows:g,onSaveQuery:u,page:m,preferences:d,queryBar:p,references:b}=o,h=d.maskColumns.size>0,y=n.unavailable?void 0:r;let x;e[0]!==t.addRow||e[1]!==t.bulkDelete||e[2]!==t.clearTable||e[3]!==t.columns||e[4]!==t.filter||e[5]!==t.filters||e[6]!==t.liveError||e[7]!==t.onFilterChange||e[8]!==t.onFiltersChange||e[9]!==t.showJson||e[10]!==t.showTable||e[11]!==t.total||e[12]!==t.viewMode||e[13]!==i||e[14]!==g||e[15]!==d.maskOn||e[16]!==d.onToggleMask||e[17]!==h||e[18]!==y?(x=f(zo,{columns:t.columns,editable:i,filter:t.filter,filters:t.filters,hasMaskedColumns:h,liveError:t.liveError,maskOn:d.maskOn,onAddRow:t.addRow,onAskAiFilter:y,onBulkDelete:t.bulkDelete,onClearTable:t.clearTable,onFilterChange:t.onFilterChange,onFiltersChange:t.onFiltersChange,onGenerateRows:g,onShowJson:t.showJson,onShowTable:t.showTable,onToggleMask:d.onToggleMask,total:t.total,viewMode:t.viewMode}),e[0]=t.addRow,e[1]=t.bulkDelete,e[2]=t.clearTable,e[3]=t.columns,e[4]=t.filter,e[5]=t.filters,e[6]=t.liveError,e[7]=t.onFilterChange,e[8]=t.onFiltersChange,e[9]=t.showJson,e[10]=t.showTable,e[11]=t.total,e[12]=t.viewMode,e[13]=i,e[14]=g,e[15]=d.maskOn,e[16]=d.onToggleMask,e[17]=h,e[18]=y,e[19]=x):x=e[19];let v;e[20]!==u||e[21]!==p?(v=p!==void 0&&f(_o,{onApply:p.onApplyQuery,onCopyLink:p.onCopyLink,onDelete:p.onDeleteQuery,onSave:u,saved:p.saved}),e[20]=u,e[21]=p,e[22]=v):v=e[22];let w;e[23]!==s||e[24]!==t.onBulkDeleteSelected||e[25]!==t.selectedTable||e[26]!==t.table||e[27]!==t.viewMode||e[28]!==i||e[29]!==m||e[30]!==d.maskView||e[31]!==d.onToggleTranspose||e[32]!==d.transposed?(w=t.viewMode==="table"&&m.rows.length>0&&f(An,{backRelations:s.available,columns:m.columns,editable:i,enabledBackRelations:s.enabled,name:t.selectedTable??"export",onBulkDelete:t.onBulkDeleteSelected,onToggleBackRelation:s.onToggle,onToggleTranspose:d.onToggleTranspose,rows:lt(m.rows,d.maskView),table:t.table.table,transposed:d.transposed}),e[23]=s,e[24]=t.onBulkDeleteSelected,e[25]=t.selectedTable,e[26]=t.table,e[27]=t.viewMode,e[28]=i,e[29]=m,e[30]=d.maskView,e[31]=d.onToggleTranspose,e[32]=d.transposed,e[33]=w):w=e[33];let N;e[34]!==t.cancelEdit||e[35]!==t.editing||e[36]!==t.saveEdit||e[37]!==t.setEditorDocumentText||e[38]!==a||e[39]!==i||e[40]!==m?(N=i&&t.editing!==null&&f(Lo,{columnMeta:a,documentText:t.editing.docText,onCancel:t.cancelEdit,onDocumentTextChange:t.setEditorDocumentText,onSave:t.saveEdit,refs:m.refs}),e[34]=t.cancelEdit,e[35]=t.editing,e[36]=t.saveEdit,e[37]=t.setEditorDocumentText,e[38]=a,e[39]=i,e[40]=m,e[41]=N):N=e[41];let T;e[42]!==t.committing||e[43]!==t.discardStaged||e[44]!==t.onCommitStaged||e[45]!==t.stagedChanges||e[46]!==i?(T=i&&t.stagedChanges.length>0&&f(qn,{changes:t.stagedChanges,committing:t.committing,onCommit:t.onCommitStaged,onDiscard:t.discardStaged}),e[42]=t.committing,e[43]=t.discardStaged,e[44]=t.onCommitStaged,e[45]=t.stagedChanges,e[46]=i,e[47]=T):T=e[47];let C;e[48]!==t.writeError?(C=t.writeError!==null&&f("p",{className:"text-sm text-destructive","data-testid":"db-write-error",role:"alert",children:t.writeError}),e[48]=t.writeError,e[49]=C):C=e[49];let S;e[50]!==x||e[51]!==v||e[52]!==w||e[53]!==N||e[54]!==T||e[55]!==C?(S=_("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border px-4 py-3",children:[x,v,w,N,T,C]}),e[50]=x,e[51]=v,e[52]=w,e[53]=N,e[54]=T,e[55]=C,e[56]=S):S=e[56];let k;e[57]!==t.viewMode||e[58]!==m?(k=t.viewMode==="table"&&m.rows.length===0&&f("div",{className:"flex flex-1 items-center justify-center p-6",children:f(Nn,{description:"Rows you insert into this table will show up here.",icon:f("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:f("path",{d:"M4 5h16v14H4V5Zm0 5h16M10 10v9M4 14.5h16"})}),testId:"db-empty-rows",title:"This table is empty."})}),e[57]=t.viewMode,e[58]=m,e[59]=k):k=e[59];let A;e[60]!==t.viewMode||e[61]!==m||e[62]!==d.maskView||e[63]!==d.transposed?(A=t.viewMode==="table"&&m.rows.length>0&&d.transposed&&f(In,{columns:m.columns,rows:lt(m.rows,d.maskView)}),e[60]=t.viewMode,e[61]=m,e[62]=d.maskView,e[63]=d.transposed,e[64]=A):A=e[64];let $;e[65]!==s||e[66]!==t.filter||e[67]!==t.onRowDelete||e[68]!==t.onRowEdit||e[69]!==t.table||e[70]!==t.viewMode||e[71]!==a||e[72]!==l||e[73]!==i||e[74]!==c||e[75]!==m||e[76]!==d.maskView||e[77]!==d.onTogglePin||e[78]!==d.pinnedColumns||e[79]!==d.transposed||e[80]!==b?($=t.viewMode==="table"&&m.rows.length>0&&!d.transposed&&f(vo,{backRelationCounts:s.counts,columnMeta:a,edit:l,editable:i,highlight:t.filter,mask:d.maskView,onDelete:t.onRowDelete,onEdit:t.onRowEdit,onInspect:c,onTogglePin:d.onTogglePin,pinnedColumns:d.pinnedColumns,refs:b,tableModel:t.table}),e[65]=s,e[66]=t.filter,e[67]=t.onRowDelete,e[68]=t.onRowEdit,e[69]=t.table,e[70]=t.viewMode,e[71]=a,e[72]=l,e[73]=i,e[74]=c,e[75]=m,e[76]=d.maskView,e[77]=d.onTogglePin,e[78]=d.pinnedColumns,e[79]=d.transposed,e[80]=b,e[81]=$):$=e[81];let E;e[82]!==t.viewMode||e[83]!==m||e[84]!==d.maskView?(E=t.viewMode==="json"&&f("pre",{className:"min-h-0 flex-1 overflow-auto border-t border-border bg-muted/30 p-3 text-xs","data-testid":"db-json",children:JSON.stringify(lt(m.rows,d.maskView),pn,2)}),e[82]=t.viewMode,e[83]=m,e[84]=d.maskView,e[85]=E):E=e[85];let D;e[86]!==t.changePageSize||e[87]!==t.goNext||e[88]!==t.goPrevious||e[89]!==t.hasNext||e[90]!==t.hasPrevious||e[91]!==t.jumpToPage||e[92]!==t.pageSize||e[93]!==t.rangeEnd||e[94]!==t.rangeStart||e[95]!==t.total?(D=f("div",{className:"flex shrink-0 items-center border-t border-border px-4 py-2",children:f(xn,{hasNext:t.hasNext,hasPrevious:t.hasPrevious,onJumpToPage:t.jumpToPage,onNext:t.goNext,onPageSizeChange:t.changePageSize,onPrevious:t.goPrevious,pageSize:t.pageSize,prefix:"db",rangeEnd:t.rangeEnd,rangeStart:t.rangeStart,total:t.total})}),e[86]=t.changePageSize,e[87]=t.goNext,e[88]=t.goPrevious,e[89]=t.hasNext,e[90]=t.hasPrevious,e[91]=t.jumpToPage,e[92]=t.pageSize,e[93]=t.rangeEnd,e[94]=t.rangeStart,e[95]=t.total,e[96]=D):D=e[96];let R;return e[97]!==k||e[98]!==A||e[99]!==$||e[100]!==E||e[101]!==D||e[102]!==S?(R=_("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"db-page",children:[S,k,A,$,E,D]}),e[97]=k,e[98]=A,e[99]=$,e[100]=E,e[101]=D,e[102]=S,e[103]=R):R=e[103],R},Go="/__lunora/seed",at=200,Jo=50,qo=(o,e)=>{const n=[];for(const s of o)s.pk!==!0&&s.ref!==void 0&&s.type==="id"&&(e[s.ref]??[]).length===0&&n.push(s.name);return n},Ko=async o=>{const e=await fetch(Go,{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST"}),n=await e.json();return e.ok&&n.rows!==void 0?{kind:"ok",rows:n.rows}:{kind:"error",message:n.error??`seed request failed (${String(e.status)})`}},Wo="rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",Ho="rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",Qo=({columns:o,fkPools:e,onClose:n,onInsertRows:s,table:t})=>{const a=re(),[l,i]=M(10),[r,c]=M(!1),[g,u]=M(void 0),[m,d]=M(void 0),[p,b]=M(0),h=w=>{const N=Number(w.target.value);!Number.isNaN(N)&&N>=1&&i(Math.min(N,at))},y=async()=>{u(void 0),d(void 0),b(0),c(!0);try{const w=await Ko({count:l,existingIds:e,seed:Date.now(),table:t});if(w.kind==="error"){u(w.message);return}const{rows:N}=w;if(N.length===0){u(a("No rows generated — all columns were skipped."));return}const T=await s(N);if(T.error!==void 0){u(T.error);return}d(T.inserted),b(T.conflicts);const C=qo(o,e);C.length>0&&u(a("Inserted {count} rows. Skipped FK columns: {cols}",{cols:C.join(", "),count:T.inserted.toString()}))}finally{c(!1)}},x=()=>{be(y())},v=o.filter(w=>w.pk!==!0);return _(It,{label:a("Generate dummy rows"),onClose:n,panelTestId:"gen-rows-panel",testId:"gen-rows-overlay",variant:"dialog",children:[_("div",{className:"flex items-start justify-between",children:[_("div",{className:"flex flex-col gap-0.5",children:[f("h3",{className:"text-base text-foreground","data-testid":"gen-rows-title",children:a("Generate dummy rows")}),f("p",{className:"text-xs text-muted-foreground","data-testid":"gen-rows-desc",children:a("Seed {table} with Faker-generated rows. Existing rows are not affected.",{table:t})})]}),f("button",{className:"text-xs text-muted-foreground hover:text-foreground","data-testid":"gen-rows-close",onClick:n,type:"button",children:a("Close")})]}),_("div",{className:"flex items-center gap-2",children:[f("label",{className:"text-xs font-medium text-foreground",htmlFor:"gen-rows-count",children:a("Row count")}),f("input",{className:"w-20 rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus-visible:border-ring","data-testid":"gen-rows-count",id:"gen-rows-count",max:at,min:1,onChange:h,type:"number",value:l}),f("span",{className:"text-xs text-muted-foreground",children:a("(max {max})",{max:at.toString()})})]}),v.length>0&&_("div",{className:"flex flex-col gap-1",children:[f("p",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:a("Columns to seed")}),f("ul",{className:"flex flex-col gap-0.5","data-testid":"gen-rows-columns",children:v.map(w=>{const N=w.ref!==void 0&&w.type==="id",T=N&&(e[w.ref??""]??[]).length===0,C=T?"rounded bg-destructive/10 px-1 text-destructive":"rounded bg-muted px-1 text-muted-foreground",S=T?`gen-rows-fk-empty-${w.name}`:`gen-rows-fk-ok-${w.name}`,k=T?a("FK: no rows in {ref} — will skip",{ref:w.ref??""}):a("→ {ref}",{ref:w.ref??""});return _("li",{className:"flex items-center gap-1.5 font-mono text-xs",children:[f("span",{className:"text-foreground",children:w.name}),_("span",{className:"text-muted-foreground",children:["(",w.type,")"]}),w.optional&&f("span",{className:"rounded bg-muted px-1 font-mono text-[10px] tracking-wide uppercase",children:"optional"}),N&&f("span",{className:C,"data-testid":S,children:k})]},w.name)})})]}),g!==void 0&&f("p",{className:"text-xs text-destructive","data-testid":"gen-rows-error",role:"alert",children:g}),m!==void 0&&g===void 0&&f("p",{className:"text-xs text-success","data-testid":"gen-rows-success",children:p>0?a("Inserted {inserted} of {total} rows — {conflicts} skipped as id conflicts.",{conflicts:p.toString(),inserted:m.toString(),total:(m+p).toString()}):a("Inserted {count} rows successfully.",{count:m.toString()})}),_("div",{className:"flex justify-end gap-2",children:[f("button",{className:Wo,"data-testid":"gen-rows-cancel",onClick:n,type:"button",children:a("Cancel")}),f("button",{className:Ho,"data-testid":"gen-rows-generate",disabled:r,onClick:x,type:"button",children:a(r?"Inserting…":"Generate & insert")})]})]})},Uo=Te(le.backRelationCounts),Yo=(o,e,n,s)=>{const t=L(16),a=ot();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={},t[0]=l):l=t[0];const[i,r]=M(l);let c;if(t[1]!==o||t[2]!==e){let y;t[4]!==o?(y=x=>o.has(pt(x)),t[4]=o,t[5]=y):y=t[5],c=e.filter(y),t[1]=o,t[2]=e,t[3]=c}else c=t[3];const g=c;let u;t[6]!==n||t[7]!==g?(u=JSON.stringify([g,n]),t[6]=n,t[7]=g,t[8]=u):u=t[8];const m=u;let d;t[9]!==a||t[10]!==s||t[11]!==m?(d=async y=>{const[x,v]=JSON.parse(m);if(x.length===0||v.length===0){y.cancelled||r({});return}try{const w=await a.query(Uo,{ids:v,relations:x},we(s));y.cancelled||r(Object.fromEntries(w.relations.map(Xo)))}catch{}},t[9]=a,t[10]=s,t[11]=m,t[12]=d):d=t[12];const p=d;let b,h;return t[13]!==p?(b=()=>{const y={cancelled:!1};return be(p(y)),()=>{y.cancelled=!0}},h=[p],t[13]=p,t[14]=b,t[15]=h):(b=t[14],h=t[15]),Le(b,h),i};function Xo(o){return[pt(o),o.counts]}const Ze=o=>{const e=o[0];return e===void 0?void 0:{column:e.id,direction:e.desc?"desc":"asc"}},Vt=o=>o==null?"":typeof o=="object"?JSON.stringify(o):String(o),Et=o=>o.map(e=>({column:e.column,operator:e.operator,value:e.value===void 0?"":Vt(e.value)})),_t=o=>o===void 0?[]:[{desc:o.direction==="desc",id:o.column}],Zo=o=>[o.column,o.operator,o.value],Ye=(o,e,n,s)=>JSON.stringify([o??"",e??"",(n??[]).map(t=>Zo(t)),s===void 0?null:[s.column,s.direction]]),Rt=200,es=20,ts=Te(le.readTablePage),ns=Te(le.facetColumn),ct=Te(le.writeRow),os=Te(le.deleteRows),ss=Te(le.clearTable),ls={},ht=new Set(["__doc__","__id__","_creationTime","_id","id"]),rs=o=>{const e=o.__doc__;if(typeof e=="string"){const s=Ln(e);if(s!==void 0)return s}const n={};for(const[s,t]of Object.entries(o))ht.has(s)||(n[s]=t);return n},is=({filters:o,offset:e,pageSize:n,search:s,sorting:t,table:a})=>({filters:Ve(o),limit:n,offset:e,orderBy:Ze(t),search:s,skipCount:!0,table:a}),as=({filters:o,search:e,table:n})=>({filters:Ve(o),limit:1,search:e,table:n}),cs=(o,e)=>{const n=new Map;for(const t of o?.rows??[]){const a=ke(t);a!==null&&n.set(a,t)}const s=[];for(const[t,a]of Object.entries(e))for(const[l,i]of Object.entries(a))s.push({column:l,newValue:i,oldValue:n.get(t)?.[l],rowId:t});return s},ds=o=>!ht.has(o),us=({initialFilters:o,initialOrderBy:e,initialSearch:n,initialShardKey:s,onSelectTable:t,onViewChange:a,pageSize:l,resolveBackRelations:i,tableParam:r})=>{const c=ot(),[g,u]=M(l),[m,d]=M(s??""),p=r===void 0||r===""?null:r,[b,h]=M(0),[y,x]=M("table"),[v,w]=M(()=>_t(e)),[N,T]=M(n??""),[C,S]=M(()=>Et(o??[])),{clearFacets:k,facets:A,refetchFacets:$,toggleFacet:E}=vn(),[D,R]=M(null),[q,O]=M(null),B=Jn(),[F,J]=M(null),[H,G]=M(!1),[U,ye]=M(r),[ie,he]=M(()=>Ye(s,n,o,e)),[xe,Se]=M(0),[ce,Ce]=M(()=>Ye(s,n,o,e)),de=r!==U,Z=Ye(s,n,o,e),ue=de||!de&&Z!==ie&&Z!==ce;if(ue){ye(r),he(Z),Se(V=>V+1),w(_t(e)),T(n??"");const I=Et(o??[]);S(I),d(s??""),k(),B.clear(),J(null),h(0)}else Z!==ie&&he(Z);const fe=ue?n??"":N,se=ue?s??"":m,me=`${r??""}:${xe.toString()}`,Y=vt(fe.trim(),300,me),j=vt(se.trim(),400,me),te=Ye(j,Y,Ve(C),Ze(v));te!==ce&&Ce(te);const ne=Xe(le.listTables,ls,{live:!0,shardKey:j}),Me=ne.data??null,oe=ne.error,W=is({filters:C,offset:b,pageSize:g,search:Y,sorting:v,table:p??""}),ee=as({filters:C,search:Y,table:p??""}),Q=Xe(le.readTablePage,W,{enabled:p!==null,keepPreviousData:!1,live:!0,shardKey:j}),z=Q.data??null,ge=Q.error,{liveError:K}=Q,Ee=Xe(le.readTablePage,ee,{enabled:p!==null,live:!0,shardKey:j});Le(()=>{ne.data!==void 0&&Bn(j)},[ne.data,j]);const Ae=I=>{t?.(I)},Oe=(I,V)=>{t?.(I,{search:V})},Fe=async(I,V)=>{try{return(await c.query(ts,{filters:[],limit:es,offset:0,search:V,table:I},we(j))).rows.find(ve=>ke(ve)===V)??null}catch{return null}},ze=(I,V,ae,ve)=>De=>c.query(ns,{column:De,filters:Ve(ae),search:ve,table:V},we(I)),pe=I=>{E(I,p===null?null:ze(j,p,C,Y))},je=(I,V)=>{const ae=Vt(V);S(ve=>[...ve.filter(De=>De.column!==I),{column:I,operator:"eq",value:ae}]),h(0)},Pe=rt(ze),Ke=rt($),Qe=rt(a);Le(()=>{p!==null&&Ke.current(Pe.current(j,p,C,Y))},[j,p,C,Y]),Le(()=>{p===null||Qe.current===void 0||U!==r||ie!==Z||Qe.current({filters:Ve(C),orderBy:Ze(v),search:Y,shard:j})},[p,r,U,ie,Z,C,v,Y,j]);const We=I=>{p!==null&&h(Math.max(0,I))},st=(I,V)=>{J({column:V,rowId:I})},P=()=>{J(null)},X=async()=>{if(p!==null){O(null),G(!0);try{for(const[I,V]of Object.entries(B.staged))await c.query(ct,{doc:V,id:I,op:"patch",table:p},we(j));B.clear(),J(null),Q.refetch()}catch(I){O(I.message)}G(!1)}},_e=()=>{B.clear(),J(null)},Re=cs(z,B.staged),$e=async(I,V,ae)=>{if(p===null)return;O(null);let ve;if(I!=="delete"){let De;try{De=ae===void 0||ae.trim()===""?{}:JSON.parse(ae)}catch(Ge){O(`Invalid JSON: ${Ge.message}`);return}try{const Ge=Pn(De);if(!Vn(Ge)){O("The document must be a JSON object.");return}ve=Ge}catch(Ge){O(`Invalid document: ${Ge.message}`);return}}try{await c.query(ct,{doc:ve,id:V??void 0,op:I,table:p},we(j)),R(null),Q.refetch()}catch(De){O(De.message)}},Ue=async(I,V)=>{if(p!==null){O(null);try{let ae="cap-hit";for(let ve=0;ve<Rt;ve+=1)if(!(await c.query(I,V,we(j))).hasMore){ae="completed";break}h(0),Q.refetch(),ae==="cap-hit"&&O(`Stopped after ${Rt.toString()} batches — rows still match this delete. Run it again to remove the rest.`)}catch(ae){O(ae.message)}}},Lt=I=>{w(I),h(0)},Bt=dt(()=>p===null?[]:i?.(p)??[],[i,p]),zt=wo(z,v,Lt,Bt),jt={filters:Ve(C),orderBy:Ze(v),search:Y,shard:m,table:p??void 0},xt=Ee.data?.total??(z===null?0:b+z.rows.length),Gt=b>0,Jt=z!==null&&b+z.rows.length<xt,qt=z===null||z.rows.length===0?0:b+1,Kt=z===null?0:b+z.rows.length,Wt=()=>{ne.refetch()},Ht=()=>{x("table")},Qt=()=>{x("json")},Ut=()=>{be(Ue(os,{filters:Ve(C),search:Y,table:p}))},Yt=()=>{be(Ue(ss,{table:p}))},Xt=I=>{T(I.target.value),h(0)},Zt=I=>{S(I),h(0)},en=()=>{O(null);const I={};for(const V of z?.columns??[])ht.has(V)||(I[V]="");R({docText:JSON.stringify(I,null,2),id:""})},tn=I=>{R(V=>V===null?V:{docText:I,id:V.id})},nn=()=>{D!==null&&be($e(D.id===""?"insert":"patch",D.id===""?null:D.id,D.docText))},on=()=>{R(null),O(null)},sn=()=>{We(b-g)},ln=()=>{We(b+g)},rn=I=>{We(Math.max(0,(I-1)*g))},an=I=>{u(I),h(0)},cn=(I,V)=>{O(null),R({docText:JSON.stringify(Fn(rs(V)),null,2),id:I})},dn=I=>{be($e("delete",I))},un=async I=>{if(!(p===null||I.length===0)){O(null);try{for(const V of I)await c.query(ct,{id:V,op:"delete",table:p},we(j));Q.refetch()}catch(V){O(V.message)}}},fn=I=>{be(un(I))},mn=()=>{be(X())};return{addRow:en,bulkDelete:Ut,cancelCellEdit:P,cancelEdit:on,changePageSize:an,clearTable:Yt,columns:z?.columns??[],committing:H,currentView:jt,discardStaged:_e,editableColumn:ds,editing:D,editingCell:F,facetFilter:je,facets:A,filter:N,filters:C,goNext:ln,goPrevious:sn,hasNext:Jt,hasPrevious:Gt,jumpToPage:rn,liveError:K,loadTables:Wt,navigateToRef:Oe,onBulkDeleteSelected:fn,onCommitStaged:mn,onFilterChange:Xt,onFiltersChange:Zt,onRowDelete:dn,onRowEdit:cn,page:z,previewRef:Fe,pageError:ge,pageSize:g,rangeEnd:Kt,rangeStart:qt,queryShardKey:j,saveEdit:nn,selectedTable:p,selectTable:Ae,setEditorDocumentText:tn,setShardKey:d,shardKey:m,showJson:Qt,showTable:Ht,stage:B.stage,stagedChanges:Re,stagedValue:B.stagedValue,startCellEdit:st,table:zt,tables:Me,tablesError:oe,toggleFacet:pe,total:xt,viewMode:y,writeError:q}},fs="lunora-studio-pinned-columns",ms=o=>{const e=L(21),{columns:n,initialPins:s,selectedTable:t}=o;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];const[l,i]=$t(fs,a),r=t??"",c=l[r];let g;e[1]!==s||e[2]!==c?(g=c===void 0?new Set((s??"").split(",").filter(gs)):new Set(c),e[1]=s,e[2]=c,e[3]=g):g=e[3];const u=g;let m;e[4]!==r||e[5]!==u||e[6]!==i?(m=k=>{i(A=>{const $=A[r]??[...u],E=$.includes(k)?$.filter(D=>D!==k):[...$,k];return{...A,[r]:E}})},e[4]=r,e[5]=u,e[6]=i,e[7]=m):m=e[7];const d=m,[p,b]=M(!1);let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{b(ps)},e[8]=h):h=e[8];const y=h;let x;e[9]!==n||e[10]!==t?(x={columns:n,selectedTable:t},e[9]=n,e[10]=t,e[11]=x):x=e[11];const{maskColumns:v,maskOn:w,maskView:N,maskViewFor:T,onToggleMask:C}=wn(x);let S;return e[12]!==v||e[13]!==w||e[14]!==N||e[15]!==T||e[16]!==C||e[17]!==d||e[18]!==u||e[19]!==p?(S={maskColumns:v,maskOn:w,maskView:N,maskViewFor:T,onToggleMask:C,onTogglePin:d,onToggleTranspose:y,pinnedColumns:u,transposed:p},e[12]=v,e[13]=w,e[14]=N,e[15]=T,e[16]=C,e[17]=d,e[18]=u,e[19]=p,e[20]=S):S=e[20],S};function gs(o){return o!==""}function ps(o){return!o}const bs=Te(le.describeTable),hs=Te(le.readTablePage),xs=Te(le.importShard),vs=o=>{const e=o._id??o.id??o.__id__??"";return typeof e=="string"?e:typeof e=="number"?String(e):""},ws=o=>{const e=Object.values(o.inserted).reduce((r,c)=>r+c,0),[n]=o.errors;if(n===void 0)return{conflicts:o.conflicts,error:void 0,inserted:e};const s=o.errors.length-1,t=e+o.conflicts+o.errors.length,a=s===1?"error":"errors",l=s>0?` (+${s.toString()} more ${a})`:"",i=`Inserted ${e.toString()} of ${t.toString()} rows — row ${n.line.toString()} (${n.table}): ${n.message}${l}`;return{conflicts:o.conflicts,error:i,inserted:e}},ys=o=>{const e=ot(),[n,s]=M(!1),[t,a]=M(void 0),[l,i]=M(void 0),[r,c]=M(void 0),[g,u]=M({}),[m,d]=M(!1),[p,b]=M(void 0),h=async(w,N)=>{s(!0),a(w),i(N),c(void 0),u({}),b(void 0),d(!0);try{const T=await e.query(bs,{table:w},we(N)),{columns:C}=T;c(C);const S={},k=C.filter(A=>A.ref!==void 0&&A.type==="id"&&A.pk!==!0);for(const A of k){if(A.ref===void 0)continue;const{ref:$}=A;if(S[$]===void 0)try{const E=await e.query(hs,{filters:[],limit:Jo,offset:0,search:"",table:$},we(N));S[$]=E.rows.flatMap(D=>vs(D)||[])}catch{S[$]=[]}}u(S)}catch(T){b(T.message)}d(!1)};return{closeDialog:()=>{s(!1),a(void 0),i(void 0),c(void 0),u({}),b(void 0)},columnMeta:r,error:p,fkPools:g,insertBatch:async(w,N)=>{if(t===void 0||l===void 0)return{conflicts:0,error:"No table selected.",inserted:0};try{const T=await e.query(xs,{rows:w.map(S=>({doc:S,table:t}))},we(l)),C=ws(T);return C.error!==void 0||(N(),o()),C}catch(T){return{conflicts:0,error:T.message,inserted:0}}},loading:m,open:n,openDialog:(w,N)=>{be(h(w,N))},shardKey:l,table:t}},Ss=()=>{const o=L(6),[e,n]=M(null);let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{n(null)},o[0]=s):s=o[0];const t=s,[a,l]=M(null);let i;o[1]===Symbol.for("react.memo_cache_sentinel")?(i=(m,d)=>{l({column:m,value:d})},o[1]=i):i=o[1];const r=i;let c;o[2]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{l(null)},o[2]=c):c=o[2];const g=c;let u;return o[3]!==a||o[4]!==e?(u={closeExpandedCell:g,closeInspect:t,expandedCell:a,inspecting:e,onExpandCell:r,onInspect:n},o[3]=a,o[4]=e,o[5]=u):u=o[5],u},Cs=/(?:_creationtime|(?:^|[a-z])(?:time|at))$/iu,Ns=(o,e)=>typeof e=="number"&&Cs.test(o),ks=o=>{const e=L(31),{column:n,masked:s,onNavigate:t,target:a,value:l}=o;let i;e[0]!==t||e[1]!==a||e[2]!==l?(i=()=>{a!==void 0&&t(a,String(l))},e[0]=t,e[1]=a,e[2]=l,e[3]=i):i=e[3];const r=i;if(l==null){let u;return e[4]===Symbol.for("react.memo_cache_sentinel")?(u=f("span",{className:"italic text-muted-foreground",children:"null"}),e[4]=u):u=e[4],u}if(s){const u=`rd-masked-${n}`;let m;e[5]!==l?(m=Be(l),e[5]=l,e[6]=m):m=e[6];let d;return e[7]!==u||e[8]!==m?(d=f("span",{className:"italic text-muted-foreground","data-testid":u,title:"Masked (preview)",children:m}),e[7]=u,e[8]=m,e[9]=d):d=e[9],d}if(a!==void 0&&(typeof l=="string"||typeof l=="number")&&String(l)!==""){const u=`rd-ref-${n}`,m=`Open ${a} ${String(l)}`,d=String(l);let p;return e[10]!==r||e[11]!==u||e[12]!==m||e[13]!==d?(p=_("button",{"data-testid":u,onClick:r,title:m,type:"button",children:[d," ↗"]}),e[10]=r,e[11]=u,e[12]=m,e[13]=d,e[14]=p):p=e[14],p}if(Ns(n,l)){const u=`rd-ts-${n}`;let m;e[15]!==l?(m=l.toString(),e[15]=l,e[16]=m):m=e[16];let d;e[17]!==l?(d=bn(l),e[17]=l,e[18]=d):d=e[18];let p;return e[19]!==u||e[20]!==m||e[21]!==d?(p=f("span",{"data-testid":u,title:m,children:d}),e[19]=u,e[20]=m,e[21]=d,e[22]=p):p=e[22],p}if(typeof l=="object"){let u;e[23]!==l?(u=JSON.stringify(l,null,2),e[23]=l,e[24]=u):u=e[24];let m;return e[25]!==u?(m=f("pre",{className:"m-0 overflow-auto rounded-md bg-muted/50 p-2 text-xs",children:u}),e[25]=u,e[26]=m):m=e[26],m}let c;e[27]!==l?(c=Be(l),e[27]=l,e[28]=c):c=e[28];let g;return e[29]!==c?(g=f("span",{children:c}),e[29]=c,e[30]=g):g=e[30],g},Ts=o=>{const e=L(23),{columns:n,mask:s,onClose:t,onNavigate:a,refs:l,row:i}=o;let r;e[0]!==t||e[1]!==a?(r=(b,h)=>{a(b,h),t()},e[0]=t,e[1]=a,e[2]=r):r=e[2];const c=r;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=f("h3",{className:"m-0 text-base text-foreground",children:"Row detail"}),e[3]=g):g=e[3];let u;e[4]!==t?(u=_("div",{className:"mb-3 flex items-center justify-between",children:[g,f("button",{"data-testid":"rd-close",onClick:t,type:"button",children:"Close"})]}),e[4]=t,e[5]=u):u=e[5];let m;if(e[6]!==n||e[7]!==s||e[8]!==c||e[9]!==l||e[10]!==i){let b;e[12]!==s||e[13]!==c||e[14]!==l||e[15]!==i?(b=h=>_("div",{className:"border-t border-border py-2 first:border-t-0","data-testid":`rd-field-${h}`,children:[f("dt",{className:"mb-0.5 text-xs font-semibold text-muted-foreground",children:h}),f("dd",{className:"m-0",children:f(ks,{column:h,masked:s.enabled&&s.columns.has(h),onNavigate:c,target:l?.[h],value:i[h]})})]},h),e[12]=s,e[13]=c,e[14]=l,e[15]=i,e[16]=b):b=e[16],m=n.map(b),e[6]=n,e[7]=s,e[8]=c,e[9]=l,e[10]=i,e[11]=m}else m=e[11];let d;e[17]!==m?(d=f("dl",{"data-testid":"rd-fields",children:m}),e[17]=m,e[18]=d):d=e[18];let p;return e[19]!==t||e[20]!==u||e[21]!==d?(p=_(It,{label:"Row detail",onClose:t,panelTestId:"rd-panel",testId:"rd-overlay",variant:"drawer",children:[u,d]}),e[19]=t,e[20]=u,e[21]=d,e[22]=p):p=e[22],p},Es=50,_s=o=>{const e=L(8),{active:n,onPick:s,shard:t}=o;let a;e[0]!==s||e[1]!==t?(a=()=>{s(t)},e[0]=s,e[1]=t,e[2]=a):a=e[2];const l=a,i=`w-full rounded px-2 py-0.5 text-left text-xs transition-colors hover:bg-accent ${n?"bg-accent font-medium":""}`,r=`shard-explorer-item-${t}`;let c;return e[3]!==l||e[4]!==t||e[5]!==i||e[6]!==r?(c=f("button",{className:i,"data-testid":r,onClick:l,type:"button",children:t}),e[3]=l,e[4]=t,e[5]=i,e[6]=r,e[7]=c):c=e[7],c},Rs=({onFetchTables:o,onSelect:e})=>{const n=re(),[s]=M(()=>zn()),[t,a]=M(!1),[l,i]=M(void 0),[r,c]=M(void 0),[g,u]=M(!1),[m,d]=M(void 0),p=He(0),b=()=>{a(x=>!x)},h=async x=>{e(x),i(x),c(void 0),d(void 0),u(!0),p.current+=1;const v=p.current;try{const w=await o(x);p.current===v&&c(w?.slice(0,Es))}catch(w){p.current===v&&d(w.message)}p.current===v&&u(!1)},y=x=>{be(h(x))};return s.length===0?null:_("div",{"data-testid":"shard-explorer",children:[_("button",{"aria-controls":"shard-explorer-panel","aria-expanded":t,className:"inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"shard-explorer-toggle",onClick:b,type:"button",children:[n("Shards seen"),f("span",{"aria-hidden":"true",className:`ml-0.5 transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),t&&_("div",{className:"mt-1 flex flex-col gap-1 rounded-md border border-border bg-popover p-2","data-testid":"shard-explorer-panel",id:"shard-explorer-panel",children:[f("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-hint",children:n("Recently visited shards — click to switch")}),f("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-list",children:s.map(x=>f("li",{children:f(_s,{active:l===x,onPick:y,shard:x})},x))}),l!==void 0&&_("div",{className:"mt-1 border-t border-border pt-1","data-testid":"shard-explorer-summary",children:[f("p",{className:"mb-1 text-xs font-medium text-foreground","data-testid":"shard-explorer-summary-title",children:n("{shard} tables",{shard:l})}),g&&f("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-loading",children:n("Loading…")}),m!==void 0&&f("p",{className:"text-xs text-destructive","data-testid":"shard-explorer-error",role:"alert",children:m}),!g&&m===void 0&&r?.length===0&&f("p",{className:"text-xs text-muted-foreground","data-testid":"shard-explorer-empty",children:n("No tables in this shard.")}),!g&&m===void 0&&r!==void 0&&r.length>0&&f("ul",{className:"flex flex-col gap-0.5","data-testid":"shard-explorer-tables",children:r.map(x=>_("li",{className:"flex items-center justify-between text-xs",children:[f("span",{"data-testid":`shard-explorer-table-${x.name}`,children:x.name}),f("span",{className:"text-muted-foreground","data-testid":`shard-explorer-rowcount-${x.name}`,children:x.rowCount})]},x.name))})]})]})]})},$s="lunora-studio-back-relations",Ds={},Is=50,Ms=[],As=Te(le.listTables),Os=o=>{const e=L(10),{onFetchShardTables:n,onShardChange:s,schemaSwitch:t,shardKey:a}=o;let l;e[0]!==s||e[1]!==a?(l=f(gn,{onChange:s,testId:"db-shard-input",value:a}),e[0]=s,e[1]=a,e[2]=l):l=e[2];let i;e[3]!==n||e[4]!==s?(i=f(Rs,{onFetchTables:n,onSelect:s}),e[3]=n,e[4]=s,e[5]=i):i=e[5];let r;return e[6]!==t||e[7]!==l||e[8]!==i?(r=_("div",{className:"flex shrink-0 flex-col items-stretch gap-2 border-b border-border p-3",children:[t,l,i]}),e[6]=t,e[7]=l,e[8]=i,e[9]=r):r=e[9],r},cl=({editable:o=!1,globalTableNames:e,initialFilters:n,initialOrderBy:s,initialPins:t,initialSearch:a,initialShardKey:l,onNavigateToGlobal:i,onSelectTable:r,onViewChange:c,pageSize:g=Is,queryBar:u,schemaSwitch:m,tableParam:d})=>{const b=Xe(le.describeTables,{},{shardKey:l??""}).data?.columnsByTable??Ds,[h,y]=$t($s,{}),x=et(P=>{const X=new Set(h[P]);return wt(P,b).filter(_e=>X.has(pt(_e)))},[h,b]),v=us({initialFilters:n,initialOrderBy:s,initialSearch:a,initialShardKey:l,onSelectTable:r,onViewChange:c,pageSize:g,resolveBackRelations:x,tableParam:d}),{cancelCellEdit:w,columns:N,currentView:T,editableColumn:C,editingCell:S,facetFilter:k,facets:A,loadTables:$,navigateToRef:E,onFiltersChange:D,page:R,pageError:q,previewRef:O,queryShardKey:B,selectedTable:F,selectTable:J,setShardKey:H,shardKey:G,stage:U,stagedValue:ye,startCellEdit:ie,tables:he,tablesError:xe,toggleFacet:Se}=v,ce=Cn(G),Ce=P=>{be((async()=>{const _e=await ce.suggestFilter(P,F??"");_e!==void 0&&D(_e.map(Re=>{const $e=Re.value,Ue=typeof $e=="string"||typeof $e=="number"||typeof $e=="boolean"?String($e):"";return{column:Re.column,operator:Re.operator,value:Ue}}))})())},de=F===null?[]:wt(F,b),Z=new Set(h[F??""]),Ne=[];for(const P of R?.rows??[]){const X=P._id??P.id;typeof X=="string"&&X!==""&&Ne.push(X)}const ue=Yo(Z,de,Ne,B),fe=P=>{y(X=>{const _e=F??"",Re=X[_e]??[];return{...X,[_e]:Re.includes(P)?Re.filter($e=>$e!==P):[...Re,P]}})},se=ms({columns:N,initialPins:t,selectedTable:F}),me=Ss(),{closeExpandedCell:Y,closeInspect:j,expandedCell:te,inspecting:ne,onExpandCell:Me}=me,oe=ot(),W=Object.fromEntries((b[F??""]??[]).map(P=>[P.name,P])),ee=new Map;for(const P of b[F??""]??[])P.isStorage===!0&&ee.set(P.name,P.bucket);const Q=et(async(P,X)=>oe.signedStorageUrl(P,X===void 0?{}:{bucket:X}),[oe]),z=async P=>await oe.query(As,{},we(P)),ge=()=>{F!==null&&J(F)},{closeDialog:K,columnMeta:Ee,fkPools:Ae,insertBatch:Oe,open:Fe,openDialog:ze}=ys(ge),pe=()=>{F!==null&&ze(F,G)},je=P=>Oe(P,K),Pe=(P,X)=>{if(i!==void 0&&e?.has(P)===!0){i(P,X);return}E(P,X)},Ke=u?.onSaveQuery,Qe=P=>{Ke?.(P,T)},We={cancelEdit:w,editable:o,editableColumn:C,editingCell:S,onExpandCell:Me,stage:U,stagedValue:ye,startEdit:ie},st={columns:R?.refs,maskViewFor:se.maskViewFor,onNavigate:Pe,onPreview:O};return _("div",{className:"flex h-full min-w-0","data-testid":"lunora-data-browser",children:[f(yn,{header:f(Os,{onFetchShardTables:z,onShardChange:H,schemaSwitch:m,shardKey:G}),onReload:$,onSelect:J,prefix:"db",selected:F,tables:he??Ms}),_("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[xe!==null&&f("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-tables-error",role:"alert",children:xe}),R===null&&q===null&&f("div",{className:"flex flex-1 items-center justify-center p-6",children:f("p",{className:"text-sm text-muted-foreground",children:"Select a table to browse its rows."})}),q!==null&&f("p",{className:"shrink-0 border-b border-border px-4 py-2 text-sm text-destructive","data-testid":"db-page-error",role:"alert",children:q}),R!==null&&f(jo,{assistant:ce,backRelations:{available:de,counts:ue,enabled:Z,onToggle:fe},browser:v,columnMeta:W,edit:We,editable:o,onAskAiFilter:Ce,onInspect:me.onInspect,onOpenGenerateRows:pe,onSaveQuery:Qe,page:R,preferences:se,queryBar:u,references:st})]}),R!==null&&f(Sn,{columns:N,facets:A,mask:se.maskView,onFacetFilter:k,onToggleFacet:Se}),ne!==null&&R!==null&&f(Ts,{columns:R.columns,mask:se.maskView,onClose:j,onNavigate:Pe,refs:R.refs,row:Dt(ne,se.maskView)}),te!==null&&f(On,{bucket:ee.get(te.column),column:te.column,onClose:Y,resolveUrl:ee.has(te.column)?Q:void 0,value:te.value}),Fe&&F!==null&&Ee!==void 0&&f(Qo,{columns:Ee,fkPools:Ae,onClose:K,onInsertRows:je,table:F})]})};export{cl as DataBrowser};
@@ -1 +0,0 @@
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 as n}from"./home-panel-CSENDmoB.mjs";export{n as HomePanel};
@@ -1,3 +0,0 @@
1
- import{c as $}from"react/compiler-runtime";import{useNavigate as Je}from"@tanstack/react-router";import{useState as Ue,useEffect as Ke,Suspense as st,lazy as nt}from"react";import{B as Ye}from"./badge-r_5B4LHP.mjs";import{C as B,a as Ze}from"./card--2hKx4L2.mjs";import{E as lt}from"./empty-state-D7jEML_T.mjs";import{u as _e}from"./use-admin-query-Cbj2GuHu.mjs";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as Ne}from"./ADMIN_FUNCTIONS-B6z7VLYt.mjs";import{c as at,f as Se,d as rt,r as ot,g as it,l as ct}from"./internal-CwaF9YNk.mjs";import{c as Xe}from"./utils-bhneXptQ.mjs";import{deriveInsights as dt}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useLunora as et}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ve}from"./button-q0UYSmrn.mjs";const ut=at(Ne.studioFeatures),tt={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},mt=t=>{if(t===null||typeof t!="object")return tt;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ft=()=>{const t=$(3),e=et(),[n,s]=Ue(tt);let a,r;return t[0]!==e?(a=()=>{Se((async()=>{try{s(mt(await e.query(ut,{},rt(""))))}catch{}})())},r=[e],t[0]=e,t[1]=a,t[2]=r):(a=t[1],r=t[2]),Ke(a,r),n},pt=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},ht=t=>{const e=$(24),{group:n}=t,s=I(),a=Je();let r;e[0]!==n.tab||e[1]!==a?(r=()=>{Se(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=r):r=e[2];const o=r,i=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(pt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(bt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Ze,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==o||e[22]!==g?(x=l(B,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:o,children:g}),e[20]=n.testId,e[21]=o,e[22]=g,e[23]=x):x=e[23],x},We=["kv","files","vectors"],gt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>We.indexOf(n.tab)-We.indexOf(s.tab)),xt=()=>{const t=$(19),e=et(),n=ft(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[r,o]=Ue(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(yt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(vt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Se((async()=>{try{const y=await b.load();if(!g.cancelled){const S={bindings:y,label:b.label,tab:b.tab,testId:b.testId};o(A=>gt(A,S))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=i,t[7]=c):(i=t[6],c=t[7]),Ke(i,c),r.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==r?(f=r.map(Nt),t[12]=r,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function bt(t){return l(Ye,{variant:"secondary",children:t},t)}function yt(t){return t.binding}function vt(t){return t.name}function Nt(t){return l(ht,{group:t},t.tab)}const _t=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],St=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=_t.map(n=>`- ${n.name} — ${n.summary}`).join(`
2
- `);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
- `)},Ct=1500,wt=()=>{const t=$(35),e=I();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=ot(),t[0]=n):n=t[0];const s=n,[a,r]=Ue(null);let o,i;t[1]!==a?(o=()=>{if(a===null)return;const L=globalThis.setTimeout(()=>{r(null)},Ct);return()=>{globalThis.clearTimeout(L)}},i=[a],t[1]=a,t[2]=o,t[3]=i):(o=t[2],i=t[3]),Ke(o,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=(L,M)=>{it(M)&&r(L)},t[4]=c):c=t[4];const m=c;let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{m("config",St(s))},t[5]=d):d=t[5];const f=d;let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{m("prompt",kt(s))},t[6]=u):u=t[6];const p=u;let g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=l("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let y;t[13]!==b?(y=l("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=y):y=t[14];let S;t[15]!==x||t[16]!==y?(S=h("div",{className:"flex flex-col gap-1.5 p-4",children:[x,y]}),t[15]=x,t[16]=y,t[17]=S):S=t[17];let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A=l("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=A):A=t[18];let k;t[19]!==a||t[20]!==e?(k=e(a==="config"?"Copied":"Copy MCP config"),t[19]=a,t[20]=e,t[21]=k):k=t[21];let v;t[22]!==k?(v=l(Ve,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:k}),t[22]=k,t[23]=v):v=t[23];let C;t[24]!==a||t[25]!==e?(C=e(a==="prompt"?"Copied":"Copy agent prompt"),t[24]=a,t[25]=e,t[26]=C):C=t[26];let w;t[27]!==C?(w=l(Ve,{"data-testid":"home-connect-agent-copy-prompt",onClick:p,size:"xs",variant:"outline",children:C}),t[27]=C,t[28]=w):w=t[28];let N;t[29]!==v||t[30]!==w?(N=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,h("div",{className:"flex flex-wrap gap-2",children:[v,w]})]}),t[29]=v,t[30]=w,t[31]=N):N=t[31];let _;return t[32]!==S||t[33]!==N?(_=h(B,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[S,N]}),t[32]=S,t[33]=N,t[34]=_):_=t[34],_},$t=nt(()=>import("../packem_chunks/sparkline.mjs")),qe=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},At=(t,e)=>{const n=Math.max(0,Math.round((e-t)/1e3));if(n<60)return`${String(n)}s ago`;const s=Math.round(n/60);if(s<60)return`${String(s)}m ago`;const a=Math.round(s/60);return a<24?`${String(a)}h ago`:`${String(Math.round(a/24))}d ago`},Qe=(t,e)=>{if(t===void 0||t.length===0)return[];const n=new Map;for(const s of t)n.set(s.bucketMs,(n.get(s.bucketMs)??0)+s[e]);return[...n.entries()].toSorted(([s],[a])=>s-a).map(([,s])=>s)},He=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((o,i)=>o+i,0),a=t.slice(n).reduce((o,i)=>o+i,0);if(s===0)return null;const r=(a-s)/s*100;return{positive:e?r>=0:r<=0,text:`${r>=0?"+":""}${r.toFixed(1)}%`}},Re=t=>{const e=$(24),{delta:n,footer:s,label:a,trend:r,unit:o,value:i}=t,c=I();let m;e[0]!==a?(m=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=m):m=e[1];let d;e[2]!==i?(d=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==o?(f=o!==void 0&&l("span",{className:"text-xs text-muted-foreground",children:o}),e[4]=o,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=h("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let p;e[9]!==r?(p=r!==void 0&&l(st,{fallback:l("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:l($t,{data:r})}),e[9]=r,e[10]=p):p=e[10];let g;e[11]!==u||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[u,p]}),e[11]=u,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==m||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[m,g]}),e[14]=m,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n||e[18]!==s||e[19]!==c?(b=n==null?s!=null&&l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s}):h("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[l("span",{className:Xe("font-semibold",n.positive?"text-success":"text-destructive"),children:n.text})," ",l("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=n,e[18]=s,e[19]=c,e[20]=b):b=e[20];let y;return e[21]!==x||e[22]!==b?(y=h(B,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=y):y=e[23],y},Lt=()=>{const t=$(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},Fe=t=>{const e=$(7),{command:n,label:s}=t;let a;e[0]!==s?(a=l("div",{className:"p-4",children:l("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=a):a=e[1];let r;e[2]!==n?(r=l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:l("code",{className:"font-mono text-xs text-muted-foreground",children:n})}),e[2]=n,e[3]=r):r=e[3];let o;return e[4]!==a||e[5]!==r?(o=h(B,{className:"justify-between gap-0 py-0",children:[a,r]}),e[4]=a,e[5]=r,e[6]=o):o=e[6],o},Ge=t=>{const e=$(18),{count:n,onView:s,testId:a,title:r}=t,o=I();let i;e[0]!==r?(i=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=i):i=e[1];let c;e[2]!==n||e[3]!==o?(c=n===null?l("span",{className:"text-xs text-muted-foreground",children:o("No data yet")}):l(Ye,{variant:n>0?"destructive":"success",children:n>0?n:o("All clear")}),e[2]=n,e[3]=o,e[4]=c):c=e[4];let m;e[5]!==i||e[6]!==c?(m=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=m):m=e[7];let d;e[8]!==o?(d=o("View"),e[8]=o,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=l(Lt,{}),e[10]=f):f=e[10];let u;e[11]!==s||e[12]!==d?(u=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:s,type:"button",children:[d,f]}),e[11]=s,e[12]=d,e[13]=u):u=e[13];let p;return e[14]!==m||e[15]!==u||e[16]!==a?(p=h(B,{className:"justify-between gap-0 py-0","data-testid":a,children:[m,u]}),e[14]=m,e[15]=u,e[16]=a,e[17]=p):p=e[17],p},Mt=t=>{const e=$(7),{functions:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const r=[...n].toSorted(Rt).slice(0,5);let o;e[3]!==s?(o=s("Top functions"),e[3]=s,e[4]=o):o=e[4];let i;e[5]!==o?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],a=h(B,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,r.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No functions called yet.")}):h("div",{className:"divide-y divide-border",children:[h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[l("span",{children:s("Function")}),l("span",{className:"text-end",children:s("Calls")}),l("span",{className:"w-12 text-end",children:s("Avg")}),l("span",{className:"w-8 text-end",children:s("Err")})]}),r.map(Et)]})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},It=t=>{const e=$(26),{subs:n}=t,s=I();let a;e[0]!==s?(a=s("Live connections"),e[0]=s,e[1]=a):a=e[1];let r;e[2]!==a?(r=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[2]=a,e[3]=r):r=e[3];const o=n?.totalConnections??0;let i;e[4]!==o?(i=o.toLocaleString(),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==i?(c=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==s?(m=s("sockets"),e[8]=s,e[9]=m):m=e[9];let d;e[10]!==m?(d=l("span",{className:"text-xs text-muted-foreground",children:m}),e[10]=m,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];const u=n?.totalSubscriptions??0;let p;e[15]!==u?(p=u.toLocaleString(),e[15]=u,e[16]=p):p=e[16];let g;e[17]!==s?(g=s("active subscriptions"),e[17]=s,e[18]=g):g=e[18];let x;e[19]!==p||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[p," ",g]}),e[19]=p,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==r||e[24]!==f?(b=l(B,{"data-testid":"home-live-connections",children:h(Ze,{className:"flex flex-col gap-2.5 py-4",children:[r,f,x]})}),e[22]=x,e[23]=r,e[24]=f,e[25]=b):b=e[25],b},Tt=t=>{const e=$(7),{entries:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const r=Date.now();let o;e[3]!==s?(o=s("Recent activity"),e[3]=s,e[4]=o):o=e[4];let i;e[5]!==o?(i=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[5]=o,e[6]=i):i=e[6],a=h(B,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,n.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No recent activity.")}):l("ul",{className:"divide-y divide-border",children:n.slice(0,5).map(c=>h("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[h("span",{className:"flex min-w-0 items-center gap-2",children:[l("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),h("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&h("span",{className:"text-muted-foreground",children:[" · ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),l("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:At(c.ts,r)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Ot=t=>{const e=t.reduce((n,s)=>n+s.calls,0);return e===0?null:t.reduce((n,s)=>n+s.totalDurationMs,0)/e},Zt=t=>{const e=$(151),{initialShardKey:n}=t,s=I(),a=Je(),r=n??"";let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={},e[0]=o):o=e[0];let i;e[1]!==r?(i={shardKey:r},e[1]=r,e[2]=i):i=e[2];const c=_e(Ne.getMetrics,o,i);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m={},e[3]=m):m=e[3];let d;e[4]!==r?(d={shardKey:r},e[4]=r,e[5]=d):d=e[5];const f=_e(Ne.getFunctionStats,m,d);let u,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},p={shardKey:""},e[6]=u,e[7]=p):(u=e[6],p=e[7]);const g=_e(Ne.getSecurityAudit,u,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==r?(b={shardKey:r},e[9]=r,e[10]=b):b=e[10];const y=_e(Ne.listSubscriptions,x,b);let S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S={},e[11]=S):S=e[11];let A;e[12]!==r?(A={shardKey:r},e[12]=r,e[13]=A):A=e[13];const k=_e(Ne.getAuditLog,S,A),v=c.data??null;let C,w,N,_,L,M,D,T,O,P,F,q,R,E,U,K,z,V;if(e[14]!==k.data||e[15]!==g.data||e[16]!==v||e[17]!==c.data||e[18]!==a||e[19]!==f.data||e[20]!==y.data||e[21]!==s){_=Array.isArray(f.data?.functions)?f.data.functions:[],D=y.data??null;let $e;e[40]!==k.data?($e=Array.isArray(k.data?.entries)?k.data.entries:[],e[40]=k.data,e[41]=$e):$e=e[41],w=$e,L=c.data===void 0||f.data===void 0?null:dt(v,_).length,M=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ae;e[42]!==a?(Ae=()=>{Se(a({to:"/security"}))},e[42]=a,e[43]=Ae):Ae=e[43],V=Ae;let Le;e[44]!==a?(Le=()=>{Se(a({to:"/insights"}))},e[44]=a,e[45]=Le):Le=e[45],z=Le;const Me=Qe(v?.history,"calls"),Ie=Qe(v?.history,"errors"),ze=Ot(_),Te=Math.max(0,..._.map(jt)),j=v?.cache;let Oe;e[46]!==j?(Oe=j!=null&&j.hits+j.misses>0?Math.round(j.hits/(j.hits+j.misses)*100):null,e[46]=j,e[47]=Oe):Oe=e[47],N=Oe,U="flex flex-col gap-6",K="lunora-home",F="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",q="home-health";const je=He(Me);let xe;e[48]!==s?(xe=s("Requests"),e[48]=s,e[49]=xe):xe=e[49];const Be=v?.requests??0;let be;e[50]!==Be?(be=Be.toLocaleString(),e[50]=Be,e[51]=be):be=e[51],e[52]!==Me||e[53]!==je||e[54]!==xe||e[55]!==be?(R=l(Re,{delta:je,label:xe,trend:Me,value:be}),e[52]=Me,e[53]=je,e[54]=xe,e[55]=be,e[56]=R):R=e[56];const De=He(Ie,!1);let ye;e[57]!==s?(ye=s("Errors"),e[57]=s,e[58]=ye):ye=e[58];const Pe=v?.errors??0;let ve;e[59]!==Pe?(ve=Pe.toLocaleString(),e[59]=Pe,e[60]=ve):ve=e[60],e[61]!==Ie||e[62]!==De||e[63]!==ye||e[64]!==ve?(E=l(Re,{delta:De,label:ye,trend:Ie,value:ve}),e[61]=Ie,e[62]=De,e[63]=ye,e[64]=ve,e[65]=E):E=e[65],C=Re,e[66]!==Te||e[67]!==s?(T=Te>0?`${s("max")} ${qe(Te)}`:void 0,e[66]=Te,e[67]=s,e[68]=T):T=e[68],e[69]!==s?(O=s("Avg latency"),e[69]=s,e[70]=O):O=e[70],P=ze===null?"—":qe(ze),e[14]=k.data,e[15]=g.data,e[16]=v,e[17]=c.data,e[18]=a,e[19]=f.data,e[20]=y.data,e[21]=s,e[22]=C,e[23]=w,e[24]=N,e[25]=_,e[26]=L,e[27]=M,e[28]=D,e[29]=T,e[30]=O,e[31]=P,e[32]=F,e[33]=q,e[34]=R,e[35]=E,e[36]=U,e[37]=K,e[38]=z,e[39]=V}else C=e[22],w=e[23],N=e[24],_=e[25],L=e[26],M=e[27],D=e[28],T=e[29],O=e[30],P=e[31],F=e[32],q=e[33],R=e[34],E=e[35],U=e[36],K=e[37],z=e[38],V=e[39];let W;e[71]!==C||e[72]!==T||e[73]!==O||e[74]!==P?(W=l(C,{footer:T,label:O,value:P}),e[71]=C,e[72]=T,e[73]=O,e[74]=P,e[75]=W):W=e[75];let Q;e[76]!==N||e[77]!==s?(Q=N===null?void 0:`${String(N)}% ${s("cache hit")}`,e[76]=N,e[77]=s,e[78]=Q):Q=e[78];let H;e[79]!==s?(H=s("Database size"),e[79]=s,e[80]=H):H=e[80];const Ee=v?.databaseSize??null;let G;e[81]!==Ee?(G=ct(Ee),e[81]=Ee,e[82]=G):G=e[82];let J;e[83]!==Q||e[84]!==H||e[85]!==G?(J=l(Re,{footer:Q,label:H,value:G}),e[83]=Q,e[84]=H,e[85]=G,e[86]=J):J=e[86];let Y;e[87]!==F||e[88]!==q||e[89]!==R||e[90]!==E||e[91]!==W||e[92]!==J?(Y=h("div",{className:F,"data-testid":q,children:[R,E,W,J]}),e[87]=F,e[88]=q,e[89]=R,e[90]=E,e[91]=W,e[92]=J,e[93]=Y):Y=e[93];let ke;e[94]===Symbol.for("react.memo_cache_sentinel")?(ke=l(xt,{}),e[94]=ke):ke=e[94];let Z;e[95]!==_?(Z=l("div",{className:"lg:col-span-2",children:l(Mt,{functions:_})}),e[95]=_,e[96]=Z):Z=e[96];let X;e[97]!==D?(X=l(It,{subs:D}),e[97]=D,e[98]=X):X=e[98];let ee;e[99]!==w?(ee=l(Tt,{entries:w}),e[99]=w,e[100]=ee):ee=e[100];let te;e[101]!==X||e[102]!==ee?(te=h("div",{className:"flex flex-col gap-3",children:[X,ee]}),e[101]=X,e[102]=ee,e[103]=te):te=e[103];let se;e[104]!==Z||e[105]!==te?(se=h("div",{className:"grid gap-3 lg:grid-cols-3",children:[Z,te]}),e[104]=Z,e[105]=te,e[106]=se):se=e[106];let ne;e[107]!==s?(ne=s("Advisors"),e[107]=s,e[108]=ne):ne=e[108];let le;e[109]!==ne?(le=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ne}),e[109]=ne,e[110]=le):le=e[110];let ae;e[111]!==L||e[112]!==M||e[113]!==s||e[114]!==z||e[115]!==V?(ae=M===0&&L===0?l(lt,{description:s("No security or performance issues detected."),icon:h("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[l("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),l("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:s("No issues found")}):h("div",{className:"grid gap-3 sm:grid-cols-2",children:[l(Ge,{count:M,onView:V,testId:"home-security",title:s("Security findings")}),l(Ge,{count:L,onView:z,testId:"home-performance",title:s("Performance issues")})]}),e[111]=L,e[112]=M,e[113]=s,e[114]=z,e[115]=V,e[116]=ae):ae=e[116];let re;e[117]!==le||e[118]!==ae?(re=h("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[le,ae]}),e[117]=le,e[118]=ae,e[119]=re):re=e[119];let oe;e[120]!==s?(oe=s("Get connected"),e[120]=s,e[121]=oe):oe=e[121];let ie;e[122]!==oe?(ie=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:oe}),e[122]=oe,e[123]=ie):ie=e[123];let ce;e[124]!==s?(ce=s("Client SDK"),e[124]=s,e[125]=ce):ce=e[125];let de;e[126]!==ce?(de=l(Fe,{command:"npm i @lunora/client",label:ce}),e[126]=ce,e[127]=de):de=e[127];let ue;e[128]!==s?(ue=s("React"),e[128]=s,e[129]=ue):ue=e[129];let me;e[130]!==ue?(me=l(Fe,{command:"npm i @lunora/react",label:ue}),e[130]=ue,e[131]=me):me=e[131];let fe;e[132]!==s?(fe=s("CLI"),e[132]=s,e[133]=fe):fe=e[133];let pe;e[134]!==fe?(pe=l(Fe,{command:"lunora dev",label:fe}),e[134]=fe,e[135]=pe):pe=e[135];let he;e[136]!==de||e[137]!==me||e[138]!==pe?(he=h("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,me,pe]}),e[136]=de,e[137]=me,e[138]=pe,e[139]=he):he=e[139];let Ce;e[140]===Symbol.for("react.memo_cache_sentinel")?(Ce=l(wt,{}),e[140]=Ce):Ce=e[140];let ge;e[141]!==ie||e[142]!==he?(ge=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,Ce]}),e[141]=ie,e[142]=he,e[143]=ge):ge=e[143];let we;return e[144]!==U||e[145]!==K||e[146]!==Y||e[147]!==se||e[148]!==re||e[149]!==ge?(we=h("div",{className:U,"data-testid":K,children:[Y,ke,se,re,ge]}),e[144]=U,e[145]=K,e[146]=Y,e[147]=se,e[148]=re,e[149]=ge,e[150]=we):we=e[150],we};function Rt(t,e){return e.calls-t.calls}function Et(t){return h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[l("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),l("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),l("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:qe(t.calls>0?t.totalDurationMs/t.calls:0)}),l("span",{className:Xe("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function jt(t){return t.maxDurationMs}export{Zt as H,ft as u};