@lunora/studio 1.0.0-alpha.190 → 1.0.0-alpha.192

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 (61) hide show
  1. package/dist/standalone/{chunk-UAMGVADC.js → chunk-2AF4GGEA.js} +1 -1
  2. package/dist/standalone/{chunk-GSVZDPHS.js → chunk-3GCIAIU7.js} +1 -1
  3. package/dist/standalone/{chunk-H6Y5JYSG.js → chunk-4FU34V26.js} +1 -1
  4. package/dist/standalone/{chunk-3GNAY2MJ.js → chunk-4HQT6J46.js} +1 -1
  5. package/dist/standalone/{chunk-HKALXRQ5.js → chunk-5CYMRJFC.js} +1 -1
  6. package/dist/standalone/{chunk-LAT7MUQV.js → chunk-5EK5T7RB.js} +1 -1
  7. package/dist/standalone/{chunk-VTPGX4ZT.js → chunk-5XNZA4MW.js} +1 -1
  8. package/dist/standalone/{chunk-WQLNHY3B.js → chunk-6QALZUGH.js} +1 -1
  9. package/dist/standalone/{chunk-CCRIC2PX.js → chunk-6RZCYIZU.js} +1 -1
  10. package/dist/standalone/{chunk-MRZ7CD3T.js → chunk-7AQCWKWG.js} +1 -1
  11. package/dist/standalone/{chunk-WE3N45LG.js → chunk-7K43USMU.js} +1 -1
  12. package/dist/standalone/{chunk-NID5AZAR.js → chunk-7QWIQTB5.js} +1 -1
  13. package/dist/standalone/{chunk-6XL3S5RE.js → chunk-B4IBO353.js} +1 -1
  14. package/dist/standalone/{chunk-QBXHU32E.js → chunk-BP52IAS7.js} +1 -1
  15. package/dist/standalone/{chunk-LV2OBCJS.js → chunk-C2JOSUSU.js} +1 -1
  16. package/dist/standalone/chunk-C6T7K5XP.js +1 -0
  17. package/dist/standalone/{chunk-LV6N3H5U.js → chunk-CUZYSM3T.js} +1 -1
  18. package/dist/standalone/{chunk-Q5U22R2E.js → chunk-D4WPZ74S.js} +1 -1
  19. package/dist/standalone/{chunk-QJNVJU5I.js → chunk-DLGCUCVF.js} +1 -1
  20. package/dist/standalone/{chunk-46CZEK2Q.js → chunk-DRCZCSQB.js} +1 -1
  21. package/dist/standalone/{chunk-YWROJNX3.js → chunk-ECXGTUEB.js} +1 -1
  22. package/dist/standalone/{chunk-2H24GTUC.js → chunk-EG4LQXMU.js} +1 -1
  23. package/dist/standalone/{chunk-IMKTN66X.js → chunk-G7CZLXHG.js} +1 -1
  24. package/dist/standalone/{chunk-QY766ZKO.js → chunk-GCK3ETRI.js} +1 -1
  25. package/dist/standalone/{chunk-6UWFARCM.js → chunk-GRRBDTHN.js} +1 -1
  26. package/dist/standalone/{chunk-P62LO76E.js → chunk-HJDUAPFN.js} +1 -1
  27. package/dist/standalone/{chunk-TACXQS76.js → chunk-HSLBRVXG.js} +1 -1
  28. package/dist/standalone/{chunk-GG2N7OO3.js → chunk-IEAB4WIW.js} +1 -1
  29. package/dist/standalone/{chunk-AALNIR3V.js → chunk-IGAZPEWG.js} +1 -1
  30. package/dist/standalone/{chunk-X74DHIA3.js → chunk-JAV5E2US.js} +1 -1
  31. package/dist/standalone/{chunk-BXSJ3MOM.js → chunk-JSLOLQVJ.js} +1 -1
  32. package/dist/standalone/{chunk-OUDWIUT7.js → chunk-JSZ62DJR.js} +1 -1
  33. package/dist/standalone/{chunk-5WUSR5UW.js → chunk-JYLNU6LY.js} +1 -1
  34. package/dist/standalone/{chunk-KEBHEIFH.js → chunk-KWMJBXDT.js} +1 -1
  35. package/dist/standalone/{chunk-ZJ4U2EWG.js → chunk-L2ELGA6G.js} +1 -1
  36. package/dist/standalone/{chunk-E2YWM2QN.js → chunk-LRMAKQ5D.js} +1 -1
  37. package/dist/standalone/{chunk-B5N47BXE.js → chunk-MRWNURCB.js} +1 -1
  38. package/dist/standalone/{chunk-5IHQJLV7.js → chunk-MW53Q7VM.js} +1 -1
  39. package/dist/standalone/{chunk-4IUB2OTN.js → chunk-N6YASDC6.js} +1 -1
  40. package/dist/standalone/{chunk-RSDM6WG5.js → chunk-NC36545D.js} +1 -1
  41. package/dist/standalone/{chunk-YBQUFWZB.js → chunk-NFVUUGI3.js} +1 -1
  42. package/dist/standalone/{chunk-746WMHVP.js → chunk-NW4UH6A5.js} +1 -1
  43. package/dist/standalone/{chunk-IWRLEQ72.js → chunk-OHUMFJGU.js} +1 -1
  44. package/dist/standalone/{chunk-4NRXTCX2.js → chunk-PFZ6PDDU.js} +1 -1
  45. package/dist/standalone/{chunk-SSERHMYQ.js → chunk-Q3OLT6HU.js} +1 -1
  46. package/dist/standalone/{chunk-JTDNWSOY.js → chunk-QDDROCW4.js} +1 -1
  47. package/dist/standalone/{chunk-CEQOKOTY.js → chunk-QU6JE7AF.js} +1 -1
  48. package/dist/standalone/{chunk-IPCE6QOA.js → chunk-RFYWIDZ7.js} +1 -1
  49. package/dist/standalone/{chunk-YHFTNPS2.js → chunk-S3GSNPBN.js} +1 -1
  50. package/dist/standalone/{chunk-NZCQC5YS.js → chunk-SDL7ZG4U.js} +1 -1
  51. package/dist/standalone/{chunk-PHCXSS6I.js → chunk-SRKHI5NE.js} +1 -1
  52. package/dist/standalone/{chunk-BLQN7VBN.js → chunk-TPW3FSXD.js} +1 -1
  53. package/dist/standalone/{chunk-M4XQHWSJ.js → chunk-UFIIJHJT.js} +1 -1
  54. package/dist/standalone/{chunk-SS2SI65S.js → chunk-WQSJGN7Q.js} +1 -1
  55. package/dist/standalone/chunk-YUZWAZ35.js +11 -0
  56. package/dist/standalone/{chunk-DDHH7VHP.js → chunk-Z6724PLT.js} +1 -1
  57. package/dist/standalone/{chunk-JXIPB43K.js → chunk-ZSGHAK2D.js} +1 -1
  58. package/dist/standalone/studio.js +1 -1
  59. package/package.json +4 -4
  60. package/dist/standalone/chunk-EJYDHEAO.js +0 -11
  61. package/dist/standalone/chunk-EY7RT4YO.js +0 -1
@@ -1 +1 @@
1
- import{b as de}from"./chunk-UYEZR3BI.js";import{a as te,b as re,c as ne}from"./chunk-Q4CAKBWN.js";import"./chunk-OKG3HWSJ.js";import{b as Y}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as ae}from"./chunk-5IHQJLV7.js";import"./chunk-ULIQFBZU.js";import"./chunk-QY766ZKO.js";import"./chunk-35DM4JJG.js";import{a as ee}from"./chunk-4ZEL6BYL.js";import{c as Z}from"./chunk-M4XQHWSJ.js";import"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as le,b as oe,c as se,d as H,e as z,f as G}from"./chunk-HEAQVSNS.js";import{a as P,e as q}from"./chunk-WUWBZPUK.js";import{d as X}from"./chunk-FODLDLE2.js";import{a as g,d as W,f as ce,g as me}from"./chunk-YKXDMIHQ.js";var J=W(ce(),1);var t=W(me(),1);var ue={binding:"outline",secret:"destructive",var:"secondary"},pe=g((n,e)=>{if(n===void 0)return[];let u=[];return n.workerUrl!==void 0&&u.push({label:e("URL"),value:n.workerUrl}),n.environment!==void 0&&u.push({label:e("Environment"),value:n.environment}),n.deploymentId!==void 0&&u.push({label:e("Deployment"),value:n.deploymentId}),n.versionTag!==void 0&&u.push({label:e("Version"),value:n.versionTag}),u},"ce"),ie=g(n=>{let e=(0,J.c)(18),{modifier:u,name:r,label:p}=n,A=te(),x;e[0]!==r?(x=g(o=>{if(!["Escape","Tab"].includes(o.key)){if(o.shiftKey){o.preventDefault();return}o.preventDefault(),re(r,o.key)}},"b"),e[0]=r,e[1]=x):x=e[1];let i=x,c=`set-shortcut-${r}`,m;e[2]!==p?(m=(0,t.jsx)("dt",{className:"text-muted-foreground",children:p}),e[2]=p,e[3]=m):m=e[3];let h;e[4]!==u?(h=(0,t.jsx)("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:u}),e[4]=u,e[5]=h):h=e[5];let l=`set-shortcut-input-${r}`,f=A[r],s;e[6]!==p||e[7]!==i||e[8]!==l||e[9]!==f?(s=(0,t.jsx)("input",{"aria-label":p,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":l,onKeyDown:i,readOnly:!0,value:f}),e[6]=p,e[7]=i,e[8]=l,e[9]=f,e[10]=s):s=e[10];let a;e[11]!==h||e[12]!==s?(a=(0,t.jsxs)("dd",{className:"flex items-center gap-1.5",children:[h,s]}),e[11]=h,e[12]=s,e[13]=a):a=e[13];let d;return e[14]!==c||e[15]!==m||e[16]!==a?(d=(0,t.jsxs)("div",{className:"contents","data-testid":c,children:[m,a]}),e[14]=c,e[15]=m,e[16]=a,e[17]=d):d=e[17],d},"z"),Se=g(n=>{let e=(0,J.c)(85),{initialShardKey:u}=n,r=X(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let A=u??"",x;e[1]!==A?(x={shardKey:A},e[1]=A,e[2]=x):x=e[2];let{data:i,error:c,errorSource:m,isLoading:h}=Z(ee.getSettings,p,x),l,f,s,a,d,o,b;if(e[3]!==c||e[4]!==m||e[5]!==i?.deploy||e[6]!==i?.settings||e[7]!==r){let Q=pe(i?.deploy,r),M;e[15]!==i?.settings?(M=i?.settings??[],e[15]=i?.settings,e[16]=M):M=e[16],l=M,f="flex flex-col gap-4",s="lunora-settings";let V;e[17]!==r?(V=r("Open in Cloudflare"),e[17]=r,e[18]=V):V=e[18],e[19]!==V?(a=(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:de,rel:"noreferrer",target:"_blank",children:V})}),e[19]=V,e[20]=a):a=e[20];let $;e[21]!==r?($=r("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=r,e[22]=$):$=e[22],e[23]!==$?(d=(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:$}),e[23]=$,e[24]=d):d=e[24],e[25]!==c||e[26]!==m?(o=c!==null&&(0,t.jsx)(ae,{error:m,testId:"set-error"}),e[25]=c,e[26]=m,e[27]=o):o=e[27],b=Q.length>0&&(0,t.jsxs)(P,{className:"py-0","data-testid":"set-deploy",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:r("Deployment")})}),(0,t.jsx)(q,{className:"py-3",children:(0,t.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:Q.map(he)})})]}),e[3]=c,e[4]=m,e[5]=i?.deploy,e[6]=i?.settings,e[7]=r,e[8]=l,e[9]=f,e[10]=s,e[11]=a,e[12]=d,e[13]=o,e[14]=b}else l=e[8],f=e[9],s=e[10],a=e[11],d=e[12],o=e[13],b=e[14];let y;e[28]!==r?(y=r("Keyboard shortcuts"),e[28]=r,e[29]=y):y=e[29];let v;e[30]!==y?(v=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y}),e[30]=y,e[31]=v):v=e[31];let N;e[32]!==r?(N=r("Reset"),e[32]=r,e[33]=N):N=e[33];let k;e[34]!==N?(k=(0,t.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:ne,type:"button",children:N}),e[34]=N,e[35]=k):k=e[35];let w;e[36]!==v||e[37]!==k?(w=(0,t.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[v,k]}),e[36]=v,e[37]=k,e[38]=w):w=e[38];let C;e[39]!==r?(C=r("Command palette"),e[39]=r,e[40]=C):C=e[40];let S;e[41]!==C?(S=(0,t.jsx)(ie,{label:C,modifier:"\u2318/Ctrl",name:"palette"}),e[41]=C,e[42]=S):S=e[42];let T;e[43]!==r?(T=r("Operation console"),e[43]=r,e[44]=T):T=e[44];let D;e[45]!==T?(D=(0,t.jsx)(ie,{label:T,modifier:"Ctrl",name:"console"}),e[45]=T,e[46]=D):D=e[46];let _;e[47]!==S||e[48]!==D?(_=(0,t.jsxs)("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[S,D]}),e[47]=S,e[48]=D,e[49]=_):_=e[49];let E;e[50]!==r?(E=r("Stored in this browser. Focus a box and press a key to rebind it."),e[50]=r,e[51]=E):E=e[51];let I;e[52]!==E?(I=(0,t.jsx)("p",{className:"pt-3 text-xs text-muted-foreground",children:E}),e[52]=E,e[53]=I):I=e[53];let K;e[54]!==_||e[55]!==I?(K=(0,t.jsxs)(q,{className:"py-3",children:[_,I]}),e[54]=_,e[55]=I,e[56]=K):K=e[56];let O;e[57]!==w||e[58]!==K?(O=(0,t.jsxs)(P,{className:"py-0","data-testid":"set-preferences",children:[w,K]}),e[57]=w,e[58]=K,e[59]=O):O=e[59];let U;e[60]!==r?(U=r("Environment & bindings"),e[60]=r,e[61]=U):U=e[61];let j;e[62]!==U?(j=(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:U})}),e[62]=U,e[63]=j):j=e[63];let F;e[64]!==c||e[65]!==h||e[66]!==l.length||e[67]!==r?(F=c===null&&!h&&l.length===0&&(0,t.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:r("No environment variables or bindings.")}),e[64]=c,e[65]=h,e[66]=l.length,e[67]=r,e[68]=F):F=e[68];let L;e[69]!==l||e[70]!==r?(L=l.length>0&&(0,t.jsx)(q,{className:"px-0 py-0",children:(0,t.jsxs)(le,{"data-testid":"set-table",children:[(0,t.jsx)(oe,{children:(0,t.jsxs)(H,{children:[(0,t.jsx)(z,{children:r("name")}),(0,t.jsx)(z,{children:r("kind")}),(0,t.jsx)(z,{children:r("value")})]})}),(0,t.jsx)(se,{children:l.map(fe)})]})}),e[69]=l,e[70]=r,e[71]=L):L=e[71];let R;e[72]!==j||e[73]!==F||e[74]!==L?(R=(0,t.jsxs)(P,{className:"py-0",children:[j,F,L]}),e[72]=j,e[73]=F,e[74]=L,e[75]=R):R=e[75];let B;return e[76]!==O||e[77]!==R||e[78]!==f||e[79]!==s||e[80]!==a||e[81]!==d||e[82]!==o||e[83]!==b?(B=(0,t.jsxs)("div",{className:f,"data-testid":s,children:[a,d,o,b,O,R]}),e[76]=O,e[77]=R,e[78]=f,e[79]=s,e[80]=a,e[81]=d,e[82]=o,e[83]=b,e[84]=B):B=e[84],B},"Ce");function he(n){return(0,t.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:n.label}),(0,t.jsx)("dd",{className:"truncate font-mono text-xs",title:n.value,children:n.value})]},n.label)}g(he,"me");function fe(n){return(0,t.jsxs)(H,{"data-testid":"set-row",children:[(0,t.jsx)(G,{className:"font-mono text-xs font-medium",children:n.name}),(0,t.jsx)(G,{children:(0,t.jsx)(Y,{variant:ue[n.kind],children:n.bindingType??n.kind})}),(0,t.jsx)(G,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:n.value??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},n.name)}g(fe,"fe");export{Se as SettingsPanel};
1
+ import{b as de}from"./chunk-UYEZR3BI.js";import{a as te,b as re,c as ne}from"./chunk-Q4CAKBWN.js";import"./chunk-OKG3HWSJ.js";import{b as Y}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as ae}from"./chunk-MW53Q7VM.js";import"./chunk-ULIQFBZU.js";import"./chunk-GCK3ETRI.js";import"./chunk-35DM4JJG.js";import{a as ee}from"./chunk-4ZEL6BYL.js";import{c as Z}from"./chunk-UFIIJHJT.js";import"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as le,b as oe,c as se,d as H,e as z,f as G}from"./chunk-HEAQVSNS.js";import{a as P,e as q}from"./chunk-WUWBZPUK.js";import{d as X}from"./chunk-FODLDLE2.js";import{a as g,d as W,f as ce,g as me}from"./chunk-YKXDMIHQ.js";var J=W(ce(),1);var t=W(me(),1);var ue={binding:"outline",secret:"destructive",var:"secondary"},pe=g((n,e)=>{if(n===void 0)return[];let u=[];return n.workerUrl!==void 0&&u.push({label:e("URL"),value:n.workerUrl}),n.environment!==void 0&&u.push({label:e("Environment"),value:n.environment}),n.deploymentId!==void 0&&u.push({label:e("Deployment"),value:n.deploymentId}),n.versionTag!==void 0&&u.push({label:e("Version"),value:n.versionTag}),u},"ce"),ie=g(n=>{let e=(0,J.c)(18),{modifier:u,name:r,label:p}=n,A=te(),x;e[0]!==r?(x=g(o=>{if(!["Escape","Tab"].includes(o.key)){if(o.shiftKey){o.preventDefault();return}o.preventDefault(),re(r,o.key)}},"b"),e[0]=r,e[1]=x):x=e[1];let i=x,c=`set-shortcut-${r}`,m;e[2]!==p?(m=(0,t.jsx)("dt",{className:"text-muted-foreground",children:p}),e[2]=p,e[3]=m):m=e[3];let h;e[4]!==u?(h=(0,t.jsx)("kbd",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:u}),e[4]=u,e[5]=h):h=e[5];let l=`set-shortcut-input-${r}`,f=A[r],s;e[6]!==p||e[7]!==i||e[8]!==l||e[9]!==f?(s=(0,t.jsx)("input",{"aria-label":p,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":l,onKeyDown:i,readOnly:!0,value:f}),e[6]=p,e[7]=i,e[8]=l,e[9]=f,e[10]=s):s=e[10];let a;e[11]!==h||e[12]!==s?(a=(0,t.jsxs)("dd",{className:"flex items-center gap-1.5",children:[h,s]}),e[11]=h,e[12]=s,e[13]=a):a=e[13];let d;return e[14]!==c||e[15]!==m||e[16]!==a?(d=(0,t.jsxs)("div",{className:"contents","data-testid":c,children:[m,a]}),e[14]=c,e[15]=m,e[16]=a,e[17]=d):d=e[17],d},"z"),Se=g(n=>{let e=(0,J.c)(85),{initialShardKey:u}=n,r=X(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let A=u??"",x;e[1]!==A?(x={shardKey:A},e[1]=A,e[2]=x):x=e[2];let{data:i,error:c,errorSource:m,isLoading:h}=Z(ee.getSettings,p,x),l,f,s,a,d,o,b;if(e[3]!==c||e[4]!==m||e[5]!==i?.deploy||e[6]!==i?.settings||e[7]!==r){let Q=pe(i?.deploy,r),M;e[15]!==i?.settings?(M=i?.settings??[],e[15]=i?.settings,e[16]=M):M=e[16],l=M,f="flex flex-col gap-4",s="lunora-settings";let V;e[17]!==r?(V=r("Open in Cloudflare"),e[17]=r,e[18]=V):V=e[18],e[19]!==V?(a=(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:de,rel:"noreferrer",target:"_blank",children:V})}),e[19]=V,e[20]=a):a=e[20];let $;e[21]!==r?($=r("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[21]=r,e[22]=$):$=e[22],e[23]!==$?(d=(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:$}),e[23]=$,e[24]=d):d=e[24],e[25]!==c||e[26]!==m?(o=c!==null&&(0,t.jsx)(ae,{error:m,testId:"set-error"}),e[25]=c,e[26]=m,e[27]=o):o=e[27],b=Q.length>0&&(0,t.jsxs)(P,{className:"py-0","data-testid":"set-deploy",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:r("Deployment")})}),(0,t.jsx)(q,{className:"py-3",children:(0,t.jsx)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:Q.map(he)})})]}),e[3]=c,e[4]=m,e[5]=i?.deploy,e[6]=i?.settings,e[7]=r,e[8]=l,e[9]=f,e[10]=s,e[11]=a,e[12]=d,e[13]=o,e[14]=b}else l=e[8],f=e[9],s=e[10],a=e[11],d=e[12],o=e[13],b=e[14];let y;e[28]!==r?(y=r("Keyboard shortcuts"),e[28]=r,e[29]=y):y=e[29];let v;e[30]!==y?(v=(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y}),e[30]=y,e[31]=v):v=e[31];let N;e[32]!==r?(N=r("Reset"),e[32]=r,e[33]=N):N=e[33];let k;e[34]!==N?(k=(0,t.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:ne,type:"button",children:N}),e[34]=N,e[35]=k):k=e[35];let w;e[36]!==v||e[37]!==k?(w=(0,t.jsxs)("header",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[v,k]}),e[36]=v,e[37]=k,e[38]=w):w=e[38];let C;e[39]!==r?(C=r("Command palette"),e[39]=r,e[40]=C):C=e[40];let S;e[41]!==C?(S=(0,t.jsx)(ie,{label:C,modifier:"\u2318/Ctrl",name:"palette"}),e[41]=C,e[42]=S):S=e[42];let T;e[43]!==r?(T=r("Operation console"),e[43]=r,e[44]=T):T=e[44];let D;e[45]!==T?(D=(0,t.jsx)(ie,{label:T,modifier:"Ctrl",name:"console"}),e[45]=T,e[46]=D):D=e[46];let _;e[47]!==S||e[48]!==D?(_=(0,t.jsxs)("dl",{className:"grid grid-cols-[10rem_minmax(0,1fr)] items-center gap-x-4 gap-y-2 text-sm",children:[S,D]}),e[47]=S,e[48]=D,e[49]=_):_=e[49];let E;e[50]!==r?(E=r("Stored in this browser. Focus a box and press a key to rebind it."),e[50]=r,e[51]=E):E=e[51];let I;e[52]!==E?(I=(0,t.jsx)("p",{className:"pt-3 text-xs text-muted-foreground",children:E}),e[52]=E,e[53]=I):I=e[53];let K;e[54]!==_||e[55]!==I?(K=(0,t.jsxs)(q,{className:"py-3",children:[_,I]}),e[54]=_,e[55]=I,e[56]=K):K=e[56];let O;e[57]!==w||e[58]!==K?(O=(0,t.jsxs)(P,{className:"py-0","data-testid":"set-preferences",children:[w,K]}),e[57]=w,e[58]=K,e[59]=O):O=e[59];let U;e[60]!==r?(U=r("Environment & bindings"),e[60]=r,e[61]=U):U=e[61];let j;e[62]!==U?(j=(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:U})}),e[62]=U,e[63]=j):j=e[63];let F;e[64]!==c||e[65]!==h||e[66]!==l.length||e[67]!==r?(F=c===null&&!h&&l.length===0&&(0,t.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:r("No environment variables or bindings.")}),e[64]=c,e[65]=h,e[66]=l.length,e[67]=r,e[68]=F):F=e[68];let L;e[69]!==l||e[70]!==r?(L=l.length>0&&(0,t.jsx)(q,{className:"px-0 py-0",children:(0,t.jsxs)(le,{"data-testid":"set-table",children:[(0,t.jsx)(oe,{children:(0,t.jsxs)(H,{children:[(0,t.jsx)(z,{children:r("name")}),(0,t.jsx)(z,{children:r("kind")}),(0,t.jsx)(z,{children:r("value")})]})}),(0,t.jsx)(se,{children:l.map(fe)})]})}),e[69]=l,e[70]=r,e[71]=L):L=e[71];let R;e[72]!==j||e[73]!==F||e[74]!==L?(R=(0,t.jsxs)(P,{className:"py-0",children:[j,F,L]}),e[72]=j,e[73]=F,e[74]=L,e[75]=R):R=e[75];let B;return e[76]!==O||e[77]!==R||e[78]!==f||e[79]!==s||e[80]!==a||e[81]!==d||e[82]!==o||e[83]!==b?(B=(0,t.jsxs)("div",{className:f,"data-testid":s,children:[a,d,o,b,O,R]}),e[76]=O,e[77]=R,e[78]=f,e[79]=s,e[80]=a,e[81]=d,e[82]=o,e[83]=b,e[84]=B):B=e[84],B},"Ce");function he(n){return(0,t.jsxs)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,t.jsx)("dt",{className:"text-muted-foreground",children:n.label}),(0,t.jsx)("dd",{className:"truncate font-mono text-xs",title:n.value,children:n.value})]},n.label)}g(he,"me");function fe(n){return(0,t.jsxs)(H,{"data-testid":"set-row",children:[(0,t.jsx)(G,{className:"font-mono text-xs font-medium",children:n.name}),(0,t.jsx)(G,{children:(0,t.jsx)(Y,{variant:ue[n.kind],children:n.bindingType??n.kind})}),(0,t.jsx)(G,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:n.value??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},n.name)}g(fe,"fe");export{Se as SettingsPanel};
@@ -1 +1 @@
1
- import{a as x}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-M4XQHWSJ.js";import{f as q}from"./chunk-EJYDHEAO.js";import{d as _,f as g,g as y,n as C}from"./chunk-FODLDLE2.js";import{a as u,d as w,e as L,f as T,g as F}from"./chunk-YKXDMIHQ.js";var v=w(L(),1);var j={},A=g(x.aiGenerateSql),I=g(x.aiTableFilter),O=g(x.aiChartConfig),R=u(s=>{let e=q(),[i,d]=(0,v.useState)({}),[n,r]=(0,v.useState)({}),a=S(x.aiAvailable,j,{shardKey:s}),[f,l]=(0,v.useState)(!1),b=f||a.data?.available===!1,p=u(t=>{d(o=>({...o,[t]:!0})),r(o=>({...o,[t]:void 0}))},"i"),h=u((t,o)=>{d(c=>({...c,[t]:!1})),o!==void 0&&r(c=>({...c,[t]:o})),o==="no-ai-binding"&&l(!0)},"a");return{generate:u(async(t,o)=>{p("sql");try{let{result:c}=await e.query(A,{failedError:o?.error,failedSql:o?.sql,prompt:t},y(s));return h("sql",c.degraded?c.reason:void 0),c.degraded?void 0:c.sql}catch{h("sql","ai-error");return}},"generate"),inferChart:u(async t=>{p("chart");try{let{result:o}=await e.query(O,t,y(s));return h("chart",o.degraded?o.reason:void 0),o.degraded?void 0:o.chart}catch{h("chart","ai-error");return}},"inferChart"),pending:u(t=>i[t]===!0,"pending"),reason:u(t=>n[t],"reason"),suggestFilter:u(async(t,o)=>{p("filter");try{let{result:c}=await e.query(I,{prompt:t,table:o},y(s));return h("filter",c.degraded?c.reason:void 0),c.degraded?void 0:c.clauses}catch{h("filter","ai-error");return}},"suggestFilter"),unavailable:b}},"w");var N=w(T(),1);var m=w(F(),1);var G=u((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let i=[],d=s.toLowerCase(),n=e.toLowerCase(),r=0;for(let a=d.indexOf(n);a!==-1;a=d.indexOf(n,r))a>r&&i.push({match:!1,offset:r,text:s.slice(r,a)}),i.push({match:!0,offset:a,text:s.slice(a,a+e.length)}),r=a+e.length;return r<s.length&&i.push({match:!1,offset:r,text:s.slice(r)}),i},"N"),U=u(s=>{let e=(0,N.c)(9),{highlight:i,value:d}=s;if(d==null){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,m.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=l):l=e[0],l}let n,r,a;if(e[1]!==i||e[2]!==d){a=Symbol.for("react.early_return_sentinel");e:{let l=C(d);if(i===void 0||i===""){a=(0,m.jsx)("span",{title:l,children:l});break e}n=l,r=G(l,i).map(z)}e[1]=i,e[2]=d,e[3]=n,e[4]=r,e[5]=a}else n=e[3],r=e[4],a=e[5];if(a!==Symbol.for("react.early_return_sentinel"))return a;let f;return e[6]!==n||e[7]!==r?(f=(0,m.jsx)("span",{title:n,children:r}),e[6]=n,e[7]=r,e[8]=f):f=e[8],f},"v"),Q=u(s=>{let e=(0,N.c)(22),{columns:i,rows:d}=s,n=_(),r;e[0]!==n?(r=n("Field"),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==r?(a=(0,m.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:r}),e[2]=r,e[3]=a):a=e[3];let f;if(e[4]!==d||e[5]!==n){let t;e[7]!==n?(t=u((o,c)=>(0,m.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:n("Row {n}",{n:c+1})},c),"c"),e[7]=n,e[8]=t):t=e[8],f=d.map(t),e[4]=d,e[5]=n,e[6]=f}else f=e[6];let l;e[9]!==a||e[10]!==f?(l=(0,m.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,m.jsxs)("tr",{children:[a,f]})}),e[9]=a,e[10]=f,e[11]=l):l=e[11];let b;if(e[12]!==i||e[13]!==d){let t;e[15]!==d?(t=u(o=>(0,m.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,m.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:o}),d.map((c,k)=>(0,m.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,m.jsx)(U,{value:c[o]})},k))]},o),"c"),e[15]=d,e[16]=t):t=e[16],b=i.map(t),e[12]=i,e[13]=d,e[14]=b}else b=e[14];let p;e[17]!==b?(p=(0,m.jsx)("tbody",{children:b}),e[17]=b,e[18]=p):p=e[18];let h;return e[19]!==l||e[20]!==p?(h=(0,m.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,m.jsxs)("table",{className:"border-collapse text-xs",children:[l,p]})}),e[19]=l,e[20]=p,e[21]=h):h=e[21],h},"T"),V=u(({children:s,layout:e="card",testId:i})=>(0,m.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":i,children:s}),"j");function z(s){return(0,m.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}u(z,"_");export{R as a,U as b,Q as c,V as d};
1
+ import{a as x}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-UFIIJHJT.js";import{f as q}from"./chunk-YUZWAZ35.js";import{d as _,f as g,g as y,n as C}from"./chunk-FODLDLE2.js";import{a as u,d as w,e as L,f as T,g as F}from"./chunk-YKXDMIHQ.js";var v=w(L(),1);var j={},A=g(x.aiGenerateSql),I=g(x.aiTableFilter),O=g(x.aiChartConfig),R=u(s=>{let e=q(),[i,d]=(0,v.useState)({}),[n,r]=(0,v.useState)({}),a=S(x.aiAvailable,j,{shardKey:s}),[f,l]=(0,v.useState)(!1),b=f||a.data?.available===!1,p=u(t=>{d(o=>({...o,[t]:!0})),r(o=>({...o,[t]:void 0}))},"i"),h=u((t,o)=>{d(c=>({...c,[t]:!1})),o!==void 0&&r(c=>({...c,[t]:o})),o==="no-ai-binding"&&l(!0)},"a");return{generate:u(async(t,o)=>{p("sql");try{let{result:c}=await e.query(A,{failedError:o?.error,failedSql:o?.sql,prompt:t},y(s));return h("sql",c.degraded?c.reason:void 0),c.degraded?void 0:c.sql}catch{h("sql","ai-error");return}},"generate"),inferChart:u(async t=>{p("chart");try{let{result:o}=await e.query(O,t,y(s));return h("chart",o.degraded?o.reason:void 0),o.degraded?void 0:o.chart}catch{h("chart","ai-error");return}},"inferChart"),pending:u(t=>i[t]===!0,"pending"),reason:u(t=>n[t],"reason"),suggestFilter:u(async(t,o)=>{p("filter");try{let{result:c}=await e.query(I,{prompt:t,table:o},y(s));return h("filter",c.degraded?c.reason:void 0),c.degraded?void 0:c.clauses}catch{h("filter","ai-error");return}},"suggestFilter"),unavailable:b}},"w");var N=w(T(),1);var m=w(F(),1);var G=u((s,e)=>{if(e==="")return[{match:!1,offset:0,text:s}];let i=[],d=s.toLowerCase(),n=e.toLowerCase(),r=0;for(let a=d.indexOf(n);a!==-1;a=d.indexOf(n,r))a>r&&i.push({match:!1,offset:r,text:s.slice(r,a)}),i.push({match:!0,offset:a,text:s.slice(a,a+e.length)}),r=a+e.length;return r<s.length&&i.push({match:!1,offset:r,text:s.slice(r)}),i},"N"),U=u(s=>{let e=(0,N.c)(9),{highlight:i,value:d}=s;if(d==null){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,m.jsx)("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=l):l=e[0],l}let n,r,a;if(e[1]!==i||e[2]!==d){a=Symbol.for("react.early_return_sentinel");e:{let l=C(d);if(i===void 0||i===""){a=(0,m.jsx)("span",{title:l,children:l});break e}n=l,r=G(l,i).map(z)}e[1]=i,e[2]=d,e[3]=n,e[4]=r,e[5]=a}else n=e[3],r=e[4],a=e[5];if(a!==Symbol.for("react.early_return_sentinel"))return a;let f;return e[6]!==n||e[7]!==r?(f=(0,m.jsx)("span",{title:n,children:r}),e[6]=n,e[7]=r,e[8]=f):f=e[8],f},"v"),Q=u(s=>{let e=(0,N.c)(22),{columns:i,rows:d}=s,n=_(),r;e[0]!==n?(r=n("Field"),e[0]=n,e[1]=r):r=e[1];let a;e[2]!==r?(a=(0,m.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:r}),e[2]=r,e[3]=a):a=e[3];let f;if(e[4]!==d||e[5]!==n){let t;e[7]!==n?(t=u((o,c)=>(0,m.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:n("Row {n}",{n:c+1})},c),"c"),e[7]=n,e[8]=t):t=e[8],f=d.map(t),e[4]=d,e[5]=n,e[6]=f}else f=e[6];let l;e[9]!==a||e[10]!==f?(l=(0,m.jsx)("thead",{className:"sticky top-0 z-10 bg-muted",children:(0,m.jsxs)("tr",{children:[a,f]})}),e[9]=a,e[10]=f,e[11]=l):l=e[11];let b;if(e[12]!==i||e[13]!==d){let t;e[15]!==d?(t=u(o=>(0,m.jsxs)("tr",{className:"hover:bg-muted/40",children:[(0,m.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:o}),d.map((c,k)=>(0,m.jsx)("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:(0,m.jsx)(U,{value:c[o]})},k))]},o),"c"),e[15]=d,e[16]=t):t=e[16],b=i.map(t),e[12]=i,e[13]=d,e[14]=b}else b=e[14];let p;e[17]!==b?(p=(0,m.jsx)("tbody",{children:b}),e[17]=b,e[18]=p):p=e[18];let h;return e[19]!==l||e[20]!==p?(h=(0,m.jsx)("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:(0,m.jsxs)("table",{className:"border-collapse text-xs",children:[l,p]})}),e[19]=l,e[20]=p,e[21]=h):h=e[21],h},"T"),V=u(({children:s,layout:e="card",testId:i})=>(0,m.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":i,children:s}),"j");function z(s){return(0,m.jsx)("mark",{className:s.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:s.text},s.offset)}u(z,"_");export{R as a,U as b,Q as c,V as d};
@@ -1 +1 @@
1
- import{d as k}from"./chunk-YOB2X3FZ.js";import{a as j}from"./chunk-66UGPQVC.js";import{a as _}from"./chunk-P62LO76E.js";import"./chunk-K7AJEMKE.js";import"./chunk-6D6Z2KXU.js";import"./chunk-Y6CXU7T4.js";import"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as g}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as E}from"./chunk-5IHQJLV7.js";import"./chunk-ULIQFBZU.js";import"./chunk-QY766ZKO.js";import"./chunk-35DM4JJG.js";import{a as y}from"./chunk-4ZEL6BYL.js";import{c as b}from"./chunk-M4XQHWSJ.js";import"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as w}from"./chunk-FKVZRPV5.js";import{a as I,b as R,c as A,d as v,e as l,f as n}from"./chunk-HEAQVSNS.js";import{a as f,e as N}from"./chunk-WUWBZPUK.js";import{d as T,r as S}from"./chunk-FODLDLE2.js";import{a as c,d as G,g as H}from"./chunk-YKXDMIHQ.js";var e=G(H(),1);var Q=["subscriptions","events"],U={},B=new Set(["active","trialing"]),V=new Set(["past_due","unpaid"]),s=c((a,t)=>{if(a[t]!==void 0)return a[t];let m=a.__doc__;return typeof m=="string"?k(m)?.[t]:void 0},"n"),i=c(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","a"),q=c(a=>B.has(a)?"default":V.has(a)?"destructive":"outline","G"),se=c(({limit:a=100})=>{let t=T(),m=_(),{data:x}=b(y.listTables,U,{live:!0}),D=x!==void 0,C=Array.isArray(x)&&Q.every(r=>x.some(d=>d.name===r)),p=m.payments&&C,o=b(y.readTablePage,{filters:[],limit:a,offset:0,orderBy:[],search:"",table:"subscriptions"},{enabled:p}),h=b(y.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"},{enabled:p});j(()=>{p&&(o.refetch(),h.refetch())},!0);let u=o.data?.rows??[],O=h.data?.rows??[],F=o.error??h.error,L=o.error===null?h.errorSource:o.errorSource,P=u.filter(r=>B.has(i(s(r,"state")))).length,M=O.toSorted((r,d)=>Number(s(d,"processedAt")??0)-Number(s(r,"processedAt")??0));return D&&!p?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(w,{description:t("No @lunora/payment tables found in this deployment. Declare the store tables (subscriptions, events, \u2026) in lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(f,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:P}),(0,e.jsx)(g,{variant:"default",children:t("{count} active",{count:P})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:u.length})})]})}),F===null?void 0:(0,e.jsx)(E,{error:L}),u.length===0&&!o.isLoading?(0,e.jsx)(w,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(f,{className:"overflow-hidden py-0",children:(0,e.jsx)(N,{className:"px-0",children:(0,e.jsxs)(I,{children:[(0,e.jsx)(R,{children:(0,e.jsxs)(v,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(A,{children:u.map(r=>{let d=i(s(r,"state"));return(0,e.jsxs)(v,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(n,{children:i(s(r,"provider"))}),(0,e.jsx)(n,{children:i(s(r,"referenceId"))}),(0,e.jsx)(n,{children:i(s(r,"priceId"))}),(0,e.jsx)(n,{children:(0,e.jsx)(g,{variant:q(d),children:d})}),(0,e.jsx)(n,{children:S(s(r,"currentPeriodEnd"))})]},i(s(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(f,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(N,{className:"px-0",children:(0,e.jsx)(I,{children:(0,e.jsx)(A,{children:M.map(r=>(0,e.jsxs)(v,{"data-testid":"payment-event-row",children:[(0,e.jsx)(n,{children:i(s(r,"provider"))}),(0,e.jsx)(n,{className:"font-medium",children:i(s(r,"type"))}),(0,e.jsx)(n,{className:"text-muted-foreground",children:i(s(r,"providerEventId"))}),(0,e.jsx)(n,{children:S(s(r,"processedAt"))})]},i(s(r,"providerEventId"))))})})})]})]})},"se");export{se as PaymentsPanel};
1
+ import{d as k}from"./chunk-YOB2X3FZ.js";import{a as j}from"./chunk-66UGPQVC.js";import{a as _}from"./chunk-HJDUAPFN.js";import"./chunk-K7AJEMKE.js";import"./chunk-6D6Z2KXU.js";import"./chunk-Y6CXU7T4.js";import"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as g}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as E}from"./chunk-MW53Q7VM.js";import"./chunk-ULIQFBZU.js";import"./chunk-GCK3ETRI.js";import"./chunk-35DM4JJG.js";import{a as y}from"./chunk-4ZEL6BYL.js";import{c as b}from"./chunk-UFIIJHJT.js";import"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as w}from"./chunk-FKVZRPV5.js";import{a as I,b as R,c as A,d as v,e as l,f as n}from"./chunk-HEAQVSNS.js";import{a as f,e as N}from"./chunk-WUWBZPUK.js";import{d as T,r as S}from"./chunk-FODLDLE2.js";import{a as c,d as G,g as H}from"./chunk-YKXDMIHQ.js";var e=G(H(),1);var Q=["subscriptions","events"],U={},B=new Set(["active","trialing"]),V=new Set(["past_due","unpaid"]),s=c((a,t)=>{if(a[t]!==void 0)return a[t];let m=a.__doc__;return typeof m=="string"?k(m)?.[t]:void 0},"n"),i=c(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","a"),q=c(a=>B.has(a)?"default":V.has(a)?"destructive":"outline","G"),se=c(({limit:a=100})=>{let t=T(),m=_(),{data:x}=b(y.listTables,U,{live:!0}),D=x!==void 0,C=Array.isArray(x)&&Q.every(r=>x.some(d=>d.name===r)),p=m.payments&&C,o=b(y.readTablePage,{filters:[],limit:a,offset:0,orderBy:[],search:"",table:"subscriptions"},{enabled:p}),h=b(y.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"},{enabled:p});j(()=>{p&&(o.refetch(),h.refetch())},!0);let u=o.data?.rows??[],O=h.data?.rows??[],F=o.error??h.error,L=o.error===null?h.errorSource:o.errorSource,P=u.filter(r=>B.has(i(s(r,"state")))).length,M=O.toSorted((r,d)=>Number(s(d,"processedAt")??0)-Number(s(r,"processedAt")??0));return D&&!p?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(w,{description:t("No @lunora/payment tables found in this deployment. Declare the store tables (subscriptions, events, \u2026) in lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(f,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:P}),(0,e.jsx)(g,{variant:"default",children:t("{count} active",{count:P})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:u.length})})]})}),F===null?void 0:(0,e.jsx)(E,{error:L}),u.length===0&&!o.isLoading?(0,e.jsx)(w,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(f,{className:"overflow-hidden py-0",children:(0,e.jsx)(N,{className:"px-0",children:(0,e.jsxs)(I,{children:[(0,e.jsx)(R,{children:(0,e.jsxs)(v,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(A,{children:u.map(r=>{let d=i(s(r,"state"));return(0,e.jsxs)(v,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(n,{children:i(s(r,"provider"))}),(0,e.jsx)(n,{children:i(s(r,"referenceId"))}),(0,e.jsx)(n,{children:i(s(r,"priceId"))}),(0,e.jsx)(n,{children:(0,e.jsx)(g,{variant:q(d),children:d})}),(0,e.jsx)(n,{children:S(s(r,"currentPeriodEnd"))})]},i(s(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(f,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(N,{className:"px-0",children:(0,e.jsx)(I,{children:(0,e.jsx)(A,{children:M.map(r=>(0,e.jsxs)(v,{"data-testid":"payment-event-row",children:[(0,e.jsx)(n,{children:i(s(r,"provider"))}),(0,e.jsx)(n,{className:"font-medium",children:i(s(r,"type"))}),(0,e.jsx)(n,{className:"text-muted-foreground",children:i(s(r,"providerEventId"))}),(0,e.jsx)(n,{children:S(s(r,"processedAt"))})]},i(s(r,"providerEventId"))))})})})]})]})},"se");export{se as PaymentsPanel};
@@ -1 +1 @@
1
- import{W as K}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as Q}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{f as z}from"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as W}from"./chunk-FKVZRPV5.js";import{a as q,b as B,c as L,d as f,e as c,f as d}from"./chunk-HEAQVSNS.js";import{a as I,e as j}from"./chunk-WUWBZPUK.js";import{d as F,h as S,n as Z,o as V}from"./chunk-FODLDLE2.js";import{a as h,d as C,e as U,f as G,g as J}from"./chunk-YKXDMIHQ.js";var A=C(G(),1);var n=C(U(),1);var e=C(J(),1);var X=10,g=h(v=>{let l=(0,A.c)(7),{label:m,value:a}=v,r;l[0]!==m?(r=(0,e.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m}),l[0]=m,l[1]=r):r=l[1];let p=a??"\u2014",s;l[2]!==p?(s=(0,e.jsx)("span",{className:"font-mono text-sm",children:p}),l[2]=p,l[3]=s):s=l[3];let u;return l[4]!==r||l[5]!==s?(u=(0,e.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r,s]}),l[4]=r,l[5]=s,l[6]=u):u=l[6],u},"g"),se=h(({loadIndexes:v,runQuery:l}={})=>{let m=z(),a=F(),[r,p]=(0,n.useState)(null),[s,u]=(0,n.useState)(null),[N,E]=(0,n.useState)(null),[b,D]=(0,n.useState)(""),[x,y]=(0,n.useState)(null),[M,w]=(0,n.useState)(null),[T,$]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let t={cancelled:!1};return V((async()=>{try{let i=await(v??(()=>m.listVectorIndexes()))();t.cancelled||(p(i),u(null),E(k=>k??i[0]?.name??null))}catch(i){t.cancelled||(p(null),u(S(i)))}})()),()=>{t.cancelled=!0}},[m,v]);let o=r?.find(t=>t.name===N)??null,H=h(t=>{E(t.currentTarget.dataset.index??null),y(null),w(null)},"Q"),O=h(t=>{D(t.target.value)},"$"),P=h(async()=>{let t=b.trim();if(!(N===null||t==="")){$(!0),w(null);try{let i=await(l??(k=>m.queryVectorIndex(k)))({name:N,text:t,topK:X});y(i)}catch(i){y(null),w(S(i))}$(!1)}},"A"),R=h(()=>{V(P())},"D");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[s!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:s}),r!==null&&r.length===0&&(0,e.jsx)(W,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear 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:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:a("No vector indexes.")}),r!==null&&r.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-table",children:[(0,e.jsx)(B,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:a("name")}),(0,e.jsx)(c,{children:a("table")}),(0,e.jsx)(c,{children:a("dimensions")}),(0,e.jsx)(c,{children:a("metric")}),(0,e.jsx)(c,{children:a("vectors")})]})}),(0,e.jsx)(L,{children:r.map(t=>(0,e.jsxs)(f,{className:t.name===N?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:H,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.table}),(0,e.jsx)(d,{className:"tabular-nums",children:t.dimensions??"\u2014"}),(0,e.jsx)(d,{children:t.metric??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:t.vectorsCount??"\u2014"})]},t.name))})]})})}),o!==null&&(0,e.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsx)(g,{label:a("field"),value:o.field}),(0,e.jsx)(g,{label:a("dimensions"),value:o.dimensions}),(0,e.jsx)(g,{label:a("metric"),value:o.metric}),(0,e.jsx)(g,{label:a("vectors"),value:o.vectorsCount})]}),o.metadata!==void 0&&o.metadata.length>0&&(0,e.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsx)("span",{className:"font-mono",children:o.metadata.join(", ")})]}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsx)(K,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:O,placeholder:a("Search by similarity\u2026"),value:b}),(0,e.jsx)(Q,{"data-testid":"vector-search",disabled:T||b.trim()==="",onClick:R,children:a(T?"Searching\u2026":"Search")})]}),M!==null&&(0,e.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M}),x!==null&&x.length===0&&(0,e.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")}),x!==null&&x.length>0&&(0,e.jsx)(I,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-matches",children:[(0,e.jsx)(B,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:a("id")}),(0,e.jsx)(c,{children:a("score")}),(0,e.jsx)(c,{children:a("metadata")})]})}),(0,e.jsx)(L,{children:x.map(t=>(0,e.jsxs)(f,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.id}),(0,e.jsx)(d,{className:"tabular-nums",children:t.score.toFixed(4)}),(0,e.jsx)(d,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":Z(t.metadata)})]},t.id))})]})})})]})]})},"se");export{se as VectorBrowser};
1
+ import{W as K}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as Q}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import{f as z}from"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as W}from"./chunk-FKVZRPV5.js";import{a as q,b as B,c as L,d as f,e as c,f as d}from"./chunk-HEAQVSNS.js";import{a as I,e as j}from"./chunk-WUWBZPUK.js";import{d as F,h as S,n as Z,o as V}from"./chunk-FODLDLE2.js";import{a as h,d as C,e as U,f as G,g as J}from"./chunk-YKXDMIHQ.js";var A=C(G(),1);var n=C(U(),1);var e=C(J(),1);var X=10,g=h(v=>{let l=(0,A.c)(7),{label:m,value:a}=v,r;l[0]!==m?(r=(0,e.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m}),l[0]=m,l[1]=r):r=l[1];let p=a??"\u2014",s;l[2]!==p?(s=(0,e.jsx)("span",{className:"font-mono text-sm",children:p}),l[2]=p,l[3]=s):s=l[3];let u;return l[4]!==r||l[5]!==s?(u=(0,e.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r,s]}),l[4]=r,l[5]=s,l[6]=u):u=l[6],u},"g"),se=h(({loadIndexes:v,runQuery:l}={})=>{let m=z(),a=F(),[r,p]=(0,n.useState)(null),[s,u]=(0,n.useState)(null),[N,E]=(0,n.useState)(null),[b,D]=(0,n.useState)(""),[x,y]=(0,n.useState)(null),[M,w]=(0,n.useState)(null),[T,$]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let t={cancelled:!1};return V((async()=>{try{let i=await(v??(()=>m.listVectorIndexes()))();t.cancelled||(p(i),u(null),E(k=>k??i[0]?.name??null))}catch(i){t.cancelled||(p(null),u(S(i)))}})()),()=>{t.cancelled=!0}},[m,v]);let o=r?.find(t=>t.name===N)??null,H=h(t=>{E(t.currentTarget.dataset.index??null),y(null),w(null)},"Q"),O=h(t=>{D(t.target.value)},"$"),P=h(async()=>{let t=b.trim();if(!(N===null||t==="")){$(!0),w(null);try{let i=await(l??(k=>m.queryVectorIndex(k)))({name:N,text:t,topK:X});y(i)}catch(i){y(null),w(S(i))}$(!1)}},"A"),R=h(()=>{V(P())},"D");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[s!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:s}),r!==null&&r.length===0&&(0,e.jsx)(W,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear 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:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:a("No vector indexes.")}),r!==null&&r.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-table",children:[(0,e.jsx)(B,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:a("name")}),(0,e.jsx)(c,{children:a("table")}),(0,e.jsx)(c,{children:a("dimensions")}),(0,e.jsx)(c,{children:a("metric")}),(0,e.jsx)(c,{children:a("vectors")})]})}),(0,e.jsx)(L,{children:r.map(t=>(0,e.jsxs)(f,{className:t.name===N?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:H,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.table}),(0,e.jsx)(d,{className:"tabular-nums",children:t.dimensions??"\u2014"}),(0,e.jsx)(d,{children:t.metric??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:t.vectorsCount??"\u2014"})]},t.name))})]})})}),o!==null&&(0,e.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsx)(g,{label:a("field"),value:o.field}),(0,e.jsx)(g,{label:a("dimensions"),value:o.dimensions}),(0,e.jsx)(g,{label:a("metric"),value:o.metric}),(0,e.jsx)(g,{label:a("vectors"),value:o.vectorsCount})]}),o.metadata!==void 0&&o.metadata.length>0&&(0,e.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsx)("span",{className:"font-mono",children:o.metadata.join(", ")})]}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsx)(K,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:O,placeholder:a("Search by similarity\u2026"),value:b}),(0,e.jsx)(Q,{"data-testid":"vector-search",disabled:T||b.trim()==="",onClick:R,children:a(T?"Searching\u2026":"Search")})]}),M!==null&&(0,e.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M}),x!==null&&x.length===0&&(0,e.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")}),x!==null&&x.length>0&&(0,e.jsx)(I,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-matches",children:[(0,e.jsx)(B,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:a("id")}),(0,e.jsx)(c,{children:a("score")}),(0,e.jsx)(c,{children:a("metadata")})]})}),(0,e.jsx)(L,{children:x.map(t=>(0,e.jsxs)(f,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.id}),(0,e.jsx)(d,{className:"tabular-nums",children:t.score.toFixed(4)}),(0,e.jsx)(d,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":Z(t.metadata)})]},t.id))})]})})})]})]})},"se");export{se as VectorBrowser};
@@ -1 +1 @@
1
- import{b as y}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as R}from"./chunk-5IHQJLV7.js";import"./chunk-ULIQFBZU.js";import"./chunk-QY766ZKO.js";import"./chunk-35DM4JJG.js";import{a as v}from"./chunk-4ZEL6BYL.js";import{c as $}from"./chunk-M4XQHWSJ.js";import"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as S}from"./chunk-FKVZRPV5.js";import{a as A,b as C,c as I,d as x,e as c,f as n}from"./chunk-HEAQVSNS.js";import{a as k,e as w}from"./chunk-WUWBZPUK.js";import{d as N}from"./chunk-FODLDLE2.js";import{a as f,d as b,f as E,g as O}from"./chunk-YKXDMIHQ.js";var j=b(E(),1);var r=b(O(),1);var _=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"I"),T={delete:2,list:3,read:0,write:1},B=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||T[t.on]-T[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"O"),q=f(()=>{let e=(0,j.c)(14),t=N(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(v.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=B(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(R,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(w,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(C,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(c,{children:t("Bucket")}),(0,r.jsx)(c,{children:t("Operation")}),(0,r.jsx)(c,{children:t("Key prefix")}),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(I,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(n,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(n,{children:(0,r.jsx)(y,{variant:"secondary",children:_(t,s.on)})}),(0,r.jsx)(n,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(n,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"M");export{q as default};
1
+ import{b as y}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as R}from"./chunk-MW53Q7VM.js";import"./chunk-ULIQFBZU.js";import"./chunk-GCK3ETRI.js";import"./chunk-35DM4JJG.js";import{a as v}from"./chunk-4ZEL6BYL.js";import{c as $}from"./chunk-UFIIJHJT.js";import"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as S}from"./chunk-FKVZRPV5.js";import{a as A,b as C,c as I,d as x,e as c,f as n}from"./chunk-HEAQVSNS.js";import{a as k,e as w}from"./chunk-WUWBZPUK.js";import{d as N}from"./chunk-FODLDLE2.js";import{a as f,d as b,f as E,g as O}from"./chunk-YKXDMIHQ.js";var j=b(E(),1);var r=b(O(),1);var _=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"I"),T={delete:2,list:3,read:0,write:1},B=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||T[t.on]-T[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"O"),q=f(()=>{let e=(0,j.c)(14),t=N(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(v.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=B(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(R,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(w,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(C,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(c,{children:t("Bucket")}),(0,r.jsx)(c,{children:t("Operation")}),(0,r.jsx)(c,{children:t("Key prefix")}),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(I,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(n,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(n,{children:(0,r.jsx)(y,{variant:"secondary",children:_(t,s.on)})}),(0,r.jsx)(n,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(n,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"M");export{q as default};
@@ -1 +1 @@
1
- import{a as $}from"./chunk-EY7RT4YO.js";import{a as b}from"./chunk-5IHQJLV7.js";import"./chunk-ULIQFBZU.js";import"./chunk-QY766ZKO.js";import"./chunk-35DM4JJG.js";import{a as u}from"./chunk-4ZEL6BYL.js";import{c as p}from"./chunk-M4XQHWSJ.js";import"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as y,b as w,c as j,d as h,e as c,f as i}from"./chunk-HEAQVSNS.js";import{a as d,e as l}from"./chunk-WUWBZPUK.js";import{d as k}from"./chunk-FODLDLE2.js";import{a as o,d as I,g as T,i as x}from"./chunk-YKXDMIHQ.js";var e=I(T(),1);var m={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},A={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},C=o((r,a)=>`exempt: ${r.exemptReason===void 0||r.exemptReason===""?a:r.exemptReason}`,"E"),E=o(r=>r.toSorted((a,n)=>a.coverage==="clean"&&n.coverage!=="clean"?1:n.coverage==="clean"&&a.coverage!=="clean"?-1:a.score-n.score),"S"),Y=o(({testId:r="advisor-health"})=>{let a=k(),n=p(u.getAdvisories,{},{live:!0}),g=p(u.getAdvisorProcedures,{},{live:!0}),f=n.data?.advisories??null,N=g.data?.procedures??null,t=f===null||N===null?null:$(N,f),v=g.error??n.error;if(v!==null)return(0,e.jsx)(b,{error:v,testId:`${r}-error`});if(t===null)return(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"py-8 text-center text-muted-foreground","data-testid":`${r}-loading`,children:a("Loading\u2026")})});let R=E(t.procedures);return(0,e.jsxs)("div",{className:"space-y-4","data-testid":r,children:[(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:x("text-4xl font-semibold tabular-nums",A[t.grade]),"data-testid":`${r}-score`,children:t.score}),(0,e.jsx)("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),(0,e.jsx)("span",{className:x("text-sm font-medium uppercase tracking-wide",A[t.grade]),"data-testid":`${r}-grade`,children:t.grade}),(0,e.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${r}-summary`,children:[(0,e.jsxs)("span",{className:m.clean,children:[t.summary.clean," ",a("clean")]}),(0,e.jsxs)("span",{className:m.warned,children:[t.summary.warned," ",a("warned")]}),(0,e.jsxs)("span",{className:m.failing,children:[t.summary.failing," ",a("failing")]}),(0,e.jsxs)("span",{className:m.exempt,children:[t.summary.exempt," ",a("exempt")]})]})]})}),t.project.checks.length>0&&(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"py-4 text-sm","data-testid":`${r}-project`,children:[(0,e.jsxs)("span",{className:"font-medium",children:[a("Schema & config")," ",t.project.score,"/100"]}),(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \u2014 ",t.project.checks.map(s=>s.name).join(", ")]})]})}),(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"p-0",children:(0,e.jsxs)(y,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(c,{className:"w-20",children:a("Score")}),(0,e.jsx)(c,{children:a("Procedure")}),(0,e.jsx)(c,{className:"w-32",children:a("Kind")}),(0,e.jsx)(c,{children:a("Rules fired")})]})}),(0,e.jsx)(j,{children:R.map(s=>(0,e.jsxs)(h,{"data-testid":`${r}-row`,children:[(0,e.jsx)(i,{className:x("tabular-nums font-medium",m[s.coverage]),children:s.coverage==="exempt"?"\u2014":s.score}),(0,e.jsx)(i,{className:"font-mono text-xs",children:s.id}),(0,e.jsxs)(i,{className:"text-muted-foreground text-xs",children:[s.visibility," ",s.kind,s.sensitivity.level==="high"&&(0,e.jsx)("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),(0,e.jsx)(i,{className:"text-muted-foreground text-xs",children:s.coverage==="exempt"?C(s,a("no reason given")):s.checks.map(S=>S.name).join(", ")})]},s.id))})]})})})]})},"Y");export{Y as default};
1
+ import{a as $}from"./chunk-C6T7K5XP.js";import{a as b}from"./chunk-MW53Q7VM.js";import"./chunk-ULIQFBZU.js";import"./chunk-GCK3ETRI.js";import"./chunk-35DM4JJG.js";import{a as u}from"./chunk-4ZEL6BYL.js";import{c as p}from"./chunk-UFIIJHJT.js";import"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as y,b as w,c as j,d as h,e as c,f as i}from"./chunk-HEAQVSNS.js";import{a as d,e as l}from"./chunk-WUWBZPUK.js";import{d as k}from"./chunk-FODLDLE2.js";import{a as o,d as I,g as T,i as x}from"./chunk-YKXDMIHQ.js";var e=I(T(),1);var m={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},A={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},C=o((r,a)=>`exempt: ${r.exemptReason===void 0||r.exemptReason===""?a:r.exemptReason}`,"E"),E=o(r=>r.toSorted((a,n)=>a.coverage==="clean"&&n.coverage!=="clean"?1:n.coverage==="clean"&&a.coverage!=="clean"?-1:a.score-n.score),"S"),Y=o(({testId:r="advisor-health"})=>{let a=k(),n=p(u.getAdvisories,{},{live:!0}),g=p(u.getAdvisorProcedures,{},{live:!0}),f=n.data?.advisories??null,N=g.data?.procedures??null,t=f===null||N===null?null:$(N,f),v=g.error??n.error;if(v!==null)return(0,e.jsx)(b,{error:v,testId:`${r}-error`});if(t===null)return(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"py-8 text-center text-muted-foreground","data-testid":`${r}-loading`,children:a("Loading\u2026")})});let R=E(t.procedures);return(0,e.jsxs)("div",{className:"space-y-4","data-testid":r,children:[(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:x("text-4xl font-semibold tabular-nums",A[t.grade]),"data-testid":`${r}-score`,children:t.score}),(0,e.jsx)("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),(0,e.jsx)("span",{className:x("text-sm font-medium uppercase tracking-wide",A[t.grade]),"data-testid":`${r}-grade`,children:t.grade}),(0,e.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${r}-summary`,children:[(0,e.jsxs)("span",{className:m.clean,children:[t.summary.clean," ",a("clean")]}),(0,e.jsxs)("span",{className:m.warned,children:[t.summary.warned," ",a("warned")]}),(0,e.jsxs)("span",{className:m.failing,children:[t.summary.failing," ",a("failing")]}),(0,e.jsxs)("span",{className:m.exempt,children:[t.summary.exempt," ",a("exempt")]})]})]})}),t.project.checks.length>0&&(0,e.jsx)(d,{children:(0,e.jsxs)(l,{className:"py-4 text-sm","data-testid":`${r}-project`,children:[(0,e.jsxs)("span",{className:"font-medium",children:[a("Schema & config")," ",t.project.score,"/100"]}),(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" \u2014 ",t.project.checks.map(s=>s.name).join(", ")]})]})}),(0,e.jsx)(d,{children:(0,e.jsx)(l,{className:"p-0",children:(0,e.jsxs)(y,{children:[(0,e.jsx)(w,{children:(0,e.jsxs)(h,{children:[(0,e.jsx)(c,{className:"w-20",children:a("Score")}),(0,e.jsx)(c,{children:a("Procedure")}),(0,e.jsx)(c,{className:"w-32",children:a("Kind")}),(0,e.jsx)(c,{children:a("Rules fired")})]})}),(0,e.jsx)(j,{children:R.map(s=>(0,e.jsxs)(h,{"data-testid":`${r}-row`,children:[(0,e.jsx)(i,{className:x("tabular-nums font-medium",m[s.coverage]),children:s.coverage==="exempt"?"\u2014":s.score}),(0,e.jsx)(i,{className:"font-mono text-xs",children:s.id}),(0,e.jsxs)(i,{className:"text-muted-foreground text-xs",children:[s.visibility," ",s.kind,s.sensitivity.level==="high"&&(0,e.jsx)("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),(0,e.jsx)(i,{className:"text-muted-foreground text-xs",children:s.coverage==="exempt"?C(s,a("no reason given")):s.checks.map(S=>S.name).join(", ")})]},s.id))})]})})})]})},"Y");export{Y as default};
@@ -1 +1 @@
1
- import{a as v}from"./chunk-F7UC63UN.js";import{a as Q}from"./chunk-66UGPQVC.js";import{a as L}from"./chunk-S3CRZLGS.js";import{a as G}from"./chunk-2DX5MROH.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import"./chunk-AAVLPU5Q.js";import{b as $}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as W}from"./chunk-5IHQJLV7.js";import"./chunk-ULIQFBZU.js";import"./chunk-QY766ZKO.js";import"./chunk-35DM4JJG.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{c as B}from"./chunk-M4XQHWSJ.js";import"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as A}from"./chunk-FKVZRPV5.js";import{a as q,b as H,c as O,d as K,e as T,f as D}from"./chunk-HEAQVSNS.js";import{a as _}from"./chunk-WUWBZPUK.js";import{d as j}from"./chunk-FODLDLE2.js";import{a as S,d as F,f as J,g as V}from"./chunk-YKXDMIHQ.js";var R=F(J(),1);var t=F(V(),1);var U=S(c=>`${c.toString()} ms`,"D"),X=S(c=>c.totalConnections===0&&c.shapePoke.passes===0&&c.whisper.passes===0&&c.shapeProbe.run===0&&c.shapeProbe.served===0&&c.globalPoll.drains===0&&c.globalPoll.pairsSkipped===0,"J"),z=S(c=>{let e=(0,R.c)(48),{counters:o,includeTiming:a,prefix:r,t:l,title:u}=c,d=`${r}-section`,n;e[0]!==u?(n=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];let s=`${r}-stats`,i;e[2]!==l?(i=l("Passes"),e[2]=l,e[3]=i):i=e[3];let m=`${r}-passes`,I;e[4]!==o.passes||e[5]!==i||e[6]!==m?(I=(0,t.jsx)(v,{label:i,testId:m,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=m,e[7]=I):I=e[7];let g;e[8]!==l?(g=l("Sockets iterated"),e[8]=l,e[9]=g):g=e[9];let k=`${r}-iterated`,p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==k?(p=(0,t.jsx)(v,{label:g,testId:k,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=k,e[13]=p):p=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${r}-delivered`,h;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(h=(0,t.jsx)(v,{label:f,testId:y,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=h):h=e[19];let x;e[20]!==l?(x=l("Peak width"),e[20]=l,e[21]=x):x=e[21];let N=`${r}-peak`,b;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==N?(b=(0,t.jsx)(v,{label:x,testId:N,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=N,e[25]=b):b=e[25];let C;e[26]!==o.totalMs||e[27]!==a||e[28]!==r||e[29]!==l?(C=a&&(0,t.jsx)(v,{label:l("Total time"),testId:`${r}-total-ms`,value:U(o.totalMs)}),e[26]=o.totalMs,e[27]=a,e[28]=r,e[29]=l,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==a||e[33]!==r||e[34]!==l?(P=a&&(0,t.jsx)(v,{label:l("Max time"),testId:`${r}-max-ms`,value:U(o.maxMs)}),e[31]=o.maxMs,e[32]=a,e[33]=r,e[34]=l,e[35]=P):P=e[35];let M;e[36]!==h||e[37]!==b||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==I||e[42]!==p?(M=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[I,p,h,b,C,P]}),e[36]=h,e[37]=b,e[38]=C,e[39]=P,e[40]=s,e[41]=I,e[42]=p,e[43]=M):M=e[43];let w;return e[44]!==d||e[45]!==M||e[46]!==n?(w=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":d,children:[n,M]}),e[44]=d,e[45]=M,e[46]=n,e[47]=w):w=e[47],w},"F"),Y=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Membership probes"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Queries run"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.run||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Shared from cache"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"V"),Z=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Global shape polls"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Global reads"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.drains||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Pairs skipped"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"X"),pe=S(c=>{let e=(0,R.c)(31),{initialShardKey:o}=c,a=j(),{queryShardKey:r,setShardKey:l,shardKey:u}=L(o),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d={},e[0]=d):d=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];let{data:s,error:i,errorSource:m,refetch:I}=B(E.getFanoutMetrics,d,n);Q(I,!0);let g;e[3]!==s?(g=s!==void 0&&X(s),e[3]=s,e[4]=g):g=e[4];let k=g,p;e[5]!==l||e[6]!==u?(p=(0,t.jsx)(G,{onChange:l,testId:"fanout-shard-input",value:u}),e[5]=l,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==s||e[9]!==a?(f=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&(0,t.jsx)($,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?a("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):a("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),(0,t.jsx)($,{variant:"secondary",children:a("{count} connections",{count:s.totalConnections})}),(0,t.jsx)($,{variant:"secondary",children:a("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=a,e[10]=f):f=e[10];let y;e[11]!==p||e[12]!==f?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13];let h;e[14]!==i||e[15]!==m?(h=i!==null&&(0,t.jsx)(W,{error:m,testId:"fanout-error"}),e[14]=i,e[15]=m,e[16]=h):h=e[16];let x;e[17]!==i||e[18]!==k||e[19]!==a?(x=i===null&&k&&(0,t.jsx)(A,{description:a("Realtime fan-out cost and per-topic subscriber counts for this shard."),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:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:a("No fan-out activity yet.")}),e[17]=i,e[18]=k,e[19]=a,e[20]=x):x=e[20];let N;e[21]!==i||e[22]!==k||e[23]!==s||e[24]!==a?(N=i===null&&s!==void 0&&!k&&(0,t.jsxs)(t.Fragment,{children:[s.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a("Hot topics")}),(0,t.jsx)(_,{className:"overflow-hidden py-0",children:(0,t.jsxs)(q,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(T,{children:a("Topic")}),(0,t.jsx)(T,{children:a("Kind")}),(0,t.jsx)(T,{className:"text-right",children:a("Subscribers")})]})}),(0,t.jsx)(O,{children:s.topics.map(ee)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:a("Fan-out cost since this instance woke")}),(0,t.jsx)(z,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:a,title:a("Shape pokes")}),(0,t.jsx)(z,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t:a,title:a("Whisper broadcasts")}),(0,t.jsx)(Y,{counters:s.shapeProbe,t:a}),(0,t.jsx)(Z,{counters:s.globalPoll,t:a})]})]}),e[21]=i,e[22]=k,e[23]=s,e[24]=a,e[25]=N):N=e[25];let b;return e[26]!==y||e[27]!==h||e[28]!==x||e[29]!==N?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,h,x,N]}),e[26]=y,e[27]=h,e[28]=x,e[29]=N,e[30]=b):b=e[30],b},"me");function ee(c){return(0,t.jsxs)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:c.topic}),(0,t.jsx)(D,{children:(0,t.jsx)($,{variant:"outline",children:c.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:c.subscribers})]},`${c.kind}:${c.topic}`)}S(ee,"Y");export{pe as default};
1
+ import{a as v}from"./chunk-F7UC63UN.js";import{a as Q}from"./chunk-66UGPQVC.js";import{a as L}from"./chunk-S3CRZLGS.js";import{a as G}from"./chunk-2DX5MROH.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import"./chunk-AAVLPU5Q.js";import{b as $}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as W}from"./chunk-MW53Q7VM.js";import"./chunk-ULIQFBZU.js";import"./chunk-GCK3ETRI.js";import"./chunk-35DM4JJG.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{c as B}from"./chunk-UFIIJHJT.js";import"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as A}from"./chunk-FKVZRPV5.js";import{a as q,b as H,c as O,d as K,e as T,f as D}from"./chunk-HEAQVSNS.js";import{a as _}from"./chunk-WUWBZPUK.js";import{d as j}from"./chunk-FODLDLE2.js";import{a as S,d as F,f as J,g as V}from"./chunk-YKXDMIHQ.js";var R=F(J(),1);var t=F(V(),1);var U=S(c=>`${c.toString()} ms`,"D"),X=S(c=>c.totalConnections===0&&c.shapePoke.passes===0&&c.whisper.passes===0&&c.shapeProbe.run===0&&c.shapeProbe.served===0&&c.globalPoll.drains===0&&c.globalPoll.pairsSkipped===0,"J"),z=S(c=>{let e=(0,R.c)(48),{counters:o,includeTiming:a,prefix:r,t:l,title:u}=c,d=`${r}-section`,n;e[0]!==u?(n=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];let s=`${r}-stats`,i;e[2]!==l?(i=l("Passes"),e[2]=l,e[3]=i):i=e[3];let m=`${r}-passes`,I;e[4]!==o.passes||e[5]!==i||e[6]!==m?(I=(0,t.jsx)(v,{label:i,testId:m,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=m,e[7]=I):I=e[7];let g;e[8]!==l?(g=l("Sockets iterated"),e[8]=l,e[9]=g):g=e[9];let k=`${r}-iterated`,p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==k?(p=(0,t.jsx)(v,{label:g,testId:k,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=k,e[13]=p):p=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${r}-delivered`,h;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(h=(0,t.jsx)(v,{label:f,testId:y,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=h):h=e[19];let x;e[20]!==l?(x=l("Peak width"),e[20]=l,e[21]=x):x=e[21];let N=`${r}-peak`,b;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==N?(b=(0,t.jsx)(v,{label:x,testId:N,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=N,e[25]=b):b=e[25];let C;e[26]!==o.totalMs||e[27]!==a||e[28]!==r||e[29]!==l?(C=a&&(0,t.jsx)(v,{label:l("Total time"),testId:`${r}-total-ms`,value:U(o.totalMs)}),e[26]=o.totalMs,e[27]=a,e[28]=r,e[29]=l,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==a||e[33]!==r||e[34]!==l?(P=a&&(0,t.jsx)(v,{label:l("Max time"),testId:`${r}-max-ms`,value:U(o.maxMs)}),e[31]=o.maxMs,e[32]=a,e[33]=r,e[34]=l,e[35]=P):P=e[35];let M;e[36]!==h||e[37]!==b||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==I||e[42]!==p?(M=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[I,p,h,b,C,P]}),e[36]=h,e[37]=b,e[38]=C,e[39]=P,e[40]=s,e[41]=I,e[42]=p,e[43]=M):M=e[43];let w;return e[44]!==d||e[45]!==M||e[46]!==n?(w=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":d,children:[n,M]}),e[44]=d,e[45]=M,e[46]=n,e[47]=w):w=e[47],w},"F"),Y=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Membership probes"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Queries run"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.run||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Shared from cache"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"V"),Z=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Global shape polls"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Global reads"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.drains||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Pairs skipped"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"X"),pe=S(c=>{let e=(0,R.c)(31),{initialShardKey:o}=c,a=j(),{queryShardKey:r,setShardKey:l,shardKey:u}=L(o),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d={},e[0]=d):d=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];let{data:s,error:i,errorSource:m,refetch:I}=B(E.getFanoutMetrics,d,n);Q(I,!0);let g;e[3]!==s?(g=s!==void 0&&X(s),e[3]=s,e[4]=g):g=e[4];let k=g,p;e[5]!==l||e[6]!==u?(p=(0,t.jsx)(G,{onChange:l,testId:"fanout-shard-input",value:u}),e[5]=l,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==s||e[9]!==a?(f=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&(0,t.jsx)($,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?a("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):a("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),(0,t.jsx)($,{variant:"secondary",children:a("{count} connections",{count:s.totalConnections})}),(0,t.jsx)($,{variant:"secondary",children:a("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=a,e[10]=f):f=e[10];let y;e[11]!==p||e[12]!==f?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13];let h;e[14]!==i||e[15]!==m?(h=i!==null&&(0,t.jsx)(W,{error:m,testId:"fanout-error"}),e[14]=i,e[15]=m,e[16]=h):h=e[16];let x;e[17]!==i||e[18]!==k||e[19]!==a?(x=i===null&&k&&(0,t.jsx)(A,{description:a("Realtime fan-out cost and per-topic subscriber counts for this shard."),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:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:a("No fan-out activity yet.")}),e[17]=i,e[18]=k,e[19]=a,e[20]=x):x=e[20];let N;e[21]!==i||e[22]!==k||e[23]!==s||e[24]!==a?(N=i===null&&s!==void 0&&!k&&(0,t.jsxs)(t.Fragment,{children:[s.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a("Hot topics")}),(0,t.jsx)(_,{className:"overflow-hidden py-0",children:(0,t.jsxs)(q,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(T,{children:a("Topic")}),(0,t.jsx)(T,{children:a("Kind")}),(0,t.jsx)(T,{className:"text-right",children:a("Subscribers")})]})}),(0,t.jsx)(O,{children:s.topics.map(ee)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:a("Fan-out cost since this instance woke")}),(0,t.jsx)(z,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:a,title:a("Shape pokes")}),(0,t.jsx)(z,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t:a,title:a("Whisper broadcasts")}),(0,t.jsx)(Y,{counters:s.shapeProbe,t:a}),(0,t.jsx)(Z,{counters:s.globalPoll,t:a})]})]}),e[21]=i,e[22]=k,e[23]=s,e[24]=a,e[25]=N):N=e[25];let b;return e[26]!==y||e[27]!==h||e[28]!==x||e[29]!==N?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,h,x,N]}),e[26]=y,e[27]=h,e[28]=x,e[29]=N,e[30]=b):b=e[30],b},"me");function ee(c){return(0,t.jsxs)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:c.topic}),(0,t.jsx)(D,{children:(0,t.jsx)($,{variant:"outline",children:c.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:c.subscribers})]},`${c.kind}:${c.topic}`)}S(ee,"Y");export{pe as default};
@@ -1 +1 @@
1
- import{W as k}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as q}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as j}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as U}from"./chunk-5IHQJLV7.js";import"./chunk-ULIQFBZU.js";import"./chunk-QY766ZKO.js";import"./chunk-35DM4JJG.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as P}from"./chunk-M4XQHWSJ.js";import"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as M}from"./chunk-FKVZRPV5.js";import{a as G,b as H,c as J,d as B,e as x,f as N}from"./chunk-HEAQVSNS.js";import{a as z,e as D}from"./chunk-WUWBZPUK.js";import{d as F,r as O}from"./chunk-FODLDLE2.js";import{a as A,d as T,e as $,f as X,g as Y}from"./chunk-YKXDMIHQ.js";var K=T(X(),1),Q=T($(),1);var t=T(Y(),1);var de=A(()=>{let e=(0,K.c)(39),a=F(),[s,V]=(0,Q.useState)(""),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:C,error:l,errorSource:S,isLoading:E,refetch:_}=P(R.getAuthAuditLog,y),I;if(e[1]!==C?.entries||e[2]!==s){let r=C?.entries??[],v=s.trim().toLowerCase();I=v===""?r:r.filter(w=>w.event.toLowerCase().includes(v)||(w.actorId??"").toLowerCase().includes(v)||(w.actorEmail??"").toLowerCase().includes(v)||(w.ip??"").toLowerCase().includes(v)||w.outcome.toLowerCase().includes(v)),e[1]=C?.entries,e[2]=s,e[3]=I}else I=e[3];let o=I,L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A(r=>{V(r.target.value)},"I"),e[4]=L):L=e[4];let W=L,i;e[5]!==a?(i=a("Filter security events"),e[5]=a,e[6]=i):i=e[6];let n;e[7]!==a?(n=a("filter event, actor, IP"),e[7]=a,e[8]=n):n=e[8];let c;e[9]!==s||e[10]!==i||e[11]!==n?(c=(0,t.jsx)(k,{"aria-label":i,className:"h-8 w-56","data-testid":"aa-search",onChange:W,placeholder:n,value:s}),e[9]=s,e[10]=i,e[11]=n,e[12]=c):c=e[12];let d;e[13]!==_?(d=A(()=>{_()},"m"),e[13]=_,e[14]=d):d=e[14];let m;e[15]!==a?(m=a("Refresh"),e[15]=a,e[16]=m):m=e[16];let u;e[17]!==d||e[18]!==m?(u=(0,t.jsx)(q,{"data-testid":"aa-refresh",onClick:d,size:"xs",type:"button",variant:"ghost",children:m}),e[17]=d,e[18]=m,e[19]=u):u=e[19];let h;e[20]!==c||e[21]!==u?(h=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u]}),e[20]=c,e[21]=u,e[22]=h):h=e[22];let f;e[23]!==l||e[24]!==S?(f=l!==null&&(0,t.jsx)(U,{error:S,testId:"aa-error"}),e[23]=l,e[24]=S,e[25]=f):f=e[25];let p;e[26]!==l||e[27]!==o.length||e[28]!==E||e[29]!==a?(p=l===null&&!E&&o.length===0&&(0,t.jsx)(M,{description:a("Authentication and security events are recorded here."),testId:"aa-empty",title:a("No security events.")}),e[26]=l,e[27]=o.length,e[28]=E,e[29]=a,e[30]=p):p=e[30];let g;e[31]!==o||e[32]!==a?(g=o.length>0&&(0,t.jsx)(z,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"aa-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(x,{children:a("time")}),(0,t.jsx)(x,{children:a("event")}),(0,t.jsx)(x,{children:a("actor")}),(0,t.jsx)(x,{children:a("ip / user agent")}),(0,t.jsx)(x,{children:a("outcome")})]})}),(0,t.jsx)(J,{children:o.map(r=>(0,t.jsxs)(B,{"data-testid":"aa-row",children:[(0,t.jsx)(N,{className:"text-muted-foreground tabular-nums",children:O(r.ts,"\u2014")}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:"secondary",children:r.event})}),(0,t.jsx)(N,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsxs)(N,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),r.userAgent!==void 0&&(0,t.jsxs)("span",{className:"ml-1 opacity-70",children:["\xB7 ",r.userAgent]})]}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:r.outcome==="failure"?"destructive":"outline",children:a(r.outcome)})})]},r.seq))})]})})}),e[31]=o,e[32]=a,e[33]=g):g=e[33];let b;return e[34]!==f||e[35]!==p||e[36]!==g||e[37]!==h?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[h,f,p,g]}),e[34]=f,e[35]=p,e[36]=g,e[37]=h,e[38]=b):b=e[38],b},"ne");export{de as default};
1
+ import{W as k}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as q}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as j}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as U}from"./chunk-MW53Q7VM.js";import"./chunk-ULIQFBZU.js";import"./chunk-GCK3ETRI.js";import"./chunk-35DM4JJG.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as P}from"./chunk-UFIIJHJT.js";import"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as M}from"./chunk-FKVZRPV5.js";import{a as G,b as H,c as J,d as B,e as x,f as N}from"./chunk-HEAQVSNS.js";import{a as z,e as D}from"./chunk-WUWBZPUK.js";import{d as F,r as O}from"./chunk-FODLDLE2.js";import{a as A,d as T,e as $,f as X,g as Y}from"./chunk-YKXDMIHQ.js";var K=T(X(),1),Q=T($(),1);var t=T(Y(),1);var de=A(()=>{let e=(0,K.c)(39),a=F(),[s,V]=(0,Q.useState)(""),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:C,error:l,errorSource:S,isLoading:E,refetch:_}=P(R.getAuthAuditLog,y),I;if(e[1]!==C?.entries||e[2]!==s){let r=C?.entries??[],v=s.trim().toLowerCase();I=v===""?r:r.filter(w=>w.event.toLowerCase().includes(v)||(w.actorId??"").toLowerCase().includes(v)||(w.actorEmail??"").toLowerCase().includes(v)||(w.ip??"").toLowerCase().includes(v)||w.outcome.toLowerCase().includes(v)),e[1]=C?.entries,e[2]=s,e[3]=I}else I=e[3];let o=I,L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A(r=>{V(r.target.value)},"I"),e[4]=L):L=e[4];let W=L,i;e[5]!==a?(i=a("Filter security events"),e[5]=a,e[6]=i):i=e[6];let n;e[7]!==a?(n=a("filter event, actor, IP"),e[7]=a,e[8]=n):n=e[8];let c;e[9]!==s||e[10]!==i||e[11]!==n?(c=(0,t.jsx)(k,{"aria-label":i,className:"h-8 w-56","data-testid":"aa-search",onChange:W,placeholder:n,value:s}),e[9]=s,e[10]=i,e[11]=n,e[12]=c):c=e[12];let d;e[13]!==_?(d=A(()=>{_()},"m"),e[13]=_,e[14]=d):d=e[14];let m;e[15]!==a?(m=a("Refresh"),e[15]=a,e[16]=m):m=e[16];let u;e[17]!==d||e[18]!==m?(u=(0,t.jsx)(q,{"data-testid":"aa-refresh",onClick:d,size:"xs",type:"button",variant:"ghost",children:m}),e[17]=d,e[18]=m,e[19]=u):u=e[19];let h;e[20]!==c||e[21]!==u?(h=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u]}),e[20]=c,e[21]=u,e[22]=h):h=e[22];let f;e[23]!==l||e[24]!==S?(f=l!==null&&(0,t.jsx)(U,{error:S,testId:"aa-error"}),e[23]=l,e[24]=S,e[25]=f):f=e[25];let p;e[26]!==l||e[27]!==o.length||e[28]!==E||e[29]!==a?(p=l===null&&!E&&o.length===0&&(0,t.jsx)(M,{description:a("Authentication and security events are recorded here."),testId:"aa-empty",title:a("No security events.")}),e[26]=l,e[27]=o.length,e[28]=E,e[29]=a,e[30]=p):p=e[30];let g;e[31]!==o||e[32]!==a?(g=o.length>0&&(0,t.jsx)(z,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"aa-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(x,{children:a("time")}),(0,t.jsx)(x,{children:a("event")}),(0,t.jsx)(x,{children:a("actor")}),(0,t.jsx)(x,{children:a("ip / user agent")}),(0,t.jsx)(x,{children:a("outcome")})]})}),(0,t.jsx)(J,{children:o.map(r=>(0,t.jsxs)(B,{"data-testid":"aa-row",children:[(0,t.jsx)(N,{className:"text-muted-foreground tabular-nums",children:O(r.ts,"\u2014")}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:"secondary",children:r.event})}),(0,t.jsx)(N,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsxs)(N,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),r.userAgent!==void 0&&(0,t.jsxs)("span",{className:"ml-1 opacity-70",children:["\xB7 ",r.userAgent]})]}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:r.outcome==="failure"?"destructive":"outline",children:a(r.outcome)})})]},r.seq))})]})})}),e[31]=o,e[32]=a,e[33]=g):g=e[33];let b;return e[34]!==f||e[35]!==p||e[36]!==g||e[37]!==h?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[h,f,p,g]}),e[34]=f,e[35]=p,e[36]=g,e[37]=h,e[38]=b):b=e[38],b},"ne");export{de as default};
@@ -1 +1 @@
1
- import{b as u}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as y}from"./chunk-5IHQJLV7.js";import"./chunk-ULIQFBZU.js";import"./chunk-QY766ZKO.js";import"./chunk-35DM4JJG.js";import{a as N}from"./chunk-4ZEL6BYL.js";import{c as v}from"./chunk-M4XQHWSJ.js";import"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as g}from"./chunk-FKVZRPV5.js";import{a as w,b,c as S,d as c,e as s,f as o}from"./chunk-HEAQVSNS.js";import{a as f,e as x}from"./chunk-WUWBZPUK.js";import{d as p}from"./chunk-FODLDLE2.js";import{a as n,d as R,g as T}from"./chunk-YKXDMIHQ.js";var e=R(T(),1);var $={active:"default",failing:"destructive",idle:"secondary"},j=n(a=>a===void 0?"\u2014":`${new Date(a).toISOString().slice(0,19).replace("T"," ")} UTC`,"I"),U=n(a=>{let t=a.runs+a.suppressed;return t===0?void 0:Math.round(a.suppressed/t*100)},"$"),F=n(({initialShardKey:a=""})=>{let t=p(),{data:l,error:E,errorSource:A,liveError:I}=v(N.listReactors,{},{live:!0,shardKey:a}),C=l!==void 0,i=Array.isArray(l?.reactors)?l.reactors:[],d;C&&i.length===0?d=(0,e.jsx)(g,{description:t("No reactor is declared in this deployment. Export an onQueryChange(select, handler) from lunora/ to run server-side logic when a query's result changes."),testId:"reactors-empty",title:t("No reactors declared")}):d=(0,e.jsx)(f,{className:"overflow-hidden py-0",children:(0,e.jsx)(x,{className:"px-0",children:(0,e.jsxs)(w,{"data-testid":"reactors-table",children:[(0,e.jsx)(b,{children:(0,e.jsxs)(c,{children:[(0,e.jsx)(s,{children:t("Reactor")}),(0,e.jsx)(s,{children:t("State")}),(0,e.jsx)(s,{children:t("Ran")}),(0,e.jsx)(s,{children:t("Suppressed")}),(0,e.jsx)(s,{children:t("Errors")}),(0,e.jsx)(s,{children:t("Watches")}),(0,e.jsx)(s,{children:t("Last dispatch")})]})}),(0,e.jsx)(S,{children:i.map(r=>{let m=U(r);return(0,e.jsxs)(c,{"data-testid":`reactors-row-${r.path}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:r.path}),(0,e.jsx)(o,{children:(0,e.jsx)(u,{"data-testid":`reactors-state-${r.path}`,variant:$[r.state],children:r.state})}),(0,e.jsx)(o,{className:"font-mono text-xs",children:r.runs}),(0,e.jsxs)(o,{className:"font-mono text-xs text-muted-foreground",children:[r.suppressed,m===void 0?"":` (${String(m)}%)`]}),(0,e.jsx)(o,{className:"font-mono text-xs",children:r.errors===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"0"}):(0,e.jsx)("span",{className:"text-destructive",children:r.errors})}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:r.tables===void 0||r.tables.length===0?"\u2014":r.tables.join(", ")}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:j(r.lastRanAt)})]},r.path)})})]})})});let h=i.filter(r=>r.state==="failing");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-reactors-panel",children:[E!==null&&(0,e.jsx)(y,{error:A,testId:"reactors-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("A reactor runs after a write flush, but only when the result of the query it watches actually changed \u2014 a trigger fires on a row write, a reactor fires on a result changing. Suppressed dispatches are the ones where the read re-ran and nothing had moved.")}),h.length>0&&(0,e.jsx)("div",{className:"flex flex-col gap-2","data-testid":"reactors-failing",children:h.map(r=>(0,e.jsxs)("p",{className:"text-xs text-destructive",role:"alert",children:[(0,e.jsx)("span",{className:"font-mono",children:r.path}),": ",r.lastError??t("last dispatch failed")]},r.path))}),I!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"reactors-live-error",role:"alert",children:t("Live updates unavailable; showing the last reading.")}),d]})},"U");export{F as default};
1
+ import{b as u}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as y}from"./chunk-MW53Q7VM.js";import"./chunk-ULIQFBZU.js";import"./chunk-GCK3ETRI.js";import"./chunk-35DM4JJG.js";import{a as N}from"./chunk-4ZEL6BYL.js";import{c as v}from"./chunk-UFIIJHJT.js";import"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as g}from"./chunk-FKVZRPV5.js";import{a as w,b,c as S,d as c,e as s,f as o}from"./chunk-HEAQVSNS.js";import{a as f,e as x}from"./chunk-WUWBZPUK.js";import{d as p}from"./chunk-FODLDLE2.js";import{a as n,d as R,g as T}from"./chunk-YKXDMIHQ.js";var e=R(T(),1);var $={active:"default",failing:"destructive",idle:"secondary"},j=n(a=>a===void 0?"\u2014":`${new Date(a).toISOString().slice(0,19).replace("T"," ")} UTC`,"I"),U=n(a=>{let t=a.runs+a.suppressed;return t===0?void 0:Math.round(a.suppressed/t*100)},"$"),F=n(({initialShardKey:a=""})=>{let t=p(),{data:l,error:E,errorSource:A,liveError:I}=v(N.listReactors,{},{live:!0,shardKey:a}),C=l!==void 0,i=Array.isArray(l?.reactors)?l.reactors:[],d;C&&i.length===0?d=(0,e.jsx)(g,{description:t("No reactor is declared in this deployment. Export an onQueryChange(select, handler) from lunora/ to run server-side logic when a query's result changes."),testId:"reactors-empty",title:t("No reactors declared")}):d=(0,e.jsx)(f,{className:"overflow-hidden py-0",children:(0,e.jsx)(x,{className:"px-0",children:(0,e.jsxs)(w,{"data-testid":"reactors-table",children:[(0,e.jsx)(b,{children:(0,e.jsxs)(c,{children:[(0,e.jsx)(s,{children:t("Reactor")}),(0,e.jsx)(s,{children:t("State")}),(0,e.jsx)(s,{children:t("Ran")}),(0,e.jsx)(s,{children:t("Suppressed")}),(0,e.jsx)(s,{children:t("Errors")}),(0,e.jsx)(s,{children:t("Watches")}),(0,e.jsx)(s,{children:t("Last dispatch")})]})}),(0,e.jsx)(S,{children:i.map(r=>{let m=U(r);return(0,e.jsxs)(c,{"data-testid":`reactors-row-${r.path}`,children:[(0,e.jsx)(o,{className:"font-mono text-xs",children:r.path}),(0,e.jsx)(o,{children:(0,e.jsx)(u,{"data-testid":`reactors-state-${r.path}`,variant:$[r.state],children:r.state})}),(0,e.jsx)(o,{className:"font-mono text-xs",children:r.runs}),(0,e.jsxs)(o,{className:"font-mono text-xs text-muted-foreground",children:[r.suppressed,m===void 0?"":` (${String(m)}%)`]}),(0,e.jsx)(o,{className:"font-mono text-xs",children:r.errors===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:"0"}):(0,e.jsx)("span",{className:"text-destructive",children:r.errors})}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:r.tables===void 0||r.tables.length===0?"\u2014":r.tables.join(", ")}),(0,e.jsx)(o,{className:"font-mono text-xs text-muted-foreground",children:j(r.lastRanAt)})]},r.path)})})]})})});let h=i.filter(r=>r.state==="failing");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-reactors-panel",children:[E!==null&&(0,e.jsx)(y,{error:A,testId:"reactors-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t("A reactor runs after a write flush, but only when the result of the query it watches actually changed \u2014 a trigger fires on a row write, a reactor fires on a result changing. Suppressed dispatches are the ones where the read re-ran and nothing had moved.")}),h.length>0&&(0,e.jsx)("div",{className:"flex flex-col gap-2","data-testid":"reactors-failing",children:h.map(r=>(0,e.jsxs)("p",{className:"text-xs text-destructive",role:"alert",children:[(0,e.jsx)("span",{className:"font-mono",children:r.path}),": ",r.lastError??t("last dispatch failed")]},r.path))}),I!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"reactors-live-error",role:"alert",children:t("Live updates unavailable; showing the last reading.")}),d]})},"U");export{F as default};
@@ -1 +1 @@
1
- import{a as G}from"./chunk-EA2JKR5D.js";import{a as x}from"./chunk-IMOHEGMV.js";import{a as U}from"./chunk-2DX5MROH.js";import{b as M}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{W as O}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as p}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as w}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{f as D}from"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{d as K,e as _,f as z,h as B,o as P,r as q}from"./chunk-FODLDLE2.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-YKXDMIHQ.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,he=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,h]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){h("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");h("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),h("success"),L("success")}catch(l){y(void 0),N(l.message),h("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(p,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(p,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:he(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(p,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
1
+ import{a as G}from"./chunk-EA2JKR5D.js";import{a as x}from"./chunk-IMOHEGMV.js";import{a as U}from"./chunk-2DX5MROH.js";import{b as M}from"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{W as O}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as p}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as w}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{f as D}from"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{d as K,e as _,f as z,h as B,o as P,r as q}from"./chunk-FODLDLE2.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-YKXDMIHQ.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,he=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,h]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){h("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");h("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),h("success"),L("success")}catch(l){y(void 0),N(l.message),h("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(p,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(p,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:he(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(p,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
@@ -1 +1 @@
1
- import{a as q}from"./chunk-YVVP4DRM.js";import{a as k}from"./chunk-GGPSI4ZR.js";import"./chunk-4GTO7FL5.js";import"./chunk-P5RUFDVX.js";import"./chunk-5JDWLCSH.js";import"./chunk-EVTM6Q43.js";import{a as A}from"./chunk-S3CRZLGS.js";import{a as $}from"./chunk-2DX5MROH.js";import"./chunk-OGUKYRFM.js";import"./chunk-6D6Z2KXU.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-AAVLPU5Q.js";import{b as K}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as F}from"./chunk-5IHQJLV7.js";import"./chunk-ULIQFBZU.js";import"./chunk-QY766ZKO.js";import"./chunk-35DM4JJG.js";import{a as T}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-M4XQHWSJ.js";import"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as O}from"./chunk-FKVZRPV5.js";import{a as j,e as w}from"./chunk-WUWBZPUK.js";import{d as I,r as E}from"./chunk-FODLDLE2.js";import{a as p,d as C,f as D,g as H}from"./chunk-YKXDMIHQ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
1
+ import{a as q}from"./chunk-YVVP4DRM.js";import{a as k}from"./chunk-GGPSI4ZR.js";import"./chunk-4GTO7FL5.js";import"./chunk-P5RUFDVX.js";import"./chunk-5JDWLCSH.js";import"./chunk-EVTM6Q43.js";import{a as A}from"./chunk-S3CRZLGS.js";import{a as $}from"./chunk-2DX5MROH.js";import"./chunk-OGUKYRFM.js";import"./chunk-6D6Z2KXU.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import"./chunk-AAVLPU5Q.js";import{b as K}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as F}from"./chunk-MW53Q7VM.js";import"./chunk-ULIQFBZU.js";import"./chunk-GCK3ETRI.js";import"./chunk-35DM4JJG.js";import{a as T}from"./chunk-4ZEL6BYL.js";import{c as S}from"./chunk-UFIIJHJT.js";import"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as O}from"./chunk-FKVZRPV5.js";import{a as j,e as w}from"./chunk-WUWBZPUK.js";import{d as I,r as E}from"./chunk-FODLDLE2.js";import{a as p,d as C,f as D,g as H}from"./chunk-YKXDMIHQ.js";var M=C(D(),1);var m=C(H(),1);var L=p(s=>s.length===0?void 0:{max:Math.max(...s),mean:s.reduce((e,t)=>e+t,0)/s.length,min:Math.min(...s)},"F"),B=/^gen_ai\.evaluation\.(.+)\.score$/u,P=p(s=>{let e=[];for(let t of s)for(let n of t.spans)for(let[a,l]of Object.entries(n.attributes??{})){let o=B.exec(a);if(!o||typeof l!="number")continue;let i=o[1],c=n.attributes?.[`gen_ai.evaluation.${i}.label`];e.push({...typeof c=="string"?{label:c}:{},name:i,score:l,spanName:n.name,startTs:t.startTs+n.offsetMs,traceId:t.traceId})}return e.toSorted((t,n)=>n.startTs-t.startTs)},"q"),Q=p(s=>{let e=[];for(let t of s?.series??[]){let n=B.exec(t.name);n&&e.push({name:n[1],points:t.points})}return e},"D"),R=p((s,e)=>{let t=new Set([...s.map(a=>a.name),...e.map(a=>a.name)]),n=[];for(let a of t){let l=s.filter(r=>r.name===a),o=e.find(r=>r.name===a)?.points??[],i=o.at(-1)?.last??l[0]?.score,c=o.length>0?{max:Math.max(...o.map(r=>r.max)),mean:o.reduce((r,d)=>r+d.sum,0)/o.reduce((r,d)=>r+d.count,0),min:Math.min(...o.map(r=>r.min))}:L(l.map(r=>r.score));n.push({...i===void 0?{}:{latest:i},...c,name:a,points:o,runs:l})}return n.toSorted((a,l)=>a.name.localeCompare(l.name))},"H"),U=p(s=>Array.isArray(s?.traces)?s.traces:[],"L"),N=p(s=>s===void 0?"\u2014":s.toFixed(2),"y"),z=p(s=>{let e=(0,M.c)(34),{card:t,onOpenTrace:n}=s,a=I(),l;e[0]!==t.name?(l=(0,m.jsx)("h3",{className:"font-mono text-sm font-semibold text-foreground","data-testid":"ev-name",children:t.name}),e[0]=t.name,e[1]=l):l=e[1];let o;e[2]!==t.latest?(o=N(t.latest),e[2]=t.latest,e[3]=o):o=e[3];let i;e[4]!==o?(i=(0,m.jsx)("span",{className:"font-mono text-lg text-foreground","data-testid":"ev-latest",children:o}),e[4]=o,e[5]=i):i=e[5];let c;e[6]!==l||e[7]!==i?(c=(0,m.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[l,i]}),e[6]=l,e[7]=i,e[8]=c):c=e[8];let r;e[9]!==t.max||e[10]!==t.mean||e[11]!==t.min||e[12]!==a?(r=a("min {min} \xB7 mean {mean} \xB7 max {max}",{max:N(t.max),mean:N(t.mean),min:N(t.min)}),e[9]=t.max,e[10]=t.mean,e[11]=t.min,e[12]=a,e[13]=r):r=e[13];let d;e[14]!==r?(d=(0,m.jsx)("p",{className:"font-mono text-xs text-muted-foreground","data-testid":"ev-summary",children:r}),e[14]=r,e[15]=d):d=e[15];let u;e[16]!==t.name||e[17]!==t.points||e[18]!==a?(u=t.points.length>1?(0,m.jsx)(q,{ariaLabel:a("Score trend for {name}",{name:t.name}),className:"h-10 w-full",series:t.points.map(G),testId:"ev-trend"}):(0,m.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"ev-no-trend",children:a("No durable history yet \u2014 pass ctx.metrics to recordEvaluation to chart a trend.")}),e[16]=t.name,e[17]=t.points,e[18]=a,e[19]=u):u=e[19];let h;if(e[20]!==t.runs||e[21]!==n||e[22]!==a){let v;e[24]!==n||e[25]!==a?(v=p(f=>(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 font-mono text-xs","data-testid":"ev-run",children:[(0,m.jsxs)("span",{className:"truncate text-muted-foreground",children:[E(f.startTs)," \xB7 ",f.spanName]}),(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[f.label===void 0?null:(0,m.jsx)(K,{variant:"outline",children:f.label}),(0,m.jsx)("span",{className:"text-foreground",children:N(f.score)}),n===void 0?null:(0,m.jsx)("button",{className:"text-muted-foreground underline-offset-2 hover:underline",onClick:p(()=>{n(f.traceId)},"onClick"),title:a("Open the trace {trace}",{trace:f.traceId}),type:"button",children:f.traceId.slice(0,8)})]})]},`${f.traceId}:${f.spanName}`),"x"),e[24]=n,e[25]=a,e[26]=v):v=e[26],h=t.runs.slice(0,5).map(v),e[20]=t.runs,e[21]=n,e[22]=a,e[23]=h}else h=e[23];let x;e[27]!==h?(x=(0,m.jsx)("div",{className:"flex flex-col gap-1",children:h}),e[27]=h,e[28]=x):x=e[28];let g;return e[29]!==c||e[30]!==d||e[31]!==u||e[32]!==x?(g=(0,m.jsx)(j,{"data-testid":"ev-card",children:(0,m.jsxs)(w,{className:"flex flex-col gap-3 p-4",children:[c,d,u,x]})}),e[29]=c,e[30]=d,e[31]=u,e[32]=x,e[33]=g):g=e[33],g},"P"),oe=p(s=>{let e=(0,M.c)(19),{initialShardKey:t}=s,n=I(),{queryShardKey:a,setShardKey:l,shardKey:o}=A(t),i=k(a),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];let r;e[1]!==a?(r={live:!0,shardKey:a},e[1]=a,e[2]=r):r=e[2];let{data:d,error:u}=S(T.getTraces,c,r),h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h={},e[3]=h):h=e[3];let x;e[4]!==a?(x={live:!0,shardKey:a},e[4]=a,e[5]=x):x=e[5];let{data:g}=S(T.getMetricHistory,h,x),v;if(e[6]!==d||e[7]!==u||e[8]!==g||e[9]!==i||e[10]!==l||e[11]!==o||e[12]!==n){let f=R(P(U(d)),Q(g)),y;e[14]!==l||e[15]!==o?(y=(0,m.jsx)($,{onChange:l,testId:"ev-shard-input",value:o}),e[14]=l,e[15]=o,e[16]=y):y=e[16];let b;e[17]!==u?(b=u===null?null:(0,m.jsx)(F,{error:u,testId:"ev-error"}),e[17]=u,e[18]=b):b=e[18],v=(0,m.jsxs)("section",{className:"flex flex-col gap-4","data-testid":"ev-panel",children:[y,b,f.length===0?(0,m.jsx)(O,{description:n("Call recordEvaluation from a graded run and its score shows up here."),testId:"ev-empty",title:n("No evals recorded")}):(0,m.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:f.map(_=>(0,m.jsx)(z,{card:_,onOpenTrace:i},_.name))})]}),e[6]=d,e[7]=u,e[8]=g,e[9]=i,e[10]=l,e[11]=o,e[12]=n,e[13]=v}else v=e[13];return v},"re");function G(s){return s.last}p(G,"Q");export{oe as default};
@@ -1 +1 @@
1
- import{b as P}from"./chunk-GSVZDPHS.js";import{c as K,d as X,e as z,f as L,h as B,i as E,j as G,k as q,l as A,m as O,n as W,o as $,p as D}from"./chunk-P5RUFDVX.js";import{a as F,b as H,c as I,d as S,e as J,f as M}from"./chunk-HEAQVSNS.js";import{d as C,n as j}from"./chunk-FODLDLE2.js";import{a as f,d as T,f as U,g as V}from"./chunk-YKXDMIHQ.js";var N=T(U(),1);var t=T(V(),1);var _=50,R={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},Q=f(r=>{let a=r.columns.find(e=>r.rows.length>0&&r.rows.every(n=>typeof n[e]=="number"))??null;return{label:r.columns.find(e=>e!==a)??null,value:a}},"D"),Y=f(r=>{let a=(0,N.c)(3),{data:e,kind:n}=r,l;return a[0]!==e||a[1]!==n?(l=(0,t.jsx)(G,{className:"h-full w-full",config:R,children:n==="area"?(0,t.jsxs)(E,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(z,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):(0,t.jsxs)(B,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(X,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),a[0]=e,a[1]=n,a[2]=l):l=a[2],l},"J"),na=f(r=>{let a=(0,N.c)(21),{axes:e,kind:n,result:l}=r,u=C(),o;a[0]!==l?(o=Q(l),a[0]=l,a[1]=o):o=a[1];let d=o,m;a[2]!==l.columns?(m=new Set(l.columns),a[2]=l.columns,a[3]=m):m=a[3];let s=m,c=e!==void 0&&s.has(e.x)?e.x:d.label,p;a[4]!==e?.y||a[5]!==s?(p=e?.y.find(i=>s.has(i)),a[4]=e?.y,a[5]=s,a[6]=p):p=a[6];let x=p,y=x??d.value,b;a[7]!==c||a[8]!==l.rows||a[9]!==y?(b=y===null?[]:l.rows.slice(0,_).map((i,w)=>({label:c===null?`#${(w+1).toString()}`:j(i[c]),value:Number(i[y])||0})),a[7]=c,a[8]=l.rows,a[9]=y,a[10]=b):b=a[10];let k=b;if(y===null){let i;a[11]!==u?(i=u("No numeric column to chart."),a[11]=u,a[12]=i):i=a[12];let w;return a[13]!==i?(w=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:i}),a[13]=i,a[14]=w):w=a[14],w}let h=n??(e!==void 0&&x!==void 0?e.kind:"bar"),v;a[15]!==k||a[16]!==h?(v=h==="bar"?(0,t.jsxs)(O,{className:"h-full w-full",config:R,data:k,children:[(0,t.jsx)($,{dataKey:"label"}),(0,t.jsx)(W,{dataKey:"value"}),(0,t.jsx)(D,{})]}):(0,t.jsx)(Y,{data:k,kind:h}),a[15]=k,a[16]=h,a[17]=v):v=a[17];let g;return a[18]!==h||a[19]!==v?(g=(0,t.jsx)("div",{className:"h-80 w-full p-3","data-chart-kind":h,"data-testid":"sql-chart",children:v}),a[18]=h,a[19]=v,a[20]=g):g=a[20],g},"oe"),oa=f(r=>{let a=(0,N.c)(19),{result:e}=r,n=C();if(e.columns.length===0){let s;a[0]!==e.rowCount||a[1]!==n?(s=n("{count} rows",{count:e.rowCount}),a[0]=e.rowCount,a[1]=n,a[2]=s):s=a[2];let c;return a[3]!==s?(c=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:s}),a[3]=s,a[4]=c):c=a[4],c}let l;a[5]!==e.columns?(l=e.columns.map(Z),a[5]=e.columns,a[6]=l):l=a[6];let u;a[7]!==l?(u=(0,t.jsx)(H,{className:"sticky top-0 z-10 bg-muted",children:(0,t.jsx)(S,{children:l})}),a[7]=l,a[8]=u):u=a[8];let o;if(a[9]!==e.columns||a[10]!==e.rows){let s;a[12]!==e.columns?(s=f((c,p)=>(0,t.jsx)(S,{"data-testid":"sql-row",children:e.columns.map(x=>(0,t.jsx)(M,{className:"max-w-md truncate font-mono text-xs",children:(0,t.jsx)(P,{value:c[x]})},x))},p),"s"),a[12]=e.columns,a[13]=s):s=a[13],o=e.rows.map(s),a[9]=e.columns,a[10]=e.rows,a[11]=o}else o=a[11];let d;a[14]!==o?(d=(0,t.jsx)(I,{children:o}),a[14]=o,a[15]=d):d=a[15];let m;return a[16]!==u||a[17]!==d?(m=(0,t.jsxs)(F,{"data-testid":"sql-rows",children:[u,d]}),a[16]=u,a[17]=d,a[18]=m):m=a[18],m},"ne");function Z(r){return(0,t.jsx)(J,{children:r},r)}f(Z,"P");export{na as a,oa as b};
1
+ import{b as P}from"./chunk-3GCIAIU7.js";import{c as K,d as X,e as z,f as L,h as B,i as E,j as G,k as q,l as A,m as O,n as W,o as $,p as D}from"./chunk-P5RUFDVX.js";import{a as F,b as H,c as I,d as S,e as J,f as M}from"./chunk-HEAQVSNS.js";import{d as C,n as j}from"./chunk-FODLDLE2.js";import{a as f,d as T,f as U,g as V}from"./chunk-YKXDMIHQ.js";var N=T(U(),1);var t=T(V(),1);var _=50,R={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},Q=f(r=>{let a=r.columns.find(e=>r.rows.length>0&&r.rows.every(n=>typeof n[e]=="number"))??null;return{label:r.columns.find(e=>e!==a)??null,value:a}},"D"),Y=f(r=>{let a=(0,N.c)(3),{data:e,kind:n}=r,l;return a[0]!==e||a[1]!==n?(l=(0,t.jsx)(G,{className:"h-full w-full",config:R,children:n==="area"?(0,t.jsxs)(E,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(z,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):(0,t.jsxs)(B,{data:e,children:[(0,t.jsx)(K,{vertical:!1}),(0,t.jsx)(L,{axisLine:!1,dataKey:"label",tickLine:!1}),(0,t.jsx)(A,{content:(0,t.jsx)(q,{})}),(0,t.jsx)(X,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),a[0]=e,a[1]=n,a[2]=l):l=a[2],l},"J"),na=f(r=>{let a=(0,N.c)(21),{axes:e,kind:n,result:l}=r,u=C(),o;a[0]!==l?(o=Q(l),a[0]=l,a[1]=o):o=a[1];let d=o,m;a[2]!==l.columns?(m=new Set(l.columns),a[2]=l.columns,a[3]=m):m=a[3];let s=m,c=e!==void 0&&s.has(e.x)?e.x:d.label,p;a[4]!==e?.y||a[5]!==s?(p=e?.y.find(i=>s.has(i)),a[4]=e?.y,a[5]=s,a[6]=p):p=a[6];let x=p,y=x??d.value,b;a[7]!==c||a[8]!==l.rows||a[9]!==y?(b=y===null?[]:l.rows.slice(0,_).map((i,w)=>({label:c===null?`#${(w+1).toString()}`:j(i[c]),value:Number(i[y])||0})),a[7]=c,a[8]=l.rows,a[9]=y,a[10]=b):b=a[10];let k=b;if(y===null){let i;a[11]!==u?(i=u("No numeric column to chart."),a[11]=u,a[12]=i):i=a[12];let w;return a[13]!==i?(w=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:i}),a[13]=i,a[14]=w):w=a[14],w}let h=n??(e!==void 0&&x!==void 0?e.kind:"bar"),v;a[15]!==k||a[16]!==h?(v=h==="bar"?(0,t.jsxs)(O,{className:"h-full w-full",config:R,data:k,children:[(0,t.jsx)($,{dataKey:"label"}),(0,t.jsx)(W,{dataKey:"value"}),(0,t.jsx)(D,{})]}):(0,t.jsx)(Y,{data:k,kind:h}),a[15]=k,a[16]=h,a[17]=v):v=a[17];let g;return a[18]!==h||a[19]!==v?(g=(0,t.jsx)("div",{className:"h-80 w-full p-3","data-chart-kind":h,"data-testid":"sql-chart",children:v}),a[18]=h,a[19]=v,a[20]=g):g=a[20],g},"oe"),oa=f(r=>{let a=(0,N.c)(19),{result:e}=r,n=C();if(e.columns.length===0){let s;a[0]!==e.rowCount||a[1]!==n?(s=n("{count} rows",{count:e.rowCount}),a[0]=e.rowCount,a[1]=n,a[2]=s):s=a[2];let c;return a[3]!==s?(c=(0,t.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:s}),a[3]=s,a[4]=c):c=a[4],c}let l;a[5]!==e.columns?(l=e.columns.map(Z),a[5]=e.columns,a[6]=l):l=a[6];let u;a[7]!==l?(u=(0,t.jsx)(H,{className:"sticky top-0 z-10 bg-muted",children:(0,t.jsx)(S,{children:l})}),a[7]=l,a[8]=u):u=a[8];let o;if(a[9]!==e.columns||a[10]!==e.rows){let s;a[12]!==e.columns?(s=f((c,p)=>(0,t.jsx)(S,{"data-testid":"sql-row",children:e.columns.map(x=>(0,t.jsx)(M,{className:"max-w-md truncate font-mono text-xs",children:(0,t.jsx)(P,{value:c[x]})},x))},p),"s"),a[12]=e.columns,a[13]=s):s=a[13],o=e.rows.map(s),a[9]=e.columns,a[10]=e.rows,a[11]=o}else o=a[11];let d;a[14]!==o?(d=(0,t.jsx)(I,{children:o}),a[14]=o,a[15]=d):d=a[15];let m;return a[16]!==u||a[17]!==d?(m=(0,t.jsxs)(F,{"data-testid":"sql-rows",children:[u,d]}),a[16]=u,a[17]=d,a[18]=m):m=a[18],m},"ne");function Z(r){return(0,t.jsx)(J,{children:r},r)}f(Z,"P");export{na as a,oa as b};
@@ -1 +1 @@
1
- import{a as ee}from"./chunk-5WJXVZMZ.js";import{b as Z}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{d as se,f as X}from"./chunk-EJYDHEAO.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as re}from"./chunk-FKVZRPV5.js";import{a as O}from"./chunk-WUWBZPUK.js";import{d as le,r as ne}from"./chunk-FODLDLE2.js";import{a as k,d as ae,f as ce,g as me,i as Y}from"./chunk-YKXDMIHQ.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"),Pe=k(r=>{let e=(0,te.c)(107),{probe:w}=r,t=le(),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)(re,{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 j=oe?.ok??!1,G=j?"ok":"crit",H,I,P,x,N,v,S,V,b,_;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]!==j||e[34]!==u||e[35]!==t){let s=[...l.checks].toSorted(xe);I="flex flex-col gap-6",P="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 L;e[58]!==t?(L=t("Checked"),e[58]=t,e[59]=L):L=e[59];let T;e[60]!==L?(T=(0,a.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:L}),e[60]=L,e[61]=T):T=e[61];let $;e[62]!==l.timestamp?($=ne(l.timestamp),e[62]=l.timestamp,e[63]=$):$=e[63];let q;e[64]!==$?(q=(0,a.jsx)("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:$}),e[64]=$,e[65]=q):q=e[65];let B;e[66]!==T||e[67]!==q?(B=(0,a.jsxs)("div",{className:"text-end",children:[T,q]}),e[66]=T,e[67]=q,e[68]=B):B=e[68],e[69]!==D||e[70]!==B?(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,B]})}),e[69]=D,e[70]=B,e[71]=N):N=e[71];let E;e[72]!==t?(E=t("Liveness"),e[72]=t,e[73]=E):E=e[73];let R;e[74]!==W||e[75]!==u||e[76]!==E?(R=(0,a.jsx)(ie,{label:E,level:W,testId:"dh-liveness",value:u}),e[74]=W,e[75]=u,e[76]=E,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]!==j||e[81]!==t?(A=t(j?"Ready":"Not ready"),e[80]=j,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],H=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],_=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]=j,e[34]=u,e[35]=t,e[36]=H,e[37]=I,e[38]=P,e[39]=x,e[40]=N,e[41]=v,e[42]=S,e[43]=V,e[44]=b,e[45]=_}else H=e[36],I=e[37],P=e[38],x=e[39],N=e[40],v=e[41],S=e[42],V=e[43],b=e[44],_=e[45];let z;e[94]!==H||e[95]!==S||e[96]!==V||e[97]!==b||e[98]!==_?(z=(0,a.jsxs)(H,{className:S,"data-testid":V,children:[b,_]}),e[94]=H,e[95]=S,e[96]=V,e[97]=b,e[98]=_,e[99]=z):z=e[99];let M;return e[100]!==I||e[101]!==P||e[102]!==x||e[103]!==N||e[104]!==v||e[105]!==z?(M=(0,a.jsxs)("div",{className:I,"data-testid":P,children:[x,N,v,z]}),e[100]=I,e[101]=P,e[102]=x,e[103]=N,e[104]=v,e[105]=z,e[106]=M):M=e[106],M},"Pe");function xe(r,e){return r.name.localeCompare(e.name)}k(xe,"he");export{Pe as DeploymentHealthPanel};
1
+ import{a as ee}from"./chunk-5WJXVZMZ.js";import{b as Z}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{d as se,f as X}from"./chunk-YUZWAZ35.js";import"./chunk-FSRSK4LY.js";import"./chunk-MKL7VDTL.js";import{a as re}from"./chunk-FKVZRPV5.js";import{a as O}from"./chunk-WUWBZPUK.js";import{d as le,r as ne}from"./chunk-FODLDLE2.js";import{a as k,d as ae,f as ce,g as me,i as Y}from"./chunk-YKXDMIHQ.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"),Pe=k(r=>{let e=(0,te.c)(107),{probe:w}=r,t=le(),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)(re,{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 j=oe?.ok??!1,G=j?"ok":"crit",H,I,P,x,N,v,S,V,b,_;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]!==j||e[34]!==u||e[35]!==t){let s=[...l.checks].toSorted(xe);I="flex flex-col gap-6",P="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 L;e[58]!==t?(L=t("Checked"),e[58]=t,e[59]=L):L=e[59];let T;e[60]!==L?(T=(0,a.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:L}),e[60]=L,e[61]=T):T=e[61];let $;e[62]!==l.timestamp?($=ne(l.timestamp),e[62]=l.timestamp,e[63]=$):$=e[63];let q;e[64]!==$?(q=(0,a.jsx)("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:$}),e[64]=$,e[65]=q):q=e[65];let B;e[66]!==T||e[67]!==q?(B=(0,a.jsxs)("div",{className:"text-end",children:[T,q]}),e[66]=T,e[67]=q,e[68]=B):B=e[68],e[69]!==D||e[70]!==B?(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,B]})}),e[69]=D,e[70]=B,e[71]=N):N=e[71];let E;e[72]!==t?(E=t("Liveness"),e[72]=t,e[73]=E):E=e[73];let R;e[74]!==W||e[75]!==u||e[76]!==E?(R=(0,a.jsx)(ie,{label:E,level:W,testId:"dh-liveness",value:u}),e[74]=W,e[75]=u,e[76]=E,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]!==j||e[81]!==t?(A=t(j?"Ready":"Not ready"),e[80]=j,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],H=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],_=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]=j,e[34]=u,e[35]=t,e[36]=H,e[37]=I,e[38]=P,e[39]=x,e[40]=N,e[41]=v,e[42]=S,e[43]=V,e[44]=b,e[45]=_}else H=e[36],I=e[37],P=e[38],x=e[39],N=e[40],v=e[41],S=e[42],V=e[43],b=e[44],_=e[45];let z;e[94]!==H||e[95]!==S||e[96]!==V||e[97]!==b||e[98]!==_?(z=(0,a.jsxs)(H,{className:S,"data-testid":V,children:[b,_]}),e[94]=H,e[95]=S,e[96]=V,e[97]=b,e[98]=_,e[99]=z):z=e[99];let M;return e[100]!==I||e[101]!==P||e[102]!==x||e[103]!==N||e[104]!==v||e[105]!==z?(M=(0,a.jsxs)("div",{className:I,"data-testid":P,children:[x,N,v,z]}),e[100]=I,e[101]=P,e[102]=x,e[103]=N,e[104]=v,e[105]=z,e[106]=M):M=e[106],M},"Pe");function xe(r,e){return r.name.localeCompare(e.name)}k(xe,"he");export{Pe as DeploymentHealthPanel};