@lunora/studio 1.0.0-alpha.372 → 1.0.0-alpha.373

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 (114) hide show
  1. package/dist/index.d.mts +1 -1
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.mjs +1 -1
  4. package/dist/packem_chunks/FileBrowser.mjs +1 -1
  5. package/dist/packem_chunks/LogsPanel.mjs +1 -1
  6. package/dist/packem_chunks/MetricsPanel.mjs +1 -1
  7. package/dist/packem_chunks/SettingsPanel.mjs +1 -1
  8. package/dist/packem_chunks/SqlEditorPanel.mjs +15 -14
  9. package/dist/packem_chunks/TableEditor.mjs +1 -1
  10. package/dist/packem_chunks/log-drains-panel.mjs +1 -1
  11. package/dist/packem_shared/{GlobalDataBrowser-D8ZheGwm.mjs → GlobalDataBrowser-DB1B-WAN.mjs} +1 -1
  12. package/dist/packem_shared/{cf-links-C4DVTr8A.mjs → cf-links-BPy1pJRO.mjs} +1 -1
  13. package/dist/standalone/{chunk-IYX53XCW.js → chunk-25WEL5RI.js} +1 -1
  14. package/dist/standalone/{chunk-DVQVIQBT.js → chunk-2CPMCEHD.js} +1 -1
  15. package/dist/standalone/{chunk-FHASF32O.js → chunk-2IOS27FL.js} +1 -1
  16. package/dist/standalone/{chunk-HOK6O3US.js → chunk-2MZLFQR5.js} +1 -1
  17. package/dist/standalone/{chunk-XICMCBFN.js → chunk-2U6Z7A6C.js} +1 -1
  18. package/dist/standalone/{chunk-3DBV6QGB.js → chunk-3BQD5ITB.js} +1 -1
  19. package/dist/standalone/{chunk-DWFXPFDT.js → chunk-42RZZFLX.js} +1 -1
  20. package/dist/standalone/{chunk-BPNGCNB2.js → chunk-4ADB7TWC.js} +1 -1
  21. package/dist/standalone/{chunk-AVHCLWWI.js → chunk-4B54WP4R.js} +1 -1
  22. package/dist/standalone/{chunk-INTNKBFO.js → chunk-4EQAUONF.js} +1 -1
  23. package/dist/standalone/{chunk-SBFFTOVT.js → chunk-4RGKUS3H.js} +1 -1
  24. package/dist/standalone/{chunk-3LPWFZNJ.js → chunk-52ULLZJX.js} +1 -1
  25. package/dist/standalone/{chunk-IVISXJR4.js → chunk-645S7KRU.js} +1 -1
  26. package/dist/standalone/{chunk-YX3H4WA3.js → chunk-6IRGBPDN.js} +1 -1
  27. package/dist/standalone/{chunk-MZJY3N7N.js → chunk-6VOBO5QL.js} +1 -1
  28. package/dist/standalone/{chunk-ATN6HPYI.js → chunk-6YBEKVUG.js} +1 -1
  29. package/dist/standalone/{chunk-7K3VSMEZ.js → chunk-7SNL633X.js} +1 -1
  30. package/dist/standalone/{chunk-R7363SOB.js → chunk-ACWAMBGT.js} +1 -1
  31. package/dist/standalone/{chunk-S5IY62X6.js → chunk-AERXMIND.js} +1 -1
  32. package/dist/standalone/{chunk-6ALZ2WSG.js → chunk-ASD6UAND.js} +1 -1
  33. package/dist/standalone/{chunk-HAK3FCOV.js → chunk-B76HLC52.js} +1 -1
  34. package/dist/standalone/{chunk-YR5RQPV4.js → chunk-BQS3C5V3.js} +1 -1
  35. package/dist/standalone/{chunk-S4PIGHQL.js → chunk-C4BS3LHQ.js} +1 -1
  36. package/dist/standalone/{chunk-4R3EKQ2A.js → chunk-CAEJQOMU.js} +1 -1
  37. package/dist/standalone/{chunk-H5CTBNMP.js → chunk-CBACG4XF.js} +1 -1
  38. package/dist/standalone/{chunk-2Z4FB527.js → chunk-CGXIERYO.js} +1 -1
  39. package/dist/standalone/{chunk-AJIXOUOQ.js → chunk-D3DZZHZA.js} +1 -1
  40. package/dist/standalone/{chunk-7LMMVPE3.js → chunk-D6CDIHHL.js} +1 -1
  41. package/dist/standalone/{chunk-EHJ2IIDG.js → chunk-DDTWGWM4.js} +1 -1
  42. package/dist/standalone/{chunk-YPEYNYYK.js → chunk-DHH7WHXQ.js} +1 -1
  43. package/dist/standalone/{chunk-E3PLSEDK.js → chunk-EAPNLM2Q.js} +1 -1
  44. package/dist/standalone/{chunk-IXV3EMNQ.js → chunk-ELUYMLPL.js} +1 -1
  45. package/dist/standalone/{chunk-WWVOUPO3.js → chunk-EX2DUBRT.js} +1 -1
  46. package/dist/standalone/{chunk-KXFU34K6.js → chunk-F5WJCL3F.js} +1 -1
  47. package/dist/standalone/{chunk-PRPZCRYY.js → chunk-FGZ73BFG.js} +1 -1
  48. package/dist/standalone/{chunk-CHIGIVHM.js → chunk-FK2S7VR4.js} +1 -1
  49. package/dist/standalone/{chunk-AR5HF7G5.js → chunk-FT3BWJVP.js} +1 -1
  50. package/dist/standalone/{chunk-YK66QDSW.js → chunk-FWOOA2ZR.js} +1 -1
  51. package/dist/standalone/{chunk-IBCJ4VGA.js → chunk-G5REMLEG.js} +1 -1
  52. package/dist/standalone/{chunk-2ENIONNZ.js → chunk-GH6CI2P2.js} +1 -1
  53. package/dist/standalone/{chunk-TA3D6GCA.js → chunk-HCWB4UDT.js} +1 -1
  54. package/dist/standalone/{chunk-LM344LXC.js → chunk-HPD2PZP2.js} +1 -1
  55. package/dist/standalone/{chunk-VOM5M3GA.js → chunk-HZU4WF4X.js} +1 -1
  56. package/dist/standalone/{chunk-LBPNDQST.js → chunk-IELLWQGA.js} +1 -1
  57. package/dist/standalone/{chunk-DCWSHHUX.js → chunk-IJNP6YSD.js} +1 -1
  58. package/dist/standalone/{chunk-GVROUDAI.js → chunk-ILSJ22BK.js} +1 -1
  59. package/dist/standalone/{chunk-G2ER6ZFN.js → chunk-JAAXDIR5.js} +1 -1
  60. package/dist/standalone/chunk-JB3DZ2PJ.js +1 -0
  61. package/dist/standalone/{chunk-BUDP4EJL.js → chunk-JPCVFWR5.js} +1 -1
  62. package/dist/standalone/{chunk-PZMCBA23.js → chunk-KBYFBEG2.js} +1 -1
  63. package/dist/standalone/{chunk-SCGQXYRJ.js → chunk-KYN4A72O.js} +1 -1
  64. package/dist/standalone/{chunk-IRC3PGZV.js → chunk-LA76GGAT.js} +1 -1
  65. package/dist/standalone/{chunk-WVMJYTWY.js → chunk-LCIDEYA4.js} +1 -1
  66. package/dist/standalone/{chunk-F5YWZPEQ.js → chunk-LFKKTGEF.js} +1 -1
  67. package/dist/standalone/{chunk-4KCL4VXL.js → chunk-LR2FBYCC.js} +1 -1
  68. package/dist/standalone/{chunk-DH6BG54K.js → chunk-M4TCBPSY.js} +1 -1
  69. package/dist/standalone/{chunk-KBAJLVHY.js → chunk-MGFELY5Q.js} +1 -1
  70. package/dist/standalone/{chunk-Z3PS37OB.js → chunk-MJWIIV2C.js} +1 -1
  71. package/dist/standalone/{chunk-R5Y2LHHL.js → chunk-MTX62MQ7.js} +1 -1
  72. package/dist/standalone/{chunk-OFMI2ROE.js → chunk-MWYGLPDV.js} +1 -1
  73. package/dist/standalone/{chunk-T6CRFQVI.js → chunk-N7EIHD3H.js} +1 -1
  74. package/dist/standalone/{chunk-TUFZY4AM.js → chunk-NGGTRLCC.js} +1 -1
  75. package/dist/standalone/chunk-ODLNNVP2.js +7 -0
  76. package/dist/standalone/{chunk-3SD5I425.js → chunk-OODTH4NA.js} +1 -1
  77. package/dist/standalone/{chunk-MYSRHHC4.js → chunk-OSHODLMU.js} +1 -1
  78. package/dist/standalone/{chunk-WBLJB5GM.js → chunk-OVEOTKK5.js} +1 -1
  79. package/dist/standalone/{chunk-VYGJX3UB.js → chunk-PGJOTPWC.js} +1 -1
  80. package/dist/standalone/{chunk-XSJHOZY3.js → chunk-PIOHOROI.js} +1 -1
  81. package/dist/standalone/{chunk-I3AJWD67.js → chunk-PIQ4A4BZ.js} +1 -1
  82. package/dist/standalone/{chunk-HYNCYK4O.js → chunk-PUK3H4RN.js} +1 -1
  83. package/dist/standalone/{chunk-XWXZPKL2.js → chunk-QHKR5JW4.js} +1 -1
  84. package/dist/standalone/{chunk-O4YNHJSC.js → chunk-QMULO5AP.js} +1 -1
  85. package/dist/standalone/{chunk-XIV3Q3NC.js → chunk-QN66FO5B.js} +1 -1
  86. package/dist/standalone/{chunk-RGER5Q3A.js → chunk-QNY5EEBN.js} +1 -1
  87. package/dist/standalone/{chunk-U76UITHC.js → chunk-R52GVSS2.js} +1 -1
  88. package/dist/standalone/{chunk-P3JNXC5P.js → chunk-RDS46R5R.js} +1 -1
  89. package/dist/standalone/{chunk-XXH2XHDM.js → chunk-RDS72J4I.js} +1 -1
  90. package/dist/standalone/{chunk-SKVT5IO6.js → chunk-RHYQB4RH.js} +1 -1
  91. package/dist/standalone/{chunk-4R3JFKEL.js → chunk-RKPVI2PI.js} +1 -1
  92. package/dist/standalone/{chunk-DM3YNFK3.js → chunk-RUQTILJN.js} +1 -1
  93. package/dist/standalone/{chunk-2USDHESR.js → chunk-SKZNH5QQ.js} +1 -1
  94. package/dist/standalone/{chunk-O3ZVMZSA.js → chunk-SUUBCPUD.js} +1 -1
  95. package/dist/standalone/{chunk-YQCQZXJH.js → chunk-TDJQ7HQM.js} +1 -1
  96. package/dist/standalone/{chunk-F6JSRYQT.js → chunk-TUFOWHEF.js} +1 -1
  97. package/dist/standalone/{chunk-WEHLWY2J.js → chunk-USVLFLZL.js} +1 -1
  98. package/dist/standalone/{chunk-4E35ZI3H.js → chunk-VDSTHVWZ.js} +1 -1
  99. package/dist/standalone/{chunk-TOWZ7WYZ.js → chunk-VXZAS5VS.js} +1 -1
  100. package/dist/standalone/{chunk-I4EHU6GZ.js → chunk-WFXS3YRM.js} +16 -15
  101. package/dist/standalone/{chunk-Y6N2MJKJ.js → chunk-WJA2IGZC.js} +1 -1
  102. package/dist/standalone/{chunk-3H2ATHKG.js → chunk-WSG35SRF.js} +1 -1
  103. package/dist/standalone/{chunk-JLGY2EV4.js → chunk-XITLHKKR.js} +1 -1
  104. package/dist/standalone/{chunk-O2U7PWU2.js → chunk-XWVFKYZV.js} +1 -1
  105. package/dist/standalone/{chunk-T43I73OA.js → chunk-XZHTVLDG.js} +1 -1
  106. package/dist/standalone/{chunk-NS3LKZU2.js → chunk-Z6WEYWT7.js} +1 -1
  107. package/dist/standalone/{chunk-5YL3SK5T.js → chunk-Z7ZGAQ5J.js} +1 -1
  108. package/dist/standalone/{chunk-Y5N4LSAB.js → chunk-ZCOMJH2I.js} +1 -1
  109. package/dist/standalone/studio.js +1 -1
  110. package/dist/styles.css +1 -1
  111. package/package.json +5 -5
  112. package/dist/standalone/chunk-6TPZKFPG.js +0 -1
  113. package/dist/standalone/chunk-A4AUTJPE.js +0 -7
  114. /package/dist/standalone/{chunk-P6VNMPWR.js → chunk-R6NJ4ER6.js} +0 -0
@@ -1 +1 @@
1
- import{B as y,r as w}from"./chunk-HYNCYK4O.js";import{a as v}from"./chunk-GWNGVKLG.js";import{b as _}from"./chunk-6G3E4PJ2.js";import{a as m,d as g}from"./chunk-5PEAXTYQ.js";var x=g(v(),1);var a=g(_(),1);var k=m((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let n=[],l=s.toLowerCase(),o=e.toLowerCase(),t=0;for(let r=l.indexOf(o);r!==-1;r=l.indexOf(o,t))r>t&&n.push({match:!1,offset:t,text:s.slice(t,r)}),n.push({match:!0,offset:r,text:s.slice(r,r+e.length)}),t=r+e.length;return t<s.length&&n.push({match:!1,offset:t,text:s.slice(t)}),n},"N"),L=m(s=>{let e=(0,x.c)(9),{highlight:n,value:l}=s;if(l==null){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=d):d=e[0],d}let o,t,r;if(e[1]!==n||e[2]!==l){r=Symbol.for("react.early_return_sentinel");e:{let d=w(l);if(n===void 0||n===""){r=(0,a.jsx)("span",{title:d,children:d});break e}o=d,t=k(d,n).map(j)}e[1]=n,e[2]=l,e[3]=o,e[4]=t,e[5]=r}else o=e[3],t=e[4],r=e[5];if(r!==Symbol.for("react.early_return_sentinel"))return r;let c;return e[6]!==o||e[7]!==t?(c=(0,a.jsx)("span",{title:o,children:t}),e[6]=o,e[7]=t,e[8]=c):c=e[8],c},"v"),O=m(s=>{let e=(0,x.c)(22),{columns:n,rows:l}=s,o=y(),t;e[0]!==o?(t=o("Field"),e[0]=o,e[1]=t):t=e[1];let r;e[2]!==t?(r=(0,a.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let c;if(e[4]!==l||e[5]!==o){let i;e[7]!==o?(i=m((b,p)=>(0,a.jsx)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:o("Row {n}",{n:p+1})},p),"c"),e[7]=o,e[8]=i):i=e[8],c=l.map(i),e[4]=l,e[5]=o,e[6]=c}else c=e[6];let d;e[9]!==r||e[10]!==c?(d=(0,a.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,a.jsxs)("tr",{children:[r,c]})}),e[9]=r,e[10]=c,e[11]=d):d=e[11];let f;if(e[12]!==n||e[13]!==l){let i;e[15]!==l?(i=m(b=>(0,a.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,a.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:b}),l.map((p,N)=>(0,a.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,a.jsx)(L,{value:p[b]})},N))]},b),"c"),e[15]=l,e[16]=i):i=e[16],f=n.map(i),e[12]=n,e[13]=l,e[14]=f}else f=e[14];let h;e[17]!==f?(h=(0,a.jsx)("tbody",{children:f}),e[17]=f,e[18]=h):h=e[18];let u;return e[19]!==d||e[20]!==h?(u=(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,a.jsxs)("table",{className:"border-collapse text-xs",children:[d,h]})}),e[19]=d,e[20]=h,e[21]=u):u=e[21],u},"T"),T=m(({children:s,layout:e="card",testId:n})=>(0,a.jsx)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":n,children:s}),"j");function j(s){return(0,a.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}m(j,"_");export{L as a,O as b,T as c};
1
+ import{B as y,r as w}from"./chunk-PUK3H4RN.js";import{a as v}from"./chunk-GWNGVKLG.js";import{b as _}from"./chunk-6G3E4PJ2.js";import{a as m,d as g}from"./chunk-5PEAXTYQ.js";var x=g(v(),1);var a=g(_(),1);var k=m((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let n=[],l=s.toLowerCase(),o=e.toLowerCase(),t=0;for(let r=l.indexOf(o);r!==-1;r=l.indexOf(o,t))r>t&&n.push({match:!1,offset:t,text:s.slice(t,r)}),n.push({match:!0,offset:r,text:s.slice(r,r+e.length)}),t=r+e.length;return t<s.length&&n.push({match:!1,offset:t,text:s.slice(t)}),n},"N"),L=m(s=>{let e=(0,x.c)(9),{highlight:n,value:l}=s;if(l==null){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=d):d=e[0],d}let o,t,r;if(e[1]!==n||e[2]!==l){r=Symbol.for("react.early_return_sentinel");e:{let d=w(l);if(n===void 0||n===""){r=(0,a.jsx)("span",{title:d,children:d});break e}o=d,t=k(d,n).map(j)}e[1]=n,e[2]=l,e[3]=o,e[4]=t,e[5]=r}else o=e[3],t=e[4],r=e[5];if(r!==Symbol.for("react.early_return_sentinel"))return r;let c;return e[6]!==o||e[7]!==t?(c=(0,a.jsx)("span",{title:o,children:t}),e[6]=o,e[7]=t,e[8]=c):c=e[8],c},"v"),O=m(s=>{let e=(0,x.c)(22),{columns:n,rows:l}=s,o=y(),t;e[0]!==o?(t=o("Field"),e[0]=o,e[1]=t):t=e[1];let r;e[2]!==t?(r=(0,a.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let c;if(e[4]!==l||e[5]!==o){let i;e[7]!==o?(i=m((b,p)=>(0,a.jsx)("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:o("Row {n}",{n:p+1})},p),"c"),e[7]=o,e[8]=i):i=e[8],c=l.map(i),e[4]=l,e[5]=o,e[6]=c}else c=e[6];let d;e[9]!==r||e[10]!==c?(d=(0,a.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,a.jsxs)("tr",{children:[r,c]})}),e[9]=r,e[10]=c,e[11]=d):d=e[11];let f;if(e[12]!==n||e[13]!==l){let i;e[15]!==l?(i=m(b=>(0,a.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,a.jsx)("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:b}),l.map((p,N)=>(0,a.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,a.jsx)(L,{value:p[b]})},N))]},b),"c"),e[15]=l,e[16]=i):i=e[16],f=n.map(i),e[12]=n,e[13]=l,e[14]=f}else f=e[14];let h;e[17]!==f?(h=(0,a.jsx)("tbody",{children:f}),e[17]=f,e[18]=h):h=e[18];let u;return e[19]!==d||e[20]!==h?(u=(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,a.jsxs)("table",{className:"border-collapse text-xs",children:[d,h]})}),e[19]=d,e[20]=h,e[21]=u):u=e[21],u},"T"),T=m(({children:s,layout:e="card",testId:n})=>(0,a.jsx)("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":n,children:s}),"j");function j(s){return(0,a.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}m(j,"_");export{L as a,O as b,T as c};
@@ -1 +1 @@
1
- import{a as ee}from"./chunk-HOK6O3US.js";import{a as ne}from"./chunk-YK66QDSW.js";import{b as Z}from"./chunk-DH6BG54K.js";import"./chunk-YUVGMKHG.js";import{a as O}from"./chunk-MYSRHHC4.js";import{i as se,n as X}from"./chunk-A4AUTJPE.js";import"./chunk-ZPQBVYNN.js";import{B as re,w as le,x as Y}from"./chunk-HYNCYK4O.js";import"./chunk-PDBW6GTJ.js";import{a as ce}from"./chunk-GWNGVKLG.js";import{b as me}from"./chunk-6G3E4PJ2.js";import{a as k,d as ae}from"./chunk-5PEAXTYQ.js";var te=ae(ce(),1);var a=ae(me(),1);var pe="/_lunora/health",he="/_lunora/health/ready",ue=k((r,e)=>(r.endsWith("/")?r.slice(0,-1):r)+e,"me"),fe=k(()=>{let r=X();return async e=>{let w=e==="ready"?he:pe,t=r.getAuthToken(),y=ue(r.url,w);try{let i=await fetch(y,{headers:t===null?{}:{authorization:`Bearer ${t}`}}),p=null;try{p=await i.json()}catch{p=null}return{body:p,ok:i.ok,status:i.status}}catch(i){return{body:null,error:i instanceof Error?i.message:String(i),ok:!1,status:0}}}},"pe"),ge={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},ye=k(r=>r==="unhealthy"?"crit":r==="degraded"?"warn":"ok","fe"),ie=k(r=>{let e=(0,te.c)(13),{label:w,level:t,testId:y,value:i}=r,p=ge[t],d;e[0]!==p?(d=Y("size-1.5 shrink-0 rounded-full",p),e[0]=p,e[1]=d):d=e[1];let o;e[2]!==d?(o=(0,a.jsx)("span",{"aria-hidden":"true",className:d}),e[2]=d,e[3]=o):o=e[3];let c;e[4]!==w||e[5]!==o?(c=(0,a.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[o,w]}),e[4]=w,e[5]=o,e[6]=c):c=e[6];let h;e[7]!==y||e[8]!==i?(h=(0,a.jsx)("span",{className:"text-lg font-semibold text-foreground","data-testid":y,children:i}),e[7]=y,e[8]=i,e[9]=h):h=e[9];let C;return e[10]!==c||e[11]!==h?(C=(0,a.jsx)(O,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[c,h]})}),e[10]=c,e[11]=h,e[12]=C):C=e[12],C},"Z"),Ie=k(r=>{let e=(0,te.c)(107),{probe:w}=r,t=re(),y=X(),i=fe(),p=w??i,d;e[0]!==p?(d=k(async()=>{let[s,n]=await Promise.all([p("live"),p("ready")]);return{live:s,ready:n}},"o"),e[0]=p,e[1]=d):d=e[1];let o;e[2]!==y?(o=y.clientIdentifier(),e[2]=y,e[3]=o):o=e[3];let c;e[4]!==o?(c=["deployment-health",o],e[4]=o,e[5]=c):c=e[5];let h;e[6]!==d||e[7]!==c?(h={queryFn:d,queryKey:c},e[6]=d,e[7]=c,e[8]=h):h=e[8];let{data:C,isPending:de}=se(h),Q=C?.live??null,oe=C?.ready??null;if(de){let s;return e[9]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"deployment-health-loading",children:[(0,a.jsx)(ee,{className:"h-16 w-full"}),(0,a.jsx)(ee,{className:"h-40 w-full"})]}),e[9]=s):s=e[9],s}let l=Q?.body??null;if(l===null){let s=Q?.status===403,n;e[10]!==s||e[11]!==Q?.error||e[12]!==t?(n=s?t("The health endpoint is in the admin posture. Paste a valid admin token in the connect popover, or set its auth to public."):t("Couldn't reach the health endpoint: {message}",{message:Q?.error??t("no response")}),e[10]=s,e[11]=Q?.error,e[12]=t,e[13]=n):n=e[13];let m;e[14]!==t?(m=t("Health endpoint unavailable"),e[14]=t,e[15]=m):m=e[15];let f;return e[16]!==n||e[17]!==m?(f=(0,a.jsx)(ne,{description:n,testId:"deployment-health-error",title:m}),e[16]=n,e[17]=m,e[18]=f):f=e[18],f}let J;e[19]!==l.status?(J=ye(l.status),e[19]=l.status,e[20]=J):J=e[20];let W=J,u;if(l.status==="unhealthy"){let s;e[21]!==t?(s=t("Unhealthy"),e[21]=t,e[22]=s):s=e[22],u=s}else if(l.status==="degraded"){let s;e[23]!==t?(s=t("Degraded"),e[23]=t,e[24]=s):s=e[24],u=s}else{let s;e[25]!==t?(s=t("Healthy"),e[25]=t,e[26]=s):s=e[26],u=s}let _=oe?.ok??!1,G=_?"ok":"crit",j,H,I,x,N,v,S,V,b,P;if(e[27]!==l.appName||e[28]!==l.appVersion||e[29]!==l.checks||e[30]!==l.timestamp||e[31]!==W||e[32]!==G||e[33]!==_||e[34]!==u||e[35]!==t){let s=[...l.checks].toSorted(xe);H="flex flex-col gap-6",I="deployment-health";let n;e[46]!==t?(n=t("Live liveness, readiness, and per-binding health from the deployment's /_lunora/health endpoint \u2014 wire an uptime monitor or a Cloudflare Health Check at it."),e[46]=t,e[47]=n):n=e[47],e[48]!==n?(x=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:n}),e[48]=n,e[49]=x):x=e[49];let m;e[50]!==u?(m=(0,a.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"dh-status",children:u}),e[50]=u,e[51]=m):m=e[51];let f;e[52]!==l.appName||e[53]!==l.appVersion?(f=(0,a.jsxs)("span",{className:"font-mono text-[13px] text-muted-foreground","data-testid":"dh-app",children:[l.appName," \xB7 ",l.appVersion]}),e[52]=l.appName,e[53]=l.appVersion,e[54]=f):f=e[54];let D;e[55]!==m||e[56]!==f?(D=(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsxs)("div",{className:"grid leading-tight",children:[m,f]})}),e[55]=m,e[56]=f,e[57]=D):D=e[57];let T;e[58]!==t?(T=t("Checked"),e[58]=t,e[59]=T):T=e[59];let $;e[60]!==T?($=(0,a.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:T}),e[60]=T,e[61]=$):$=e[61];let q;e[62]!==l.timestamp?(q=le(l.timestamp),e[62]=l.timestamp,e[63]=q):q=e[63];let B;e[64]!==q?(B=(0,a.jsx)("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:q}),e[64]=q,e[65]=B):B=e[65];let E;e[66]!==$||e[67]!==B?(E=(0,a.jsxs)("div",{className:"text-end",children:[$,B]}),e[66]=$,e[67]=B,e[68]=E):E=e[68],e[69]!==D||e[70]!==E?(N=(0,a.jsx)(O,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[D,E]})}),e[69]=D,e[70]=E,e[71]=N):N=e[71];let L;e[72]!==t?(L=t("Liveness"),e[72]=t,e[73]=L):L=e[73];let R;e[74]!==W||e[75]!==u||e[76]!==L?(R=(0,a.jsx)(ie,{label:L,level:W,testId:"dh-liveness",value:u}),e[74]=W,e[75]=u,e[76]=L,e[77]=R):R=e[77];let U;e[78]!==t?(U=t("Readiness"),e[78]=t,e[79]=U):U=e[79];let A;e[80]!==_||e[81]!==t?(A=t(_?"Ready":"Not ready"),e[80]=_,e[81]=t,e[82]=A):A=e[82];let F;e[83]!==G||e[84]!==U||e[85]!==A?(F=(0,a.jsx)(ie,{label:U,level:G,testId:"dh-readiness",value:A}),e[83]=G,e[84]=U,e[85]=A,e[86]=F):F=e[86],e[87]!==R||e[88]!==F?(v=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2","data-testid":"dh-probes",children:[R,F]}),e[87]=R,e[88]=F,e[89]=v):v=e[89],j=O,S="gap-0 py-0",V="dh-checks";let K;e[90]!==t?(K=t("Subsystem checks"),e[90]=t,e[91]=K):K=e[91],e[92]!==K?(b=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:K})}),e[92]=K,e[93]=b):b=e[93],P=s.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"dh-checks-empty",children:t("No checks reported.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:s.map(g=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs","data-testid":`dh-check-${g.name}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:Y("size-1.5 shrink-0 rounded-full",g.status==="up"?"bg-success":"bg-destructive")}),(0,a.jsx)("span",{className:"font-mono text-foreground",children:g.name}),g.critical&&(0,a.jsx)(Z,{variant:"outline",children:t("Critical")})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[g.message!==void 0&&(0,a.jsx)("span",{className:"text-muted-foreground",children:g.message}),(0,a.jsx)(Z,{"data-testid":`dh-check-status-${g.name}`,variant:g.status==="up"?"secondary":"destructive",children:g.status==="up"?t("Up"):t("Down")})]})]},g.name))}),e[27]=l.appName,e[28]=l.appVersion,e[29]=l.checks,e[30]=l.timestamp,e[31]=W,e[32]=G,e[33]=_,e[34]=u,e[35]=t,e[36]=j,e[37]=H,e[38]=I,e[39]=x,e[40]=N,e[41]=v,e[42]=S,e[43]=V,e[44]=b,e[45]=P}else j=e[36],H=e[37],I=e[38],x=e[39],N=e[40],v=e[41],S=e[42],V=e[43],b=e[44],P=e[45];let z;e[94]!==j||e[95]!==S||e[96]!==V||e[97]!==b||e[98]!==P?(z=(0,a.jsxs)(j,{className:S,"data-testid":V,children:[b,P]}),e[94]=j,e[95]=S,e[96]=V,e[97]=b,e[98]=P,e[99]=z):z=e[99];let M;return e[100]!==H||e[101]!==I||e[102]!==x||e[103]!==N||e[104]!==v||e[105]!==z?(M=(0,a.jsxs)("div",{className:H,"data-testid":I,children:[x,N,v,z]}),e[100]=H,e[101]=I,e[102]=x,e[103]=N,e[104]=v,e[105]=z,e[106]=M):M=e[106],M},"_e");function xe(r,e){return r.name.localeCompare(e.name)}k(xe,"he");export{Ie as DeploymentHealthPanel};
1
+ import{a as ee}from"./chunk-2MZLFQR5.js";import{a as ne}from"./chunk-FWOOA2ZR.js";import{b as Z}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as O}from"./chunk-OSHODLMU.js";import{i as se,n as X}from"./chunk-ODLNNVP2.js";import"./chunk-ZPQBVYNN.js";import{B as re,w as le,x as Y}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as ce}from"./chunk-GWNGVKLG.js";import{b as me}from"./chunk-6G3E4PJ2.js";import{a as k,d as ae}from"./chunk-5PEAXTYQ.js";var te=ae(ce(),1);var a=ae(me(),1);var pe="/_lunora/health",he="/_lunora/health/ready",ue=k((r,e)=>(r.endsWith("/")?r.slice(0,-1):r)+e,"me"),fe=k(()=>{let r=X();return async e=>{let w=e==="ready"?he:pe,t=r.getAuthToken(),y=ue(r.url,w);try{let i=await fetch(y,{headers:t===null?{}:{authorization:`Bearer ${t}`}}),p=null;try{p=await i.json()}catch{p=null}return{body:p,ok:i.ok,status:i.status}}catch(i){return{body:null,error:i instanceof Error?i.message:String(i),ok:!1,status:0}}}},"pe"),ge={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},ye=k(r=>r==="unhealthy"?"crit":r==="degraded"?"warn":"ok","fe"),ie=k(r=>{let e=(0,te.c)(13),{label:w,level:t,testId:y,value:i}=r,p=ge[t],d;e[0]!==p?(d=Y("size-1.5 shrink-0 rounded-full",p),e[0]=p,e[1]=d):d=e[1];let o;e[2]!==d?(o=(0,a.jsx)("span",{"aria-hidden":"true",className:d}),e[2]=d,e[3]=o):o=e[3];let c;e[4]!==w||e[5]!==o?(c=(0,a.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[o,w]}),e[4]=w,e[5]=o,e[6]=c):c=e[6];let h;e[7]!==y||e[8]!==i?(h=(0,a.jsx)("span",{className:"text-lg font-semibold text-foreground","data-testid":y,children:i}),e[7]=y,e[8]=i,e[9]=h):h=e[9];let C;return e[10]!==c||e[11]!==h?(C=(0,a.jsx)(O,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[c,h]})}),e[10]=c,e[11]=h,e[12]=C):C=e[12],C},"Z"),Ie=k(r=>{let e=(0,te.c)(107),{probe:w}=r,t=re(),y=X(),i=fe(),p=w??i,d;e[0]!==p?(d=k(async()=>{let[s,n]=await Promise.all([p("live"),p("ready")]);return{live:s,ready:n}},"o"),e[0]=p,e[1]=d):d=e[1];let o;e[2]!==y?(o=y.clientIdentifier(),e[2]=y,e[3]=o):o=e[3];let c;e[4]!==o?(c=["deployment-health",o],e[4]=o,e[5]=c):c=e[5];let h;e[6]!==d||e[7]!==c?(h={queryFn:d,queryKey:c},e[6]=d,e[7]=c,e[8]=h):h=e[8];let{data:C,isPending:de}=se(h),Q=C?.live??null,oe=C?.ready??null;if(de){let s;return e[9]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"deployment-health-loading",children:[(0,a.jsx)(ee,{className:"h-16 w-full"}),(0,a.jsx)(ee,{className:"h-40 w-full"})]}),e[9]=s):s=e[9],s}let l=Q?.body??null;if(l===null){let s=Q?.status===403,n;e[10]!==s||e[11]!==Q?.error||e[12]!==t?(n=s?t("The health endpoint is in the admin posture. Paste a valid admin token in the connect popover, or set its auth to public."):t("Couldn't reach the health endpoint: {message}",{message:Q?.error??t("no response")}),e[10]=s,e[11]=Q?.error,e[12]=t,e[13]=n):n=e[13];let m;e[14]!==t?(m=t("Health endpoint unavailable"),e[14]=t,e[15]=m):m=e[15];let f;return e[16]!==n||e[17]!==m?(f=(0,a.jsx)(ne,{description:n,testId:"deployment-health-error",title:m}),e[16]=n,e[17]=m,e[18]=f):f=e[18],f}let J;e[19]!==l.status?(J=ye(l.status),e[19]=l.status,e[20]=J):J=e[20];let W=J,u;if(l.status==="unhealthy"){let s;e[21]!==t?(s=t("Unhealthy"),e[21]=t,e[22]=s):s=e[22],u=s}else if(l.status==="degraded"){let s;e[23]!==t?(s=t("Degraded"),e[23]=t,e[24]=s):s=e[24],u=s}else{let s;e[25]!==t?(s=t("Healthy"),e[25]=t,e[26]=s):s=e[26],u=s}let _=oe?.ok??!1,G=_?"ok":"crit",j,H,I,x,N,v,S,V,b,P;if(e[27]!==l.appName||e[28]!==l.appVersion||e[29]!==l.checks||e[30]!==l.timestamp||e[31]!==W||e[32]!==G||e[33]!==_||e[34]!==u||e[35]!==t){let s=[...l.checks].toSorted(xe);H="flex flex-col gap-6",I="deployment-health";let n;e[46]!==t?(n=t("Live liveness, readiness, and per-binding health from the deployment's /_lunora/health endpoint \u2014 wire an uptime monitor or a Cloudflare Health Check at it."),e[46]=t,e[47]=n):n=e[47],e[48]!==n?(x=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:n}),e[48]=n,e[49]=x):x=e[49];let m;e[50]!==u?(m=(0,a.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"dh-status",children:u}),e[50]=u,e[51]=m):m=e[51];let f;e[52]!==l.appName||e[53]!==l.appVersion?(f=(0,a.jsxs)("span",{className:"font-mono text-[13px] text-muted-foreground","data-testid":"dh-app",children:[l.appName," \xB7 ",l.appVersion]}),e[52]=l.appName,e[53]=l.appVersion,e[54]=f):f=e[54];let D;e[55]!==m||e[56]!==f?(D=(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsxs)("div",{className:"grid leading-tight",children:[m,f]})}),e[55]=m,e[56]=f,e[57]=D):D=e[57];let T;e[58]!==t?(T=t("Checked"),e[58]=t,e[59]=T):T=e[59];let $;e[60]!==T?($=(0,a.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:T}),e[60]=T,e[61]=$):$=e[61];let q;e[62]!==l.timestamp?(q=le(l.timestamp),e[62]=l.timestamp,e[63]=q):q=e[63];let B;e[64]!==q?(B=(0,a.jsx)("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:q}),e[64]=q,e[65]=B):B=e[65];let E;e[66]!==$||e[67]!==B?(E=(0,a.jsxs)("div",{className:"text-end",children:[$,B]}),e[66]=$,e[67]=B,e[68]=E):E=e[68],e[69]!==D||e[70]!==E?(N=(0,a.jsx)(O,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[D,E]})}),e[69]=D,e[70]=E,e[71]=N):N=e[71];let L;e[72]!==t?(L=t("Liveness"),e[72]=t,e[73]=L):L=e[73];let R;e[74]!==W||e[75]!==u||e[76]!==L?(R=(0,a.jsx)(ie,{label:L,level:W,testId:"dh-liveness",value:u}),e[74]=W,e[75]=u,e[76]=L,e[77]=R):R=e[77];let U;e[78]!==t?(U=t("Readiness"),e[78]=t,e[79]=U):U=e[79];let A;e[80]!==_||e[81]!==t?(A=t(_?"Ready":"Not ready"),e[80]=_,e[81]=t,e[82]=A):A=e[82];let F;e[83]!==G||e[84]!==U||e[85]!==A?(F=(0,a.jsx)(ie,{label:U,level:G,testId:"dh-readiness",value:A}),e[83]=G,e[84]=U,e[85]=A,e[86]=F):F=e[86],e[87]!==R||e[88]!==F?(v=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2","data-testid":"dh-probes",children:[R,F]}),e[87]=R,e[88]=F,e[89]=v):v=e[89],j=O,S="gap-0 py-0",V="dh-checks";let K;e[90]!==t?(K=t("Subsystem checks"),e[90]=t,e[91]=K):K=e[91],e[92]!==K?(b=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:K})}),e[92]=K,e[93]=b):b=e[93],P=s.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"dh-checks-empty",children:t("No checks reported.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:s.map(g=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs","data-testid":`dh-check-${g.name}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:Y("size-1.5 shrink-0 rounded-full",g.status==="up"?"bg-success":"bg-destructive")}),(0,a.jsx)("span",{className:"font-mono text-foreground",children:g.name}),g.critical&&(0,a.jsx)(Z,{variant:"outline",children:t("Critical")})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[g.message!==void 0&&(0,a.jsx)("span",{className:"text-muted-foreground",children:g.message}),(0,a.jsx)(Z,{"data-testid":`dh-check-status-${g.name}`,variant:g.status==="up"?"secondary":"destructive",children:g.status==="up"?t("Up"):t("Down")})]})]},g.name))}),e[27]=l.appName,e[28]=l.appVersion,e[29]=l.checks,e[30]=l.timestamp,e[31]=W,e[32]=G,e[33]=_,e[34]=u,e[35]=t,e[36]=j,e[37]=H,e[38]=I,e[39]=x,e[40]=N,e[41]=v,e[42]=S,e[43]=V,e[44]=b,e[45]=P}else j=e[36],H=e[37],I=e[38],x=e[39],N=e[40],v=e[41],S=e[42],V=e[43],b=e[44],P=e[45];let z;e[94]!==j||e[95]!==S||e[96]!==V||e[97]!==b||e[98]!==P?(z=(0,a.jsxs)(j,{className:S,"data-testid":V,children:[b,P]}),e[94]=j,e[95]=S,e[96]=V,e[97]=b,e[98]=P,e[99]=z):z=e[99];let M;return e[100]!==H||e[101]!==I||e[102]!==x||e[103]!==N||e[104]!==v||e[105]!==z?(M=(0,a.jsxs)("div",{className:H,"data-testid":I,children:[x,N,v,z]}),e[100]=H,e[101]=I,e[102]=x,e[103]=N,e[104]=v,e[105]=z,e[106]=M):M=e[106],M},"_e");function xe(r,e){return r.name.localeCompare(e.name)}k(xe,"he");export{Ie as DeploymentHealthPanel};
@@ -1 +1 @@
1
- import{B as P}from"./chunk-HYNCYK4O.js";import{a as w}from"./chunk-GWNGVKLG.js";import{b as z}from"./chunk-6G3E4PJ2.js";import{a as x,d as k}from"./chunk-5PEAXTYQ.js";var $=k(w(),1);var n=k(z(),1);var S=[25,50,100,250],j=x(b=>{let e=(0,$.c)(18),{onChange:p,options:m,prefix:o,value:f}=b,t=P(),u;e[0]!==p?(u=x(v=>{p(Number.parseInt(v.target.value,10))},"c"),e[0]=p,e[1]=u):u=e[1];let a=u,g=`${o}-page-size`,i;e[2]!==t?(i=t("Rows per page"),e[2]=t,e[3]=i):i=e[3];let s;e[4]!==i?(s=(0,n.jsx)("span",{children:i}),e[4]=i,e[5]=s):s=e[5];let c=`${o}-page-size`,l=`${o}-page-size`,r;e[6]!==m?(r=m.map(T),e[6]=m,e[7]=r):r=e[7];let d;e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r||e[12]!==f?(d=(0,n.jsx)("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":c,id:l,onChange:a,value:f,children:r}),e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=f,e[13]=d):d=e[13];let h;return e[14]!==g||e[15]!==s||e[16]!==d?(h=(0,n.jsxs)("label",{className:"flex items-center gap-1.5",htmlFor:g,children:[s,d]}),e[14]=g,e[15]=s,e[16]=d,e[17]=h):h=e[17],h},"C"),E=x(b=>{let e=(0,$.c)(25),{onJump:p,page:m,pages:o,prefix:f}=b,t=P(),u;e[0]!==p||e[1]!==o?(u=x(y=>{let C=Number.parseInt(y,10);Number.isNaN(C)||p(Math.min(Math.max(1,C),Math.max(1,o)))},"c"),e[0]=p,e[1]=o,e[2]=u):u=e[2];let a=u,g;e[3]!==a?(g=x(y=>{y.key==="Enter"&&a(y.currentTarget.value)},"b"),e[3]=a,e[4]=g):g=e[4];let i=g,s;e[5]!==a?(s=x(y=>{a(y.currentTarget.value)},"o"),e[5]=a,e[6]=s):s=e[6];let c=s,l;e[7]!==t?(l=t("Page"),e[7]=t,e[8]=l):l=e[8];let r;e[9]!==t?(r=t("Page"),e[9]=t,e[10]=r):r=e[10];let d=`${f}-page-jump`,h=Math.max(1,o),v;e[11]!==c||e[12]!==i||e[13]!==m||e[14]!==r||e[15]!==d||e[16]!==h?(v=(0,n.jsx)("input",{"aria-label":r,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":d,defaultValue:m,max:h,min:1,onBlur:c,onKeyDown:i,type:"number"},m),e[11]=c,e[12]=i,e[13]=m,e[14]=r,e[15]=d,e[16]=h,e[17]=v):v=e[17];let N;e[18]!==o||e[19]!==t?(N=t("of {pages}",{pages:o}),e[18]=o,e[19]=t,e[20]=N):N=e[20];let M;return e[21]!==l||e[22]!==v||e[23]!==N?(M=(0,n.jsxs)("span",{className:"flex items-center gap-1.5 tabular-nums",children:[l,v,N]}),e[21]=l,e[22]=v,e[23]=N,e[24]=M):M=e[24],M},"j"),I=x(({hasNext:b,hasPrevious:e,onJumpToPage:p,onNext:m,onPageSizeChange:o,onPrevious:f,pageSize:t,pageSizeOptions:u=S,prefix:a,rangeEnd:g,rangeStart:i,total:s})=>{let c=P(),l="rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",r=t!==void 0&&t>0?Math.max(1,Math.ceil(s/t)):1,d=t!==void 0&&t>0?Math.floor(Math.max(0,i-1)/t)+1:1;return(0,n.jsxs)("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[t!==void 0&&o!==void 0&&(0,n.jsx)(j,{onChange:o,options:u,prefix:a,value:t}),(0,n.jsx)("span",{className:"tabular-nums","data-testid":`${a}-page-info`,children:c("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:g,rangeStart:i,total:s})})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("button",{className:l,"data-testid":`${a}-prev`,disabled:!e,onClick:f,type:"button",children:c("Previous")}),t!==void 0&&p!==void 0&&(0,n.jsx)(E,{onJump:p,page:d,pages:r,prefix:a}),(0,n.jsx)("button",{className:l,"data-testid":`${a}-next`,disabled:!b,onClick:m,type:"button",children:c("Next")})]})]})},"_");function T(b){return(0,n.jsx)("option",{value:b,children:b},b)}x(T,"E");export{I as a};
1
+ import{B as P}from"./chunk-PUK3H4RN.js";import{a as w}from"./chunk-GWNGVKLG.js";import{b as z}from"./chunk-6G3E4PJ2.js";import{a as x,d as k}from"./chunk-5PEAXTYQ.js";var $=k(w(),1);var n=k(z(),1);var S=[25,50,100,250],j=x(b=>{let e=(0,$.c)(18),{onChange:p,options:m,prefix:o,value:f}=b,t=P(),u;e[0]!==p?(u=x(v=>{p(Number.parseInt(v.target.value,10))},"c"),e[0]=p,e[1]=u):u=e[1];let a=u,g=`${o}-page-size`,i;e[2]!==t?(i=t("Rows per page"),e[2]=t,e[3]=i):i=e[3];let s;e[4]!==i?(s=(0,n.jsx)("span",{children:i}),e[4]=i,e[5]=s):s=e[5];let c=`${o}-page-size`,l=`${o}-page-size`,r;e[6]!==m?(r=m.map(T),e[6]=m,e[7]=r):r=e[7];let d;e[8]!==a||e[9]!==c||e[10]!==l||e[11]!==r||e[12]!==f?(d=(0,n.jsx)("select",{className:"h-6 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":c,id:l,onChange:a,value:f,children:r}),e[8]=a,e[9]=c,e[10]=l,e[11]=r,e[12]=f,e[13]=d):d=e[13];let h;return e[14]!==g||e[15]!==s||e[16]!==d?(h=(0,n.jsxs)("label",{className:"flex items-center gap-1.5",htmlFor:g,children:[s,d]}),e[14]=g,e[15]=s,e[16]=d,e[17]=h):h=e[17],h},"C"),E=x(b=>{let e=(0,$.c)(25),{onJump:p,page:m,pages:o,prefix:f}=b,t=P(),u;e[0]!==p||e[1]!==o?(u=x(y=>{let C=Number.parseInt(y,10);Number.isNaN(C)||p(Math.min(Math.max(1,C),Math.max(1,o)))},"c"),e[0]=p,e[1]=o,e[2]=u):u=e[2];let a=u,g;e[3]!==a?(g=x(y=>{y.key==="Enter"&&a(y.currentTarget.value)},"b"),e[3]=a,e[4]=g):g=e[4];let i=g,s;e[5]!==a?(s=x(y=>{a(y.currentTarget.value)},"o"),e[5]=a,e[6]=s):s=e[6];let c=s,l;e[7]!==t?(l=t("Page"),e[7]=t,e[8]=l):l=e[8];let r;e[9]!==t?(r=t("Page"),e[9]=t,e[10]=r):r=e[10];let d=`${f}-page-jump`,h=Math.max(1,o),v;e[11]!==c||e[12]!==i||e[13]!==m||e[14]!==r||e[15]!==d||e[16]!==h?(v=(0,n.jsx)("input",{"aria-label":r,className:"h-6 w-12 rounded-md border border-border bg-background px-1 text-center tabular-nums outline-none focus-visible:border-ring","data-testid":d,defaultValue:m,max:h,min:1,onBlur:c,onKeyDown:i,type:"number"},m),e[11]=c,e[12]=i,e[13]=m,e[14]=r,e[15]=d,e[16]=h,e[17]=v):v=e[17];let N;e[18]!==o||e[19]!==t?(N=t("of {pages}",{pages:o}),e[18]=o,e[19]=t,e[20]=N):N=e[20];let M;return e[21]!==l||e[22]!==v||e[23]!==N?(M=(0,n.jsxs)("span",{className:"flex items-center gap-1.5 tabular-nums",children:[l,v,N]}),e[21]=l,e[22]=v,e[23]=N,e[24]=M):M=e[24],M},"j"),I=x(({hasNext:b,hasPrevious:e,onJumpToPage:p,onNext:m,onPageSizeChange:o,onPrevious:f,pageSize:t,pageSizeOptions:u=S,prefix:a,rangeEnd:g,rangeStart:i,total:s})=>{let c=P(),l="rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50",r=t!==void 0&&t>0?Math.max(1,Math.ceil(s/t)):1,d=t!==void 0&&t>0?Math.floor(Math.max(0,i-1)/t)+1:1;return(0,n.jsxs)("div",{className:"flex w-full items-center justify-between gap-3 text-xs text-muted-foreground",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[t!==void 0&&o!==void 0&&(0,n.jsx)(j,{onChange:o,options:u,prefix:a,value:t}),(0,n.jsx)("span",{className:"tabular-nums","data-testid":`${a}-page-info`,children:c("{rangeStart}-{rangeEnd} of {total}",{rangeEnd:g,rangeStart:i,total:s})})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("button",{className:l,"data-testid":`${a}-prev`,disabled:!e,onClick:f,type:"button",children:c("Previous")}),t!==void 0&&p!==void 0&&(0,n.jsx)(E,{onJump:p,page:d,pages:r,prefix:a}),(0,n.jsx)("button",{className:l,"data-testid":`${a}-next`,disabled:!b,onClick:m,type:"button",children:c("Next")})]})]})},"_");function T(b){return(0,n.jsx)("option",{value:b,children:b},b)}x(T,"E");export{I as a};
@@ -0,0 +1 @@
1
+ import{b as Ke}from"./chunk-R6NJ4ER6.js";import{a as Ie,b as De,c as Oe}from"./chunk-GXTSE66Z.js";import{a as Ee}from"./chunk-6YBEKVUG.js";import"./chunk-ZSWW2UGP.js";import{i as we}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as ke}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{b as _e}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as je}from"./chunk-N7EIHD3H.js";import"./chunk-F5WJCL3F.js";import{a as Se,b as Te,c as Ce,d as ie,e as M,f as W}from"./chunk-VXZAS5VS.js";import"./chunk-FGZ73BFG.js";import"./chunk-RUQTILJN.js";import"./chunk-4PI2OSSP.js";import{a as ve}from"./chunk-6A6AELDJ.js";import{c as ye}from"./chunk-TUFOWHEF.js";import{a as le,e as oe}from"./chunk-OSHODLMU.js";import{n as Ae}from"./chunk-ODLNNVP2.js";import"./chunk-ZPQBVYNN.js";import{B as xe,j as pe,s as he,w as fe}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as ze}from"./chunk-GWNGVKLG.js";import{a as Ue,b as Pe}from"./chunk-6G3E4PJ2.js";import{a as b,d as Ne}from"./chunk-5PEAXTYQ.js";var ce=Ne(ze(),1);var I=Ne(Ue(),1);var a=Ne(Pe(),1);var Le=["disabled","schema","schema_and_log","schema_and_log_and_data"],$e={describeTables:"schema",readAdvisors:"schema",readLogs:"schema_and_log",readPolicies:"schema",runSql:"schema_and_log_and_data"},Be=864e5,qe=b(()=>{let t=(0,ce.c)(67),e=Ae(),r=xe(),n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=[],t[0]=n):n=t[0];let g;t[1]!==e?(g={owner:e,tokens:n},t[1]=e,t[2]=g):g=t[2];let[h,N]=(0,I.useState)(g),x=h.owner===e?h.tokens:[],[c,m]=(0,I.useState)(null),[p,o]=(0,I.useState)(null);p!==null&&p.owner!==e&&o(null);let d=p?.owner===e?p.token:null,[l,i]=(0,I.useState)(""),[s,u]=(0,I.useState)(""),[_,k]=(0,I.useState)(null),D=_===e,v=(0,I.useRef)(0),w=(0,I.useRef)(e),O,j;t[3]!==e?(O=b(()=>{w.current=e},"D"),j=[e],t[3]=e,t[4]=O,t[5]=j):(O=t[4],j=t[5]),(0,I.useEffect)(O,j);let K;t[6]!==e?(K=b(async()=>{if(w.current!==e)return;v.current=v.current+1;let f=v.current;try{let E=await e.listAdminTokens();f===v.current&&(N({owner:e,tokens:E}),m(null))}catch(E){let de=E;f===v.current&&m(pe(de))}},"L"),t[6]=e,t[7]=K):K=t[7];let y=K,L,R;t[8]!==y?(L=b(()=>{he(y())},"O"),R=[y],t[8]=y,t[9]=L,t[10]=R):(L=t[9],R=t[10]),(0,I.useEffect)(L,R);let U;t[11]!==e||t[12]!==d||t[13]!==D||t[14]!==s||t[15]!==l||t[16]!==y?(U=b(f=>{if(f.preventDefault(),D||d!==null)return;k(e);let E=e,de=s===""?void 0:Date.now()+Number(s)*Be;he((async()=>{try{let se=await E.createAdminToken({expiresAt:de,name:l.trim()});w.current===E&&(o({owner:E,token:se}),i(""),u(""),await y())}catch(se){m(pe(se))}k(se=>se===E?null:se)})())},"K"),t[11]=e,t[12]=d,t[13]=D,t[14]=s,t[15]=l,t[16]=y,t[17]=U):U=t[17];let B=U,H=b(f=>{he((async()=>{try{await e.revokeAdminToken(f),o(E=>E?.token.name===f?null:E),await y()}catch(E){let de=E;await y(),w.current===e&&m(pe(de))}})())},"q"),q=le,G="py-0",J="set-admin-tokens",S;t[18]!==r?(S=r("Admin tokens"),t[18]=r,t[19]=S):S=t[19];let T;t[20]!==S?(T=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S})}),t[20]=S,t[21]=T):T=t[21];let F=oe,Q="flex flex-col gap-3 py-3",C;t[22]!==r?(C=r("Named tokens use the admin API but cannot manage tokens or open admin WebSockets. A revoked token is refused within 30 seconds."),t[22]=r,t[23]=C):C=t[23];let z;t[24]!==C?(z=(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:C}),t[24]=C,t[25]=z):z=t[25];let V;t[26]!==c?(V=c!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"set-admin-tokens-error",role:"alert",children:c}),t[26]=c,t[27]=V):V=t[27];let P;t[28]!==d||t[29]!==r?(P=d!==null&&(0,a.jsxs)("div",{className:"rounded-md border border-border p-3 text-xs","data-testid":"set-admin-token-created",role:"status",children:[(0,a.jsx)("p",{className:"pb-1 text-muted-foreground",children:r("Copy this token now. It is not shown again.")}),(0,a.jsx)("code",{className:"font-mono break-all select-all",children:d.token}),(0,a.jsx)("div",{className:"pt-2",children:(0,a.jsx)(ke,{"data-testid":"set-admin-token-dismiss",onClick:b(()=>{o(null)},"onClick"),size:"xs",variant:"outline",children:r("Dismiss")})})]}),t[28]=d,t[29]=r,t[30]=P):P=t[30];let A;t[31]!==r?(A=r("Token name"),t[31]=r,t[32]=A):A=t[32];let $;t[33]===Symbol.for("react.memo_cache_sentinel")?($=b(f=>{i(f.target.value)},"B"),t[33]=$):$=t[33];let X;t[34]!==l||t[35]!==A?(X=(0,a.jsx)(we,{"aria-label":A,className:"w-48","data-testid":"set-admin-token-name",onChange:$,pattern:"[a-z0-9][a-z0-9_\\-]{0,63}",placeholder:"ci-deploy",required:!0,value:l}),t[34]=l,t[35]=A,t[36]=X):X=t[36];let Y;t[37]!==r?(Y=r("Expires in days (optional)"),t[37]=r,t[38]=Y):Y=t[38];let me;t[39]===Symbol.for("react.memo_cache_sentinel")?(me=b(f=>{u(f.target.value)},"de"),t[39]=me):me=t[39];let Z;t[40]!==r?(Z=r("Expires in days (optional)"),t[40]=r,t[41]=Z):Z=t[41];let ee;t[42]!==s||t[43]!==Y||t[44]!==Z?(ee=(0,a.jsx)(we,{"aria-label":Y,className:"w-40",min:1,onChange:me,placeholder:Z,type:"number",value:s}),t[42]=s,t[43]=Y,t[44]=Z,t[45]=ee):ee=t[45];let be=D||d!==null,te;t[46]!==r?(te=r("Create token"),t[46]=r,t[47]=te):te=t[47];let ae;t[48]!==be||t[49]!==te?(ae=(0,a.jsx)(ke,{"data-testid":"set-admin-token-create",disabled:be,size:"sm",type:"submit",children:te}),t[48]=be,t[49]=te,t[50]=ae):ae=t[50];let ne;t[51]!==B||t[52]!==X||t[53]!==ee||t[54]!==ae?(ne=(0,a.jsxs)("form",{className:"flex flex-wrap items-end gap-2",onSubmit:B,children:[X,ee,ae]}),t[51]=B,t[52]=X,t[53]=ee,t[54]=ae,t[55]=ne):ne=t[55];let ge=x.length>0&&(0,a.jsxs)(Se,{"data-testid":"set-admin-tokens-table",children:[(0,a.jsx)(Te,{children:(0,a.jsxs)(ie,{children:[(0,a.jsx)(M,{children:r("name")}),(0,a.jsx)(M,{children:r("Created")}),(0,a.jsx)(M,{children:r("Last used")}),(0,a.jsx)(M,{children:r("Expires")}),(0,a.jsx)(M,{})]})}),(0,a.jsx)(Ce,{children:x.map(f=>(0,a.jsxs)(ie,{"data-testid":"set-admin-token-row",children:[(0,a.jsxs)(W,{className:"font-mono text-xs",children:[f.name,f.revoked===!0&&(0,a.jsx)("span",{className:"pl-2 text-destructive",children:r("Revoked")})]}),(0,a.jsx)(W,{className:"text-xs",children:fe(f.createdAt)}),(0,a.jsx)(W,{className:"text-xs",children:fe(f.lastUsedAt,"\u2014")}),(0,a.jsx)(W,{className:"text-xs",children:fe(f.expiresAt,r("Never"))}),(0,a.jsx)(W,{children:(0,a.jsx)(Ee,{onConfirm:b(()=>{H(f.name)},"onConfirm"),testId:`set-admin-token-revoke-${f.name}`,children:r("Revoke")})})]},f.name))})]}),re;t[56]!==F||t[57]!==z||t[58]!==V||t[59]!==P||t[60]!==ne||t[61]!==ge?(re=(0,a.jsxs)(F,{className:Q,children:[z,V,P,ne,ge]}),t[56]=F,t[57]=z,t[58]=V,t[59]=P,t[60]=ne,t[61]=ge,t[62]=re):re=t[62];let ue;return t[63]!==q||t[64]!==T||t[65]!==re?(ue=(0,a.jsxs)(q,{className:G,"data-testid":J,children:[T,re]}),t[63]=q,t[64]=T,t[65]=re,t[66]=ue):ue=t[66],ue},"Fe"),Fe={binding:"outline",secret:"destructive",var:"secondary"},Ve=b((t,e)=>{if(t===void 0)return[];let r=[];return t.workerUrl!==void 0&&r.push({label:e("URL"),value:t.workerUrl}),t.environment!==void 0&&r.push({label:e("Environment"),value:t.environment}),t.deploymentId!==void 0&&r.push({label:e("Deployment"),value:t.deploymentId}),t.versionTag!==void 0&&r.push({label:e("Version"),value:t.versionTag}),r},"Pe"),Me={disabled:"The assistant is off. Nothing about this deployment is sent to a model.",schema:"Table and column names.",schema_and_log:"Table and column names, plus recent log lines.",schema_and_log_and_data:"Table and column names, log lines, and rows read with SELECT."},We=b(t=>{let e=[];for(let[r,n]of Object.entries($e))n===t&&e.push(r);return e},"qe"),He=b(()=>{let t=(0,ce.c)(29),e=xe(),r,n;t[0]===Symbol.for("react.memo_cache_sentinel")?(r={},n={shardKey:""},t[0]=r,t[1]=n):(r=t[0],n=t[1]);let{data:g}=ye(ve.aiAvailable,r,n),h=g?.level,N;t[2]!==h?(N=h===void 0?-1:Le.indexOf(h),t[2]=h,t[3]=N):N=t[3];let x=N,c;t[4]!==e?(c=e("AI assistant data sharing"),t[4]=e,t[5]=c):c=t[5];let m;t[6]!==c?(m=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c}),t[6]=c,t[7]=m):m=t[7];let p;t[8]!==h?(p=h!==void 0&&(0,a.jsx)(_e,{"data-testid":"set-ai-level",variant:h==="disabled"?"outline":"secondary",children:h}),t[8]=h,t[9]=p):p=t[9];let o;t[10]!==m||t[11]!==p?(o=(0,a.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[m,p]}),t[10]=m,t[11]=p,t[12]=o):o=t[12];let d;t[13]!==x||t[14]!==h||t[15]!==e?(d=Le.map((k,D)=>{let v=x>=D,w=We(k);return(0,a.jsxs)("li",{className:v?"flex flex-col gap-0.5":"flex flex-col gap-0.5 opacity-50","data-granted":String(v),"data-testid":`set-ai-tier-${k}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:k}),k===h&&(0,a.jsx)("span",{className:"text-[11px] text-primary",children:e("current")})]}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:e(Me[k])}),w.length>0&&(0,a.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:w.join(", ")})]},k)}),t[13]=x,t[14]=h,t[15]=e,t[16]=d):d=t[16];let l;t[17]!==d?(l=(0,a.jsx)("ul",{className:"flex flex-col gap-1.5 text-sm",children:d}),t[17]=d,t[18]=l):l=t[18];let i;t[19]!==e?(i=e("Set LUNORA_AI_OPT_IN in wrangler.jsonc and redeploy to change this. The Studio can read this level but never raise it."),t[19]=e,t[20]=i):i=t[20];let s;t[21]!==i?(s=(0,a.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"set-ai-howto",children:i}),t[21]=i,t[22]=s):s=t[22];let u;t[23]!==s||t[24]!==l?(u=(0,a.jsxs)(oe,{className:"flex flex-col gap-3 py-3",children:[l,s]}),t[23]=s,t[24]=l,t[25]=u):u=t[25];let _;return t[26]!==u||t[27]!==o?(_=(0,a.jsxs)(le,{className:"py-0","data-testid":"set-ai-sharing",children:[o,u]}),t[26]=u,t[27]=o,t[28]=_):_=t[28],_},"ze"),Re=b(t=>{let e=(0,ce.c)(18),{modifier:r,name:n,label:g}=t,h=Ie(),N;e[0]!==n?(N=b(u=>{if(!["Escape","Tab"].includes(u.key)){if(u.shiftKey){u.preventDefault();return}u.preventDefault(),De(n,u.key)}},"N"),e[0]=n,e[1]=N):N=e[1];let x=N,c=`set-shortcut-${n}`,m;e[2]!==g?(m=(0,a.jsx)("dt",{className:"text-muted-foreground",children:g}),e[2]=g,e[3]=m):m=e[3];let p;e[4]!==r?(p=(0,a.jsx)("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:r}),e[4]=r,e[5]=p):p=e[5];let o=`set-shortcut-input-${n}`,d=h[n],l;e[6]!==g||e[7]!==x||e[8]!==o||e[9]!==d?(l=(0,a.jsx)("input",{"aria-label":g,className:"h-7 w-12 rounded-md border border-border bg-background text-center font-mono text-xs uppercase outline-none focus-visible:border-ring","data-testid":o,onKeyDown:x,readOnly:!0,value:d}),e[6]=g,e[7]=x,e[8]=o,e[9]=d,e[10]=l):l=e[10];let i;e[11]!==p||e[12]!==l?(i=(0,a.jsxs)("dd",{className:"flex items-center gap-1.5",children:[p,l]}),e[11]=p,e[12]=l,e[13]=i):i=e[13];let s;return e[14]!==c||e[15]!==m||e[16]!==i?(s=(0,a.jsxs)("div",{className:"contents","data-testid":c,children:[m,i]}),e[14]=c,e[15]=m,e[16]=i,e[17]=s):s=e[17],s},"we"),ct=b(t=>{let e=(0,ce.c)(87),{initialShardKey:r}=t,n=xe(),g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={},e[0]=g):g=e[0];let h=r??"",N;e[1]!==h?(N={shardKey:h},e[1]=h,e[2]=N):N=e[2];let{data:x,error:c,errorSource:m,isLoading:p}=ye(ve.getSettings,g,N),o,d,l,i,s,u,_;if(e[3]!==c||e[4]!==m||e[5]!==x?.deploy||e[6]!==x?.settings||e[7]!==n){let V=Ve(x?.deploy,n),P;e[15]!==x?.settings?(P=x?.settings??[],e[15]=x?.settings,e[16]=P):P=e[16],o=P,d="flex flex-col gap-4",l="lunora-settings";let A;e[17]!==n?(A=n("Open in Cloudflare"),e[17]=n,e[18]=A):A=e[18],e[19]!==A?(i=(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,a.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:Ke,rel:"noreferrer",target:"_blank",children:A})}),e[19]=A,e[20]=i):i=e[20];let $;e[21]!==n?($=n("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=n,e[22]=$):$=e[22],e[23]!==$?(s=(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:$}),e[23]=$,e[24]=s):s=e[24],e[25]!==c||e[26]!==m?(u=c!==null&&(0,a.jsx)(je,{error:m,testId:"set-error"}),e[25]=c,e[26]=m,e[27]=u):u=e[27],_=V.length>0&&(0,a.jsxs)(le,{className:"py-0","data-testid":"set-deploy",children:[(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Deployment")})}),(0,a.jsx)(oe,{className:"py-3",children:(0,a.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:V.map(Ge)})})]}),e[3]=c,e[4]=m,e[5]=x?.deploy,e[6]=x?.settings,e[7]=n,e[8]=o,e[9]=d,e[10]=l,e[11]=i,e[12]=s,e[13]=u,e[14]=_}else o=e[8],d=e[9],l=e[10],i=e[11],s=e[12],u=e[13],_=e[14];let k,D;e[28]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsx)(He,{}),D=(0,a.jsx)(qe,{}),e[28]=k,e[29]=D):(k=e[28],D=e[29]);let v;e[30]!==n?(v=n("Keyboard shortcuts"),e[30]=n,e[31]=v):v=e[31];let w;e[32]!==v?(w=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[32]=v,e[33]=w):w=e[33];let O;e[34]!==n?(O=n("Reset"),e[34]=n,e[35]=O):O=e[35];let j;e[36]!==O?(j=(0,a.jsx)("button",{className:"rounded px-1 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:text-foreground","data-testid":"set-shortcut-reset",onClick:Oe,type:"button",children:O}),e[36]=O,e[37]=j):j=e[37];let K;e[38]!==w||e[39]!==j?(K=(0,a.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[w,j]}),e[38]=w,e[39]=j,e[40]=K):K=e[40];let y;e[41]!==n?(y=n("Command palette"),e[41]=n,e[42]=y):y=e[42];let L;e[43]!==y?(L=(0,a.jsx)(Re,{label:y,modifier:"\u2318/Ctrl",name:"palette"}),e[43]=y,e[44]=L):L=e[44];let R;e[45]!==n?(R=n("Operation console"),e[45]=n,e[46]=R):R=e[46];let U;e[47]!==R?(U=(0,a.jsx)(Re,{label:R,modifier:"Ctrl",name:"console"}),e[47]=R,e[48]=U):U=e[48];let B;e[49]!==L||e[50]!==U?(B=(0,a.jsxs)("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[L,U]}),e[49]=L,e[50]=U,e[51]=B):B=e[51];let H;e[52]!==n?(H=n("Stored in this browser. Focus a box and press a key to rebind it."),e[52]=n,e[53]=H):H=e[53];let q;e[54]!==H?(q=(0,a.jsx)("p",{className:"pt-3 text-xs text-muted-foreground",children:H}),e[54]=H,e[55]=q):q=e[55];let G;e[56]!==B||e[57]!==q?(G=(0,a.jsxs)(oe,{className:"py-3",children:[B,q]}),e[56]=B,e[57]=q,e[58]=G):G=e[58];let J;e[59]!==K||e[60]!==G?(J=(0,a.jsxs)(le,{className:"py-0","data-testid":"set-preferences",children:[K,G]}),e[59]=K,e[60]=G,e[61]=J):J=e[61];let S;e[62]!==n?(S=n("Environment & bindings"),e[62]=n,e[63]=S):S=e[63];let T;e[64]!==S?(T=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S})}),e[64]=S,e[65]=T):T=e[65];let F;e[66]!==c||e[67]!==p||e[68]!==o.length||e[69]!==n?(F=c===null&&!p&&o.length===0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:n("No environment variables or bindings.")}),e[66]=c,e[67]=p,e[68]=o.length,e[69]=n,e[70]=F):F=e[70];let Q;e[71]!==o||e[72]!==n?(Q=o.length>0&&(0,a.jsx)(oe,{className:"px-0 py-0",children:(0,a.jsxs)(Se,{"data-testid":"set-table",children:[(0,a.jsx)(Te,{children:(0,a.jsxs)(ie,{children:[(0,a.jsx)(M,{children:n("name")}),(0,a.jsx)(M,{children:n("kind")}),(0,a.jsx)(M,{children:n("value")})]})}),(0,a.jsx)(Ce,{children:o.map(Je)})]})}),e[71]=o,e[72]=n,e[73]=Q):Q=e[73];let C;e[74]!==T||e[75]!==F||e[76]!==Q?(C=(0,a.jsxs)(le,{className:"py-0",children:[T,F,Q]}),e[74]=T,e[75]=F,e[76]=Q,e[77]=C):C=e[77];let z;return e[78]!==J||e[79]!==C||e[80]!==d||e[81]!==l||e[82]!==i||e[83]!==s||e[84]!==u||e[85]!==_?(z=(0,a.jsxs)("div",{className:d,"data-testid":l,children:[i,s,u,_,k,D,J,C]}),e[78]=J,e[79]=C,e[80]=d,e[81]=l,e[82]=i,e[83]=s,e[84]=u,e[85]=_,e[86]=z):z=e[86],z},"ft");function Ge(t){return(0,a.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,a.jsx)("dt",{className:"text-muted-foreground",children:t.label}),(0,a.jsx)("dd",{className:"truncate font-mono text-xs",title:t.value,children:t.value})]},t.label)}b(Ge,"He");function Je(t){return(0,a.jsxs)(ie,{"data-testid":"set-row",children:[(0,a.jsx)(W,{className:"font-mono text-xs font-medium",children:t.name}),(0,a.jsx)(W,{children:(0,a.jsx)(_e,{variant:Fe[t.kind],children:t.bindingType??t.kind})}),(0,a.jsx)(W,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:t.value??(0,a.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},t.name)}b(Je,"We");export{ct as SettingsPanel};
@@ -1 +1 @@
1
- import{a as re}from"./chunk-7K3VSMEZ.js";import{a as X}from"./chunk-J45HAKBU.js";import{a as V}from"./chunk-IVISXJR4.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-OFMI2ROE.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as W}from"./chunk-PZMCBA23.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as Q}from"./chunk-YK66QDSW.js";import{b as G}from"./chunk-DH6BG54K.js";import"./chunk-YUVGMKHG.js";import{a as Y}from"./chunk-T6CRFQVI.js";import"./chunk-KXFU34K6.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-TOWZ7WYZ.js";import"./chunk-PRPZCRYY.js";import"./chunk-DM3YNFK3.js";import"./chunk-4PI2OSSP.js";import{a as R}from"./chunk-6A6AELDJ.js";import{c as O}from"./chunk-F6JSRYQT.js";import{a as H,e as J}from"./chunk-MYSRHHC4.js";import"./chunk-A4AUTJPE.js";import"./chunk-ZPQBVYNN.js";import{B as U,w as z,x as L}from"./chunk-HYNCYK4O.js";import"./chunk-PDBW6GTJ.js";import{a as me}from"./chunk-GWNGVKLG.js";import{a as de,b as he}from"./chunk-6G3E4PJ2.js";import{a as l,d as B}from"./chunk-5PEAXTYQ.js";var se=B(me(),1),le=B(de(),1);var t=B(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},ae=l(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"q"),fe=l(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=l(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:l((r,e)=>e.calls-r.calls,"calls"),recent:l((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:l((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},De=l(r=>{let e=(0,se.c)(49),{functions:_,initialShardKey:ne}=r,s=U(),{queryShardKey:i,setShardKey:v,shardKey:S}=X(ne),[c,oe]=(0,le.useState)("recent"),C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C={},e[0]=C):C=e[0];let $;e[1]!==i?($={live:!0,shardKey:i},e[1]=i,e[2]=$):$=e[2];let{data:ie,error:d,errorSource:b,liveError:k}=O(R.getFunctionStats,C,$),M=ie?.functions??null,F;e[3]!==_?(F=new Map((_??[]).map(ge)),e[3]=_,e[4]=F):F=e[4];let T=F,I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=l(w=>{oe(w.currentTarget.dataset.sort)},"E"),e[5]=I):I=e[5];let ce=I,K;if(e[6]!==d||e[7]!==b||e[8]!==T||e[9]!==k||e[10]!==i||e[11]!==v||e[12]!==S||e[13]!==c||e[14]!==M||e[15]!==s){let w=M===null?[]:M.toSorted(xe[c]),m;e[17]!==s?(m=s("Recent"),e[17]=s,e[18]=m):m=e[18];let h;e[19]!==m?(h={key:"recent",label:m},e[19]=m,e[20]=h):h=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let f;e[23]!==u?(f={key:"calls",label:u},e[23]=u,e[24]=f):f=e[24];let p;e[25]!==s?(p=s("Slowest"),e[25]=s,e[26]=p):p=e[26];let x;e[27]!==p?(x={key:"slowest",label:p},e[27]=p,e[28]=x):x=e[28];let A;e[29]!==x||e[30]!==h||e[31]!==f?(A=[h,f,x],e[29]=x,e[30]=h,e[31]=f,e[32]=A):A=e[32];let j=A,g;e[33]!==v||e[34]!==S?(g=(0,t.jsx)(V,{onChange:v,testId:"fs-shard-input",value:S}),e[33]=v,e[34]=S,e[35]=g):g=e[35];let y;e[36]!==k?(y=(0,t.jsx)(re,{message:k,prefix:"fs"}),e[36]=k,e[37]=y):y=e[37];let N;e[38]!==j||e[39]!==c?(N=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:j.map(a=>(0,t.jsx)(W,{"data-sort":a.key,"data-testid":`fs-sort-${a.key}`,onClick:ce,size:"sm",type:"button",variant:c===a.key?"secondary":"ghost",children:a.label},a.key))}),e[38]=j,e[39]=c,e[40]=N):N=e[40];let D;e[41]!==g||e[42]!==y||e[43]!==N?(D=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g,y,N]}),e[41]=g,e[42]=y,e[43]=N,e[44]=D):D=e[44];let E;e[45]!==d||e[46]!==b||e[47]!==i?(E=d!==null&&(0,t.jsx)(Y,{error:b,shardKey:i,testId:"fs-error"}),e[45]=d,e[46]=b,e[47]=i,e[48]=E):E=e[48],K=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,M!==null&&w.length===0&&d===null&&(0,t.jsx)(Q,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxs)("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:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),w.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(J,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(n,{children:s("function")}),(0,t.jsx)(n,{children:s("kind")}),(0,t.jsx)(n,{className:"text-right",children:s("calls")}),(0,t.jsx)(n,{className:"text-right",children:s("errors")}),(0,t.jsx)(n,{className:"text-right",children:s("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:s("avg")}),(0,t.jsx)(n,{className:"text-right",children:s("max")}),(0,t.jsx)(n,{children:s("last run")}),(0,t.jsx)(n,{children:s("last error")})]})}),(0,t.jsx)(te,{children:w.map(a=>{let q=T.get(a.path);return(0,t.jsxs)(P,{"data-testid":`fs-row-${a.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:a.path}),(0,t.jsx)(o,{children:q===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(G,{variant:ue[q],children:q})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls}),(0,t.jsx)(o,{className:L("text-right tabular-nums",a.errors>0&&"text-destructive"),children:fe(a)}),(0,t.jsx)(o,{className:L("text-right tabular-nums",(a.conflicts??0)>0&&"text-warning"),children:pe(a)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.totalDurationMs/a.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:z(a.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:a.lastErrorMessage??void 0,children:a.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.path)})})]})})})]}),e[6]=d,e[7]=b,e[8]=T,e[9]=k,e[10]=i,e[11]=v,e[12]=S,e[13]=c,e[14]=M,e[15]=s,e[16]=K}else K=e[16];return K},"Ae");function ge(r){return[r.path,r.kind]}l(ge,"fe");export{De as FunctionStatsPanel};
1
+ import{a as re}from"./chunk-7SNL633X.js";import{a as X}from"./chunk-J45HAKBU.js";import{a as V}from"./chunk-645S7KRU.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as W}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as Q}from"./chunk-FWOOA2ZR.js";import{b as G}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as Y}from"./chunk-N7EIHD3H.js";import"./chunk-F5WJCL3F.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-VXZAS5VS.js";import"./chunk-FGZ73BFG.js";import"./chunk-RUQTILJN.js";import"./chunk-4PI2OSSP.js";import{a as R}from"./chunk-6A6AELDJ.js";import{c as O}from"./chunk-TUFOWHEF.js";import{a as H,e as J}from"./chunk-OSHODLMU.js";import"./chunk-ODLNNVP2.js";import"./chunk-ZPQBVYNN.js";import{B as U,w as z,x as L}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as me}from"./chunk-GWNGVKLG.js";import{a as de,b as he}from"./chunk-6G3E4PJ2.js";import{a as l,d as B}from"./chunk-5PEAXTYQ.js";var se=B(me(),1),le=B(de(),1);var t=B(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},ae=l(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"q"),fe=l(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=l(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:l((r,e)=>e.calls-r.calls,"calls"),recent:l((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:l((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},De=l(r=>{let e=(0,se.c)(49),{functions:_,initialShardKey:ne}=r,s=U(),{queryShardKey:i,setShardKey:v,shardKey:S}=X(ne),[c,oe]=(0,le.useState)("recent"),C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C={},e[0]=C):C=e[0];let $;e[1]!==i?($={live:!0,shardKey:i},e[1]=i,e[2]=$):$=e[2];let{data:ie,error:d,errorSource:b,liveError:k}=O(R.getFunctionStats,C,$),M=ie?.functions??null,F;e[3]!==_?(F=new Map((_??[]).map(ge)),e[3]=_,e[4]=F):F=e[4];let T=F,I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=l(w=>{oe(w.currentTarget.dataset.sort)},"E"),e[5]=I):I=e[5];let ce=I,K;if(e[6]!==d||e[7]!==b||e[8]!==T||e[9]!==k||e[10]!==i||e[11]!==v||e[12]!==S||e[13]!==c||e[14]!==M||e[15]!==s){let w=M===null?[]:M.toSorted(xe[c]),m;e[17]!==s?(m=s("Recent"),e[17]=s,e[18]=m):m=e[18];let h;e[19]!==m?(h={key:"recent",label:m},e[19]=m,e[20]=h):h=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let f;e[23]!==u?(f={key:"calls",label:u},e[23]=u,e[24]=f):f=e[24];let p;e[25]!==s?(p=s("Slowest"),e[25]=s,e[26]=p):p=e[26];let x;e[27]!==p?(x={key:"slowest",label:p},e[27]=p,e[28]=x):x=e[28];let A;e[29]!==x||e[30]!==h||e[31]!==f?(A=[h,f,x],e[29]=x,e[30]=h,e[31]=f,e[32]=A):A=e[32];let j=A,g;e[33]!==v||e[34]!==S?(g=(0,t.jsx)(V,{onChange:v,testId:"fs-shard-input",value:S}),e[33]=v,e[34]=S,e[35]=g):g=e[35];let y;e[36]!==k?(y=(0,t.jsx)(re,{message:k,prefix:"fs"}),e[36]=k,e[37]=y):y=e[37];let N;e[38]!==j||e[39]!==c?(N=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:j.map(a=>(0,t.jsx)(W,{"data-sort":a.key,"data-testid":`fs-sort-${a.key}`,onClick:ce,size:"sm",type:"button",variant:c===a.key?"secondary":"ghost",children:a.label},a.key))}),e[38]=j,e[39]=c,e[40]=N):N=e[40];let D;e[41]!==g||e[42]!==y||e[43]!==N?(D=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g,y,N]}),e[41]=g,e[42]=y,e[43]=N,e[44]=D):D=e[44];let E;e[45]!==d||e[46]!==b||e[47]!==i?(E=d!==null&&(0,t.jsx)(Y,{error:b,shardKey:i,testId:"fs-error"}),e[45]=d,e[46]=b,e[47]=i,e[48]=E):E=e[48],K=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,M!==null&&w.length===0&&d===null&&(0,t.jsx)(Q,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxs)("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:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),w.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(J,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(n,{children:s("function")}),(0,t.jsx)(n,{children:s("kind")}),(0,t.jsx)(n,{className:"text-right",children:s("calls")}),(0,t.jsx)(n,{className:"text-right",children:s("errors")}),(0,t.jsx)(n,{className:"text-right",children:s("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:s("avg")}),(0,t.jsx)(n,{className:"text-right",children:s("max")}),(0,t.jsx)(n,{children:s("last run")}),(0,t.jsx)(n,{children:s("last error")})]})}),(0,t.jsx)(te,{children:w.map(a=>{let q=T.get(a.path);return(0,t.jsxs)(P,{"data-testid":`fs-row-${a.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:a.path}),(0,t.jsx)(o,{children:q===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(G,{variant:ue[q],children:q})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls}),(0,t.jsx)(o,{className:L("text-right tabular-nums",a.errors>0&&"text-destructive"),children:fe(a)}),(0,t.jsx)(o,{className:L("text-right tabular-nums",(a.conflicts??0)>0&&"text-warning"),children:pe(a)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.totalDurationMs/a.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:z(a.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:a.lastErrorMessage??void 0,children:a.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.path)})})]})})})]}),e[6]=d,e[7]=b,e[8]=T,e[9]=k,e[10]=i,e[11]=v,e[12]=S,e[13]=c,e[14]=M,e[15]=s,e[16]=K}else K=e[16];return K},"Ae");function ge(r){return[r.path,r.kind]}l(ge,"fe");export{De as FunctionStatsPanel};
@@ -1 +1 @@
1
- import{c as u}from"./chunk-JMZT3CEW.js";import{j as c}from"./chunk-YUVGMKHG.js";import{a as l}from"./chunk-ZPQBVYNN.js";import{x as d}from"./chunk-HYNCYK4O.js";import{a as h,b as z}from"./chunk-6G3E4PJ2.js";import{a as t,d as o}from"./chunk-5PEAXTYQ.js";var p=o(h(),1);var a=p.forwardRef(t(function(e,r){let{render:n,className:k,disabled:s=!1,focusableWhenDisabled:g=!1,nativeButton:f=!0,style:B,...b}=e,{getButtonProps:m,buttonRef:x}=u({disabled:s,focusableWhenDisabled:g,native:f});return c("button",e,{state:{disabled:s},ref:[r,x],props:[b,m]})},"Button"));var v=o(z(),1);var y=l("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",xs:"h-6 gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-md px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",icon:"size-8","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-md","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function W({className:i,variant:e="default",size:r="default",...n}){return(0,v.jsx)(a,{"data-slot":"button",className:d(y({variant:e,size:r,className:i})),...n})}t(W,"v");export{W as a};
1
+ import{c as u}from"./chunk-JMZT3CEW.js";import{j as c}from"./chunk-YUVGMKHG.js";import{a as l}from"./chunk-ZPQBVYNN.js";import{x as d}from"./chunk-PUK3H4RN.js";import{a as h,b as z}from"./chunk-6G3E4PJ2.js";import{a as t,d as o}from"./chunk-5PEAXTYQ.js";var p=o(h(),1);var a=p.forwardRef(t(function(e,r){let{render:n,className:k,disabled:s=!1,focusableWhenDisabled:g=!1,nativeButton:f=!0,style:B,...b}=e,{getButtonProps:m,buttonRef:x}=u({disabled:s,focusableWhenDisabled:g,native:f});return c("button",e,{state:{disabled:s},ref:[r,x],props:[b,m]})},"Button"));var v=o(z(),1);var y=l("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",xs:"h-6 gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-md px-2.5 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pe-2 has-data-[icon=inline-start]:ps-2",icon:"size-8","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-md","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function W({className:i,variant:e="default",size:r="default",...n}){return(0,v.jsx)(a,{"data-slot":"button",className:d(y({variant:e,size:r,className:i})),...n})}t(W,"v");export{W as a};
@@ -1 +1 @@
1
- import{a as _}from"./chunk-YK66QDSW.js";import{b as j}from"./chunk-DH6BG54K.js";import"./chunk-YUVGMKHG.js";import{a as J}from"./chunk-T6CRFQVI.js";import"./chunk-KXFU34K6.js";import{a as E,b as G,c as L,d as I,e as c,f as p}from"./chunk-TOWZ7WYZ.js";import"./chunk-PRPZCRYY.js";import{b as q}from"./chunk-DM3YNFK3.js";import"./chunk-4PI2OSSP.js";import{a as O}from"./chunk-6A6AELDJ.js";import{c as H}from"./chunk-F6JSRYQT.js";import{a as D,e as W}from"./chunk-MYSRHHC4.js";import"./chunk-A4AUTJPE.js";import"./chunk-ZPQBVYNN.js";import{B as z}from"./chunk-HYNCYK4O.js";import"./chunk-PDBW6GTJ.js";import{a as Q}from"./chunk-GWNGVKLG.js";import{b as V}from"./chunk-6G3E4PJ2.js";import{a as d,d as F}from"./chunk-5PEAXTYQ.js";var K=F(Q(),1);var r=F(V(),1);var U=["read","insert","update","delete"],M=30,X=d((e,t)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[t],"z"),Y=d(e=>{let t=new Map;for(let s of e){let a=t.get(s.table)??{operations:new Set,procedures:new Set,table:s.table};a.operations.add(s.on),a.procedures.add(s.procedure),t.set(s.table,a)}return[...t.values()].toSorted((s,a)=>s.table.localeCompare(a.table))},"J"),Z=d(e=>{let t=e.slice(0,M).map(s=>`${s.table}: ${U.filter(a=>s.operations.has(a)).join("/")}`).join("; ");return e.length>M?`${t}; and ${String(e.length-M)} more tables`:t},"K"),pe=d(()=>{let e=(0,K.c)(45),t=z(),s=q(),a=s!==void 0&&!s.unavailable,k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k={},e[0]=k):k=e[0];let{data:l,error:C,errorSource:P}=H(O.rlsPolicies,k),o=l!==void 0,m;e[1]!==l?(m=Array.isArray(l?.policies)?l.policies:[],e[1]=l,e[2]=m):m=e[2];let S;e[3]!==m?(S=Y(m),e[3]=m,e[4]=S):S=e[4];let i=S,R;e[5]!==l?(R=Array.isArray(l?.roles)?l.roles:[],e[5]=l,e[6]=R):R=e[6];let T=R,h;e[7]!==C||e[8]!==P?(h=C!==null&&(0,r.jsx)(J,{error:P,testId:"rls-error"}),e[7]=C,e[8]=P,e[9]=h):h=e[9];let u;e[10]!==t?(u=t("Policies"),e[10]=t,e[11]=u):u=e[11];let f;e[12]!==u?(f=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:u}),e[12]=u,e[13]=f):f=e[13];let b;e[14]!==s||e[15]!==a||e[16]!==o||e[17]!==t||e[18]!==i?(b=o&&a&&(0,r.jsx)("button",{className:"ms-auto text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"rls-ask-assistant",onClick:d(()=>{s.openAssistant({ask:i.length===0?t("This app declares no row-level-security policies at all. Which tables most need one, and what policy should I write for them?"):t("The Lunora RLS inspector shows these declared policies \u2014 {coverage}. Which tables and operations are still unguarded, and what policy should I add?",{coverage:Z(i)}),suggestions:[t("Which procedures still need .use(rls(...))?"),t("How do I test a policy?")],title:t("Access rules")})},"onClick"),type:"button",children:t("Ask the assistant")}),e[14]=s,e[15]=a,e[16]=o,e[17]=t,e[18]=i,e[19]=b):b=e[19];let x;e[20]!==f||e[21]!==b?(x=(0,r.jsxs)("header",{className:"flex items-center gap-3 border-b border-border px-4 py-3",children:[f,b]}),e[20]=f,e[21]=b,e[22]=x):x=e[22];let g;e[23]!==o||e[24]!==t||e[25]!==i?(g=o&&i.length===0?(0,r.jsx)(_,{description:t("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:t("No policies defined")}):(0,r.jsx)(W,{className:"px-0",children:(0,r.jsxs)(E,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(G,{children:(0,r.jsxs)(I,{children:[(0,r.jsx)(c,{children:t("Table")}),U.map(n=>(0,r.jsx)(c,{children:X(t,n)},n)),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(L,{children:i.map(n=>(0,r.jsxs)(I,{"data-testid":`rls-table-${n.table}`,children:[(0,r.jsx)(p,{className:"font-mono text-xs",children:n.table}),U.map(B=>(0,r.jsx)(p,{children:n.operations.has(B)?(0,r.jsx)(j,{variant:"secondary",children:t("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},B)),(0,r.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:[...n.procedures].join(", ")})]},n.table))})]})}),e[23]=o,e[24]=t,e[25]=i,e[26]=g):g=e[26];let N;e[27]!==x||e[28]!==g?(N=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[x,g]})}),e[27]=x,e[28]=g,e[29]=N):N=e[29];let y;e[30]!==t?(y=t("Roles"),e[30]=t,e[31]=y):y=e[31];let w;e[32]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[32]=y,e[33]=w):w=e[33];let v;e[34]!==o||e[35]!==T||e[36]!==t?(v=o&&T.length===0?(0,r.jsx)(_,{description:t("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:t("No roles defined")}):(0,r.jsx)(W,{className:"px-0",children:(0,r.jsxs)(E,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(G,{children:(0,r.jsxs)(I,{children:[(0,r.jsx)(c,{children:t("Role")}),(0,r.jsx)(c,{children:t("Description")}),(0,r.jsx)(c,{children:t("Permissions")})]})}),(0,r.jsx)(L,{children:T.map(re)})]})}),e[34]=o,e[35]=T,e[36]=t,e[37]=v):v=e[37];let A;e[38]!==w||e[39]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[w,v]})}),e[38]=w,e[39]=v,e[40]=A):A=e[40];let $;return e[41]!==N||e[42]!==A||e[43]!==h?($=(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-rls-panel",children:[h,N,A]}),e[41]=N,e[42]=A,e[43]=h,e[44]=$):$=e[44],$},"ce");function ee(e){return(0,r.jsx)(j,{variant:"outline",children:e},e)}d(ee,"V");function re(e){return(0,r.jsxs)(I,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(p,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(p,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(p,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(ee)})})]},e.name)}d(re,"Y");export{pe as default};
1
+ import{a as _}from"./chunk-FWOOA2ZR.js";import{b as j}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as J}from"./chunk-N7EIHD3H.js";import"./chunk-F5WJCL3F.js";import{a as E,b as G,c as L,d as I,e as c,f as p}from"./chunk-VXZAS5VS.js";import"./chunk-FGZ73BFG.js";import{b as q}from"./chunk-RUQTILJN.js";import"./chunk-4PI2OSSP.js";import{a as O}from"./chunk-6A6AELDJ.js";import{c as H}from"./chunk-TUFOWHEF.js";import{a as D,e as W}from"./chunk-OSHODLMU.js";import"./chunk-ODLNNVP2.js";import"./chunk-ZPQBVYNN.js";import{B as z}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as Q}from"./chunk-GWNGVKLG.js";import{b as V}from"./chunk-6G3E4PJ2.js";import{a as d,d as F}from"./chunk-5PEAXTYQ.js";var K=F(Q(),1);var r=F(V(),1);var U=["read","insert","update","delete"],M=30,X=d((e,t)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[t],"z"),Y=d(e=>{let t=new Map;for(let s of e){let a=t.get(s.table)??{operations:new Set,procedures:new Set,table:s.table};a.operations.add(s.on),a.procedures.add(s.procedure),t.set(s.table,a)}return[...t.values()].toSorted((s,a)=>s.table.localeCompare(a.table))},"J"),Z=d(e=>{let t=e.slice(0,M).map(s=>`${s.table}: ${U.filter(a=>s.operations.has(a)).join("/")}`).join("; ");return e.length>M?`${t}; and ${String(e.length-M)} more tables`:t},"K"),pe=d(()=>{let e=(0,K.c)(45),t=z(),s=q(),a=s!==void 0&&!s.unavailable,k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k={},e[0]=k):k=e[0];let{data:l,error:C,errorSource:P}=H(O.rlsPolicies,k),o=l!==void 0,m;e[1]!==l?(m=Array.isArray(l?.policies)?l.policies:[],e[1]=l,e[2]=m):m=e[2];let S;e[3]!==m?(S=Y(m),e[3]=m,e[4]=S):S=e[4];let i=S,R;e[5]!==l?(R=Array.isArray(l?.roles)?l.roles:[],e[5]=l,e[6]=R):R=e[6];let T=R,h;e[7]!==C||e[8]!==P?(h=C!==null&&(0,r.jsx)(J,{error:P,testId:"rls-error"}),e[7]=C,e[8]=P,e[9]=h):h=e[9];let u;e[10]!==t?(u=t("Policies"),e[10]=t,e[11]=u):u=e[11];let f;e[12]!==u?(f=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:u}),e[12]=u,e[13]=f):f=e[13];let b;e[14]!==s||e[15]!==a||e[16]!==o||e[17]!==t||e[18]!==i?(b=o&&a&&(0,r.jsx)("button",{className:"ms-auto text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"rls-ask-assistant",onClick:d(()=>{s.openAssistant({ask:i.length===0?t("This app declares no row-level-security policies at all. Which tables most need one, and what policy should I write for them?"):t("The Lunora RLS inspector shows these declared policies \u2014 {coverage}. Which tables and operations are still unguarded, and what policy should I add?",{coverage:Z(i)}),suggestions:[t("Which procedures still need .use(rls(...))?"),t("How do I test a policy?")],title:t("Access rules")})},"onClick"),type:"button",children:t("Ask the assistant")}),e[14]=s,e[15]=a,e[16]=o,e[17]=t,e[18]=i,e[19]=b):b=e[19];let x;e[20]!==f||e[21]!==b?(x=(0,r.jsxs)("header",{className:"flex items-center gap-3 border-b border-border px-4 py-3",children:[f,b]}),e[20]=f,e[21]=b,e[22]=x):x=e[22];let g;e[23]!==o||e[24]!==t||e[25]!==i?(g=o&&i.length===0?(0,r.jsx)(_,{description:t("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:t("No policies defined")}):(0,r.jsx)(W,{className:"px-0",children:(0,r.jsxs)(E,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(G,{children:(0,r.jsxs)(I,{children:[(0,r.jsx)(c,{children:t("Table")}),U.map(n=>(0,r.jsx)(c,{children:X(t,n)},n)),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(L,{children:i.map(n=>(0,r.jsxs)(I,{"data-testid":`rls-table-${n.table}`,children:[(0,r.jsx)(p,{className:"font-mono text-xs",children:n.table}),U.map(B=>(0,r.jsx)(p,{children:n.operations.has(B)?(0,r.jsx)(j,{variant:"secondary",children:t("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},B)),(0,r.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:[...n.procedures].join(", ")})]},n.table))})]})}),e[23]=o,e[24]=t,e[25]=i,e[26]=g):g=e[26];let N;e[27]!==x||e[28]!==g?(N=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[x,g]})}),e[27]=x,e[28]=g,e[29]=N):N=e[29];let y;e[30]!==t?(y=t("Roles"),e[30]=t,e[31]=y):y=e[31];let w;e[32]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[32]=y,e[33]=w):w=e[33];let v;e[34]!==o||e[35]!==T||e[36]!==t?(v=o&&T.length===0?(0,r.jsx)(_,{description:t("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:t("No roles defined")}):(0,r.jsx)(W,{className:"px-0",children:(0,r.jsxs)(E,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(G,{children:(0,r.jsxs)(I,{children:[(0,r.jsx)(c,{children:t("Role")}),(0,r.jsx)(c,{children:t("Description")}),(0,r.jsx)(c,{children:t("Permissions")})]})}),(0,r.jsx)(L,{children:T.map(re)})]})}),e[34]=o,e[35]=T,e[36]=t,e[37]=v):v=e[37];let A;e[38]!==w||e[39]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[w,v]})}),e[38]=w,e[39]=v,e[40]=A):A=e[40];let $;return e[41]!==N||e[42]!==A||e[43]!==h?($=(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-rls-panel",children:[h,N,A]}),e[41]=N,e[42]=A,e[43]=h,e[44]=$):$=e[44],$},"ce");function ee(e){return(0,r.jsx)(j,{variant:"outline",children:e},e)}d(ee,"V");function re(e){return(0,r.jsxs)(I,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(p,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(p,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(p,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(ee)})})]},e.name)}d(re,"Y");export{pe as default};
@@ -1 +1 @@
1
- import{a as ee}from"./chunk-J45HAKBU.js";import{a as Z}from"./chunk-IVISXJR4.js";import{b as Y}from"./chunk-3D67ZJRW.js";import{a as X}from"./chunk-DA2CAFXI.js";import{a as W}from"./chunk-ATN6HPYI.js";import"./chunk-ZSWW2UGP.js";import{i as D}from"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import"./chunk-OFMI2ROE.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{b as ae,c as ne}from"./chunk-4NKJV7YX.js";import{a as q,b as te}from"./chunk-CHIGIVHM.js";import{a as V}from"./chunk-PZMCBA23.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import"./chunk-YUVGMKHG.js";import"./chunk-T6CRFQVI.js";import"./chunk-KXFU34K6.js";import"./chunk-TOWZ7WYZ.js";import"./chunk-PRPZCRYY.js";import"./chunk-DM3YNFK3.js";import"./chunk-4PI2OSSP.js";import{a as I}from"./chunk-6A6AELDJ.js";import{c as A}from"./chunk-F6JSRYQT.js";import"./chunk-MYSRHHC4.js";import{n as Q}from"./chunk-A4AUTJPE.js";import"./chunk-ZPQBVYNN.js";import{B as _,h as M,i as C,o as G,s as N}from"./chunk-HYNCYK4O.js";import"./chunk-PDBW6GTJ.js";import{a as me}from"./chunk-GWNGVKLG.js";import{a as he,b as pe}from"./chunk-6G3E4PJ2.js";import{a as l,d as j}from"./chunk-5PEAXTYQ.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:r}=t;if(typeof r!="string"||r.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(i=>typeof i!="string"||i.length===0)?!1:typeof n=="string"&&n.length>0},"xe"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(r=>JSON.stringify(r)).join(", ")}])`,"ge"),xe=l(t=>{let e=(0,E.c)(19),{fields:r,indexName:a,table:n,testId:i}=t,u=_(),[h,f]=(0,c.useState)(null),m;e[0]!==r||e[1]!==a?(m=l(()=>{let b=be(a,r),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=r,e[1]=a,e[2]=m):m=e[2];let y=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==i?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${i}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:n})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${i}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:n}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=n,e[7]=i,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==n?(p=u("Copy index declaration for {table}",{table:n}),e[11]=u,e[12]=n,e[13]=p):p=e[13];let w;return e[14]!==y||e[15]!==T||e[16]!==p||e[17]!==i?(w=(0,S.jsx)(W,{confirmLabel:T,onConfirm:y,testId:i,children:p}),e[14]=y,e[15]=T,e[16]=p,e[17]=i,e[18]=w):w=e[18],w},"ve"),ye=l((t,e)=>{let r=new Map;for(let a of e){let n=`${a.table} ${a.index}`;r.set(n,(r.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:r.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let r of t)for(let a of r.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([r,a])=>({scans:a,table:r}))},"Te"),re=l((t,e)=>e.map(r=>({index:r.name,table:t})),"P"),we=l(t=>{let e=ye(t.declaredIndexes??[],t.indexHits??[]),r=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,i=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:r,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:i,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(y=>!(y.metadata.kind==="hot_scan"&&typeof y.metadata.table=="string"&&m.has(y.metadata.table)))).map(y=>q(y))},"we"),Se=M(I.listTables),Te=M(I.listTableIndexes),Ie=M(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"H"),se=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),ie=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:se(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:se(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:G(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:r,table:a}=t,n=_(),i;e[0]!==r||e[1]!==a?(i=l(()=>{r(a)},"o"),e[0]=r,e[1]=a,e[2]=i):i=e[2];let u=i,h=`in-add-index-${a}`,f;e[3]!==n||e[4]!==a?(f=n("Add index on {table}",{table:a}),e[3]=n,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(V,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let r=Q(),a=D(),n=_(),{queryShardKey:i,setShardKey:u,shardKey:h}=ee(t),[f,m]=(0,c.useState)(null),[y,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=A(I.getMetrics,{},{live:!0,shardKey:i}),b=A(I.getFunctionStats,{},{live:!0,shardKey:i}),$=A(I.getAdvisories,{},{live:!0,shardKey:i}),L=w.data??null,K=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(s=>r.shardTraffic(s)),le=l(async(s,x)=>{let o=s[0];if(o===void 0||o===""){p.current===x&&T(null);return}try{let g=await oe(o);if(p.current!==x)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===x&&T(null)}},"Y"),de=l(async(s,x)=>{let o=await Promise.allSettled(s.map(async d=>[d,await r.query(Te,{table:d},C(x))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...re(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async s=>{p.current=s;let x=[];try{let o=await r.query(Se,{},C(s));if(p.current!==s)return;Y(s),x=o.map(d=>d.name);let g=[];if(x.length>0)try{let d=await r.query(Ie,{tables:x},C(s));if(p.current!==s)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...re(v,k))}catch{if(g=await de(x,s),p.current!==s)return}m(g)}catch{p.current===s&&m(null)}await le(x,s)});(0,c.useEffect)(()=>{N(z(i))},[i]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(i))});(0,c.useEffect)(()=>{let s=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s)}},[]);let U=(0,c.useCallback)(s=>{N(a({search:{table:s},to:"/schema"}))},[a]),H=(0,c.useMemo)(()=>X(L,K),[K,L]),P=(0,c.useMemo)(()=>new Set(H.filter(s=>s.kind==="missing-index").flatMap(s=>s.tables??[])),[H]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:K,indexHits:J,shardTraffic:y,suppressHotScanTables:P}),[f,K,J,P,y]),ue=(0,c.useMemo)(()=>{let s=H.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?ie(n,o):`${ie(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),x=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(x.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(xe,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...s]},[F,H,U,R,n]),fe=(0,S.jsx)(Z,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(te,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,shardKey:i,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
1
+ import{a as ee}from"./chunk-J45HAKBU.js";import{a as Z}from"./chunk-645S7KRU.js";import{b as Y}from"./chunk-3D67ZJRW.js";import{a as X}from"./chunk-DA2CAFXI.js";import{a as W}from"./chunk-6YBEKVUG.js";import"./chunk-ZSWW2UGP.js";import{i as D}from"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{b as ae,c as ne}from"./chunk-4NKJV7YX.js";import{a as q,b as te}from"./chunk-FK2S7VR4.js";import{a as V}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import"./chunk-YUVGMKHG.js";import"./chunk-N7EIHD3H.js";import"./chunk-F5WJCL3F.js";import"./chunk-VXZAS5VS.js";import"./chunk-FGZ73BFG.js";import"./chunk-RUQTILJN.js";import"./chunk-4PI2OSSP.js";import{a as I}from"./chunk-6A6AELDJ.js";import{c as A}from"./chunk-TUFOWHEF.js";import"./chunk-OSHODLMU.js";import{n as Q}from"./chunk-ODLNNVP2.js";import"./chunk-ZPQBVYNN.js";import{B as _,h as M,i as C,o as G,s as N}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as me}from"./chunk-GWNGVKLG.js";import{a as he,b as pe}from"./chunk-6G3E4PJ2.js";import{a as l,d as j}from"./chunk-5PEAXTYQ.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:r}=t;if(typeof r!="string"||r.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(i=>typeof i!="string"||i.length===0)?!1:typeof n=="string"&&n.length>0},"xe"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(r=>JSON.stringify(r)).join(", ")}])`,"ge"),xe=l(t=>{let e=(0,E.c)(19),{fields:r,indexName:a,table:n,testId:i}=t,u=_(),[h,f]=(0,c.useState)(null),m;e[0]!==r||e[1]!==a?(m=l(()=>{let b=be(a,r),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=r,e[1]=a,e[2]=m):m=e[2];let y=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==i?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${i}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:n})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${i}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:n}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=n,e[7]=i,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==n?(p=u("Copy index declaration for {table}",{table:n}),e[11]=u,e[12]=n,e[13]=p):p=e[13];let w;return e[14]!==y||e[15]!==T||e[16]!==p||e[17]!==i?(w=(0,S.jsx)(W,{confirmLabel:T,onConfirm:y,testId:i,children:p}),e[14]=y,e[15]=T,e[16]=p,e[17]=i,e[18]=w):w=e[18],w},"ve"),ye=l((t,e)=>{let r=new Map;for(let a of e){let n=`${a.table} ${a.index}`;r.set(n,(r.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:r.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let r of t)for(let a of r.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([r,a])=>({scans:a,table:r}))},"Te"),re=l((t,e)=>e.map(r=>({index:r.name,table:t})),"P"),we=l(t=>{let e=ye(t.declaredIndexes??[],t.indexHits??[]),r=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,i=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:r,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:i,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(y=>!(y.metadata.kind==="hot_scan"&&typeof y.metadata.table=="string"&&m.has(y.metadata.table)))).map(y=>q(y))},"we"),Se=M(I.listTables),Te=M(I.listTableIndexes),Ie=M(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"H"),se=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),ie=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:se(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:se(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:G(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:r,table:a}=t,n=_(),i;e[0]!==r||e[1]!==a?(i=l(()=>{r(a)},"o"),e[0]=r,e[1]=a,e[2]=i):i=e[2];let u=i,h=`in-add-index-${a}`,f;e[3]!==n||e[4]!==a?(f=n("Add index on {table}",{table:a}),e[3]=n,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(V,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let r=Q(),a=D(),n=_(),{queryShardKey:i,setShardKey:u,shardKey:h}=ee(t),[f,m]=(0,c.useState)(null),[y,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=A(I.getMetrics,{},{live:!0,shardKey:i}),b=A(I.getFunctionStats,{},{live:!0,shardKey:i}),$=A(I.getAdvisories,{},{live:!0,shardKey:i}),L=w.data??null,K=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(s=>r.shardTraffic(s)),le=l(async(s,x)=>{let o=s[0];if(o===void 0||o===""){p.current===x&&T(null);return}try{let g=await oe(o);if(p.current!==x)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===x&&T(null)}},"Y"),de=l(async(s,x)=>{let o=await Promise.allSettled(s.map(async d=>[d,await r.query(Te,{table:d},C(x))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...re(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async s=>{p.current=s;let x=[];try{let o=await r.query(Se,{},C(s));if(p.current!==s)return;Y(s),x=o.map(d=>d.name);let g=[];if(x.length>0)try{let d=await r.query(Ie,{tables:x},C(s));if(p.current!==s)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...re(v,k))}catch{if(g=await de(x,s),p.current!==s)return}m(g)}catch{p.current===s&&m(null)}await le(x,s)});(0,c.useEffect)(()=>{N(z(i))},[i]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(i))});(0,c.useEffect)(()=>{let s=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s)}},[]);let U=(0,c.useCallback)(s=>{N(a({search:{table:s},to:"/schema"}))},[a]),H=(0,c.useMemo)(()=>X(L,K),[K,L]),P=(0,c.useMemo)(()=>new Set(H.filter(s=>s.kind==="missing-index").flatMap(s=>s.tables??[])),[H]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:K,indexHits:J,shardTraffic:y,suppressHotScanTables:P}),[f,K,J,P,y]),ue=(0,c.useMemo)(()=>{let s=H.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?ie(n,o):`${ie(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),x=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(x.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(xe,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...s]},[F,H,U,R,n]),fe=(0,S.jsx)(Z,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(te,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,shardKey:i,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
@@ -1 +1 @@
1
- import{a as He}from"./chunk-6FPV3EK2.js";import{a as Se}from"./chunk-P3JNXC5P.js";import{a as Ze}from"./chunk-R7363SOB.js";import{a as je}from"./chunk-ATN6HPYI.js";import{i as qe}from"./chunk-OFMI2ROE.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as $e}from"./chunk-PZMCBA23.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{b as Ge}from"./chunk-DH6BG54K.js";import"./chunk-YUVGMKHG.js";import{a as Fe}from"./chunk-6A6AELDJ.js";import{n as Ke}from"./chunk-A4AUTJPE.js";import"./chunk-ZPQBVYNN.js";import{B as Oe,h as Pe,i as me,j as Ce,k as Ue,s as Re}from"./chunk-HYNCYK4O.js";import"./chunk-PDBW6GTJ.js";import{a as at}from"./chunk-GWNGVKLG.js";import{a as ot,b as lt}from"./chunk-6G3E4PJ2.js";import{a as s,d as Me}from"./chunk-5PEAXTYQ.js";var De=Me(at(),1),m=Me(ot(),1);var r=Me(lt(),1);var ze=Pe(Fe.getPitrBookmark),st=Pe(Fe.pitrRestore),nt=/^\d+$/u,Je=s(ie=>{let e=ie.trim(),h=nt.test(e)?Number(e):Date.parse(e),l=new Date(h);return Number.isNaN(l.getTime())?void 0:{epochMs:h,iso:l.toISOString()}},"De"),it=s(ie=>{let e=(0,De.c)(9),{text:h}=ie,l=Oe();if(h.trim()==="")return null;let t,o,p;if(e[0]!==l||e[1]!==h){let y=Je(h);t="font-mono text-xs text-muted-foreground",o="pitr-time-resolved",p=y===void 0?l("Not a time \u2014 use epoch-ms or ISO 8601."):l("Resolves to {instant} (a date-time without an offset is read in this browser's time zone; a bare date is UTC)",{instant:y.iso}),e[0]=l,e[1]=h,e[2]=t,e[3]=o,e[4]=p}else t=e[2],o=e[3],p=e[4];let N;return e[5]!==t||e[6]!==o||e[7]!==p?(N=(0,r.jsx)("p",{className:t,"data-testid":o,children:p}),e[5]=t,e[6]=o,e[7]=p,e[8]=N):N=e[8],N},"lt"),vt=s(ie=>{let e=(0,De.c)(140),{initialShardKey:h}=ie,l=Ke(),t=Oe(),o=h??"",p=He(o),[N,y]=(0,m.useState)(null),[f,Qe]=(0,m.useState)(""),[ce,Ee]=(0,m.useState)(null),[c,We]=(0,m.useState)(""),[b,Xe]=(0,m.useState)(!1),[i,Ye]=(0,m.useState)(null),[ue,w]=(0,m.useState)(null),[de,I]=(0,m.useState)(!1),[C,Ve]=(0,m.useState)(!1),pe;e[0]!==l||e[1]!==o?(pe=s(async a=>{I(!0),w(null);let d;try{d={current:(await l.query(ze,{},me(o))).current,error:null,unavailable:!1}}catch(n){let g=n;d={current:null,error:Ce(g),unavailable:Ue(g)==="PITR_UNAVAILABLE"}}a?.aborted!==!0&&(d.error===null?y(d.current):w(d.error),Ve(d.unavailable),I(!1))},"fe"),e[0]=l,e[1]=o,e[2]=pe):pe=e[2];let x=pe,he,fe;e[3]!==x?(he=s(()=>{let a=new AbortController;return Re(x(a.signal)),()=>{a.abort()}},"ue"),fe=[x],e[3]=x,e[4]=he,e[5]=fe):(he=e[4],fe=e[5]),(0,m.useEffect)(he,fe);let be;e[6]!==l||e[7]!==o?(be=s(async()=>{let a=await l.query(ze,{},me(o));y(a.current)},"he"),e[6]=l,e[7]=o,e[8]=be):be=e[8],Ze(be,!C);let xe;e[9]===Symbol.for("react.memo_cache_sentinel")?(xe=s(a=>{Qe(a.target.value)},"be"),e[9]=xe):xe=e[9];let et=xe,ke;e[10]===Symbol.for("react.memo_cache_sentinel")?(ke=s(a=>{We(a.target.value)},"xe"),e[10]=ke):ke=e[10];let tt=ke,Ne;e[11]===Symbol.for("react.memo_cache_sentinel")?(Ne=s(a=>{Xe(a.target.checked)},"ke"),e[11]=Ne):Ne=e[11];let rt=Ne,ve,R,u,k,v,ge;if(e[12]!==c||e[13]!==l||e[14]!==ce||e[15]!==x||e[16]!==o||e[17]!==p||e[18]!==t||e[19]!==f){u=Je(f),R=s(()=>{if(u===void 0)return;let d=o;Re((async()=>{I(!0),w(null);let n;try{n={result:await l.query(ze,{time:u.epochMs},me(d))}}catch(g){n={error:Ce(g)}}p.current===d&&("result"in n?(Ee(n.result.forTime===void 0?null:{bookmark:n.result.forTime,shard:d}),y(n.result.current)):(Ee(null),w(n.error)),I(!1))})())},"C"),v=ce?.shard===o?ce.bookmark:null;let a;e[26]!==l||e[27]!==x||e[28]!==o?(a=s(d=>{Re((async()=>{I(!0),w(null);try{let n=await l.mutation(st,d,me(o));Ye(n),await x()}catch(n){let g=n;w(Ce(g)),Ue(g)==="PITR_UNAVAILABLE"&&Ve(!0)}I(!1)})())},"o"),e[26]=l,e[27]=x,e[28]=o,e[29]=a):a=e[29],k=a,ve=c.trim()!==""||u!==void 0,ge=t("Restore {shard} to {target}?",{shard:o===""?t("root"):o,target:c.trim()===""?u?.iso??"":t("the given bookmark")}),e[12]=c,e[13]=l,e[14]=ce,e[15]=x,e[16]=o,e[17]=p,e[18]=t,e[19]=f,e[20]=ve,e[21]=R,e[22]=u,e[23]=k,e[24]=v,e[25]=ge}else ve=e[20],R=e[21],u=e[22],k=e[23],v=e[24],ge=e[25];let Te=ge,ye;e[30]!==c||e[31]!==u?.epochMs||e[32]!==b||e[33]!==k?(ye=s(()=>{let a=b?{restart:!0}:{};c.trim()===""?a.time=u?.epochMs:a.bookmark=c.trim(),k(a)},"Ne"),e[30]=c,e[31]=u?.epochMs,e[32]=b,e[33]=k,e[34]=ye):ye=e[34];let Be=ye,we;e[35]!==b||e[36]!==i||e[37]!==k?(we=s(()=>{i!==null&&k(b?{bookmark:i.undoBookmark,restart:!0}:{bookmark:i.undoBookmark})},"ye"),e[35]=b,e[36]=i,e[37]=k,e[38]=we):we=e[38];let Ae=we,S;e[39]!==t?(S=t("Shard"),e[39]=t,e[40]=S):S=e[40];let T;e[41]!==o||e[42]!==t?(T=o===""?t("root"):o,e[41]=o,e[42]=t,e[43]=T):T=e[43];let B;e[44]!==T?(B=(0,r.jsx)("span",{className:"font-mono",children:T}),e[44]=T,e[45]=B):B=e[45];let A;e[46]!==S||e[47]!==B?(A=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[S,": ",B]})}),e[46]=S,e[47]=B,e[48]=A):A=e[48];let _;e[49]!==t?(_=t("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier."),e[49]=t,e[50]=_):_=e[50];let L;e[51]!==_?(L=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:_}),e[51]=_,e[52]=L):L=e[52];let M;e[53]!==ue?(M=ue!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:ue}),e[53]=ue,e[54]=M):M=e[54];let P;e[55]!==t?(P=t("Current bookmark"),e[55]=t,e[56]=P):P=e[56];let U;e[57]!==P?(U=(0,r.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:P}),e[57]=P,e[58]=U):U=e[58];let F;e[59]!==N?(F=N??(0,r.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[59]=N,e[60]=F):F=e[60];let O;e[61]!==F?(O=(0,r.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:F}),e[61]=F,e[62]=O):O=e[62];let j;e[63]!==U||e[64]!==O?(j=(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[U,O]}),e[63]=U,e[64]=O,e[65]=j):j=e[65];let q;e[66]!==t?(q=t("Restore"),e[66]=t,e[67]=q):q=e[67];let z;e[68]!==q?(z=(0,r.jsx)("h3",{className:"text-sm font-semibold",children:q}),e[68]=q,e[69]=z):z=e[69];let D;e[70]!==t?(D=t("Time (ISO or epoch-ms, last 30 days)"),e[70]=t,e[71]=D):D=e[71];let E;e[72]!==D?(E=(0,r.jsx)(Se,{htmlFor:"pitr-time",children:D}),e[72]=D,e[73]=E):E=e[73];let V;e[74]!==f?(V=(0,r.jsx)(qe,{"data-testid":"pitr-time",id:"pitr-time",onChange:et,placeholder:"2026-06-01T00:00:00.000Z",value:f}),e[74]=f,e[75]=V):V=e[75];let _e=de||C||u===void 0,K;e[76]!==t?(K=t("Preview"),e[76]=t,e[77]=K):K=e[77];let Z;e[78]!==R||e[79]!==_e||e[80]!==K?(Z=(0,r.jsx)($e,{"data-testid":"pitr-preview",disabled:_e,onClick:R,size:"sm",type:"button",variant:"outline",children:K}),e[78]=R,e[79]=_e,e[80]=K,e[81]=Z):Z=e[81];let $;e[82]!==V||e[83]!==Z?($=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[V,Z]}),e[82]=V,e[83]=Z,e[84]=$):$=e[84];let G;e[85]!==f?(G=(0,r.jsx)(it,{text:f}),e[85]=f,e[86]=G):G=e[86];let H;e[87]!==v||e[88]!==t?(H=v!==null&&(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[t("Bookmark for that time"),": ",v]}),e[87]=v,e[88]=t,e[89]=H):H=e[89];let J;e[90]!==E||e[91]!==$||e[92]!==G||e[93]!==H?(J=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[E,$,G,H]}),e[90]=E,e[91]=$,e[92]=G,e[93]=H,e[94]=J):J=e[94];let Q;e[95]!==t?(Q=t("Or an explicit bookmark (wins over time)"),e[95]=t,e[96]=Q):Q=e[96];let W;e[97]!==Q?(W=(0,r.jsx)(Se,{htmlFor:"pitr-bookmark",children:Q}),e[97]=Q,e[98]=W):W=e[98];let X;e[99]!==t?(X=t("bookmark string"),e[99]=t,e[100]=X):X=e[100];let Y;e[101]!==c||e[102]!==X?(Y=(0,r.jsx)(qe,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:tt,placeholder:X,value:c}),e[101]=c,e[102]=X,e[103]=Y):Y=e[103];let ee;e[104]!==W||e[105]!==Y?(ee=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[W,Y]}),e[104]=W,e[105]=Y,e[106]=ee):ee=e[106];let te;e[107]!==b?(te=(0,r.jsx)("input",{checked:b,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:rt,type:"checkbox"}),e[107]=b,e[108]=te):te=e[108];let re;e[109]!==t?(re=t("Restart the shard now so recovery applies immediately"),e[109]=t,e[110]=re):re=e[110];let oe;e[111]!==te||e[112]!==re?(oe=(0,r.jsxs)(Se,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[te,re]}),e[111]=te,e[112]=re,e[113]=oe):oe=e[113];let Le=de||C||!ve,ae;e[114]!==t?(ae=t("Restore"),e[114]=t,e[115]=ae):ae=e[115];let le;e[116]!==Te||e[117]!==Be||e[118]!==Le||e[119]!==ae?(le=(0,r.jsx)("div",{children:(0,r.jsx)(je,{confirmLabel:Te,disabled:Le,onConfirm:Be,testId:"pitr-restore",children:ae})}),e[116]=Te,e[117]=Be,e[118]=Le,e[119]=ae,e[120]=le):le=e[120];let se;e[121]!==z||e[122]!==J||e[123]!==ee||e[124]!==oe||e[125]!==le?(se=(0,r.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[z,J,ee,oe,le]}),e[121]=z,e[122]=J,e[123]=ee,e[124]=oe,e[125]=le,e[126]=se):se=e[126];let ne;e[127]!==de||e[128]!==Ae||e[129]!==i||e[130]!==t||e[131]!==C?(ne=i!==null&&(0,r.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold",children:t("Restore armed")}),(0,r.jsx)(Ge,{variant:i.restarted?"destructive":"secondary",children:i.restarted?t("restarted now"):t("on next restart")})]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[t("Restored to"),": ",i.restoredTo]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[t("Undo bookmark"),": ",i.undoBookmark]}),(0,r.jsx)("div",{children:(0,r.jsx)(je,{confirmLabel:t("Confirm undo"),disabled:de||C,onConfirm:Ae,testId:"pitr-undo",children:t("Undo restore")})})]}),e[127]=de,e[128]=Ae,e[129]=i,e[130]=t,e[131]=C,e[132]=ne):ne=e[132];let Ie;return e[133]!==A||e[134]!==L||e[135]!==M||e[136]!==j||e[137]!==se||e[138]!==ne?(Ie=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[A,L,M,j,se,ne]}),e[133]=A,e[134]=L,e[135]=M,e[136]=j,e[137]=se,e[138]=ne,e[139]=Ie):Ie=e[139],Ie},"Nt");export{vt as PitrPanel};
1
+ import{a as He}from"./chunk-6FPV3EK2.js";import{a as Se}from"./chunk-RDS46R5R.js";import{a as Ze}from"./chunk-ACWAMBGT.js";import{a as je}from"./chunk-6YBEKVUG.js";import{i as qe}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as $e}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{b as Ge}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as Fe}from"./chunk-6A6AELDJ.js";import{n as Ke}from"./chunk-ODLNNVP2.js";import"./chunk-ZPQBVYNN.js";import{B as Oe,h as Pe,i as me,j as Ce,k as Ue,s as Re}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as at}from"./chunk-GWNGVKLG.js";import{a as ot,b as lt}from"./chunk-6G3E4PJ2.js";import{a as s,d as Me}from"./chunk-5PEAXTYQ.js";var De=Me(at(),1),m=Me(ot(),1);var r=Me(lt(),1);var ze=Pe(Fe.getPitrBookmark),st=Pe(Fe.pitrRestore),nt=/^\d+$/u,Je=s(ie=>{let e=ie.trim(),h=nt.test(e)?Number(e):Date.parse(e),l=new Date(h);return Number.isNaN(l.getTime())?void 0:{epochMs:h,iso:l.toISOString()}},"De"),it=s(ie=>{let e=(0,De.c)(9),{text:h}=ie,l=Oe();if(h.trim()==="")return null;let t,o,p;if(e[0]!==l||e[1]!==h){let y=Je(h);t="font-mono text-xs text-muted-foreground",o="pitr-time-resolved",p=y===void 0?l("Not a time \u2014 use epoch-ms or ISO 8601."):l("Resolves to {instant} (a date-time without an offset is read in this browser's time zone; a bare date is UTC)",{instant:y.iso}),e[0]=l,e[1]=h,e[2]=t,e[3]=o,e[4]=p}else t=e[2],o=e[3],p=e[4];let N;return e[5]!==t||e[6]!==o||e[7]!==p?(N=(0,r.jsx)("p",{className:t,"data-testid":o,children:p}),e[5]=t,e[6]=o,e[7]=p,e[8]=N):N=e[8],N},"lt"),vt=s(ie=>{let e=(0,De.c)(140),{initialShardKey:h}=ie,l=Ke(),t=Oe(),o=h??"",p=He(o),[N,y]=(0,m.useState)(null),[f,Qe]=(0,m.useState)(""),[ce,Ee]=(0,m.useState)(null),[c,We]=(0,m.useState)(""),[b,Xe]=(0,m.useState)(!1),[i,Ye]=(0,m.useState)(null),[ue,w]=(0,m.useState)(null),[de,I]=(0,m.useState)(!1),[C,Ve]=(0,m.useState)(!1),pe;e[0]!==l||e[1]!==o?(pe=s(async a=>{I(!0),w(null);let d;try{d={current:(await l.query(ze,{},me(o))).current,error:null,unavailable:!1}}catch(n){let g=n;d={current:null,error:Ce(g),unavailable:Ue(g)==="PITR_UNAVAILABLE"}}a?.aborted!==!0&&(d.error===null?y(d.current):w(d.error),Ve(d.unavailable),I(!1))},"fe"),e[0]=l,e[1]=o,e[2]=pe):pe=e[2];let x=pe,he,fe;e[3]!==x?(he=s(()=>{let a=new AbortController;return Re(x(a.signal)),()=>{a.abort()}},"ue"),fe=[x],e[3]=x,e[4]=he,e[5]=fe):(he=e[4],fe=e[5]),(0,m.useEffect)(he,fe);let be;e[6]!==l||e[7]!==o?(be=s(async()=>{let a=await l.query(ze,{},me(o));y(a.current)},"he"),e[6]=l,e[7]=o,e[8]=be):be=e[8],Ze(be,!C);let xe;e[9]===Symbol.for("react.memo_cache_sentinel")?(xe=s(a=>{Qe(a.target.value)},"be"),e[9]=xe):xe=e[9];let et=xe,ke;e[10]===Symbol.for("react.memo_cache_sentinel")?(ke=s(a=>{We(a.target.value)},"xe"),e[10]=ke):ke=e[10];let tt=ke,Ne;e[11]===Symbol.for("react.memo_cache_sentinel")?(Ne=s(a=>{Xe(a.target.checked)},"ke"),e[11]=Ne):Ne=e[11];let rt=Ne,ve,R,u,k,v,ge;if(e[12]!==c||e[13]!==l||e[14]!==ce||e[15]!==x||e[16]!==o||e[17]!==p||e[18]!==t||e[19]!==f){u=Je(f),R=s(()=>{if(u===void 0)return;let d=o;Re((async()=>{I(!0),w(null);let n;try{n={result:await l.query(ze,{time:u.epochMs},me(d))}}catch(g){n={error:Ce(g)}}p.current===d&&("result"in n?(Ee(n.result.forTime===void 0?null:{bookmark:n.result.forTime,shard:d}),y(n.result.current)):(Ee(null),w(n.error)),I(!1))})())},"C"),v=ce?.shard===o?ce.bookmark:null;let a;e[26]!==l||e[27]!==x||e[28]!==o?(a=s(d=>{Re((async()=>{I(!0),w(null);try{let n=await l.mutation(st,d,me(o));Ye(n),await x()}catch(n){let g=n;w(Ce(g)),Ue(g)==="PITR_UNAVAILABLE"&&Ve(!0)}I(!1)})())},"o"),e[26]=l,e[27]=x,e[28]=o,e[29]=a):a=e[29],k=a,ve=c.trim()!==""||u!==void 0,ge=t("Restore {shard} to {target}?",{shard:o===""?t("root"):o,target:c.trim()===""?u?.iso??"":t("the given bookmark")}),e[12]=c,e[13]=l,e[14]=ce,e[15]=x,e[16]=o,e[17]=p,e[18]=t,e[19]=f,e[20]=ve,e[21]=R,e[22]=u,e[23]=k,e[24]=v,e[25]=ge}else ve=e[20],R=e[21],u=e[22],k=e[23],v=e[24],ge=e[25];let Te=ge,ye;e[30]!==c||e[31]!==u?.epochMs||e[32]!==b||e[33]!==k?(ye=s(()=>{let a=b?{restart:!0}:{};c.trim()===""?a.time=u?.epochMs:a.bookmark=c.trim(),k(a)},"Ne"),e[30]=c,e[31]=u?.epochMs,e[32]=b,e[33]=k,e[34]=ye):ye=e[34];let Be=ye,we;e[35]!==b||e[36]!==i||e[37]!==k?(we=s(()=>{i!==null&&k(b?{bookmark:i.undoBookmark,restart:!0}:{bookmark:i.undoBookmark})},"ye"),e[35]=b,e[36]=i,e[37]=k,e[38]=we):we=e[38];let Ae=we,S;e[39]!==t?(S=t("Shard"),e[39]=t,e[40]=S):S=e[40];let T;e[41]!==o||e[42]!==t?(T=o===""?t("root"):o,e[41]=o,e[42]=t,e[43]=T):T=e[43];let B;e[44]!==T?(B=(0,r.jsx)("span",{className:"font-mono",children:T}),e[44]=T,e[45]=B):B=e[45];let A;e[46]!==S||e[47]!==B?(A=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[S,": ",B]})}),e[46]=S,e[47]=B,e[48]=A):A=e[48];let _;e[49]!==t?(_=t("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier."),e[49]=t,e[50]=_):_=e[50];let L;e[51]!==_?(L=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:_}),e[51]=_,e[52]=L):L=e[52];let M;e[53]!==ue?(M=ue!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:ue}),e[53]=ue,e[54]=M):M=e[54];let P;e[55]!==t?(P=t("Current bookmark"),e[55]=t,e[56]=P):P=e[56];let U;e[57]!==P?(U=(0,r.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:P}),e[57]=P,e[58]=U):U=e[58];let F;e[59]!==N?(F=N??(0,r.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[59]=N,e[60]=F):F=e[60];let O;e[61]!==F?(O=(0,r.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:F}),e[61]=F,e[62]=O):O=e[62];let j;e[63]!==U||e[64]!==O?(j=(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[U,O]}),e[63]=U,e[64]=O,e[65]=j):j=e[65];let q;e[66]!==t?(q=t("Restore"),e[66]=t,e[67]=q):q=e[67];let z;e[68]!==q?(z=(0,r.jsx)("h3",{className:"text-sm font-semibold",children:q}),e[68]=q,e[69]=z):z=e[69];let D;e[70]!==t?(D=t("Time (ISO or epoch-ms, last 30 days)"),e[70]=t,e[71]=D):D=e[71];let E;e[72]!==D?(E=(0,r.jsx)(Se,{htmlFor:"pitr-time",children:D}),e[72]=D,e[73]=E):E=e[73];let V;e[74]!==f?(V=(0,r.jsx)(qe,{"data-testid":"pitr-time",id:"pitr-time",onChange:et,placeholder:"2026-06-01T00:00:00.000Z",value:f}),e[74]=f,e[75]=V):V=e[75];let _e=de||C||u===void 0,K;e[76]!==t?(K=t("Preview"),e[76]=t,e[77]=K):K=e[77];let Z;e[78]!==R||e[79]!==_e||e[80]!==K?(Z=(0,r.jsx)($e,{"data-testid":"pitr-preview",disabled:_e,onClick:R,size:"sm",type:"button",variant:"outline",children:K}),e[78]=R,e[79]=_e,e[80]=K,e[81]=Z):Z=e[81];let $;e[82]!==V||e[83]!==Z?($=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[V,Z]}),e[82]=V,e[83]=Z,e[84]=$):$=e[84];let G;e[85]!==f?(G=(0,r.jsx)(it,{text:f}),e[85]=f,e[86]=G):G=e[86];let H;e[87]!==v||e[88]!==t?(H=v!==null&&(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[t("Bookmark for that time"),": ",v]}),e[87]=v,e[88]=t,e[89]=H):H=e[89];let J;e[90]!==E||e[91]!==$||e[92]!==G||e[93]!==H?(J=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[E,$,G,H]}),e[90]=E,e[91]=$,e[92]=G,e[93]=H,e[94]=J):J=e[94];let Q;e[95]!==t?(Q=t("Or an explicit bookmark (wins over time)"),e[95]=t,e[96]=Q):Q=e[96];let W;e[97]!==Q?(W=(0,r.jsx)(Se,{htmlFor:"pitr-bookmark",children:Q}),e[97]=Q,e[98]=W):W=e[98];let X;e[99]!==t?(X=t("bookmark string"),e[99]=t,e[100]=X):X=e[100];let Y;e[101]!==c||e[102]!==X?(Y=(0,r.jsx)(qe,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:tt,placeholder:X,value:c}),e[101]=c,e[102]=X,e[103]=Y):Y=e[103];let ee;e[104]!==W||e[105]!==Y?(ee=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[W,Y]}),e[104]=W,e[105]=Y,e[106]=ee):ee=e[106];let te;e[107]!==b?(te=(0,r.jsx)("input",{checked:b,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:rt,type:"checkbox"}),e[107]=b,e[108]=te):te=e[108];let re;e[109]!==t?(re=t("Restart the shard now so recovery applies immediately"),e[109]=t,e[110]=re):re=e[110];let oe;e[111]!==te||e[112]!==re?(oe=(0,r.jsxs)(Se,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[te,re]}),e[111]=te,e[112]=re,e[113]=oe):oe=e[113];let Le=de||C||!ve,ae;e[114]!==t?(ae=t("Restore"),e[114]=t,e[115]=ae):ae=e[115];let le;e[116]!==Te||e[117]!==Be||e[118]!==Le||e[119]!==ae?(le=(0,r.jsx)("div",{children:(0,r.jsx)(je,{confirmLabel:Te,disabled:Le,onConfirm:Be,testId:"pitr-restore",children:ae})}),e[116]=Te,e[117]=Be,e[118]=Le,e[119]=ae,e[120]=le):le=e[120];let se;e[121]!==z||e[122]!==J||e[123]!==ee||e[124]!==oe||e[125]!==le?(se=(0,r.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[z,J,ee,oe,le]}),e[121]=z,e[122]=J,e[123]=ee,e[124]=oe,e[125]=le,e[126]=se):se=e[126];let ne;e[127]!==de||e[128]!==Ae||e[129]!==i||e[130]!==t||e[131]!==C?(ne=i!==null&&(0,r.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold",children:t("Restore armed")}),(0,r.jsx)(Ge,{variant:i.restarted?"destructive":"secondary",children:i.restarted?t("restarted now"):t("on next restart")})]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[t("Restored to"),": ",i.restoredTo]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[t("Undo bookmark"),": ",i.undoBookmark]}),(0,r.jsx)("div",{children:(0,r.jsx)(je,{confirmLabel:t("Confirm undo"),disabled:de||C,onConfirm:Ae,testId:"pitr-undo",children:t("Undo restore")})})]}),e[127]=de,e[128]=Ae,e[129]=i,e[130]=t,e[131]=C,e[132]=ne):ne=e[132];let Ie;return e[133]!==A||e[134]!==L||e[135]!==M||e[136]!==j||e[137]!==se||e[138]!==ne?(Ie=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[A,L,M,j,se,ne]}),e[133]=A,e[134]=L,e[135]=M,e[136]=j,e[137]=se,e[138]=ne,e[139]=Ie):Ie=e[139],Ie},"Nt");export{vt as PitrPanel};
@@ -1 +1 @@
1
- import{a as O,c as D}from"./chunk-BKI3JMXQ.js";import{a as F}from"./chunk-7K3VSMEZ.js";import{a as j}from"./chunk-J45HAKBU.js";import{a as V}from"./chunk-IVISXJR4.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import{i as K}from"./chunk-OFMI2ROE.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import"./chunk-VUOEJJUH.js";import{a as T}from"./chunk-YK66QDSW.js";import{b as k}from"./chunk-DH6BG54K.js";import"./chunk-YUVGMKHG.js";import{a as z}from"./chunk-T6CRFQVI.js";import"./chunk-KXFU34K6.js";import{a as A,b as q,c as B,d as p,e as d,f as l}from"./chunk-TOWZ7WYZ.js";import"./chunk-PRPZCRYY.js";import"./chunk-DM3YNFK3.js";import"./chunk-4PI2OSSP.js";import{a as I}from"./chunk-6A6AELDJ.js";import{c as L}from"./chunk-F6JSRYQT.js";import{a as M,e as R}from"./chunk-MYSRHHC4.js";import"./chunk-A4AUTJPE.js";import"./chunk-ZPQBVYNN.js";import{B as E,p as b,w as C}from"./chunk-HYNCYK4O.js";import"./chunk-PDBW6GTJ.js";import"./chunk-GWNGVKLG.js";import{a as ee,b as te}from"./chunk-6G3E4PJ2.js";import{a as i,d as y}from"./chunk-5PEAXTYQ.js";var s=y(ee(),1);var e=y(te(),1);var re=i(o=>o===void 0?"":JSON.stringify(o,b),"te"),ae=41,J=480,H=5,ie=i((o,t)=>O(o,n=>{t(n.height>0?n:{height:J,width:n.width})}),"ae"),Ne=i(({initialShardKey:o})=>{let t=E(),{queryShardKey:n,setShardKey:P,shardKey:U}=j(o),[m,W]=(0,s.useState)(""),{data:f,error:g,errorSource:Z,isLoading:_,liveError:G}=L(I.getAuditLog,{},{live:!0,shardKey:n}),c=(0,s.useMemo)(()=>f?.entries??[],[f]),h=(0,s.useMemo)(()=>{let a=m.trim().toLowerCase();return a===""?c:c.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[c,m]),x=(0,s.useRef)(null),v=D({count:h.length,estimateSize:i(()=>ae,"estimateSize"),getScrollElement:i(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),Q=v.getTotalSize(),N=u[0]?.start??0,w=Q-(u.at(-1)?.end??0),X={height:N},Y={height:w},$=i(a=>{W(a.target.value)},"k");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(V,{onChange:P,testId:"au-shard-input",value:U}),(0,e.jsx)(F,{message:G,prefix:"au"}),(0,e.jsx)(K,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:$,placeholder:t("filter op, table, id"),value:m})]}),g!==null&&(0,e.jsx)(z,{error:Z,shardKey:n,testId:"au-error"}),g===null&&!_&&h.length===0&&(0,e.jsx)(T,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),h.length>0&&(0,e.jsx)(M,{className:"overflow-hidden py-0",children:(0,e.jsx)(R,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(A,{"data-testid":"au-table",children:[(0,e.jsx)(q,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(d,{children:t("time")}),(0,e.jsx)(d,{children:t("op")}),(0,e.jsx)(d,{children:t("table")}),(0,e.jsx)(d,{children:t("id")}),(0,e.jsx)(d,{children:t("detail")})]})}),(0,e.jsxs)(B,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})}),u.map(a=>{let r=h[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(l,{className:"text-muted-foreground tabular-nums",children:C(r.ts,"\u2014")}),(0,e.jsx)(l,{children:(0,e.jsx)(k,{variant:"secondary",children:r.op})}),(0,e.jsx)(l,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(l,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(l,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Y})})]})]})})})]})},"we");export{Ne as AuditPanel};
1
+ import{a as O,c as D}from"./chunk-BKI3JMXQ.js";import{a as F}from"./chunk-7SNL633X.js";import{a as j}from"./chunk-J45HAKBU.js";import{a as V}from"./chunk-645S7KRU.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import{i as K}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import"./chunk-VUOEJJUH.js";import{a as T}from"./chunk-FWOOA2ZR.js";import{b as k}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as z}from"./chunk-N7EIHD3H.js";import"./chunk-F5WJCL3F.js";import{a as A,b as q,c as B,d as p,e as d,f as l}from"./chunk-VXZAS5VS.js";import"./chunk-FGZ73BFG.js";import"./chunk-RUQTILJN.js";import"./chunk-4PI2OSSP.js";import{a as I}from"./chunk-6A6AELDJ.js";import{c as L}from"./chunk-TUFOWHEF.js";import{a as M,e as R}from"./chunk-OSHODLMU.js";import"./chunk-ODLNNVP2.js";import"./chunk-ZPQBVYNN.js";import{B as E,p as b,w as C}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import"./chunk-GWNGVKLG.js";import{a as ee,b as te}from"./chunk-6G3E4PJ2.js";import{a as i,d as y}from"./chunk-5PEAXTYQ.js";var s=y(ee(),1);var e=y(te(),1);var re=i(o=>o===void 0?"":JSON.stringify(o,b),"te"),ae=41,J=480,H=5,ie=i((o,t)=>O(o,n=>{t(n.height>0?n:{height:J,width:n.width})}),"ae"),Ne=i(({initialShardKey:o})=>{let t=E(),{queryShardKey:n,setShardKey:P,shardKey:U}=j(o),[m,W]=(0,s.useState)(""),{data:f,error:g,errorSource:Z,isLoading:_,liveError:G}=L(I.getAuditLog,{},{live:!0,shardKey:n}),c=(0,s.useMemo)(()=>f?.entries??[],[f]),h=(0,s.useMemo)(()=>{let a=m.trim().toLowerCase();return a===""?c:c.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[c,m]),x=(0,s.useRef)(null),v=D({count:h.length,estimateSize:i(()=>ae,"estimateSize"),getScrollElement:i(()=>x.current,"getScrollElement"),initialRect:{height:J,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),Q=v.getTotalSize(),N=u[0]?.start??0,w=Q-(u.at(-1)?.end??0),X={height:N},Y={height:w},$=i(a=>{W(a.target.value)},"k");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(V,{onChange:P,testId:"au-shard-input",value:U}),(0,e.jsx)(F,{message:G,prefix:"au"}),(0,e.jsx)(K,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:$,placeholder:t("filter op, table, id"),value:m})]}),g!==null&&(0,e.jsx)(z,{error:Z,shardKey:n,testId:"au-error"}),g===null&&!_&&h.length===0&&(0,e.jsx)(T,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),h.length>0&&(0,e.jsx)(M,{className:"overflow-hidden py-0",children:(0,e.jsx)(R,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(A,{"data-testid":"au-table",children:[(0,e.jsx)(q,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(d,{children:t("time")}),(0,e.jsx)(d,{children:t("op")}),(0,e.jsx)(d,{children:t("table")}),(0,e.jsx)(d,{children:t("id")}),(0,e.jsx)(d,{children:t("detail")})]})}),(0,e.jsxs)(B,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:X})}),u.map(a=>{let r=h[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(l,{className:"text-muted-foreground tabular-nums",children:C(r.ts,"\u2014")}),(0,e.jsx)(l,{children:(0,e.jsx)(k,{variant:"secondary",children:r.op})}),(0,e.jsx)(l,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(l,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(l,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:H,style:Y})})]})]})})})]})},"we");export{Ne as AuditPanel};
@@ -1 +1 @@
1
- import{a as qe}from"./chunk-NS3LKZU2.js";import{a as Ke}from"./chunk-LM344LXC.js";import{a as Je}from"./chunk-KBAJLVHY.js";import{a as Ze}from"./chunk-3H2ATHKG.js";import"./chunk-G2ER6ZFN.js";import{a as He}from"./chunk-AJIXOUOQ.js";import{a as L}from"./chunk-P3JNXC5P.js";import{a as Xe}from"./chunk-2DT3QG6Q.js";import{a as We}from"./chunk-R7363SOB.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import{i as T}from"./chunk-OFMI2ROE.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as _}from"./chunk-PZMCBA23.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as De}from"./chunk-YK66QDSW.js";import{b as D}from"./chunk-DH6BG54K.js";import"./chunk-YUVGMKHG.js";import{a as ze,b as _e,c as Pe,d as q,e as U,f as z}from"./chunk-TOWZ7WYZ.js";import{b as Ve}from"./chunk-F6JSRYQT.js";import{a as X,e as Z}from"./chunk-MYSRHHC4.js";import{n as K}from"./chunk-A4AUTJPE.js";import"./chunk-ZPQBVYNN.js";import{B as Q,j as Ee,r as Ue,s as J,u as Qe,w as te}from"./chunk-HYNCYK4O.js";import"./chunk-PDBW6GTJ.js";import{a as lt}from"./chunk-GWNGVKLG.js";import{a as at,b as nt}from"./chunk-6G3E4PJ2.js";import{a as s,d as Me}from"./chunk-5PEAXTYQ.js";var C=Me(at(),1);var W=Me(lt(),1);var t=Me(nt(),1);var it=s(()=>{let h=(0,W.c)(3),{config:e,ready:n}=qe(),l;return h[0]!==e.capabilities||h[1]!==n?(l={capabilities:e.capabilities,ready:n},h[0]=e.capabilities,h[1]=n,h[2]=l):l=h[2],l},"nt"),st=s((h,e)=>typeof h.acceptedAt=="number"?"spent":typeof h.expiresAt=="number"&&h.expiresAt<=e?"expired":"pending","lt"),et=500,rt=s((h,e)=>{if(!URL.canParse(h.trim()))return null;let n=new URL(h.trim());return n.searchParams.set("email",e.email),n.searchParams.set("invite",e.token),n.toString()},"at"),dt=s(h=>{let e=(0,W.c)(34),{issued:n,onSignUpPageChange:l,signUpPage:o}=h,a=Q(),[p,i]=(0,C.useState)(null),u;e[0]!==n||e[1]!==o?(u=rt(o,n),e[0]=n,e[1]=o,e[2]=u):u=e[2];let c=u,y;e[3]!==c?(y=s(()=>{let $="navigator"in globalThis?globalThis.navigator.clipboard:void 0;c===null||$===void 0||J($.writeText(c).then(()=>(i(c),!0)))},"y"),e[3]=c,e[4]=y):y=e[4];let w=y,g;e[5]!==a?(g=a("Send this link to the invitee. It is shown once and cannot be recovered."),e[5]=a,e[6]=g):g=e[6];let I;e[7]!==g?(I=(0,t.jsx)("p",{className:"text-sm",children:g}),e[7]=g,e[8]=I):I=e[8];let k=c===null,v;e[9]!==a?(v=a("Your app's sign-up page"),e[9]=a,e[10]=v):v=e[10];let d;e[11]!==l?(d=s($=>{l($.target.value)},"r"),e[11]=l,e[12]=d):d=e[12];let m;e[13]!==o||e[14]!==k||e[15]!==v||e[16]!==d?(m=(0,t.jsx)(T,{"aria-invalid":k,"aria-label":v,"data-testid":"sign-up-invitation-page",onChange:d,value:o}),e[13]=o,e[14]=k,e[15]=v,e[16]=d,e[17]=m):m=e[17];let b=c??"",x;e[18]!==b?(x=(0,t.jsx)(T,{"data-testid":"sign-up-invitation-link",readOnly:!0,value:b}),e[18]=b,e[19]=x):x=e[19];let N;e[20]!==p||e[21]!==c||e[22]!==a?(N=a(p!==null&&p===c?"Copied":"Copy"),e[20]=p,e[21]=c,e[22]=a,e[23]=N):N=e[23];let f;e[24]!==w||e[25]!==N?(f=(0,t.jsx)(_,{"data-testid":"sign-up-invitation-copy",onClick:w,type:"button",children:N}),e[24]=w,e[25]=N,e[26]=f):f=e[26];let r;e[27]!==x||e[28]!==f?(r=(0,t.jsxs)("div",{className:"flex gap-2",children:[x,f]}),e[27]=x,e[28]=f,e[29]=r):r=e[29];let A;return e[30]!==r||e[31]!==I||e[32]!==m?(A=(0,t.jsx)(X,{children:(0,t.jsxs)(Z,{className:"flex flex-col gap-2 p-4",children:[I,m,r]})}),e[30]=r,e[31]=I,e[32]=m,e[33]=A):A=e[33],A},"it"),ot=s(()=>{let h=K(),e=Q(),[n,l]=(0,C.useState)(""),[o,a]=(0,C.useState)(null),[p,i]=(0,C.useState)(null),[u,c]=(0,C.useState)(()=>`${Qe(h.url)}/sign-up`),y=Ve(["lunora-auth-sign-up-invitations",et],()=>h.listAuthSignUpInvitations({limit:et})),w=y.data?.rows??null,g=y.data?.total??0,I=s(()=>{let v=n.trim();v!==""&&(a(null),J((async()=>{try{let d=await h.createAuthSignUpInvitation({email:v}),m=typeof d.token=="string"?d.token:void 0;i(m===void 0?null:{email:v,token:m}),l(""),y.refetch()}catch(d){a(d instanceof Error?d.message:String(d))}})()))},"w"),k=s(v=>{a(null),J((async()=>{try{await h.revokeAuthSignUpInvitation({email:v}),y.refetch()}catch(d){a(d instanceof Error?d.message:String(d))}})())},"k");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"sign-up-invitations",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-base font-medium",children:e("Sign-up invitations")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Only invited addresses can create an account. Nothing is emailed \u2014 send the invitee the one-time link yourself.")})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(T,{"aria-label":e("Email address to invite"),"data-testid":"sign-up-invitation-email",onChange:s(v=>{l(v.target.value)},"onChange"),placeholder:e("ada@example.com"),type:"email",value:n}),(0,t.jsx)(_,{"data-testid":"sign-up-invitation-submit",onClick:I,type:"button",children:e("Invite")})]}),p!==null&&(0,t.jsx)(dt,{issued:p,onSignUpPageChange:c,signUpPage:u},p.token),(o??y.error)!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sign-up-invitations-error",role:"alert",children:o??y.error}),w!==null&&w.length===0&&(0,t.jsx)(De,{testId:"sign-up-invitations-empty",title:e("Nobody has been invited yet.")}),w!==null&&g>w.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sign-up-invitations-truncated",children:e("Showing the most recent invitations. Query the signUpInvitation table directly to see the rest.")}),w!==null&&w.length>0&&(0,t.jsx)(X,{children:(0,t.jsx)(Z,{className:"p-0",children:(0,t.jsxs)(ze,{children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:e("Email")}),(0,t.jsx)(U,{children:e("Status")}),(0,t.jsx)(U,{children:e("Expires")}),(0,t.jsx)(U,{children:e("Invited by")}),(0,t.jsx)(U,{})]})}),(0,t.jsx)(Pe,{children:w.map(v=>{let d=st(v,Date.now()),m=v.email??"";return(0,t.jsxs)(q,{"data-testid":`sign-up-invitation-${m}`,children:[(0,t.jsx)(z,{children:m}),(0,t.jsxs)(z,{"data-testid":`sign-up-invitation-status-${m}`,children:[d==="spent"&&e("Accepted"),d==="expired"&&e("Expired"),d==="pending"&&e("Pending")]}),(0,t.jsx)(z,{children:typeof v.expiresAt=="number"?te(v.expiresAt):"\u2014"}),(0,t.jsx)(z,{children:v.invitedBy??"\u2014"}),(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(_,{onClick:s(()=>{k(m)},"onClick"),type:"button",variant:"ghost",children:e("Revoke")})})]},v.id)})})]})})})]})},"rt"),ct={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},ut=s((h,e)=>h.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:h.type!=="number"||!Number.isNaN(Number(e.trim())),"dt"),mt=s((h,e)=>{if(h.type==="boolean")return e===!0?{value:!0}:h.required?{value:!1}:void 0;let n=typeof e=="string"?e.trim():"";if(n!==""){if(h.type==="number"){let l=Number(n);return Number.isNaN(l)?void 0:{value:l}}return{value:n}}},"ct"),ht=s(h=>{let e=(0,W.c)(105),{onClose:n,onCreated:l}=h,o=K(),a=Q(),{config:p}=qe(),{busy:i,error:u,run:c}=Ke(),[y,w]=(0,C.useState)(""),[g,I]=(0,C.useState)(""),[k,v]=(0,C.useState)(""),[d,m]=(0,C.useState)(""),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];let[x,N]=(0,C.useState)(b),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=s(S=>{w(S.target.value)},"p"),e[1]=f):f=e[1];let r=f,A;e[2]===Symbol.for("react.memo_cache_sentinel")?(A=s(S=>{I(S.target.value)},"S"),e[2]=A):A=e[2];let $=A,j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j=s(S=>{v(S.target.value)},"z"),e[3]=j):j=e[3];let H=j,M;e[4]===Symbol.for("react.memo_cache_sentinel")?(M=s(S=>{m(S.target.value)},"M"),e[4]=M):M=e[4];let Y=M,B;e[5]===Symbol.for("react.memo_cache_sentinel")?(B=s((S,R)=>{N(ee=>({...ee,[S]:R}))},"L"),e[5]=B):B=e[5];let V=B,G;e[6]!==x?(G=s(S=>x[S.name]??(S.type==="boolean"?!1:""),"Y"),e[6]=x,e[7]=G):G=e[7];let P=G,O;if(e[8]!==p.userFields||e[9]!==P){let S;e[11]!==P?(S=s(R=>!R.required||ut(R,P(R)),"A"),e[11]=P,e[12]=S):S=e[12],O=p.userFields.every(S),e[8]=p.userFields,e[9]=P,e[10]=O}else O=e[10];let F=O,E;e[13]!==i||e[14]!==y||e[15]!==g||e[16]!==F?(E=!i&&y.trim()!==""&&g.trim()!==""&&F,e[13]=i,e[14]=y,e[15]=g,e[16]=F,e[17]=E):E=e[17];let $e=E,ae;e[18]!==p.userFields||e[19]!==P?(ae=s(()=>{let S={};for(let R of p.userFields){let ee=mt(R,P(R));ee!==void 0&&(S[R.name]=ee.value)}return Object.keys(S).length===0?void 0:S},"te"),e[18]=p.userFields,e[19]=P,e[20]=ae):ae=e[20];let je=ae,Re;e[21]!==je||e[22]!==o||e[23]!==y||e[24]!==g||e[25]!==n||e[26]!==l||e[27]!==k||e[28]!==d||e[29]!==c?(Re=s(()=>{c(async()=>{await o.createAuthUser({data:je(),email:y.trim(),name:g.trim(),password:k===""?void 0:k,role:d.trim()===""?void 0:d.trim()}),l(),n()})},"De"),e[21]=je,e[22]=o,e[23]=y,e[24]=g,e[25]=n,e[26]=l,e[27]=k,e[28]=d,e[29]=c,e[30]=Re):Re=e[30];let Be=Re,le;e[31]!==a?(le=a("Create user"),e[31]=a,e[32]=le):le=e[32];let ne;e[33]!==a?(ne=a("Create user"),e[33]=a,e[34]=ne):ne=e[34];let ie;e[35]!==ne?(ie=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:ne}),e[35]=ne,e[36]=ie):ie=e[36];let se;e[37]!==a?(se=a("email"),e[37]=a,e[38]=se):se=e[38];let re;e[39]!==se?(re=(0,t.jsx)(L,{htmlFor:"uc-email",children:se}),e[39]=se,e[40]=re):re=e[40];let de;e[41]!==y?(de=(0,t.jsx)(T,{"data-testid":"uc-email",id:"uc-email",onChange:r,type:"email",value:y}),e[41]=y,e[42]=de):de=e[42];let oe;e[43]!==re||e[44]!==de?(oe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,de]}),e[43]=re,e[44]=de,e[45]=oe):oe=e[45];let ce;e[46]!==a?(ce=a("name"),e[46]=a,e[47]=ce):ce=e[47];let ue;e[48]!==ce?(ue=(0,t.jsx)(L,{htmlFor:"uc-name",children:ce}),e[48]=ce,e[49]=ue):ue=e[49];let me;e[50]!==g?(me=(0,t.jsx)(T,{"data-testid":"uc-name",id:"uc-name",onChange:$,value:g}),e[50]=g,e[51]=me):me=e[51];let he;e[52]!==ue||e[53]!==me?(he=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[ue,me]}),e[52]=ue,e[53]=me,e[54]=he):he=e[54];let pe;e[55]!==a?(pe=a("Password (optional)"),e[55]=a,e[56]=pe):pe=e[56];let fe;e[57]!==pe?(fe=(0,t.jsx)(L,{htmlFor:"uc-password",children:pe}),e[57]=pe,e[58]=fe):fe=e[58];let ve;e[59]!==k?(ve=(0,t.jsx)(T,{"data-testid":"uc-password",id:"uc-password",onChange:H,type:"password",value:k}),e[59]=k,e[60]=ve):ve=e[60];let ge;e[61]!==fe||e[62]!==ve?(ge=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[fe,ve]}),e[61]=fe,e[62]=ve,e[63]=ge):ge=e[63];let be;e[64]!==a?(be=a("Role (optional)"),e[64]=a,e[65]=be):be=e[65];let xe;e[66]!==be?(xe=(0,t.jsx)(L,{htmlFor:"uc-role",children:be}),e[66]=be,e[67]=xe):xe=e[67];let ye;e[68]!==d?(ye=(0,t.jsx)(T,{"data-testid":"uc-role",id:"uc-role",onChange:Y,value:d}),e[68]=d,e[69]=ye):ye=e[69];let Ne;e[70]!==xe||e[71]!==ye?(Ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[xe,ye]}),e[70]=xe,e[71]=ye,e[72]=Ne):Ne=e[72];let ke;e[73]!==p.userFields||e[74]!==P||e[75]!==a?(ke=p.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")}),p.userFields.map(S=>{let R=`uc-field-${S.name}`,ee=S.required?"":` (${a("optional")})`;if(S.type==="boolean"){let Le=P(S)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:R,children:[(0,t.jsx)(Ze,{checked:Le,"data-testid":R,id:R,onCheckedChange:s(tt=>{V(S.name,tt)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[S.name,ee]})]},S.name)}let Ge=P(S);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(L,{htmlFor:R,children:[S.name,ee]}),(0,t.jsx)(T,{"data-testid":R,id:R,onChange:s(Le=>{V(S.name,Le.target.value)},"onChange"),type:ct[S.type],value:typeof Ge=="string"?Ge:""})]},S.name)})]}),e[73]=p.userFields,e[74]=P,e[75]=a,e[76]=ke):ke=e[76];let we;e[77]!==u?(we=u!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:u}),e[77]=u,e[78]=we):we=e[78];let Ce;e[79]!==a?(Ce=a("Cancel"),e[79]=a,e[80]=Ce):Ce=e[80];let Ie;e[81]!==n||e[82]!==Ce?(Ie=(0,t.jsx)(_,{"data-testid":"uc-cancel",onClick:n,size:"sm",type:"button",variant:"outline",children:Ce}),e[81]=n,e[82]=Ce,e[83]=Ie):Ie=e[83];let Oe=!$e,Se;e[84]!==i||e[85]!==a?(Se=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=Se):Se=e[86];let Ae;e[87]!==Be||e[88]!==Oe||e[89]!==Se?(Ae=(0,t.jsx)(_,{"data-testid":"uc-submit",disabled:Oe,onClick:Be,size:"sm",type:"button",children:Se}),e[87]=Be,e[88]=Oe,e[89]=Se,e[90]=Ae):Ae=e[90];let Fe;e[91]!==Ie||e[92]!==Ae?(Fe=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[Ie,Ae]}),e[91]=Ie,e[92]=Ae,e[93]=Fe):Fe=e[93];let Te;return e[94]!==n||e[95]!==le||e[96]!==ie||e[97]!==oe||e[98]!==he||e[99]!==ge||e[100]!==Ne||e[101]!==ke||e[102]!==we||e[103]!==Fe?(Te=(0,t.jsxs)(He,{label:le,onClose:n,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[ie,oe,he,ge,Ne,ke,we,Fe]}),e[94]=n,e[95]=le,e[96]=ie,e[97]=oe,e[98]=he,e[99]=ge,e[100]=Ne,e[101]=ke,e[102]=we,e[103]=Fe,e[104]=Te):Te=e[104],Te},"ut"),Ye=s(h=>{let e=(0,W.c)(2),{children:n}=h,l;return e[0]!==n?(l=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n}),e[0]=n,e[1]=l):l=e[1],l},"_e"),pt=s(h=>{let e=(0,W.c)(29),{busy:n,runAction:l,userId:o,version:a}=h,p=K(),i=Q(),[u,c]=(0,C.useState)(null),[y,w]=(0,C.useState)(null),g;e[0]!==p||e[1]!==o?(g=s(()=>{J((async()=>{w(null);try{let r=await p.listAuthSessions({limit:50,userId:o});c(r.rows)}catch(r){let A=r;c(null),w(Ee(A))}})())},"g"),e[0]=p,e[1]=o,e[2]=g):g=e[2];let I;e[3]!==p||e[4]!==o||e[5]!==a?(I=[p,o,a],e[3]=p,e[4]=o,e[5]=a,e[6]=I):I=e[6],(0,C.useEffect)(g,I);let k;e[7]!==p||e[8]!==l?(k=s(r=>{l(()=>p.revokeAuthSession({sessionId:r}))},"k"),e[7]=p,e[8]=l,e[9]=k):k=e[9];let v=k,d;e[10]!==i?(d=i("Sessions"),e[10]=i,e[11]=d):d=e[11];let m;e[12]!==d?(m=(0,t.jsx)(Ye,{children:d}),e[12]=d,e[13]=m):m=e[13];let b;e[14]!==y?(b=y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:y}),e[14]=y,e[15]=b):b=e[15];let x;e[16]!==u||e[17]!==i?(x=u!==null&&u.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=u,e[17]=i,e[18]=x):x=e[18];let N;e[19]!==n||e[20]!==v||e[21]!==u||e[22]!==i?(N=u!==null&&u.length>0&&(0,t.jsx)(X,{className:"overflow-hidden py-0",children:(0,t.jsx)(Z,{className:"px-0",children:(0,t.jsxs)(ze,{"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)(Pe,{children:u.map(r=>(0,t.jsxs)(q,{"data-testid":`ud-session-${r.id}`,children:[(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.expiresAt)}),(0,t.jsx)(z,{children:r.ipAddress??""}),(0,t.jsx)(z,{className:"max-w-40 truncate",children:r.userAgent??""}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-revoke-${r.id}`,disabled:n,onClick:s(()=>{v(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},r.id))})]})})}),e[19]=n,e[20]=v,e[21]=u,e[22]=i,e[23]=N):N=e[23];let f;return e[24]!==m||e[25]!==b||e[26]!==x||e[27]!==N?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[m,b,x,N]}),e[24]=m,e[25]=b,e[26]=x,e[27]=N,e[28]=f):f=e[28],f},"mt"),ft=s(h=>{let e=(0,W.c)(30),{busy:n,runAction:l,userId:o,version:a}=h,p=K(),i=Q(),[u,c]=(0,C.useState)(null),[y,w]=(0,C.useState)(null),g;e[0]!==p||e[1]!==o?(g=s(()=>{J((async()=>{w(null);try{c(await p.listAuthAccounts({userId:o}))}catch(r){let A=r;c(null),w(Ee(A))}})())},"g"),e[0]=p,e[1]=o,e[2]=g):g=e[2];let I;e[3]!==p||e[4]!==o||e[5]!==a?(I=[p,o,a],e[3]=p,e[4]=o,e[5]=a,e[6]=I):I=e[6],(0,C.useEffect)(g,I);let k;e[7]!==p||e[8]!==l||e[9]!==o?(k=s(r=>{l(()=>p.unlinkAuthAccount({accountId:r,userId:o}))},"k"),e[7]=p,e[8]=l,e[9]=o,e[10]=k):k=e[10];let v=k,d;e[11]!==i?(d=i("Linked accounts"),e[11]=i,e[12]=d):d=e[12];let m;e[13]!==d?(m=(0,t.jsx)(Ye,{children:d}),e[13]=d,e[14]=m):m=e[14];let b;e[15]!==y?(b=y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:y}),e[15]=y,e[16]=b):b=e[16];let x;e[17]!==u||e[18]!==i?(x=u!==null&&u.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=u,e[18]=i,e[19]=x):x=e[19];let N;e[20]!==u||e[21]!==n||e[22]!==v||e[23]!==i?(N=u!==null&&u.length>0&&(0,t.jsx)(X,{className:"overflow-hidden py-0",children:(0,t.jsx)(Z,{className:"px-0",children:(0,t.jsxs)(ze,{"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)(Pe,{children:u.map(r=>{let A=Ue(r.id);return(0,t.jsxs)(q,{"data-testid":`ud-account-${A}`,children:[(0,t.jsx)(z,{children:Ue(r.providerId)}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-unlink-${A}`,disabled:n,onClick:s(()=>{v(A)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},A)})})]})})}),e[20]=u,e[21]=n,e[22]=v,e[23]=i,e[24]=N):N=e[24];let f;return e[25]!==m||e[26]!==b||e[27]!==x||e[28]!==N?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[m,b,x,N]}),e[25]=m,e[26]=b,e[27]=x,e[28]=N,e[29]=f):f=e[29],f},"ht"),vt=s(h=>{let e=(0,W.c)(40),{busy:n,capabilities:l,runAction:o,userId:a,version:p}=h,i=K(),u=Q(),[c,y]=(0,C.useState)(null),w;e[0]!==l.passkey||e[1]!==i||e[2]!==a?(w=s(()=>{l.passkey&&J((async()=>{try{y(await i.listAuthPasskeys({userId:a}))}catch{y(null)}})())},"C"),e[0]=l.passkey,e[1]=i,e[2]=a,e[3]=w):w=e[3];let g;e[4]!==l.passkey||e[5]!==i||e[6]!==a||e[7]!==p?(g=[l.passkey,i,a,p],e[4]=l.passkey,e[5]=i,e[6]=a,e[7]=p,e[8]=g):g=e[8],(0,C.useEffect)(w,g);let I;e[9]!==i||e[10]!==o||e[11]!==a?(I=s(()=>{o(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=o,e[11]=a,e[12]=I):I=e[12];let k=I,v;e[13]!==i||e[14]!==o?(v=s(A=>{o(()=>i.deleteAuthPasskey({passkeyId:A}))},"v"),e[13]=i,e[14]=o,e[15]=v):v=e[15];let d=v,m;e[16]!==u?(m=u("Security"),e[16]=u,e[17]=m):m=e[17];let b;e[18]!==m?(b=(0,t.jsx)(Ye,{children:m}),e[18]=m,e[19]=b):b=e[19];let x;e[20]!==n||e[21]!==l.twoFactor||e[22]!==k||e[23]!==u?(x=l.twoFactor&&(0,t.jsx)(_,{"data-testid":"ud-disable-2fa",disabled:n,onClick:k,size:"sm",type:"button",variant:"outline",children:u("Disable two-factor")}),e[20]=n,e[21]=l.twoFactor,e[22]=k,e[23]=u,e[24]=x):x=e[24];let N;e[25]!==l.passkey||e[26]!==c||e[27]!==u?(N=l.passkey&&c!==null&&c.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:u("No passkeys.")}),e[25]=l.passkey,e[26]=c,e[27]=u,e[28]=N):N=e[28];let f;e[29]!==n||e[30]!==l.passkey||e[31]!==d||e[32]!==c||e[33]!==u?(f=l.passkey&&c!==null&&c.length>0&&(0,t.jsx)(X,{className:"overflow-hidden py-0",children:(0,t.jsx)(Z,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:u("name")}),(0,t.jsx)(U,{children:u("created")}),(0,t.jsx)(U,{"aria-label":u("Actions")})]})}),(0,t.jsx)(Pe,{children:c.map(A=>{let $=Ue(A.id);return(0,t.jsxs)(q,{"data-testid":`ud-passkey-${$}`,children:[(0,t.jsx)(z,{children:Ue(A.name)||$}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(A.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-delete-passkey-${$}`,disabled:n,onClick:s(()=>{d($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:u("Delete")})})]},$)})})]})})}),e[29]=n,e[30]=l.passkey,e[31]=d,e[32]=c,e[33]=u,e[34]=f):f=e[34];let r;return e[35]!==b||e[36]!==x||e[37]!==N||e[38]!==f?(r=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,x,N,f]}),e[35]=b,e[36]=x,e[37]=N,e[38]=f,e[39]=r):r=e[39],r},"ft"),gt=/(?:at|expires)$/iu,bt=/^[1-9]\d*$/u,xt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),yt=s(h=>{let e=(0,W.c)(51),{busy:n,onBan:l}=h,o=Q(),[a,p]=(0,C.useState)(""),[i,u]=(0,C.useState)(""),[c,y]=(0,C.useState)(!1),w;e[0]!==i?(w=bt.test(i.trim())&&Number.isSafeInteger(Number(i.trim())*86400)?Number(i.trim()):void 0,e[0]=i,e[1]=w):w=e[1];let g=w,I=c||g!==void 0,k;e[2]!==l||e[3]!==c||e[4]!==a||e[5]!==g?(k=s(()=>{l({expiresInSeconds:c||g===void 0?void 0:g*86400,reason:a.trim()===""?void 0:a.trim()})},"k"),e[2]=l,e[3]=c,e[4]=a,e[5]=g,e[6]=k):k=e[6];let v=k,d;e[7]!==o?(d=o("Ban reason (optional)"),e[7]=o,e[8]=d):d=e[8];let m;e[9]!==d?(m=(0,t.jsx)(L,{htmlFor:"ud-ban-reason",children:d}),e[9]=d,e[10]=m):m=e[10];let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=s(E=>{p(E.target.value)},"b"),e[11]=b):b=e[11];let x;e[12]!==a?(x=(0,t.jsx)(T,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:b,value:a}),e[12]=a,e[13]=x):x=e[13];let N;e[14]!==m||e[15]!==x?(N=(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[m,x]}),e[14]=m,e[15]=x,e[16]=N):N=e[16];let f;e[17]!==o?(f=o("Days"),e[17]=o,e[18]=f):f=e[18];let r;e[19]!==f?(r=(0,t.jsx)(L,{htmlFor:"ud-ban-days",children:f}),e[19]=f,e[20]=r):r=e[20];let A;e[21]!==i||e[22]!==g?(A=i.trim()!==""&&g===void 0,e[21]=i,e[22]=g,e[23]=A):A=e[23];let $;e[24]===Symbol.for("react.memo_cache_sentinel")?($=s(E=>{u(E.target.value)},"T"),e[24]=$):$=e[24];let j;e[25]!==i||e[26]!==c||e[27]!==A?(j=(0,t.jsx)(T,{"aria-invalid":A,"data-testid":"ud-ban-days",disabled:c,id:"ud-ban-days",min:1,onChange:$,step:1,type:"number",value:i}),e[25]=i,e[26]=c,e[27]=A,e[28]=j):j=e[28];let H;e[29]!==j||e[30]!==r?(H=(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[r,j]}),e[29]=j,e[30]=r,e[31]=H):H=e[31];let M;e[32]===Symbol.for("react.memo_cache_sentinel")?(M=s(E=>{y(E.target.checked)},"M"),e[32]=M):M=e[32];let Y;e[33]!==c?(Y=(0,t.jsx)("input",{checked:c,className:"size-4 accent-destructive","data-testid":"ud-ban-permanent",id:"ud-ban-permanent",onChange:M,type:"checkbox"}),e[33]=c,e[34]=Y):Y=e[34];let B;e[35]!==o?(B=o("Permanent"),e[35]=o,e[36]=B):B=e[36];let V;e[37]!==Y||e[38]!==B?(V=(0,t.jsxs)(L,{className:"flex items-center gap-1.5 pb-2 text-xs font-normal",htmlFor:"ud-ban-permanent",children:[Y,B]}),e[37]=Y,e[38]=B,e[39]=V):V=e[39];let G=n||!I,P;e[40]!==o?(P=o("Ban user"),e[40]=o,e[41]=P):P=e[41];let O;e[42]!==v||e[43]!==G||e[44]!==P?(O=(0,t.jsx)(_,{"data-testid":"ud-ban",disabled:G,onClick:v,size:"sm",type:"button",variant:"destructive",children:P}),e[42]=v,e[43]=G,e[44]=P,e[45]=O):O=e[45];let F;return e[46]!==H||e[47]!==V||e[48]!==O||e[49]!==N?(F=(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[N,H,V,O]}),e[46]=H,e[47]=V,e[48]=O,e[49]=N,e[50]=F):F=e[50],F},"bt"),Nt=s((h,e)=>typeof e=="number"&&gt.test(h)?te(e):Ue(e),"xt"),kt=s(({capabilities:h,onChanged:e,onClose:n,user:l})=>{let o=K(),a=Q(),p=l.banned===!0,[i,u]=(0,C.useState)(null),[c,y]=(0,C.useState)(!1),[w,g]=(0,C.useState)(0),[I,k]=(0,C.useState)(typeof l.role=="string"?l.role:""),[v,d]=(0,C.useState)(""),[m,b]=(0,C.useState)(null),[x,N]=(0,C.useState)(!1),f=s((F,E)=>{J((async()=>{y(!0),u(null);try{let $e=await F();E?.refresh!==!1&&(g(ae=>ae+1),e()),E?.onResult?.($e)}catch($e){u(Ee($e))}y(!1)})())},"p"),r=s(F=>{k(F.target.value)},"i"),A=s(F=>{d(F.target.value)},"S"),$=s(()=>{let F=I.trim();F!==""&&f(async()=>{await o.setAuthUserRole({role:F,userId:l.id})})},"T"),j=s(F=>{f(async()=>{await o.banAuthUser({...F,userId:l.id})})},"z"),H=s(()=>{f(async()=>{await o.unbanAuthUser({userId:l.id})})},"j"),M=s(()=>{f(async()=>{await o.setAuthUserPassword({newPassword:v,userId:l.id}),d("")})},"M"),Y=s(()=>{f(()=>o.impersonateAuthUser({userId:l.id}),{onResult:s(F=>{b(F.token)},"onResult"),refresh:!1})},"H"),B=s(()=>{f(async()=>{await o.revokeAuthUserSessions({userId:l.id})})},"L"),V=s(()=>{f(async()=>{await o.removeAuthUser({userId:l.id}),n()})},"V"),G=s(()=>{N(!0)},"Y"),P=s(()=>{N(!1)},"E"),O=Object.entries(l).filter(([F])=>!xt.has(F));return(0,t.jsxs)(He,{label:a("User details"),onClose:n,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:l.name??l.email??l.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:l.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&(0,t.jsx)(D,{variant:"secondary",children:l.role}),p?(0,t.jsx)(D,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(D,{variant:"outline",children:a("Active")}),l.emailVerified===!0?(0,t.jsx)(D,{variant:"secondary",children:a("verified")}):(0,t.jsx)(D,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(_,{"data-testid":"ud-close",onClick:n,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}),h.admin&&(0,t.jsxs)(X,{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)(Z,{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)(L,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(T,{"data-testid":"ud-role-input",id:"ud-role",onChange:r,value:I})]}),(0,t.jsx)(_,{"data-testid":"ud-set-role",disabled:c||I.trim()==="",onClick:$,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),p?(0,t.jsx)(_,{"data-testid":"ud-unban",disabled:c,onClick:H,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsx)(yt,{busy:c,onBan:j}),(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)(L,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(T,{"data-testid":"ud-password",id:"ud-password",onChange:A,type:"password",value:v})]}),(0,t.jsx)(_,{"data-testid":"ud-set-password",disabled:c||v==="",onClick:M,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(_,{"data-testid":"ud-impersonate",disabled:c,onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(_,{"data-testid":"ud-revoke-all",disabled:c,onClick:B,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_,{"data-testid":"ud-delete-confirm",disabled:c,onClick:V,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(_,{"data-testid":"ud-delete-cancel",onClick:P,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(_,{"data-testid":"ud-delete",disabled:c,onClick:G,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),m!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(L,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(T,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:m})]})]})]}),(0,t.jsx)(pt,{busy:c,runAction:f,userId:l.id,version:w}),h.accounts&&(0,t.jsx)(ft,{busy:c,runAction:f,userId:l.id,version:w}),(h.twoFactor||h.passkey)&&(0,t.jsx)(vt,{busy:c,capabilities:h,runAction:f,userId:l.id,version:w}),(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:O.map(([F,E])=>(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:F}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:Nt(F,E)})]},F))})]})]})},"yt"),wt=50,Vt=s(({pageSize:h=wt}={})=>{let e=K(),n=Q(),[l,o]=(0,C.useState)(""),[a,p]=(0,C.useState)(""),[i,u]=(0,C.useState)(0),c=Xe(l),[y,w]=(0,C.useState)(null),[g,I]=(0,C.useState)(!1),{capabilities:k}=it(),v=c.trim(),d=a.trim(),m=Ve(["lunora-auth-users",v,d,h,i],()=>e.listAuthUsers({filterField:d===""?void 0:"role",filterValue:d===""?void 0:d,limit:h,offset:i,search:v===""?void 0:v}).then(r=>({...r,offset:i})),{keepPreviousData:!0}),b=m.data?.rows??null,x=m.error,N=s(()=>{m.refetch()},"N");We(()=>m.poll(),!0);let f=y===null?null:b?.find(r=>r.id===y)??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)(T,{"aria-label":n("Search users"),className:"w-56","data-testid":"us-search",onChange:s(r=>{o(r.target.value),u(0)},"onChange"),placeholder:n("Search by email or name\u2026"),value:l}),(0,t.jsx)(T,{"aria-label":n("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:s(r=>{p(r.target.value),u(0)},"onChange"),placeholder:n("Filter by role"),value:a}),(0,t.jsx)(_,{"data-testid":"us-new",onClick:s(()=>{I(!0)},"onClick"),size:"sm",type:"button",children:n("New user")})]}),x!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:x}),b!==null&&b.length===0&&(0,t.jsx)(De,{description:n("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:n("No users.")}),b!==null&&b.length>0&&(0,t.jsx)(X,{className:"overflow-hidden py-0",children:(0,t.jsx)(Z,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"us-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:n("id")}),(0,t.jsx)(U,{children:n("email")}),(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("role")}),(0,t.jsx)(U,{children:n("status")}),(0,t.jsx)(U,{children:n("verified")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)(Pe,{children:b.map(r=>(0,t.jsxs)(q,{"data-testid":`us-row-${r.id}`,children:[(0,t.jsx)(z,{className:"font-mono text-xs",children:r.id}),(0,t.jsx)(z,{children:r.email??""}),(0,t.jsx)(z,{children:r.name??""}),(0,t.jsx)(z,{children:typeof r.role=="string"&&r.role!==""?(0,t.jsx)(D,{variant:"secondary",children:r.role}):""}),(0,t.jsx)(z,{children:r.banned===!0?(0,t.jsx)(D,{variant:"destructive",children:n("Banned")}):(0,t.jsx)(D,{variant:"success",children:n("Active")})}),(0,t.jsx)(z,{children:r.emailVerified===!0?(0,t.jsx)(D,{variant:"success",children:n("yes")}):(0,t.jsx)(D,{variant:"outline",children:n("no")})}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`us-manage-${r.id}`,onClick:s(()=>{w(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Manage")})})]},r.id))})]})})}),b!==null&&(0,t.jsx)(Je,{count:b.length,offset:m.data?.offset??0,onOffsetChange:u,pageSize:h,prefix:"us",total:m.data?.total}),f!==null&&(0,t.jsx)(kt,{capabilities:k,onChanged:N,onClose:s(()=>{w(null)},"onClose"),user:f}),g&&(0,t.jsx)(ht,{onClose:s(()=>{I(!1)},"onClose"),onCreated:N}),k.inviteOnly&&(0,t.jsx)(ot,{})]})},"jt");export{Vt as UsersPanel};
1
+ import{a as qe}from"./chunk-Z6WEYWT7.js";import{a as Ke}from"./chunk-HPD2PZP2.js";import{a as Je}from"./chunk-MGFELY5Q.js";import{a as Ze}from"./chunk-WSG35SRF.js";import"./chunk-JAAXDIR5.js";import{a as He}from"./chunk-D3DZZHZA.js";import{a as L}from"./chunk-RDS46R5R.js";import{a as Xe}from"./chunk-2DT3QG6Q.js";import{a as We}from"./chunk-ACWAMBGT.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import{i as T}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as _}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as De}from"./chunk-FWOOA2ZR.js";import{b as D}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as ze,b as _e,c as Pe,d as q,e as U,f as z}from"./chunk-VXZAS5VS.js";import{b as Ve}from"./chunk-TUFOWHEF.js";import{a as X,e as Z}from"./chunk-OSHODLMU.js";import{n as K}from"./chunk-ODLNNVP2.js";import"./chunk-ZPQBVYNN.js";import{B as Q,j as Ee,r as Ue,s as J,u as Qe,w as te}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as lt}from"./chunk-GWNGVKLG.js";import{a as at,b as nt}from"./chunk-6G3E4PJ2.js";import{a as s,d as Me}from"./chunk-5PEAXTYQ.js";var C=Me(at(),1);var W=Me(lt(),1);var t=Me(nt(),1);var it=s(()=>{let h=(0,W.c)(3),{config:e,ready:n}=qe(),l;return h[0]!==e.capabilities||h[1]!==n?(l={capabilities:e.capabilities,ready:n},h[0]=e.capabilities,h[1]=n,h[2]=l):l=h[2],l},"nt"),st=s((h,e)=>typeof h.acceptedAt=="number"?"spent":typeof h.expiresAt=="number"&&h.expiresAt<=e?"expired":"pending","lt"),et=500,rt=s((h,e)=>{if(!URL.canParse(h.trim()))return null;let n=new URL(h.trim());return n.searchParams.set("email",e.email),n.searchParams.set("invite",e.token),n.toString()},"at"),dt=s(h=>{let e=(0,W.c)(34),{issued:n,onSignUpPageChange:l,signUpPage:o}=h,a=Q(),[p,i]=(0,C.useState)(null),u;e[0]!==n||e[1]!==o?(u=rt(o,n),e[0]=n,e[1]=o,e[2]=u):u=e[2];let c=u,y;e[3]!==c?(y=s(()=>{let $="navigator"in globalThis?globalThis.navigator.clipboard:void 0;c===null||$===void 0||J($.writeText(c).then(()=>(i(c),!0)))},"y"),e[3]=c,e[4]=y):y=e[4];let w=y,g;e[5]!==a?(g=a("Send this link to the invitee. It is shown once and cannot be recovered."),e[5]=a,e[6]=g):g=e[6];let I;e[7]!==g?(I=(0,t.jsx)("p",{className:"text-sm",children:g}),e[7]=g,e[8]=I):I=e[8];let k=c===null,v;e[9]!==a?(v=a("Your app's sign-up page"),e[9]=a,e[10]=v):v=e[10];let d;e[11]!==l?(d=s($=>{l($.target.value)},"r"),e[11]=l,e[12]=d):d=e[12];let m;e[13]!==o||e[14]!==k||e[15]!==v||e[16]!==d?(m=(0,t.jsx)(T,{"aria-invalid":k,"aria-label":v,"data-testid":"sign-up-invitation-page",onChange:d,value:o}),e[13]=o,e[14]=k,e[15]=v,e[16]=d,e[17]=m):m=e[17];let b=c??"",x;e[18]!==b?(x=(0,t.jsx)(T,{"data-testid":"sign-up-invitation-link",readOnly:!0,value:b}),e[18]=b,e[19]=x):x=e[19];let N;e[20]!==p||e[21]!==c||e[22]!==a?(N=a(p!==null&&p===c?"Copied":"Copy"),e[20]=p,e[21]=c,e[22]=a,e[23]=N):N=e[23];let f;e[24]!==w||e[25]!==N?(f=(0,t.jsx)(_,{"data-testid":"sign-up-invitation-copy",onClick:w,type:"button",children:N}),e[24]=w,e[25]=N,e[26]=f):f=e[26];let r;e[27]!==x||e[28]!==f?(r=(0,t.jsxs)("div",{className:"flex gap-2",children:[x,f]}),e[27]=x,e[28]=f,e[29]=r):r=e[29];let A;return e[30]!==r||e[31]!==I||e[32]!==m?(A=(0,t.jsx)(X,{children:(0,t.jsxs)(Z,{className:"flex flex-col gap-2 p-4",children:[I,m,r]})}),e[30]=r,e[31]=I,e[32]=m,e[33]=A):A=e[33],A},"it"),ot=s(()=>{let h=K(),e=Q(),[n,l]=(0,C.useState)(""),[o,a]=(0,C.useState)(null),[p,i]=(0,C.useState)(null),[u,c]=(0,C.useState)(()=>`${Qe(h.url)}/sign-up`),y=Ve(["lunora-auth-sign-up-invitations",et],()=>h.listAuthSignUpInvitations({limit:et})),w=y.data?.rows??null,g=y.data?.total??0,I=s(()=>{let v=n.trim();v!==""&&(a(null),J((async()=>{try{let d=await h.createAuthSignUpInvitation({email:v}),m=typeof d.token=="string"?d.token:void 0;i(m===void 0?null:{email:v,token:m}),l(""),y.refetch()}catch(d){a(d instanceof Error?d.message:String(d))}})()))},"w"),k=s(v=>{a(null),J((async()=>{try{await h.revokeAuthSignUpInvitation({email:v}),y.refetch()}catch(d){a(d instanceof Error?d.message:String(d))}})())},"k");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"sign-up-invitations",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-base font-medium",children:e("Sign-up invitations")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("Only invited addresses can create an account. Nothing is emailed \u2014 send the invitee the one-time link yourself.")})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(T,{"aria-label":e("Email address to invite"),"data-testid":"sign-up-invitation-email",onChange:s(v=>{l(v.target.value)},"onChange"),placeholder:e("ada@example.com"),type:"email",value:n}),(0,t.jsx)(_,{"data-testid":"sign-up-invitation-submit",onClick:I,type:"button",children:e("Invite")})]}),p!==null&&(0,t.jsx)(dt,{issued:p,onSignUpPageChange:c,signUpPage:u},p.token),(o??y.error)!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"sign-up-invitations-error",role:"alert",children:o??y.error}),w!==null&&w.length===0&&(0,t.jsx)(De,{testId:"sign-up-invitations-empty",title:e("Nobody has been invited yet.")}),w!==null&&g>w.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"sign-up-invitations-truncated",children:e("Showing the most recent invitations. Query the signUpInvitation table directly to see the rest.")}),w!==null&&w.length>0&&(0,t.jsx)(X,{children:(0,t.jsx)(Z,{className:"p-0",children:(0,t.jsxs)(ze,{children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:e("Email")}),(0,t.jsx)(U,{children:e("Status")}),(0,t.jsx)(U,{children:e("Expires")}),(0,t.jsx)(U,{children:e("Invited by")}),(0,t.jsx)(U,{})]})}),(0,t.jsx)(Pe,{children:w.map(v=>{let d=st(v,Date.now()),m=v.email??"";return(0,t.jsxs)(q,{"data-testid":`sign-up-invitation-${m}`,children:[(0,t.jsx)(z,{children:m}),(0,t.jsxs)(z,{"data-testid":`sign-up-invitation-status-${m}`,children:[d==="spent"&&e("Accepted"),d==="expired"&&e("Expired"),d==="pending"&&e("Pending")]}),(0,t.jsx)(z,{children:typeof v.expiresAt=="number"?te(v.expiresAt):"\u2014"}),(0,t.jsx)(z,{children:v.invitedBy??"\u2014"}),(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(_,{onClick:s(()=>{k(m)},"onClick"),type:"button",variant:"ghost",children:e("Revoke")})})]},v.id)})})]})})})]})},"rt"),ct={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},ut=s((h,e)=>h.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:h.type!=="number"||!Number.isNaN(Number(e.trim())),"dt"),mt=s((h,e)=>{if(h.type==="boolean")return e===!0?{value:!0}:h.required?{value:!1}:void 0;let n=typeof e=="string"?e.trim():"";if(n!==""){if(h.type==="number"){let l=Number(n);return Number.isNaN(l)?void 0:{value:l}}return{value:n}}},"ct"),ht=s(h=>{let e=(0,W.c)(105),{onClose:n,onCreated:l}=h,o=K(),a=Q(),{config:p}=qe(),{busy:i,error:u,run:c}=Ke(),[y,w]=(0,C.useState)(""),[g,I]=(0,C.useState)(""),[k,v]=(0,C.useState)(""),[d,m]=(0,C.useState)(""),b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={},e[0]=b):b=e[0];let[x,N]=(0,C.useState)(b),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=s(S=>{w(S.target.value)},"p"),e[1]=f):f=e[1];let r=f,A;e[2]===Symbol.for("react.memo_cache_sentinel")?(A=s(S=>{I(S.target.value)},"S"),e[2]=A):A=e[2];let $=A,j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j=s(S=>{v(S.target.value)},"z"),e[3]=j):j=e[3];let H=j,M;e[4]===Symbol.for("react.memo_cache_sentinel")?(M=s(S=>{m(S.target.value)},"M"),e[4]=M):M=e[4];let Y=M,B;e[5]===Symbol.for("react.memo_cache_sentinel")?(B=s((S,R)=>{N(ee=>({...ee,[S]:R}))},"L"),e[5]=B):B=e[5];let V=B,G;e[6]!==x?(G=s(S=>x[S.name]??(S.type==="boolean"?!1:""),"Y"),e[6]=x,e[7]=G):G=e[7];let P=G,O;if(e[8]!==p.userFields||e[9]!==P){let S;e[11]!==P?(S=s(R=>!R.required||ut(R,P(R)),"A"),e[11]=P,e[12]=S):S=e[12],O=p.userFields.every(S),e[8]=p.userFields,e[9]=P,e[10]=O}else O=e[10];let F=O,E;e[13]!==i||e[14]!==y||e[15]!==g||e[16]!==F?(E=!i&&y.trim()!==""&&g.trim()!==""&&F,e[13]=i,e[14]=y,e[15]=g,e[16]=F,e[17]=E):E=e[17];let $e=E,ae;e[18]!==p.userFields||e[19]!==P?(ae=s(()=>{let S={};for(let R of p.userFields){let ee=mt(R,P(R));ee!==void 0&&(S[R.name]=ee.value)}return Object.keys(S).length===0?void 0:S},"te"),e[18]=p.userFields,e[19]=P,e[20]=ae):ae=e[20];let je=ae,Re;e[21]!==je||e[22]!==o||e[23]!==y||e[24]!==g||e[25]!==n||e[26]!==l||e[27]!==k||e[28]!==d||e[29]!==c?(Re=s(()=>{c(async()=>{await o.createAuthUser({data:je(),email:y.trim(),name:g.trim(),password:k===""?void 0:k,role:d.trim()===""?void 0:d.trim()}),l(),n()})},"De"),e[21]=je,e[22]=o,e[23]=y,e[24]=g,e[25]=n,e[26]=l,e[27]=k,e[28]=d,e[29]=c,e[30]=Re):Re=e[30];let Be=Re,le;e[31]!==a?(le=a("Create user"),e[31]=a,e[32]=le):le=e[32];let ne;e[33]!==a?(ne=a("Create user"),e[33]=a,e[34]=ne):ne=e[34];let ie;e[35]!==ne?(ie=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:ne}),e[35]=ne,e[36]=ie):ie=e[36];let se;e[37]!==a?(se=a("email"),e[37]=a,e[38]=se):se=e[38];let re;e[39]!==se?(re=(0,t.jsx)(L,{htmlFor:"uc-email",children:se}),e[39]=se,e[40]=re):re=e[40];let de;e[41]!==y?(de=(0,t.jsx)(T,{"data-testid":"uc-email",id:"uc-email",onChange:r,type:"email",value:y}),e[41]=y,e[42]=de):de=e[42];let oe;e[43]!==re||e[44]!==de?(oe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,de]}),e[43]=re,e[44]=de,e[45]=oe):oe=e[45];let ce;e[46]!==a?(ce=a("name"),e[46]=a,e[47]=ce):ce=e[47];let ue;e[48]!==ce?(ue=(0,t.jsx)(L,{htmlFor:"uc-name",children:ce}),e[48]=ce,e[49]=ue):ue=e[49];let me;e[50]!==g?(me=(0,t.jsx)(T,{"data-testid":"uc-name",id:"uc-name",onChange:$,value:g}),e[50]=g,e[51]=me):me=e[51];let he;e[52]!==ue||e[53]!==me?(he=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[ue,me]}),e[52]=ue,e[53]=me,e[54]=he):he=e[54];let pe;e[55]!==a?(pe=a("Password (optional)"),e[55]=a,e[56]=pe):pe=e[56];let fe;e[57]!==pe?(fe=(0,t.jsx)(L,{htmlFor:"uc-password",children:pe}),e[57]=pe,e[58]=fe):fe=e[58];let ve;e[59]!==k?(ve=(0,t.jsx)(T,{"data-testid":"uc-password",id:"uc-password",onChange:H,type:"password",value:k}),e[59]=k,e[60]=ve):ve=e[60];let ge;e[61]!==fe||e[62]!==ve?(ge=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[fe,ve]}),e[61]=fe,e[62]=ve,e[63]=ge):ge=e[63];let be;e[64]!==a?(be=a("Role (optional)"),e[64]=a,e[65]=be):be=e[65];let xe;e[66]!==be?(xe=(0,t.jsx)(L,{htmlFor:"uc-role",children:be}),e[66]=be,e[67]=xe):xe=e[67];let ye;e[68]!==d?(ye=(0,t.jsx)(T,{"data-testid":"uc-role",id:"uc-role",onChange:Y,value:d}),e[68]=d,e[69]=ye):ye=e[69];let Ne;e[70]!==xe||e[71]!==ye?(Ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[xe,ye]}),e[70]=xe,e[71]=ye,e[72]=Ne):Ne=e[72];let ke;e[73]!==p.userFields||e[74]!==P||e[75]!==a?(ke=p.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")}),p.userFields.map(S=>{let R=`uc-field-${S.name}`,ee=S.required?"":` (${a("optional")})`;if(S.type==="boolean"){let Le=P(S)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:R,children:[(0,t.jsx)(Ze,{checked:Le,"data-testid":R,id:R,onCheckedChange:s(tt=>{V(S.name,tt)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[S.name,ee]})]},S.name)}let Ge=P(S);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(L,{htmlFor:R,children:[S.name,ee]}),(0,t.jsx)(T,{"data-testid":R,id:R,onChange:s(Le=>{V(S.name,Le.target.value)},"onChange"),type:ct[S.type],value:typeof Ge=="string"?Ge:""})]},S.name)})]}),e[73]=p.userFields,e[74]=P,e[75]=a,e[76]=ke):ke=e[76];let we;e[77]!==u?(we=u!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:u}),e[77]=u,e[78]=we):we=e[78];let Ce;e[79]!==a?(Ce=a("Cancel"),e[79]=a,e[80]=Ce):Ce=e[80];let Ie;e[81]!==n||e[82]!==Ce?(Ie=(0,t.jsx)(_,{"data-testid":"uc-cancel",onClick:n,size:"sm",type:"button",variant:"outline",children:Ce}),e[81]=n,e[82]=Ce,e[83]=Ie):Ie=e[83];let Oe=!$e,Se;e[84]!==i||e[85]!==a?(Se=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=Se):Se=e[86];let Ae;e[87]!==Be||e[88]!==Oe||e[89]!==Se?(Ae=(0,t.jsx)(_,{"data-testid":"uc-submit",disabled:Oe,onClick:Be,size:"sm",type:"button",children:Se}),e[87]=Be,e[88]=Oe,e[89]=Se,e[90]=Ae):Ae=e[90];let Fe;e[91]!==Ie||e[92]!==Ae?(Fe=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[Ie,Ae]}),e[91]=Ie,e[92]=Ae,e[93]=Fe):Fe=e[93];let Te;return e[94]!==n||e[95]!==le||e[96]!==ie||e[97]!==oe||e[98]!==he||e[99]!==ge||e[100]!==Ne||e[101]!==ke||e[102]!==we||e[103]!==Fe?(Te=(0,t.jsxs)(He,{label:le,onClose:n,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[ie,oe,he,ge,Ne,ke,we,Fe]}),e[94]=n,e[95]=le,e[96]=ie,e[97]=oe,e[98]=he,e[99]=ge,e[100]=Ne,e[101]=ke,e[102]=we,e[103]=Fe,e[104]=Te):Te=e[104],Te},"ut"),Ye=s(h=>{let e=(0,W.c)(2),{children:n}=h,l;return e[0]!==n?(l=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n}),e[0]=n,e[1]=l):l=e[1],l},"_e"),pt=s(h=>{let e=(0,W.c)(29),{busy:n,runAction:l,userId:o,version:a}=h,p=K(),i=Q(),[u,c]=(0,C.useState)(null),[y,w]=(0,C.useState)(null),g;e[0]!==p||e[1]!==o?(g=s(()=>{J((async()=>{w(null);try{let r=await p.listAuthSessions({limit:50,userId:o});c(r.rows)}catch(r){let A=r;c(null),w(Ee(A))}})())},"g"),e[0]=p,e[1]=o,e[2]=g):g=e[2];let I;e[3]!==p||e[4]!==o||e[5]!==a?(I=[p,o,a],e[3]=p,e[4]=o,e[5]=a,e[6]=I):I=e[6],(0,C.useEffect)(g,I);let k;e[7]!==p||e[8]!==l?(k=s(r=>{l(()=>p.revokeAuthSession({sessionId:r}))},"k"),e[7]=p,e[8]=l,e[9]=k):k=e[9];let v=k,d;e[10]!==i?(d=i("Sessions"),e[10]=i,e[11]=d):d=e[11];let m;e[12]!==d?(m=(0,t.jsx)(Ye,{children:d}),e[12]=d,e[13]=m):m=e[13];let b;e[14]!==y?(b=y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:y}),e[14]=y,e[15]=b):b=e[15];let x;e[16]!==u||e[17]!==i?(x=u!==null&&u.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=u,e[17]=i,e[18]=x):x=e[18];let N;e[19]!==n||e[20]!==v||e[21]!==u||e[22]!==i?(N=u!==null&&u.length>0&&(0,t.jsx)(X,{className:"overflow-hidden py-0",children:(0,t.jsx)(Z,{className:"px-0",children:(0,t.jsxs)(ze,{"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)(Pe,{children:u.map(r=>(0,t.jsxs)(q,{"data-testid":`ud-session-${r.id}`,children:[(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.expiresAt)}),(0,t.jsx)(z,{children:r.ipAddress??""}),(0,t.jsx)(z,{className:"max-w-40 truncate",children:r.userAgent??""}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-revoke-${r.id}`,disabled:n,onClick:s(()=>{v(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},r.id))})]})})}),e[19]=n,e[20]=v,e[21]=u,e[22]=i,e[23]=N):N=e[23];let f;return e[24]!==m||e[25]!==b||e[26]!==x||e[27]!==N?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[m,b,x,N]}),e[24]=m,e[25]=b,e[26]=x,e[27]=N,e[28]=f):f=e[28],f},"mt"),ft=s(h=>{let e=(0,W.c)(30),{busy:n,runAction:l,userId:o,version:a}=h,p=K(),i=Q(),[u,c]=(0,C.useState)(null),[y,w]=(0,C.useState)(null),g;e[0]!==p||e[1]!==o?(g=s(()=>{J((async()=>{w(null);try{c(await p.listAuthAccounts({userId:o}))}catch(r){let A=r;c(null),w(Ee(A))}})())},"g"),e[0]=p,e[1]=o,e[2]=g):g=e[2];let I;e[3]!==p||e[4]!==o||e[5]!==a?(I=[p,o,a],e[3]=p,e[4]=o,e[5]=a,e[6]=I):I=e[6],(0,C.useEffect)(g,I);let k;e[7]!==p||e[8]!==l||e[9]!==o?(k=s(r=>{l(()=>p.unlinkAuthAccount({accountId:r,userId:o}))},"k"),e[7]=p,e[8]=l,e[9]=o,e[10]=k):k=e[10];let v=k,d;e[11]!==i?(d=i("Linked accounts"),e[11]=i,e[12]=d):d=e[12];let m;e[13]!==d?(m=(0,t.jsx)(Ye,{children:d}),e[13]=d,e[14]=m):m=e[14];let b;e[15]!==y?(b=y!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:y}),e[15]=y,e[16]=b):b=e[16];let x;e[17]!==u||e[18]!==i?(x=u!==null&&u.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=u,e[18]=i,e[19]=x):x=e[19];let N;e[20]!==u||e[21]!==n||e[22]!==v||e[23]!==i?(N=u!==null&&u.length>0&&(0,t.jsx)(X,{className:"overflow-hidden py-0",children:(0,t.jsx)(Z,{className:"px-0",children:(0,t.jsxs)(ze,{"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)(Pe,{children:u.map(r=>{let A=Ue(r.id);return(0,t.jsxs)(q,{"data-testid":`ud-account-${A}`,children:[(0,t.jsx)(z,{children:Ue(r.providerId)}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-unlink-${A}`,disabled:n,onClick:s(()=>{v(A)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},A)})})]})})}),e[20]=u,e[21]=n,e[22]=v,e[23]=i,e[24]=N):N=e[24];let f;return e[25]!==m||e[26]!==b||e[27]!==x||e[28]!==N?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[m,b,x,N]}),e[25]=m,e[26]=b,e[27]=x,e[28]=N,e[29]=f):f=e[29],f},"ht"),vt=s(h=>{let e=(0,W.c)(40),{busy:n,capabilities:l,runAction:o,userId:a,version:p}=h,i=K(),u=Q(),[c,y]=(0,C.useState)(null),w;e[0]!==l.passkey||e[1]!==i||e[2]!==a?(w=s(()=>{l.passkey&&J((async()=>{try{y(await i.listAuthPasskeys({userId:a}))}catch{y(null)}})())},"C"),e[0]=l.passkey,e[1]=i,e[2]=a,e[3]=w):w=e[3];let g;e[4]!==l.passkey||e[5]!==i||e[6]!==a||e[7]!==p?(g=[l.passkey,i,a,p],e[4]=l.passkey,e[5]=i,e[6]=a,e[7]=p,e[8]=g):g=e[8],(0,C.useEffect)(w,g);let I;e[9]!==i||e[10]!==o||e[11]!==a?(I=s(()=>{o(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=o,e[11]=a,e[12]=I):I=e[12];let k=I,v;e[13]!==i||e[14]!==o?(v=s(A=>{o(()=>i.deleteAuthPasskey({passkeyId:A}))},"v"),e[13]=i,e[14]=o,e[15]=v):v=e[15];let d=v,m;e[16]!==u?(m=u("Security"),e[16]=u,e[17]=m):m=e[17];let b;e[18]!==m?(b=(0,t.jsx)(Ye,{children:m}),e[18]=m,e[19]=b):b=e[19];let x;e[20]!==n||e[21]!==l.twoFactor||e[22]!==k||e[23]!==u?(x=l.twoFactor&&(0,t.jsx)(_,{"data-testid":"ud-disable-2fa",disabled:n,onClick:k,size:"sm",type:"button",variant:"outline",children:u("Disable two-factor")}),e[20]=n,e[21]=l.twoFactor,e[22]=k,e[23]=u,e[24]=x):x=e[24];let N;e[25]!==l.passkey||e[26]!==c||e[27]!==u?(N=l.passkey&&c!==null&&c.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:u("No passkeys.")}),e[25]=l.passkey,e[26]=c,e[27]=u,e[28]=N):N=e[28];let f;e[29]!==n||e[30]!==l.passkey||e[31]!==d||e[32]!==c||e[33]!==u?(f=l.passkey&&c!==null&&c.length>0&&(0,t.jsx)(X,{className:"overflow-hidden py-0",children:(0,t.jsx)(Z,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:u("name")}),(0,t.jsx)(U,{children:u("created")}),(0,t.jsx)(U,{"aria-label":u("Actions")})]})}),(0,t.jsx)(Pe,{children:c.map(A=>{let $=Ue(A.id);return(0,t.jsxs)(q,{"data-testid":`ud-passkey-${$}`,children:[(0,t.jsx)(z,{children:Ue(A.name)||$}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(A.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`ud-delete-passkey-${$}`,disabled:n,onClick:s(()=>{d($)},"onClick"),size:"xs",type:"button",variant:"ghost",children:u("Delete")})})]},$)})})]})})}),e[29]=n,e[30]=l.passkey,e[31]=d,e[32]=c,e[33]=u,e[34]=f):f=e[34];let r;return e[35]!==b||e[36]!==x||e[37]!==N||e[38]!==f?(r=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[b,x,N,f]}),e[35]=b,e[36]=x,e[37]=N,e[38]=f,e[39]=r):r=e[39],r},"ft"),gt=/(?:at|expires)$/iu,bt=/^[1-9]\d*$/u,xt=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),yt=s(h=>{let e=(0,W.c)(51),{busy:n,onBan:l}=h,o=Q(),[a,p]=(0,C.useState)(""),[i,u]=(0,C.useState)(""),[c,y]=(0,C.useState)(!1),w;e[0]!==i?(w=bt.test(i.trim())&&Number.isSafeInteger(Number(i.trim())*86400)?Number(i.trim()):void 0,e[0]=i,e[1]=w):w=e[1];let g=w,I=c||g!==void 0,k;e[2]!==l||e[3]!==c||e[4]!==a||e[5]!==g?(k=s(()=>{l({expiresInSeconds:c||g===void 0?void 0:g*86400,reason:a.trim()===""?void 0:a.trim()})},"k"),e[2]=l,e[3]=c,e[4]=a,e[5]=g,e[6]=k):k=e[6];let v=k,d;e[7]!==o?(d=o("Ban reason (optional)"),e[7]=o,e[8]=d):d=e[8];let m;e[9]!==d?(m=(0,t.jsx)(L,{htmlFor:"ud-ban-reason",children:d}),e[9]=d,e[10]=m):m=e[10];let b;e[11]===Symbol.for("react.memo_cache_sentinel")?(b=s(E=>{p(E.target.value)},"b"),e[11]=b):b=e[11];let x;e[12]!==a?(x=(0,t.jsx)(T,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:b,value:a}),e[12]=a,e[13]=x):x=e[13];let N;e[14]!==m||e[15]!==x?(N=(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[m,x]}),e[14]=m,e[15]=x,e[16]=N):N=e[16];let f;e[17]!==o?(f=o("Days"),e[17]=o,e[18]=f):f=e[18];let r;e[19]!==f?(r=(0,t.jsx)(L,{htmlFor:"ud-ban-days",children:f}),e[19]=f,e[20]=r):r=e[20];let A;e[21]!==i||e[22]!==g?(A=i.trim()!==""&&g===void 0,e[21]=i,e[22]=g,e[23]=A):A=e[23];let $;e[24]===Symbol.for("react.memo_cache_sentinel")?($=s(E=>{u(E.target.value)},"T"),e[24]=$):$=e[24];let j;e[25]!==i||e[26]!==c||e[27]!==A?(j=(0,t.jsx)(T,{"aria-invalid":A,"data-testid":"ud-ban-days",disabled:c,id:"ud-ban-days",min:1,onChange:$,step:1,type:"number",value:i}),e[25]=i,e[26]=c,e[27]=A,e[28]=j):j=e[28];let H;e[29]!==j||e[30]!==r?(H=(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[r,j]}),e[29]=j,e[30]=r,e[31]=H):H=e[31];let M;e[32]===Symbol.for("react.memo_cache_sentinel")?(M=s(E=>{y(E.target.checked)},"M"),e[32]=M):M=e[32];let Y;e[33]!==c?(Y=(0,t.jsx)("input",{checked:c,className:"size-4 accent-destructive","data-testid":"ud-ban-permanent",id:"ud-ban-permanent",onChange:M,type:"checkbox"}),e[33]=c,e[34]=Y):Y=e[34];let B;e[35]!==o?(B=o("Permanent"),e[35]=o,e[36]=B):B=e[36];let V;e[37]!==Y||e[38]!==B?(V=(0,t.jsxs)(L,{className:"flex items-center gap-1.5 pb-2 text-xs font-normal",htmlFor:"ud-ban-permanent",children:[Y,B]}),e[37]=Y,e[38]=B,e[39]=V):V=e[39];let G=n||!I,P;e[40]!==o?(P=o("Ban user"),e[40]=o,e[41]=P):P=e[41];let O;e[42]!==v||e[43]!==G||e[44]!==P?(O=(0,t.jsx)(_,{"data-testid":"ud-ban",disabled:G,onClick:v,size:"sm",type:"button",variant:"destructive",children:P}),e[42]=v,e[43]=G,e[44]=P,e[45]=O):O=e[45];let F;return e[46]!==H||e[47]!==V||e[48]!==O||e[49]!==N?(F=(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[N,H,V,O]}),e[46]=H,e[47]=V,e[48]=O,e[49]=N,e[50]=F):F=e[50],F},"bt"),Nt=s((h,e)=>typeof e=="number"&&gt.test(h)?te(e):Ue(e),"xt"),kt=s(({capabilities:h,onChanged:e,onClose:n,user:l})=>{let o=K(),a=Q(),p=l.banned===!0,[i,u]=(0,C.useState)(null),[c,y]=(0,C.useState)(!1),[w,g]=(0,C.useState)(0),[I,k]=(0,C.useState)(typeof l.role=="string"?l.role:""),[v,d]=(0,C.useState)(""),[m,b]=(0,C.useState)(null),[x,N]=(0,C.useState)(!1),f=s((F,E)=>{J((async()=>{y(!0),u(null);try{let $e=await F();E?.refresh!==!1&&(g(ae=>ae+1),e()),E?.onResult?.($e)}catch($e){u(Ee($e))}y(!1)})())},"p"),r=s(F=>{k(F.target.value)},"i"),A=s(F=>{d(F.target.value)},"S"),$=s(()=>{let F=I.trim();F!==""&&f(async()=>{await o.setAuthUserRole({role:F,userId:l.id})})},"T"),j=s(F=>{f(async()=>{await o.banAuthUser({...F,userId:l.id})})},"z"),H=s(()=>{f(async()=>{await o.unbanAuthUser({userId:l.id})})},"j"),M=s(()=>{f(async()=>{await o.setAuthUserPassword({newPassword:v,userId:l.id}),d("")})},"M"),Y=s(()=>{f(()=>o.impersonateAuthUser({userId:l.id}),{onResult:s(F=>{b(F.token)},"onResult"),refresh:!1})},"H"),B=s(()=>{f(async()=>{await o.revokeAuthUserSessions({userId:l.id})})},"L"),V=s(()=>{f(async()=>{await o.removeAuthUser({userId:l.id}),n()})},"V"),G=s(()=>{N(!0)},"Y"),P=s(()=>{N(!1)},"E"),O=Object.entries(l).filter(([F])=>!xt.has(F));return(0,t.jsxs)(He,{label:a("User details"),onClose:n,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:l.name??l.email??l.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:l.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof l.role=="string"&&l.role!==""&&(0,t.jsx)(D,{variant:"secondary",children:l.role}),p?(0,t.jsx)(D,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(D,{variant:"outline",children:a("Active")}),l.emailVerified===!0?(0,t.jsx)(D,{variant:"secondary",children:a("verified")}):(0,t.jsx)(D,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(_,{"data-testid":"ud-close",onClick:n,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}),h.admin&&(0,t.jsxs)(X,{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)(Z,{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)(L,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(T,{"data-testid":"ud-role-input",id:"ud-role",onChange:r,value:I})]}),(0,t.jsx)(_,{"data-testid":"ud-set-role",disabled:c||I.trim()==="",onClick:$,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),p?(0,t.jsx)(_,{"data-testid":"ud-unban",disabled:c,onClick:H,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsx)(yt,{busy:c,onBan:j}),(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)(L,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(T,{"data-testid":"ud-password",id:"ud-password",onChange:A,type:"password",value:v})]}),(0,t.jsx)(_,{"data-testid":"ud-set-password",disabled:c||v==="",onClick:M,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(_,{"data-testid":"ud-impersonate",disabled:c,onClick:Y,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(_,{"data-testid":"ud-revoke-all",disabled:c,onClick:B,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_,{"data-testid":"ud-delete-confirm",disabled:c,onClick:V,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(_,{"data-testid":"ud-delete-cancel",onClick:P,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(_,{"data-testid":"ud-delete",disabled:c,onClick:G,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),m!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(L,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(T,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:m})]})]})]}),(0,t.jsx)(pt,{busy:c,runAction:f,userId:l.id,version:w}),h.accounts&&(0,t.jsx)(ft,{busy:c,runAction:f,userId:l.id,version:w}),(h.twoFactor||h.passkey)&&(0,t.jsx)(vt,{busy:c,capabilities:h,runAction:f,userId:l.id,version:w}),(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:O.map(([F,E])=>(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:F}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:Nt(F,E)})]},F))})]})]})},"yt"),wt=50,Vt=s(({pageSize:h=wt}={})=>{let e=K(),n=Q(),[l,o]=(0,C.useState)(""),[a,p]=(0,C.useState)(""),[i,u]=(0,C.useState)(0),c=Xe(l),[y,w]=(0,C.useState)(null),[g,I]=(0,C.useState)(!1),{capabilities:k}=it(),v=c.trim(),d=a.trim(),m=Ve(["lunora-auth-users",v,d,h,i],()=>e.listAuthUsers({filterField:d===""?void 0:"role",filterValue:d===""?void 0:d,limit:h,offset:i,search:v===""?void 0:v}).then(r=>({...r,offset:i})),{keepPreviousData:!0}),b=m.data?.rows??null,x=m.error,N=s(()=>{m.refetch()},"N");We(()=>m.poll(),!0);let f=y===null?null:b?.find(r=>r.id===y)??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)(T,{"aria-label":n("Search users"),className:"w-56","data-testid":"us-search",onChange:s(r=>{o(r.target.value),u(0)},"onChange"),placeholder:n("Search by email or name\u2026"),value:l}),(0,t.jsx)(T,{"aria-label":n("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:s(r=>{p(r.target.value),u(0)},"onChange"),placeholder:n("Filter by role"),value:a}),(0,t.jsx)(_,{"data-testid":"us-new",onClick:s(()=>{I(!0)},"onClick"),size:"sm",type:"button",children:n("New user")})]}),x!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:x}),b!==null&&b.length===0&&(0,t.jsx)(De,{description:n("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:n("No users.")}),b!==null&&b.length>0&&(0,t.jsx)(X,{className:"overflow-hidden py-0",children:(0,t.jsx)(Z,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"us-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(q,{children:[(0,t.jsx)(U,{children:n("id")}),(0,t.jsx)(U,{children:n("email")}),(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("role")}),(0,t.jsx)(U,{children:n("status")}),(0,t.jsx)(U,{children:n("verified")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)(Pe,{children:b.map(r=>(0,t.jsxs)(q,{"data-testid":`us-row-${r.id}`,children:[(0,t.jsx)(z,{className:"font-mono text-xs",children:r.id}),(0,t.jsx)(z,{children:r.email??""}),(0,t.jsx)(z,{children:r.name??""}),(0,t.jsx)(z,{children:typeof r.role=="string"&&r.role!==""?(0,t.jsx)(D,{variant:"secondary",children:r.role}):""}),(0,t.jsx)(z,{children:r.banned===!0?(0,t.jsx)(D,{variant:"destructive",children:n("Banned")}):(0,t.jsx)(D,{variant:"success",children:n("Active")})}),(0,t.jsx)(z,{children:r.emailVerified===!0?(0,t.jsx)(D,{variant:"success",children:n("yes")}):(0,t.jsx)(D,{variant:"outline",children:n("no")})}),(0,t.jsx)(z,{className:"text-muted-foreground tabular-nums",children:te(r.createdAt)}),(0,t.jsx)(z,{children:(0,t.jsx)(_,{"data-testid":`us-manage-${r.id}`,onClick:s(()=>{w(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Manage")})})]},r.id))})]})})}),b!==null&&(0,t.jsx)(Je,{count:b.length,offset:m.data?.offset??0,onOffsetChange:u,pageSize:h,prefix:"us",total:m.data?.total}),f!==null&&(0,t.jsx)(kt,{capabilities:k,onChanged:N,onClose:s(()=>{w(null)},"onClose"),user:f}),g&&(0,t.jsx)(ht,{onClose:s(()=>{I(!1)},"onClose"),onCreated:N}),k.inviteOnly&&(0,t.jsx)(ot,{})]})},"jt");export{Vt as UsersPanel};
@@ -1 +1 @@
1
- import{b as i,j as a}from"./chunk-YUVGMKHG.js";import{a as o}from"./chunk-ZPQBVYNN.js";import{x as n}from"./chunk-HYNCYK4O.js";import{a as r}from"./chunk-5PEAXTYQ.js";function s(e){return a(e.defaultTagName??"div",e,e)}r(s,"useRender");var g=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-none border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive font-mono text-[11px] tracking-wide uppercase focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline",success:"bg-success/10 text-success font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-success/15 dark:bg-success/15",warning:"bg-warning/10 text-warning font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-warning/15 dark:bg-warning/15",info:"bg-info/10 text-info font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-info/15 dark:bg-info/15"}},defaultVariants:{variant:"default"}});function x({className:e,variant:t="default",render:d,...u}){return s({defaultTagName:"span",props:i({className:n(g({variant:t}),e)},u),render:d,state:{slot:"badge",variant:t}})}r(x,"f");export{s as a,x as b};
1
+ import{b as i,j as a}from"./chunk-YUVGMKHG.js";import{a as o}from"./chunk-ZPQBVYNN.js";import{x as n}from"./chunk-PUK3H4RN.js";import{a as r}from"./chunk-5PEAXTYQ.js";function s(e){return a(e.defaultTagName??"div",e,e)}r(s,"useRender");var g=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-none border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pe-1.5 has-data-[icon=inline-start]:ps-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive font-mono text-[11px] tracking-wide uppercase focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline",success:"bg-success/10 text-success font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-success/15 dark:bg-success/15",warning:"bg-warning/10 text-warning font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-warning/15 dark:bg-warning/15",info:"bg-info/10 text-info font-mono text-[11px] tracking-wide uppercase [a]:hover:bg-info/15 dark:bg-info/15"}},defaultVariants:{variant:"default"}});function x({className:e,variant:t="default",render:d,...u}){return s({defaultTagName:"span",props:i({className:n(g({variant:t}),e)},u),render:d,state:{slot:"badge",variant:t}})}r(x,"f");export{s as a,x as b};
@@ -1 +1 @@
1
- import{a as d}from"./chunk-G2ER6ZFN.js";import{a as S}from"./chunk-GWNGVKLG.js";import{a as P,b as G}from"./chunk-6G3E4PJ2.js";import{a as m,d as w}from"./chunk-5PEAXTYQ.js";var M=w(S(),1),v=w(P(),1);var N=w(G(),1);var z=m(r=>{let t=(0,M.c)(18),{count:a,offset:e,onOffsetChange:f,pageSize:o,prefix:s,total:n}=r;if(n===void 0)return null;let c=Math.max(0,Math.floor((n-1)/o)*o),p=e+a<n,x=e>0,i;t[0]!==e||t[1]!==f||t[2]!==o?(i=m(()=>{f(e+o)},"r"),t[0]=e,t[1]=f,t[2]=o,t[3]=i):i=t[3];let l;t[4]!==c||t[5]!==e||t[6]!==f||t[7]!==o?(l=m(()=>{f(Math.max(0,Math.min(e-o,c)))},"l"),t[4]=c,t[5]=e,t[6]=f,t[7]=o,t[8]=l):l=t[8];let h=a===0?0:e+a,g=a===0?0:e+1,u;return t[9]!==s||t[10]!==p||t[11]!==x||t[12]!==i||t[13]!==l||t[14]!==h||t[15]!==g||t[16]!==n?(u=(0,N.jsx)(d,{hasNext:p,hasPrevious:x,onNext:i,onPrevious:l,prefix:s,rangeEnd:h,rangeStart:g,total:n}),t[9]=s,t[10]=p,t[11]=x,t[12]=i,t[13]=l,t[14]=h,t[15]=g,t[16]=n,t[17]=u):u=t[17],u},"G"),A=m(r=>{let t=(0,M.c)(7),a;t[0]!==r?(a={offset:0,owner:r},t[0]=r,t[1]=a):a=t[1];let[e,f]=(0,v.useState)(a);e.owner!==r&&f({offset:0,owner:r});let o=e.owner===r?e.offset:0,s;t[2]!==r?(s=m(c=>{f({offset:c,owner:r})},"a"),t[2]=r,t[3]=s):s=t[3];let n;return t[4]!==o||t[5]!==s?(n=[o,s],t[4]=o,t[5]=s,t[6]=n):n=t[6],n},"N");export{z as a,A as b};
1
+ import{a as d}from"./chunk-JAAXDIR5.js";import{a as S}from"./chunk-GWNGVKLG.js";import{a as P,b as G}from"./chunk-6G3E4PJ2.js";import{a as m,d as w}from"./chunk-5PEAXTYQ.js";var M=w(S(),1),v=w(P(),1);var N=w(G(),1);var z=m(r=>{let t=(0,M.c)(18),{count:a,offset:e,onOffsetChange:f,pageSize:o,prefix:s,total:n}=r;if(n===void 0)return null;let c=Math.max(0,Math.floor((n-1)/o)*o),p=e+a<n,x=e>0,i;t[0]!==e||t[1]!==f||t[2]!==o?(i=m(()=>{f(e+o)},"r"),t[0]=e,t[1]=f,t[2]=o,t[3]=i):i=t[3];let l;t[4]!==c||t[5]!==e||t[6]!==f||t[7]!==o?(l=m(()=>{f(Math.max(0,Math.min(e-o,c)))},"l"),t[4]=c,t[5]=e,t[6]=f,t[7]=o,t[8]=l):l=t[8];let h=a===0?0:e+a,g=a===0?0:e+1,u;return t[9]!==s||t[10]!==p||t[11]!==x||t[12]!==i||t[13]!==l||t[14]!==h||t[15]!==g||t[16]!==n?(u=(0,N.jsx)(d,{hasNext:p,hasPrevious:x,onNext:i,onPrevious:l,prefix:s,rangeEnd:h,rangeStart:g,total:n}),t[9]=s,t[10]=p,t[11]=x,t[12]=i,t[13]=l,t[14]=h,t[15]=g,t[16]=n,t[17]=u):u=t[17],u},"G"),A=m(r=>{let t=(0,M.c)(7),a;t[0]!==r?(a={offset:0,owner:r},t[0]=r,t[1]=a):a=t[1];let[e,f]=(0,v.useState)(a);e.owner!==r&&f({offset:0,owner:r});let o=e.owner===r?e.offset:0,s;t[2]!==r?(s=m(c=>{f({offset:c,owner:r})},"a"),t[2]=r,t[3]=s):s=t[3];let n;return t[4]!==o||t[5]!==s?(n=[o,s],t[4]=o,t[5]=s,t[6]=n):n=t[6],n},"N");export{z as a,A as b};